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

Contents of /hydra/src/boa.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.10 - (show annotations)
Fri Sep 27 07:03:45 2002 UTC (21 years, 6 months ago) by nmav
Branch: MAIN
Changes since 1.9: +5 -1 lines
File MIME type: text/plain
Added locks in the SSL session cache.

1 /*
2 * Boa, an http server
3 * Copyright (C) 1995 Paul Phillips <paulp@go2net.com>
4 * Some changes Copyright (C) 1996-99 Larry Doolittle <ldoolitt@jlab.org>
5 * Some changes Copyright (C) 1997-99 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: boa.h,v 1.9 2002/09/25 19:55:53 nmav Exp $*/
24
25 #ifndef _BOA_H
26 #define _BOA_H
27
28 #include <errno.h>
29 #include <stdlib.h> /* malloc, free, etc. */
30 #include <stdio.h> /* stdin, stdout, stderr */
31 #include <string.h> /* strdup */
32 #include <ctype.h>
33 #include <time.h> /* localtime, time */
34 #include <pwd.h>
35 #include <grp.h>
36 #include <unistd.h>
37 #include <fcntl.h>
38 #include <limits.h> /* OPEN_MAX */
39 #include <setjmp.h>
40
41 #include <netdb.h>
42 #include <netinet/in.h>
43
44 #include <sys/mman.h>
45 #include <sys/select.h>
46 #include <sys/types.h> /* socket, bind, accept */
47 #include <sys/socket.h> /* socket, bind, accept, setsockopt, */
48 #include <sys/stat.h> /* open */
49
50 #include "compat.h" /* oh what fun is porting */
51 #include "defines.h"
52
53 #ifdef ENABLE_SMP
54 # include <pthread.h>
55 #endif
56
57 #ifdef HAVE_NETINET_TCP_H
58 # include <netinet/tcp.h>
59 #endif
60
61 #include "globals.h"
62
63 /* alias */
64 void add_alias(char* hostname, char *fakename, char *realname, int script);
65 int translate_uri(request * req);
66 int init_script_alias(request * req, alias * current, int uri_len);
67 void dump_alias( virthost*);
68
69 /* virthost */
70 void add_virthost(const char *host, const char *ip, const char* document_root, const char* user_dir);
71 virthost *find_virthost(const char *host, int hostlen);
72 void dump_virthost(void);
73
74 /* directory_index */
75 char *find_and_open_directory_index(const char *directory, int dirlen, int* fd);
76 void dump_directory_index(void);
77 void add_directory_index( const char* index);
78 char* find_default_directory_index( void);
79
80 /* config */
81 void read_config_files(void);
82
83 /* escape */
84 #include "escape.h"
85
86 /* get */
87
88 int init_get(server_params*, request * req);
89 int process_get(server_params*, request * req);
90 int get_dir(request * req, struct stat *statbuf);
91
92 /* hash */
93 unsigned get_mime_hash_value(char *extension);
94 char *get_mime_type(char *filename);
95 char *get_home_dir(char *name);
96 void dump_mime(void);
97 void dump_passwd(void);
98 void show_hash_stats(void);
99
100 /* log */
101 void open_logs(void);
102 void close_access_log(void);
103 void log_access(request * req);
104 void log_error_doc(request * req);
105 void boa_perror(request * req, char *message);
106 void log_error_time(void);
107 void log_error_mesg(char *file, int line, char *mesg);
108
109 /* queue */
110 void block_request(server_params*, request * req);
111 void ready_request(server_params*, request * req);
112 void dequeue(request ** head, request * req);
113 void enqueue(request ** head, request * req);
114
115 /* read */
116 int read_header(server_params*, request * req);
117 int read_body(request * req);
118 int write_body(request * req);
119
120 /* request */
121 request *new_request(server_params* params);
122 void get_request(server_params* params, socket_type*);
123 void process_requests(server_params* params, socket_type* server_s);
124 int process_header_end(server_params*, request * req);
125 int process_header_line(request * req);
126 int process_logline(request * req);
127 int process_option_line(request * req);
128 void add_accept_header(request * req, char *mime_type);
129 void free_requests(server_params* params);
130
131 /* response */
132 void print_ka_phrase(request * req);
133 void print_content_type(request * req);
134 void print_content_length(request * req);
135 void print_last_modified(request * req);
136 void print_http_headers(request * req);
137
138 void send_r_request_ok(request * req); /* 200 */
139 void send_r_request_partial(request * req); /* 206 */
140 void send_r_moved_perm(request * req, char *url); /* 301 */
141 void send_r_moved_temp(request * req, char *url, char *more_hdr); /* 302 */
142 void send_r_not_modified(request * req); /* 304 */
143 void send_r_bad_request(request * req); /* 400 */
144 void send_r_unauthorized(request * req, char *name); /* 401 */
145 void send_r_forbidden(request * req); /* 403 */
146 void send_r_not_found(request * req); /* 404 */
147 void send_r_range_unsatisfiable(request * req); /* 416 */
148 void send_r_error(request * req); /* 500 */
149 void send_r_not_implemented(request * req); /* 501 */
150 void send_r_bad_gateway(request * req); /* 502 */
151 void send_r_service_unavailable(request * req); /* 503 */
152 void send_r_bad_version(request * req); /* 505 */
153
154 /* cgi */
155 void create_common_env(void);
156 void clear_common_env(void);
157 int add_cgi_env(request * req, char *key, char *value, int http_prefix);
158 int complete_env(request * req);
159 void create_argv(request * req, char **aargv);
160 int init_cgi(request * req);
161
162 /* signals */
163 void init_signals(void);
164 void block_main_signals(void);
165 void unblock_main_signals(void);
166 void sighup_run(void);
167 void sigchld_run(void);
168 void sigalrm_run(void);
169 void sigusr1_run(void);
170 void sigterm_stage1_run(void);
171 void sigterm_stage2_run(void);
172
173 /* smp */
174 void smp_reinit();
175
176 /* util.c */
177 void clean_pathname(char *pathname);
178 void get_commonlog_time(char buf[30]);
179 void rfc822_time_buf(char *buf, time_t s);
180 void simple_itoa(unsigned long int i, char buf[22]);
181 int boa_atoi(const char *s);
182 char *escape_string(char *inp, char *buf);
183 int month2int(char *month);
184 int modified_since(time_t * mtime, char *if_modified_since);
185 char *to_upper(char *str);
186 int unescape_uri(char *uri, char **query_string);
187 int create_temporary_file(short want_unlink, char *storage, int size);
188 char * normalize_path(char *path);
189 int real_set_block_fd(int fd);
190 int real_set_nonblock_fd(int fd);
191
192 /* buffer */
193 int req_write(request * req, const char *msg);
194 void reset_output_buffer(request *req);
195 int req_write_escape_http(request * req, char *msg);
196 int req_write_escape_html(request * req, char *msg);
197 int req_flush(request * req);
198 char *escape_uri(char *uri);
199
200 /* timestamp */
201 void timestamp(void);
202
203 /* mmap_cache */
204 struct mmap_entry *find_mmap( int data_fd, struct stat *s);
205 void release_mmap( struct mmap_entry *e);
206 void initialize_mmap( void);
207 void mmap_reinit( void);
208
209 /* sublog */
210 int open_gen_fd(char *spec);
211 int process_cgi_header(request * req);
212
213 /* pipe */
214 int read_from_pipe(request * req);
215 int write_from_pipe(request * req);
216
217 /* ip */
218 int bind_server(int server_s, char *ip, int port);
219 char *ascii_sockaddr(struct SOCKADDR *s, char *dest, int len);
220 int net_port(struct SOCKADDR *s);
221
222 /* select */
223 void* select_loop(void*);
224
225 #endif

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26