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