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

Annotation of /hydra/src/globals.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.34 - (hide 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 nmav 1.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 nmav 1.34 /* $Id: globals.h,v 1.33 2003/01/26 11:25:39 nmav Exp $*/
24 nmav 1.1
25     #ifndef _GLOBALS_H
26     #define _GLOBALS_H
27    
28 nmav 1.15 #ifdef ENABLE_SSL
29     # include <gnutls/gnutls.h>
30     #endif
31 nmav 1.1
32     typedef struct {
33     int socket;
34 nmav 1.3 int secure; /* ssl or not. NOTE: 0 or 1. Nothing else. */
35 nmav 1.5 int port;
36 nmav 1.1 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 nmav 1.2 int times_used;
47 nmav 1.1 };
48 nmav 1.12
49 nmav 1.32 /* This structure is used for both HIC loaded modules
50     * and CGI Actions.
51     */
52 nmav 1.12 typedef struct {
53     char* sym_prefix; /* ie. "_php" */
54 nmav 1.13 char* content_type; /* ie. "application/x-httpd-php" */
55 nmav 1.32 char* action; /* ie. "/usr/bin/php4" */
56 nmav 1.13 int content_type_len;
57 nmav 1.34 } action_module_st;
58 nmav 1.1
59 nmav 1.8 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 nmav 1.28 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 nmav 1.31 struct access_node
79     {
80     char *pattern;
81     char type;
82     };
83    
84 nmav 1.6 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 nmav 1.8 alias *alias_hashtable[ALIAS_HASHTABLE_SIZE]; /* aliases in this virthost */
94 nmav 1.31
95     int n_access;
96     struct access_node *access_nodes;
97 nmav 1.6 struct _virthost *next;
98     } virthost;
99    
100 nmav 1.1 struct request { /* pending requests */
101     int fd; /* client's socket fd */
102 nmav 1.26 #ifdef USE_POLL
103     int pollfd_id;
104     #endif
105 nmav 1.15 #ifdef ENABLE_SSL
106 nmav 1.23 gnutls_session ssl_state;
107 nmav 1.24 char * certificate_verified; /* a string that describes the output of the
108     * certificate verification function. Needed
109     * in CGIs.
110     */
111 nmav 1.15 #endif
112 nmav 1.1 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 nmav 1.33 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 nmav 1.4 * Indicates how many bytes to send from a file (actually a copy of range_stop,
122     * but it is modified. */
123 nmav 1.32 int keepalive_given; /* whether the keepalive was sent by the client */
124 nmav 1.1 int keepalive; /* keepalive status */
125     int kacount; /* keepalive count */
126    
127     int data_fd; /* fd of data */
128 nmav 1.33 off_t filesize; /* filesize */
129     off_t filepos; /* position in file */
130 nmav 1.1 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 nmav 1.32 int http_version; /* HTTP version numeric HTTP_0_9, HTTP_1_0 etc */
144     char *http_version_str; /* HTTP/?.? of req */
145 nmav 1.1 int response_status; /* R_NOT_FOUND etc. */
146    
147     char *if_modified_since; /* If-Modified-Since */
148     time_t last_modified; /* Last-modified: */
149 nmav 1.17
150 nmav 1.18 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 nmav 1.17 */
155 nmav 1.18 int if_types; /* If-Match, If-None-Match, If-Range
156     * and OR of the MATCH_* definitions.
157 nmav 1.17 */
158 nmav 1.1
159     char local_ip_addr[NI_MAXHOST]; /* for virtualhost */
160 nmav 1.32 int hostname_given; /* For HTTP/1.1 checks. 0 if the
161     * Host header was not found.
162     */
163 nmav 1.29 char *hostname; /* The hostname used in this request */
164 nmav 1.7 char document_root[MAX_PATH_LENGTH + 1];
165 nmav 1.8 char user_dir[MAX_USER_DIR_LENGTH + 1];
166 nmav 1.1
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 nmav 1.32 char* action; /* the action to run if CGI_ACTION cgi */
174 nmav 1.1 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 nmav 1.28 tmp_fd post_data_fd; /* fd for post data tmpfile */
183 nmav 1.1
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 nmav 1.26
226 nmav 1.1 socket_type server_s[2];
227 nmav 1.26
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 nmav 1.1 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 nmav 1.19
249 nmav 1.1 /* for SIGBUS handling */
250     jmp_buf env;
251     int handle_sigbus;
252    
253     } server_params;
254    
255     /* global server variables */
256    
257 nmav 1.30 extern int maintenance_interval;
258 nmav 1.27 extern int mmap_list_entries_used;
259 nmav 1.1 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 nmav 1.9
265     extern int max_files_cache;
266     extern int max_file_size_cache;
267 nmav 1.5
268     extern int boa_ssl;
269 nmav 1.1
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 nmav 1.11 extern char *default_charset;
282 nmav 1.1 extern char *dirmaker;
283     extern char *mime_types;
284 nmav 1.26 extern char *pid_file;
285 nmav 1.1 extern char *cachedir;
286    
287 nmav 1.6 extern char *default_document_root;
288 nmav 1.7 extern int default_document_root_size;
289 nmav 1.6
290 nmav 1.26 extern int system_bufsize; /* Default size of SNDBUF given by system */
291    
292 nmav 1.1 extern char *tempdir;
293 nmav 1.16 extern int tempdir_len;
294 nmav 1.1
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 nmav 1.19 extern int max_server_threads;
304    
305 nmav 1.26 extern int cgi_umask;
306    
307 nmav 1.1 extern long int max_connections;
308 nmav 1.32 extern long int max_ssl_connections;
309    
310     long int get_total_global_connections(int ssl);
311 nmav 1.1
312     extern int verbose_cgi_logs;
313    
314     extern int backlog;
315     extern time_t current_time;
316    
317 nmav 1.19 /* 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 nmav 1.32 /* The default character set used.
324     */
325     extern char *default_charset;
326 nmav 1.19
327 nmav 1.20 /* These contain a string of the form: "Server: Hydra/0.0.x\r\n"
328 nmav 1.19 */
329     extern char boa_tls_version[];
330     extern char boa_version[];
331 nmav 1.1
332     #endif

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26