Mercurial > gftp.yaz
annotate lib/gftp.h @ 235:1638e32e6a35
2003-7-25 Brian Masney <masneyb@gftp.org>
* lib/gftp.h lib/pty.c - moved including of some PTY related header
files to pty.c. Hopefully should fix build problems under FreeBSD
author | masneyb |
---|---|
date | Fri, 25 Jul 2003 20:46:58 +0000 |
parents | 35ae2e80962e |
children | b42e7233533a |
rev | line source |
---|---|
1 | 1 /*****************************************************************************/ |
2 /* gftp.h - include file for the whole ftp program */ | |
122 | 3 /* Copyright (C) 1998-2003 Brian Masney <masneyb@gftp.org> */ |
1 | 4 /* */ |
5 /* This program is free software; you can redistribute it and/or modify */ | |
6 /* it under the terms of the GNU General Public License as published by */ | |
7 /* the Free Software Foundation; either version 2 of the License, or */ | |
8 /* (at your option) any later version. */ | |
9 /* */ | |
10 /* This program is distributed in the hope that it will be useful, */ | |
11 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ | |
12 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ | |
13 /* GNU General Public License for more details. */ | |
14 /* */ | |
15 /* You should have received a copy of the GNU General Public License */ | |
16 /* along with this program; if not, write to the Free Software */ | |
17 /* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
18 /*****************************************************************************/ | |
19 | |
33 | 20 /* $Id$ */ |
21 | |
1 | 22 #ifndef __GFTP_H |
23 #define __GFTP_H | |
24 | |
25 #ifdef HAVE_CONFIG_H | |
26 #include "config.h" | |
27 #endif | |
28 | |
29 #include <sys/types.h> | |
30 #include <sys/stat.h> | |
31 #include <sys/socket.h> | |
32 #include <sys/time.h> | |
33 #ifndef TIOCGWINSZ | |
34 #include <sys/ioctl.h> | |
35 #endif | |
36 #include <sys/wait.h> | |
37 #include <sys/utsname.h> | |
38 #include <netinet/in.h> | |
39 #include <arpa/inet.h> | |
40 #include <glib.h> | |
41 #include <limits.h> | |
42 #include <netdb.h> | |
43 #include <stdio.h> | |
44 #include <stdarg.h> | |
45 #include <stdlib.h> | |
46 #include <errno.h> | |
47 #include <fcntl.h> | |
48 #include <unistd.h> | |
49 #include <ctype.h> | |
50 #include <time.h> | |
51 #include <utime.h> | |
52 #include <signal.h> | |
53 #include <termios.h> | |
54 #include <pwd.h> | |
55 #include <setjmp.h> | |
56 #include <dirent.h> | |
57 #include <grp.h> | |
58 #include <math.h> | |
59 | |
60 #ifdef HAVE_STRING_H | |
61 #include <string.h> | |
62 #else | |
63 #include <strings.h> | |
64 #endif | |
65 | |
168 | 66 #ifdef USE_SSL |
67 #include <openssl/bio.h> | |
68 #include <openssl/err.h> | |
69 #include <openssl/rand.h> | |
70 #include <openssl/ssl.h> | |
71 #include <openssl/x509v3.h> | |
72 #endif | |
73 | |
1 | 74 #ifdef ENABLE_NLS |
75 #include <libintl.h> | |
76 #include <locale.h> | |
77 #define _(String) gettext (String) | |
78 #else | |
79 #define _(String) String | |
80 #endif | |
81 #define N_(String) String | |
82 | |
83 #ifndef AF_LOCAL | |
84 #define AF_LOCAL AF_UNIX | |
85 #endif | |
86 | |
146 | 87 #ifdef HAVE_GETADDRINFO |
88 #define HAVE_IPV6 | |
151 | 89 #define GFTP_GET_AI_FAMILY(request) (request != NULL && request->hostp != NULL ? request->hostp->ai_family : -1) |
146 | 90 #else |
91 #define GFTP_GET_AI_FAMILY(request) AF_INET | |
92 #endif | |
93 | |
48 | 94 /* We need the major() and minor() macros in the user interface. If they aren't |
95 defined by the system, we'll just define them here. */ | |
96 #ifndef major | |
97 #warning major macro was not defined by the system. Defining one that is probably wrong for your system | |
98 #define major(dev) (((dev) >> 8) & 0xff) | |
99 #endif | |
100 | |
101 #ifndef minor | |
102 #warning minor macro was not defined by the system. Defining one that is probably wrong for your system | |
103 #define minor(dev) ((dev) & 0xff) | |
104 #endif | |
105 | |
201 | 106 #ifdef WITH_DMALLOC |
107 | |
108 #undef g_malloc | |
109 #define g_malloc(size) \ | |
110 _malloc_leap(__FILE__, __LINE__, size) | |
111 | |
112 #undef g_malloc0 | |
113 #define g_malloc0(size) \ | |
114 _calloc_leap(__FILE__, __LINE__, 1, size) | |
115 | |
116 #undef g_realloc | |
117 #define g_realloc(ptr, size) \ | |
118 _realloc_leap(__FILE__, __LINE__, ptr, size) | |
119 | |
120 #undef g_strdup | |
121 #define g_strdup(str) \ | |
122 _strdup_leap(__FILE__, __LINE__, str) | |
123 | |
124 #undef g_free | |
125 #define g_free(ptr) \ | |
126 _free_leap(__FILE__, __LINE__, ptr) | |
127 | |
1 | 128 #include <dmalloc.h> |
201 | 129 |
1 | 130 #endif |
131 | |
91 | 132 /* Server types (used by FTP protocol from SYST command) */ |
122 | 133 #define GFTP_DIRTYPE_UNIX 1 |
134 #define GFTP_DIRTYPE_EPLF 2 | |
135 #define GFTP_DIRTYPE_CRAY 3 | |
136 #define GFTP_DIRTYPE_NOVELL 4 | |
137 #define GFTP_DIRTYPE_DOS 5 | |
138 #define GFTP_DIRTYPE_VMS 6 | |
139 #define GFTP_DIRTYPE_OTHER 7 | |
91 | 140 |
84 | 141 /* Error types */ |
142 #define GFTP_ERETRYABLE -1 | |
143 #define GFTP_EFATAL -2 | |
144 | |
1 | 145 /* Some general settings */ |
146 #define BASE_CONF_DIR "~/.gftp" | |
147 #define CONFIG_FILE BASE_CONF_DIR "/gftprc" | |
148 #define BOOKMARKS_FILE BASE_CONF_DIR "/bookmarks" | |
149 #define LOG_FILE BASE_CONF_DIR "/gftp.log" | |
150 #define MAX_HIST_LEN 10 | |
151 | |
152 typedef enum gftp_transfer_type_tag | |
153 { | |
154 gftp_transfer_passive, | |
155 gftp_transfer_active | |
156 } gftp_transfer_type; | |
157 | |
158 | |
159 typedef enum gftp_logging_level_tag | |
160 { | |
161 gftp_logging_send, | |
162 gftp_logging_recv, | |
163 gftp_logging_error, | |
164 gftp_logging_misc | |
165 } gftp_logging_level; | |
166 | |
167 typedef struct gftp_file_tag gftp_file; | |
168 | |
169 #define GFTP_TRANS_ACTION_OVERWRITE 1 | |
170 #define GFTP_TRANS_ACTION_RESUME 2 | |
171 #define GFTP_TRANS_ACTION_SKIP 3 | |
172 | |
173 #define GFTP_DIRECTION_DOWNLOAD 0 | |
174 #define GFTP_DIRECTION_UPLOAD 1 | |
175 | |
16 | 176 #define GFTP_SORT_COL_FILE 1 |
177 #define GFTP_SORT_COL_SIZE 2 | |
178 #define GFTP_SORT_COL_USER 3 | |
179 #define GFTP_SORT_COL_GROUP 4 | |
180 #define GFTP_SORT_COL_DATETIME 5 | |
181 #define GFTP_SORT_COL_ATTRIBS 6 | |
182 | |
1 | 183 struct gftp_file_tag |
184 { | |
185 char *file, /* Our filename */ | |
184 | 186 *utf8_file, /* UTF-8 encoded filename for display purposes |
187 only. This is only set if file is not in | |
188 UTF-8 */ | |
1 | 189 *user, /* User that owns it */ |
190 *group, /* Group that owns it */ | |
191 *attribs, /* Attribs (-rwxr-x-rx) */ | |
192 *destfile; /* Full pathname to the destination for the | |
193 file transfer */ | |
122 | 194 |
195 int fd; /* Already open fd for this file */ | |
196 /* FIXME - add fd_open function */ | |
197 | |
1 | 198 time_t datetime; /* File date and time */ |
14
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
1
diff
changeset
|
199 off_t size, /* Size of the file */ |
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
1
diff
changeset
|
200 startsize; /* Size to start the transfer at */ |
1 | 201 unsigned int isdir : 1, /* File type */ |
202 isexe : 1, | |
203 islink : 1, | |
204 selected : 1, /* Is this file selected? */ | |
205 was_sel : 1, /* Was this file selected before */ | |
206 shown : 1, /* Is this file shown? */ | |
207 done_view : 1, /* View the file when done transfering? */ | |
208 done_edit : 1, /* Edit the file when done transfering? */ | |
209 done_rm : 1, /* Remove the file when done */ | |
210 transfer_done : 1, /* Is current file transfer done? */ | |
211 is_fd : 1; /* Is this a file descriptor? */ | |
212 char transfer_action; /* See the GFTP_TRANS_ACTION_* vars above */ | |
122 | 213 void *user_data; |
1 | 214 }; |
215 | |
216 | |
217 typedef struct gftp_proxy_hosts_tag | |
218 { | |
122 | 219 /* FIXME - add IPV4 stuff here */ |
220 | |
221 gint32 ipv4_network_address, | |
1 | 222 ipv4_netmask; |
223 char *domain; | |
224 } gftp_proxy_hosts; | |
225 | |
136 | 226 |
227 /* Note, these numbers must match up to the index number in config_file.c | |
228 in the declaration of gftp_option_types */ | |
229 typedef enum | |
230 { | |
231 gftp_option_type_text = 0, | |
232 gftp_option_type_textcombo = 1, | |
233 gftp_option_type_textcomboedt = 2, | |
234 gftp_option_type_hidetext = 3, | |
235 gftp_option_type_int = 4, | |
236 gftp_option_type_checkbox = 5, | |
237 gftp_option_type_intcombo = 6, | |
238 gftp_option_type_float = 7, | |
239 gftp_option_type_color = 8, | |
240 gftp_option_type_notebook = 9 | |
241 } gftp_option_type_enum; | |
242 | |
243 | |
244 #define GFTP_PORT_GTK (1 << 1) | |
245 #define GFTP_PORT_TEXT (1 << 2) | |
246 #define GFTP_PORT_ALL (GFTP_PORT_GTK | GFTP_PORT_TEXT) | |
247 | |
248 | |
249 typedef struct gftp_config_list_vars_tag | |
250 { | |
251 char *key; | |
252 void * (*read_func) (char *buf, int line); | |
253 void (*write_func) (FILE *fd, void *data); | |
254 GList * list; | |
255 unsigned int num_items; | |
256 char *header; | |
257 } gftp_config_list_vars; | |
258 | |
259 | |
201 | 260 #define GFTP_CVARS_FLAGS_DYNMEM (1 << 1) |
261 #define GFTP_CVARS_FLAGS_DYNLISTMEM (1 << 2) | |
227 | 262 #define GFTP_CVARS_FLAGS_SHOW_BOOKMARK (1 << 3) |
136 | 263 |
264 typedef struct gftp_config_vars_tag | |
265 { | |
266 char *key, /* variable name */ | |
267 *description; /* How this field will show up in the dialog */ | |
268 int otype; /* Type of option this is */ | |
269 void *value; | |
270 void *listdata; /* For options that have several different | |
271 options, this is a list of all the options. | |
272 Each option_type that uses this will use this | |
273 field differently */ | |
274 int flags; /* See GFTP_CVARS_FLAGS_* above */ | |
275 char *comment; /* Comment to write out to the config file */ | |
276 int ports_shown; /* What ports of gFTP is this option shown in */ | |
277 void *user_data; /* Data that the GUI can store here (Widget in gtk+) */ | |
278 } gftp_config_vars; | |
279 | |
280 | |
281 typedef struct gftp_option_type_tag | |
282 { | |
283 int (*read_function) (char *str, gftp_config_vars * cv, int line); | |
284 int (*write_function) (gftp_config_vars * cv, FILE * fd, int to_config_file); | |
207 | 285 void (*copy_function) (gftp_config_vars * cv, gftp_config_vars * dest_cv); |
227 | 286 int (*compare_function) (gftp_config_vars * cv1, gftp_config_vars * cv2); |
229 | 287 void *(*ui_print_function) (gftp_config_vars * cv, void *user_data, void *value); |
136 | 288 void (*ui_save_function) (gftp_config_vars * cv, void *user_data); |
139 | 289 void (*ui_cancel_function) (gftp_config_vars * cv, void *user_data); |
136 | 290 void *user_data; |
291 } gftp_option_type_var; | |
292 | |
293 | |
294 #define GFTP_TEXTCOMBOEDT_EDITABLE (1 << 0) | |
295 | |
296 typedef struct gftp_textcomboedt_data_tag | |
297 { | |
298 char *description, | |
299 *text; | |
300 int flags; | |
301 } gftp_textcomboedt_data; | |
302 | |
303 | |
1 | 304 typedef struct gftp_request_tag gftp_request; |
305 | |
186 | 306 typedef void (*gftp_logging_func) ( gftp_logging_level level, |
307 gftp_request * request, | |
308 const char *string, ... ); | |
309 | |
1 | 310 struct gftp_request_tag |
311 { | |
312 int protonum; /* Current number of the protocol this is | |
313 set to */ | |
314 char *hostname, /* Hostname we will connect to */ | |
315 *username, /* Username for host*/ | |
316 *password, /* Password for host */ | |
317 *account, /* Account for host (FTP only) */ | |
318 *directory, /* Current working directory */ | |
319 *url_prefix, /* URL Prefix (ex: ftp) */ | |
320 *last_ftp_response, /* Last response from server */ | |
321 *last_dir_entry; /* Last dir entry from server */ | |
322 size_t last_dir_entry_len; /* Length of last_dir_entry */ | |
323 | |
122 | 324 unsigned int port; /* Port of remote site */ |
1 | 325 |
169 | 326 int datafd, /* Data connection */ |
58 | 327 cachefd; /* For the directory cache */ |
1 | 328 int wakeup_main_thread[2]; /* FD that gets written to by the threads |
329 to wakeup the parent */ | |
122 | 330 |
331 /* One of these are used to lookup the IP address of the host we are | |
332 connecting to */ | |
1 | 333 #if defined (HAVE_GETADDRINFO) && defined (HAVE_GAI_STRERROR) |
122 | 334 struct addrinfo *hostp; |
1 | 335 #else |
122 | 336 struct hostent host, *hostp; |
1 | 337 #endif |
338 | |
122 | 339 int server_type; /* The type of server we are connected to. |
340 See GFTP_DIRTYPE_* above */ | |
151 | 341 unsigned int free_hostp : 1, /* Should we free the hostp structure |
342 in gftp_destroy_request() */ | |
343 use_proxy : 1, | |
1 | 344 always_connected : 1, |
345 need_hostport : 1, | |
346 need_userpass : 1, | |
347 use_cache : 1, /* Enable or disable the cache */ | |
348 use_threads : 1, /* Whether we need to spawn a thread | |
349 for this protocol */ | |
350 cached : 1, /* Is this directory listing cached? */ | |
41 | 351 cancel : 1, /* If a signal is received, should |
352 we cancel this operation */ | |
1 | 353 stopable : 1; |
354 | |
355 off_t gotbytes; | |
356 | |
357 void *protocol_data; | |
358 | |
359 gftp_logging_func logging_function; | |
360 void *user_data; | |
361 | |
173 | 362 int (*init) ( gftp_request * request ); |
168 | 363 ssize_t (*read_function) ( gftp_request * request, |
364 void *ptr, | |
365 size_t size, | |
366 int fd ); | |
367 ssize_t (*write_function) ( gftp_request * request, | |
368 const char *ptr, | |
369 size_t size, | |
370 int fd ); | |
1 | 371 void (*destroy) ( gftp_request * request ); |
372 int (*connect) ( gftp_request * request ); | |
168 | 373 int (*post_connect) ( gftp_request * request ); |
1 | 374 void (*disconnect) ( gftp_request * request ); |
58 | 375 off_t (*get_file) ( gftp_request * request, |
1 | 376 const char *filename, |
58 | 377 int fd, |
1 | 378 off_t startsize ); |
379 int (*put_file) ( gftp_request * request, | |
380 const char *filename, | |
58 | 381 int fd, |
1 | 382 off_t startsize, |
383 off_t totalsize ); | |
384 long (*transfer_file) ( gftp_request * fromreq, | |
385 const char *fromfile, | |
386 off_t fromsize, | |
387 gftp_request * toreq, | |
388 const char *tofile, | |
389 off_t tosize ); | |
58 | 390 ssize_t (*get_next_file_chunk) ( gftp_request * request, |
1 | 391 char *buf, |
392 size_t size ); | |
58 | 393 ssize_t (*put_next_file_chunk) ( gftp_request * request, |
1 | 394 char *buf, |
395 size_t size ); | |
396 int (*end_transfer) ( gftp_request * request ); | |
40 | 397 int (*abort_transfer) ( gftp_request * request ); |
1 | 398 int (*list_files) ( gftp_request * request ); |
399 int (*get_next_file) ( gftp_request * request, | |
400 gftp_file *fle, | |
58 | 401 int fd ); |
1 | 402 off_t (*get_file_size) ( gftp_request * request, |
403 const char *filename ); | |
404 int (*chdir) ( gftp_request * request, | |
405 const char *directory ); | |
406 int (*rmdir) ( gftp_request * request, | |
407 const char *directory ); | |
408 int (*rmfile) ( gftp_request * request, | |
409 const char *filename ); | |
410 int (*mkdir) ( gftp_request * request, | |
411 const char *directory ); | |
412 int (*rename) ( gftp_request * request, | |
413 const char *oldname, | |
414 const char *newname ); | |
415 int (*chmod) ( gftp_request * request, | |
416 const char *filename, | |
417 int mode ); | |
418 int (*set_file_time) ( gftp_request * request, | |
419 const char *filename, | |
420 time_t datettime ); | |
421 int (*site) ( gftp_request * request, | |
422 const char *filename ); | |
423 int (*parse_url) ( gftp_request * request, | |
424 const char *url ); | |
177 | 425 int (*set_config_options) ( gftp_request * request ); |
63 | 426 void (*swap_socks) ( gftp_request * dest, |
427 gftp_request * source ); | |
1 | 428 |
136 | 429 gftp_config_vars * local_options_vars; |
430 int num_local_options_vars; | |
431 GHashTable * local_options_hash; | |
168 | 432 #ifdef USE_SSL |
433 SSL * ssl; | |
434 #endif | |
184 | 435 |
436 #if GLIB_MAJOR_VERSION > 1 | |
437 GIConv iconv; | |
438 unsigned int iconv_initialized : 1; | |
439 #endif | |
1 | 440 }; |
441 | |
442 | |
136 | 443 typedef struct gftp_transfer_tag |
1 | 444 { |
445 gftp_request * fromreq, | |
446 * toreq; | |
447 | |
448 unsigned int transfer_direction : 1, | |
449 cancel : 1, | |
450 ready : 1, | |
451 started : 1, | |
452 done : 1, | |
453 show : 1, | |
454 stalled : 1, | |
455 next_file : 1, | |
14
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
1
diff
changeset
|
456 skip_file : 1; |
1 | 457 |
458 struct timeval starttime, | |
459 lasttime; | |
460 | |
461 double kbs; | |
462 | |
463 GList * files, | |
464 * curfle, | |
465 * updfle; | |
466 | |
19 | 467 long numfiles, |
468 numdirs, | |
469 current_file_number, | |
470 current_file_retries; | |
1 | 471 |
472 off_t curtrans, /* Current transfered bytes for this file */ | |
473 curresumed, /* Resumed bytes for this file */ | |
474 trans_bytes, /* Amount of data transfered for entire | |
475 transfer */ | |
476 total_bytes, /* Grand total bytes for whole transfer */ | |
477 resumed_bytes; /* Grand total of resumed bytes for whole | |
478 transfer */ | |
479 | |
480 void * fromwdata, | |
481 * towdata; | |
482 | |
122 | 483 GStaticMutex statmutex, |
484 structmutex; | |
485 | |
125 | 486 void *user_data; |
1 | 487 void *clist; |
136 | 488 } gftp_transfer; |
1 | 489 |
490 | |
491 typedef struct gftp_log_tag | |
492 { | |
493 char *msg; | |
494 gftp_logging_level type; | |
495 } gftp_log; | |
496 | |
497 | |
498 typedef struct supported_gftp_protocols_tag | |
499 { | |
500 char *name; /* Description of protocol */ | |
173 | 501 int (*init) (gftp_request * request); /* Init function */ |
122 | 502 void (*register_options) (void); /* Protocol options */ |
1 | 503 char *url_prefix; /* URL Prefix */ |
122 | 504 int shown; /* Whether this protocol is |
505 shown or not to the user in | |
506 the protocol dropdown box */ | |
1 | 507 } supported_gftp_protocols; |
508 | |
509 | |
122 | 510 typedef struct gftp_bookmarks_tag gftp_bookmarks_var; |
1 | 511 |
512 struct gftp_bookmarks_tag | |
513 { | |
514 char *path; /* Path */ | |
515 char *hostname, /* Our actual internet hostname */ | |
516 *protocol, /* Protocol we will connect through */ | |
517 *remote_dir, /* Initial directory */ | |
518 *local_dir, /* Init local directory */ | |
519 *user, /* Username to log in as */ | |
520 *pass, /* Our password */ | |
521 *acct; /* Account */ | |
522 | |
523 unsigned int port, /* The port we will connect to */ | |
524 isfolder : 1, /* If this is set, then the children field can | |
525 be non-NULL */ | |
526 save_password : 1; /* Save this password */ | |
122 | 527 gftp_bookmarks_var *children, /* The children of this node. */ |
528 *prev, /* The parent of this node */ | |
529 *next; /* The next sibling of this node */ | |
1 | 530 gpointer cnode; |
531 | |
199 | 532 gftp_config_vars * local_options_vars; |
533 int num_local_options_vars; | |
534 GHashTable * local_options_hash; | |
1 | 535 }; |
536 | |
537 | |
538 typedef struct gftp_file_extensions_tag | |
539 { | |
540 char *ext, /* The file extension to register */ | |
541 *filename, /* The xpm file to display */ | |
542 *view_program, /* The program used to view this file */ | |
543 *ascii_binary; /* Is this a ASCII transfer or a BINARY transfer */ | |
544 int stlen; /* How long is the file extension. */ | |
545 } gftp_file_extensions; | |
546 | |
547 | |
548 typedef struct gftp_color_tag | |
549 { | |
550 gushort red, | |
551 green, | |
552 blue; | |
553 } gftp_color; | |
554 | |
555 | |
58 | 556 typedef struct gftp_getline_buffer_tag |
557 { | |
558 char *buffer, | |
559 *curpos; | |
560 size_t max_bufsize, | |
561 cur_bufsize; | |
179 | 562 unsigned int eof : 1; |
58 | 563 } gftp_getline_buffer; |
564 | |
126 | 565 |
122 | 566 /* Global config options. These are defined in options.h */ |
567 extern GList * gftp_file_transfers, * gftp_file_transfer_logs, | |
568 * gftp_options_list; | |
569 extern GHashTable * gftp_global_options_htable, * gftp_bookmarks_htable, | |
570 * gftp_config_list_htable; | |
571 extern gftp_config_vars gftp_global_config_vars[]; | |
1 | 572 extern supported_gftp_protocols gftp_protocols[]; |
122 | 573 extern gftp_bookmarks_var * gftp_bookmarks; |
574 extern char gftp_version[]; | |
575 extern FILE * gftp_logfd; | |
201 | 576 extern int gftp_configuration_changed; |
122 | 577 |
578 /* This is defined in config_file.c */ | |
579 | |
580 extern gftp_option_type_var gftp_option_types[]; | |
1 | 581 |
582 /* cache.c */ | |
182 | 583 void gftp_generate_cache_description ( gftp_request * request, |
584 char *description, | |
585 size_t len, | |
586 int ignore_directory ); | |
587 | |
58 | 588 int gftp_new_cache_entry ( gftp_request * request ); |
1 | 589 |
58 | 590 int gftp_find_cache_entry ( gftp_request * request ); |
1 | 591 |
592 void gftp_clear_cache_files ( void ); | |
593 | |
47 | 594 void gftp_delete_cache_entry ( gftp_request * request, |
182 | 595 char *descr, |
47 | 596 int ignore_directory ); |
1 | 597 |
598 /* config_file.c */ | |
198 | 599 int gftp_config_parse_args ( char *str, |
600 int numargs, | |
601 int lineno, | |
602 char **first, | |
603 ... ); | |
604 | |
122 | 605 void gftp_add_bookmark ( gftp_bookmarks_var * newentry ); |
606 | |
124 | 607 void gftp_read_config_file ( char *global_data_path ); |
1 | 608 |
122 | 609 void gftp_write_bookmarks_file ( void ); |
1 | 610 |
611 void gftp_write_config_file ( void ); | |
612 | |
122 | 613 GHashTable * build_bookmarks_hash_table ( gftp_bookmarks_var * entry ); |
614 | |
615 void print_bookmarks ( gftp_bookmarks_var * bookmarks ); | |
616 | |
617 void gftp_lookup_global_option ( char * key, | |
618 void *value ); | |
26 | 619 |
122 | 620 void gftp_lookup_request_option ( gftp_request * request, |
621 char * key, | |
622 void *value ); | |
1 | 623 |
229 | 624 void gftp_lookup_bookmark_option ( gftp_bookmarks_var * bm, |
625 char * key, | |
626 void *value ); | |
627 | |
122 | 628 void gftp_set_global_option ( char * key, |
227 | 629 const void *value ); |
122 | 630 |
631 void gftp_set_request_option ( gftp_request * request, | |
632 char * key, | |
229 | 633 const void *value ); |
634 | |
635 void gftp_set_bookmark_option ( gftp_bookmarks_var * bm, | |
636 char * key, | |
637 const void *value ); | |
122 | 638 |
639 void gftp_register_config_vars ( gftp_config_vars *config_vars ); | |
1 | 640 |
201 | 641 void gftp_copy_local_options ( gftp_config_vars ** new_options_vars, |
642 GHashTable ** new_options_hash, | |
643 gftp_config_vars * orig_options, | |
644 int num_local_options_vars ); | |
645 | |
646 void gftp_config_free_options ( gftp_config_vars * options_vars, | |
647 GHashTable * options_hash, | |
648 int num_options_vars ); | |
649 | |
650 void gftp_bookmarks_destroy ( gftp_bookmarks_var * bookmarks ); | |
651 | |
218 | 652 void gftp_free_proxy_hosts ( GList * proxy_hosts ); |
653 | |
654 GList * gftp_copy_proxy_hosts ( GList * proxy_hosts ); | |
655 | |
1 | 656 /* misc.c */ |
14
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
1
diff
changeset
|
657 char *insert_commas ( off_t number, |
1 | 658 char *dest_str, |
659 size_t dest_len ); | |
660 | |
661 char *alltrim ( char *str ); | |
662 | |
663 char *expand_path ( const char *src ); | |
664 | |
665 void remove_double_slashes ( char *string ); | |
666 | |
667 void make_nonnull ( char **str ); | |
668 | |
669 int copyfile ( char *source, | |
670 char *dest ); | |
671 | |
672 int gftp_match_filespec ( char *filename, | |
673 char *filespec ); | |
674 | |
675 int gftp_parse_command_line ( int *argc, | |
676 char ***argv ); | |
677 | |
678 void gftp_usage ( void ); | |
679 | |
680 gint string_hash_compare ( gconstpointer path1, | |
681 gconstpointer path2 ); | |
682 | |
683 guint string_hash_function ( gconstpointer key ); | |
684 | |
685 void free_file_list ( GList * filelist ); | |
686 | |
687 void free_fdata ( gftp_file * fle ); | |
688 | |
689 gftp_file * copy_fdata ( gftp_file * fle ); | |
690 | |
691 int compare_request ( gftp_request * request1, | |
692 gftp_request * request2, | |
693 int compare_dirs ); | |
694 | |
129 | 695 gftp_transfer * gftp_tdata_new ( void ); |
696 | |
1 | 697 void free_tdata ( gftp_transfer * tdata ); |
698 | |
151 | 699 gftp_request * copy_request ( gftp_request * req, |
700 int copy_local_options ); | |
1 | 701 |
16 | 702 GList * gftp_sort_filelist ( GList * filelist, |
703 int column, | |
704 int asds ); | |
705 | |
125 | 706 mode_t gftp_parse_attribs ( char *attribs ); |
707 | |
131 | 708 char * gftp_gen_ls_string ( gftp_file * fle, |
709 char *file_prefixstr, | |
710 char *file_suffixstr ); | |
711 | |
168 | 712 char * base64_encode ( char *str ); |
713 | |
199 | 714 void gftp_free_bookmark ( gftp_bookmarks_var * entry ); |
715 | |
201 | 716 void gftp_shutdown ( void ); |
199 | 717 |
207 | 718 GList * get_next_selection ( GList * selection, |
719 GList ** list, | |
720 int *curnum ); | |
721 | |
227 | 722 #if GLIB_MAJOR_VERSION == 1 |
723 | |
724 gchar * g_build_path ( const gchar *separator, | |
725 const gchar *first_element, | |
726 ... ); | |
727 | |
728 #endif | |
729 | |
1 | 730 /* protocols.c */ |
731 #define GFTP_FTP_NUM 0 | |
732 #define GFTP_HTTP_NUM 1 | |
168 | 733 #define GFTP_HTTPS_NUM 2 |
734 #define GFTP_LOCAL_NUM 3 | |
735 #define GFTP_SSHV2_NUM 4 | |
736 #define GFTP_BOOKMARK_NUM 5 | |
122 | 737 |
1 | 738 #define GFTP_IS_CONNECTED(request) ((request) != NULL && \ |
169 | 739 ((request)->datafd > 0 || \ |
58 | 740 (request)->cached || \ |
741 (request)->always_connected)) | |
1 | 742 |
743 | |
173 | 744 int rfc959_init ( gftp_request * request ); |
1 | 745 |
122 | 746 void rfc959_register_module ( void ); |
747 | |
1 | 748 int rfc959_get_next_file ( gftp_request * request, |
749 gftp_file *fle, | |
58 | 750 int fd ); |
1 | 751 |
173 | 752 int rfc2068_init ( gftp_request * request ); |
1 | 753 |
122 | 754 void rfc2068_register_module ( void ); |
755 | |
173 | 756 int https_init ( gftp_request * request ); |
168 | 757 |
758 void https_register_module ( void ); | |
759 | |
173 | 760 int local_init ( gftp_request * request ); |
1 | 761 |
122 | 762 void local_register_module ( void ); |
763 | |
173 | 764 int sshv2_init ( gftp_request * request ); |
1 | 765 |
122 | 766 void sshv2_register_module ( void ); |
767 | |
174 | 768 void ssl_register_module ( void ); |
769 | |
173 | 770 int bookmark_init ( gftp_request * request ); |
1 | 771 |
122 | 772 void bookmark_register_module ( void ); |
773 | |
1 | 774 gftp_request *gftp_request_new ( void ); |
775 | |
67 | 776 void gftp_request_destroy ( gftp_request * request, |
777 int free_request ); | |
1 | 778 |
779 void gftp_file_destroy ( gftp_file *file ); | |
780 | |
781 int gftp_connect ( gftp_request * request ); | |
782 | |
783 void gftp_disconnect ( gftp_request * request ); | |
784 | |
58 | 785 off_t gftp_get_file ( gftp_request * request, |
1 | 786 const char *filename, |
58 | 787 int fd, |
1 | 788 size_t startsize ); |
789 | |
790 int gftp_put_file ( gftp_request * request, | |
791 const char *filename, | |
58 | 792 int fd, |
1 | 793 size_t startsize, |
794 size_t totalsize ); | |
795 | |
796 long gftp_transfer_file ( gftp_request *fromreq, | |
797 const char *fromfile, | |
58 | 798 int fromfd, |
1 | 799 size_t fromsize, |
800 gftp_request *toreq, | |
801 const char *tofile, | |
58 | 802 int tofd, |
1 | 803 size_t tosize ); |
804 | |
58 | 805 ssize_t gftp_get_next_file_chunk ( gftp_request * request, |
1 | 806 char *buf, |
807 size_t size ); | |
808 | |
58 | 809 ssize_t gftp_put_next_file_chunk ( gftp_request * request, |
1 | 810 char *buf, |
811 size_t size ); | |
812 | |
813 int gftp_list_files ( gftp_request * request ); | |
814 | |
186 | 815 #if GLIB_MAJOR_VERSION > 1 |
816 char * gftp_string_to_utf8 ( gftp_request * request, | |
817 char *str ); | |
818 #endif | |
819 | |
87 | 820 int gftp_parse_bookmark ( gftp_request * request, |
821 const char * bookmark ); | |
822 | |
1 | 823 int gftp_parse_url ( gftp_request * request, |
824 const char *url ); | |
825 | |
826 int gftp_get_next_file ( gftp_request * request, | |
827 char *filespec, | |
828 gftp_file *fle ); | |
829 | |
830 int gftp_end_transfer ( gftp_request * request ); | |
831 | |
40 | 832 int gftp_abort_transfer ( gftp_request * request ); |
833 | |
1 | 834 void gftp_set_hostname ( gftp_request * request, |
835 const char *hostname ); | |
836 | |
837 void gftp_set_username ( gftp_request * request, | |
838 const char *username ); | |
839 | |
840 void gftp_set_password ( gftp_request * request, | |
841 const char *password ); | |
842 | |
843 void gftp_set_account ( gftp_request * request, | |
844 const char *account ); | |
845 | |
846 int gftp_set_directory ( gftp_request * request, | |
847 const char *directory ); | |
848 | |
849 void gftp_set_port ( gftp_request * request, | |
850 unsigned int port ); | |
851 | |
852 int gftp_remove_directory ( gftp_request * request, | |
853 const char *directory ); | |
854 | |
855 int gftp_remove_file ( gftp_request * request, | |
856 const char *file ); | |
857 | |
858 int gftp_make_directory ( gftp_request * request, | |
859 const char *directory ); | |
860 | |
861 int gftp_rename_file ( gftp_request * request, | |
862 const char *oldname, | |
863 const char *newname ); | |
864 | |
865 int gftp_chmod ( gftp_request * request, | |
866 const char *file, | |
867 int mode ); | |
868 | |
869 int gftp_set_file_time ( gftp_request * request, | |
870 const char *file, | |
871 time_t datetime ); | |
872 | |
873 char gftp_site_cmd ( gftp_request * request, | |
874 const char *command ); | |
875 | |
58 | 876 off_t gftp_get_file_size ( gftp_request * request, |
1 | 877 const char *filename ); |
878 | |
879 void gftp_calc_kbs ( gftp_transfer * tdata, | |
880 ssize_t num_read ); | |
881 | |
102 | 882 time_t parse_time ( char *str, |
883 char **endpos ); | |
884 | |
91 | 885 int gftp_parse_ls ( gftp_request * request, |
886 const char *lsoutput, | |
1 | 887 gftp_file *fle ); |
888 | |
889 int gftp_get_all_subdirs ( gftp_transfer * transfer, | |
890 void (*update_func) | |
891 ( gftp_transfer * transfer )); | |
892 | |
893 int gftp_connect_server ( gftp_request * request, | |
122 | 894 char *service, |
895 char *proxy_hostname, | |
896 int proxy_port ); | |
1 | 897 |
122 | 898 #if !defined (HAVE_GETADDRINFO) || !defined (HAVE_GAI_STRERROR) |
1 | 899 |
900 struct hostent *r_gethostbyname ( const char *name, | |
901 struct hostent *result_buf, | |
902 int *h_errnop ); | |
903 | |
56 | 904 #endif |
905 | |
1 | 906 struct servent *r_getservbyname ( const char *name, |
907 const char *proto, | |
908 struct servent *result_buf, | |
909 int *h_errnop ); | |
122 | 910 |
177 | 911 int gftp_set_config_options ( gftp_request * request ); |
1 | 912 |
913 void print_file_list ( GList * list ); | |
914 | |
201 | 915 void gftp_free_getline_buffer ( gftp_getline_buffer ** rbuf ); |
168 | 916 |
58 | 917 ssize_t gftp_get_line ( gftp_request * request, |
918 gftp_getline_buffer ** rbuf, | |
41 | 919 char * str, |
920 size_t len, | |
58 | 921 int fd ); |
922 | |
168 | 923 ssize_t gftp_fd_read ( gftp_request * request, |
58 | 924 void *ptr, |
925 size_t size, | |
926 int fd ); | |
41 | 927 |
168 | 928 ssize_t gftp_fd_write ( gftp_request * request, |
58 | 929 const char *ptr, |
41 | 930 size_t size, |
58 | 931 int fd ); |
932 | |
933 ssize_t gftp_writefmt ( gftp_request * request, | |
934 int fd, | |
935 const char *fmt, | |
936 ... ); | |
937 | |
168 | 938 int gftp_fd_set_sockblocking ( gftp_request * request, |
58 | 939 int fd, |
940 int non_blocking ); | |
41 | 941 |
63 | 942 void gftp_swap_socks ( gftp_request * dest, |
943 gftp_request * source ); | |
944 | |
122 | 945 void gftp_calc_kbs ( gftp_transfer * tdata, |
946 ssize_t num_read ); | |
947 | |
125 | 948 int gftp_get_transfer_status ( gftp_transfer * tdata, |
949 ssize_t num_read ); | |
950 | |
182 | 951 int gftp_fd_open ( gftp_request * request, |
952 const char *pathname, | |
953 int flags, | |
954 mode_t perms ); | |
955 | |
146 | 956 /* pty.c */ |
210 | 957 char * gftp_get_pty_impl ( void ); |
179 | 958 |
210 | 959 pid_t gftp_exec_with_new_pty ( gftp_request * request, |
146 | 960 int *fdm, |
210 | 961 char **args ); |
146 | 962 |
210 | 963 pid_t gftp_exec_without_new_pty ( gftp_request * request, |
964 int *fdm, | |
965 char **args ); | |
146 | 966 |
168 | 967 #ifdef USE_SSL |
968 /* sslcommon.c */ | |
969 int gftp_ssl_startup ( gftp_request * request ); | |
970 | |
971 int gftp_ssl_session_setup ( gftp_request * request ); | |
972 | |
973 void gftp_ssl_free ( gftp_request * request ); | |
974 | |
975 ssize_t gftp_ssl_read ( gftp_request * request, | |
976 void *ptr, | |
977 size_t size, | |
978 int fd ); | |
979 | |
980 ssize_t gftp_ssl_write ( gftp_request * request, | |
981 const char *ptr, | |
982 size_t size, | |
983 int fd ); | |
984 #endif /* USE_SSL */ | |
985 | |
1 | 986 #endif |
987 |