Mercurial > gftp.yaz
annotate lib/gftp.h @ 305:6d180e6a8ba5
2003-11-3 Brian Masney <masneyb@gftp.org>
* lib/gftp.h src/gtk/transfer.c src/gtk/delete_dialog.c - removed
transfer_direction variable from gftp_transfer structure. Cleaned
up the code that did checks based on the value of this variable.
* lib/rfc959.c (rfc959_syst) - added a check for Novell FTP servers
* src/gtk/transfer.c (add_file_transfer) - check the value of the option
one_transfer and if that is disabled, do not append the file transfers.
(transfer_done) - refresh the destination window correctly after a
transfer is completed.
author | masneyb |
---|---|
date | Tue, 04 Nov 2003 02:53:17 +0000 |
parents | 3b9d5797050f |
children | cc2eeb30b793 |
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 ); |
168 | 353 ssize_t (*read_function) ( gftp_request * request, |
354 void *ptr, | |
355 size_t size, | |
356 int fd ); | |
357 ssize_t (*write_function) ( gftp_request * request, | |
358 const char *ptr, | |
359 size_t size, | |
360 int fd ); | |
1 | 361 void (*destroy) ( gftp_request * request ); |
362 int (*connect) ( gftp_request * request ); | |
168 | 363 int (*post_connect) ( gftp_request * request ); |
1 | 364 void (*disconnect) ( gftp_request * request ); |
58 | 365 off_t (*get_file) ( gftp_request * request, |
1 | 366 const char *filename, |
58 | 367 int fd, |
1 | 368 off_t startsize ); |
369 int (*put_file) ( gftp_request * request, | |
370 const char *filename, | |
58 | 371 int fd, |
1 | 372 off_t startsize, |
373 off_t totalsize ); | |
374 long (*transfer_file) ( gftp_request * fromreq, | |
375 const char *fromfile, | |
376 off_t fromsize, | |
377 gftp_request * toreq, | |
378 const char *tofile, | |
379 off_t tosize ); | |
58 | 380 ssize_t (*get_next_file_chunk) ( gftp_request * request, |
1 | 381 char *buf, |
382 size_t size ); | |
58 | 383 ssize_t (*put_next_file_chunk) ( gftp_request * request, |
1 | 384 char *buf, |
385 size_t size ); | |
386 int (*end_transfer) ( gftp_request * request ); | |
40 | 387 int (*abort_transfer) ( gftp_request * request ); |
1 | 388 int (*list_files) ( gftp_request * request ); |
389 int (*get_next_file) ( gftp_request * request, | |
390 gftp_file *fle, | |
58 | 391 int fd ); |
1 | 392 off_t (*get_file_size) ( gftp_request * request, |
393 const char *filename ); | |
394 int (*chdir) ( gftp_request * request, | |
395 const char *directory ); | |
396 int (*rmdir) ( gftp_request * request, | |
397 const char *directory ); | |
398 int (*rmfile) ( gftp_request * request, | |
399 const char *filename ); | |
400 int (*mkdir) ( gftp_request * request, | |
401 const char *directory ); | |
402 int (*rename) ( gftp_request * request, | |
403 const char *oldname, | |
404 const char *newname ); | |
405 int (*chmod) ( gftp_request * request, | |
406 const char *filename, | |
407 int mode ); | |
408 int (*set_file_time) ( gftp_request * request, | |
409 const char *filename, | |
410 time_t datettime ); | |
411 int (*site) ( gftp_request * request, | |
412 const char *filename ); | |
413 int (*parse_url) ( gftp_request * request, | |
414 const char *url ); | |
177 | 415 int (*set_config_options) ( gftp_request * request ); |
63 | 416 void (*swap_socks) ( gftp_request * dest, |
417 gftp_request * source ); | |
1 | 418 |
136 | 419 gftp_config_vars * local_options_vars; |
420 int num_local_options_vars; | |
421 GHashTable * local_options_hash; | |
168 | 422 #ifdef USE_SSL |
423 SSL * ssl; | |
424 #endif | |
184 | 425 |
426 #if GLIB_MAJOR_VERSION > 1 | |
427 GIConv iconv; | |
428 unsigned int iconv_initialized : 1; | |
429 #endif | |
1 | 430 }; |
431 | |
432 | |
136 | 433 typedef struct gftp_transfer_tag |
1 | 434 { |
435 gftp_request * fromreq, | |
436 * toreq; | |
437 | |
305 | 438 unsigned int cancel : 1, |
1 | 439 ready : 1, |
440 started : 1, | |
441 done : 1, | |
442 show : 1, | |
443 stalled : 1, | |
303 | 444 conn_error_no_timeout : 1, |
1 | 445 next_file : 1, |
14
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
1
diff
changeset
|
446 skip_file : 1; |
1 | 447 |
448 struct timeval starttime, | |
449 lasttime; | |
450 | |
451 double kbs; | |
452 | |
453 GList * files, | |
454 * curfle, | |
455 * updfle; | |
456 | |
19 | 457 long numfiles, |
458 numdirs, | |
459 current_file_number, | |
460 current_file_retries; | |
1 | 461 |
462 off_t curtrans, /* Current transfered bytes for this file */ | |
463 curresumed, /* Resumed bytes for this file */ | |
464 trans_bytes, /* Amount of data transfered for entire | |
465 transfer */ | |
466 total_bytes, /* Grand total bytes for whole transfer */ | |
467 resumed_bytes; /* Grand total of resumed bytes for whole | |
468 transfer */ | |
469 | |
470 void * fromwdata, | |
471 * towdata; | |
472 | |
122 | 473 GStaticMutex statmutex, |
474 structmutex; | |
475 | |
125 | 476 void *user_data; |
1 | 477 void *clist; |
136 | 478 } gftp_transfer; |
1 | 479 |
480 | |
481 typedef struct gftp_log_tag | |
482 { | |
483 char *msg; | |
484 gftp_logging_level type; | |
485 } gftp_log; | |
486 | |
487 | |
488 typedef struct supported_gftp_protocols_tag | |
489 { | |
490 char *name; /* Description of protocol */ | |
173 | 491 int (*init) (gftp_request * request); /* Init function */ |
122 | 492 void (*register_options) (void); /* Protocol options */ |
1 | 493 char *url_prefix; /* URL Prefix */ |
122 | 494 int shown; /* Whether this protocol is |
495 shown or not to the user in | |
496 the protocol dropdown box */ | |
1 | 497 } supported_gftp_protocols; |
498 | |
499 | |
122 | 500 typedef struct gftp_bookmarks_tag gftp_bookmarks_var; |
1 | 501 |
502 struct gftp_bookmarks_tag | |
503 { | |
504 char *path; /* Path */ | |
505 char *hostname, /* Our actual internet hostname */ | |
506 *protocol, /* Protocol we will connect through */ | |
507 *remote_dir, /* Initial directory */ | |
508 *local_dir, /* Init local directory */ | |
509 *user, /* Username to log in as */ | |
510 *pass, /* Our password */ | |
511 *acct; /* Account */ | |
512 | |
513 unsigned int port, /* The port we will connect to */ | |
514 isfolder : 1, /* If this is set, then the children field can | |
515 be non-NULL */ | |
516 save_password : 1; /* Save this password */ | |
122 | 517 gftp_bookmarks_var *children, /* The children of this node. */ |
518 *prev, /* The parent of this node */ | |
519 *next; /* The next sibling of this node */ | |
1 | 520 gpointer cnode; |
521 | |
199 | 522 gftp_config_vars * local_options_vars; |
523 int num_local_options_vars; | |
524 GHashTable * local_options_hash; | |
1 | 525 }; |
526 | |
527 | |
528 typedef struct gftp_file_extensions_tag | |
529 { | |
530 char *ext, /* The file extension to register */ | |
531 *filename, /* The xpm file to display */ | |
532 *view_program, /* The program used to view this file */ | |
533 *ascii_binary; /* Is this a ASCII transfer or a BINARY transfer */ | |
534 int stlen; /* How long is the file extension. */ | |
535 } gftp_file_extensions; | |
536 | |
537 | |
538 typedef struct gftp_color_tag | |
539 { | |
540 gushort red, | |
541 green, | |
542 blue; | |
543 } gftp_color; | |
544 | |
545 | |
58 | 546 typedef struct gftp_getline_buffer_tag |
547 { | |
548 char *buffer, | |
549 *curpos; | |
550 size_t max_bufsize, | |
551 cur_bufsize; | |
179 | 552 unsigned int eof : 1; |
58 | 553 } gftp_getline_buffer; |
554 | |
126 | 555 |
122 | 556 /* Global config options. These are defined in options.h */ |
557 extern GList * gftp_file_transfers, * gftp_file_transfer_logs, | |
558 * gftp_options_list; | |
559 extern GHashTable * gftp_global_options_htable, * gftp_bookmarks_htable, | |
560 * gftp_config_list_htable; | |
561 extern gftp_config_vars gftp_global_config_vars[]; | |
1 | 562 extern supported_gftp_protocols gftp_protocols[]; |
122 | 563 extern gftp_bookmarks_var * gftp_bookmarks; |
564 extern char gftp_version[]; | |
565 extern FILE * gftp_logfd; | |
201 | 566 extern int gftp_configuration_changed; |
122 | 567 |
568 /* This is defined in config_file.c */ | |
569 | |
570 extern gftp_option_type_var gftp_option_types[]; | |
1 | 571 |
572 /* cache.c */ | |
182 | 573 void gftp_generate_cache_description ( gftp_request * request, |
574 char *description, | |
575 size_t len, | |
576 int ignore_directory ); | |
577 | |
58 | 578 int gftp_new_cache_entry ( gftp_request * request ); |
1 | 579 |
58 | 580 int gftp_find_cache_entry ( gftp_request * request ); |
1 | 581 |
582 void gftp_clear_cache_files ( void ); | |
583 | |
47 | 584 void gftp_delete_cache_entry ( gftp_request * request, |
182 | 585 char *descr, |
47 | 586 int ignore_directory ); |
1 | 587 |
588 /* config_file.c */ | |
198 | 589 int gftp_config_parse_args ( char *str, |
590 int numargs, | |
591 int lineno, | |
592 char **first, | |
593 ... ); | |
594 | |
122 | 595 void gftp_add_bookmark ( gftp_bookmarks_var * newentry ); |
596 | |
124 | 597 void gftp_read_config_file ( char *global_data_path ); |
1 | 598 |
122 | 599 void gftp_write_bookmarks_file ( void ); |
1 | 600 |
601 void gftp_write_config_file ( void ); | |
602 | |
122 | 603 GHashTable * build_bookmarks_hash_table ( gftp_bookmarks_var * entry ); |
604 | |
605 void print_bookmarks ( gftp_bookmarks_var * bookmarks ); | |
606 | |
607 void gftp_lookup_global_option ( char * key, | |
608 void *value ); | |
26 | 609 |
122 | 610 void gftp_lookup_request_option ( gftp_request * request, |
611 char * key, | |
612 void *value ); | |
1 | 613 |
229 | 614 void gftp_lookup_bookmark_option ( gftp_bookmarks_var * bm, |
615 char * key, | |
616 void *value ); | |
617 | |
122 | 618 void gftp_set_global_option ( char * key, |
227 | 619 const void *value ); |
122 | 620 |
621 void gftp_set_request_option ( gftp_request * request, | |
622 char * key, | |
229 | 623 const void *value ); |
624 | |
625 void gftp_set_bookmark_option ( gftp_bookmarks_var * bm, | |
626 char * key, | |
627 const void *value ); | |
122 | 628 |
629 void gftp_register_config_vars ( gftp_config_vars *config_vars ); | |
1 | 630 |
201 | 631 void gftp_copy_local_options ( gftp_config_vars ** new_options_vars, |
632 GHashTable ** new_options_hash, | |
633 gftp_config_vars * orig_options, | |
634 int num_local_options_vars ); | |
635 | |
636 void gftp_config_free_options ( gftp_config_vars * options_vars, | |
637 GHashTable * options_hash, | |
638 int num_options_vars ); | |
639 | |
640 void gftp_bookmarks_destroy ( gftp_bookmarks_var * bookmarks ); | |
641 | |
218 | 642 void gftp_free_proxy_hosts ( GList * proxy_hosts ); |
643 | |
644 GList * gftp_copy_proxy_hosts ( GList * proxy_hosts ); | |
645 | |
1 | 646 /* misc.c */ |
14
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
1
diff
changeset
|
647 char *insert_commas ( off_t number, |
1 | 648 char *dest_str, |
649 size_t dest_len ); | |
650 | |
651 char *alltrim ( char *str ); | |
652 | |
653 char *expand_path ( const char *src ); | |
654 | |
655 void make_nonnull ( char **str ); | |
656 | |
657 int copyfile ( char *source, | |
658 char *dest ); | |
659 | |
660 int gftp_match_filespec ( char *filename, | |
661 char *filespec ); | |
662 | |
663 int gftp_parse_command_line ( int *argc, | |
664 char ***argv ); | |
665 | |
666 void gftp_usage ( void ); | |
667 | |
668 gint string_hash_compare ( gconstpointer path1, | |
669 gconstpointer path2 ); | |
670 | |
671 guint string_hash_function ( gconstpointer key ); | |
672 | |
673 void free_file_list ( GList * filelist ); | |
674 | |
675 void free_fdata ( gftp_file * fle ); | |
676 | |
677 gftp_file * copy_fdata ( gftp_file * fle ); | |
678 | |
679 int compare_request ( gftp_request * request1, | |
680 gftp_request * request2, | |
681 int compare_dirs ); | |
682 | |
129 | 683 gftp_transfer * gftp_tdata_new ( void ); |
684 | |
1 | 685 void free_tdata ( gftp_transfer * tdata ); |
686 | |
151 | 687 gftp_request * copy_request ( gftp_request * req, |
688 int copy_local_options ); | |
1 | 689 |
16 | 690 GList * gftp_sort_filelist ( GList * filelist, |
691 int column, | |
692 int asds ); | |
693 | |
125 | 694 mode_t gftp_parse_attribs ( char *attribs ); |
695 | |
131 | 696 char * gftp_gen_ls_string ( gftp_file * fle, |
697 char *file_prefixstr, | |
698 char *file_suffixstr ); | |
699 | |
168 | 700 char * base64_encode ( char *str ); |
701 | |
199 | 702 void gftp_free_bookmark ( gftp_bookmarks_var * entry ); |
703 | |
201 | 704 void gftp_shutdown ( void ); |
199 | 705 |
207 | 706 GList * get_next_selection ( GList * selection, |
707 GList ** list, | |
708 int *curnum ); | |
709 | |
245 | 710 char * gftp_build_path ( const char *first_element, |
227 | 711 ... ); |
712 | |
244 | 713 off_t gftp_parse_file_size ( char *str ); |
714 | |
290 | 715 void gftp_locale_init ( void ); |
716 | |
1 | 717 /* protocols.c */ |
718 #define GFTP_FTP_NUM 0 | |
719 #define GFTP_HTTP_NUM 1 | |
168 | 720 #define GFTP_HTTPS_NUM 2 |
721 #define GFTP_LOCAL_NUM 3 | |
722 #define GFTP_SSHV2_NUM 4 | |
723 #define GFTP_BOOKMARK_NUM 5 | |
122 | 724 |
1 | 725 #define GFTP_IS_CONNECTED(request) ((request) != NULL && \ |
169 | 726 ((request)->datafd > 0 || \ |
58 | 727 (request)->cached || \ |
728 (request)->always_connected)) | |
1 | 729 |
730 | |
173 | 731 int rfc959_init ( gftp_request * request ); |
1 | 732 |
122 | 733 void rfc959_register_module ( void ); |
734 | |
1 | 735 int rfc959_get_next_file ( gftp_request * request, |
736 gftp_file *fle, | |
58 | 737 int fd ); |
1 | 738 |
173 | 739 int rfc2068_init ( gftp_request * request ); |
1 | 740 |
122 | 741 void rfc2068_register_module ( void ); |
742 | |
173 | 743 int https_init ( gftp_request * request ); |
168 | 744 |
745 void https_register_module ( void ); | |
746 | |
173 | 747 int local_init ( gftp_request * request ); |
1 | 748 |
122 | 749 void local_register_module ( void ); |
750 | |
173 | 751 int sshv2_init ( gftp_request * request ); |
1 | 752 |
122 | 753 void sshv2_register_module ( void ); |
754 | |
174 | 755 void ssl_register_module ( void ); |
756 | |
173 | 757 int bookmark_init ( gftp_request * request ); |
1 | 758 |
122 | 759 void bookmark_register_module ( void ); |
760 | |
1 | 761 gftp_request *gftp_request_new ( void ); |
762 | |
67 | 763 void gftp_request_destroy ( gftp_request * request, |
764 int free_request ); | |
1 | 765 |
766 void gftp_file_destroy ( gftp_file *file ); | |
767 | |
768 int gftp_connect ( gftp_request * request ); | |
769 | |
770 void gftp_disconnect ( gftp_request * request ); | |
771 | |
58 | 772 off_t gftp_get_file ( gftp_request * request, |
1 | 773 const char *filename, |
58 | 774 int fd, |
244 | 775 off_t startsize ); |
1 | 776 |
777 int gftp_put_file ( gftp_request * request, | |
778 const char *filename, | |
58 | 779 int fd, |
244 | 780 off_t startsize, |
781 off_t totalsize ); | |
1 | 782 |
261 | 783 off_t gftp_transfer_file ( gftp_request *fromreq, |
1 | 784 const char *fromfile, |
58 | 785 int fromfd, |
244 | 786 off_t fromsize, |
1 | 787 gftp_request *toreq, |
788 const char *tofile, | |
58 | 789 int tofd, |
244 | 790 off_t tosize ); |
1 | 791 |
58 | 792 ssize_t gftp_get_next_file_chunk ( gftp_request * request, |
1 | 793 char *buf, |
794 size_t size ); | |
795 | |
58 | 796 ssize_t gftp_put_next_file_chunk ( gftp_request * request, |
1 | 797 char *buf, |
798 size_t size ); | |
799 | |
800 int gftp_list_files ( gftp_request * request ); | |
801 | |
186 | 802 char * gftp_string_to_utf8 ( gftp_request * request, |
291 | 803 const char *str ); |
804 | |
805 char * gftp_string_from_utf8 ( gftp_request * request, | |
806 const char *str ); | |
186 | 807 |
87 | 808 int gftp_parse_bookmark ( gftp_request * request, |
243 | 809 gftp_request * local_request, |
275 | 810 const char * bookmark, |
811 int *refresh_local ); | |
87 | 812 |
1 | 813 int gftp_parse_url ( gftp_request * request, |
814 const char *url ); | |
815 | |
816 int gftp_get_next_file ( gftp_request * request, | |
817 char *filespec, | |
818 gftp_file *fle ); | |
819 | |
820 int gftp_end_transfer ( gftp_request * request ); | |
821 | |
40 | 822 int gftp_abort_transfer ( gftp_request * request ); |
823 | |
1 | 824 void gftp_set_hostname ( gftp_request * request, |
825 const char *hostname ); | |
826 | |
827 void gftp_set_username ( gftp_request * request, | |
828 const char *username ); | |
829 | |
830 void gftp_set_password ( gftp_request * request, | |
831 const char *password ); | |
832 | |
833 void gftp_set_account ( gftp_request * request, | |
834 const char *account ); | |
835 | |
836 int gftp_set_directory ( gftp_request * request, | |
837 const char *directory ); | |
838 | |
839 void gftp_set_port ( gftp_request * request, | |
840 unsigned int port ); | |
841 | |
842 int gftp_remove_directory ( gftp_request * request, | |
843 const char *directory ); | |
844 | |
845 int gftp_remove_file ( gftp_request * request, | |
846 const char *file ); | |
847 | |
848 int gftp_make_directory ( gftp_request * request, | |
849 const char *directory ); | |
850 | |
851 int gftp_rename_file ( gftp_request * request, | |
852 const char *oldname, | |
853 const char *newname ); | |
854 | |
855 int gftp_chmod ( gftp_request * request, | |
856 const char *file, | |
857 int mode ); | |
858 | |
859 int gftp_set_file_time ( gftp_request * request, | |
860 const char *file, | |
861 time_t datetime ); | |
862 | |
863 char gftp_site_cmd ( gftp_request * request, | |
864 const char *command ); | |
865 | |
58 | 866 off_t gftp_get_file_size ( gftp_request * request, |
1 | 867 const char *filename ); |
868 | |
869 void gftp_calc_kbs ( gftp_transfer * tdata, | |
870 ssize_t num_read ); | |
871 | |
102 | 872 time_t parse_time ( char *str, |
873 char **endpos ); | |
874 | |
91 | 875 int gftp_parse_ls ( gftp_request * request, |
876 const char *lsoutput, | |
1 | 877 gftp_file *fle ); |
878 | |
879 int gftp_get_all_subdirs ( gftp_transfer * transfer, | |
880 void (*update_func) | |
881 ( gftp_transfer * transfer )); | |
882 | |
883 int gftp_connect_server ( gftp_request * request, | |
122 | 884 char *service, |
885 char *proxy_hostname, | |
886 int proxy_port ); | |
1 | 887 |
122 | 888 #if !defined (HAVE_GETADDRINFO) || !defined (HAVE_GAI_STRERROR) |
1 | 889 |
890 struct hostent *r_gethostbyname ( const char *name, | |
891 struct hostent *result_buf, | |
892 int *h_errnop ); | |
893 | |
56 | 894 #endif |
895 | |
1 | 896 struct servent *r_getservbyname ( const char *name, |
897 const char *proto, | |
898 struct servent *result_buf, | |
899 int *h_errnop ); | |
122 | 900 |
177 | 901 int gftp_set_config_options ( gftp_request * request ); |
1 | 902 |
903 void print_file_list ( GList * list ); | |
904 | |
201 | 905 void gftp_free_getline_buffer ( gftp_getline_buffer ** rbuf ); |
168 | 906 |
58 | 907 ssize_t gftp_get_line ( gftp_request * request, |
908 gftp_getline_buffer ** rbuf, | |
41 | 909 char * str, |
910 size_t len, | |
58 | 911 int fd ); |
912 | |
168 | 913 ssize_t gftp_fd_read ( gftp_request * request, |
58 | 914 void *ptr, |
915 size_t size, | |
916 int fd ); | |
41 | 917 |
168 | 918 ssize_t gftp_fd_write ( gftp_request * request, |
58 | 919 const char *ptr, |
41 | 920 size_t size, |
58 | 921 int fd ); |
922 | |
923 ssize_t gftp_writefmt ( gftp_request * request, | |
924 int fd, | |
925 const char *fmt, | |
926 ... ); | |
927 | |
168 | 928 int gftp_fd_set_sockblocking ( gftp_request * request, |
58 | 929 int fd, |
930 int non_blocking ); | |
41 | 931 |
63 | 932 void gftp_swap_socks ( gftp_request * dest, |
933 gftp_request * source ); | |
934 | |
122 | 935 void gftp_calc_kbs ( gftp_transfer * tdata, |
936 ssize_t num_read ); | |
937 | |
125 | 938 int gftp_get_transfer_status ( gftp_transfer * tdata, |
939 ssize_t num_read ); | |
940 | |
182 | 941 int gftp_fd_open ( gftp_request * request, |
942 const char *pathname, | |
943 int flags, | |
944 mode_t perms ); | |
945 | |
146 | 946 /* pty.c */ |
210 | 947 char * gftp_get_pty_impl ( void ); |
179 | 948 |
210 | 949 pid_t gftp_exec_with_new_pty ( gftp_request * request, |
146 | 950 int *fdm, |
210 | 951 char **args ); |
146 | 952 |
210 | 953 pid_t gftp_exec_without_new_pty ( gftp_request * request, |
954 int *fdm, | |
955 char **args ); | |
146 | 956 |
168 | 957 #ifdef USE_SSL |
958 /* sslcommon.c */ | |
959 int gftp_ssl_startup ( gftp_request * request ); | |
960 | |
961 int gftp_ssl_session_setup ( gftp_request * request ); | |
962 | |
963 void gftp_ssl_free ( gftp_request * request ); | |
964 | |
965 ssize_t gftp_ssl_read ( gftp_request * request, | |
966 void *ptr, | |
967 size_t size, | |
968 int fd ); | |
969 | |
970 ssize_t gftp_ssl_write ( gftp_request * request, | |
971 const char *ptr, | |
972 size_t size, | |
973 int fd ); | |
974 #endif /* USE_SSL */ | |
975 | |
1 | 976 #endif |
977 |