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