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