/[svn]/vendor/pxys2-2.1.0/pxyscand/src/PXConfig.h
ViewVC logotype

Contents of /vendor/pxys2-2.1.0/pxyscand/src/PXConfig.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3253 - (show annotations)
Wed Apr 2 20:46:18 2014 UTC (6 years, 10 months ago) by michael
File MIME type: text/x-csrc
File size: 2367 byte(s)
- Imported pxys2-2.1.0

1 /* Copyright (C) 2003 Stephane Thiell
2 *
3 * This file is part of pxyscand (from pxys)
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (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
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 *
19 */
20 #ifndef INCLUDED_PXCONFIG_H_
21 #define INCLUDED_PXCONFIG_H_
22
23 #include <sys/types.h>
24 #include <sys/socket.h>
25 #include <netinet/in.h>
26 #include <ctime>
27
28 #include <vector>
29
30 #include "PXMutex.h"
31
32 #define PXOPAS_PROTO_TCP 1
33 #define PXOPAS_PROTO_UDP 2
34
35 using std::vector;
36
37 struct PXConfigOPAS
38 {
39 int port;
40 in_addr local_address;
41 vector<int> proto;
42 vector<in_addr> allow;
43 int limit;
44 };
45
46 struct PXConfigModule
47 {
48 int id;
49 int port;
50 };
51
52 enum
53 {
54 CONFIG_MODULE_WINGATE,
55 CONFIG_MODULE_SOCKS,
56 CONFIG_MODULE_HTTP,
57 CONFIG_MODULE_CRAZYBANDIT
58 /* Add new module type id here. */
59 };
60
61 struct PXConfigScannerTarget
62 {
63 in_addr address;
64 int port;
65 char *secret;
66 };
67
68 struct PXConfigScanner
69 {
70 int maxscans;
71 vector<PXConfigModule> modules;
72 vector<in_addr> source_pool;
73 vector<PXConfigScannerTarget> targets;
74 time_t target_check;
75 char *log_agent;
76 time_t timeout;
77 };
78
79 struct PXConfigCache
80 {
81 char *dir;
82 int expire;
83 int proxy_expire;
84 int maxips;
85 };
86
87 struct NetworkNetmask
88 {
89 in_addr network;
90 in_addr netmask;
91 };
92
93 struct PXConfigNoScan
94 {
95 vector<NetworkNetmask> address;
96 };
97
98 struct PXConfig
99 {
100 PXConfig();
101 ~PXConfig();
102
103 bool OPASIsAllowed(const in_addr &in) const;
104 bool HasSourcePool() const { return scanner.source_pool.size() > 0; }
105 in_addr GetOneFromSourcePool() const;
106 bool CheckNoScan(const in_addr &addr) const;
107
108 PXConfigOPAS opas;
109 PXConfigScanner scanner;
110 PXConfigCache cache;
111 PXConfigNoScan noscan;
112 protected:
113 mutable PXMutex mutex;
114 };
115
116 #endif /* INCLUDED_PXCONFIG_H_ */

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.28