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