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

Annotation of /hydra/src/boa.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations)
Sat Sep 21 13:53:17 2002 UTC (21 years, 7 months ago) by nmav
Branch: MAIN
Branch point for: boas
File MIME type: text/plain
Initial revision

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     /* $Id: boa.h,v 1.63.2.2 2002/07/26 03:03:44 jnelson 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     #include "globals.h"
53    
54     /* alias */
55     void add_alias(char *fakename, char *realname, int script);
56     int translate_uri(request * req);
57     int init_script_alias(request * req, alias * current, int uri_len);
58     void dump_alias(void);
59    
60     /* config */
61     void read_config_files(void);
62    
63     /* escape */
64     #include "escape.h"
65    
66     /* get */
67    
68     int init_get(server_params*, request * req);
69     int process_get(server_params*, request * req);
70     int get_dir(request * req, struct stat *statbuf);
71    
72     /* hash */
73     unsigned get_mime_hash_value(char *extension);
74     char *get_mime_type(char *filename);
75     char *get_home_dir(char *name);
76     void dump_mime(void);
77     void dump_passwd(void);
78     void show_hash_stats(void);
79    
80     /* log */
81     void open_logs(void);
82     void close_access_log(void);
83     void log_access(request * req);
84     void log_error_doc(request * req);
85     void boa_perror(request * req, char *message);
86     void log_error_time(void);
87     void log_error_mesg(char *file, int line, char *mesg);
88    
89     /* queue */
90     void block_request(server_params*, request * req);
91     void ready_request(server_params*, request * req);
92     void dequeue(request ** head, request * req);
93     void enqueue(request ** head, request * req);
94    
95     /* read */
96     int read_header(server_params*, request * req);
97     int read_body(request * req);
98     int write_body(request * req);
99    
100     /* request */
101     request *new_request(server_params* params);
102     void get_request(server_params* params, socket_type);
103     void process_requests(server_params* params, socket_type server_s);
104     int process_header_end(server_params*, request * req);
105     int process_header_line(request * req);
106     int process_logline(request * req);
107     int process_option_line(request * req);
108     void add_accept_header(request * req, char *mime_type);
109     void free_requests(server_params* params);
110    
111     /* response */
112     void print_ka_phrase(request * req);
113     void print_content_type(request * req);
114     void print_content_length(request * req);
115     void print_last_modified(request * req);
116     void print_http_headers(request * req);
117    
118     void send_r_request_ok(request * req); /* 200 */
119     void send_r_moved_perm(request * req, char *url); /* 301 */
120     void send_r_moved_temp(request * req, char *url, char *more_hdr); /* 302 */
121     void send_r_not_modified(request * req); /* 304 */
122     void send_r_bad_request(request * req); /* 400 */
123     void send_r_unauthorized(request * req, char *name); /* 401 */
124     void send_r_forbidden(request * req); /* 403 */
125     void send_r_not_found(request * req); /* 404 */
126     void send_r_error(request * req); /* 500 */
127     void send_r_not_implemented(request * req); /* 501 */
128     void send_r_bad_gateway(request * req); /* 502 */
129     void send_r_service_unavailable(request * req); /* 503 */
130     void send_r_bad_version(request * req); /* 505 */
131    
132     /* cgi */
133     void create_common_env(void);
134     void clear_common_env(void);
135     int add_cgi_env(request * req, char *key, char *value, int http_prefix);
136     int complete_env(request * req);
137     void create_argv(request * req, char **aargv);
138     int init_cgi(request * req);
139    
140     /* signals */
141     void init_signals(void);
142     void block_main_signals(void);
143     void unblock_main_signals(void);
144     void sighup_run(void);
145     void sigchld_run(void);
146     void sigalrm_run(void);
147     void sigusr1_run(void);
148     void sigterm_stage1_run(void);
149     void sigterm_stage2_run(void);
150    
151     /* smp */
152     void smp_reinit();
153    
154     /* util.c */
155     void clean_pathname(char *pathname);
156     char *get_commonlog_time(void);
157     void rfc822_time_buf(char *buf, time_t s);
158     char *simple_itoa(unsigned int i);
159     int boa_atoi(char *s);
160     char *escape_string(char *inp, char *buf);
161     int month2int(char *month);
162     int modified_since(time_t * mtime, char *if_modified_since);
163     char *to_upper(char *str);
164     int unescape_uri(char *uri, char **query_string);
165     int create_temporary_file(short want_unlink, char *storage, int size);
166     char * normalize_path(char *path);
167     int real_set_block_fd(int fd);
168     int real_set_nonblock_fd(int fd);
169    
170     /* buffer */
171     int req_write(request * req, char *msg);
172     void reset_output_buffer(request *req);
173     int req_write_escape_http(request * req, char *msg);
174     int req_write_escape_html(request * req, char *msg);
175     int req_flush(request * req);
176     char *escape_uri(char *uri);
177    
178     /* timestamp */
179     void timestamp(void);
180    
181     /* mmap_cache */
182     struct mmap_entry *find_mmap( int data_fd, struct stat *s);
183     void release_mmap( struct mmap_entry *e);
184    
185     /* sublog */
186     int open_gen_fd(char *spec);
187     int process_cgi_header(request * req);
188    
189     /* pipe */
190     int read_from_pipe(request * req);
191     int write_from_pipe(request * req);
192    
193     /* ip */
194     int bind_server(int server_s, char *ip, int port);
195     char *ascii_sockaddr(struct SOCKADDR *s, char *dest, int len);
196     int net_port(struct SOCKADDR *s);
197    
198     /* select */
199     void* select_loop(void*);
200    
201     #endif

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26