From 7290691142027e3a2020cab742478a3c87c0012f Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 7 Dec 2009 22:23:31 +0100 Subject: Move definition of "struct config_s" from main.h to conf.h Michael --- src/acl.h | 2 ++ src/anonymous.c | 1 + src/child.c | 1 + src/conf.c | 2 -- src/conf.h | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/filter.c | 1 + src/hashmap.h | 2 ++ src/html-error.c | 1 + src/log.c | 1 + src/main.h | 76 ------------------------------------------------------- src/reqs.c | 1 + src/sock.c | 1 + src/stats.c | 1 + 13 files changed, 89 insertions(+), 78 deletions(-) (limited to 'src') diff --git a/src/acl.h b/src/acl.h index b1a5dee..2d11cef 100644 --- a/src/acl.h +++ b/src/acl.h @@ -21,6 +21,8 @@ #ifndef TINYPROXY_ACL_H #define TINYPROXY_ACL_H +#include "vector.h" + typedef enum { ACL_ALLOW, ACL_DENY } acl_access_t; extern int insert_acl (char *location, acl_access_t access_type, diff --git a/src/anonymous.c b/src/anonymous.c index 2834852..3049acf 100644 --- a/src/anonymous.c +++ b/src/anonymous.c @@ -26,6 +26,7 @@ #include "hashmap.h" #include "heap.h" #include "log.h" +#include "conf.h" short int is_anonymous_enabled (void) { diff --git a/src/child.c b/src/child.c index 6bd7456..d640bed 100644 --- a/src/child.c +++ b/src/child.c @@ -30,6 +30,7 @@ #include "reqs.h" #include "sock.h" #include "utils.h" +#include "conf.h" static int listenfd; static socklen_t addrlen; diff --git a/src/conf.c b/src/conf.c index 128b09c..3abadb1 100644 --- a/src/conf.c +++ b/src/conf.c @@ -22,8 +22,6 @@ * add new directives to. Who knows if I'm right though. */ -#include "main.h" - #include "conf.h" #include "acl.h" diff --git a/src/conf.h b/src/conf.h index 39f3a51..c4f7ee9 100644 --- a/src/conf.h +++ b/src/conf.h @@ -21,6 +21,83 @@ #ifndef TINYPROXY_CONF_H #define TINYPROXY_CONF_H +#include "hashmap.h" +#include "vector.h" + +/* + * Hold all the configuration time information. + */ +struct config_s { + char *logf_name; + char *config_file; + unsigned int syslog; /* boolean */ + int port; + char *stathost; + unsigned int godaemon; /* boolean */ + unsigned int quit; /* boolean */ + char *user; + char *group; + char *ipAddr; +#ifdef FILTER_ENABLE + char *filter; + unsigned int filter_url; /* boolean */ + unsigned int filter_extended; /* boolean */ + unsigned int filter_casesensitive; /* boolean */ +#endif /* FILTER_ENABLE */ +#ifdef XTINYPROXY_ENABLE + unsigned int add_xtinyproxy; /* boolean */ +#endif +#ifdef REVERSE_SUPPORT + struct reversepath *reversepath_list; + unsigned int reverseonly; /* boolean */ + unsigned int reversemagic; /* boolean */ + char *reversebaseurl; +#endif +#ifdef UPSTREAM_SUPPORT + struct upstream *upstream_list; +#endif /* UPSTREAM_SUPPORT */ + char *pidpath; + unsigned int idletimeout; + char *bind_address; + unsigned int bindsame; + + /* + * The configured name to use in the HTTP "Via" header field. + */ + char *via_proxy_name; + + unsigned int disable_viaheader; /* boolean */ + + /* + * Error page support. Map error numbers to file paths. + */ + hashmap_t errorpages; + + /* + * Error page to be displayed if appropriate page cannot be located + * in the errorpages structure. + */ + char *errorpage_undef; + + /* + * The HTML statistics page. + */ + char *statpage; + + vector_t access_list; + + /* + * Store the list of port allowed by CONNECT. + */ + vector_t connect_ports; + + /* + * Map of headers which should be let through when the + * anonymous feature is turned on. + */ + hashmap_t anonymous_map; +}; + extern int load_config_file (const char *config_fname, struct config_s *conf); void free_config (struct config_s *conf); int reload_config (const char *config_fname, struct config_s *conf, diff --git a/src/filter.c b/src/filter.c index e0e5f9e..3164191 100644 --- a/src/filter.c +++ b/src/filter.c @@ -28,6 +28,7 @@ #include "heap.h" #include "log.h" #include "reqs.h" +#include "conf.h" #define FILTER_BUFFER_LEN (512) diff --git a/src/hashmap.h b/src/hashmap.h index 5095f77..e8fa819 100644 --- a/src/hashmap.h +++ b/src/hashmap.h @@ -21,6 +21,8 @@ #ifndef _HASHMAP_H #define _HASHMAP_H +#include "common.h" + /* * We're using a typedef here to "hide" the implementation details of the * hash map. Sure, it's a pointer, but the struct is hidden in the C file. diff --git a/src/html-error.c b/src/html-error.c index e4ddf88..adb9775 100644 --- a/src/html-error.c +++ b/src/html-error.c @@ -29,6 +29,7 @@ #include "html-error.h" #include "network.h" #include "utils.h" +#include "conf.h" /* * Add an error number -> filename mapping to the errorpages list. diff --git a/src/log.c b/src/log.c index 4398488..5d669b4 100644 --- a/src/log.c +++ b/src/log.c @@ -27,6 +27,7 @@ #include "log.h" #include "utils.h" #include "vector.h" +#include "conf.h" static const char *syslog_level[] = { NULL, diff --git a/src/main.h b/src/main.h index c07482c..f3864e4 100644 --- a/src/main.h +++ b/src/main.h @@ -23,87 +23,11 @@ #define __MAIN_H__ #include "common.h" -#include "hashmap.h" -#include "vector.h" /* Global variables for the main controls of the program */ #define MAXBUFFSIZE ((size_t)(1024 * 96)) /* Max size of buffer */ #define MAX_IDLE_TIME (60 * 10) /* 10 minutes of no activity */ -/* - * Hold all the configuration time information. - */ -struct config_s { - char *logf_name; - char *config_file; - unsigned int syslog; /* boolean */ - int port; - char *stathost; - unsigned int godaemon; /* boolean */ - unsigned int quit; /* boolean */ - char *user; - char *group; - char *ipAddr; -#ifdef FILTER_ENABLE - char *filter; - unsigned int filter_url; /* boolean */ - unsigned int filter_extended; /* boolean */ - unsigned int filter_casesensitive; /* boolean */ -#endif /* FILTER_ENABLE */ -#ifdef XTINYPROXY_ENABLE - unsigned int add_xtinyproxy; /* boolean */ -#endif -#ifdef REVERSE_SUPPORT - struct reversepath *reversepath_list; - unsigned int reverseonly; /* boolean */ - unsigned int reversemagic; /* boolean */ - char *reversebaseurl; -#endif -#ifdef UPSTREAM_SUPPORT - struct upstream *upstream_list; -#endif /* UPSTREAM_SUPPORT */ - char *pidpath; - unsigned int idletimeout; - char *bind_address; - unsigned int bindsame; - - /* - * The configured name to use in the HTTP "Via" header field. - */ - char *via_proxy_name; - - unsigned int disable_viaheader; /* boolean */ - - /* - * Error page support. Map error numbers to file paths. - */ - hashmap_t errorpages; - - /* - * Error page to be displayed if appropriate page cannot be located - * in the errorpages structure. - */ - char *errorpage_undef; - - /* - * The HTML statistics page. - */ - char *statpage; - - vector_t access_list; - - /* - * Store the list of port allowed by CONNECT. - */ - vector_t connect_ports; - - /* - * Map of headers which should be let through when the - * anonymous feature is turned on. - */ - hashmap_t anonymous_map; -}; - /* Global Structures used in the program */ extern struct config_s config; extern unsigned int received_sighup; /* boolean */ diff --git a/src/reqs.c b/src/reqs.c index 83873df..2f6b67e 100644 --- a/src/reqs.c +++ b/src/reqs.c @@ -47,6 +47,7 @@ #include "transparent-proxy.h" #include "upstream.h" #include "connect-ports.h" +#include "conf.h" /* * Maximum length of a HTTP line diff --git a/src/sock.c b/src/sock.c index d9acd5b..be50376 100644 --- a/src/sock.c +++ b/src/sock.c @@ -32,6 +32,7 @@ #include "network.h" #include "sock.h" #include "text.h" +#include "conf.h" /* * Bind the given socket to the supplied address. The socket is diff --git a/src/stats.c b/src/stats.c index 0b60071..c7b4423 100644 --- a/src/stats.c +++ b/src/stats.c @@ -32,6 +32,7 @@ #include "html-error.h" #include "stats.h" #include "utils.h" +#include "conf.h" struct stat_s { unsigned long int num_reqs; -- cgit v1.2.3