/[hydra]/hydra/src/globals.h
ViewVC logotype

Contents of /hydra/src/globals.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.34 - (show annotations)
Thu Mar 9 18:11:07 2006 UTC (18 years ago) by nmav
Branch: MAIN
CVS Tags: hydra_0_1_6_without_hic, hydra_0_1_8, HEAD
Changes since 1.33: +2 -31 lines
File MIME type: text/plain
Removed the HIC support.

1 /*
2 * Boa, an http server
3 * Copyright (C) 1995 Paul Phillips <paulp@go2net.com>
4 * Some changes Copyright (C) 1996,97 Larry Doolittle <ldoolitt@jlab.org>
5 * Some changes Copyright (C) 1997 Jon Nelson <jnelson@boa.org>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 1, or (at your option)
10 * any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 *
21 */
22
23 /* $Id: globals.h,v 1.33 2003/01/26 11:25:39 nmav Exp $*/
24
25 #ifndef _GLOBALS_H
26 #define _GLOBALS_H
27
28 #ifdef ENABLE_SSL
29 # include <gnutls/gnutls.h>
30 #endif
31
32 typedef struct {
33 int socket;
34 int secure; /* ssl or not. NOTE: 0 or 1. Nothing else. */
35 int port;
36 int pending_requests;
37 } socket_type;
38
39 struct mmap_entry {
40 dev_t dev;
41 ino_t ino;
42 char *mmap;
43 int use_count;
44 size_t len;
45 int available;
46 int times_used;
47 };
48
49 /* This structure is used for both HIC loaded modules
50 * and CGI Actions.
51 */
52 typedef struct {
53 char* sym_prefix; /* ie. "_php" */
54 char* content_type; /* ie. "application/x-httpd-php" */
55 char* action; /* ie. "/usr/bin/php4" */
56 int content_type_len;
57 } action_module_st;
58
59 struct alias {
60 char *fakename; /* URI path to file */
61 char *realname; /* Actual path to file */
62 int type; /* ALIAS, SCRIPTALIAS, REDIRECT */
63 int fake_len; /* strlen of fakename */
64 int real_len; /* strlen of realname */
65 struct alias *next;
66 };
67
68 typedef struct alias alias;
69
70 typedef struct {
71 /* We use this, in order to store data to pipes if the
72 * given POST data length, is smaller that PIPE_BUF;
73 */
74 int fds[2]; /* 0 is for reading, 1 for writing */
75 int pipe; /* non zero if it's a pipe */
76 } tmp_fd;
77
78 struct access_node
79 {
80 char *pattern;
81 char type;
82 };
83
84 typedef struct _virthost {
85 char *ip; /* This virthost will be visible in this IP */
86 char *host; /* The hostname of the virtual host */
87 char* document_root; /* The document root of this virtual host */
88 char* user_dir; /* The user dir of this virtual host */
89 int user_dir_len; /* strlen of user_dir */
90 int ip_len; /* strlen of IP */
91 int host_len; /* strlen of hostname */
92 int document_root_len; /* strlen of document root */
93 alias *alias_hashtable[ALIAS_HASHTABLE_SIZE]; /* aliases in this virthost */
94
95 int n_access;
96 struct access_node *access_nodes;
97 struct _virthost *next;
98 } virthost;
99
100 struct request { /* pending requests */
101 int fd; /* client's socket fd */
102 #ifdef USE_POLL
103 int pollfd_id;
104 #endif
105 #ifdef ENABLE_SSL
106 gnutls_session ssl_state;
107 char * certificate_verified; /* a string that describes the output of the
108 * certificate verification function. Needed
109 * in CGIs.
110 */
111 #endif
112 int secure; /* whether ssl or not */
113 int alert_to_send; /* in SEND_ALERT state */
114
115 int status; /* see #defines.h */
116 time_t time_last; /* time of last succ. op. */
117 char *pathname; /* pathname of requested file */
118 off_t range_start; /* send file from byte ... */
119 off_t range_stop; /* to byte */
120 off_t pipe_range_stop; /* This is used only if the file is sent by the pipe_read() method.
121 * Indicates how many bytes to send from a file (actually a copy of range_stop,
122 * but it is modified. */
123 int keepalive_given; /* whether the keepalive was sent by the client */
124 int keepalive; /* keepalive status */
125 int kacount; /* keepalive count */
126
127 int data_fd; /* fd of data */
128 off_t filesize; /* filesize */
129 off_t filepos; /* position in file */
130 char *data_mem; /* mmapped/malloced char array */
131 int method; /* M_GET, M_POST, etc. */
132
133 char *logline; /* line to log file */
134
135 char *header_line; /* beginning of un or incompletely processed header line */
136 char *header_end; /* last known end of header, or end of processed data */
137 int parse_pos; /* how much have we parsed */
138 int client_stream_pos; /* how much have we read... */
139
140 int buffer_start; /* where the buffer starts */
141 int buffer_end; /* where the buffer ends */
142
143 int http_version; /* HTTP version numeric HTTP_0_9, HTTP_1_0 etc */
144 char *http_version_str; /* HTTP/?.? of req */
145 int response_status; /* R_NOT_FOUND etc. */
146
147 char *if_modified_since; /* If-Modified-Since */
148 time_t last_modified; /* Last-modified: */
149
150 char *if_none_match_etag;
151 char *if_match_etag;
152 char *if_range_etag; /* These are the Etags sent by the client
153 * In If-* requests.
154 */
155 int if_types; /* If-Match, If-None-Match, If-Range
156 * and OR of the MATCH_* definitions.
157 */
158
159 char local_ip_addr[NI_MAXHOST]; /* for virtualhost */
160 int hostname_given; /* For HTTP/1.1 checks. 0 if the
161 * Host header was not found.
162 */
163 char *hostname; /* The hostname used in this request */
164 char document_root[MAX_PATH_LENGTH + 1];
165 char user_dir[MAX_USER_DIR_LENGTH + 1];
166
167 /* CGI vars */
168
169 int remote_port; /* could be used for ident */
170
171 char remote_ip_addr[NI_MAXHOST]; /* after inet_ntoa */
172
173 char* action; /* the action to run if CGI_ACTION cgi */
174 int is_cgi; /* true if CGI/NPH */
175 int cgi_status;
176 int cgi_env_index; /* index into array */
177
178 /* Agent and referer for logfiles */
179 char *header_user_agent;
180 char *header_referer;
181
182 tmp_fd post_data_fd; /* fd for post data tmpfile */
183
184 char *path_info; /* env variable */
185 char *path_translated; /* env variable */
186 char *script_name; /* env variable */
187 char *query_string; /* env variable */
188 char *content_type; /* env variable */
189 char *content_length; /* env variable */
190
191 struct mmap_entry *mmap_entry_var;
192
193 struct request *next; /* next */
194 struct request *prev; /* previous */
195
196 /* everything below this line is kept regardless */
197 char buffer[BUFFER_SIZE + 1]; /* generic I/O buffer */
198 char request_uri[MAX_HEADER_LENGTH + 1]; /* uri */
199 char client_stream[CLIENT_STREAM_SIZE]; /* data from client - fit or be hosed */
200 char *cgi_env[CGI_ENV_MAX + 4]; /* CGI environment */
201
202 #ifdef ACCEPT_ON
203 char accept[MAX_ACCEPT_LENGTH]; /* Accept: fields */
204 #endif
205 };
206
207 typedef struct request request;
208
209 struct status {
210 long requests;
211 long errors;
212 };
213
214
215 extern char *optarg; /* For getopt */
216 extern FILE *yyin; /* yacc input */
217
218 typedef struct {
219 #ifdef ENABLE_SMP
220 pthread_t tid;
221 #endif
222 request* request_ready;
223 request* request_block;
224 request* request_free;
225
226 socket_type server_s[2];
227
228 #ifdef USE_POLL
229 struct pollfd *pfds;
230 int pfd_len;
231 #else
232 fd_set block_read_fdset; /* fds blocked on read */
233 fd_set block_write_fdset; /* fds blocked on write */
234 #endif
235
236 struct timeval req_timeout;
237 int sighup_flag; /* 1 => signal has happened, needs attention */
238 int sigchld_flag; /* 1 => signal has happened, needs attention */
239 int sigalrm_flag; /* 1 => signal has happened, needs attention */
240 int sigusr1_flag; /* 1 => signal has happened, needs attention */
241 int sigterm_flag; /* lame duck mode */
242
243 int max_fd;
244
245 int sockbufsize;
246 struct status status;
247 int total_connections;
248
249 /* for SIGBUS handling */
250 jmp_buf env;
251 int handle_sigbus;
252
253 } server_params;
254
255 /* global server variables */
256
257 extern int maintenance_interval;
258 extern int mmap_list_entries_used;
259 extern char *access_log_name;
260 extern char *error_log_name;
261 extern char *cgi_log_name;
262 extern int cgi_log_fd;
263 extern int use_localtime;
264
265 extern int max_files_cache;
266 extern int max_file_size_cache;
267
268 extern int boa_ssl;
269
270 extern int server_port;
271 extern int ssl_port;
272 extern uid_t server_uid;
273 extern gid_t server_gid;
274 extern char *server_admin;
275 extern char *server_root;
276 extern char *server_name;
277 extern char *server_ip;
278 extern int max_fd;
279
280 extern char *default_type;
281 extern char *default_charset;
282 extern char *dirmaker;
283 extern char *mime_types;
284 extern char *pid_file;
285 extern char *cachedir;
286
287 extern char *default_document_root;
288 extern int default_document_root_size;
289
290 extern int system_bufsize; /* Default size of SNDBUF given by system */
291
292 extern char *tempdir;
293 extern int tempdir_len;
294
295 extern char *cgi_path;
296 extern int single_post_limit;
297
298 extern int ka_timeout;
299 extern int ka_max;
300
301 extern time_t start_time;
302
303 extern int max_server_threads;
304
305 extern int cgi_umask;
306
307 extern long int max_connections;
308 extern long int max_ssl_connections;
309
310 long int get_total_global_connections(int ssl);
311
312 extern int verbose_cgi_logs;
313
314 extern int backlog;
315 extern time_t current_time;
316
317 /* Global stuff that is shared by all threads.
318 * Use with extreme care, or don't use.
319 */
320 extern server_params *global_server_params;
321 extern int global_server_params_size;
322
323 /* The default character set used.
324 */
325 extern char *default_charset;
326
327 /* These contain a string of the form: "Server: Hydra/0.0.x\r\n"
328 */
329 extern char boa_tls_version[];
330 extern char boa_version[];
331
332 #endif

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26