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

Annotation of /hydra/src/defines.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (hide annotations)
Tue Sep 24 17:12:47 2002 UTC (21 years, 6 months ago) by nmav
Branch: MAIN
Changes since 1.6: +2 -1 lines
File MIME type: text/plain
Added some support for host based virtual hosting.

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.7 /* $Id: defines.h,v 1.6 2002/09/23 19:28:41 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     #define SERVER_ROOT "/etc/boa"
31     #endif
32    
33     /***** Change this via the CGIPath configuration value in boa.conf *****/
34     #define DEFAULT_PATH "/bin:/usr/bin:/usr/local/bin"
35    
36     /***** Change this via the SinglePostLimit configuration value in boa.conf *****/
37     #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.5 #define SOCKETBUF_SIZE 16*1024
48 nmav 1.1 #define MAX_HEADER_LENGTH 1024
49     #define CLIENT_STREAM_SIZE SOCKETBUF_SIZE
50     #define BUFFER_SIZE CLIENT_STREAM_SIZE
51    
52     #define MIME_HASHTABLE_SIZE 47
53     #define ALIAS_HASHTABLE_SIZE 17
54     #define PASSWD_HASHTABLE_SIZE 47
55 nmav 1.7 #define VIRTHOST_HASHTABLE_SIZE 20
56 nmav 1.1
57     #define REQUEST_TIMEOUT 60
58    
59     #define CGI_MIME_TYPE "application/x-httpd-cgi"
60    
61     /***** CHANGE ANYTHING BELOW THIS LINE AT YOUR OWN PERIL *****/
62     /***** You will probably introduce buffer overruns unless you know
63     what you are doing *****/
64    
65     #define MAX_SITENAME_LENGTH 256
66     #define MAX_LOG_LENGTH MAX_HEADER_LENGTH + 1024
67     #define MAX_FILE_LENGTH NAME_MAX
68     #define MAX_PATH_LENGTH PATH_MAX
69    
70     #ifdef ACCEPT_ON
71     #define MAX_ACCEPT_LENGTH MAX_HEADER_LENGTH
72     #else
73     #define MAX_ACCEPT_LENGTH 0
74     #endif
75    
76 nmav 1.5 #define SERVER_VERSION BOA_VERSION
77 nmav 1.1
78     #define CGI_VERSION "CGI/1.1"
79     #define COMMON_CGI_COUNT 5
80     #define CGI_ENV_MAX 50
81     #define CGI_ARGC_MAX 128
82    
83     /******************* RESPONSE CLASSES *****************/
84    
85     #define R_INFORMATIONAL 1
86     #define R_SUCCESS 2
87     #define R_REDIRECTION 3
88     #define R_CLIENT_ERROR 4
89     #define R_SERVER_ERROR 5
90    
91     /******************* RESPONSE CODES ******************/
92    
93     #define R_REQUEST_OK 200
94     #define R_CREATED 201
95     #define R_ACCEPTED 202
96     #define R_PROVISIONAL 203 /* provisional information */
97     #define R_NO_CONTENT 204
98 nmav 1.4 #define R_REQUEST_PARTIAL 206
99 nmav 1.1
100     #define R_MULTIPLE 300 /* multiple choices */
101     #define R_MOVED_PERM 301
102     #define R_MOVED_TEMP 302
103     #define R_NOT_MODIFIED 304
104    
105     #define R_BAD_REQUEST 400
106     #define R_UNAUTHORIZED 401
107     #define R_PAYMENT 402 /* payment required */
108     #define R_FORBIDDEN 403
109     #define R_NOT_FOUND 404
110     #define R_METHOD_NA 405 /* method not allowed */
111     #define R_NONE_ACC 406 /* none acceptable */
112     #define R_PROXY 407 /* proxy authentication required */
113     #define R_REQUEST_TO 408 /* request timeout */
114     #define R_CONFLICT 409
115     #define R_GONE 410
116 nmav 1.4 #define R_RANGE_UNSATISFIABLE 410
117 nmav 1.1
118     #define R_ERROR 500 /* internal server error */
119     #define R_NOT_IMP 501 /* not implemented */
120     #define R_BAD_GATEWAY 502
121     #define R_SERVICE_UNAV 503 /* service unavailable */
122     #define R_GATEWAY_TO 504 /* gateway timeout */
123     #define R_BAD_VERSION 505
124    
125     /****************** METHODS *****************/
126    
127     #define M_GET 1
128     #define M_HEAD 2
129     #define M_PUT 3
130     #define M_POST 4
131     #define M_DELETE 5
132     #define M_LINK 6
133     #define M_UNLINK 7
134    
135     /************** REQUEST STATUS (req->status) ***************/
136    
137     #define READ_HEADER 0
138     #define ONE_CR 1
139     #define ONE_LF 2
140     #define TWO_CR 3
141     #define BODY_READ 4
142     #define BODY_WRITE 5
143     #define WRITE 6
144     #define PIPE_READ 7
145     #define PIPE_WRITE 8
146     #define DONE 9
147     #define DEAD 10
148     #define FINISH_HANDSHAKE 11
149     #define SEND_ALERT 12
150    
151     /************** CGI TYPE (req->is_cgi) ******************/
152    
153     #define CGI 1
154     #define NPH 2
155 nmav 1.6 #define GUNZIP_CGI 3
156     #define INDEXER_CGI 4
157 nmav 1.1
158     /************* ALIAS TYPES (aliasp->type) ***************/
159    
160     #define ALIAS 0
161     #define SCRIPTALIAS 1
162     #define REDIRECT 2
163    
164     /*********** KEEPALIVE CONSTANTS (req->keepalive) *******/
165    
166     #define KA_INACTIVE 0
167     #define KA_STOPPED 1
168     #define KA_ACTIVE 2
169    
170     /********* CGI STATUS CONSTANTS (req->cgi_status) *******/
171     #define CGI_PARSE 1
172     #define CGI_BUFFER 2
173     #define CGI_DONE 3
174    
175     /*********** MMAP_LIST CONSTANTS ************************/
176 nmav 1.2 #define USE_MMAP_LIST /* undefine it in constraint environments
177     * to save memory, from mmaped files.
178     */
179    
180 nmav 1.1 #define MMAP_LIST_SIZE 256
181     #define MMAP_LIST_MASK 255
182     #define MMAP_LIST_NEXT(i) (((i)+1)&MMAP_LIST_MASK)
183     #define MMAP_LIST_HASH(dev,ino,size) ((ino)&MMAP_LIST_MASK)
184    
185     #define MAX_FILE_MMAP 100 * 1024 /* 100K */
186    
187     /***************** USEFUL MACROS ************************/
188    
189     #define SQUASH_KA(req) (req->keepalive=KA_STOPPED)
190    
191     #define BOA_FD_SET(fd, where) { FD_SET(fd, where); \
192     if (fd > params->max_fd) params->max_fd = fd; \
193     }
194    
195     /* If and when everyone has a modern gcc or other near-C99 compiler,
196     * change these to static inline functions. Also note that since
197     * we never fuss with O_APPEND append or O_ASYNC, we shouldn't have
198     * to perform an extra system call to F_GETFL first.
199     */
200    
201     #ifdef BOA_USE_GETFL
202     #define set_block_fd(fd) real_set_block_fd(fd)
203     #define set_nonblock_fd(fd) real_set_nonblock_fd(fd)
204     #else
205     #define set_block_fd(fd) fcntl(fd, F_SETFL, 0)
206     #define set_nonblock_fd(fd) fcntl(fd, F_SETFL, NOBLOCK)
207     #endif
208    
209     #define DIE(mesg) log_error_mesg(__FILE__, __LINE__, mesg), exit(1)
210     #define WARN(mesg) log_error_mesg(__FILE__, __LINE__, mesg)
211    
212     #endif

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26