summaryrefslogtreecommitdiffhomepage
path: root/src/tinyproxy.h
blob: 22630a7b01ffd5cf6340564482c099768c13a134 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/* $Id: tinyproxy.h,v 1.2 2000-03-11 20:37:44 rjkaes Exp $
 *
 * See 'tinyproxy.c' for a detailed description.
 *
 * Copyright (C) 1998  Steven Young
 * Copyright (C) 1999  Robert James Kaes (rjkaes@flarenet.com)
 *
 * 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, or (at your option) any
 * later version.
 *
 * 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.
 */

#ifndef _TINYPROXY_H_
#define _TINYPROXY_H_	1

#ifdef HAVE_CONFIG_H
#include <defines.h>
#endif

#include <stdio.h>
#include <time.h>

#include "config.h"

/* Global variables for the main controls of the program */
#define BUFFER (1024 * 2)	/* Size of buffer for reading */
#define MAXLISTEN 128		/* Max number of connections to listen for */

/* Make a new type: flag */
typedef char flag;

/* Other stuff */
#define FALSE (0)
#define TRUE  (!FALSE)

struct config_s {
	FILE *logf;
	char *logf_name;
	flag syslog;
	float cutoffload;
	int port;
	char *stathost;
	flag quit;
	char *changeuser;
	flag anonymous;
	char *subnet;
	char *ipAddr;
#ifdef FILTER_ENABLE
	char *filter;
#endif				/* FILTER_ENABLE */
	flag restricted;
#ifdef XTINYPROXY
	char *my_domain;
#endif
#ifdef UPSTREAM_PROXY
	char *upstream_name;
	int upstream_port;
#endif
};

struct stat_s {
	unsigned long int num_reqs;
	unsigned long int num_cons;
	unsigned long int num_badcons;
	unsigned long int num_opens;
	unsigned long int num_listens;
	unsigned long int num_tx;
	unsigned long int num_rx;
	unsigned long int num_garbage;
	unsigned long int num_idles;
	unsigned long int num_refused;
};

struct allowedhdr_s {
	char *hdrname;
	struct allowedhdr_s *next;
};

/* Global Structures used in the program */
extern struct config_s config;
extern struct stat_s stats;
extern struct allowedhdr_s *allowedhdrs;
extern float load;

#endif