1 /* tinyproxy - A fast light-weight HTTP proxy
2  * Copyright (C) 2004 Robert James Kaes <rjkaes@users.sourceforge.net>
3  * Copyright (C) 2009 Michael Adam <obnox@samba.org>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 /* See 'conf.c' for detailed information. */
21 
22 #ifndef TINYPROXY_CONF_H
23 #define TINYPROXY_CONF_H
24 
25 #include "hsearch.h"
26 #include "sblist.h"
27 #include "acl.h"
28 
29 /*
30  * Stores a HTTP header created using the AddHeader directive.
31  */
32 typedef struct {
33         char *name;
34         char *value;
35 } http_header_t;
36 
37 /*
38  * Hold all the configuration time information.
39  */
40 struct config_s {
41         sblist *basicauth_list;
42         char *logf_name;
43         unsigned int syslog;    /* boolean */
44         unsigned int port;
45         char *stathost;
46         unsigned int quit;      /* boolean */
47         unsigned int maxclients;
48         char *user;
49         char *group;
50         sblist *listen_addrs;
51 #ifdef FILTER_ENABLE
52         char *filter;
53         unsigned int filter_url;        /* boolean */
54         unsigned int filter_extended;   /* boolean */
55         unsigned int filter_casesensitive;      /* boolean */
56 #endif                          /* FILTER_ENABLE */
57 #ifdef XTINYPROXY_ENABLE
58         unsigned int add_xtinyproxy; /* boolean */
59 #endif
60 #ifdef REVERSE_SUPPORT
61         struct reversepath *reversepath_list;
62         unsigned int reverseonly;       /* boolean */
63         unsigned int reversemagic;      /* boolean */
64         char *reversebaseurl;
65 #endif
66 #ifdef UPSTREAM_SUPPORT
67         struct upstream *upstream_list;
68 #endif                          /* UPSTREAM_SUPPORT */
69         char *pidpath;
70         unsigned int idletimeout;
71         sblist *bind_addrs;
72         unsigned int bindsame;
73 
74         /*
75          * The configured name to use in the HTTP "Via" header field.
76          */
77         char *via_proxy_name;
78 
79         unsigned int disable_viaheader; /* boolean */
80 
81         /*
82          * Error page support.  Map error numbers to file paths.
83          */
84         struct htab *errorpages;
85 
86         /*
87          * Error page to be displayed if appropriate page cannot be located
88          * in the errorpages structure.
89          */
90         char *errorpage_undef;
91 
92         /*
93          * The HTML statistics page.
94          */
95         char *statpage;
96 
97         acl_list_t access_list;
98 
99         /*
100          * Store the list of port allowed by CONNECT.
101          */
102         sblist *connect_ports;
103 
104         /*
105          * Map of headers which should be let through when the
106          * anonymous feature is turned on.
107          */
108         struct htab *anonymous_map;
109 
110         /*
111          * Extra headers to be added to outgoing HTTP requests.
112          */
113         sblist* add_headers;
114 };
115 
116 extern int reload_config_file (const char *config_fname, struct config_s *conf);
117 
118 int config_init (void);
119 void free_config (struct config_s *conf);
120 
121 #endif
122