2008-05-24 16:05:49 +08:00
|
|
|
/* tinyproxy - A fast light-weight HTTP proxy
|
|
|
|
* Copyright (C) 1998 Steven Young <sdyoung@miranda.org>
|
|
|
|
* Copyright (C) 1999 Robert James Kaes <rjkaes@users.sourceforge.net>
|
2000-02-17 01:32:49 +08:00
|
|
|
*
|
2008-05-24 16:05:49 +08:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
2000-02-17 01:32:49 +08:00
|
|
|
*
|
2008-05-24 16:05:49 +08:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2000-02-17 01:32:49 +08:00
|
|
|
*
|
2008-05-24 16:05:49 +08:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2000-02-17 01:32:49 +08:00
|
|
|
*/
|
|
|
|
|
2009-08-07 06:12:53 +08:00
|
|
|
/* See 'main.c' for detailed information. */
|
2008-05-24 16:05:49 +08:00
|
|
|
|
2009-08-07 06:12:53 +08:00
|
|
|
#ifndef __MAIN_H__
|
|
|
|
#define __MAIN_H__
|
2000-02-17 01:32:49 +08:00
|
|
|
|
2002-05-24 02:27:19 +08:00
|
|
|
#include "common.h"
|
2003-08-01 08:14:34 +08:00
|
|
|
#include "hashmap.h"
|
2000-02-17 01:32:49 +08:00
|
|
|
|
|
|
|
/* Global variables for the main controls of the program */
|
2008-12-08 21:39:44 +08:00
|
|
|
#define MAXBUFFSIZE ((size_t)(1024 * 96)) /* Max size of buffer */
|
|
|
|
#define MAX_IDLE_TIME (60 * 10) /* 10 minutes of no activity */
|
2000-02-17 01:32:49 +08:00
|
|
|
|
2004-08-11 05:24:24 +08:00
|
|
|
/*
|
|
|
|
* Even if upstream support is not compiled into tinyproxy, this
|
|
|
|
* structure still needs to be defined.
|
|
|
|
*/
|
2009-09-15 03:41:25 +08:00
|
|
|
struct upstream {
|
|
|
|
struct upstream *next;
|
|
|
|
char *domain; /* optional */
|
|
|
|
char *host;
|
|
|
|
int port;
|
|
|
|
in_addr_t ip, mask;
|
2003-05-30 03:44:00 +08:00
|
|
|
};
|
|
|
|
|
2003-08-01 08:14:34 +08:00
|
|
|
/*
|
|
|
|
* Hold all the configuration time information.
|
|
|
|
*/
|
2009-09-15 03:41:25 +08:00
|
|
|
struct config_s {
|
|
|
|
char *logf_name;
|
|
|
|
const char *config_file;
|
|
|
|
unsigned int syslog; /* boolean */
|
|
|
|
int port;
|
2009-09-15 06:44:26 +08:00
|
|
|
char *stathost;
|
2009-09-15 04:04:30 +08:00
|
|
|
unsigned int godaemon; /* boolean */
|
2009-09-15 03:41:25 +08:00
|
|
|
unsigned int quit; /* boolean */
|
|
|
|
char *user;
|
|
|
|
char *group;
|
|
|
|
char *ipAddr;
|
2000-02-17 01:32:49 +08:00
|
|
|
#ifdef FILTER_ENABLE
|
2009-09-15 03:41:25 +08:00
|
|
|
char *filter;
|
|
|
|
unsigned int filter_url; /* boolean */
|
|
|
|
unsigned int filter_extended; /* boolean */
|
|
|
|
unsigned int filter_casesensitive; /* boolean */
|
2008-12-08 21:39:44 +08:00
|
|
|
#endif /* FILTER_ENABLE */
|
2000-09-12 08:03:53 +08:00
|
|
|
#ifdef XTINYPROXY_ENABLE
|
2009-09-27 17:54:38 +08:00
|
|
|
unsigned int add_xtinyproxy; /* boolean */
|
2000-02-17 01:32:49 +08:00
|
|
|
#endif
|
2004-01-27 03:11:52 +08:00
|
|
|
#ifdef REVERSE_SUPPORT
|
2009-09-15 03:41:25 +08:00
|
|
|
struct reversepath *reversepath_list;
|
|
|
|
unsigned int reverseonly; /* boolean */
|
|
|
|
unsigned int reversemagic; /* boolean */
|
|
|
|
char *reversebaseurl;
|
2004-01-27 03:11:52 +08:00
|
|
|
#endif
|
2001-09-17 04:12:29 +08:00
|
|
|
#ifdef UPSTREAM_SUPPORT
|
2009-09-15 03:41:25 +08:00
|
|
|
struct upstream *upstream_list;
|
2008-12-08 21:39:44 +08:00
|
|
|
#endif /* UPSTREAM_SUPPORT */
|
2009-09-15 03:41:25 +08:00
|
|
|
char *pidpath;
|
|
|
|
unsigned int idletimeout;
|
|
|
|
char *bind_address;
|
|
|
|
unsigned int bindsame;
|
2002-05-24 02:27:19 +08:00
|
|
|
|
2009-09-15 03:41:25 +08:00
|
|
|
/*
|
|
|
|
* The configured name to use in the HTTP "Via" header field.
|
|
|
|
*/
|
|
|
|
char *via_proxy_name;
|
2003-03-14 05:32:33 +08:00
|
|
|
|
2009-09-15 03:41:25 +08:00
|
|
|
/*
|
|
|
|
* Error page support. Map error numbers to file paths.
|
|
|
|
*/
|
|
|
|
hashmap_t errorpages;
|
2003-08-01 08:14:34 +08:00
|
|
|
|
2009-09-15 03:41:25 +08:00
|
|
|
/*
|
|
|
|
* Error page to be displayed if appropriate page cannot be located
|
|
|
|
* in the errorpages structure.
|
|
|
|
*/
|
|
|
|
char *errorpage_undef;
|
2003-03-14 05:32:33 +08:00
|
|
|
|
2009-09-15 03:41:25 +08:00
|
|
|
/*
|
|
|
|
* The HTML statistics page.
|
|
|
|
*/
|
|
|
|
char *statpage;
|
2000-02-17 01:32:49 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Global Structures used in the program */
|
|
|
|
extern struct config_s config;
|
2008-12-08 21:39:44 +08:00
|
|
|
extern unsigned int received_sighup; /* boolean */
|
|
|
|
extern unsigned int processed_config_file; /* boolean */
|
2000-02-17 01:32:49 +08:00
|
|
|
|
2009-08-07 06:12:53 +08:00
|
|
|
#endif /* __MAIN_H__ */
|