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

Annotation of /hydra/src/defines.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.31 - (hide annotations)
Wed Jan 22 07:51:50 2003 UTC (21 years, 3 months ago) by nmav
Branch: MAIN
CVS Tags: hydra_0_1_6_without_hic, hydra_0_1_7, hydra_0_1_6, hydra_0_1_4, hydra_0_1_8, HEAD
Changes since 1.30: +7 -2 lines
File MIME type: text/plain
merged changes from 0.1.x branch.

1 nmav 1.1 /*
2     * Boa, an http server
3     * Copyright (C) 1995 Paul Phillips <paulp@go2net.com>
4     * Some changes Copyright (C) 1997 Jon Nelson <jnelson@boa.org>
5     *
6     * This program is free software; you can redistribute it and/or modify
7     * it under the terms of the GNU General Public License as published by
8     * the Free Software Foundation; either version 1, or (at your option)
9     * any later version.
10     *
11     * This program is distributed in the hope that it will be useful,
12     * but WITHOUT ANY WARRANTY; without even the implied warranty of
13     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14     * GNU General Public License for more details.
15     *
16     * You should have received a copy of the GNU General Public License
17     * along with this program; if not, write to the Free Software
18     * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19     *
20     */
21    
22 nmav 1.31 /* $Id: defines.h,v 1.30.2.4 2003/01/17 17:19:15 nmav Exp $*/
23 nmav 1.1
24     #ifndef _DEFINES_H
25     #define _DEFINES_H
26    
27     /***** Change this, or use -c on the command line to specify it *****/
28    
29     #ifndef SERVER_ROOT
30 nmav 1.23 #define SERVER_ROOT "/etc/hydra"
31 nmav 1.1 #endif
32    
33 nmav 1.10 /***** Change this via the CGIPath configuration value in hydra.conf *****/
34 nmav 1.1 #define DEFAULT_PATH "/bin:/usr/bin:/usr/local/bin"
35    
36 nmav 1.10 /***** Change this via the SinglePostLimit configuration value in hydra.conf *****/
37 nmav 1.1 #define SINGLE_POST_LIMIT_DEFAULT 1024 * 1024 /* 1 MB */
38    
39     /***** BOA error codes for socket operations */
40     #define BOA_E_AGAIN -1
41     #define BOA_E_PIPE -2
42     #define BOA_E_INTR -3
43     #define BOA_E_UNKNOWN -255
44    
45     /***** Various stuff that you may want to tweak, but probably shouldn't *****/
46    
47 nmav 1.28 #define SOCKETBUF_SIZE 32*1024
48 nmav 1.1 #define MAX_HEADER_LENGTH 1024
49 nmav 1.28 #define CLIENT_STREAM_SIZE 8192
50     #define BUFFER_SIZE 4096
51 nmav 1.1
52 nmav 1.17 #define MODULE_HASHTABLE_SIZE 8
53 nmav 1.1 #define MIME_HASHTABLE_SIZE 47
54     #define ALIAS_HASHTABLE_SIZE 17
55     #define PASSWD_HASHTABLE_SIZE 47
56 nmav 1.18 #define VIRTHOST_HASHTABLE_SIZE 20 /* You'd better increase this
57     * if you host several sites.
58     */
59 nmav 1.12 #define DIRECTORY_INDEX_TABLE_SIZE 30
60 nmav 1.1
61 nmav 1.31 #define REQUEST_TIMEOUT 70
62 nmav 1.1
63     #define CGI_MIME_TYPE "application/x-httpd-cgi"
64    
65     /***** CHANGE ANYTHING BELOW THIS LINE AT YOUR OWN PERIL *****/
66     /***** You will probably introduce buffer overruns unless you know
67     what you are doing *****/
68    
69     #define MAX_SITENAME_LENGTH 256
70     #define MAX_LOG_LENGTH MAX_HEADER_LENGTH + 1024
71     #define MAX_FILE_LENGTH NAME_MAX
72     #define MAX_PATH_LENGTH PATH_MAX
73 nmav 1.22 #define MAX_ETAG_LENGTH 13+1 /* does include the
74 nmav 1.20 * quotes, and includes the
75     * terminating null character.
76     */
77 nmav 1.1
78 nmav 1.9 #define MAX_USER_DIR_LENGTH 60
79    
80 nmav 1.1 #ifdef ACCEPT_ON
81     #define MAX_ACCEPT_LENGTH MAX_HEADER_LENGTH
82     #else
83     #define MAX_ACCEPT_LENGTH 0
84     #endif
85    
86     #define CGI_VERSION "CGI/1.1"
87 nmav 1.28
88     #ifdef USE_NCSA_CGI_ENV
89     # define COMMON_CGI_COUNT 5
90     #else
91     # define COMMON_CGI_COUNT 4
92     #endif
93    
94 nmav 1.1 #define CGI_ENV_MAX 50
95     #define CGI_ARGC_MAX 128
96    
97     /******************* RESPONSE CLASSES *****************/
98    
99     #define R_INFORMATIONAL 1
100     #define R_SUCCESS 2
101     #define R_REDIRECTION 3
102     #define R_CLIENT_ERROR 4
103     #define R_SERVER_ERROR 5
104    
105     /******************* RESPONSE CODES ******************/
106    
107     #define R_REQUEST_OK 200
108     #define R_CREATED 201
109     #define R_ACCEPTED 202
110     #define R_PROVISIONAL 203 /* provisional information */
111     #define R_NO_CONTENT 204
112 nmav 1.4 #define R_REQUEST_PARTIAL 206
113 nmav 1.1
114     #define R_MULTIPLE 300 /* multiple choices */
115     #define R_MOVED_PERM 301
116     #define R_MOVED_TEMP 302
117     #define R_NOT_MODIFIED 304
118    
119     #define R_BAD_REQUEST 400
120     #define R_UNAUTHORIZED 401
121     #define R_PAYMENT 402 /* payment required */
122     #define R_FORBIDDEN 403
123     #define R_NOT_FOUND 404
124     #define R_METHOD_NA 405 /* method not allowed */
125     #define R_NONE_ACC 406 /* none acceptable */
126     #define R_PROXY 407 /* proxy authentication required */
127     #define R_REQUEST_TO 408 /* request timeout */
128     #define R_CONFLICT 409
129     #define R_GONE 410
130 nmav 1.19 #define R_PRECONDITION_FAILED 412
131     #define R_RANGE_UNSATISFIABLE 416
132 nmav 1.1
133     #define R_ERROR 500 /* internal server error */
134     #define R_NOT_IMP 501 /* not implemented */
135     #define R_BAD_GATEWAY 502
136     #define R_SERVICE_UNAV 503 /* service unavailable */
137     #define R_GATEWAY_TO 504 /* gateway timeout */
138     #define R_BAD_VERSION 505
139    
140     /****************** METHODS *****************/
141    
142     #define M_GET 1
143     #define M_HEAD 2
144     #define M_PUT 3
145     #define M_POST 4
146     #define M_DELETE 5
147     #define M_LINK 6
148     #define M_UNLINK 7
149    
150     /************** REQUEST STATUS (req->status) ***************/
151    
152     #define READ_HEADER 0
153     #define ONE_CR 1
154     #define ONE_LF 2
155     #define TWO_CR 3
156     #define BODY_READ 4
157     #define BODY_WRITE 5
158     #define WRITE 6
159     #define PIPE_READ 7
160     #define PIPE_WRITE 8
161 nmav 1.28 #define IOSHUFFLE 9
162     #define DONE 10
163     #define DEAD 11
164     #define FINISH_HANDSHAKE 12
165     #define SEND_ALERT 13
166    
167 nmav 1.1
168     /************** CGI TYPE (req->is_cgi) ******************/
169    
170     #define CGI 1
171     #define NPH 2
172 nmav 1.12 #define INDEXER_CGI 3
173 nmav 1.14 #define HIC_CGI 4
174 nmav 1.31 #define CGI_ACTION 5
175 nmav 1.1
176     /************* ALIAS TYPES (aliasp->type) ***************/
177    
178     #define ALIAS 0
179     #define SCRIPTALIAS 1
180     #define REDIRECT 2
181    
182     /*********** KEEPALIVE CONSTANTS (req->keepalive) *******/
183    
184     #define KA_INACTIVE 0
185     #define KA_STOPPED 1
186     #define KA_ACTIVE 2
187 nmav 1.8
188     /********* SSL stuff */
189 nmav 1.30 #define MIN_MAINTENANCE_INTERVAL 1800 /* half an hour */
190 nmav 1.1
191     /********* CGI STATUS CONSTANTS (req->cgi_status) *******/
192     #define CGI_PARSE 1
193     #define CGI_BUFFER 2
194     #define CGI_DONE 3
195    
196     /*********** MMAP_LIST CONSTANTS ************************/
197 nmav 1.2 #define USE_MMAP_LIST /* undefine it in constraint environments
198     * to save memory, from mmaped files.
199     */
200    
201 nmav 1.11 #define MMAP_LIST_NEXT(i) (((i)+1)%max_files_cache)
202 nmav 1.27 #define MMAP_LIST_HASH(dev,ino,size) (((unsigned long int)ino)%max_files_cache)
203 nmav 1.26
204     /***************** Defines for break_comma_list() *************/
205     #define MAX_COMMA_SEP_ELEMENTS 6
206 nmav 1.13
207     /***************** HTTP HEADER STUFF ***************************/
208    
209     #define TEXT_HTML "text/html; charset=ISO-8859-1"
210     #define CRLF "\r\n"
211 nmav 1.22 #define HTTP_VERSION "HTTP/1.1"
212 nmav 1.31
213     #define HTTP_0_9 0
214     #define HTTP_1_0 1
215     #define HTTP_1_1 2
216 nmav 1.13
217 nmav 1.19 /***************** HTTP/1.1 If-Match stuff ********************/
218    
219     #define IF_NO_IF 0 /* unused - just to indicate that 0 is no If header */
220     #define IF_MATCH 1
221     #define IF_NONE_MATCH 2
222 nmav 1.21 #define IF_RANGE 4
223     #define IF_MODIFIED_SINCE 8
224 nmav 1.1
225     /***************** USEFUL MACROS ************************/
226 nmav 1.24
227     #ifndef INT_MAX
228     # define INT_MAX 2147483647L
229     #endif
230 nmav 1.25
231     #define HEX(x) (((x)>9)?(('a'-10)+(x)):('0'+(x)))
232 nmav 1.1
233 nmav 1.28 #ifdef USE_POLL
234     # define BOA_READ POLLIN|POLLPRI
235     # define BOA_WRITE POLLOUT
236 nmav 1.29 # define BOA_FD_SET(req, thefd,where) { struct pollfd *my_pfd; \
237     my_pfd = &params->pfds[params->pfd_len]; \
238     req->pollfd_id = params->pfd_len++; \
239     my_pfd->fd = thefd; \
240     my_pfd->events = where; \
241     }
242     # define BOA_FD_ZERO( ign) /* nothing */
243 nmav 1.28 # define BOA_FD_CLR(req, fd, where) /* this doesn't do anything? */
244     #else /* SELECT */
245     # define BOA_READ &params->block_read_fdset
246     # define BOA_WRITE &params->block_write_fdset
247     # define BOA_FD_SET(req, fd, where) { FD_SET(fd, where); if (fd > params->max_fd) params->max_fd = fd; }
248     # define BOA_FD_CLR(req, fd, where) { FD_CLR(fd, where); }
249 nmav 1.29 # define BOA_FD_ZERO( fdset) FD_ZERO( fdset)
250 nmav 1.28 #endif
251 nmav 1.1
252 nmav 1.28 /******** MACROS TO CHANGE BLOCK/NON-BLOCK **************/
253 nmav 1.1
254     #define DIE(mesg) log_error_mesg(__FILE__, __LINE__, mesg), exit(1)
255     #define WARN(mesg) log_error_mesg(__FILE__, __LINE__, mesg)
256    
257     #endif
258 nmav 1.28
259     /***************** USEFUL MACROS ************************/
260    
261     #define SQUASH_KA(req) (req->keepalive=KA_STOPPED)
262    

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26