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

Annotation of /hydra/src/boa.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.14 - (hide annotations)
Fri Sep 27 23:40:29 2002 UTC (21 years, 6 months ago) by nmav
Branch: MAIN
Changes since 1.13: +6 -1 lines
File MIME type: text/plain
Improvements on 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-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 nmav 1.14 /* $Id: boa.h,v 1.13 2002/09/27 21:09:11 nmav Exp $*/
24 nmav 1.1
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 nmav 1.14 #include "hic.h"
53 nmav 1.10
54     #ifdef ENABLE_SMP
55     # include <pthread.h>
56     #endif
57 nmav 1.4
58     #ifdef HAVE_NETINET_TCP_H
59     # include <netinet/tcp.h>
60     #endif
61    
62 nmav 1.1 #include "globals.h"
63    
64     /* alias */
65 nmav 1.7 void add_alias(char* hostname, char *fakename, char *realname, int script);
66 nmav 1.1 int translate_uri(request * req);
67     int init_script_alias(request * req, alias * current, int uri_len);
68 nmav 1.7 void dump_alias( virthost*);
69 nmav 1.5
70     /* virthost */
71     void add_virthost(const char *host, const char *ip, const char* document_root, const char* user_dir);
72     virthost *find_virthost(const char *host, int hostlen);
73 nmav 1.6 void dump_virthost(void);
74 nmav 1.9
75     /* directory_index */
76     char *find_and_open_directory_index(const char *directory, int dirlen, int* fd);
77     void dump_directory_index(void);
78     void add_directory_index( const char* index);
79     char* find_default_directory_index( void);
80 nmav 1.1
81     /* config */
82     void read_config_files(void);
83    
84     /* escape */
85     #include "escape.h"
86    
87     /* get */
88    
89     int init_get(server_params*, request * req);
90     int process_get(server_params*, request * req);
91     int get_dir(request * req, struct stat *statbuf);
92 nmav 1.11 const char* hydra_method_str( int method);
93 nmav 1.1
94     /* hash */
95     unsigned get_mime_hash_value(char *extension);
96     char *get_mime_type(char *filename);
97     char *get_home_dir(char *name);
98     void dump_mime(void);
99     void dump_passwd(void);
100     void show_hash_stats(void);
101    
102     /* log */
103     void open_logs(void);
104     void close_access_log(void);
105     void log_access(request * req);
106     void log_error_doc(request * req);
107     void boa_perror(request * req, char *message);
108     void log_error_time(void);
109     void log_error_mesg(char *file, int line, char *mesg);
110    
111     /* queue */
112     void block_request(server_params*, request * req);
113     void ready_request(server_params*, request * req);
114     void dequeue(request ** head, request * req);
115     void enqueue(request ** head, request * req);
116    
117     /* read */
118     int read_header(server_params*, request * req);
119     int read_body(request * req);
120     int write_body(request * req);
121    
122     /* request */
123     request *new_request(server_params* params);
124 nmav 1.4 void get_request(server_params* params, socket_type*);
125     void process_requests(server_params* params, socket_type* server_s);
126 nmav 1.1 int process_header_end(server_params*, request * req);
127     int process_header_line(request * req);
128     int process_logline(request * req);
129     int process_option_line(request * req);
130     void add_accept_header(request * req, char *mime_type);
131     void free_requests(server_params* params);
132    
133     /* response */
134     void print_ka_phrase(request * req);
135     void print_content_type(request * req);
136     void print_content_length(request * req);
137     void print_last_modified(request * req);
138     void print_http_headers(request * req);
139    
140     void send_r_request_ok(request * req); /* 200 */
141 nmav 1.3 void send_r_request_partial(request * req); /* 206 */
142 nmav 1.1 void send_r_moved_perm(request * req, char *url); /* 301 */
143     void send_r_moved_temp(request * req, char *url, char *more_hdr); /* 302 */
144     void send_r_not_modified(request * req); /* 304 */
145     void send_r_bad_request(request * req); /* 400 */
146     void send_r_unauthorized(request * req, char *name); /* 401 */
147     void send_r_forbidden(request * req); /* 403 */
148     void send_r_not_found(request * req); /* 404 */
149 nmav 1.3 void send_r_range_unsatisfiable(request * req); /* 416 */
150 nmav 1.1 void send_r_error(request * req); /* 500 */
151     void send_r_not_implemented(request * req); /* 501 */
152     void send_r_bad_gateway(request * req); /* 502 */
153     void send_r_service_unavailable(request * req); /* 503 */
154     void send_r_bad_version(request * req); /* 505 */
155    
156     /* cgi */
157     void create_common_env(void);
158     void clear_common_env(void);
159 nmav 1.12 int add_cgi_env(request * req, const char *key, const char *value, int http_prefix);
160 nmav 1.1 int complete_env(request * req);
161     void create_argv(request * req, char **aargv);
162     int init_cgi(request * req);
163    
164     /* signals */
165     void init_signals(void);
166     void block_main_signals(void);
167     void unblock_main_signals(void);
168     void sighup_run(void);
169     void sigchld_run(void);
170     void sigalrm_run(void);
171     void sigusr1_run(void);
172     void sigterm_stage1_run(void);
173     void sigterm_stage2_run(void);
174    
175     /* smp */
176     void smp_reinit();
177    
178     /* util.c */
179     void clean_pathname(char *pathname);
180 nmav 1.2 void get_commonlog_time(char buf[30]);
181 nmav 1.1 void rfc822_time_buf(char *buf, time_t s);
182 nmav 1.3 void simple_itoa(unsigned long int i, char buf[22]);
183     int boa_atoi(const char *s);
184 nmav 1.1 char *escape_string(char *inp, char *buf);
185     int month2int(char *month);
186     int modified_since(time_t * mtime, char *if_modified_since);
187     char *to_upper(char *str);
188     int unescape_uri(char *uri, char **query_string);
189     int create_temporary_file(short want_unlink, char *storage, int size);
190     char * normalize_path(char *path);
191     int real_set_block_fd(int fd);
192     int real_set_nonblock_fd(int fd);
193    
194     /* buffer */
195 nmav 1.2 int req_write(request * req, const char *msg);
196 nmav 1.1 void reset_output_buffer(request *req);
197     int req_write_escape_http(request * req, char *msg);
198     int req_write_escape_html(request * req, char *msg);
199     int req_flush(request * req);
200     char *escape_uri(char *uri);
201    
202     /* timestamp */
203     void timestamp(void);
204    
205     /* mmap_cache */
206     struct mmap_entry *find_mmap( int data_fd, struct stat *s);
207     void release_mmap( struct mmap_entry *e);
208 nmav 1.8 void initialize_mmap( void);
209     void mmap_reinit( void);
210 nmav 1.1
211     /* sublog */
212     int open_gen_fd(char *spec);
213     int process_cgi_header(request * req);
214    
215     /* pipe */
216     int read_from_pipe(request * req);
217     int write_from_pipe(request * req);
218    
219     /* ip */
220     int bind_server(int server_s, char *ip, int port);
221     char *ascii_sockaddr(struct SOCKADDR *s, char *dest, int len);
222     int net_port(struct SOCKADDR *s);
223    
224     /* select */
225     void* select_loop(void*);
226 nmav 1.14
227     /* HIC stuff */
228 nmav 1.13 void* hic_main_loop(void*);
229    
230 nmav 1.14 void add_hic_module(const char *module, const char* sym_prefix, const char* file_suffix);
231     hic_module_st *find_hic_appr_module(const char *filename, int filename_len);
232 nmav 1.13 int hic_send_command( request *req, int out_fd);
233 nmav 1.1
234     #endif

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26