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