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