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