Move definition of "struct config_s" from main.h to conf.h
Michael
This commit is contained in:
parent
34e4be193e
commit
7290691142
@ -21,6 +21,8 @@
|
|||||||
#ifndef TINYPROXY_ACL_H
|
#ifndef TINYPROXY_ACL_H
|
||||||
#define TINYPROXY_ACL_H
|
#define TINYPROXY_ACL_H
|
||||||
|
|
||||||
|
#include "vector.h"
|
||||||
|
|
||||||
typedef enum { ACL_ALLOW, ACL_DENY } acl_access_t;
|
typedef enum { ACL_ALLOW, ACL_DENY } acl_access_t;
|
||||||
|
|
||||||
extern int insert_acl (char *location, acl_access_t access_type,
|
extern int insert_acl (char *location, acl_access_t access_type,
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "hashmap.h"
|
#include "hashmap.h"
|
||||||
#include "heap.h"
|
#include "heap.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "conf.h"
|
||||||
|
|
||||||
short int is_anonymous_enabled (void)
|
short int is_anonymous_enabled (void)
|
||||||
{
|
{
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include "reqs.h"
|
#include "reqs.h"
|
||||||
#include "sock.h"
|
#include "sock.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
#include "conf.h"
|
||||||
|
|
||||||
static int listenfd;
|
static int listenfd;
|
||||||
static socklen_t addrlen;
|
static socklen_t addrlen;
|
||||||
|
@ -22,8 +22,6 @@
|
|||||||
* add new directives to. Who knows if I'm right though.
|
* add new directives to. Who knows if I'm right though.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "main.h"
|
|
||||||
|
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
|
||||||
#include "acl.h"
|
#include "acl.h"
|
||||||
|
77
src/conf.h
77
src/conf.h
@ -21,6 +21,83 @@
|
|||||||
#ifndef TINYPROXY_CONF_H
|
#ifndef TINYPROXY_CONF_H
|
||||||
#define 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);
|
extern int load_config_file (const char *config_fname, struct config_s *conf);
|
||||||
void free_config (struct config_s *conf);
|
void free_config (struct config_s *conf);
|
||||||
int reload_config (const char *config_fname, struct config_s *conf,
|
int reload_config (const char *config_fname, struct config_s *conf,
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include "heap.h"
|
#include "heap.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "reqs.h"
|
#include "reqs.h"
|
||||||
|
#include "conf.h"
|
||||||
|
|
||||||
#define FILTER_BUFFER_LEN (512)
|
#define FILTER_BUFFER_LEN (512)
|
||||||
|
|
||||||
|
@ -21,6 +21,8 @@
|
|||||||
#ifndef _HASHMAP_H
|
#ifndef _HASHMAP_H
|
||||||
#define _HASHMAP_H
|
#define _HASHMAP_H
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We're using a typedef here to "hide" the implementation details of the
|
* 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.
|
* hash map. Sure, it's a pointer, but the struct is hidden in the C file.
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include "html-error.h"
|
#include "html-error.h"
|
||||||
#include "network.h"
|
#include "network.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
#include "conf.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add an error number -> filename mapping to the errorpages list.
|
* Add an error number -> filename mapping to the errorpages list.
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "vector.h"
|
#include "vector.h"
|
||||||
|
#include "conf.h"
|
||||||
|
|
||||||
static const char *syslog_level[] = {
|
static const char *syslog_level[] = {
|
||||||
NULL,
|
NULL,
|
||||||
|
76
src/main.h
76
src/main.h
@ -23,87 +23,11 @@
|
|||||||
#define __MAIN_H__
|
#define __MAIN_H__
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "hashmap.h"
|
|
||||||
#include "vector.h"
|
|
||||||
|
|
||||||
/* Global variables for the main controls of the program */
|
/* Global variables for the main controls of the program */
|
||||||
#define MAXBUFFSIZE ((size_t)(1024 * 96)) /* Max size of buffer */
|
#define MAXBUFFSIZE ((size_t)(1024 * 96)) /* Max size of buffer */
|
||||||
#define MAX_IDLE_TIME (60 * 10) /* 10 minutes of no activity */
|
#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 */
|
/* Global Structures used in the program */
|
||||||
extern struct config_s config;
|
extern struct config_s config;
|
||||||
extern unsigned int received_sighup; /* boolean */
|
extern unsigned int received_sighup; /* boolean */
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
#include "transparent-proxy.h"
|
#include "transparent-proxy.h"
|
||||||
#include "upstream.h"
|
#include "upstream.h"
|
||||||
#include "connect-ports.h"
|
#include "connect-ports.h"
|
||||||
|
#include "conf.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Maximum length of a HTTP line
|
* Maximum length of a HTTP line
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include "network.h"
|
#include "network.h"
|
||||||
#include "sock.h"
|
#include "sock.h"
|
||||||
#include "text.h"
|
#include "text.h"
|
||||||
|
#include "conf.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Bind the given socket to the supplied address. The socket is
|
* Bind the given socket to the supplied address. The socket is
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include "html-error.h"
|
#include "html-error.h"
|
||||||
#include "stats.h"
|
#include "stats.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
#include "conf.h"
|
||||||
|
|
||||||
struct stat_s {
|
struct stat_s {
|
||||||
unsigned long int num_reqs;
|
unsigned long int num_reqs;
|
||||||
|
Loading…
Reference in New Issue
Block a user