Mercurial > gftp.yaz
annotate lib/gftp.h @ 952:a490d94a5b8e
2008-03-28 Brian Masney <masneyb@gftp.org>
* lib/Makefile.am lib/misc.c lib/socket-connect.c
lib/socket-connect-getaddrinfo.c lib/socket-connect-gethostbyname.c
lib/sockutils.c lib/gftp.h - cleaned up more of the socket functions
and split them up into their own files. Cleanups and bug fixes to the
DNS lookup code.
| author | masneyb |
|---|---|
| date | Fri, 28 Mar 2008 11:44:36 +0000 |
| parents | c7d7a081cd9c |
| children | 63555c9744c2 |
| 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 | |
| 1 | 95 #ifdef ENABLE_NLS |
| 96 #include <libintl.h> | |
| 97 #include <locale.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) |
| 136 | 315 |
| 316 typedef struct gftp_config_vars_tag | |
| 317 { | |
| 765 | 318 /*@null@*/ char *key, /* variable name */ |
| 319 *description; /* How this field will show up in the dialog */ | |
| 136 | 320 int otype; /* Type of option this is */ |
| 765 | 321 /*@null@*/ void *value; |
| 322 /*@null@*/ void *listdata; /* For options that have several different | |
| 136 | 323 options, this is a list of all the options. |
| 324 Each option_type that uses this will use this | |
| 325 field differently */ | |
| 326 int flags; /* See GFTP_CVARS_FLAGS_* above */ | |
| 765 | 327 /*@null@*/ char *comment; /* Comment to write out to the config file */ |
| 136 | 328 int ports_shown; /* What ports of gFTP is this option shown in */ |
| 765 | 329 /*@null@*/ void *user_data; /* Data that the GUI can store here (Widget in gtk+) */ |
| 136 | 330 } gftp_config_vars; |
| 331 | |
| 332 | |
| 333 typedef struct gftp_option_type_tag | |
| 334 { | |
| 335 int (*read_function) (char *str, gftp_config_vars * cv, int line); | |
| 765 | 336 int (*write_function) (gftp_config_vars * cv, /*@out@*/ char *buf, |
| 337 size_t buflen, int to_config_file); | |
| 207 | 338 void (*copy_function) (gftp_config_vars * cv, gftp_config_vars * dest_cv); |
| 227 | 339 int (*compare_function) (gftp_config_vars * cv1, gftp_config_vars * cv2); |
| 229 | 340 void *(*ui_print_function) (gftp_config_vars * cv, void *user_data, void *value); |
| 136 | 341 void (*ui_save_function) (gftp_config_vars * cv, void *user_data); |
| 139 | 342 void (*ui_cancel_function) (gftp_config_vars * cv, void *user_data); |
| 136 | 343 void *user_data; |
| 344 } gftp_option_type_var; | |
| 345 | |
| 346 | |
| 347 #define GFTP_TEXTCOMBOEDT_EDITABLE (1 << 0) | |
| 348 | |
| 349 typedef struct gftp_textcomboedt_data_tag | |
| 350 { | |
| 765 | 351 /*@null@*/ char *description, |
| 352 *text; | |
| 136 | 353 int flags; |
| 354 } gftp_textcomboedt_data; | |
| 355 | |
| 356 | |
| 1 | 357 typedef struct gftp_request_tag gftp_request; |
| 358 | |
| 186 | 359 typedef void (*gftp_logging_func) ( gftp_logging_level level, |
| 765 | 360 /*@null@*/ gftp_request * request, |
| 186 | 361 const char *string, ... ); |
| 362 | |
| 570 | 363 #define GFTP_ANONYMOUS_USER "anonymous" |
| 555 | 364 #define gftp_need_username(request) ((request)->need_username && ((request)->username == NULL || *(request)->username == '\0')) |
| 570 | 365 #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 | 366 |
| 1 | 367 struct gftp_request_tag |
| 368 { | |
| 369 int protonum; /* Current number of the protocol this is | |
| 370 set to */ | |
| 371 char *hostname, /* Hostname we will connect to */ | |
| 372 *username, /* Username for host*/ | |
| 373 *password, /* Password for host */ | |
| 374 *account, /* Account for host (FTP only) */ | |
| 375 *directory, /* Current working directory */ | |
| 376 *url_prefix, /* URL Prefix (ex: ftp) */ | |
| 377 *last_ftp_response, /* Last response from server */ | |
| 378 *last_dir_entry; /* Last dir entry from server */ | |
| 379 size_t last_dir_entry_len; /* Length of last_dir_entry */ | |
| 380 | |
| 122 | 381 unsigned int port; /* Port of remote site */ |
| 1 | 382 |
| 169 | 383 int datafd, /* Data connection */ |
| 58 | 384 cachefd; /* For the directory cache */ |
| 1 | 385 int wakeup_main_thread[2]; /* FD that gets written to by the threads |
| 386 to wakeup the parent */ | |
| 122 | 387 |
| 944 | 388 void *remote_addr; |
| 389 size_t remote_addr_len; | |
| 390 int ai_family; | |
| 1 | 391 |
| 122 | 392 int server_type; /* The type of server we are connected to. |
| 393 See GFTP_DIRTYPE_* above */ | |
| 944 | 394 unsigned int use_proxy : 1, |
| 1 | 395 always_connected : 1, |
| 396 need_hostport : 1, | |
| 553 | 397 need_username : 1, |
| 398 need_password : 1, | |
| 1 | 399 use_cache : 1, /* Enable or disable the cache */ |
| 400 cached : 1, /* Is this directory listing cached? */ | |
| 41 | 401 cancel : 1, /* If a signal is received, should |
| 402 we cancel this operation */ | |
| 832 | 403 stopable : 1, |
| 879 | 404 refreshing : 1, |
| 832 | 405 use_local_encoding : 1; |
| 1 | 406 |
| 407 off_t gotbytes; | |
| 408 | |
| 409 void *protocol_data; | |
| 410 | |
| 411 gftp_logging_func logging_function; | |
| 412 void *user_data; | |
| 413 | |
| 173 | 414 int (*init) ( gftp_request * request ); |
| 309 | 415 void (*copy_param_options) ( gftp_request * dest_request, |
| 416 gftp_request * src_request ); | |
| 168 | 417 ssize_t (*read_function) ( gftp_request * request, |
| 418 void *ptr, | |
| 419 size_t size, | |
| 420 int fd ); | |
| 421 ssize_t (*write_function) ( gftp_request * request, | |
| 422 const char *ptr, | |
| 423 size_t size, | |
| 424 int fd ); | |
| 1 | 425 void (*destroy) ( gftp_request * request ); |
| 426 int (*connect) ( gftp_request * request ); | |
| 168 | 427 int (*post_connect) ( gftp_request * request ); |
| 1 | 428 void (*disconnect) ( gftp_request * request ); |
| 58 | 429 off_t (*get_file) ( gftp_request * request, |
| 1 | 430 const char *filename, |
| 431 off_t startsize ); | |
| 432 int (*put_file) ( gftp_request * request, | |
| 433 const char *filename, | |
| 434 off_t startsize, | |
| 435 off_t totalsize ); | |
| 765 | 436 off_t (*transfer_file) ( gftp_request * fromreq, |
| 1 | 437 const char *fromfile, |
| 438 off_t fromsize, | |
| 439 gftp_request * toreq, | |
| 440 const char *tofile, | |
| 441 off_t tosize ); | |
| 58 | 442 ssize_t (*get_next_file_chunk) ( gftp_request * request, |
| 1 | 443 char *buf, |
| 444 size_t size ); | |
| 58 | 445 ssize_t (*put_next_file_chunk) ( gftp_request * request, |
| 1 | 446 char *buf, |
| 447 size_t size ); | |
| 448 int (*end_transfer) ( gftp_request * request ); | |
| 40 | 449 int (*abort_transfer) ( gftp_request * request ); |
| 520 | 450 int (*stat_filename) ( gftp_request * request, |
| 451 const char *filename, | |
| 787 | 452 mode_t * mode, |
| 453 off_t * filesize ); | |
| 1 | 454 int (*list_files) ( gftp_request * request ); |
| 455 int (*get_next_file) ( gftp_request * request, | |
| 456 gftp_file *fle, | |
| 58 | 457 int fd ); |
| 485 | 458 ssize_t (*get_next_dirlist_line) ( gftp_request * request, |
| 459 int fd, | |
| 460 char *buf, | |
| 461 size_t buflen ); | |
| 1 | 462 off_t (*get_file_size) ( gftp_request * request, |
| 463 const char *filename ); | |
| 464 int (*chdir) ( gftp_request * request, | |
| 465 const char *directory ); | |
| 466 int (*rmdir) ( gftp_request * request, | |
| 467 const char *directory ); | |
| 468 int (*rmfile) ( gftp_request * request, | |
| 469 const char *filename ); | |
| 470 int (*mkdir) ( gftp_request * request, | |
| 471 const char *directory ); | |
| 472 int (*rename) ( gftp_request * request, | |
| 473 const char *oldname, | |
| 474 const char *newname ); | |
| 475 int (*chmod) ( gftp_request * request, | |
| 476 const char *filename, | |
| 499 | 477 mode_t mode ); |
| 1 | 478 int (*set_file_time) ( gftp_request * request, |
| 479 const char *filename, | |
| 480 time_t datettime ); | |
| 481 int (*site) ( gftp_request * request, | |
| 478 | 482 int specify_site, |
| 1 | 483 const char *filename ); |
| 484 int (*parse_url) ( gftp_request * request, | |
| 485 const char *url ); | |
| 177 | 486 int (*set_config_options) ( gftp_request * request ); |
| 63 | 487 void (*swap_socks) ( gftp_request * dest, |
| 488 gftp_request * source ); | |
| 1 | 489 |
| 136 | 490 gftp_config_vars * local_options_vars; |
| 491 int num_local_options_vars; | |
| 492 GHashTable * local_options_hash; | |
| 168 | 493 #ifdef USE_SSL |
| 494 SSL * ssl; | |
| 495 #endif | |
| 184 | 496 |
| 497 #if GLIB_MAJOR_VERSION > 1 | |
| 899 | 498 GIConv iconv_to, iconv_from; |
| 499 unsigned int iconv_from_initialized : 1, | |
| 500 iconv_to_initialized : 1; | |
| 842 | 501 char *iconv_charset; |
| 184 | 502 #endif |
| 1 | 503 }; |
| 504 | |
| 505 | |
| 136 | 506 typedef struct gftp_transfer_tag |
| 1 | 507 { |
| 508 gftp_request * fromreq, | |
| 509 * toreq; | |
| 510 | |
| 305 | 511 unsigned int cancel : 1, |
| 1 | 512 ready : 1, |
| 513 started : 1, | |
| 514 done : 1, | |
| 515 show : 1, | |
| 516 stalled : 1, | |
| 303 | 517 conn_error_no_timeout : 1, |
| 1 | 518 next_file : 1, |
|
14
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
1
diff
changeset
|
519 skip_file : 1; |
| 1 | 520 |
| 521 struct timeval starttime, | |
| 522 lasttime; | |
| 523 | |
| 524 double kbs; | |
| 525 | |
| 526 GList * files, | |
| 527 * curfle, | |
| 528 * updfle; | |
| 529 | |
| 19 | 530 long numfiles, |
| 531 numdirs, | |
| 532 current_file_number, | |
| 533 current_file_retries; | |
| 1 | 534 |
| 535 off_t curtrans, /* Current transfered bytes for this file */ | |
| 377 | 536 tot_file_trans, /* Total number of bytes in the file being |
| 537 transferred */ | |
| 1 | 538 curresumed, /* Resumed bytes for this file */ |
| 539 trans_bytes, /* Amount of data transfered for entire | |
| 540 transfer */ | |
| 541 total_bytes, /* Grand total bytes for whole transfer */ | |
| 542 resumed_bytes; /* Grand total of resumed bytes for whole | |
| 543 transfer */ | |
| 544 | |
| 545 void * fromwdata, | |
| 546 * towdata; | |
| 547 | |
| 122 | 548 GStaticMutex statmutex, |
| 549 structmutex; | |
| 550 | |
| 125 | 551 void *user_data; |
| 876 | 552 void *thread_id; |
| 1 | 553 void *clist; |
| 136 | 554 } gftp_transfer; |
| 1 | 555 |
| 556 | |
| 557 typedef struct gftp_log_tag | |
| 558 { | |
| 559 char *msg; | |
| 560 gftp_logging_level type; | |
| 561 } gftp_log; | |
| 562 | |
| 563 | |
| 564 typedef struct supported_gftp_protocols_tag | |
| 565 { | |
| 765 | 566 /*@null@*/ char *name; /* Description of protocol */ |
| 567 /*@null@*/ int (*init) (gftp_request * request); /* Init function */ | |
| 568 /*@null@*/ void (*register_options) (void); /* Protocol options */ | |
| 569 /*@null@*/ char *url_prefix; /* URL Prefix */ | |
| 542 | 570 unsigned int default_port; /* Default port */ |
| 341 | 571 unsigned int shown : 1, /* Whether this protocol is |
| 122 | 572 shown or not to the user in |
| 573 the protocol dropdown box */ | |
| 341 | 574 use_threads : 1; /* Whether or not operations in |
| 575 this protocol should use | |
| 576 threads */ | |
| 1 | 577 } supported_gftp_protocols; |
| 578 | |
| 579 | |
| 122 | 580 typedef struct gftp_bookmarks_tag gftp_bookmarks_var; |
| 1 | 581 |
| 582 struct gftp_bookmarks_tag | |
| 583 { | |
| 609 | 584 char *path, /* Path */ |
| 585 *oldpath, /* Old path name */ | |
| 586 *hostname, /* Our actual internet hostname */ | |
| 1 | 587 *protocol, /* Protocol we will connect through */ |
| 588 *remote_dir, /* Initial directory */ | |
| 589 *local_dir, /* Init local directory */ | |
| 590 *user, /* Username to log in as */ | |
| 591 *pass, /* Our password */ | |
| 592 *acct; /* Account */ | |
| 593 | |
| 594 unsigned int port, /* The port we will connect to */ | |
| 595 isfolder : 1, /* If this is set, then the children field can | |
| 596 be non-NULL */ | |
| 597 save_password : 1; /* Save this password */ | |
| 122 | 598 gftp_bookmarks_var *children, /* The children of this node. */ |
| 599 *prev, /* The parent of this node */ | |
| 600 *next; /* The next sibling of this node */ | |
| 1 | 601 gpointer cnode; |
| 602 | |
| 199 | 603 gftp_config_vars * local_options_vars; |
| 604 int num_local_options_vars; | |
| 605 GHashTable * local_options_hash; | |
| 1 | 606 }; |
| 607 | |
| 608 | |
| 609 typedef struct gftp_file_extensions_tag | |
| 610 { | |
| 611 char *ext, /* The file extension to register */ | |
| 612 *filename, /* The xpm file to display */ | |
| 613 *view_program, /* The program used to view this file */ | |
| 614 *ascii_binary; /* Is this a ASCII transfer or a BINARY transfer */ | |
| 516 | 615 unsigned int stlen; /* How long is the file extension. */ |
| 1 | 616 } gftp_file_extensions; |
| 617 | |
| 618 | |
| 619 typedef struct gftp_color_tag | |
| 620 { | |
| 621 gushort red, | |
| 622 green, | |
| 623 blue; | |
| 624 } gftp_color; | |
| 625 | |
| 626 | |
| 58 | 627 typedef struct gftp_getline_buffer_tag |
| 628 { | |
| 629 char *buffer, | |
| 630 *curpos; | |
| 631 size_t max_bufsize, | |
| 632 cur_bufsize; | |
| 179 | 633 unsigned int eof : 1; |
| 58 | 634 } gftp_getline_buffer; |
| 635 | |
| 126 | 636 |
| 122 | 637 /* Global config options. These are defined in options.h */ |
| 765 | 638 /*@null@*/ extern GList * gftp_file_transfers, * gftp_file_transfer_logs, |
| 639 * gftp_options_list; | |
| 640 /*@null@*/ extern GHashTable * gftp_global_options_htable, * gftp_bookmarks_htable, | |
| 641 * gftp_config_list_htable; | |
| 642 /*@null@*/ extern gftp_bookmarks_var * gftp_bookmarks; | |
| 643 /*@null@*/ extern FILE * gftp_logfd; | |
| 122 | 644 extern gftp_config_vars gftp_global_config_vars[]; |
| 1 | 645 extern supported_gftp_protocols gftp_protocols[]; |
| 122 | 646 extern char gftp_version[]; |
| 201 | 647 extern int gftp_configuration_changed; |
| 122 | 648 |
| 649 /* This is defined in config_file.c */ | |
| 650 | |
| 651 extern gftp_option_type_var gftp_option_types[]; | |
| 1 | 652 |
| 653 /* cache.c */ | |
| 182 | 654 void gftp_generate_cache_description ( gftp_request * request, |
| 765 | 655 /*@out@*/ char *description, |
| 182 | 656 size_t len, |
| 657 int ignore_directory ); | |
| 658 | |
| 58 | 659 int gftp_new_cache_entry ( gftp_request * request ); |
| 1 | 660 |
| 58 | 661 int gftp_find_cache_entry ( gftp_request * request ); |
| 1 | 662 |
| 663 void gftp_clear_cache_files ( void ); | |
| 664 | |
| 47 | 665 void gftp_delete_cache_entry ( gftp_request * request, |
| 182 | 666 char *descr, |
| 47 | 667 int ignore_directory ); |
| 1 | 668 |
| 950 | 669 /* charset-conv.c */ |
| 670 /*@null@*/ char * gftp_string_to_utf8 ( gftp_request * request, | |
| 671 const char *str, | |
| 672 size_t *dest_len ); | |
| 673 | |
| 674 /*@null@*/ char * gftp_string_from_utf8 ( gftp_request * request, | |
| 675 int force_local, | |
| 676 const char *str, | |
| 677 size_t *dest_len ); | |
| 678 | |
| 679 /*@null@*/ char * gftp_filename_to_utf8 ( gftp_request * request, | |
| 680 const char *str, | |
| 681 size_t *dest_len ); | |
| 682 | |
| 683 /*@null@*/ char * gftp_filename_from_utf8 ( gftp_request * request, | |
| 684 const char *str, | |
| 685 size_t *dest_len ); | |
| 686 | |
| 1 | 687 /* config_file.c */ |
| 198 | 688 int gftp_config_parse_args ( char *str, |
| 689 int numargs, | |
| 690 int lineno, | |
| 765 | 691 /*@out@*/ char **first, |
| 198 | 692 ... ); |
| 693 | |
| 122 | 694 void gftp_add_bookmark ( gftp_bookmarks_var * newentry ); |
| 695 | |
| 124 | 696 void gftp_read_config_file ( char *global_data_path ); |
| 1 | 697 |
| 122 | 698 void gftp_write_bookmarks_file ( void ); |
| 1 | 699 |
| 700 void gftp_write_config_file ( void ); | |
| 701 | |
| 122 | 702 GHashTable * build_bookmarks_hash_table ( gftp_bookmarks_var * entry ); |
| 703 | |
| 704 void print_bookmarks ( gftp_bookmarks_var * bookmarks ); | |
| 705 | |
| 374 | 706 void gftp_lookup_global_option ( const char * key, |
| 765 | 707 /*@out@*/ void *value ); |
| 26 | 708 |
| 122 | 709 void gftp_lookup_request_option ( gftp_request * request, |
| 374 | 710 const char * key, |
| 765 | 711 /*@out@*/ void *value ); |
| 712 | |
| 1 | 713 |
| 229 | 714 void gftp_lookup_bookmark_option ( gftp_bookmarks_var * bm, |
| 374 | 715 const char * key, |
| 229 | 716 void *value ); |
| 717 | |
| 374 | 718 void gftp_set_global_option ( const char * key, |
| 227 | 719 const void *value ); |
| 122 | 720 |
| 721 void gftp_set_request_option ( gftp_request * request, | |
| 374 | 722 const char * key, |
| 229 | 723 const void *value ); |
| 724 | |
| 725 void gftp_set_bookmark_option ( gftp_bookmarks_var * bm, | |
| 374 | 726 const char * key, |
| 229 | 727 const void *value ); |
| 122 | 728 |
| 729 void gftp_register_config_vars ( gftp_config_vars *config_vars ); | |
| 1 | 730 |
| 201 | 731 void gftp_copy_local_options ( gftp_config_vars ** new_options_vars, |
| 732 GHashTable ** new_options_hash, | |
| 429 | 733 int *new_num_local_options_vars, |
| 201 | 734 gftp_config_vars * orig_options, |
| 735 int num_local_options_vars ); | |
| 736 | |
| 737 void gftp_config_free_options ( gftp_config_vars * options_vars, | |
| 738 GHashTable * options_hash, | |
| 739 int num_options_vars ); | |
| 740 | |
| 741 void gftp_bookmarks_destroy ( gftp_bookmarks_var * bookmarks ); | |
| 742 | |
| 218 | 743 void gftp_free_proxy_hosts ( GList * proxy_hosts ); |
| 744 | |
| 745 GList * gftp_copy_proxy_hosts ( GList * proxy_hosts ); | |
| 746 | |
| 1 | 747 /* misc.c */ |
| 765 | 748 /*@null@*/ char *insert_commas ( off_t number, |
| 1 | 749 char *dest_str, |
| 750 size_t dest_len ); | |
| 751 | |
| 752 char *alltrim ( char *str ); | |
| 753 | |
| 555 | 754 char *gftp_expand_path ( gftp_request * request, |
| 755 const char *src ); | |
| 1 | 756 |
| 757 void make_nonnull ( char **str ); | |
| 758 | |
| 821 | 759 int gftp_match_filespec ( gftp_request * request, |
| 760 const char *filename, | |
| 374 | 761 const char *filespec ); |
| 1 | 762 |
| 763 int gftp_parse_command_line ( int *argc, | |
| 764 char ***argv ); | |
| 765 | |
| 766 void gftp_usage ( void ); | |
| 767 | |
| 768 gint string_hash_compare ( gconstpointer path1, | |
| 769 gconstpointer path2 ); | |
| 770 | |
| 771 guint string_hash_function ( gconstpointer key ); | |
| 772 | |
| 852 | 773 gint uint_hash_compare ( gconstpointer path1, |
| 774 gconstpointer path2 ); | |
| 775 | |
| 776 guint uint_hash_function ( gconstpointer key ); | |
| 777 | |
| 1 | 778 void free_file_list ( GList * filelist ); |
| 779 | |
| 780 gftp_file * copy_fdata ( gftp_file * fle ); | |
| 781 | |
| 782 int compare_request ( gftp_request * request1, | |
| 783 gftp_request * request2, | |
| 784 int compare_dirs ); | |
| 785 | |
| 129 | 786 gftp_transfer * gftp_tdata_new ( void ); |
| 787 | |
| 1 | 788 void free_tdata ( gftp_transfer * tdata ); |
| 789 | |
| 368 | 790 gftp_request * gftp_copy_request ( gftp_request * req ); |
| 1 | 791 |
| 16 | 792 GList * gftp_sort_filelist ( GList * filelist, |
| 793 int column, | |
| 794 int asds ); | |
| 795 | |
| 830 | 796 char * gftp_gen_ls_string ( gftp_request * request, |
| 797 gftp_file * fle, | |
| 131 | 798 char *file_prefixstr, |
| 799 char *file_suffixstr ); | |
| 800 | |
| 168 | 801 char * base64_encode ( char *str ); |
| 802 | |
| 609 | 803 void gftp_free_bookmark ( gftp_bookmarks_var * entry, |
| 804 int free_node ); | |
| 199 | 805 |
| 201 | 806 void gftp_shutdown ( void ); |
| 199 | 807 |
| 207 | 808 GList * get_next_selection ( GList * selection, |
| 809 GList ** list, | |
| 810 int *curnum ); | |
| 811 | |
| 555 | 812 char * gftp_build_path ( gftp_request * request, |
| 813 const char *first_element, | |
| 227 | 814 ... ); |
| 815 | |
| 290 | 816 void gftp_locale_init ( void ); |
| 817 | |
| 330 | 818 char * gftp_scramble_password ( const char *password ); |
| 819 | |
| 820 char * gftp_descramble_password ( const char *password ); | |
| 821 | |
| 378 | 822 int gftp_get_transfer_action ( gftp_request * request, |
| 823 gftp_file * fle ); | |
| 824 | |
| 483 | 825 char * gftp_get_share_dir ( void ); |
| 826 | |
| 402 | 827 /* mkstemps.c */ |
| 828 int mkstemps ( char *template, | |
| 829 int suffix_len ); | |
| 830 | |
| 950 | 831 /* parse-dir-listing.c */ |
| 832 time_t parse_time ( char *str, | |
| 833 char **endpos ); | |
| 834 | |
| 835 int gftp_parse_ls ( gftp_request * request, | |
| 836 const char *lsoutput, | |
| 837 gftp_file *fle, | |
| 838 int fd ); | |
| 839 | |
| 1 | 840 /* protocols.c */ |
| 841 #define GFTP_FTP_NUM 0 | |
| 389 | 842 #define GFTP_FTPS_NUM 1 |
| 843 #define GFTP_HTTP_NUM 2 | |
| 844 #define GFTP_HTTPS_NUM 3 | |
| 845 #define GFTP_LOCAL_NUM 4 | |
| 846 #define GFTP_SSHV2_NUM 5 | |
| 847 #define GFTP_BOOKMARK_NUM 6 | |
| 661 | 848 #define GFTP_FSP_NUM 7 |
| 122 | 849 |
| 1 | 850 #define GFTP_IS_CONNECTED(request) ((request) != NULL && \ |
| 169 | 851 ((request)->datafd > 0 || \ |
| 58 | 852 (request)->cached || \ |
| 853 (request)->always_connected)) | |
| 1 | 854 |
| 855 | |
| 173 | 856 int rfc959_init ( gftp_request * request ); |
| 1 | 857 |
| 122 | 858 void rfc959_register_module ( void ); |
| 859 | |
| 1 | 860 int rfc959_get_next_file ( gftp_request * request, |
| 861 gftp_file *fle, | |
| 58 | 862 int fd ); |
| 1 | 863 |
| 451 | 864 int rfc959_connect ( gftp_request * request ); |
| 865 | |
| 389 | 866 int ftps_init ( gftp_request * request ); |
| 867 | |
| 868 void ftps_register_module ( void ); | |
| 869 | |
| 173 | 870 int rfc2068_init ( gftp_request * request ); |
| 1 | 871 |
| 122 | 872 void rfc2068_register_module ( void ); |
| 873 | |
| 173 | 874 int https_init ( gftp_request * request ); |
| 168 | 875 |
| 876 void https_register_module ( void ); | |
| 877 | |
| 173 | 878 int local_init ( gftp_request * request ); |
| 1 | 879 |
| 122 | 880 void local_register_module ( void ); |
| 881 | |
| 173 | 882 int sshv2_init ( gftp_request * request ); |
| 1 | 883 |
| 122 | 884 void sshv2_register_module ( void ); |
| 885 | |
| 174 | 886 void ssl_register_module ( void ); |
| 887 | |
| 173 | 888 int bookmark_init ( gftp_request * request ); |
| 1 | 889 |
| 122 | 890 void bookmark_register_module ( void ); |
| 891 | |
| 661 | 892 int fsp_init ( gftp_request * request ); |
| 893 | |
| 894 void fsp_register_module ( void ); | |
| 895 | |
| 1 | 896 gftp_request *gftp_request_new ( void ); |
| 897 | |
| 67 | 898 void gftp_request_destroy ( gftp_request * request, |
| 899 int free_request ); | |
| 1 | 900 |
| 309 | 901 void gftp_copy_param_options ( gftp_request * dest_request, |
| 902 gftp_request * src_request ); | |
| 903 | |
| 598 | 904 void gftp_file_destroy ( gftp_file *file, |
| 905 int free_it ); | |
| 1 | 906 |
| 907 int gftp_connect ( gftp_request * request ); | |
| 908 | |
| 909 void gftp_disconnect ( gftp_request * request ); | |
| 910 | |
| 58 | 911 off_t gftp_get_file ( gftp_request * request, |
| 1 | 912 const char *filename, |
| 244 | 913 off_t startsize ); |
| 1 | 914 |
| 915 int gftp_put_file ( gftp_request * request, | |
| 916 const char *filename, | |
| 244 | 917 off_t startsize, |
| 918 off_t totalsize ); | |
| 1 | 919 |
| 261 | 920 off_t gftp_transfer_file ( gftp_request *fromreq, |
| 1 | 921 const char *fromfile, |
| 244 | 922 off_t fromsize, |
| 1 | 923 gftp_request *toreq, |
| 924 const char *tofile, | |
| 244 | 925 off_t tosize ); |
| 1 | 926 |
| 58 | 927 ssize_t gftp_get_next_file_chunk ( gftp_request * request, |
| 1 | 928 char *buf, |
| 929 size_t size ); | |
| 930 | |
| 58 | 931 ssize_t gftp_put_next_file_chunk ( gftp_request * request, |
| 1 | 932 char *buf, |
| 933 size_t size ); | |
| 934 | |
| 935 int gftp_list_files ( gftp_request * request ); | |
| 936 | |
| 87 | 937 int gftp_parse_bookmark ( gftp_request * request, |
| 243 | 938 gftp_request * local_request, |
| 275 | 939 const char * bookmark, |
| 940 int *refresh_local ); | |
| 87 | 941 |
| 1 | 942 int gftp_parse_url ( gftp_request * request, |
| 943 const char *url ); | |
| 944 | |
| 945 int gftp_get_next_file ( gftp_request * request, | |
| 377 | 946 const char *filespec, |
| 1 | 947 gftp_file *fle ); |
| 948 | |
| 949 int gftp_end_transfer ( gftp_request * request ); | |
| 950 | |
| 40 | 951 int gftp_abort_transfer ( gftp_request * request ); |
| 952 | |
| 520 | 953 int gftp_stat_filename ( gftp_request * request, |
| 954 const char *filename, | |
| 787 | 955 mode_t * mode, |
| 956 off_t * filesize ); | |
| 500 | 957 |
| 1 | 958 void gftp_set_hostname ( gftp_request * request, |
| 959 const char *hostname ); | |
| 960 | |
| 961 void gftp_set_username ( gftp_request * request, | |
| 962 const char *username ); | |
| 963 | |
| 964 void gftp_set_password ( gftp_request * request, | |
| 965 const char *password ); | |
| 966 | |
| 967 void gftp_set_account ( gftp_request * request, | |
| 968 const char *account ); | |
| 969 | |
| 970 int gftp_set_directory ( gftp_request * request, | |
| 971 const char *directory ); | |
| 972 | |
| 973 void gftp_set_port ( gftp_request * request, | |
| 974 unsigned int port ); | |
| 975 | |
| 976 int gftp_remove_directory ( gftp_request * request, | |
| 977 const char *directory ); | |
| 978 | |
| 979 int gftp_remove_file ( gftp_request * request, | |
| 980 const char *file ); | |
| 981 | |
| 982 int gftp_make_directory ( gftp_request * request, | |
| 983 const char *directory ); | |
| 984 | |
| 985 int gftp_rename_file ( gftp_request * request, | |
| 986 const char *oldname, | |
| 987 const char *newname ); | |
| 988 | |
| 989 int gftp_chmod ( gftp_request * request, | |
| 990 const char *file, | |
| 499 | 991 mode_t mode ); |
| 1 | 992 |
| 993 int gftp_set_file_time ( gftp_request * request, | |
| 994 const char *file, | |
| 995 time_t datetime ); | |
| 996 | |
| 765 | 997 int gftp_site_cmd ( gftp_request * request, |
| 478 | 998 int specify_site, |
| 1 | 999 const char *command ); |
| 1000 | |
| 58 | 1001 off_t gftp_get_file_size ( gftp_request * request, |
| 1 | 1002 const char *filename ); |
| 1003 | |
| 1004 void gftp_calc_kbs ( gftp_transfer * tdata, | |
| 1005 ssize_t num_read ); | |
| 1006 | |
| 1007 int gftp_get_all_subdirs ( gftp_transfer * transfer, | |
| 1008 void (*update_func) | |
| 1009 ( gftp_transfer * transfer )); | |
| 1010 | |
| 177 | 1011 int gftp_set_config_options ( gftp_request * request ); |
| 1 | 1012 |
| 1013 void print_file_list ( GList * list ); | |
| 1014 | |
| 63 | 1015 void gftp_swap_socks ( gftp_request * dest, |
| 1016 gftp_request * source ); | |
| 1017 | |
| 122 | 1018 void gftp_calc_kbs ( gftp_transfer * tdata, |
| 1019 ssize_t num_read ); | |
| 1020 | |
| 125 | 1021 int gftp_get_transfer_status ( gftp_transfer * tdata, |
| 1022 ssize_t num_read ); | |
| 1023 | |
| 182 | 1024 int gftp_fd_open ( gftp_request * request, |
| 1025 const char *pathname, | |
| 1026 int flags, | |
| 1027 mode_t perms ); | |
| 1028 | |
| 792 | 1029 void gftp_setup_startup_directory ( gftp_request * request, |
| 1030 const char *option_name ); | |
| 422 | 1031 |
| 542 | 1032 unsigned int gftp_protocol_default_port ( gftp_request * request ); |
| 1033 | |
| 146 | 1034 /* pty.c */ |
| 210 | 1035 char * gftp_get_pty_impl ( void ); |
| 179 | 1036 |
| 458 | 1037 pid_t gftp_exec ( gftp_request * request, |
| 1038 int *fdm, | |
| 1039 int *ptymfd, | |
| 210 | 1040 char **args ); |
| 146 | 1041 |
| 499 | 1042 char *gftp_convert_attributes_from_mode_t ( mode_t mode ); |
| 1043 | |
| 1044 mode_t gftp_convert_attributes_to_mode_t ( char *attribs ); | |
| 1045 | |
| 1046 | |
| 168 | 1047 #ifdef USE_SSL |
| 1048 /* sslcommon.c */ | |
| 1049 int gftp_ssl_startup ( gftp_request * request ); | |
| 1050 | |
| 1051 int gftp_ssl_session_setup ( gftp_request * request ); | |
| 1052 | |
| 1053 void gftp_ssl_free ( gftp_request * request ); | |
| 1054 | |
| 1055 ssize_t gftp_ssl_read ( gftp_request * request, | |
| 1056 void *ptr, | |
| 1057 size_t size, | |
| 1058 int fd ); | |
| 1059 | |
| 1060 ssize_t gftp_ssl_write ( gftp_request * request, | |
| 1061 const char *ptr, | |
| 1062 size_t size, | |
| 1063 int fd ); | |
| 1064 #endif /* USE_SSL */ | |
| 1065 | |
| 460 | 1066 /* UI dependent functions that must be implemented */ |
| 1067 int gftpui_protocol_ask_yes_no ( gftp_request * request, | |
| 1068 char *title, | |
| 1069 char *question ); | |
| 1070 | |
| 484 | 1071 char *gftpui_protocol_ask_user_input ( gftp_request * request, |
| 1072 char *title, | |
| 1073 char *question, | |
| 1074 int shown ); | |
| 1075 | |
| 469 | 1076 void gftpui_protocol_update_timeout ( gftp_request * request ); |
| 1077 | |
| 1 | 1078 #endif |
| 1079 | |
| 950 | 1080 /* socket-connect.c */ |
| 1081 int gftp_connect_server ( gftp_request * request, | |
| 1082 char *service, | |
| 1083 char *proxy_hostname, | |
| 1084 unsigned int proxy_port ); | |
| 1085 | |
| 952 | 1086 /* socket-connect-getaddrinfo.c */ |
| 1087 struct addrinfo * lookup_host_with_getaddrinfo | |
| 1088 ( gftp_request *request, | |
| 1089 char *service, | |
| 1090 char *proxy_hostname, | |
| 1091 int proxy_port ); | |
| 1092 | |
| 1093 int gftp_connect_server_with_getaddrinfo | |
| 1094 ( gftp_request * request, | |
| 1095 char *service, | |
| 1096 char *proxy_hostname, | |
| 1097 unsigned int proxy_port ); | |
| 1098 | |
| 1099 /* socket-connect-gethostbyname.c */ | |
| 1100 int lookup_host_with_gethostbyname ( gftp_request *request, | |
| 1101 char *proxy_hostname, | |
| 1102 struct hostent *hostp ); | |
| 1103 | |
| 1104 int gftp_connect_server_legacy ( gftp_request * request, | |
| 1105 char *service, | |
| 1106 char *proxy_hostname, | |
| 1107 unsigned int proxy_port ); | |
| 1108 | |
| 950 | 1109 /* sockutils.c */ |
| 1110 ssize_t gftp_get_line ( gftp_request * request, | |
| 1111 /*@out@*/ gftp_getline_buffer ** rbuf, | |
| 1112 /*@out@*/ char * str, | |
| 1113 size_t len, | |
| 1114 int fd ); | |
| 1115 | |
| 1116 void gftp_free_getline_buffer ( gftp_getline_buffer ** rbuf ); | |
| 1117 | |
| 1118 ssize_t gftp_fd_read ( gftp_request * request, | |
| 1119 void *ptr, | |
| 1120 size_t size, | |
| 1121 int fd ); | |
| 1122 | |
| 1123 ssize_t gftp_fd_write ( gftp_request * request, | |
| 1124 const char *ptr, | |
| 1125 size_t size, | |
| 1126 int fd ); | |
| 1127 | |
| 1128 ssize_t gftp_writefmt ( gftp_request * request, | |
| 1129 int fd, | |
| 1130 const char *fmt, | |
| 1131 ... ); | |
| 1132 | |
| 1133 int gftp_fd_set_sockblocking ( gftp_request * request, | |
| 1134 int fd, | |
| 1135 int non_blocking ); | |
| 1136 | |
| 952 | 1137 struct servent * r_getservbyname ( const char *name, |
| 1138 const char *proto, | |
| 1139 struct servent *result_buf, | |
| 1140 int *h_errnop ); | |
| 1141 |
