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