annotate lib/options.h @ 91:8c37d73d3f1f

2003-1-21 Brian Masney <masneyb@gftp.org> * lib/gftp.h - added server type defines. Added server_type field to gftp_request * lib/local.c - use S_ISDIR and S_ISLINK macros * lib/protocols.c - (gftp_parse_ls*) - use hints from server_type for parsing directory listing * lib/rfc959.c - added function rfc959_syst. Call this on startup * lib/protocols.c lib/rfc959.c lib/sshv2.c - pass request structure to gftp_parse_ls * lib/sshv2.c - set server_type to be GFTP_TYPE_UNIX
author masneyb
date Tue, 21 Jan 2003 23:46:03 +0000
parents 7ef60ce2bdb2
children 5f9ad9facf0e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
1 /*****************************************************************************/
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
2 /* options.h - the global variables for the program */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
3 /* Copyright (C) 1998-2002 Brian Masney <masneyb@gftp.org> */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
4 /* */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
5 /* This program is free software; you can redistribute it and/or modify */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
6 /* it under the terms of the GNU General Public License as published by */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
7 /* the Free Software Foundation; either version 2 of the License, or */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
8 /* (at your option) any later version. */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
9 /* */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
10 /* This program is distributed in the hope that it will be useful, */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
11 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
12 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
13 /* GNU General Public License for more details. */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
14 /* */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
15 /* You should have received a copy of the GNU General Public License */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
16 /* along with this program; if not, write to the Free Software */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
17 /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
18 /*****************************************************************************/
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
19
33
c8ec7877432e 2002-10-06 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
20 /* $Id$ */
c8ec7877432e 2002-10-06 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
21
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
22 #include "gftp.h"
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
23
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
24 supported_gftp_protocols gftp_protocols[] =
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
25 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
26 {"FTP", rfc959_init, "ftp", 1},
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
27 {"HTTP", rfc2068_init, "http", 1},
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
28 {"Local", local_init, "file", 1},
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
29 {"SSH2", sshv2_init, "ssh2", 1},
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
30 {"Bookmark", bookmark_init, "bookmark", 0},
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
31 {NULL, NULL, NULL, 0}
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
32 };
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
33
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
34 gftp_proxy_type proxy_type[] = {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
35 {N_("none"), ""},
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
36 {N_("SITE command"), "USER %pu\nPASS %pp\nSITE %hh\nUSER %hu\nPASS %hp\n"},
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
37 {N_("user@host"), "USER %pu\nPASS %pp\nUSER %hu@%hh\nPASS %hp\n"},
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
38 {N_("user@host:port"), "USER %hu@%hh:%ho\nPASS %hp\n"},
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
39 {N_("AUTHENTICATE"), "USER %hu@%hh\nPASS %hp\nSITE AUTHENTICATE %pu\nSITE RESPONSE %pp\n"},
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
40 {N_("user@host port"), "USER %hu@%hh %ho\nPASS %hp\n"},
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
41 {N_("user@host NOAUTH"), "USER %hu@%hh\nPASS %hp\n"},
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
42 {N_("HTTP Proxy"), "http"},
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
43 {N_("Custom"), ""},
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
44 {NULL, NULL}
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
45 };
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
46
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
47 /* Most of these should be self explanatory */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
48 char version[] = "gFTP " VERSION,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
49 *emailaddr = NULL, /* Email address for logging in
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
50 anonymously */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
51 *default_protocol = NULL,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
52 *edit_program = NULL,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
53 *view_program = NULL,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
54 *firewall_host = NULL,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
55 *firewall_username = NULL,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
56 *firewall_password = NULL,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
57 *firewall_account = NULL,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
58 *proxy_config = NULL, /* The way to log into the proxy */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
59 *http_proxy_host = NULL,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
60 *http_proxy_username = NULL,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
61 *http_proxy_password = NULL,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
62 *startup_directory = NULL,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
63 *ssh_prog_name = NULL,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
64 *ssh_extra_params = NULL,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
65 **ssh_extra_params_list = NULL,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
66 *ssh1_sftp_path = NULL,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
67 *ssh2_sftp_path = NULL;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
68 int num_ssh_extra_params;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
69
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
70 FILE * logfd = NULL; /* Our fd to write logs to */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
71
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
72 double maxkbs = 0.00; /* Bandwidth throttling */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
73 GList * proxy_hosts = NULL, /* Our local hosts that won't need to
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
74 use the proxy */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
75 * registered_exts = NULL, /* Registered file extensions */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
76 * viewedit_processes = NULL, /* View/Edit processes that are
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
77 running */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
78 * file_transfers = NULL, /* File transfers in progress */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
79 * file_transfer_logs = NULL; /* Logs generated by other threads */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
80
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
81 gftp_bookmarks * bookmarks = NULL;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
82 GHashTable * bookmarks_htable = NULL,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
83 * config_htable = NULL;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
84
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
85 int do_one_transfer_at_a_time = 1, /* Only allow one transfer at a time.
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
86 The other transfers will be queued */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
87 start_file_transfers = 1, /* Shall we start the file transfers? */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
88 transfer_in_progress = 0, /* Any transfers transferring files? */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
89 passive_transfer = 1, /* Are we sending PASV or PORT to the
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
90 server */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
91 sort_dirs_first = 1, /* Put the dirs first when sorting */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
92 show_hidden_files = 1, /* Show hidden files */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
93 refresh_files = 0, /* Refresh the listbox after each file
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
94 is done */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
95 listbox_local_width = 302, /* Width of the local listbox */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
96 listbox_remote_width = 302, /* Width of the remote listbox */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
97 listbox_file_height = 265, /* Height of the local/remote listbox */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
98 transfer_height = 80, /* Height of the transfer window */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
99 log_height = 105, /* Height of the logging window */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
100 retries = 3, /* Number of auto-retries */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
101 sleep_time = 30, /* Number of seconds to wait between
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
102 retries */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
103 network_timeout = 120, /* Timeout on the read()s and write()s */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
104 use_http11 = 1, /* Use HTTP/1.1 or HTTP/1.0 */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
105 listbox_dblclick_action = 0, /* What happens when you double click in the
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
106 file listboxes. 0 = View, 1 = Edit,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
107 2 = Download */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
108 file_trans_column = 100, /* The width of the File column in the
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
109 listbox */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
110 local_columns[6] = {0, 85, 75, 76, 120, 75}, /* The width of the local
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
111 file, size, user, group, date and attribs column */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
112 remote_columns[6] = {0, 85, 75, 76, 120, 75}, /* The width of the remote
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
113 file, size, user, group, date and attribs column */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
114 resolve_symlinks = 1, /* Send LIST -L or LIST to the remote ftp
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
115 server */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
116 firewall_port = 21, /* What port to connect to for ftp? */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
117 http_proxy_port = 80, /* What port to connect to for http? */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
118 overwrite_by_default = 0, /* Resume file transfers or set to
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
119 overwrite by default */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
120 append_file_transfers = 1, /* Append new file transfers onto
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
121 existing ones for the same
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
122 hostname */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
123 ssh_need_userpass = 0, /* Require a user/pass for SSH
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
124 connections */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
125 ssh_use_askpass = 0, /* Use the ssh-askpass tool to
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
126 grab the password. I personally
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
127 don't like this, but some people
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
128 do */
37
5a178bd04ca5 2002-10-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 33
diff changeset
129 sshv2_use_sftp_subsys = 0, /* Call ssh -s sftp. If you set this
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
130 it'll automatically use the askpass
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
131 utility above */
37
5a178bd04ca5 2002-10-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 33
diff changeset
132 local_sortcol = 1,
5a178bd04ca5 2002-10-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 33
diff changeset
133 local_sortasds = 1,
5a178bd04ca5 2002-10-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 33
diff changeset
134 remote_sortcol = 1,
5a178bd04ca5 2002-10-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 33
diff changeset
135 remote_sortasds = 1;
5a178bd04ca5 2002-10-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 33
diff changeset
136
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
137
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
138 guint max_log_window_size = 5000; /* Max size of the log window for the
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
139 GTK port */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
140
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
141 GList * host_history = NULL,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
142 * port_history = NULL,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
143 * user_history = NULL,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
144 * localhistory = NULL,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
145 * remotehistory = NULL;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
146
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
147 unsigned int host_len = 0,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
148 port_len = 0,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
149 user_len = 0,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
150 localhistlen = 0,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
151 remotehistlen = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
152
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
153 volatile sig_atomic_t viewedit_process_done = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
154
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
155 gftp_color send_color, recv_color, error_color, misc_color;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
156