Mercurial > gftp.yaz
annotate lib/gftp.h @ 168:c505d9ba9d53
2003-6-6 Brian Masney <masneyb@gftp.org>
* lib/gftp.h - if USE_SSL is defined, include the OpenSSL headers.
Added read_function, write_function and post_connect function pointers
to gftp_request structure. Added SSL object to gftp_request structure
if USE_SSL is defined. Added protocol number and init function
declarations for the HTTPS protocol
* lib/options.h - added HTTPS to the list of supported protocols
* lib/protocols.c lib/cache.c lib/rfc2068.c lib/rfc959.c lib/sshv2.c -
renamed gftp_read(), gftp_write() and gftp_set_sockblocking() to
gftp_fd_read(), gftp_fd_write() and gftp_fd_set_sockblocking()
respectively
* lib/bookmark.c lib/local.c
* lib/misc.c lib/rfc2068.c - moved base64_encode() to misc.c
* lib/protocols.c - improved parsing of URLs. Rather than calling
gftp_read() or gftp_write() directly, call the read_function or
write_function that is set in the request structure. Expanded tabs
to spaces. Cleanup for parsing of timestamps. In
gftp_connect_server(), if a post_connect function pointer is set,
call it after we are connected to the server. Improvements to
gftp_get_line ().
* lib/httpcommon.h lib/rfc2068.c - moved rfc2068_params structure to
httpcommon.h. Fix for chunked file transfers, they were not handled
at all before. Made the I/O calls a little more generic so that we can
read from either a socket or a SSL connection.
* lib/sslcommon.c - added generic SSL layer
* lib/https.c - added support for the HTTPS protocol. It piggy backs
off of the existing HTTP support and uses the generic SSL layer
* src/gtk/bookmarks.c src/gtk/chmod_dialog.c src/gtk/gftp-gtk.c
src/gtk/menu-items.c src/gtk/misc-gtk.c src/gtk/options_dialog.c
src/gtk/view_dialog.c - set the window icon name to the gFTP <version>
* configure.in - added lib back to SUBDIRS (oops)
* lib/Makefile.am - added https.c, sslcommon.c and httpcommon.h
author | masneyb |
---|---|
date | Sun, 08 Jun 2003 15:04:40 +0000 |
parents | 2f15b3000dbc |
children | d40f9db52cdf |
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 | |
25 #ifdef HAVE_CONFIG_H | |
26 #include "config.h" | |
27 #endif | |
28 | |
29 #include <sys/types.h> | |
30 #include <sys/stat.h> | |
31 #include <sys/socket.h> | |
32 #include <sys/time.h> | |
33 #ifndef TIOCGWINSZ | |
34 #include <sys/ioctl.h> | |
35 #endif | |
36 #include <sys/wait.h> | |
37 #include <sys/utsname.h> | |
38 #include <netinet/in.h> | |
39 #include <arpa/inet.h> | |
40 #include <glib.h> | |
41 #include <limits.h> | |
42 #include <netdb.h> | |
43 #include <stdio.h> | |
44 #include <stdarg.h> | |
45 #include <stdlib.h> | |
46 #include <errno.h> | |
47 #include <fcntl.h> | |
48 #include <unistd.h> | |
49 #include <ctype.h> | |
50 #include <time.h> | |
51 #include <utime.h> | |
52 #include <signal.h> | |
53 #include <termios.h> | |
54 #include <pwd.h> | |
55 #include <setjmp.h> | |
56 #include <dirent.h> | |
57 #include <grp.h> | |
58 #include <math.h> | |
59 | |
80 | 60 #ifdef HAVE_GRANTPT |
61 #include <stropts.h> | |
62 #endif | |
63 | |
1 | 64 #ifdef HAVE_STRING_H |
65 #include <string.h> | |
66 #else | |
67 #include <strings.h> | |
68 #endif | |
69 | |
168 | 70 #ifdef USE_SSL |
71 #include <openssl/bio.h> | |
72 #include <openssl/err.h> | |
73 #include <openssl/rand.h> | |
74 #include <openssl/ssl.h> | |
75 #include <openssl/x509v3.h> | |
76 #endif | |
77 | |
1 | 78 #ifdef ENABLE_NLS |
79 #include <libintl.h> | |
80 #include <locale.h> | |
81 #define _(String) gettext (String) | |
82 #else | |
83 #define _(String) String | |
84 #endif | |
85 #define N_(String) String | |
86 | |
87 #ifndef AF_LOCAL | |
88 #define AF_LOCAL AF_UNIX | |
89 #endif | |
90 | |
151 | 91 #ifdef HAVE_OPENPTY |
92 #include <pty.h> | |
93 #endif | |
94 | |
146 | 95 #ifdef HAVE_GETADDRINFO |
96 #define HAVE_IPV6 | |
151 | 97 #define GFTP_GET_AI_FAMILY(request) (request != NULL && request->hostp != NULL ? request->hostp->ai_family : -1) |
146 | 98 #else |
99 #define GFTP_GET_AI_FAMILY(request) AF_INET | |
100 #endif | |
101 | |
48 | 102 /* We need the major() and minor() macros in the user interface. If they aren't |
103 defined by the system, we'll just define them here. */ | |
104 #ifndef major | |
105 #warning major macro was not defined by the system. Defining one that is probably wrong for your system | |
106 #define major(dev) (((dev) >> 8) & 0xff) | |
107 #endif | |
108 | |
109 #ifndef minor | |
110 #warning minor macro was not defined by the system. Defining one that is probably wrong for your system | |
111 #define minor(dev) ((dev) & 0xff) | |
112 #endif | |
113 | |
1 | 114 #ifdef HAVE_DMALLOC |
115 #include <dmalloc.h> | |
116 #endif | |
117 | |
91 | 118 /* Server types (used by FTP protocol from SYST command) */ |
122 | 119 #define GFTP_DIRTYPE_UNIX 1 |
120 #define GFTP_DIRTYPE_EPLF 2 | |
121 #define GFTP_DIRTYPE_CRAY 3 | |
122 #define GFTP_DIRTYPE_NOVELL 4 | |
123 #define GFTP_DIRTYPE_DOS 5 | |
124 #define GFTP_DIRTYPE_VMS 6 | |
125 #define GFTP_DIRTYPE_OTHER 7 | |
91 | 126 |
84 | 127 /* Error types */ |
128 #define GFTP_ERETRYABLE -1 | |
129 #define GFTP_EFATAL -2 | |
130 | |
1 | 131 /* Some general settings */ |
132 #define BASE_CONF_DIR "~/.gftp" | |
133 #define CONFIG_FILE BASE_CONF_DIR "/gftprc" | |
134 #define BOOKMARKS_FILE BASE_CONF_DIR "/bookmarks" | |
135 #define LOG_FILE BASE_CONF_DIR "/gftp.log" | |
136 #define MAX_HIST_LEN 10 | |
137 | |
138 typedef enum gftp_transfer_type_tag | |
139 { | |
140 gftp_transfer_passive, | |
141 gftp_transfer_active | |
142 } gftp_transfer_type; | |
143 | |
144 | |
145 typedef enum gftp_logging_level_tag | |
146 { | |
147 gftp_logging_send, | |
148 gftp_logging_recv, | |
149 gftp_logging_error, | |
150 gftp_logging_misc | |
151 } gftp_logging_level; | |
152 | |
153 typedef void (*gftp_logging_func) ( gftp_logging_level level, | |
154 void *ptr, | |
155 const char *string, ... ); | |
156 | |
157 | |
158 typedef struct gftp_file_tag gftp_file; | |
159 | |
160 #define GFTP_TRANS_ACTION_OVERWRITE 1 | |
161 #define GFTP_TRANS_ACTION_RESUME 2 | |
162 #define GFTP_TRANS_ACTION_SKIP 3 | |
163 | |
164 #define GFTP_DIRECTION_DOWNLOAD 0 | |
165 #define GFTP_DIRECTION_UPLOAD 1 | |
166 | |
16 | 167 #define GFTP_SORT_COL_FILE 1 |
168 #define GFTP_SORT_COL_SIZE 2 | |
169 #define GFTP_SORT_COL_USER 3 | |
170 #define GFTP_SORT_COL_GROUP 4 | |
171 #define GFTP_SORT_COL_DATETIME 5 | |
172 #define GFTP_SORT_COL_ATTRIBS 6 | |
173 | |
1 | 174 struct gftp_file_tag |
175 { | |
176 char *file, /* Our filename */ | |
177 *user, /* User that owns it */ | |
178 *group, /* Group that owns it */ | |
179 *attribs, /* Attribs (-rwxr-x-rx) */ | |
180 *destfile; /* Full pathname to the destination for the | |
181 file transfer */ | |
122 | 182 |
183 int fd; /* Already open fd for this file */ | |
184 /* FIXME - add fd_open function */ | |
185 | |
1 | 186 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
|
187 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
|
188 startsize; /* Size to start the transfer at */ |
1 | 189 unsigned int isdir : 1, /* File type */ |
190 isexe : 1, | |
191 islink : 1, | |
192 selected : 1, /* Is this file selected? */ | |
193 was_sel : 1, /* Was this file selected before */ | |
194 shown : 1, /* Is this file shown? */ | |
195 done_view : 1, /* View the file when done transfering? */ | |
196 done_edit : 1, /* Edit the file when done transfering? */ | |
197 done_rm : 1, /* Remove the file when done */ | |
198 transfer_done : 1, /* Is current file transfer done? */ | |
199 is_fd : 1; /* Is this a file descriptor? */ | |
200 char transfer_action; /* See the GFTP_TRANS_ACTION_* vars above */ | |
122 | 201 void *user_data; |
1 | 202 }; |
203 | |
204 | |
205 typedef struct gftp_proxy_hosts_tag | |
206 { | |
122 | 207 /* FIXME - add IPV4 stuff here */ |
208 | |
209 gint32 ipv4_network_address, | |
1 | 210 ipv4_netmask; |
211 char *domain; | |
212 } gftp_proxy_hosts; | |
213 | |
136 | 214 |
215 /* Note, these numbers must match up to the index number in config_file.c | |
216 in the declaration of gftp_option_types */ | |
217 typedef enum | |
218 { | |
219 gftp_option_type_text = 0, | |
220 gftp_option_type_textcombo = 1, | |
221 gftp_option_type_textcomboedt = 2, | |
222 gftp_option_type_hidetext = 3, | |
223 gftp_option_type_int = 4, | |
224 gftp_option_type_checkbox = 5, | |
225 gftp_option_type_intcombo = 6, | |
226 gftp_option_type_float = 7, | |
227 gftp_option_type_color = 8, | |
228 gftp_option_type_notebook = 9 | |
229 } gftp_option_type_enum; | |
230 | |
231 | |
232 #define GFTP_PORT_GTK (1 << 1) | |
233 #define GFTP_PORT_TEXT (1 << 2) | |
234 #define GFTP_PORT_ALL (GFTP_PORT_GTK | GFTP_PORT_TEXT) | |
235 | |
236 | |
237 typedef struct gftp_config_list_vars_tag | |
238 { | |
239 char *key; | |
240 void * (*read_func) (char *buf, int line); | |
241 void (*write_func) (FILE *fd, void *data); | |
242 GList * list; | |
243 unsigned int num_items; | |
244 char *header; | |
245 } gftp_config_list_vars; | |
246 | |
247 | |
248 #define GFTP_CVARS_FLAGS_DYNMEM (1 << 1) | |
249 | |
250 | |
251 typedef struct gftp_config_vars_tag | |
252 { | |
253 char *key, /* variable name */ | |
254 *description; /* How this field will show up in the dialog */ | |
255 int otype; /* Type of option this is */ | |
256 void *value; | |
257 void *listdata; /* For options that have several different | |
258 options, this is a list of all the options. | |
259 Each option_type that uses this will use this | |
260 field differently */ | |
261 int flags; /* See GFTP_CVARS_FLAGS_* above */ | |
262 char *comment; /* Comment to write out to the config file */ | |
263 int ports_shown; /* What ports of gFTP is this option shown in */ | |
264 void *user_data; /* Data that the GUI can store here (Widget in gtk+) */ | |
265 } gftp_config_vars; | |
266 | |
267 | |
268 typedef struct gftp_option_type_tag | |
269 { | |
270 int (*read_function) (char *str, gftp_config_vars * cv, int line); | |
271 int (*write_function) (gftp_config_vars * cv, FILE * fd, int to_config_file); | |
272 void * (*ui_print_function) (gftp_config_vars * cv, void *user_data); | |
273 void (*ui_save_function) (gftp_config_vars * cv, void *user_data); | |
139 | 274 void (*ui_cancel_function) (gftp_config_vars * cv, void *user_data); |
136 | 275 void *user_data; |
276 } gftp_option_type_var; | |
277 | |
278 | |
279 #define GFTP_TEXTCOMBOEDT_EDITABLE (1 << 0) | |
280 | |
281 typedef struct gftp_textcomboedt_data_tag | |
282 { | |
283 char *description, | |
284 *text; | |
285 int flags; | |
286 } gftp_textcomboedt_data; | |
287 | |
288 | |
1 | 289 typedef struct gftp_request_tag gftp_request; |
290 | |
291 struct gftp_request_tag | |
292 { | |
293 int protonum; /* Current number of the protocol this is | |
294 set to */ | |
295 char *hostname, /* Hostname we will connect to */ | |
296 *username, /* Username for host*/ | |
297 *password, /* Password for host */ | |
298 *account, /* Account for host (FTP only) */ | |
299 *directory, /* Current working directory */ | |
300 *url_prefix, /* URL Prefix (ex: ftp) */ | |
301 *last_ftp_response, /* Last response from server */ | |
302 *last_dir_entry; /* Last dir entry from server */ | |
303 size_t last_dir_entry_len; /* Length of last_dir_entry */ | |
304 | |
122 | 305 unsigned int port; /* Port of remote site */ |
1 | 306 |
58 | 307 int sockfd, /* Control connection (read) */ |
308 datafd, /* Data connection */ | |
309 cachefd; /* For the directory cache */ | |
1 | 310 int wakeup_main_thread[2]; /* FD that gets written to by the threads |
311 to wakeup the parent */ | |
122 | 312 |
313 /* One of these are used to lookup the IP address of the host we are | |
314 connecting to */ | |
1 | 315 #if defined (HAVE_GETADDRINFO) && defined (HAVE_GAI_STRERROR) |
122 | 316 struct addrinfo *hostp; |
1 | 317 #else |
122 | 318 struct hostent host, *hostp; |
1 | 319 #endif |
320 | |
122 | 321 int server_type; /* The type of server we are connected to. |
322 See GFTP_DIRTYPE_* above */ | |
151 | 323 unsigned int free_hostp : 1, /* Should we free the hostp structure |
324 in gftp_destroy_request() */ | |
325 use_proxy : 1, | |
1 | 326 always_connected : 1, |
327 need_hostport : 1, | |
328 need_userpass : 1, | |
329 use_cache : 1, /* Enable or disable the cache */ | |
330 use_threads : 1, /* Whether we need to spawn a thread | |
331 for this protocol */ | |
332 cached : 1, /* Is this directory listing cached? */ | |
41 | 333 cancel : 1, /* If a signal is received, should |
334 we cancel this operation */ | |
1 | 335 stopable : 1; |
336 | |
337 off_t gotbytes; | |
338 | |
339 void *protocol_data; | |
340 | |
341 gftp_logging_func logging_function; | |
342 void *user_data; | |
343 | |
344 void (*init) ( gftp_request * request ); | |
168 | 345 ssize_t (*read_function) ( gftp_request * request, |
346 void *ptr, | |
347 size_t size, | |
348 int fd ); | |
349 ssize_t (*write_function) ( gftp_request * request, | |
350 const char *ptr, | |
351 size_t size, | |
352 int fd ); | |
1 | 353 void (*destroy) ( gftp_request * request ); |
354 int (*connect) ( gftp_request * request ); | |
168 | 355 int (*post_connect) ( gftp_request * request ); |
1 | 356 void (*disconnect) ( gftp_request * request ); |
58 | 357 off_t (*get_file) ( gftp_request * request, |
1 | 358 const char *filename, |
58 | 359 int fd, |
1 | 360 off_t startsize ); |
361 int (*put_file) ( gftp_request * request, | |
362 const char *filename, | |
58 | 363 int fd, |
1 | 364 off_t startsize, |
365 off_t totalsize ); | |
366 long (*transfer_file) ( gftp_request * fromreq, | |
367 const char *fromfile, | |
368 off_t fromsize, | |
369 gftp_request * toreq, | |
370 const char *tofile, | |
371 off_t tosize ); | |
58 | 372 ssize_t (*get_next_file_chunk) ( gftp_request * request, |
1 | 373 char *buf, |
374 size_t size ); | |
58 | 375 ssize_t (*put_next_file_chunk) ( gftp_request * request, |
1 | 376 char *buf, |
377 size_t size ); | |
378 int (*end_transfer) ( gftp_request * request ); | |
40 | 379 int (*abort_transfer) ( gftp_request * request ); |
1 | 380 int (*list_files) ( gftp_request * request ); |
381 int (*get_next_file) ( gftp_request * request, | |
382 gftp_file *fle, | |
58 | 383 int fd ); |
1 | 384 off_t (*get_file_size) ( gftp_request * request, |
385 const char *filename ); | |
386 int (*chdir) ( gftp_request * request, | |
387 const char *directory ); | |
388 int (*rmdir) ( gftp_request * request, | |
389 const char *directory ); | |
390 int (*rmfile) ( gftp_request * request, | |
391 const char *filename ); | |
392 int (*mkdir) ( gftp_request * request, | |
393 const char *directory ); | |
394 int (*rename) ( gftp_request * request, | |
395 const char *oldname, | |
396 const char *newname ); | |
397 int (*chmod) ( gftp_request * request, | |
398 const char *filename, | |
399 int mode ); | |
400 int (*set_file_time) ( gftp_request * request, | |
401 const char *filename, | |
402 time_t datettime ); | |
403 int (*site) ( gftp_request * request, | |
404 const char *filename ); | |
405 int (*parse_url) ( gftp_request * request, | |
406 const char *url ); | |
58 | 407 void (*set_config_options) ( gftp_request * request ); |
63 | 408 void (*swap_socks) ( gftp_request * dest, |
409 gftp_request * source ); | |
1 | 410 |
136 | 411 gftp_config_vars * local_options_vars; |
412 int num_local_options_vars; | |
413 GHashTable * local_options_hash; | |
168 | 414 #ifdef USE_SSL |
415 SSL * ssl; | |
416 #endif | |
1 | 417 }; |
418 | |
419 | |
136 | 420 typedef struct gftp_transfer_tag |
1 | 421 { |
422 gftp_request * fromreq, | |
423 * toreq; | |
424 | |
425 unsigned int transfer_direction : 1, | |
426 cancel : 1, | |
427 ready : 1, | |
428 started : 1, | |
429 done : 1, | |
430 show : 1, | |
431 stalled : 1, | |
432 next_file : 1, | |
14
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
1
diff
changeset
|
433 skip_file : 1; |
1 | 434 |
435 struct timeval starttime, | |
436 lasttime; | |
437 | |
438 double kbs; | |
439 | |
440 GList * files, | |
441 * curfle, | |
442 * updfle; | |
443 | |
19 | 444 long numfiles, |
445 numdirs, | |
446 current_file_number, | |
447 current_file_retries; | |
1 | 448 |
449 off_t curtrans, /* Current transfered bytes for this file */ | |
450 curresumed, /* Resumed bytes for this file */ | |
451 trans_bytes, /* Amount of data transfered for entire | |
452 transfer */ | |
453 total_bytes, /* Grand total bytes for whole transfer */ | |
454 resumed_bytes; /* Grand total of resumed bytes for whole | |
455 transfer */ | |
456 | |
457 void * fromwdata, | |
458 * towdata; | |
459 | |
122 | 460 GStaticMutex statmutex, |
461 structmutex; | |
462 | |
125 | 463 void *user_data; |
1 | 464 void *clist; |
136 | 465 } gftp_transfer; |
1 | 466 |
467 | |
468 typedef struct gftp_log_tag | |
469 { | |
470 char *msg; | |
471 gftp_logging_level type; | |
472 } gftp_log; | |
473 | |
474 | |
475 typedef struct supported_gftp_protocols_tag | |
476 { | |
477 char *name; /* Description of protocol */ | |
478 void (*init) (gftp_request * request); /* Init function */ | |
122 | 479 void (*register_options) (void); /* Protocol options */ |
1 | 480 char *url_prefix; /* URL Prefix */ |
122 | 481 int shown; /* Whether this protocol is |
482 shown or not to the user in | |
483 the protocol dropdown box */ | |
1 | 484 } supported_gftp_protocols; |
485 | |
486 | |
122 | 487 typedef struct gftp_bookmarks_tag gftp_bookmarks_var; |
1 | 488 |
489 struct gftp_bookmarks_tag | |
490 { | |
491 char *path; /* Path */ | |
492 char *hostname, /* Our actual internet hostname */ | |
493 *protocol, /* Protocol we will connect through */ | |
494 *remote_dir, /* Initial directory */ | |
495 *local_dir, /* Init local directory */ | |
496 *user, /* Username to log in as */ | |
497 *pass, /* Our password */ | |
498 *acct; /* Account */ | |
499 | |
500 unsigned int port, /* The port we will connect to */ | |
501 isfolder : 1, /* If this is set, then the children field can | |
502 be non-NULL */ | |
503 save_password : 1; /* Save this password */ | |
122 | 504 gftp_bookmarks_var *children, /* The children of this node. */ |
505 *prev, /* The parent of this node */ | |
506 *next; /* The next sibling of this node */ | |
1 | 507 gpointer cnode; |
508 | |
509 /* Site options */ | |
510 char *sftpserv_path; /* Path to the sftp server */ | |
511 }; | |
512 | |
513 | |
514 typedef struct gftp_file_extensions_tag | |
515 { | |
516 char *ext, /* The file extension to register */ | |
517 *filename, /* The xpm file to display */ | |
518 *view_program, /* The program used to view this file */ | |
519 *ascii_binary; /* Is this a ASCII transfer or a BINARY transfer */ | |
520 int stlen; /* How long is the file extension. */ | |
521 } gftp_file_extensions; | |
522 | |
523 | |
524 typedef struct gftp_color_tag | |
525 { | |
526 gushort red, | |
527 green, | |
528 blue; | |
529 } gftp_color; | |
530 | |
531 | |
58 | 532 typedef struct gftp_getline_buffer_tag |
533 { | |
534 char *buffer, | |
535 *curpos; | |
536 size_t max_bufsize, | |
537 cur_bufsize; | |
538 } gftp_getline_buffer; | |
539 | |
126 | 540 |
122 | 541 /* Global config options. These are defined in options.h */ |
542 extern GList * gftp_file_transfers, * gftp_file_transfer_logs, | |
543 * gftp_options_list; | |
544 extern GHashTable * gftp_global_options_htable, * gftp_bookmarks_htable, | |
545 * gftp_config_list_htable; | |
546 extern gftp_config_vars gftp_global_config_vars[]; | |
1 | 547 extern supported_gftp_protocols gftp_protocols[]; |
122 | 548 extern gftp_bookmarks_var * gftp_bookmarks; |
549 extern char gftp_version[]; | |
550 extern FILE * gftp_logfd; | |
551 | |
552 /* This is defined in config_file.c */ | |
553 | |
554 extern gftp_option_type_var gftp_option_types[]; | |
1 | 555 |
556 /* cache.c */ | |
58 | 557 int gftp_new_cache_entry ( gftp_request * request ); |
1 | 558 |
58 | 559 int gftp_find_cache_entry ( gftp_request * request ); |
1 | 560 |
561 void gftp_clear_cache_files ( void ); | |
562 | |
47 | 563 void gftp_delete_cache_entry ( gftp_request * request, |
564 int ignore_directory ); | |
1 | 565 |
566 /* config_file.c */ | |
122 | 567 void gftp_add_bookmark ( gftp_bookmarks_var * newentry ); |
568 | |
124 | 569 void gftp_read_config_file ( char *global_data_path ); |
1 | 570 |
122 | 571 void gftp_write_bookmarks_file ( void ); |
1 | 572 |
573 void gftp_write_config_file ( void ); | |
574 | |
122 | 575 GHashTable * build_bookmarks_hash_table ( gftp_bookmarks_var * entry ); |
576 | |
577 void print_bookmarks ( gftp_bookmarks_var * bookmarks ); | |
578 | |
579 void gftp_lookup_global_option ( char * key, | |
580 void *value ); | |
26 | 581 |
122 | 582 void gftp_lookup_request_option ( gftp_request * request, |
583 char * key, | |
584 void *value ); | |
1 | 585 |
122 | 586 void gftp_set_global_option ( char * key, |
587 void *value ); | |
588 | |
589 void gftp_set_request_option ( gftp_request * request, | |
590 char * key, | |
591 void *value ); | |
592 | |
593 void gftp_register_config_vars ( gftp_config_vars *config_vars ); | |
1 | 594 |
595 /* misc.c */ | |
14
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
1
diff
changeset
|
596 char *insert_commas ( off_t number, |
1 | 597 char *dest_str, |
598 size_t dest_len ); | |
599 | |
600 char *alltrim ( char *str ); | |
601 | |
602 char *expand_path ( const char *src ); | |
603 | |
604 void remove_double_slashes ( char *string ); | |
605 | |
606 void make_nonnull ( char **str ); | |
607 | |
608 int copyfile ( char *source, | |
609 char *dest ); | |
610 | |
611 char *get_xpm_path ( char *filename, | |
612 int quit_on_err ); | |
613 | |
614 int gftp_match_filespec ( char *filename, | |
615 char *filespec ); | |
616 | |
617 int gftp_parse_command_line ( int *argc, | |
618 char ***argv ); | |
619 | |
620 void gftp_usage ( void ); | |
621 | |
622 gint string_hash_compare ( gconstpointer path1, | |
623 gconstpointer path2 ); | |
624 | |
625 guint string_hash_function ( gconstpointer key ); | |
626 | |
627 void free_file_list ( GList * filelist ); | |
628 | |
629 void free_fdata ( gftp_file * fle ); | |
630 | |
631 gftp_file * copy_fdata ( gftp_file * fle ); | |
632 | |
633 int compare_request ( gftp_request * request1, | |
634 gftp_request * request2, | |
635 int compare_dirs ); | |
636 | |
129 | 637 gftp_transfer * gftp_tdata_new ( void ); |
638 | |
1 | 639 void free_tdata ( gftp_transfer * tdata ); |
640 | |
136 | 641 void gftp_copy_local_options ( gftp_request * dest, |
642 gftp_request * source ); | |
643 | |
151 | 644 gftp_request * copy_request ( gftp_request * req, |
645 int copy_local_options ); | |
1 | 646 |
16 | 647 GList * gftp_sort_filelist ( GList * filelist, |
648 int column, | |
649 int asds ); | |
650 | |
125 | 651 mode_t gftp_parse_attribs ( char *attribs ); |
652 | |
131 | 653 char * gftp_gen_ls_string ( gftp_file * fle, |
654 char *file_prefixstr, | |
655 char *file_suffixstr ); | |
656 | |
168 | 657 char * base64_encode ( char *str ); |
658 | |
1 | 659 /* protocols.c */ |
660 #define GFTP_FTP_NUM 0 | |
661 #define GFTP_HTTP_NUM 1 | |
168 | 662 #define GFTP_HTTPS_NUM 2 |
663 #define GFTP_LOCAL_NUM 3 | |
664 #define GFTP_SSHV2_NUM 4 | |
665 #define GFTP_BOOKMARK_NUM 5 | |
122 | 666 |
1 | 667 #define GFTP_IS_CONNECTED(request) ((request) != NULL && \ |
58 | 668 ((request)->sockfd > 0 || \ |
669 (request)->cached || \ | |
670 (request)->always_connected)) | |
1 | 671 |
672 | |
673 void rfc959_init ( gftp_request * request ); | |
674 | |
122 | 675 void rfc959_register_module ( void ); |
676 | |
1 | 677 int rfc959_get_next_file ( gftp_request * request, |
678 gftp_file *fle, | |
58 | 679 int fd ); |
1 | 680 |
681 void rfc2068_init ( gftp_request * request ); | |
682 | |
122 | 683 void rfc2068_register_module ( void ); |
684 | |
168 | 685 void https_init ( gftp_request * request ); |
686 | |
687 void https_register_module ( void ); | |
688 | |
1 | 689 void local_init ( gftp_request * request ); |
690 | |
122 | 691 void local_register_module ( void ); |
692 | |
1 | 693 void sshv2_init ( gftp_request * request ); |
694 | |
122 | 695 void sshv2_register_module ( void ); |
696 | |
1 | 697 void bookmark_init ( gftp_request * request ); |
698 | |
122 | 699 void bookmark_register_module ( void ); |
700 | |
1 | 701 gftp_request *gftp_request_new ( void ); |
702 | |
67 | 703 void gftp_request_destroy ( gftp_request * request, |
704 int free_request ); | |
1 | 705 |
706 void gftp_file_destroy ( gftp_file *file ); | |
707 | |
708 int gftp_connect ( gftp_request * request ); | |
709 | |
710 void gftp_disconnect ( gftp_request * request ); | |
711 | |
58 | 712 off_t gftp_get_file ( gftp_request * request, |
1 | 713 const char *filename, |
58 | 714 int fd, |
1 | 715 size_t startsize ); |
716 | |
717 int gftp_put_file ( gftp_request * request, | |
718 const char *filename, | |
58 | 719 int fd, |
1 | 720 size_t startsize, |
721 size_t totalsize ); | |
722 | |
723 long gftp_transfer_file ( gftp_request *fromreq, | |
724 const char *fromfile, | |
58 | 725 int fromfd, |
1 | 726 size_t fromsize, |
727 gftp_request *toreq, | |
728 const char *tofile, | |
58 | 729 int tofd, |
1 | 730 size_t tosize ); |
731 | |
58 | 732 ssize_t gftp_get_next_file_chunk ( gftp_request * request, |
1 | 733 char *buf, |
734 size_t size ); | |
735 | |
58 | 736 ssize_t gftp_put_next_file_chunk ( gftp_request * request, |
1 | 737 char *buf, |
738 size_t size ); | |
739 | |
740 int gftp_list_files ( gftp_request * request ); | |
741 | |
87 | 742 int gftp_parse_bookmark ( gftp_request * request, |
743 const char * bookmark ); | |
744 | |
1 | 745 int gftp_parse_url ( gftp_request * request, |
746 const char *url ); | |
747 | |
748 int gftp_get_next_file ( gftp_request * request, | |
749 char *filespec, | |
750 gftp_file *fle ); | |
751 | |
752 int gftp_end_transfer ( gftp_request * request ); | |
753 | |
40 | 754 int gftp_abort_transfer ( gftp_request * request ); |
755 | |
1 | 756 void gftp_set_hostname ( gftp_request * request, |
757 const char *hostname ); | |
758 | |
759 void gftp_set_username ( gftp_request * request, | |
760 const char *username ); | |
761 | |
762 void gftp_set_password ( gftp_request * request, | |
763 const char *password ); | |
764 | |
765 void gftp_set_account ( gftp_request * request, | |
766 const char *account ); | |
767 | |
768 int gftp_set_directory ( gftp_request * request, | |
769 const char *directory ); | |
770 | |
771 void gftp_set_port ( gftp_request * request, | |
772 unsigned int port ); | |
773 | |
774 int gftp_remove_directory ( gftp_request * request, | |
775 const char *directory ); | |
776 | |
777 int gftp_remove_file ( gftp_request * request, | |
778 const char *file ); | |
779 | |
780 int gftp_make_directory ( gftp_request * request, | |
781 const char *directory ); | |
782 | |
783 int gftp_rename_file ( gftp_request * request, | |
784 const char *oldname, | |
785 const char *newname ); | |
786 | |
787 int gftp_chmod ( gftp_request * request, | |
788 const char *file, | |
789 int mode ); | |
790 | |
791 int gftp_set_file_time ( gftp_request * request, | |
792 const char *file, | |
793 time_t datetime ); | |
794 | |
795 char gftp_site_cmd ( gftp_request * request, | |
796 const char *command ); | |
797 | |
58 | 798 off_t gftp_get_file_size ( gftp_request * request, |
1 | 799 const char *filename ); |
800 | |
801 void gftp_calc_kbs ( gftp_transfer * tdata, | |
802 ssize_t num_read ); | |
803 | |
102 | 804 time_t parse_time ( char *str, |
805 char **endpos ); | |
806 | |
91 | 807 int gftp_parse_ls ( gftp_request * request, |
808 const char *lsoutput, | |
1 | 809 gftp_file *fle ); |
810 | |
811 int gftp_get_all_subdirs ( gftp_transfer * transfer, | |
812 void (*update_func) | |
813 ( gftp_transfer * transfer )); | |
814 | |
815 int gftp_connect_server ( gftp_request * request, | |
122 | 816 char *service, |
817 char *proxy_hostname, | |
818 int proxy_port ); | |
1 | 819 |
122 | 820 #if !defined (HAVE_GETADDRINFO) || !defined (HAVE_GAI_STRERROR) |
1 | 821 |
822 struct hostent *r_gethostbyname ( const char *name, | |
823 struct hostent *result_buf, | |
824 int *h_errnop ); | |
825 | |
56 | 826 #endif |
827 | |
1 | 828 struct servent *r_getservbyname ( const char *name, |
829 const char *proto, | |
830 struct servent *result_buf, | |
831 int *h_errnop ); | |
122 | 832 |
1 | 833 void gftp_set_config_options ( gftp_request * request ); |
834 | |
835 void print_file_list ( GList * list ); | |
836 | |
168 | 837 |
58 | 838 ssize_t gftp_get_line ( gftp_request * request, |
839 gftp_getline_buffer ** rbuf, | |
41 | 840 char * str, |
841 size_t len, | |
58 | 842 int fd ); |
843 | |
168 | 844 ssize_t gftp_fd_read ( gftp_request * request, |
58 | 845 void *ptr, |
846 size_t size, | |
847 int fd ); | |
41 | 848 |
168 | 849 ssize_t gftp_fd_write ( gftp_request * request, |
58 | 850 const char *ptr, |
41 | 851 size_t size, |
58 | 852 int fd ); |
853 | |
854 ssize_t gftp_writefmt ( gftp_request * request, | |
855 int fd, | |
856 const char *fmt, | |
857 ... ); | |
858 | |
168 | 859 int gftp_fd_set_sockblocking ( gftp_request * request, |
58 | 860 int fd, |
861 int non_blocking ); | |
41 | 862 |
63 | 863 void gftp_swap_socks ( gftp_request * dest, |
864 gftp_request * source ); | |
865 | |
122 | 866 void gftp_calc_kbs ( gftp_transfer * tdata, |
867 ssize_t num_read ); | |
868 | |
125 | 869 int gftp_get_transfer_status ( gftp_transfer * tdata, |
870 ssize_t num_read ); | |
871 | |
146 | 872 /* pty.c */ |
873 int open_ptys ( gftp_request * request, | |
874 int *fdm, | |
875 int *fds ); | |
876 | |
877 int tty_raw ( int fd ); | |
878 | |
168 | 879 #ifdef USE_SSL |
880 /* sslcommon.c */ | |
881 int gftp_ssl_startup ( gftp_request * request ); | |
882 | |
883 int gftp_ssl_session_setup ( gftp_request * request ); | |
884 | |
885 void gftp_ssl_free ( gftp_request * request ); | |
886 | |
887 ssize_t gftp_ssl_read ( gftp_request * request, | |
888 void *ptr, | |
889 size_t size, | |
890 int fd ); | |
891 | |
892 ssize_t gftp_ssl_write ( gftp_request * request, | |
893 const char *ptr, | |
894 size_t size, | |
895 int fd ); | |
896 #endif /* USE_SSL */ | |
897 | |
1 | 898 #endif |
899 |