Change the FSF address and update LICENSE with the new address and some texts
[MonkeyD.git] / src / include / config.h
blob1d73334d58cf9002c3e900f95cecea7b2eaa4275
2 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
4 /* Monkey HTTP Daemon
5 * ------------------
6 * Copyright (C) 2001-2003, Eduardo Silva P.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Library General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 #include "memory.h"
25 #ifndef MK_CONFIG_H
26 #define MK_CONFIG_H
28 #include <unistd.h>
29 #include <sys/types.h>
31 #define O_NOATIME 01000000
33 #define M_DEFAULT_CONFIG_FILE "monkey.conf"
34 #define MK_WORKERS_DEFAULT 1
36 #define VALUE_ON "on"
37 #define VALUE_OFF "off"
39 #define MK_CONFIG_VAL_STR 0
40 #define MK_CONFIG_VAL_NUM 1
41 #define MK_CONFIG_VAL_BOOL 2
42 #define MK_CONFIG_VAL_LIST 3
44 struct mk_config
46 char *key;
47 char *val;
48 struct mk_config *next;
52 /* Base struct of server */
53 struct server_config
55 mk_pointer port;
57 char *serverconf; /* path to configuration files */
59 mk_pointer server_addr;
60 mk_pointer server_software;
62 char *user;
63 char *user_dir;
64 char *pid_file_path; /* pid of server */
65 char *file_config;
66 char **request_headers_allowed;
68 int workers; /* number of worker threads */
69 int worker_capacity; /* how many clients per thread... */
71 int symlink; /* symbolic links */
72 int serverport; /* port */
73 int timeout; /* max time to wait for a new connection */
74 int maxclients; /* max clients (max threads) */
75 int hideversion; /* hide version of server to clients ? */
76 int standard_port; /* common port used in web servers (80) */
77 int pid_status;
78 int resume; /* Resume (on/off) */
80 /* keep alive */
81 int keep_alive; /* it's a persisten connection ? */
82 int max_keep_alive_request; /* max persistent connections to allow */
83 int keep_alive_timeout; /* persistent connection timeout */
85 /* counter of threads working */
86 int thread_counter;
87 /* real user */
88 uid_t egid;
89 gid_t euid;
91 /* max ip */
92 int max_ip;
94 struct dir_html_theme *dir_theme;
96 /* configured host quantity */
97 int nhosts;
98 struct host *hosts;
100 mode_t open_flags;
101 struct plugin_stages *plugins;
104 struct server_config *config;
106 struct host
108 char *file; /* configuration file */
109 char *servername; /* host name */
110 mk_pointer documentroot;
112 char *access_log_path; /* access log file */
113 char *error_log_path; /* error log file */
114 int getdir; /* allow show directory info ? */
116 char *cgi_alias;
117 char *cgi_path;
118 char **scriptalias;
119 char *host_signature;
120 mk_pointer header_host_signature;
122 int log_access[2];
123 int log_error[2];
125 struct host *next;
128 /* Functions */
129 void mk_config_start_configure(void);
130 void mk_config_read_files(char *path_conf, char *file_conf);
131 void mk_config_add_index(char *indexname);
132 void mk_config_print_error_msg(char *variable, char *path);
133 void mk_config_set_init_values(void);
135 /* config helpers */
136 struct mk_config *mk_config_create(char *path);
137 void mk_config_free(struct mk_config *cnf);
138 void *mk_config_getval(struct mk_config *cnf, char *key, int mode);
141 int mk_config_get_bool(char *value);
142 void mk_config_read_hosts(char *path);
143 void mk_config_sanity_check();
145 struct host *mk_config_get_host(char *path);
146 struct host *mk_config_host_find(mk_pointer host);
148 #endif