Mercurial > gftp.yaz
annotate lib/gftp.h @ 338:0f34108f27b7
2003-12-10 Brian Masney <masneyb@gftp.org>
* lib/gftp.h src/text/gftp-text.h src/gtk/gftp-gtk.h - added
GFTP_LOG_FUNCTION_ATTRIBUTES that is only defined when compiled
against gcc. When this is set, it will specify the function is
printf() type function so that extra checks can be done by the
compiler. This is to fix problems with older Sun compilers.
author | masneyb |
---|---|
date | Sat, 13 Dec 2003 20:52:14 +0000 |
parents | 532eb171d5c2 |
children | eedc2c5727fa |
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 | |
325 | 60 #ifdef HAVE_STDINT_H |
61 #include <stdint.h> | |
62 #endif | |
63 | |
1 | 64 #ifdef HAVE_STRING_H |
65 #include <string.h> | |
66 #else | |
67 #include <strings.h> | |
68 #endif | |
69 | |
168 | 70 #ifdef USE_SSL |
71 #include <openssl/bio.h> | |
72 #include <openssl/err.h> | |
73 #include <openssl/rand.h> | |
74 #include <openssl/ssl.h> | |
75 #include <openssl/x509v3.h> | |
76 #endif | |
77 | |
1 | 78 #ifdef ENABLE_NLS |
79 #include <libintl.h> | |
80 #include <locale.h> | |
81 #define _(String) gettext (String) | |
82 #else | |
83 #define _(String) String | |
84 #endif | |
85 #define N_(String) String | |
86 | |
87 #ifndef AF_LOCAL | |
88 #define AF_LOCAL AF_UNIX | |
89 #endif | |
90 | |
146 | 91 #ifdef HAVE_GETADDRINFO |
92 #define HAVE_IPV6 | |
151 | 93 #define GFTP_GET_AI_FAMILY(request) (request != NULL && request->hostp != NULL ? request->hostp->ai_family : -1) |
146 | 94 #else |
95 #define GFTP_GET_AI_FAMILY(request) AF_INET | |
96 #endif | |
97 | |
48 | 98 /* We need the major() and minor() macros in the user interface. If they aren't |
99 defined by the system, we'll just define them here. */ | |
100 #ifndef major | |
101 #warning major macro was not defined by the system. Defining one that is probably wrong for your system | |
102 #define major(dev) (((dev) >> 8) & 0xff) | |
103 #endif | |
104 | |
105 #ifndef minor | |
106 #warning minor macro was not defined by the system. Defining one that is probably wrong for your system | |
107 #define minor(dev) ((dev) & 0xff) | |
108 #endif | |
109 | |
201 | 110 #ifdef WITH_DMALLOC |
111 | |
112 #undef g_malloc | |
113 #define g_malloc(size) \ | |
114 _malloc_leap(__FILE__, __LINE__, size) | |
115 | |
116 #undef g_malloc0 | |
117 #define g_malloc0(size) \ | |
118 _calloc_leap(__FILE__, __LINE__, 1, size) | |
119 | |
120 #undef g_realloc | |
121 #define g_realloc(ptr, size) \ | |
122 _realloc_leap(__FILE__, __LINE__, ptr, size) | |
123 | |
124 #undef g_strdup | |
125 #define g_strdup(str) \ | |
126 _strdup_leap(__FILE__, __LINE__, str) | |
127 | |
128 #undef g_free | |
129 #define g_free(ptr) \ | |
130 _free_leap(__FILE__, __LINE__, ptr) | |
131 | |
1 | 132 #include <dmalloc.h> |
201 | 133 |
1 | 134 #endif |
135 | |
338 | 136 #ifdef __GNUC__ |
137 # define GFTP_LOG_FUNCTION_ATTRIBUTES __attribute__((format(printf, 3, 4))) | |
138 #else | |
139 # define GFTP_LOG_FUNCTION_ATTRIBUTES | |
140 #endif | |
141 | |
91 | 142 /* Server types (used by FTP protocol from SYST command) */ |
122 | 143 #define GFTP_DIRTYPE_UNIX 1 |
144 #define GFTP_DIRTYPE_EPLF 2 | |
145 #define GFTP_DIRTYPE_CRAY 3 | |
146 #define GFTP_DIRTYPE_NOVELL 4 | |
147 #define GFTP_DIRTYPE_DOS 5 | |
148 #define GFTP_DIRTYPE_VMS 6 | |
149 #define GFTP_DIRTYPE_OTHER 7 | |
91 | 150 |
84 | 151 /* Error types */ |
152 #define GFTP_ERETRYABLE -1 | |
153 #define GFTP_EFATAL -2 | |
154 | |
1 | 155 /* Some general settings */ |
156 #define BASE_CONF_DIR "~/.gftp" | |
157 #define CONFIG_FILE BASE_CONF_DIR "/gftprc" | |
158 #define BOOKMARKS_FILE BASE_CONF_DIR "/bookmarks" | |
159 #define LOG_FILE BASE_CONF_DIR "/gftp.log" | |
160 #define MAX_HIST_LEN 10 | |
161 | |
162 typedef enum gftp_logging_level_tag | |
163 { | |
164 gftp_logging_send, | |
165 gftp_logging_recv, | |
166 gftp_logging_error, | |
167 gftp_logging_misc | |
168 } gftp_logging_level; | |
169 | |
170 typedef struct gftp_file_tag gftp_file; | |
171 | |
172 #define GFTP_TRANS_ACTION_OVERWRITE 1 | |
173 #define GFTP_TRANS_ACTION_RESUME 2 | |
174 #define GFTP_TRANS_ACTION_SKIP 3 | |
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 { | |
303 | 219 /* FIXME - add IPV6 stuff here */ |
122 | 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 ); |
309 | 363 void (*copy_param_options) ( gftp_request * dest_request, |
364 gftp_request * src_request ); | |
168 | 365 ssize_t (*read_function) ( gftp_request * request, |
366 void *ptr, | |
367 size_t size, | |
368 int fd ); | |
369 ssize_t (*write_function) ( gftp_request * request, | |
370 const char *ptr, | |
371 size_t size, | |
372 int fd ); | |
1 | 373 void (*destroy) ( gftp_request * request ); |
374 int (*connect) ( gftp_request * request ); | |
168 | 375 int (*post_connect) ( gftp_request * request ); |
1 | 376 void (*disconnect) ( gftp_request * request ); |
58 | 377 off_t (*get_file) ( gftp_request * request, |
1 | 378 const char *filename, |
58 | 379 int fd, |
1 | 380 off_t startsize ); |
381 int (*put_file) ( gftp_request * request, | |
382 const char *filename, | |
58 | 383 int fd, |
1 | 384 off_t startsize, |
385 off_t totalsize ); | |
386 long (*transfer_file) ( gftp_request * fromreq, | |
387 const char *fromfile, | |
388 off_t fromsize, | |
389 gftp_request * toreq, | |
390 const char *tofile, | |
391 off_t tosize ); | |
58 | 392 ssize_t (*get_next_file_chunk) ( gftp_request * request, |
1 | 393 char *buf, |
394 size_t size ); | |
58 | 395 ssize_t (*put_next_file_chunk) ( gftp_request * request, |
1 | 396 char *buf, |
397 size_t size ); | |
398 int (*end_transfer) ( gftp_request * request ); | |
40 | 399 int (*abort_transfer) ( gftp_request * request ); |
1 | 400 int (*list_files) ( gftp_request * request ); |
401 int (*get_next_file) ( gftp_request * request, | |
402 gftp_file *fle, | |
58 | 403 int fd ); |
1 | 404 off_t (*get_file_size) ( gftp_request * request, |
405 const char *filename ); | |
406 int (*chdir) ( gftp_request * request, | |
407 const char *directory ); | |
408 int (*rmdir) ( gftp_request * request, | |
409 const char *directory ); | |
410 int (*rmfile) ( gftp_request * request, | |
411 const char *filename ); | |
412 int (*mkdir) ( gftp_request * request, | |
413 const char *directory ); | |
414 int (*rename) ( gftp_request * request, | |
415 const char *oldname, | |
416 const char *newname ); | |
417 int (*chmod) ( gftp_request * request, | |
418 const char *filename, | |
419 int mode ); | |
420 int (*set_file_time) ( gftp_request * request, | |
421 const char *filename, | |
422 time_t datettime ); | |
423 int (*site) ( gftp_request * request, | |
424 const char *filename ); | |
425 int (*parse_url) ( gftp_request * request, | |
426 const char *url ); | |
177 | 427 int (*set_config_options) ( gftp_request * request ); |
63 | 428 void (*swap_socks) ( gftp_request * dest, |
429 gftp_request * source ); | |
1 | 430 |
136 | 431 gftp_config_vars * local_options_vars; |
432 int num_local_options_vars; | |
433 GHashTable * local_options_hash; | |
168 | 434 #ifdef USE_SSL |
435 SSL * ssl; | |
436 #endif | |
184 | 437 |
438 #if GLIB_MAJOR_VERSION > 1 | |
439 GIConv iconv; | |
440 unsigned int iconv_initialized : 1; | |
441 #endif | |
1 | 442 }; |
443 | |
444 | |
136 | 445 typedef struct gftp_transfer_tag |
1 | 446 { |
447 gftp_request * fromreq, | |
448 * toreq; | |
449 | |
305 | 450 unsigned int cancel : 1, |
1 | 451 ready : 1, |
452 started : 1, | |
453 done : 1, | |
454 show : 1, | |
455 stalled : 1, | |
303 | 456 conn_error_no_timeout : 1, |
1 | 457 next_file : 1, |
14
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
1
diff
changeset
|
458 skip_file : 1; |
1 | 459 |
460 struct timeval starttime, | |
461 lasttime; | |
462 | |
463 double kbs; | |
464 | |
465 GList * files, | |
466 * curfle, | |
467 * updfle; | |
468 | |
19 | 469 long numfiles, |
470 numdirs, | |
471 current_file_number, | |
472 current_file_retries; | |
1 | 473 |
474 off_t curtrans, /* Current transfered bytes for this file */ | |
475 curresumed, /* Resumed bytes for this file */ | |
476 trans_bytes, /* Amount of data transfered for entire | |
477 transfer */ | |
478 total_bytes, /* Grand total bytes for whole transfer */ | |
479 resumed_bytes; /* Grand total of resumed bytes for whole | |
480 transfer */ | |
481 | |
482 void * fromwdata, | |
483 * towdata; | |
484 | |
122 | 485 GStaticMutex statmutex, |
486 structmutex; | |
487 | |
125 | 488 void *user_data; |
1 | 489 void *clist; |
136 | 490 } gftp_transfer; |
1 | 491 |
492 | |
493 typedef struct gftp_log_tag | |
494 { | |
495 char *msg; | |
496 gftp_logging_level type; | |
497 } gftp_log; | |
498 | |
499 | |
500 typedef struct supported_gftp_protocols_tag | |
501 { | |
502 char *name; /* Description of protocol */ | |
173 | 503 int (*init) (gftp_request * request); /* Init function */ |
122 | 504 void (*register_options) (void); /* Protocol options */ |
1 | 505 char *url_prefix; /* URL Prefix */ |
122 | 506 int shown; /* Whether this protocol is |
507 shown or not to the user in | |
508 the protocol dropdown box */ | |
1 | 509 } supported_gftp_protocols; |
510 | |
511 | |
122 | 512 typedef struct gftp_bookmarks_tag gftp_bookmarks_var; |
1 | 513 |
514 struct gftp_bookmarks_tag | |
515 { | |
516 char *path; /* Path */ | |
517 char *hostname, /* Our actual internet hostname */ | |
518 *protocol, /* Protocol we will connect through */ | |
519 *remote_dir, /* Initial directory */ | |
520 *local_dir, /* Init local directory */ | |
521 *user, /* Username to log in as */ | |
522 *pass, /* Our password */ | |
523 *acct; /* Account */ | |
524 | |
525 unsigned int port, /* The port we will connect to */ | |
526 isfolder : 1, /* If this is set, then the children field can | |
527 be non-NULL */ | |
528 save_password : 1; /* Save this password */ | |
122 | 529 gftp_bookmarks_var *children, /* The children of this node. */ |
530 *prev, /* The parent of this node */ | |
531 *next; /* The next sibling of this node */ | |
1 | 532 gpointer cnode; |
533 | |
199 | 534 gftp_config_vars * local_options_vars; |
535 int num_local_options_vars; | |
536 GHashTable * local_options_hash; | |
1 | 537 }; |
538 | |
539 | |
540 typedef struct gftp_file_extensions_tag | |
541 { | |
542 char *ext, /* The file extension to register */ | |
543 *filename, /* The xpm file to display */ | |
544 *view_program, /* The program used to view this file */ | |
545 *ascii_binary; /* Is this a ASCII transfer or a BINARY transfer */ | |
546 int stlen; /* How long is the file extension. */ | |
547 } gftp_file_extensions; | |
548 | |
549 | |
550 typedef struct gftp_color_tag | |
551 { | |
552 gushort red, | |
553 green, | |
554 blue; | |
555 } gftp_color; | |
556 | |
557 | |
58 | 558 typedef struct gftp_getline_buffer_tag |
559 { | |
560 char *buffer, | |
561 *curpos; | |
562 size_t max_bufsize, | |
563 cur_bufsize; | |
179 | 564 unsigned int eof : 1; |
58 | 565 } gftp_getline_buffer; |
566 | |
126 | 567 |
122 | 568 /* Global config options. These are defined in options.h */ |
569 extern GList * gftp_file_transfers, * gftp_file_transfer_logs, | |
570 * gftp_options_list; | |
571 extern GHashTable * gftp_global_options_htable, * gftp_bookmarks_htable, | |
572 * gftp_config_list_htable; | |
573 extern gftp_config_vars gftp_global_config_vars[]; | |
1 | 574 extern supported_gftp_protocols gftp_protocols[]; |
122 | 575 extern gftp_bookmarks_var * gftp_bookmarks; |
576 extern char gftp_version[]; | |
577 extern FILE * gftp_logfd; | |
201 | 578 extern int gftp_configuration_changed; |
122 | 579 |
580 /* This is defined in config_file.c */ | |
581 | |
582 extern gftp_option_type_var gftp_option_types[]; | |
1 | 583 |
584 /* cache.c */ | |
182 | 585 void gftp_generate_cache_description ( gftp_request * request, |
586 char *description, | |
587 size_t len, | |
588 int ignore_directory ); | |
589 | |
58 | 590 int gftp_new_cache_entry ( gftp_request * request ); |
1 | 591 |
58 | 592 int gftp_find_cache_entry ( gftp_request * request ); |
1 | 593 |
594 void gftp_clear_cache_files ( void ); | |
595 | |
47 | 596 void gftp_delete_cache_entry ( gftp_request * request, |
182 | 597 char *descr, |
47 | 598 int ignore_directory ); |
1 | 599 |
600 /* config_file.c */ | |
198 | 601 int gftp_config_parse_args ( char *str, |
602 int numargs, | |
603 int lineno, | |
604 char **first, | |
605 ... ); | |
606 | |
122 | 607 void gftp_add_bookmark ( gftp_bookmarks_var * newentry ); |
608 | |
124 | 609 void gftp_read_config_file ( char *global_data_path ); |
1 | 610 |
122 | 611 void gftp_write_bookmarks_file ( void ); |
1 | 612 |
613 void gftp_write_config_file ( void ); | |
614 | |
122 | 615 GHashTable * build_bookmarks_hash_table ( gftp_bookmarks_var * entry ); |
616 | |
617 void print_bookmarks ( gftp_bookmarks_var * bookmarks ); | |
618 | |
619 void gftp_lookup_global_option ( char * key, | |
620 void *value ); | |
26 | 621 |
122 | 622 void gftp_lookup_request_option ( gftp_request * request, |
623 char * key, | |
624 void *value ); | |
1 | 625 |
229 | 626 void gftp_lookup_bookmark_option ( gftp_bookmarks_var * bm, |
627 char * key, | |
628 void *value ); | |
629 | |
122 | 630 void gftp_set_global_option ( char * key, |
227 | 631 const void *value ); |
122 | 632 |
633 void gftp_set_request_option ( gftp_request * request, | |
634 char * key, | |
229 | 635 const void *value ); |
636 | |
637 void gftp_set_bookmark_option ( gftp_bookmarks_var * bm, | |
638 char * key, | |
639 const void *value ); | |
122 | 640 |
641 void gftp_register_config_vars ( gftp_config_vars *config_vars ); | |
1 | 642 |
201 | 643 void gftp_copy_local_options ( gftp_config_vars ** new_options_vars, |
644 GHashTable ** new_options_hash, | |
645 gftp_config_vars * orig_options, | |
646 int num_local_options_vars ); | |
647 | |
648 void gftp_config_free_options ( gftp_config_vars * options_vars, | |
649 GHashTable * options_hash, | |
650 int num_options_vars ); | |
651 | |
652 void gftp_bookmarks_destroy ( gftp_bookmarks_var * bookmarks ); | |
653 | |
218 | 654 void gftp_free_proxy_hosts ( GList * proxy_hosts ); |
655 | |
656 GList * gftp_copy_proxy_hosts ( GList * proxy_hosts ); | |
657 | |
1 | 658 /* misc.c */ |
14
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
1
diff
changeset
|
659 char *insert_commas ( off_t number, |
1 | 660 char *dest_str, |
661 size_t dest_len ); | |
662 | |
663 char *alltrim ( char *str ); | |
664 | |
665 char *expand_path ( const char *src ); | |
666 | |
667 void make_nonnull ( char **str ); | |
668 | |
669 int gftp_match_filespec ( char *filename, | |
670 char *filespec ); | |
671 | |
672 int gftp_parse_command_line ( int *argc, | |
673 char ***argv ); | |
674 | |
675 void gftp_usage ( void ); | |
676 | |
677 gint string_hash_compare ( gconstpointer path1, | |
678 gconstpointer path2 ); | |
679 | |
680 guint string_hash_function ( gconstpointer key ); | |
681 | |
682 void free_file_list ( GList * filelist ); | |
683 | |
684 void free_fdata ( gftp_file * fle ); | |
685 | |
686 gftp_file * copy_fdata ( gftp_file * fle ); | |
687 | |
688 int compare_request ( gftp_request * request1, | |
689 gftp_request * request2, | |
690 int compare_dirs ); | |
691 | |
129 | 692 gftp_transfer * gftp_tdata_new ( void ); |
693 | |
1 | 694 void free_tdata ( gftp_transfer * tdata ); |
695 | |
151 | 696 gftp_request * copy_request ( gftp_request * req, |
697 int copy_local_options ); | |
1 | 698 |
16 | 699 GList * gftp_sort_filelist ( GList * filelist, |
700 int column, | |
701 int asds ); | |
702 | |
125 | 703 mode_t gftp_parse_attribs ( char *attribs ); |
704 | |
131 | 705 char * gftp_gen_ls_string ( gftp_file * fle, |
706 char *file_prefixstr, | |
707 char *file_suffixstr ); | |
708 | |
168 | 709 char * base64_encode ( char *str ); |
710 | |
199 | 711 void gftp_free_bookmark ( gftp_bookmarks_var * entry ); |
712 | |
201 | 713 void gftp_shutdown ( void ); |
199 | 714 |
207 | 715 GList * get_next_selection ( GList * selection, |
716 GList ** list, | |
717 int *curnum ); | |
718 | |
245 | 719 char * gftp_build_path ( const char *first_element, |
227 | 720 ... ); |
721 | |
244 | 722 off_t gftp_parse_file_size ( char *str ); |
723 | |
290 | 724 void gftp_locale_init ( void ); |
725 | |
330 | 726 char * gftp_scramble_password ( const char *password ); |
727 | |
728 char * gftp_descramble_password ( const char *password ); | |
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 |
309 | 779 void gftp_copy_param_options ( gftp_request * dest_request, |
780 gftp_request * src_request ); | |
781 | |
1 | 782 void gftp_file_destroy ( gftp_file *file ); |
783 | |
784 int gftp_connect ( gftp_request * request ); | |
785 | |
786 void gftp_disconnect ( gftp_request * request ); | |
787 | |
58 | 788 off_t gftp_get_file ( gftp_request * request, |
1 | 789 const char *filename, |
58 | 790 int fd, |
244 | 791 off_t startsize ); |
1 | 792 |
793 int gftp_put_file ( gftp_request * request, | |
794 const char *filename, | |
58 | 795 int fd, |
244 | 796 off_t startsize, |
797 off_t totalsize ); | |
1 | 798 |
261 | 799 off_t gftp_transfer_file ( gftp_request *fromreq, |
1 | 800 const char *fromfile, |
58 | 801 int fromfd, |
244 | 802 off_t fromsize, |
1 | 803 gftp_request *toreq, |
804 const char *tofile, | |
58 | 805 int tofd, |
244 | 806 off_t tosize ); |
1 | 807 |
58 | 808 ssize_t gftp_get_next_file_chunk ( gftp_request * request, |
1 | 809 char *buf, |
810 size_t size ); | |
811 | |
58 | 812 ssize_t gftp_put_next_file_chunk ( gftp_request * request, |
1 | 813 char *buf, |
814 size_t size ); | |
815 | |
816 int gftp_list_files ( gftp_request * request ); | |
817 | |
186 | 818 char * gftp_string_to_utf8 ( gftp_request * request, |
291 | 819 const char *str ); |
820 | |
821 char * gftp_string_from_utf8 ( gftp_request * request, | |
822 const char *str ); | |
186 | 823 |
87 | 824 int gftp_parse_bookmark ( gftp_request * request, |
243 | 825 gftp_request * local_request, |
275 | 826 const char * bookmark, |
827 int *refresh_local ); | |
87 | 828 |
1 | 829 int gftp_parse_url ( gftp_request * request, |
830 const char *url ); | |
831 | |
832 int gftp_get_next_file ( gftp_request * request, | |
833 char *filespec, | |
834 gftp_file *fle ); | |
835 | |
836 int gftp_end_transfer ( gftp_request * request ); | |
837 | |
40 | 838 int gftp_abort_transfer ( gftp_request * request ); |
839 | |
1 | 840 void gftp_set_hostname ( gftp_request * request, |
841 const char *hostname ); | |
842 | |
843 void gftp_set_username ( gftp_request * request, | |
844 const char *username ); | |
845 | |
846 void gftp_set_password ( gftp_request * request, | |
847 const char *password ); | |
848 | |
849 void gftp_set_account ( gftp_request * request, | |
850 const char *account ); | |
851 | |
852 int gftp_set_directory ( gftp_request * request, | |
853 const char *directory ); | |
854 | |
855 void gftp_set_port ( gftp_request * request, | |
856 unsigned int port ); | |
857 | |
858 int gftp_remove_directory ( gftp_request * request, | |
859 const char *directory ); | |
860 | |
861 int gftp_remove_file ( gftp_request * request, | |
862 const char *file ); | |
863 | |
864 int gftp_make_directory ( gftp_request * request, | |
865 const char *directory ); | |
866 | |
867 int gftp_rename_file ( gftp_request * request, | |
868 const char *oldname, | |
869 const char *newname ); | |
870 | |
871 int gftp_chmod ( gftp_request * request, | |
872 const char *file, | |
873 int mode ); | |
874 | |
875 int gftp_set_file_time ( gftp_request * request, | |
876 const char *file, | |
877 time_t datetime ); | |
878 | |
879 char gftp_site_cmd ( gftp_request * request, | |
880 const char *command ); | |
881 | |
58 | 882 off_t gftp_get_file_size ( gftp_request * request, |
1 | 883 const char *filename ); |
884 | |
885 void gftp_calc_kbs ( gftp_transfer * tdata, | |
886 ssize_t num_read ); | |
887 | |
102 | 888 time_t parse_time ( char *str, |
889 char **endpos ); | |
890 | |
91 | 891 int gftp_parse_ls ( gftp_request * request, |
892 const char *lsoutput, | |
1 | 893 gftp_file *fle ); |
894 | |
895 int gftp_get_all_subdirs ( gftp_transfer * transfer, | |
896 void (*update_func) | |
897 ( gftp_transfer * transfer )); | |
898 | |
899 int gftp_connect_server ( gftp_request * request, | |
122 | 900 char *service, |
901 char *proxy_hostname, | |
902 int proxy_port ); | |
1 | 903 |
122 | 904 #if !defined (HAVE_GETADDRINFO) || !defined (HAVE_GAI_STRERROR) |
1 | 905 |
906 struct hostent *r_gethostbyname ( const char *name, | |
907 struct hostent *result_buf, | |
908 int *h_errnop ); | |
909 | |
56 | 910 #endif |
911 | |
1 | 912 struct servent *r_getservbyname ( const char *name, |
913 const char *proto, | |
914 struct servent *result_buf, | |
915 int *h_errnop ); | |
122 | 916 |
177 | 917 int gftp_set_config_options ( gftp_request * request ); |
1 | 918 |
919 void print_file_list ( GList * list ); | |
920 | |
201 | 921 void gftp_free_getline_buffer ( gftp_getline_buffer ** rbuf ); |
168 | 922 |
58 | 923 ssize_t gftp_get_line ( gftp_request * request, |
924 gftp_getline_buffer ** rbuf, | |
41 | 925 char * str, |
926 size_t len, | |
58 | 927 int fd ); |
928 | |
168 | 929 ssize_t gftp_fd_read ( gftp_request * request, |
58 | 930 void *ptr, |
931 size_t size, | |
932 int fd ); | |
41 | 933 |
168 | 934 ssize_t gftp_fd_write ( gftp_request * request, |
58 | 935 const char *ptr, |
41 | 936 size_t size, |
58 | 937 int fd ); |
938 | |
939 ssize_t gftp_writefmt ( gftp_request * request, | |
940 int fd, | |
941 const char *fmt, | |
942 ... ); | |
943 | |
168 | 944 int gftp_fd_set_sockblocking ( gftp_request * request, |
58 | 945 int fd, |
946 int non_blocking ); | |
41 | 947 |
63 | 948 void gftp_swap_socks ( gftp_request * dest, |
949 gftp_request * source ); | |
950 | |
122 | 951 void gftp_calc_kbs ( gftp_transfer * tdata, |
952 ssize_t num_read ); | |
953 | |
125 | 954 int gftp_get_transfer_status ( gftp_transfer * tdata, |
955 ssize_t num_read ); | |
956 | |
182 | 957 int gftp_fd_open ( gftp_request * request, |
958 const char *pathname, | |
959 int flags, | |
960 mode_t perms ); | |
961 | |
146 | 962 /* pty.c */ |
210 | 963 char * gftp_get_pty_impl ( void ); |
179 | 964 |
210 | 965 pid_t gftp_exec_with_new_pty ( gftp_request * request, |
146 | 966 int *fdm, |
210 | 967 char **args ); |
146 | 968 |
210 | 969 pid_t gftp_exec_without_new_pty ( gftp_request * request, |
970 int *fdm, | |
971 char **args ); | |
146 | 972 |
168 | 973 #ifdef USE_SSL |
974 /* sslcommon.c */ | |
975 int gftp_ssl_startup ( gftp_request * request ); | |
976 | |
977 int gftp_ssl_session_setup ( gftp_request * request ); | |
978 | |
979 void gftp_ssl_free ( gftp_request * request ); | |
980 | |
981 ssize_t gftp_ssl_read ( gftp_request * request, | |
982 void *ptr, | |
983 size_t size, | |
984 int fd ); | |
985 | |
986 ssize_t gftp_ssl_write ( gftp_request * request, | |
987 const char *ptr, | |
988 size_t size, | |
989 int fd ); | |
990 #endif /* USE_SSL */ | |
991 | |
1 | 992 #endif |
993 |