Mercurial > gftp.yaz
annotate lib/gftp.h @ 47:eec25f215772
2002-11-5 Brian Masney <masneyb@gftp.org>
* lib/cache.c lib/gftp.h - added second argument ignore_directory to
gftp_delete_cache_entry
* src/gtk/menu-items.c (disconnect) - when disconnecting from the
remote site, clear all cache entries for that site
* src/gtk/delete_dialog.c src/gtk/misc-gtk.c src/gtk/mkdir_dialog.c -
pass a 0 as second argument to gftp_delete_cache_entry
author | masneyb |
---|---|
date | Tue, 05 Nov 2002 20:36:11 +0000 |
parents | 4bcfaf6307b5 |
children | e5f6054590b5 |
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? */ | |
41 | 214 cancel : 1, /* If a signal is received, should |
215 we cancel this operation */ | |
1 | 216 stopable : 1; |
217 | |
218 off_t gotbytes; | |
219 | |
220 void *protocol_data; | |
221 | |
222 gftp_logging_func logging_function; | |
223 void *user_data; | |
224 | |
225 void (*init) ( gftp_request * request ); | |
226 void (*destroy) ( gftp_request * request ); | |
227 int (*connect) ( gftp_request * request ); | |
228 void (*disconnect) ( gftp_request * request ); | |
229 long (*get_file) ( gftp_request * request, | |
230 const char *filename, | |
231 FILE * fd, | |
232 off_t startsize ); | |
233 int (*put_file) ( gftp_request * request, | |
234 const char *filename, | |
235 FILE * fd, | |
236 off_t startsize, | |
237 off_t totalsize ); | |
238 long (*transfer_file) ( gftp_request * fromreq, | |
239 const char *fromfile, | |
240 off_t fromsize, | |
241 gftp_request * toreq, | |
242 const char *tofile, | |
243 off_t tosize ); | |
244 size_t (*get_next_file_chunk) ( gftp_request * request, | |
245 char *buf, | |
246 size_t size ); | |
247 size_t (*put_next_file_chunk) ( gftp_request * request, | |
248 char *buf, | |
249 size_t size ); | |
250 int (*end_transfer) ( gftp_request * request ); | |
40 | 251 int (*abort_transfer) ( gftp_request * request ); |
1 | 252 int (*list_files) ( gftp_request * request ); |
253 int (*get_next_file) ( gftp_request * request, | |
254 gftp_file *fle, | |
255 FILE *fd ); | |
256 int (*set_data_type) ( gftp_request * request, | |
257 int data_type ); | |
258 off_t (*get_file_size) ( gftp_request * request, | |
259 const char *filename ); | |
260 int (*chdir) ( gftp_request * request, | |
261 const char *directory ); | |
262 int (*rmdir) ( gftp_request * request, | |
263 const char *directory ); | |
264 int (*rmfile) ( gftp_request * request, | |
265 const char *filename ); | |
266 int (*mkdir) ( gftp_request * request, | |
267 const char *directory ); | |
268 int (*rename) ( gftp_request * request, | |
269 const char *oldname, | |
270 const char *newname ); | |
271 int (*chmod) ( gftp_request * request, | |
272 const char *filename, | |
273 int mode ); | |
274 int (*set_file_time) ( gftp_request * request, | |
275 const char *filename, | |
276 time_t datettime ); | |
277 int (*site) ( gftp_request * request, | |
278 const char *filename ); | |
279 int (*parse_url) ( gftp_request * request, | |
280 const char *url ); | |
281 | |
282 /* Options */ | |
283 gftp_transfer_type transfer_type; /* Passive or non-passive (FTP only) */ | |
284 int network_timeout, | |
285 retries, | |
286 sleep_time, | |
287 passive_transfer; | |
288 float maxkbs; | |
289 char *sftpserv_path; | |
290 }; | |
291 | |
292 | |
293 typedef struct gftp_transfer_tag gftp_transfer; | |
294 | |
295 struct gftp_transfer_tag | |
296 { | |
297 gftp_request * fromreq, | |
298 * toreq; | |
299 | |
300 unsigned int transfer_direction : 1, | |
301 cancel : 1, | |
302 ready : 1, | |
303 started : 1, | |
304 done : 1, | |
305 show : 1, | |
306 stalled : 1, | |
307 next_file : 1, | |
14
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
1
diff
changeset
|
308 skip_file : 1; |
1 | 309 |
310 struct timeval starttime, | |
311 lasttime; | |
312 | |
313 double kbs; | |
314 | |
315 GList * files, | |
316 * curfle, | |
317 * updfle; | |
318 | |
19 | 319 long numfiles, |
320 numdirs, | |
321 current_file_number, | |
322 current_file_retries; | |
1 | 323 |
324 off_t curtrans, /* Current transfered bytes for this file */ | |
325 curresumed, /* Resumed bytes for this file */ | |
326 trans_bytes, /* Amount of data transfered for entire | |
327 transfer */ | |
328 total_bytes, /* Grand total bytes for whole transfer */ | |
329 resumed_bytes; /* Grand total of resumed bytes for whole | |
330 transfer */ | |
331 | |
332 void * fromwdata, | |
333 * towdata; | |
334 | |
335 void *statmutex, | |
336 *structmutex; | |
337 void *node; | |
338 void *clist; | |
339 }; | |
340 | |
341 | |
342 typedef struct gftp_log_tag | |
343 { | |
344 char *msg; | |
345 gftp_logging_level type; | |
346 } gftp_log; | |
347 | |
348 | |
349 typedef struct supported_gftp_protocols_tag | |
350 { | |
351 char *name; /* Description of protocol */ | |
352 void (*init) (gftp_request * request); /* Init function */ | |
353 char *url_prefix; /* URL Prefix */ | |
354 int shown; /* Whether this protocol is shown or not to the user | |
355 in the protocol dropdown box */ | |
356 } supported_gftp_protocols; | |
357 | |
358 | |
359 typedef struct gftp_bookmarks_tag gftp_bookmarks; | |
360 | |
361 struct gftp_bookmarks_tag | |
362 { | |
363 char *path; /* Path */ | |
364 char *hostname, /* Our actual internet hostname */ | |
365 *protocol, /* Protocol we will connect through */ | |
366 *remote_dir, /* Initial directory */ | |
367 *local_dir, /* Init local directory */ | |
368 *user, /* Username to log in as */ | |
369 *pass, /* Our password */ | |
370 *acct; /* Account */ | |
371 | |
372 unsigned int port, /* The port we will connect to */ | |
373 isfolder : 1, /* If this is set, then the children field can | |
374 be non-NULL */ | |
375 save_password : 1; /* Save this password */ | |
376 gftp_bookmarks *children, /* The children of this node. */ | |
377 *prev, /* The parent of this node */ | |
378 *next; /* The next sibling of this node */ | |
379 gpointer cnode; | |
380 | |
381 /* Site options */ | |
382 char *sftpserv_path; /* Path to the sftp server */ | |
383 }; | |
384 | |
385 | |
386 typedef struct gftp_file_extensions_tag | |
387 { | |
388 char *ext, /* The file extension to register */ | |
389 *filename, /* The xpm file to display */ | |
390 *view_program, /* The program used to view this file */ | |
391 *ascii_binary; /* Is this a ASCII transfer or a BINARY transfer */ | |
392 int stlen; /* How long is the file extension. */ | |
393 } gftp_file_extensions; | |
394 | |
395 | |
396 typedef struct gftp_color_tag | |
397 { | |
398 gushort red, | |
399 green, | |
400 blue; | |
401 } gftp_color; | |
402 | |
403 | |
404 typedef struct gftp_config_vars_tag | |
405 { | |
406 char *key, /* variable name */ | |
407 *description; /* How this field will show up in the dialog */ | |
408 gpointer var; /* Pointer to our variable */ | |
37 | 409 int type; /* See defines below */ |
1 | 410 char *comment; /* Comment to write out to the config file */ |
411 gpointer widget; | |
37 | 412 int ports_shown; /* What ports of gFTP is this option shown in */ |
1 | 413 } gftp_config_vars; |
414 | |
415 #define CONFIG_INTTEXT 1 | |
416 #define CONFIG_FLOATTEXT 2 | |
417 #define CONFIG_CHECKBOX 3 | |
418 #define CONFIG_LABEL 4 | |
419 #define CONFIG_NOTEBOOK 5 | |
420 #define CONFIG_HIDEINT 6 | |
421 #define CONFIG_TABLE 7 | |
422 #define CONFIG_CHARTEXT 8 | |
423 #define CONFIG_COMBO 9 | |
424 #define CONFIG_TEXT 10 | |
425 #define CONFIG_COLOR 11 | |
426 #define CONFIG_UINTTEXT 12 | |
427 #define CONFIG_CHARPASS 13 | |
428 | |
37 | 429 #define GFTP_PORT_GTK (1 << 1) |
430 #define GFTP_PORT_TEXT (1 << 2) | |
431 #define GFTP_PORT_ALL (GFTP_PORT_GTK | GFTP_PORT_TEXT) | |
432 | |
1 | 433 typedef struct gftp_proxy_type_tag |
434 { | |
435 char *key, | |
436 *description; | |
437 } gftp_proxy_type; | |
438 | |
439 #define GFTP_CUSTOM_PROXY_NUM 8 | |
440 | |
441 /* Global config options */ | |
442 extern supported_gftp_protocols gftp_protocols[]; | |
443 extern char version[], *emailaddr, *edit_program, *view_program, | |
444 *firewall_host, *firewall_username, *firewall_password, | |
445 *firewall_account, *proxy_config, *http_proxy_host, | |
41 | 446 *http_proxy_username, *http_proxy_password, |
1 | 447 *startup_directory, *ssh_prog_name, *ssh_extra_params, |
448 **ssh_extra_params_list, *default_protocol, *ssh1_sftp_path, | |
449 *ssh2_sftp_path; | |
450 extern int num_ssh_extra_params; | |
451 extern FILE * logfd; | |
452 extern double maxkbs; | |
453 extern GList * proxy_hosts, * registered_exts, * viewedit_processes, | |
454 * file_transfers, * file_transfer_logs; | |
455 extern gftp_bookmarks * bookmarks; | |
456 extern int do_one_transfer_at_a_time, start_file_transfers, | |
457 transfer_in_progress, passive_transfer, sort_dirs_first, | |
458 use_default_dl_types, show_hidden_files, refresh_files, | |
459 listbox_local_width, listbox_remote_width, listbox_file_height, | |
460 transfer_height, log_height, retries, sleep_time, network_timeout, | |
461 use_http11, listbox_dblclick_action, file_trans_column, | |
462 local_columns[6], remote_columns[6], resolve_symlinks, | |
463 firewall_port, http_proxy_port, overwrite_by_default, | |
464 append_file_transfers, enable_old_ssh, ssh_need_userpass, | |
37 | 465 ssh_use_askpass, sshv2_use_sftp_subsys, local_sortcol, |
466 local_sortasds, remote_sortcol, remote_sortasds; | |
1 | 467 extern guint max_log_window_size; |
468 extern GHashTable * bookmarks_htable, * config_htable; | |
469 extern GList * localhistory, * remotehistory, * host_history, * port_history, | |
470 * user_history; | |
471 extern unsigned int host_len, port_len, user_len, localhistlen, remotehistlen; | |
472 extern volatile sig_atomic_t viewedit_process_done; | |
473 extern gftp_config_vars config_file_vars[]; | |
474 extern gftp_proxy_type proxy_type[]; | |
475 extern gftp_color send_color, recv_color, error_color, misc_color; | |
476 | |
477 /* cache.c */ | |
478 FILE * gftp_new_cache_entry ( gftp_request * request ); | |
479 | |
480 FILE * gftp_find_cache_entry ( gftp_request * request ); | |
481 | |
482 void gftp_clear_cache_files ( void ); | |
483 | |
47 | 484 void gftp_delete_cache_entry ( gftp_request * request, |
485 int ignore_directory ); | |
1 | 486 |
487 /* config_file.c */ | |
488 void gftp_read_config_file ( char **argv, | |
489 int get_xpms ); | |
490 | |
491 void gftp_read_bookmarks ( void ); | |
492 | |
493 void add_to_bookmark ( gftp_bookmarks *newentry ); | |
494 | |
495 void gftp_write_config_file ( void ); | |
496 | |
26 | 497 void gftp_write_bookmarks_file ( void ); |
498 | |
1 | 499 GHashTable * build_bookmarks_hash_table ( gftp_bookmarks * entry ); |
500 | |
501 void print_bookmarks ( gftp_bookmarks * bookmarks ); | |
502 | |
503 /* misc.c */ | |
14
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
1
diff
changeset
|
504 char *insert_commas ( off_t number, |
1 | 505 char *dest_str, |
506 size_t dest_len ); | |
507 | |
508 long file_countlf ( int filefd, | |
509 long endpos ); | |
510 | |
511 char *alltrim ( char *str ); | |
512 | |
513 char *expand_path ( const char *src ); | |
514 | |
515 void remove_double_slashes ( char *string ); | |
516 | |
517 void make_nonnull ( char **str ); | |
518 | |
519 int copyfile ( char *source, | |
520 char *dest ); | |
521 | |
522 char *get_xpm_path ( char *filename, | |
523 int quit_on_err ); | |
524 | |
525 int gftp_match_filespec ( char *filename, | |
526 char *filespec ); | |
527 | |
528 int gftp_parse_command_line ( int *argc, | |
529 char ***argv ); | |
530 | |
531 void gftp_usage ( void ); | |
532 | |
533 gint string_hash_compare ( gconstpointer path1, | |
534 gconstpointer path2 ); | |
535 | |
536 guint string_hash_function ( gconstpointer key ); | |
537 | |
538 void free_file_list ( GList * filelist ); | |
539 | |
540 void free_fdata ( gftp_file * fle ); | |
541 | |
542 gftp_file * copy_fdata ( gftp_file * fle ); | |
543 | |
544 void swap_socks ( gftp_request * dest, | |
545 gftp_request * source ); | |
546 | |
547 int compare_request ( gftp_request * request1, | |
548 gftp_request * request2, | |
549 int compare_dirs ); | |
550 | |
551 void free_tdata ( gftp_transfer * tdata ); | |
552 | |
553 gftp_request * copy_request ( gftp_request * req ); | |
554 | |
555 int ptym_open ( char *pts_name ); | |
556 | |
557 int ptys_open ( int fdm, | |
558 char *pts_name ); | |
559 | |
560 int tty_raw ( int fd ); | |
561 | |
562 char **make_ssh_exec_args ( gftp_request * request, | |
563 char *execname, | |
564 int use_sftp_subsys, | |
565 char *portstring ); | |
566 | |
567 char * ssh_start_login_sequence ( gftp_request * request, | |
568 int fd ); | |
569 | |
570 #ifdef G_HAVE_GINT64 | |
571 gint64 hton64 ( gint64 val ); | |
572 #endif | |
573 | |
16 | 574 GList * gftp_sort_filelist ( GList * filelist, |
575 int column, | |
576 int asds ); | |
577 | |
1 | 578 /* protocols.c */ |
579 #define GFTP_CONNECTED(request) (request->sockfd != NULL) | |
580 #define GFTP_GET_HOSTNAME(request) (request->hostname) | |
581 #define GFTP_GET_USERNAME(request) (request->username) | |
582 #define GFTP_GET_PASSWORD(request) (request->password) | |
583 #define GFTP_GET_ACCOUNT(request) (request->account) | |
584 #define GFTP_GET_DIRECTORY(request) (request->directory) | |
585 #define GFTP_GET_PORT(request) (request->port) | |
586 #define GFTP_GET_PROXY_CONFIG(request) (request->proxy_config) | |
587 #define GFTP_GET_PROXY_HOSTNAME(request) (request->proxy_hostname) | |
588 #define GFTP_GET_PROXY_USERNAME(request) (request->proxy_username) | |
589 #define GFTP_GET_PROXY_PASSWORD(request) (request->proxy_password) | |
590 #define GFTP_GET_PROXY_ACCOUNT(request) (request->proxy_account) | |
591 #define GFTP_GET_PROXY_PORT(request) (request->proxy_port) | |
592 #define GFTP_GET_URL_PREFIX(request) (request->url_prefix) | |
593 #define GFTP_GET_PROTOCOL_NAME(request) (request->protocol_name) | |
594 #define GFTP_GET_LAST_RESPONSE(request) (request->last_ftp_response) | |
595 #define GFTP_GET_LAST_DIRENT(request) (request->last_dir_entry) | |
596 #define GFTP_GET_LAST_DIRENT_LEN(request) (request->last_dir_entry_len) | |
597 #define GFTP_GET_CONTROL_FD(request) (request->sockfd) | |
598 #define GFTP_GET_DATA_FD(request) (request->datafd) | |
599 #define GFTP_GET_DATA_TYPE(request) (request->data_type) | |
600 #define GFTP_GET_TRANSFER_TYPE(request) (request->transfer_type) | |
601 #define GFTP_SET_TRANSFER_TYPE(request,val) (request->transfer_type = (val)) | |
602 #define GFTP_GET_LOGGING(request) (request->logging) | |
603 #define GFTP_SET_LOGGING(request, val) (request->logging = (val)) | |
604 #define GFTP_UNSAFE_SYMLINKS(request) (request->unsafe_symlinks) | |
605 #define GFTP_FTP_NUM 0 | |
606 #define GFTP_HTTP_NUM 1 | |
607 #define GFTP_LOCAL_NUM 2 | |
608 #define GFTP_SSHV2_NUM 3 | |
609 #define GFTP_BOOKMARK_NUM 4 | |
610 #define GFTP_SSH_NUM 5 | |
611 #define GFTP_TYPE_BINARY 1 | |
612 #define GFTP_TYPE_ASCII 2 | |
613 #define GFTP_IS_CONNECTED(request) ((request) != NULL && \ | |
614 ((request)->sockfd != NULL || \ | |
615 (request)->cached)) | |
616 | |
617 | |
618 void rfc959_init ( gftp_request * request ); | |
619 | |
620 int rfc959_get_next_file ( gftp_request * request, | |
621 gftp_file *fle, | |
622 FILE *fd ); | |
623 | |
624 void rfc2068_init ( gftp_request * request ); | |
625 | |
626 void local_init ( gftp_request * request ); | |
627 | |
628 void ssh_init ( gftp_request * request ); | |
629 | |
630 void sshv2_init ( gftp_request * request ); | |
631 | |
632 void bookmark_init ( gftp_request * request ); | |
633 | |
634 gftp_request *gftp_request_new ( void ); | |
635 | |
636 void gftp_request_destroy ( gftp_request * request ); | |
637 | |
638 void gftp_file_destroy ( gftp_file *file ); | |
639 | |
640 int gftp_connect ( gftp_request * request ); | |
641 | |
642 void gftp_disconnect ( gftp_request * request ); | |
643 | |
644 size_t gftp_get_file ( gftp_request * request, | |
645 const char *filename, | |
646 FILE * fd, | |
647 size_t startsize ); | |
648 | |
649 int gftp_put_file ( gftp_request * request, | |
650 const char *filename, | |
651 FILE * fd, | |
652 size_t startsize, | |
653 size_t totalsize ); | |
654 | |
655 long gftp_transfer_file ( gftp_request *fromreq, | |
656 const char *fromfile, | |
657 FILE * fromfd, | |
658 size_t fromsize, | |
659 gftp_request *toreq, | |
660 const char *tofile, | |
661 FILE * tofd, | |
662 size_t tosize ); | |
663 | |
664 size_t gftp_get_next_file_chunk ( gftp_request * request, | |
665 char *buf, | |
666 size_t size ); | |
667 | |
668 size_t gftp_put_next_file_chunk ( gftp_request * request, | |
669 char *buf, | |
670 size_t size ); | |
671 | |
672 int gftp_list_files ( gftp_request * request ); | |
673 | |
674 int gftp_parse_url ( gftp_request * request, | |
675 const char *url ); | |
676 | |
677 int gftp_get_next_file ( gftp_request * request, | |
678 char *filespec, | |
679 gftp_file *fle ); | |
680 | |
681 int gftp_end_transfer ( gftp_request * request ); | |
682 | |
40 | 683 int gftp_abort_transfer ( gftp_request * request ); |
684 | |
1 | 685 int gftp_read_response ( gftp_request * request ); |
686 | |
687 int gftp_set_data_type ( gftp_request * request, | |
688 int data_type ); | |
689 | |
690 void gftp_set_hostname ( gftp_request * request, | |
691 const char *hostname ); | |
692 | |
693 void gftp_set_username ( gftp_request * request, | |
694 const char *username ); | |
695 | |
696 void gftp_set_password ( gftp_request * request, | |
697 const char *password ); | |
698 | |
699 void gftp_set_account ( gftp_request * request, | |
700 const char *account ); | |
701 | |
702 int gftp_set_directory ( gftp_request * request, | |
703 const char *directory ); | |
704 | |
705 void gftp_set_port ( gftp_request * request, | |
706 unsigned int port ); | |
707 | |
708 void gftp_set_proxy_hostname ( gftp_request * request, | |
709 const char *hostname ); | |
710 | |
711 void gftp_set_proxy_username ( gftp_request * request, | |
712 const char *username ); | |
713 | |
714 void gftp_set_proxy_password ( gftp_request * request, | |
715 const char *password ); | |
716 | |
717 void gftp_set_proxy_account ( gftp_request * request, | |
718 const char *account ); | |
719 | |
720 void gftp_set_proxy_port ( gftp_request * request, | |
721 unsigned int port ); | |
722 | |
723 int gftp_remove_directory ( gftp_request * request, | |
724 const char *directory ); | |
725 | |
726 int gftp_remove_file ( gftp_request * request, | |
727 const char *file ); | |
728 | |
729 int gftp_make_directory ( gftp_request * request, | |
730 const char *directory ); | |
731 | |
732 int gftp_rename_file ( gftp_request * request, | |
733 const char *oldname, | |
734 const char *newname ); | |
735 | |
736 int gftp_chmod ( gftp_request * request, | |
737 const char *file, | |
738 int mode ); | |
739 | |
740 int gftp_set_file_time ( gftp_request * request, | |
741 const char *file, | |
742 time_t datetime ); | |
743 | |
744 char gftp_site_cmd ( gftp_request * request, | |
745 const char *command ); | |
746 | |
747 void gftp_set_proxy_config ( gftp_request * request, | |
748 const char *proxy_config ); | |
749 | |
750 long gftp_get_file_size ( gftp_request * request, | |
751 const char *filename ); | |
752 | |
753 int gftp_need_proxy ( gftp_request * request, | |
754 char *service ); | |
755 | |
756 char *gftp_convert_ascii ( char *buf, | |
757 ssize_t *len, | |
758 int direction ); | |
759 | |
760 void gftp_calc_kbs ( gftp_transfer * tdata, | |
761 ssize_t num_read ); | |
762 | |
763 int gftp_parse_ls ( const char *lsoutput, | |
764 gftp_file *fle ); | |
765 | |
766 int gftp_get_all_subdirs ( gftp_transfer * transfer, | |
767 void (*update_func) | |
768 ( gftp_transfer * transfer )); | |
769 | |
770 int gftp_get_file_transfer_mode ( char *filename, | |
771 int def ); | |
772 | |
773 int gftp_connect_server ( gftp_request * request, | |
774 char *service ); | |
775 | |
776 void gftp_set_sftpserv_path ( gftp_request * request, | |
777 char *path ); | |
778 | |
779 #if defined (HAVE_GETADDRINFO) && defined (HAVE_GAI_STRERROR) | |
780 | |
781 int get_port ( struct addrinfo *addr ); | |
782 | |
783 #else | |
784 | |
785 struct hostent *r_gethostbyname ( const char *name, | |
786 struct hostent *result_buf, | |
787 int *h_errnop ); | |
788 | |
789 struct servent *r_getservbyname ( const char *name, | |
790 const char *proto, | |
791 struct servent *result_buf, | |
792 int *h_errnop ); | |
793 #endif | |
794 | |
795 void gftp_set_config_options ( gftp_request * request ); | |
796 | |
797 void print_file_list ( GList * list ); | |
798 | |
41 | 799 char *gftp_fgets ( gftp_request * request, |
800 char * str, | |
801 size_t len, | |
802 FILE * fd ); | |
803 | |
804 size_t gftp_fwrite ( gftp_request * request, | |
805 const void *ptr, | |
806 size_t size, | |
807 FILE * fd ); | |
808 | |
1 | 809 #endif |
810 |