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