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

Contents of /hydra/src/globals.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (show annotations)
Tue Sep 24 21:47:26 2002 UTC (21 years, 6 months ago) by nmav
Branch: MAIN
Changes since 1.6: +4 -3 lines
File MIME type: text/plain
cleaned up the new virtual hosting code.

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.6 2002/09/24 17:12:47 nmav Exp $*/
24
25 #ifndef _GLOBALS_H
26 #define _GLOBALS_H
27
28 #include <gnutls/gnutls.h>
29
30 typedef struct {
31 int socket;
32 int secure; /* ssl or not. NOTE: 0 or 1. Nothing else. */
33 int port;
34 int pending_requests;
35 } socket_type;
36
37 struct mmap_entry {
38 dev_t dev;
39 ino_t ino;
40 char *mmap;
41 int use_count;
42 size_t len;
43 int available;
44 int times_used;
45 };
46
47 typedef struct _virthost {
48 char *ip; /* This virthost will be visible in this IP */
49 char *host; /* The hostname of the virtual host */
50 char* document_root; /* The document root of this virtual host */
51 char* user_dir; /* The user dir of this virtual host */
52 int user_dir_len; /* strlen of user_dir */
53 int ip_len; /* strlen of IP */
54 int host_len; /* strlen of hostname */
55 int document_root_len; /* strlen of document root */
56 struct _virthost *next;
57 } virthost;
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 struct request { /* pending requests */
71 int fd; /* client's socket fd */
72 GNUTLS_STATE ssl_state;
73 int secure; /* whether ssl or not */
74 int alert_to_send; /* in SEND_ALERT state */
75
76 int status; /* see #defines.h */
77 time_t time_last; /* time of last succ. op. */
78 char *pathname; /* pathname of requested file */
79 size_t range_start; /* send file from byte ... */
80 size_t range_stop; /* to byte */
81 size_t pipe_range_stop; /* This is used only if the file is sent by the pipe_read() method.
82 * Indicates how many bytes to send from a file (actually a copy of range_stop,
83 * but it is modified. */
84 int simple; /* simple request? */
85 int keepalive; /* keepalive status */
86 int kacount; /* keepalive count */
87
88 int data_fd; /* fd of data */
89 unsigned long filesize; /* filesize */
90 unsigned long filepos; /* position in file */
91 char *data_mem; /* mmapped/malloced char array */
92 int method; /* M_GET, M_POST, etc. */
93
94 char *logline; /* line to log file */
95
96 char *header_line; /* beginning of un or incompletely processed header line */
97 char *header_end; /* last known end of header, or end of processed data */
98 int parse_pos; /* how much have we parsed */
99 int client_stream_pos; /* how much have we read... */
100
101 int buffer_start; /* where the buffer starts */
102 int buffer_end; /* where the buffer ends */
103
104 char *http_version; /* HTTP/?.? of req */
105 int response_status; /* R_NOT_FOUND etc. */
106
107 char *if_modified_since; /* If-Modified-Since */
108 time_t last_modified; /* Last-modified: */
109
110 char local_ip_addr[NI_MAXHOST]; /* for virtualhost */
111 char document_root[MAX_PATH_LENGTH + 1];
112 char user_dir[MAX_PATH_LENGTH + 1];
113
114 /* CGI vars */
115
116 int remote_port; /* could be used for ident */
117
118 char remote_ip_addr[NI_MAXHOST]; /* after inet_ntoa */
119
120 int is_cgi; /* true if CGI/NPH */
121 int cgi_status;
122 int cgi_env_index; /* index into array */
123
124 /* Agent and referer for logfiles */
125 char *header_user_agent;
126 char *header_referer;
127
128 int post_data_fd; /* fd for post data tmpfile */
129
130 char *path_info; /* env variable */
131 char *path_translated; /* env variable */
132 char *script_name; /* env variable */
133 char *query_string; /* env variable */
134 char *content_type; /* env variable */
135 char *content_length; /* env variable */
136
137 struct mmap_entry *mmap_entry_var;
138
139 struct request *next; /* next */
140 struct request *prev; /* previous */
141
142 /* everything below this line is kept regardless */
143 char buffer[BUFFER_SIZE + 1]; /* generic I/O buffer */
144 char request_uri[MAX_HEADER_LENGTH + 1]; /* uri */
145 char client_stream[CLIENT_STREAM_SIZE]; /* data from client - fit or be hosed */
146 char *cgi_env[CGI_ENV_MAX + 4]; /* CGI environment */
147
148 #ifdef ACCEPT_ON
149 char accept[MAX_ACCEPT_LENGTH]; /* Accept: fields */
150 #endif
151 };
152
153 typedef struct request request;
154
155 struct status {
156 long requests;
157 long errors;
158 };
159
160
161 extern char *optarg; /* For getopt */
162 extern FILE *yyin; /* yacc input */
163
164 extern request **_request_ready; /* first in ready list */
165 extern request **_request_block; /* first in blocked list */
166 extern request **_request_free; /* first in free list */
167
168 typedef struct {
169 #ifdef ENABLE_SMP
170 pthread_t tid;
171 #endif
172 request* request_ready;
173 request* request_block;
174 request* request_free;
175 socket_type server_s[2];
176 fd_set block_read_fdset;
177 fd_set block_write_fdset;
178 struct timeval req_timeout;
179 int sighup_flag; /* 1 => signal has happened, needs attention */
180 int sigchld_flag; /* 1 => signal has happened, needs attention */
181 int sigalrm_flag; /* 1 => signal has happened, needs attention */
182 int sigusr1_flag; /* 1 => signal has happened, needs attention */
183 int sigterm_flag; /* lame duck mode */
184
185 int max_fd;
186
187 int sockbufsize;
188 struct status status;
189 int total_connections;
190
191 /* for SIGBUS handling */
192 jmp_buf env;
193 int handle_sigbus;
194
195 } server_params;
196
197 /* global server variables */
198
199 extern char *access_log_name;
200 extern char *error_log_name;
201 extern char *cgi_log_name;
202 extern int cgi_log_fd;
203 extern int use_localtime;
204
205 extern int boa_ssl;
206
207 extern int server_port;
208 extern int ssl_port;
209 extern uid_t server_uid;
210 extern gid_t server_gid;
211 extern char *server_admin;
212 extern char *server_root;
213 extern char *server_name;
214 extern char *server_ip;
215 extern int max_fd;
216 extern int devnullfd;
217
218 extern char *directory_index;
219 extern char *default_type;
220 extern char *dirmaker;
221 extern char *mime_types;
222 extern char *cachedir;
223
224 extern char *default_document_root;
225 extern int default_document_root_size;
226
227 extern char *tempdir;
228
229 extern char *cgi_path;
230 extern int single_post_limit;
231
232 extern int ka_timeout;
233 extern int ka_max;
234
235 extern int sighup_flag;
236 extern int sigchld_flag;
237 extern int sigalrm_flag;
238 extern int sigusr1_flag;
239 extern int sigterm_flag;
240 extern time_t start_time;
241
242 extern int pending_requests;
243 extern long int max_connections;
244
245 extern int verbose_cgi_logs;
246
247 extern int backlog;
248 extern time_t current_time;
249
250
251 #endif

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26