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