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