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