Mercurial > gftp.yaz
annotate lib/gftp.h @ 309:cc2eeb30b793
2003-11-7 Brian Masney <masneyb@gftp.org>
* lib/gftp.h lib/local.c lib/protocols.c lib/rfc2068.c lib/rfc959.c
lib/sshv2.c - added copy_param_options method to gftp_request
structure. When a gftp_request structure is copied, if a
copy_param_options method exists, this will be called so that the
local protocol data can be copied over. This is only used by the
FTP protocol at the moment to save the current state of Ascii or
Binary transfers.
* src/gtk/transfer.c (transfer_done) - when a transfer is
completed, copy the local protocol options back to the main window
* lib/rfc959.c (gftp_set_data_type) - check the return value of
rfc959_send_command() and if there is an error, return that
error.
* configure.in - added 'hr' to ALL_LINGUAS
author | masneyb |
---|---|
date | Sat, 08 Nov 2003 12:23:21 +0000 |
parents | 6d180e6a8ba5 |
children | 853981bbd4d7 |
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 copyfile ( char *source, | |
660 char *dest ); | |
661 | |
662 int gftp_match_filespec ( char *filename, | |
663 char *filespec ); | |
664 | |
665 int gftp_parse_command_line ( int *argc, | |
666 char ***argv ); | |
667 | |
668 void gftp_usage ( void ); | |
669 | |
670 gint string_hash_compare ( gconstpointer path1, | |
671 gconstpointer path2 ); | |
672 | |
673 guint string_hash_function ( gconstpointer key ); | |
674 | |
675 void free_file_list ( GList * filelist ); | |
676 | |
677 void free_fdata ( gftp_file * fle ); | |
678 | |
679 gftp_file * copy_fdata ( gftp_file * fle ); | |
680 | |
681 int compare_request ( gftp_request * request1, | |
682 gftp_request * request2, | |
683 int compare_dirs ); | |
684 | |
129 | 685 gftp_transfer * gftp_tdata_new ( void ); |
686 | |
1 | 687 void free_tdata ( gftp_transfer * tdata ); |
688 | |
151 | 689 gftp_request * copy_request ( gftp_request * req, |
690 int copy_local_options ); | |
1 | 691 |
16 | 692 GList * gftp_sort_filelist ( GList * filelist, |
693 int column, | |
694 int asds ); | |
695 | |
125 | 696 mode_t gftp_parse_attribs ( char *attribs ); |
697 | |
131 | 698 char * gftp_gen_ls_string ( gftp_file * fle, |
699 char *file_prefixstr, | |
700 char *file_suffixstr ); | |
701 | |
168 | 702 char * base64_encode ( char *str ); |
703 | |
199 | 704 void gftp_free_bookmark ( gftp_bookmarks_var * entry ); |
705 | |
201 | 706 void gftp_shutdown ( void ); |
199 | 707 |
207 | 708 GList * get_next_selection ( GList * selection, |
709 GList ** list, | |
710 int *curnum ); | |
711 | |
245 | 712 char * gftp_build_path ( const char *first_element, |
227 | 713 ... ); |
714 | |
244 | 715 off_t gftp_parse_file_size ( char *str ); |
716 | |
290 | 717 void gftp_locale_init ( void ); |
718 | |
1 | 719 /* protocols.c */ |
720 #define GFTP_FTP_NUM 0 | |
721 #define GFTP_HTTP_NUM 1 | |
168 | 722 #define GFTP_HTTPS_NUM 2 |
723 #define GFTP_LOCAL_NUM 3 | |
724 #define GFTP_SSHV2_NUM 4 | |
725 #define GFTP_BOOKMARK_NUM 5 | |
122 | 726 |
1 | 727 #define GFTP_IS_CONNECTED(request) ((request) != NULL && \ |
169 | 728 ((request)->datafd > 0 || \ |
58 | 729 (request)->cached || \ |
730 (request)->always_connected)) | |
1 | 731 |
732 | |
173 | 733 int rfc959_init ( gftp_request * request ); |
1 | 734 |
122 | 735 void rfc959_register_module ( void ); |
736 | |
1 | 737 int rfc959_get_next_file ( gftp_request * request, |
738 gftp_file *fle, | |
58 | 739 int fd ); |
1 | 740 |
173 | 741 int rfc2068_init ( gftp_request * request ); |
1 | 742 |
122 | 743 void rfc2068_register_module ( void ); |
744 | |
173 | 745 int https_init ( gftp_request * request ); |
168 | 746 |
747 void https_register_module ( void ); | |
748 | |
173 | 749 int local_init ( gftp_request * request ); |
1 | 750 |
122 | 751 void local_register_module ( void ); |
752 | |
173 | 753 int sshv2_init ( gftp_request * request ); |
1 | 754 |
122 | 755 void sshv2_register_module ( void ); |
756 | |
174 | 757 void ssl_register_module ( void ); |
758 | |
173 | 759 int bookmark_init ( gftp_request * request ); |
1 | 760 |
122 | 761 void bookmark_register_module ( void ); |
762 | |
1 | 763 gftp_request *gftp_request_new ( void ); |
764 | |
67 | 765 void gftp_request_destroy ( gftp_request * request, |
766 int free_request ); | |
1 | 767 |
309 | 768 void gftp_copy_param_options ( gftp_request * dest_request, |
769 gftp_request * src_request ); | |
770 | |
1 | 771 void gftp_file_destroy ( gftp_file *file ); |
772 | |
773 int gftp_connect ( gftp_request * request ); | |
774 | |
775 void gftp_disconnect ( gftp_request * request ); | |
776 | |
58 | 777 off_t gftp_get_file ( gftp_request * request, |
1 | 778 const char *filename, |
58 | 779 int fd, |
244 | 780 off_t startsize ); |
1 | 781 |
782 int gftp_put_file ( gftp_request * request, | |
783 const char *filename, | |
58 | 784 int fd, |
244 | 785 off_t startsize, |
786 off_t totalsize ); | |
1 | 787 |
261 | 788 off_t gftp_transfer_file ( gftp_request *fromreq, |
1 | 789 const char *fromfile, |
58 | 790 int fromfd, |
244 | 791 off_t fromsize, |
1 | 792 gftp_request *toreq, |
793 const char *tofile, | |
58 | 794 int tofd, |
244 | 795 off_t tosize ); |
1 | 796 |
58 | 797 ssize_t gftp_get_next_file_chunk ( gftp_request * request, |
1 | 798 char *buf, |
799 size_t size ); | |
800 | |
58 | 801 ssize_t gftp_put_next_file_chunk ( gftp_request * request, |
1 | 802 char *buf, |
803 size_t size ); | |
804 | |
805 int gftp_list_files ( gftp_request * request ); | |
806 | |
186 | 807 char * gftp_string_to_utf8 ( gftp_request * request, |
291 | 808 const char *str ); |
809 | |
810 char * gftp_string_from_utf8 ( gftp_request * request, | |
811 const char *str ); | |
186 | 812 |
87 | 813 int gftp_parse_bookmark ( gftp_request * request, |
243 | 814 gftp_request * local_request, |
275 | 815 const char * bookmark, |
816 int *refresh_local ); | |
87 | 817 |
1 | 818 int gftp_parse_url ( gftp_request * request, |
819 const char *url ); | |
820 | |
821 int gftp_get_next_file ( gftp_request * request, | |
822 char *filespec, | |
823 gftp_file *fle ); | |
824 | |
825 int gftp_end_transfer ( gftp_request * request ); | |
826 | |
40 | 827 int gftp_abort_transfer ( gftp_request * request ); |
828 | |
1 | 829 void gftp_set_hostname ( gftp_request * request, |
830 const char *hostname ); | |
831 | |
832 void gftp_set_username ( gftp_request * request, | |
833 const char *username ); | |
834 | |
835 void gftp_set_password ( gftp_request * request, | |
836 const char *password ); | |
837 | |
838 void gftp_set_account ( gftp_request * request, | |
839 const char *account ); | |
840 | |
841 int gftp_set_directory ( gftp_request * request, | |
842 const char *directory ); | |
843 | |
844 void gftp_set_port ( gftp_request * request, | |
845 unsigned int port ); | |
846 | |
847 int gftp_remove_directory ( gftp_request * request, | |
848 const char *directory ); | |
849 | |
850 int gftp_remove_file ( gftp_request * request, | |
851 const char *file ); | |
852 | |
853 int gftp_make_directory ( gftp_request * request, | |
854 const char *directory ); | |
855 | |
856 int gftp_rename_file ( gftp_request * request, | |
857 const char *oldname, | |
858 const char *newname ); | |
859 | |
860 int gftp_chmod ( gftp_request * request, | |
861 const char *file, | |
862 int mode ); | |
863 | |
864 int gftp_set_file_time ( gftp_request * request, | |
865 const char *file, | |
866 time_t datetime ); | |
867 | |
868 char gftp_site_cmd ( gftp_request * request, | |
869 const char *command ); | |
870 | |
58 | 871 off_t gftp_get_file_size ( gftp_request * request, |
1 | 872 const char *filename ); |
873 | |
874 void gftp_calc_kbs ( gftp_transfer * tdata, | |
875 ssize_t num_read ); | |
876 | |
102 | 877 time_t parse_time ( char *str, |
878 char **endpos ); | |
879 | |
91 | 880 int gftp_parse_ls ( gftp_request * request, |
881 const char *lsoutput, | |
1 | 882 gftp_file *fle ); |
883 | |
884 int gftp_get_all_subdirs ( gftp_transfer * transfer, | |
885 void (*update_func) | |
886 ( gftp_transfer * transfer )); | |
887 | |
888 int gftp_connect_server ( gftp_request * request, | |
122 | 889 char *service, |
890 char *proxy_hostname, | |
891 int proxy_port ); | |
1 | 892 |
122 | 893 #if !defined (HAVE_GETADDRINFO) || !defined (HAVE_GAI_STRERROR) |
1 | 894 |
895 struct hostent *r_gethostbyname ( const char *name, | |
896 struct hostent *result_buf, | |
897 int *h_errnop ); | |
898 | |
56 | 899 #endif |
900 | |
1 | 901 struct servent *r_getservbyname ( const char *name, |
902 const char *proto, | |
903 struct servent *result_buf, | |
904 int *h_errnop ); | |
122 | 905 |
177 | 906 int gftp_set_config_options ( gftp_request * request ); |
1 | 907 |
908 void print_file_list ( GList * list ); | |
909 | |
201 | 910 void gftp_free_getline_buffer ( gftp_getline_buffer ** rbuf ); |
168 | 911 |
58 | 912 ssize_t gftp_get_line ( gftp_request * request, |
913 gftp_getline_buffer ** rbuf, | |
41 | 914 char * str, |
915 size_t len, | |
58 | 916 int fd ); |
917 | |
168 | 918 ssize_t gftp_fd_read ( gftp_request * request, |
58 | 919 void *ptr, |
920 size_t size, | |
921 int fd ); | |
41 | 922 |
168 | 923 ssize_t gftp_fd_write ( gftp_request * request, |
58 | 924 const char *ptr, |
41 | 925 size_t size, |
58 | 926 int fd ); |
927 | |
928 ssize_t gftp_writefmt ( gftp_request * request, | |
929 int fd, | |
930 const char *fmt, | |
931 ... ); | |
932 | |
168 | 933 int gftp_fd_set_sockblocking ( gftp_request * request, |
58 | 934 int fd, |
935 int non_blocking ); | |
41 | 936 |
63 | 937 void gftp_swap_socks ( gftp_request * dest, |
938 gftp_request * source ); | |
939 | |
122 | 940 void gftp_calc_kbs ( gftp_transfer * tdata, |
941 ssize_t num_read ); | |
942 | |
125 | 943 int gftp_get_transfer_status ( gftp_transfer * tdata, |
944 ssize_t num_read ); | |
945 | |
182 | 946 int gftp_fd_open ( gftp_request * request, |
947 const char *pathname, | |
948 int flags, | |
949 mode_t perms ); | |
950 | |
146 | 951 /* pty.c */ |
210 | 952 char * gftp_get_pty_impl ( void ); |
179 | 953 |
210 | 954 pid_t gftp_exec_with_new_pty ( gftp_request * request, |
146 | 955 int *fdm, |
210 | 956 char **args ); |
146 | 957 |
210 | 958 pid_t gftp_exec_without_new_pty ( gftp_request * request, |
959 int *fdm, | |
960 char **args ); | |
146 | 961 |
168 | 962 #ifdef USE_SSL |
963 /* sslcommon.c */ | |
964 int gftp_ssl_startup ( gftp_request * request ); | |
965 | |
966 int gftp_ssl_session_setup ( gftp_request * request ); | |
967 | |
968 void gftp_ssl_free ( gftp_request * request ); | |
969 | |
970 ssize_t gftp_ssl_read ( gftp_request * request, | |
971 void *ptr, | |
972 size_t size, | |
973 int fd ); | |
974 | |
975 ssize_t gftp_ssl_write ( gftp_request * request, | |
976 const char *ptr, | |
977 size_t size, | |
978 int fd ); | |
979 #endif /* USE_SSL */ | |
980 | |
1 | 981 #endif |
982 |