Mercurial > gftp.yaz
annotate lib/gftp.h @ 988:63555c9744c2
remote charset should be specified by each bookmark entry.
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Fri, 14 Aug 2009 07:54:55 +0900 |
parents | a490d94a5b8e |
children | c99b134c6185 |
rev | line source |
---|---|
1 | 1 /*****************************************************************************/ |
2 /* gftp.h - include file for the whole ftp program */ | |
122 | 3 /* Copyright (C) 1998-2003 Brian Masney <masneyb@gftp.org> */ |
1 | 4 /* */ |
5 /* This program is free software; you can redistribute it and/or modify */ | |
6 /* it under the terms of the GNU General Public License as published by */ | |
7 /* the Free Software Foundation; either version 2 of the License, or */ | |
8 /* (at your option) any later version. */ | |
9 /* */ | |
10 /* This program is distributed in the hope that it will be useful, */ | |
11 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ | |
12 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ | |
13 /* GNU General Public License for more details. */ | |
14 /* */ | |
15 /* You should have received a copy of the GNU General Public License */ | |
16 /* along with this program; if not, write to the Free Software */ | |
17 /* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
18 /*****************************************************************************/ | |
19 | |
33 | 20 /* $Id$ */ |
21 | |
1 | 22 #ifndef __GFTP_H |
23 #define __GFTP_H | |
24 | |
548 | 25 #ifndef _GNU_SOURCE |
26 #define _GNU_SOURCE | |
27 #endif | |
28 | |
1 | 29 #ifdef HAVE_CONFIG_H |
30 #include "config.h" | |
31 #endif | |
32 | |
435 | 33 /* *BSD include 64bit off_t but _LARGEFILE_SOURCE is not defined. */ |
34 #if defined (SIZEOF_OFF_T) && SIZEOF_OFF_T > 4 && !defined (_LARGEFILE_SOURCE) | |
423 | 35 #define _LARGEFILE_SOURCE 1 |
36 #endif | |
37 | |
437 | 38 #if defined (_LARGEFILE_SOURCE) && !defined (_LARGEFILE64_SOURCE) |
39 #define _LARGEFILE64_SOURCE 1 | |
40 #endif | |
41 | |
1 | 42 #include <sys/types.h> |
43 #include <sys/stat.h> | |
44 #include <sys/socket.h> | |
45 #include <sys/time.h> | |
46 #ifndef TIOCGWINSZ | |
47 #include <sys/ioctl.h> | |
48 #endif | |
49 #include <sys/wait.h> | |
50 #include <sys/utsname.h> | |
51 #include <netinet/in.h> | |
52 #include <arpa/inet.h> | |
53 #include <glib.h> | |
54 #include <limits.h> | |
55 #include <netdb.h> | |
56 #include <stdio.h> | |
57 #include <stdarg.h> | |
58 #include <stdlib.h> | |
59 #include <errno.h> | |
60 #include <fcntl.h> | |
61 #include <unistd.h> | |
62 #include <ctype.h> | |
63 #include <time.h> | |
64 #include <utime.h> | |
65 #include <signal.h> | |
66 #include <termios.h> | |
67 #include <pwd.h> | |
68 #include <setjmp.h> | |
69 #include <dirent.h> | |
70 #include <grp.h> | |
71 #include <math.h> | |
72 | |
325 | 73 #ifdef HAVE_STDINT_H |
74 #include <stdint.h> | |
75 #endif | |
76 | |
460 | 77 #ifdef HAVE_INTTYPES_H |
78 #include <inttypes.h> | |
79 #endif | |
80 | |
1 | 81 #ifdef HAVE_STRING_H |
82 #include <string.h> | |
83 #else | |
84 #include <strings.h> | |
85 #endif | |
86 | |
168 | 87 #ifdef USE_SSL |
88 #include <openssl/bio.h> | |
89 #include <openssl/err.h> | |
90 #include <openssl/rand.h> | |
91 #include <openssl/ssl.h> | |
92 #include <openssl/x509v3.h> | |
93 #endif | |
94 | |
988
63555c9744c2
remote charset should be specified by each bookmark entry.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
952
diff
changeset
|
95 #include <locale.h> |
1 | 96 #ifdef ENABLE_NLS |
97 #include <libintl.h> | |
98 #define _(String) gettext (String) | |
99 #else | |
100 #define _(String) String | |
101 #endif | |
102 #define N_(String) String | |
103 | |
104 #ifndef AF_LOCAL | |
105 #define AF_LOCAL AF_UNIX | |
106 #endif | |
107 | |
351 | 108 /* Solaris needs this included for major()/minor() */ |
109 #ifdef HAVE_SYS_MKDEV_H | |
110 #include <sys/mkdev.h> | |
111 #endif | |
112 | |
48 | 113 /* We need the major() and minor() macros in the user interface. If they aren't |
114 defined by the system, we'll just define them here. */ | |
115 #ifndef major | |
116 #warning major macro was not defined by the system. Defining one that is probably wrong for your system | |
117 #define major(dev) (((dev) >> 8) & 0xff) | |
118 #endif | |
119 | |
120 #ifndef minor | |
121 #warning minor macro was not defined by the system. Defining one that is probably wrong for your system | |
122 #define minor(dev) ((dev) & 0xff) | |
123 #endif | |
124 | |
201 | 125 #ifdef WITH_DMALLOC |
126 | |
127 #undef g_malloc | |
128 #define g_malloc(size) \ | |
129 _malloc_leap(__FILE__, __LINE__, size) | |
130 | |
131 #undef g_malloc0 | |
132 #define g_malloc0(size) \ | |
133 _calloc_leap(__FILE__, __LINE__, 1, size) | |
134 | |
135 #undef g_realloc | |
136 #define g_realloc(ptr, size) \ | |
137 _realloc_leap(__FILE__, __LINE__, ptr, size) | |
138 | |
139 #undef g_strdup | |
140 #define g_strdup(str) \ | |
141 _strdup_leap(__FILE__, __LINE__, str) | |
142 | |
143 #undef g_free | |
144 #define g_free(ptr) \ | |
145 _free_leap(__FILE__, __LINE__, ptr) | |
146 | |
1 | 147 #include <dmalloc.h> |
201 | 148 |
1 | 149 #endif |
150 | |
338 | 151 #ifdef __GNUC__ |
152 # define GFTP_LOG_FUNCTION_ATTRIBUTES __attribute__((format(printf, 3, 4))) | |
153 #else | |
154 # define GFTP_LOG_FUNCTION_ATTRIBUTES | |
155 #endif | |
156 | |
944 | 157 #if defined (HAVE_GETADDRINFO) && defined (HAVE_GAI_STRERROR) |
158 # define HAVE_IPV6 | |
159 #endif | |
160 | |
649 | 161 #if defined (_LARGEFILE_SOURCE) && !defined (__hppa__) && !defined (__hppa) |
532 | 162 #define GFTP_OFF_T_HEX_PRINTF_MOD "%llx" |
163 #define GFTP_OFF_T_INTL_PRINTF_MOD "%'lld" | |
164 #define GFTP_OFF_T_PRINTF_MOD "%lld" | |
165 #define GFTP_OFF_T_11PRINTF_MOD "%11lld" | |
166 #define gftp_parse_file_size(str) strtoll (str, NULL, 10) | |
926 | 167 #define GFTP_OFF_T_PRINTF_CONVERSION long long |
516 | 168 #else |
532 | 169 #define GFTP_OFF_T_HEX_PRINTF_MOD "%lx" |
170 #define GFTP_OFF_T_INTL_PRINTF_MOD "%'ld" | |
171 #define GFTP_OFF_T_PRINTF_MOD "%ld" | |
172 #define GFTP_OFF_T_11PRINTF_MOD "%11ld" | |
173 #define gftp_parse_file_size(str) strtol (str, NULL, 10) | |
926 | 174 #define GFTP_OFF_T_PRINTF_CONVERSION off_t |
516 | 175 #endif |
176 | |
91 | 177 /* Server types (used by FTP protocol from SYST command) */ |
122 | 178 #define GFTP_DIRTYPE_UNIX 1 |
179 #define GFTP_DIRTYPE_EPLF 2 | |
180 #define GFTP_DIRTYPE_CRAY 3 | |
181 #define GFTP_DIRTYPE_NOVELL 4 | |
182 #define GFTP_DIRTYPE_DOS 5 | |
183 #define GFTP_DIRTYPE_VMS 6 | |
184 #define GFTP_DIRTYPE_OTHER 7 | |
358 | 185 #define GFTP_DIRTYPE_MVS 8 |
91 | 186 |
84 | 187 /* Error types */ |
341 | 188 #define GFTP_ERETRYABLE -1 /* Temporary failure. The GUI |
189 should wait briefly */ | |
190 #define GFTP_EFATAL -2 /* Fatal error */ | |
191 #define GFTP_ERETRYABLE_NO_WAIT -3 /* Temporary failure. The GUI | |
192 should not wait and should | |
193 reconnect */ | |
426 | 194 #define GFTP_ENOTRANS -4 /* Custom error. This is |
195 returned when a FXP transfer | |
196 is requested */ | |
442 | 197 #define GFTP_ETIMEDOUT -5 /* Connected timed out */ |
84 | 198 |
1 | 199 /* Some general settings */ |
200 #define BASE_CONF_DIR "~/.gftp" | |
201 #define CONFIG_FILE BASE_CONF_DIR "/gftprc" | |
202 #define BOOKMARKS_FILE BASE_CONF_DIR "/bookmarks" | |
203 #define LOG_FILE BASE_CONF_DIR "/gftp.log" | |
204 #define MAX_HIST_LEN 10 | |
356 | 205 #define GFTP_URL_USAGE "[[protocol://][user[:pass]@]site[:port][/directory]]" |
1 | 206 |
207 typedef enum gftp_logging_level_tag | |
208 { | |
209 gftp_logging_send, | |
210 gftp_logging_recv, | |
211 gftp_logging_error, | |
354 | 212 gftp_logging_misc, |
213 gftp_logging_misc_nolog /* Log to the screen, but don't log to disk */ | |
1 | 214 } gftp_logging_level; |
215 | |
216 typedef struct gftp_file_tag gftp_file; | |
217 | |
218 #define GFTP_TRANS_ACTION_OVERWRITE 1 | |
219 #define GFTP_TRANS_ACTION_RESUME 2 | |
220 #define GFTP_TRANS_ACTION_SKIP 3 | |
221 | |
16 | 222 #define GFTP_SORT_COL_FILE 1 |
223 #define GFTP_SORT_COL_SIZE 2 | |
224 #define GFTP_SORT_COL_USER 3 | |
225 #define GFTP_SORT_COL_GROUP 4 | |
226 #define GFTP_SORT_COL_DATETIME 5 | |
227 #define GFTP_SORT_COL_ATTRIBS 6 | |
228 | |
499 | 229 #define GFTP_IS_SPECIAL_DEVICE(mode) (S_ISBLK (mode) || S_ISCHR (mode)) |
230 | |
1 | 231 struct gftp_file_tag |
232 { | |
765 | 233 /*@null@*/ char *file, /* Our filename */ |
234 *user, /* User that owns it */ | |
235 *group, /* Group that owns it */ | |
236 *destfile; /* Full pathname to the destination for the | |
1 | 237 file transfer */ |
122 | 238 |
239 int fd; /* Already open fd for this file */ | |
240 /* FIXME - add fd_open function */ | |
241 | |
1 | 242 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
|
243 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
|
244 startsize; /* Size to start the transfer at */ |
499 | 245 mode_t st_mode; /* File attributes */ |
852 | 246 |
247 dev_t st_dev; /* The device and associated inode. These */ | |
248 ino_t st_ino; /* two fields are used for detecting loops */ | |
249 /* with symbolic links. */ | |
250 | |
499 | 251 unsigned int selected : 1, /* Is this file selected? */ |
1 | 252 was_sel : 1, /* Was this file selected before */ |
253 shown : 1, /* Is this file shown? */ | |
254 done_view : 1, /* View the file when done transfering? */ | |
255 done_edit : 1, /* Edit the file when done transfering? */ | |
256 done_rm : 1, /* Remove the file when done */ | |
257 transfer_done : 1, /* Is current file transfer done? */ | |
862 | 258 retry_transfer : 1, /* Is current file transfer done? */ |
916 | 259 exists_other_side : 1, /* The file exists on the other side |
260 during the file transfer */ | |
261 filename_utf8_encoded : 1; /* Is the filename properly UTF8 | |
262 encoded? */ | |
263 | |
1 | 264 char transfer_action; /* See the GFTP_TRANS_ACTION_* vars above */ |
765 | 265 /*@null@*/ void *user_data; |
1 | 266 }; |
267 | |
268 | |
269 typedef struct gftp_proxy_hosts_tag | |
270 { | |
303 | 271 /* FIXME - add IPV6 stuff here */ |
122 | 272 |
273 gint32 ipv4_network_address, | |
1 | 274 ipv4_netmask; |
275 char *domain; | |
276 } gftp_proxy_hosts; | |
277 | |
136 | 278 |
279 /* Note, these numbers must match up to the index number in config_file.c | |
280 in the declaration of gftp_option_types */ | |
281 typedef enum | |
282 { | |
283 gftp_option_type_text = 0, | |
284 gftp_option_type_textcombo = 1, | |
285 gftp_option_type_textcomboedt = 2, | |
286 gftp_option_type_hidetext = 3, | |
287 gftp_option_type_int = 4, | |
288 gftp_option_type_checkbox = 5, | |
289 gftp_option_type_intcombo = 6, | |
290 gftp_option_type_float = 7, | |
291 gftp_option_type_color = 8, | |
292 gftp_option_type_notebook = 9 | |
293 } gftp_option_type_enum; | |
294 | |
295 | |
296 #define GFTP_PORT_GTK (1 << 1) | |
297 #define GFTP_PORT_TEXT (1 << 2) | |
298 #define GFTP_PORT_ALL (GFTP_PORT_GTK | GFTP_PORT_TEXT) | |
299 | |
300 | |
301 typedef struct gftp_config_list_vars_tag | |
302 { | |
303 char *key; | |
304 void * (*read_func) (char *buf, int line); | |
305 void (*write_func) (FILE *fd, void *data); | |
306 GList * list; | |
307 unsigned int num_items; | |
308 char *header; | |
309 } gftp_config_list_vars; | |
310 | |
311 | |
201 | 312 #define GFTP_CVARS_FLAGS_DYNMEM (1 << 1) |
313 #define GFTP_CVARS_FLAGS_DYNLISTMEM (1 << 2) | |
227 | 314 #define GFTP_CVARS_FLAGS_SHOW_BOOKMARK (1 << 3) |
988
63555c9744c2
remote charset should be specified by each bookmark entry.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
952
diff
changeset
|
315 #define GFTP_CVARS_FLAGS_SHOW_BOOKMARK_ONLY (1 << 4) |
136 | 316 |
317 typedef struct gftp_config_vars_tag | |
318 { | |
765 | 319 /*@null@*/ char *key, /* variable name */ |
320 *description; /* How this field will show up in the dialog */ | |
136 | 321 int otype; /* Type of option this is */ |
765 | 322 /*@null@*/ void *value; |
323 /*@null@*/ void *listdata; /* For options that have several different | |
136 | 324 options, this is a list of all the options. |
325 Each option_type that uses this will use this | |
326 field differently */ | |
327 int flags; /* See GFTP_CVARS_FLAGS_* above */ | |
765 | 328 /*@null@*/ char *comment; /* Comment to write out to the config file */ |
136 | 329 int ports_shown; /* What ports of gFTP is this option shown in */ |
765 | 330 /*@null@*/ void *user_data; /* Data that the GUI can store here (Widget in gtk+) */ |
136 | 331 } gftp_config_vars; |
332 | |
333 | |
334 typedef struct gftp_option_type_tag | |
335 { | |
336 int (*read_function) (char *str, gftp_config_vars * cv, int line); | |
765 | 337 int (*write_function) (gftp_config_vars * cv, /*@out@*/ char *buf, |
338 size_t buflen, int to_config_file); | |
207 | 339 void (*copy_function) (gftp_config_vars * cv, gftp_config_vars * dest_cv); |
227 | 340 int (*compare_function) (gftp_config_vars * cv1, gftp_config_vars * cv2); |
229 | 341 void *(*ui_print_function) (gftp_config_vars * cv, void *user_data, void *value); |
136 | 342 void (*ui_save_function) (gftp_config_vars * cv, void *user_data); |
139 | 343 void (*ui_cancel_function) (gftp_config_vars * cv, void *user_data); |
136 | 344 void *user_data; |
345 } gftp_option_type_var; | |
346 | |
347 | |
348 #define GFTP_TEXTCOMBOEDT_EDITABLE (1 << 0) | |
349 | |
350 typedef struct gftp_textcomboedt_data_tag | |
351 { | |
765 | 352 /*@null@*/ char *description, |
353 *text; | |
136 | 354 int flags; |
355 } gftp_textcomboedt_data; | |
356 | |
357 | |
1 | 358 typedef struct gftp_request_tag gftp_request; |
359 | |
186 | 360 typedef void (*gftp_logging_func) ( gftp_logging_level level, |
765 | 361 /*@null@*/ gftp_request * request, |
186 | 362 const char *string, ... ); |
363 | |
570 | 364 #define GFTP_ANONYMOUS_USER "anonymous" |
555 | 365 #define gftp_need_username(request) ((request)->need_username && ((request)->username == NULL || *(request)->username == '\0')) |
570 | 366 #define gftp_need_password(request) ((request)->need_password && (request)->username != NULL && *(request)->username != '\0' && strcasecmp ((request)->username, GFTP_ANONYMOUS_USER) != 0 && ((request)->password == NULL || *(request)->password == '\0')) |
553 | 367 |
1 | 368 struct gftp_request_tag |
369 { | |
370 int protonum; /* Current number of the protocol this is | |
371 set to */ | |
372 char *hostname, /* Hostname we will connect to */ | |
373 *username, /* Username for host*/ | |
374 *password, /* Password for host */ | |
375 *account, /* Account for host (FTP only) */ | |
376 *directory, /* Current working directory */ | |
377 *url_prefix, /* URL Prefix (ex: ftp) */ | |
378 *last_ftp_response, /* Last response from server */ | |
379 *last_dir_entry; /* Last dir entry from server */ | |
380 size_t last_dir_entry_len; /* Length of last_dir_entry */ | |
381 | |
122 | 382 unsigned int port; /* Port of remote site */ |
1 | 383 |
169 | 384 int datafd, /* Data connection */ |
58 | 385 cachefd; /* For the directory cache */ |
1 | 386 int wakeup_main_thread[2]; /* FD that gets written to by the threads |
387 to wakeup the parent */ | |
122 | 388 |
944 | 389 void *remote_addr; |
390 size_t remote_addr_len; | |
391 int ai_family; | |
1 | 392 |
122 | 393 int server_type; /* The type of server we are connected to. |
394 See GFTP_DIRTYPE_* above */ | |
944 | 395 unsigned int use_proxy : 1, |
1 | 396 always_connected : 1, |
397 need_hostport : 1, | |
553 | 398 need_username : 1, |
399 need_password : 1, | |
1 | 400 use_cache : 1, /* Enable or disable the cache */ |
401 cached : 1, /* Is this directory listing cached? */ | |
41 | 402 cancel : 1, /* If a signal is received, should |
403 we cancel this operation */ | |
832 | 404 stopable : 1, |
879 | 405 refreshing : 1, |
832 | 406 use_local_encoding : 1; |
1 | 407 |
408 off_t gotbytes; | |
409 | |
410 void *protocol_data; | |
411 | |
412 gftp_logging_func logging_function; | |
413 void *user_data; | |
414 | |
173 | 415 int (*init) ( gftp_request * request ); |
309 | 416 void (*copy_param_options) ( gftp_request * dest_request, |
417 gftp_request * src_request ); | |
168 | 418 ssize_t (*read_function) ( gftp_request * request, |
419 void *ptr, | |
420 size_t size, | |
421 int fd ); | |
422 ssize_t (*write_function) ( gftp_request * request, | |
423 const char *ptr, | |
424 size_t size, | |
425 int fd ); | |
1 | 426 void (*destroy) ( gftp_request * request ); |
427 int (*connect) ( gftp_request * request ); | |
168 | 428 int (*post_connect) ( gftp_request * request ); |
1 | 429 void (*disconnect) ( gftp_request * request ); |
58 | 430 off_t (*get_file) ( gftp_request * request, |
1 | 431 const char *filename, |
432 off_t startsize ); | |
433 int (*put_file) ( gftp_request * request, | |
434 const char *filename, | |
435 off_t startsize, | |
436 off_t totalsize ); | |
765 | 437 off_t (*transfer_file) ( gftp_request * fromreq, |
1 | 438 const char *fromfile, |
439 off_t fromsize, | |
440 gftp_request * toreq, | |
441 const char *tofile, | |
442 off_t tosize ); | |
58 | 443 ssize_t (*get_next_file_chunk) ( gftp_request * request, |
1 | 444 char *buf, |
445 size_t size ); | |
58 | 446 ssize_t (*put_next_file_chunk) ( gftp_request * request, |
1 | 447 char *buf, |
448 size_t size ); | |
449 int (*end_transfer) ( gftp_request * request ); | |
40 | 450 int (*abort_transfer) ( gftp_request * request ); |
520 | 451 int (*stat_filename) ( gftp_request * request, |
452 const char *filename, | |
787 | 453 mode_t * mode, |
454 off_t * filesize ); | |
1 | 455 int (*list_files) ( gftp_request * request ); |
456 int (*get_next_file) ( gftp_request * request, | |
457 gftp_file *fle, | |
58 | 458 int fd ); |
485 | 459 ssize_t (*get_next_dirlist_line) ( gftp_request * request, |
460 int fd, | |
461 char *buf, | |
462 size_t buflen ); | |
1 | 463 off_t (*get_file_size) ( gftp_request * request, |
464 const char *filename ); | |
465 int (*chdir) ( gftp_request * request, | |
466 const char *directory ); | |
467 int (*rmdir) ( gftp_request * request, | |
468 const char *directory ); | |
469 int (*rmfile) ( gftp_request * request, | |
470 const char *filename ); | |
471 int (*mkdir) ( gftp_request * request, | |
472 const char *directory ); | |
473 int (*rename) ( gftp_request * request, | |
474 const char *oldname, | |
475 const char *newname ); | |
476 int (*chmod) ( gftp_request * request, | |
477 const char *filename, | |
499 | 478 mode_t mode ); |
1 | 479 int (*set_file_time) ( gftp_request * request, |
480 const char *filename, | |
481 time_t datettime ); | |
482 int (*site) ( gftp_request * request, | |
478 | 483 int specify_site, |
1 | 484 const char *filename ); |
485 int (*parse_url) ( gftp_request * request, | |
486 const char *url ); | |
177 | 487 int (*set_config_options) ( gftp_request * request ); |
63 | 488 void (*swap_socks) ( gftp_request * dest, |
489 gftp_request * source ); | |
1 | 490 |
136 | 491 gftp_config_vars * local_options_vars; |
492 int num_local_options_vars; | |
493 GHashTable * local_options_hash; | |
168 | 494 #ifdef USE_SSL |
495 SSL * ssl; | |
496 #endif | |
184 | 497 |
498 #if GLIB_MAJOR_VERSION > 1 | |
899 | 499 GIConv iconv_to, iconv_from; |
500 unsigned int iconv_from_initialized : 1, | |
501 iconv_to_initialized : 1; | |
842 | 502 char *iconv_charset; |
184 | 503 #endif |
988
63555c9744c2
remote charset should be specified by each bookmark entry.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
952
diff
changeset
|
504 char *remote_charset; |
1 | 505 }; |
506 | |
507 | |
136 | 508 typedef struct gftp_transfer_tag |
1 | 509 { |
510 gftp_request * fromreq, | |
511 * toreq; | |
512 | |
305 | 513 unsigned int cancel : 1, |
1 | 514 ready : 1, |
515 started : 1, | |
516 done : 1, | |
517 show : 1, | |
518 stalled : 1, | |
303 | 519 conn_error_no_timeout : 1, |
1 | 520 next_file : 1, |
14
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
1
diff
changeset
|
521 skip_file : 1; |
1 | 522 |
523 struct timeval starttime, | |
524 lasttime; | |
525 | |
526 double kbs; | |
527 | |
528 GList * files, | |
529 * curfle, | |
530 * updfle; | |
531 | |
19 | 532 long numfiles, |
533 numdirs, | |
534 current_file_number, | |
535 current_file_retries; | |
1 | 536 |
537 off_t curtrans, /* Current transfered bytes for this file */ | |
377 | 538 tot_file_trans, /* Total number of bytes in the file being |
539 transferred */ | |
1 | 540 curresumed, /* Resumed bytes for this file */ |
541 trans_bytes, /* Amount of data transfered for entire | |
542 transfer */ | |
543 total_bytes, /* Grand total bytes for whole transfer */ | |
544 resumed_bytes; /* Grand total of resumed bytes for whole | |
545 transfer */ | |
546 | |
547 void * fromwdata, | |
548 * towdata; | |
549 | |
122 | 550 GStaticMutex statmutex, |
551 structmutex; | |
552 | |
125 | 553 void *user_data; |
876 | 554 void *thread_id; |
1 | 555 void *clist; |
136 | 556 } gftp_transfer; |
1 | 557 |
558 | |
559 typedef struct gftp_log_tag | |
560 { | |
561 char *msg; | |
562 gftp_logging_level type; | |
563 } gftp_log; | |
564 | |
565 | |
566 typedef struct supported_gftp_protocols_tag | |
567 { | |
765 | 568 /*@null@*/ char *name; /* Description of protocol */ |
569 /*@null@*/ int (*init) (gftp_request * request); /* Init function */ | |
570 /*@null@*/ void (*register_options) (void); /* Protocol options */ | |
571 /*@null@*/ char *url_prefix; /* URL Prefix */ | |
542 | 572 unsigned int default_port; /* Default port */ |
341 | 573 unsigned int shown : 1, /* Whether this protocol is |
122 | 574 shown or not to the user in |
575 the protocol dropdown box */ | |
341 | 576 use_threads : 1; /* Whether or not operations in |
577 this protocol should use | |
578 threads */ | |
1 | 579 } supported_gftp_protocols; |
580 | |
581 | |
122 | 582 typedef struct gftp_bookmarks_tag gftp_bookmarks_var; |
1 | 583 |
584 struct gftp_bookmarks_tag | |
585 { | |
609 | 586 char *path, /* Path */ |
587 *oldpath, /* Old path name */ | |
588 *hostname, /* Our actual internet hostname */ | |
1 | 589 *protocol, /* Protocol we will connect through */ |
590 *remote_dir, /* Initial directory */ | |
591 *local_dir, /* Init local directory */ | |
592 *user, /* Username to log in as */ | |
593 *pass, /* Our password */ | |
594 *acct; /* Account */ | |
595 | |
596 unsigned int port, /* The port we will connect to */ | |
597 isfolder : 1, /* If this is set, then the children field can | |
598 be non-NULL */ | |
599 save_password : 1; /* Save this password */ | |
988
63555c9744c2
remote charset should be specified by each bookmark entry.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
952
diff
changeset
|
600 char *remote_charset; |
122 | 601 gftp_bookmarks_var *children, /* The children of this node. */ |
602 *prev, /* The parent of this node */ | |
603 *next; /* The next sibling of this node */ | |
988
63555c9744c2
remote charset should be specified by each bookmark entry.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
952
diff
changeset
|
604 gpointer cnode; |
1 | 605 |
199 | 606 gftp_config_vars * local_options_vars; |
607 int num_local_options_vars; | |
608 GHashTable * local_options_hash; | |
1 | 609 }; |
610 | |
611 | |
612 typedef struct gftp_file_extensions_tag | |
613 { | |
614 char *ext, /* The file extension to register */ | |
615 *filename, /* The xpm file to display */ | |
616 *view_program, /* The program used to view this file */ | |
617 *ascii_binary; /* Is this a ASCII transfer or a BINARY transfer */ | |
516 | 618 unsigned int stlen; /* How long is the file extension. */ |
1 | 619 } gftp_file_extensions; |
620 | |
621 | |
622 typedef struct gftp_color_tag | |
623 { | |
624 gushort red, | |
625 green, | |
626 blue; | |
627 } gftp_color; | |
628 | |
629 | |
58 | 630 typedef struct gftp_getline_buffer_tag |
631 { | |
632 char *buffer, | |
633 *curpos; | |
634 size_t max_bufsize, | |
635 cur_bufsize; | |
179 | 636 unsigned int eof : 1; |
58 | 637 } gftp_getline_buffer; |
638 | |
126 | 639 |
122 | 640 /* Global config options. These are defined in options.h */ |
765 | 641 /*@null@*/ extern GList * gftp_file_transfers, * gftp_file_transfer_logs, |
642 * gftp_options_list; | |
643 /*@null@*/ extern GHashTable * gftp_global_options_htable, * gftp_bookmarks_htable, | |
644 * gftp_config_list_htable; | |
645 /*@null@*/ extern gftp_bookmarks_var * gftp_bookmarks; | |
646 /*@null@*/ extern FILE * gftp_logfd; | |
122 | 647 extern gftp_config_vars gftp_global_config_vars[]; |
1 | 648 extern supported_gftp_protocols gftp_protocols[]; |
122 | 649 extern char gftp_version[]; |
201 | 650 extern int gftp_configuration_changed; |
122 | 651 |
652 /* This is defined in config_file.c */ | |
653 | |
654 extern gftp_option_type_var gftp_option_types[]; | |
1 | 655 |
656 /* cache.c */ | |
182 | 657 void gftp_generate_cache_description ( gftp_request * request, |
765 | 658 /*@out@*/ char *description, |
182 | 659 size_t len, |
660 int ignore_directory ); | |
661 | |
58 | 662 int gftp_new_cache_entry ( gftp_request * request ); |
1 | 663 |
58 | 664 int gftp_find_cache_entry ( gftp_request * request ); |
1 | 665 |
666 void gftp_clear_cache_files ( void ); | |
667 | |
47 | 668 void gftp_delete_cache_entry ( gftp_request * request, |
182 | 669 char *descr, |
47 | 670 int ignore_directory ); |
1 | 671 |
950 | 672 /* charset-conv.c */ |
673 /*@null@*/ char * gftp_string_to_utf8 ( gftp_request * request, | |
674 const char *str, | |
675 size_t *dest_len ); | |
676 | |
677 /*@null@*/ char * gftp_string_from_utf8 ( gftp_request * request, | |
678 int force_local, | |
679 const char *str, | |
680 size_t *dest_len ); | |
681 | |
682 /*@null@*/ char * gftp_filename_to_utf8 ( gftp_request * request, | |
683 const char *str, | |
684 size_t *dest_len ); | |
685 | |
686 /*@null@*/ char * gftp_filename_from_utf8 ( gftp_request * request, | |
687 const char *str, | |
688 size_t *dest_len ); | |
689 | |
988
63555c9744c2
remote charset should be specified by each bookmark entry.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
952
diff
changeset
|
690 /*@null@*/ char * gftp_remote_filename_to_utf8 ( gftp_request * request, |
63555c9744c2
remote charset should be specified by each bookmark entry.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
952
diff
changeset
|
691 const char *str, |
63555c9744c2
remote charset should be specified by each bookmark entry.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
952
diff
changeset
|
692 size_t *dest_len ); |
63555c9744c2
remote charset should be specified by each bookmark entry.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
952
diff
changeset
|
693 |
63555c9744c2
remote charset should be specified by each bookmark entry.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
952
diff
changeset
|
694 /*@null@*/ char * gftp_remote_filename_from_utf8 ( gftp_request * request, |
63555c9744c2
remote charset should be specified by each bookmark entry.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
952
diff
changeset
|
695 const char *str, |
63555c9744c2
remote charset should be specified by each bookmark entry.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
952
diff
changeset
|
696 size_t *dest_len ); |
63555c9744c2
remote charset should be specified by each bookmark entry.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
952
diff
changeset
|
697 |
1 | 698 /* config_file.c */ |
198 | 699 int gftp_config_parse_args ( char *str, |
700 int numargs, | |
701 int lineno, | |
765 | 702 /*@out@*/ char **first, |
198 | 703 ... ); |
704 | |
122 | 705 void gftp_add_bookmark ( gftp_bookmarks_var * newentry ); |
706 | |
124 | 707 void gftp_read_config_file ( char *global_data_path ); |
1 | 708 |
122 | 709 void gftp_write_bookmarks_file ( void ); |
1 | 710 |
711 void gftp_write_config_file ( void ); | |
712 | |
122 | 713 GHashTable * build_bookmarks_hash_table ( gftp_bookmarks_var * entry ); |
714 | |
715 void print_bookmarks ( gftp_bookmarks_var * bookmarks ); | |
716 | |
374 | 717 void gftp_lookup_global_option ( const char * key, |
765 | 718 /*@out@*/ void *value ); |
26 | 719 |
122 | 720 void gftp_lookup_request_option ( gftp_request * request, |
374 | 721 const char * key, |
765 | 722 /*@out@*/ void *value ); |
723 | |
1 | 724 |
229 | 725 void gftp_lookup_bookmark_option ( gftp_bookmarks_var * bm, |
374 | 726 const char * key, |
229 | 727 void *value ); |
728 | |
374 | 729 void gftp_set_global_option ( const char * key, |
227 | 730 const void *value ); |
122 | 731 |
732 void gftp_set_request_option ( gftp_request * request, | |
374 | 733 const char * key, |
229 | 734 const void *value ); |
735 | |
736 void gftp_set_bookmark_option ( gftp_bookmarks_var * bm, | |
374 | 737 const char * key, |
229 | 738 const void *value ); |
122 | 739 |
740 void gftp_register_config_vars ( gftp_config_vars *config_vars ); | |
1 | 741 |
201 | 742 void gftp_copy_local_options ( gftp_config_vars ** new_options_vars, |
743 GHashTable ** new_options_hash, | |
429 | 744 int *new_num_local_options_vars, |
201 | 745 gftp_config_vars * orig_options, |
746 int num_local_options_vars ); | |
747 | |
748 void gftp_config_free_options ( gftp_config_vars * options_vars, | |
749 GHashTable * options_hash, | |
750 int num_options_vars ); | |
751 | |
752 void gftp_bookmarks_destroy ( gftp_bookmarks_var * bookmarks ); | |
753 | |
218 | 754 void gftp_free_proxy_hosts ( GList * proxy_hosts ); |
755 | |
756 GList * gftp_copy_proxy_hosts ( GList * proxy_hosts ); | |
757 | |
1 | 758 /* misc.c */ |
765 | 759 /*@null@*/ char *insert_commas ( off_t number, |
1 | 760 char *dest_str, |
761 size_t dest_len ); | |
762 | |
763 char *alltrim ( char *str ); | |
764 | |
555 | 765 char *gftp_expand_path ( gftp_request * request, |
766 const char *src ); | |
1 | 767 |
768 void make_nonnull ( char **str ); | |
769 | |
821 | 770 int gftp_match_filespec ( gftp_request * request, |
771 const char *filename, | |
374 | 772 const char *filespec ); |
1 | 773 |
774 int gftp_parse_command_line ( int *argc, | |
775 char ***argv ); | |
776 | |
777 void gftp_usage ( void ); | |
778 | |
779 gint string_hash_compare ( gconstpointer path1, | |
780 gconstpointer path2 ); | |
781 | |
782 guint string_hash_function ( gconstpointer key ); | |
783 | |
852 | 784 gint uint_hash_compare ( gconstpointer path1, |
785 gconstpointer path2 ); | |
786 | |
787 guint uint_hash_function ( gconstpointer key ); | |
788 | |
1 | 789 void free_file_list ( GList * filelist ); |
790 | |
791 gftp_file * copy_fdata ( gftp_file * fle ); | |
792 | |
793 int compare_request ( gftp_request * request1, | |
794 gftp_request * request2, | |
795 int compare_dirs ); | |
796 | |
129 | 797 gftp_transfer * gftp_tdata_new ( void ); |
798 | |
1 | 799 void free_tdata ( gftp_transfer * tdata ); |
800 | |
368 | 801 gftp_request * gftp_copy_request ( gftp_request * req ); |
1 | 802 |
16 | 803 GList * gftp_sort_filelist ( GList * filelist, |
804 int column, | |
805 int asds ); | |
806 | |
830 | 807 char * gftp_gen_ls_string ( gftp_request * request, |
808 gftp_file * fle, | |
131 | 809 char *file_prefixstr, |
810 char *file_suffixstr ); | |
811 | |
168 | 812 char * base64_encode ( char *str ); |
813 | |
609 | 814 void gftp_free_bookmark ( gftp_bookmarks_var * entry, |
815 int free_node ); | |
199 | 816 |
201 | 817 void gftp_shutdown ( void ); |
199 | 818 |
207 | 819 GList * get_next_selection ( GList * selection, |
820 GList ** list, | |
821 int *curnum ); | |
822 | |
555 | 823 char * gftp_build_path ( gftp_request * request, |
824 const char *first_element, | |
227 | 825 ... ); |
826 | |
290 | 827 void gftp_locale_init ( void ); |
828 | |
330 | 829 char * gftp_scramble_password ( const char *password ); |
830 | |
831 char * gftp_descramble_password ( const char *password ); | |
832 | |
378 | 833 int gftp_get_transfer_action ( gftp_request * request, |
834 gftp_file * fle ); | |
835 | |
483 | 836 char * gftp_get_share_dir ( void ); |
837 | |
402 | 838 /* mkstemps.c */ |
839 int mkstemps ( char *template, | |
840 int suffix_len ); | |
841 | |
950 | 842 /* parse-dir-listing.c */ |
843 time_t parse_time ( char *str, | |
844 char **endpos ); | |
845 | |
846 int gftp_parse_ls ( gftp_request * request, | |
847 const char *lsoutput, | |
848 gftp_file *fle, | |
849 int fd ); | |
850 | |
1 | 851 /* protocols.c */ |
852 #define GFTP_FTP_NUM 0 | |
389 | 853 #define GFTP_FTPS_NUM 1 |
854 #define GFTP_HTTP_NUM 2 | |
855 #define GFTP_HTTPS_NUM 3 | |
856 #define GFTP_LOCAL_NUM 4 | |
857 #define GFTP_SSHV2_NUM 5 | |
858 #define GFTP_BOOKMARK_NUM 6 | |
661 | 859 #define GFTP_FSP_NUM 7 |
122 | 860 |
1 | 861 #define GFTP_IS_CONNECTED(request) ((request) != NULL && \ |
169 | 862 ((request)->datafd > 0 || \ |
58 | 863 (request)->cached || \ |
864 (request)->always_connected)) | |
1 | 865 |
866 | |
173 | 867 int rfc959_init ( gftp_request * request ); |
1 | 868 |
122 | 869 void rfc959_register_module ( void ); |
870 | |
1 | 871 int rfc959_get_next_file ( gftp_request * request, |
872 gftp_file *fle, | |
58 | 873 int fd ); |
1 | 874 |
451 | 875 int rfc959_connect ( gftp_request * request ); |
876 | |
389 | 877 int ftps_init ( gftp_request * request ); |
878 | |
879 void ftps_register_module ( void ); | |
880 | |
173 | 881 int rfc2068_init ( gftp_request * request ); |
1 | 882 |
122 | 883 void rfc2068_register_module ( void ); |
884 | |
173 | 885 int https_init ( gftp_request * request ); |
168 | 886 |
887 void https_register_module ( void ); | |
888 | |
173 | 889 int local_init ( gftp_request * request ); |
1 | 890 |
122 | 891 void local_register_module ( void ); |
892 | |
173 | 893 int sshv2_init ( gftp_request * request ); |
1 | 894 |
122 | 895 void sshv2_register_module ( void ); |
896 | |
174 | 897 void ssl_register_module ( void ); |
898 | |
173 | 899 int bookmark_init ( gftp_request * request ); |
1 | 900 |
122 | 901 void bookmark_register_module ( void ); |
902 | |
661 | 903 int fsp_init ( gftp_request * request ); |
904 | |
905 void fsp_register_module ( void ); | |
906 | |
1 | 907 gftp_request *gftp_request_new ( void ); |
908 | |
67 | 909 void gftp_request_destroy ( gftp_request * request, |
910 int free_request ); | |
1 | 911 |
309 | 912 void gftp_copy_param_options ( gftp_request * dest_request, |
913 gftp_request * src_request ); | |
914 | |
598 | 915 void gftp_file_destroy ( gftp_file *file, |
916 int free_it ); | |
1 | 917 |
918 int gftp_connect ( gftp_request * request ); | |
919 | |
920 void gftp_disconnect ( gftp_request * request ); | |
921 | |
58 | 922 off_t gftp_get_file ( gftp_request * request, |
1 | 923 const char *filename, |
244 | 924 off_t startsize ); |
1 | 925 |
926 int gftp_put_file ( gftp_request * request, | |
927 const char *filename, | |
244 | 928 off_t startsize, |
929 off_t totalsize ); | |
1 | 930 |
261 | 931 off_t gftp_transfer_file ( gftp_request *fromreq, |
1 | 932 const char *fromfile, |
244 | 933 off_t fromsize, |
1 | 934 gftp_request *toreq, |
935 const char *tofile, | |
244 | 936 off_t tosize ); |
1 | 937 |
58 | 938 ssize_t gftp_get_next_file_chunk ( gftp_request * request, |
1 | 939 char *buf, |
940 size_t size ); | |
941 | |
58 | 942 ssize_t gftp_put_next_file_chunk ( gftp_request * request, |
1 | 943 char *buf, |
944 size_t size ); | |
945 | |
946 int gftp_list_files ( gftp_request * request ); | |
947 | |
87 | 948 int gftp_parse_bookmark ( gftp_request * request, |
243 | 949 gftp_request * local_request, |
275 | 950 const char * bookmark, |
951 int *refresh_local ); | |
87 | 952 |
1 | 953 int gftp_parse_url ( gftp_request * request, |
954 const char *url ); | |
955 | |
956 int gftp_get_next_file ( gftp_request * request, | |
377 | 957 const char *filespec, |
1 | 958 gftp_file *fle ); |
959 | |
960 int gftp_end_transfer ( gftp_request * request ); | |
961 | |
40 | 962 int gftp_abort_transfer ( gftp_request * request ); |
963 | |
520 | 964 int gftp_stat_filename ( gftp_request * request, |
965 const char *filename, | |
787 | 966 mode_t * mode, |
967 off_t * filesize ); | |
500 | 968 |
1 | 969 void gftp_set_hostname ( gftp_request * request, |
970 const char *hostname ); | |
971 | |
988
63555c9744c2
remote charset should be specified by each bookmark entry.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
952
diff
changeset
|
972 void gftp_set_remote_charset (gftp_request * request, |
63555c9744c2
remote charset should be specified by each bookmark entry.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
952
diff
changeset
|
973 const char *remote_charset); |
63555c9744c2
remote charset should be specified by each bookmark entry.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
952
diff
changeset
|
974 |
1 | 975 void gftp_set_username ( gftp_request * request, |
976 const char *username ); | |
977 | |
978 void gftp_set_password ( gftp_request * request, | |
979 const char *password ); | |
980 | |
981 void gftp_set_account ( gftp_request * request, | |
982 const char *account ); | |
983 | |
984 int gftp_set_directory ( gftp_request * request, | |
985 const char *directory ); | |
986 | |
987 void gftp_set_port ( gftp_request * request, | |
988 unsigned int port ); | |
989 | |
990 int gftp_remove_directory ( gftp_request * request, | |
991 const char *directory ); | |
992 | |
993 int gftp_remove_file ( gftp_request * request, | |
994 const char *file ); | |
995 | |
996 int gftp_make_directory ( gftp_request * request, | |
997 const char *directory ); | |
998 | |
999 int gftp_rename_file ( gftp_request * request, | |
1000 const char *oldname, | |
1001 const char *newname ); | |
1002 | |
1003 int gftp_chmod ( gftp_request * request, | |
1004 const char *file, | |
499 | 1005 mode_t mode ); |
1 | 1006 |
1007 int gftp_set_file_time ( gftp_request * request, | |
1008 const char *file, | |
1009 time_t datetime ); | |
1010 | |
765 | 1011 int gftp_site_cmd ( gftp_request * request, |
478 | 1012 int specify_site, |
1 | 1013 const char *command ); |
1014 | |
58 | 1015 off_t gftp_get_file_size ( gftp_request * request, |
1 | 1016 const char *filename ); |
1017 | |
1018 void gftp_calc_kbs ( gftp_transfer * tdata, | |
1019 ssize_t num_read ); | |
1020 | |
1021 int gftp_get_all_subdirs ( gftp_transfer * transfer, | |
1022 void (*update_func) | |
1023 ( gftp_transfer * transfer )); | |
1024 | |
177 | 1025 int gftp_set_config_options ( gftp_request * request ); |
1 | 1026 |
1027 void print_file_list ( GList * list ); | |
1028 | |
63 | 1029 void gftp_swap_socks ( gftp_request * dest, |
1030 gftp_request * source ); | |
1031 | |
122 | 1032 void gftp_calc_kbs ( gftp_transfer * tdata, |
1033 ssize_t num_read ); | |
1034 | |
125 | 1035 int gftp_get_transfer_status ( gftp_transfer * tdata, |
1036 ssize_t num_read ); | |
1037 | |
182 | 1038 int gftp_fd_open ( gftp_request * request, |
1039 const char *pathname, | |
1040 int flags, | |
1041 mode_t perms ); | |
1042 | |
792 | 1043 void gftp_setup_startup_directory ( gftp_request * request, |
1044 const char *option_name ); | |
422 | 1045 |
542 | 1046 unsigned int gftp_protocol_default_port ( gftp_request * request ); |
1047 | |
146 | 1048 /* pty.c */ |
210 | 1049 char * gftp_get_pty_impl ( void ); |
179 | 1050 |
458 | 1051 pid_t gftp_exec ( gftp_request * request, |
1052 int *fdm, | |
1053 int *ptymfd, | |
210 | 1054 char **args ); |
146 | 1055 |
499 | 1056 char *gftp_convert_attributes_from_mode_t ( mode_t mode ); |
1057 | |
1058 mode_t gftp_convert_attributes_to_mode_t ( char *attribs ); | |
1059 | |
1060 | |
168 | 1061 #ifdef USE_SSL |
1062 /* sslcommon.c */ | |
1063 int gftp_ssl_startup ( gftp_request * request ); | |
1064 | |
1065 int gftp_ssl_session_setup ( gftp_request * request ); | |
1066 | |
1067 void gftp_ssl_free ( gftp_request * request ); | |
1068 | |
1069 ssize_t gftp_ssl_read ( gftp_request * request, | |
1070 void *ptr, | |
1071 size_t size, | |
1072 int fd ); | |
1073 | |
1074 ssize_t gftp_ssl_write ( gftp_request * request, | |
1075 const char *ptr, | |
1076 size_t size, | |
1077 int fd ); | |
1078 #endif /* USE_SSL */ | |
1079 | |
460 | 1080 /* UI dependent functions that must be implemented */ |
1081 int gftpui_protocol_ask_yes_no ( gftp_request * request, | |
1082 char *title, | |
1083 char *question ); | |
1084 | |
484 | 1085 char *gftpui_protocol_ask_user_input ( gftp_request * request, |
1086 char *title, | |
1087 char *question, | |
1088 int shown ); | |
1089 | |
469 | 1090 void gftpui_protocol_update_timeout ( gftp_request * request ); |
1091 | |
1 | 1092 #endif |
1093 | |
950 | 1094 /* socket-connect.c */ |
1095 int gftp_connect_server ( gftp_request * request, | |
1096 char *service, | |
1097 char *proxy_hostname, | |
1098 unsigned int proxy_port ); | |
1099 | |
952 | 1100 /* socket-connect-getaddrinfo.c */ |
1101 struct addrinfo * lookup_host_with_getaddrinfo | |
1102 ( gftp_request *request, | |
1103 char *service, | |
1104 char *proxy_hostname, | |
1105 int proxy_port ); | |
1106 | |
1107 int gftp_connect_server_with_getaddrinfo | |
1108 ( gftp_request * request, | |
1109 char *service, | |
1110 char *proxy_hostname, | |
1111 unsigned int proxy_port ); | |
1112 | |
1113 /* socket-connect-gethostbyname.c */ | |
1114 int lookup_host_with_gethostbyname ( gftp_request *request, | |
1115 char *proxy_hostname, | |
1116 struct hostent *hostp ); | |
1117 | |
1118 int gftp_connect_server_legacy ( gftp_request * request, | |
1119 char *service, | |
1120 char *proxy_hostname, | |
1121 unsigned int proxy_port ); | |
1122 | |
950 | 1123 /* sockutils.c */ |
1124 ssize_t gftp_get_line ( gftp_request * request, | |
1125 /*@out@*/ gftp_getline_buffer ** rbuf, | |
1126 /*@out@*/ char * str, | |
1127 size_t len, | |
1128 int fd ); | |
1129 | |
1130 void gftp_free_getline_buffer ( gftp_getline_buffer ** rbuf ); | |
1131 | |
1132 ssize_t gftp_fd_read ( gftp_request * request, | |
1133 void *ptr, | |
1134 size_t size, | |
1135 int fd ); | |
1136 | |
1137 ssize_t gftp_fd_write ( gftp_request * request, | |
1138 const char *ptr, | |
1139 size_t size, | |
1140 int fd ); | |
1141 | |
1142 ssize_t gftp_writefmt ( gftp_request * request, | |
1143 int fd, | |
1144 const char *fmt, | |
1145 ... ); | |
1146 | |
1147 int gftp_fd_set_sockblocking ( gftp_request * request, | |
1148 int fd, | |
1149 int non_blocking ); | |
1150 | |
952 | 1151 struct servent * r_getservbyname ( const char *name, |
1152 const char *proto, | |
1153 struct servent *result_buf, | |
1154 int *h_errnop ); | |
1155 |