Mercurial > gftp.yaz
annotate lib/gftp.h @ 40:66c064fd05bc
2002-10-17 Brian Masney <masneyb@gftp.org>
* lib/protocols.c - add gftp_abort_transfer function. Also, in
gftp_transfer_file, when we do a gftp_put_file, if that fails,
try to abort the transfer.
* lib/rfc959.c - add rfc959_abort_transfer function
* lib/rfc2068.c, lib/local.c - point abort_transfer pointer to
rfc2068_end_transfer and local_end_transfer respectively
* lib/ssh.c, lib/sshv2.c - add FIXME to implement abort function
* src/gtk/transfer.c - when we stop a transfer, try to abort it
first. If that fails, disconnect from the site completely
author | masneyb |
---|---|
date | Fri, 18 Oct 2002 02:53:52 +0000 |
parents | 5a178bd04ca5 |
children | 4bcfaf6307b5 |
rev | line source |
---|---|
1 | 1 /*****************************************************************************/ |
2 /* gftp.h - include file for the whole ftp program */ | |
3 /* Copyright (C) 1998-2002 Brian Masney <masneyb@gftp.org> */ | |
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 | |
60 #ifdef HAVE_STRING_H | |
61 #include <string.h> | |
62 #else | |
63 #include <strings.h> | |
64 #endif | |
65 | |
66 #ifdef ENABLE_NLS | |
67 #include <libintl.h> | |
68 #include <locale.h> | |
69 #define _(String) gettext (String) | |
70 #else | |
71 #define _(String) String | |
72 #endif | |
73 #define N_(String) String | |
74 | |
75 #ifndef AF_LOCAL | |
76 #define AF_LOCAL AF_UNIX | |
77 #endif | |
78 | |
79 #ifdef HAVE_DMALLOC | |
80 #include <dmalloc.h> | |
81 #endif | |
82 | |
83 /* Some general settings */ | |
84 #define BASE_CONF_DIR "~/.gftp" | |
85 #define CONFIG_FILE BASE_CONF_DIR "/gftprc" | |
86 #define BOOKMARKS_FILE BASE_CONF_DIR "/bookmarks" | |
87 #define LOG_FILE BASE_CONF_DIR "/gftp.log" | |
88 #define MAX_HIST_LEN 10 | |
89 | |
90 typedef enum gftp_transfer_type_tag | |
91 { | |
92 gftp_transfer_passive, | |
93 gftp_transfer_active | |
94 } gftp_transfer_type; | |
95 | |
96 | |
97 typedef enum gftp_logging_level_tag | |
98 { | |
99 gftp_logging_send, | |
100 gftp_logging_recv, | |
101 gftp_logging_error, | |
102 gftp_logging_misc | |
103 } gftp_logging_level; | |
104 | |
105 typedef void (*gftp_logging_func) ( gftp_logging_level level, | |
106 void *ptr, | |
107 const char *string, ... ); | |
108 | |
109 | |
110 typedef struct gftp_file_tag gftp_file; | |
111 | |
112 #define GFTP_TRANS_ACTION_OVERWRITE 1 | |
113 #define GFTP_TRANS_ACTION_RESUME 2 | |
114 #define GFTP_TRANS_ACTION_SKIP 3 | |
115 | |
116 #define GFTP_DIRECTION_DOWNLOAD 0 | |
117 #define GFTP_DIRECTION_UPLOAD 1 | |
118 | |
16 | 119 #define GFTP_SORT_COL_FILE 1 |
120 #define GFTP_SORT_COL_SIZE 2 | |
121 #define GFTP_SORT_COL_USER 3 | |
122 #define GFTP_SORT_COL_GROUP 4 | |
123 #define GFTP_SORT_COL_DATETIME 5 | |
124 #define GFTP_SORT_COL_ATTRIBS 6 | |
125 | |
1 | 126 struct gftp_file_tag |
127 { | |
128 char *file, /* Our filename */ | |
129 *user, /* User that owns it */ | |
130 *group, /* Group that owns it */ | |
131 *attribs, /* Attribs (-rwxr-x-rx) */ | |
132 *destfile; /* Full pathname to the destination for the | |
133 file transfer */ | |
134 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
|
135 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
|
136 startsize; /* Size to start the transfer at */ |
1 | 137 unsigned int isdir : 1, /* File type */ |
138 isexe : 1, | |
139 islink : 1, | |
140 isblock : 1, | |
141 ischar : 1, | |
142 issocket : 1, | |
143 isfifo : 1, | |
144 ascii : 1, /* Transfer in ASCII mode */ | |
145 selected : 1, /* Is this file selected? */ | |
146 was_sel : 1, /* Was this file selected before */ | |
147 shown : 1, /* Is this file shown? */ | |
148 done_view : 1, /* View the file when done transfering? */ | |
149 done_edit : 1, /* Edit the file when done transfering? */ | |
150 done_rm : 1, /* Remove the file when done */ | |
151 transfer_done : 1, /* Is current file transfer done? */ | |
152 is_fd : 1; /* Is this a file descriptor? */ | |
153 char transfer_action; /* See the GFTP_TRANS_ACTION_* vars above */ | |
154 void *node; /* Pointer to the node for the gui */ | |
155 FILE * fd; | |
156 }; | |
157 | |
158 | |
159 typedef struct gftp_proxy_hosts_tag | |
160 { | |
161 gint32 ipv4_network_address, | |
162 ipv4_netmask; | |
163 char *domain; | |
164 } gftp_proxy_hosts; | |
165 | |
166 | |
167 typedef struct gftp_request_tag gftp_request; | |
168 | |
169 struct gftp_request_tag | |
170 { | |
171 int protonum; /* Current number of the protocol this is | |
172 set to */ | |
173 char *hostname, /* Hostname we will connect to */ | |
174 *username, /* Username for host*/ | |
175 *password, /* Password for host */ | |
176 *account, /* Account for host (FTP only) */ | |
177 *directory, /* Current working directory */ | |
178 *proxy_config, /* Proxy configuration */ | |
179 *proxy_hostname, /* Proxy hostname */ | |
180 *proxy_username, /* Proxy username */ | |
181 *proxy_password, /* Proxy password */ | |
182 *proxy_account, /* Proxy account (FTP only) */ | |
183 *url_prefix, /* URL Prefix (ex: ftp) */ | |
184 *protocol_name, /* Protocol description */ | |
185 *last_ftp_response, /* Last response from server */ | |
186 *last_dir_entry; /* Last dir entry from server */ | |
187 size_t last_dir_entry_len; /* Length of last_dir_entry */ | |
188 | |
189 unsigned int port, /* Port of remote site */ | |
190 proxy_port; /* Port of the proxy server */ | |
191 | |
192 FILE *sockfd, /* Control connection (read) */ | |
193 *sockfd_write, /* Control connection (write) */ | |
194 *datafd, /* Data connection */ | |
195 *cachefd; /* For the directory cache */ | |
196 int wakeup_main_thread[2]; /* FD that gets written to by the threads | |
197 to wakeup the parent */ | |
198 | |
199 #if defined (HAVE_GETADDRINFO) && defined (HAVE_GAI_STRERROR) | |
200 struct addrinfo *hostp; /* Remote host we are connected to */ | |
201 #else | |
202 struct hostent host, *hostp; /* Remote host we are connected to */ | |
203 #endif | |
204 | |
205 int data_type; /* ASCII or BINARY (FTP only) */ | |
206 unsigned int use_proxy : 1, /* Go out of proxy server */ | |
207 always_connected : 1, | |
208 need_hostport : 1, | |
209 need_userpass : 1, | |
210 use_cache : 1, /* Enable or disable the cache */ | |
211 use_threads : 1, /* Whether we need to spawn a thread | |
212 for this protocol */ | |
213 cached : 1, /* Is this directory listing cached? */ | |
214 stopable : 1; | |
215 | |
216 off_t gotbytes; | |
217 | |
218 void *protocol_data; | |
219 | |
220 gftp_logging_func logging_function; | |
221 void *user_data; | |
222 | |
223 void (*init) ( gftp_request * request ); | |
224 void (*destroy) ( gftp_request * request ); | |
225 int (*connect) ( gftp_request * request ); | |
226 void (*disconnect) ( gftp_request * request ); | |
227 long (*get_file) ( gftp_request * request, | |
228 const char *filename, | |
229 FILE * fd, | |
230 off_t startsize ); | |
231 int (*put_file) ( gftp_request * request, | |
232 const char *filename, | |
233 FILE * fd, | |
234 off_t startsize, | |
235 off_t totalsize ); | |
236 long (*transfer_file) ( gftp_request * fromreq, | |
237 const char *fromfile, | |
238 off_t fromsize, | |
239 gftp_request * toreq, | |
240 const char *tofile, | |
241 off_t tosize ); | |
242 size_t (*get_next_file_chunk) ( gftp_request * request, | |
243 char *buf, | |
244 size_t size ); | |
245 size_t (*put_next_file_chunk) ( gftp_request * request, | |
246 char *buf, | |
247 size_t size ); | |
248 int (*end_transfer) ( gftp_request * request ); | |
40 | 249 int (*abort_transfer) ( gftp_request * request ); |
1 | 250 int (*list_files) ( gftp_request * request ); |
251 int (*get_next_file) ( gftp_request * request, | |
252 gftp_file *fle, | |
253 FILE *fd ); | |
254 int (*set_data_type) ( gftp_request * request, | |
255 int data_type ); | |
256 off_t (*get_file_size) ( gftp_request * request, | |
257 const char *filename ); | |
258 int (*chdir) ( gftp_request * request, | |
259 const char *directory ); | |
260 int (*rmdir) ( gftp_request * request, | |
261 const char *directory ); | |
262 int (*rmfile) ( gftp_request * request, | |
263 const char *filename ); | |
264 int (*mkdir) ( gftp_request * request, | |
265 const char *directory ); | |
266 int (*rename) ( gftp_request * request, | |
267 const char *oldname, | |
268 const char *newname ); | |
269 int (*chmod) ( gftp_request * request, | |
270 const char *filename, | |
271 int mode ); | |
272 int (*set_file_time) ( gftp_request * request, | |
273 const char *filename, | |
274 time_t datettime ); | |
275 int (*site) ( gftp_request * request, | |
276 const char *filename ); | |
277 int (*parse_url) ( gftp_request * request, | |
278 const char *url ); | |
279 | |
280 /* Options */ | |
281 gftp_transfer_type transfer_type; /* Passive or non-passive (FTP only) */ | |
282 int network_timeout, | |
283 retries, | |
284 sleep_time, | |
285 passive_transfer; | |
286 float maxkbs; | |
287 char *sftpserv_path; | |
288 }; | |
289 | |
290 | |
291 typedef struct gftp_transfer_tag gftp_transfer; | |
292 | |
293 struct gftp_transfer_tag | |
294 { | |
295 gftp_request * fromreq, | |
296 * toreq; | |
297 | |
298 unsigned int transfer_direction : 1, | |
299 cancel : 1, | |
300 ready : 1, | |
301 started : 1, | |
302 done : 1, | |
303 show : 1, | |
304 stalled : 1, | |
305 next_file : 1, | |
14
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
1
diff
changeset
|
306 skip_file : 1; |
1 | 307 |
308 struct timeval starttime, | |
309 lasttime; | |
310 | |
311 double kbs; | |
312 | |
313 GList * files, | |
314 * curfle, | |
315 * updfle; | |
316 | |
19 | 317 long numfiles, |
318 numdirs, | |
319 current_file_number, | |
320 current_file_retries; | |
1 | 321 |
322 off_t curtrans, /* Current transfered bytes for this file */ | |
323 curresumed, /* Resumed bytes for this file */ | |
324 trans_bytes, /* Amount of data transfered for entire | |
325 transfer */ | |
326 total_bytes, /* Grand total bytes for whole transfer */ | |
327 resumed_bytes; /* Grand total of resumed bytes for whole | |
328 transfer */ | |
329 | |
330 void * fromwdata, | |
331 * towdata; | |
332 | |
333 void *statmutex, | |
334 *structmutex; | |
335 void *node; | |
336 void *clist; | |
337 }; | |
338 | |
339 | |
340 typedef struct gftp_log_tag | |
341 { | |
342 char *msg; | |
343 gftp_logging_level type; | |
344 } gftp_log; | |
345 | |
346 | |
347 typedef struct supported_gftp_protocols_tag | |
348 { | |
349 char *name; /* Description of protocol */ | |
350 void (*init) (gftp_request * request); /* Init function */ | |
351 char *url_prefix; /* URL Prefix */ | |
352 int shown; /* Whether this protocol is shown or not to the user | |
353 in the protocol dropdown box */ | |
354 } supported_gftp_protocols; | |
355 | |
356 | |
357 typedef struct gftp_bookmarks_tag gftp_bookmarks; | |
358 | |
359 struct gftp_bookmarks_tag | |
360 { | |
361 char *path; /* Path */ | |
362 char *hostname, /* Our actual internet hostname */ | |
363 *protocol, /* Protocol we will connect through */ | |
364 *remote_dir, /* Initial directory */ | |
365 *local_dir, /* Init local directory */ | |
366 *user, /* Username to log in as */ | |
367 *pass, /* Our password */ | |
368 *acct; /* Account */ | |
369 | |
370 unsigned int port, /* The port we will connect to */ | |
371 isfolder : 1, /* If this is set, then the children field can | |
372 be non-NULL */ | |
373 save_password : 1; /* Save this password */ | |
374 gftp_bookmarks *children, /* The children of this node. */ | |
375 *prev, /* The parent of this node */ | |
376 *next; /* The next sibling of this node */ | |
377 gpointer cnode; | |
378 | |
379 /* Site options */ | |
380 char *sftpserv_path; /* Path to the sftp server */ | |
381 }; | |
382 | |
383 | |
384 typedef struct gftp_file_extensions_tag | |
385 { | |
386 char *ext, /* The file extension to register */ | |
387 *filename, /* The xpm file to display */ | |
388 *view_program, /* The program used to view this file */ | |
389 *ascii_binary; /* Is this a ASCII transfer or a BINARY transfer */ | |
390 int stlen; /* How long is the file extension. */ | |
391 } gftp_file_extensions; | |
392 | |
393 | |
394 typedef struct gftp_color_tag | |
395 { | |
396 gushort red, | |
397 green, | |
398 blue; | |
399 } gftp_color; | |
400 | |
401 | |
402 typedef struct gftp_config_vars_tag | |
403 { | |
404 char *key, /* variable name */ | |
405 *description; /* How this field will show up in the dialog */ | |
406 gpointer var; /* Pointer to our variable */ | |
37 | 407 int type; /* See defines below */ |
1 | 408 char *comment; /* Comment to write out to the config file */ |
409 gpointer widget; | |
37 | 410 int ports_shown; /* What ports of gFTP is this option shown in */ |
1 | 411 } gftp_config_vars; |
412 | |
413 #define CONFIG_INTTEXT 1 | |
414 #define CONFIG_FLOATTEXT 2 | |
415 #define CONFIG_CHECKBOX 3 | |
416 #define CONFIG_LABEL 4 | |
417 #define CONFIG_NOTEBOOK 5 | |
418 #define CONFIG_HIDEINT 6 | |
419 #define CONFIG_TABLE 7 | |
420 #define CONFIG_CHARTEXT 8 | |
421 #define CONFIG_COMBO 9 | |
422 #define CONFIG_TEXT 10 | |
423 #define CONFIG_COLOR 11 | |
424 #define CONFIG_UINTTEXT 12 | |
425 #define CONFIG_CHARPASS 13 | |
426 | |
37 | 427 #define GFTP_PORT_GTK (1 << 1) |
428 #define GFTP_PORT_TEXT (1 << 2) | |
429 #define GFTP_PORT_ALL (GFTP_PORT_GTK | GFTP_PORT_TEXT) | |
430 | |
1 | 431 typedef struct gftp_proxy_type_tag |
432 { | |
433 char *key, | |
434 *description; | |
435 } gftp_proxy_type; | |
436 | |
437 #define GFTP_CUSTOM_PROXY_NUM 8 | |
438 | |
439 /* Global config options */ | |
440 extern supported_gftp_protocols gftp_protocols[]; | |
441 extern char version[], *emailaddr, *edit_program, *view_program, | |
442 *firewall_host, *firewall_username, *firewall_password, | |
443 *firewall_account, *proxy_config, *http_proxy_host, | |
444 *http_proxy_username, *http_proxy_password, *tmp_directory, | |
445 *startup_directory, *ssh_prog_name, *ssh_extra_params, | |
446 **ssh_extra_params_list, *default_protocol, *ssh1_sftp_path, | |
447 *ssh2_sftp_path; | |
448 extern int num_ssh_extra_params; | |
449 extern FILE * logfd; | |
450 extern double maxkbs; | |
451 extern GList * proxy_hosts, * registered_exts, * viewedit_processes, | |
452 * file_transfers, * file_transfer_logs; | |
453 extern gftp_bookmarks * bookmarks; | |
454 extern int do_one_transfer_at_a_time, start_file_transfers, | |
455 transfer_in_progress, passive_transfer, sort_dirs_first, | |
456 use_default_dl_types, show_hidden_files, refresh_files, | |
457 listbox_local_width, listbox_remote_width, listbox_file_height, | |
458 transfer_height, log_height, retries, sleep_time, network_timeout, | |
459 use_http11, listbox_dblclick_action, file_trans_column, | |
460 local_columns[6], remote_columns[6], resolve_symlinks, | |
461 firewall_port, http_proxy_port, overwrite_by_default, | |
462 append_file_transfers, enable_old_ssh, ssh_need_userpass, | |
37 | 463 ssh_use_askpass, sshv2_use_sftp_subsys, local_sortcol, |
464 local_sortasds, remote_sortcol, remote_sortasds; | |
1 | 465 extern guint max_log_window_size; |
466 extern GHashTable * bookmarks_htable, * config_htable; | |
467 extern GList * localhistory, * remotehistory, * host_history, * port_history, | |
468 * user_history; | |
469 extern unsigned int host_len, port_len, user_len, localhistlen, remotehistlen; | |
470 extern volatile sig_atomic_t viewedit_process_done; | |
471 extern gftp_config_vars config_file_vars[]; | |
472 extern gftp_proxy_type proxy_type[]; | |
473 extern gftp_color send_color, recv_color, error_color, misc_color; | |
474 | |
475 /* cache.c */ | |
476 FILE * gftp_new_cache_entry ( gftp_request * request ); | |
477 | |
478 FILE * gftp_find_cache_entry ( gftp_request * request ); | |
479 | |
480 void gftp_clear_cache_files ( void ); | |
481 | |
482 void gftp_delete_cache_entry ( gftp_request * request ); | |
483 | |
484 /* config_file.c */ | |
485 void gftp_read_config_file ( char **argv, | |
486 int get_xpms ); | |
487 | |
488 void gftp_read_bookmarks ( void ); | |
489 | |
490 void add_to_bookmark ( gftp_bookmarks *newentry ); | |
491 | |
492 void gftp_write_config_file ( void ); | |
493 | |
26 | 494 void gftp_write_bookmarks_file ( void ); |
495 | |
1 | 496 GHashTable * build_bookmarks_hash_table ( gftp_bookmarks * entry ); |
497 | |
498 void print_bookmarks ( gftp_bookmarks * bookmarks ); | |
499 | |
500 /* misc.c */ | |
14
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
1
diff
changeset
|
501 char *insert_commas ( off_t number, |
1 | 502 char *dest_str, |
503 size_t dest_len ); | |
504 | |
505 long file_countlf ( int filefd, | |
506 long endpos ); | |
507 | |
508 char *alltrim ( char *str ); | |
509 | |
510 char *expand_path ( const char *src ); | |
511 | |
512 void remove_double_slashes ( char *string ); | |
513 | |
514 void make_nonnull ( char **str ); | |
515 | |
516 int copyfile ( char *source, | |
517 char *dest ); | |
518 | |
519 char *get_xpm_path ( char *filename, | |
520 int quit_on_err ); | |
521 | |
522 int gftp_match_filespec ( char *filename, | |
523 char *filespec ); | |
524 | |
525 int gftp_parse_command_line ( int *argc, | |
526 char ***argv ); | |
527 | |
528 void gftp_usage ( void ); | |
529 | |
530 gint string_hash_compare ( gconstpointer path1, | |
531 gconstpointer path2 ); | |
532 | |
533 guint string_hash_function ( gconstpointer key ); | |
534 | |
535 void free_file_list ( GList * filelist ); | |
536 | |
537 void free_fdata ( gftp_file * fle ); | |
538 | |
539 gftp_file * copy_fdata ( gftp_file * fle ); | |
540 | |
541 void swap_socks ( gftp_request * dest, | |
542 gftp_request * source ); | |
543 | |
544 int compare_request ( gftp_request * request1, | |
545 gftp_request * request2, | |
546 int compare_dirs ); | |
547 | |
548 void free_tdata ( gftp_transfer * tdata ); | |
549 | |
550 gftp_request * copy_request ( gftp_request * req ); | |
551 | |
552 int ptym_open ( char *pts_name ); | |
553 | |
554 int ptys_open ( int fdm, | |
555 char *pts_name ); | |
556 | |
557 int tty_raw ( int fd ); | |
558 | |
559 char **make_ssh_exec_args ( gftp_request * request, | |
560 char *execname, | |
561 int use_sftp_subsys, | |
562 char *portstring ); | |
563 | |
564 char * ssh_start_login_sequence ( gftp_request * request, | |
565 int fd ); | |
566 | |
567 #ifdef G_HAVE_GINT64 | |
568 gint64 hton64 ( gint64 val ); | |
569 #endif | |
570 | |
16 | 571 GList * gftp_sort_filelist ( GList * filelist, |
572 int column, | |
573 int asds ); | |
574 | |
1 | 575 /* protocols.c */ |
576 #define GFTP_CONNECTED(request) (request->sockfd != NULL) | |
577 #define GFTP_GET_HOSTNAME(request) (request->hostname) | |
578 #define GFTP_GET_USERNAME(request) (request->username) | |
579 #define GFTP_GET_PASSWORD(request) (request->password) | |
580 #define GFTP_GET_ACCOUNT(request) (request->account) | |
581 #define GFTP_GET_DIRECTORY(request) (request->directory) | |
582 #define GFTP_GET_PORT(request) (request->port) | |
583 #define GFTP_GET_PROXY_CONFIG(request) (request->proxy_config) | |
584 #define GFTP_GET_PROXY_HOSTNAME(request) (request->proxy_hostname) | |
585 #define GFTP_GET_PROXY_USERNAME(request) (request->proxy_username) | |
586 #define GFTP_GET_PROXY_PASSWORD(request) (request->proxy_password) | |
587 #define GFTP_GET_PROXY_ACCOUNT(request) (request->proxy_account) | |
588 #define GFTP_GET_PROXY_PORT(request) (request->proxy_port) | |
589 #define GFTP_GET_URL_PREFIX(request) (request->url_prefix) | |
590 #define GFTP_GET_PROTOCOL_NAME(request) (request->protocol_name) | |
591 #define GFTP_GET_LAST_RESPONSE(request) (request->last_ftp_response) | |
592 #define GFTP_GET_LAST_DIRENT(request) (request->last_dir_entry) | |
593 #define GFTP_GET_LAST_DIRENT_LEN(request) (request->last_dir_entry_len) | |
594 #define GFTP_GET_CONTROL_FD(request) (request->sockfd) | |
595 #define GFTP_GET_DATA_FD(request) (request->datafd) | |
596 #define GFTP_GET_DATA_TYPE(request) (request->data_type) | |
597 #define GFTP_GET_TRANSFER_TYPE(request) (request->transfer_type) | |
598 #define GFTP_SET_TRANSFER_TYPE(request,val) (request->transfer_type = (val)) | |
599 #define GFTP_GET_LOGGING(request) (request->logging) | |
600 #define GFTP_SET_LOGGING(request, val) (request->logging = (val)) | |
601 #define GFTP_UNSAFE_SYMLINKS(request) (request->unsafe_symlinks) | |
602 #define GFTP_FTP_NUM 0 | |
603 #define GFTP_HTTP_NUM 1 | |
604 #define GFTP_LOCAL_NUM 2 | |
605 #define GFTP_SSHV2_NUM 3 | |
606 #define GFTP_BOOKMARK_NUM 4 | |
607 #define GFTP_SSH_NUM 5 | |
608 #define GFTP_TYPE_BINARY 1 | |
609 #define GFTP_TYPE_ASCII 2 | |
610 #define GFTP_IS_CONNECTED(request) ((request) != NULL && \ | |
611 ((request)->sockfd != NULL || \ | |
612 (request)->cached)) | |
613 | |
614 | |
615 void rfc959_init ( gftp_request * request ); | |
616 | |
617 int rfc959_get_next_file ( gftp_request * request, | |
618 gftp_file *fle, | |
619 FILE *fd ); | |
620 | |
621 void rfc2068_init ( gftp_request * request ); | |
622 | |
623 void local_init ( gftp_request * request ); | |
624 | |
625 void ssh_init ( gftp_request * request ); | |
626 | |
627 void sshv2_init ( gftp_request * request ); | |
628 | |
629 void bookmark_init ( gftp_request * request ); | |
630 | |
631 gftp_request *gftp_request_new ( void ); | |
632 | |
633 void gftp_request_destroy ( gftp_request * request ); | |
634 | |
635 void gftp_file_destroy ( gftp_file *file ); | |
636 | |
637 int gftp_connect ( gftp_request * request ); | |
638 | |
639 void gftp_disconnect ( gftp_request * request ); | |
640 | |
641 size_t gftp_get_file ( gftp_request * request, | |
642 const char *filename, | |
643 FILE * fd, | |
644 size_t startsize ); | |
645 | |
646 int gftp_put_file ( gftp_request * request, | |
647 const char *filename, | |
648 FILE * fd, | |
649 size_t startsize, | |
650 size_t totalsize ); | |
651 | |
652 long gftp_transfer_file ( gftp_request *fromreq, | |
653 const char *fromfile, | |
654 FILE * fromfd, | |
655 size_t fromsize, | |
656 gftp_request *toreq, | |
657 const char *tofile, | |
658 FILE * tofd, | |
659 size_t tosize ); | |
660 | |
661 size_t gftp_get_next_file_chunk ( gftp_request * request, | |
662 char *buf, | |
663 size_t size ); | |
664 | |
665 size_t gftp_put_next_file_chunk ( gftp_request * request, | |
666 char *buf, | |
667 size_t size ); | |
668 | |
669 int gftp_list_files ( gftp_request * request ); | |
670 | |
671 int gftp_parse_url ( gftp_request * request, | |
672 const char *url ); | |
673 | |
674 int gftp_get_next_file ( gftp_request * request, | |
675 char *filespec, | |
676 gftp_file *fle ); | |
677 | |
678 int gftp_end_transfer ( gftp_request * request ); | |
679 | |
40 | 680 int gftp_abort_transfer ( gftp_request * request ); |
681 | |
1 | 682 int gftp_read_response ( gftp_request * request ); |
683 | |
684 int gftp_set_data_type ( gftp_request * request, | |
685 int data_type ); | |
686 | |
687 void gftp_set_hostname ( gftp_request * request, | |
688 const char *hostname ); | |
689 | |
690 void gftp_set_username ( gftp_request * request, | |
691 const char *username ); | |
692 | |
693 void gftp_set_password ( gftp_request * request, | |
694 const char *password ); | |
695 | |
696 void gftp_set_account ( gftp_request * request, | |
697 const char *account ); | |
698 | |
699 int gftp_set_directory ( gftp_request * request, | |
700 const char *directory ); | |
701 | |
702 void gftp_set_port ( gftp_request * request, | |
703 unsigned int port ); | |
704 | |
705 void gftp_set_proxy_hostname ( gftp_request * request, | |
706 const char *hostname ); | |
707 | |
708 void gftp_set_proxy_username ( gftp_request * request, | |
709 const char *username ); | |
710 | |
711 void gftp_set_proxy_password ( gftp_request * request, | |
712 const char *password ); | |
713 | |
714 void gftp_set_proxy_account ( gftp_request * request, | |
715 const char *account ); | |
716 | |
717 void gftp_set_proxy_port ( gftp_request * request, | |
718 unsigned int port ); | |
719 | |
720 int gftp_remove_directory ( gftp_request * request, | |
721 const char *directory ); | |
722 | |
723 int gftp_remove_file ( gftp_request * request, | |
724 const char *file ); | |
725 | |
726 int gftp_make_directory ( gftp_request * request, | |
727 const char *directory ); | |
728 | |
729 int gftp_rename_file ( gftp_request * request, | |
730 const char *oldname, | |
731 const char *newname ); | |
732 | |
733 int gftp_chmod ( gftp_request * request, | |
734 const char *file, | |
735 int mode ); | |
736 | |
737 int gftp_set_file_time ( gftp_request * request, | |
738 const char *file, | |
739 time_t datetime ); | |
740 | |
741 char gftp_site_cmd ( gftp_request * request, | |
742 const char *command ); | |
743 | |
744 void gftp_set_proxy_config ( gftp_request * request, | |
745 const char *proxy_config ); | |
746 | |
747 long gftp_get_file_size ( gftp_request * request, | |
748 const char *filename ); | |
749 | |
750 int gftp_need_proxy ( gftp_request * request, | |
751 char *service ); | |
752 | |
753 char *gftp_convert_ascii ( char *buf, | |
754 ssize_t *len, | |
755 int direction ); | |
756 | |
757 void gftp_calc_kbs ( gftp_transfer * tdata, | |
758 ssize_t num_read ); | |
759 | |
760 int gftp_parse_ls ( const char *lsoutput, | |
761 gftp_file *fle ); | |
762 | |
763 int gftp_get_all_subdirs ( gftp_transfer * transfer, | |
764 void (*update_func) | |
765 ( gftp_transfer * transfer )); | |
766 | |
767 int gftp_get_file_transfer_mode ( char *filename, | |
768 int def ); | |
769 | |
770 int gftp_connect_server ( gftp_request * request, | |
771 char *service ); | |
772 | |
773 void gftp_set_sftpserv_path ( gftp_request * request, | |
774 char *path ); | |
775 | |
776 #if defined (HAVE_GETADDRINFO) && defined (HAVE_GAI_STRERROR) | |
777 | |
778 int get_port ( struct addrinfo *addr ); | |
779 | |
780 #else | |
781 | |
782 struct hostent *r_gethostbyname ( const char *name, | |
783 struct hostent *result_buf, | |
784 int *h_errnop ); | |
785 | |
786 struct servent *r_getservbyname ( const char *name, | |
787 const char *proto, | |
788 struct servent *result_buf, | |
789 int *h_errnop ); | |
790 #endif | |
791 | |
792 void gftp_set_config_options ( gftp_request * request ); | |
793 | |
794 void print_file_list ( GList * list ); | |
795 | |
796 #endif | |
797 |