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