1 |
/* Copyright (C) 2003 Stephane Thiell |
2 |
* |
3 |
* This file is part of pxyservd (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 |
* $Id: PXServiceMsg.h,v 1.1.1.1 2003/12/30 17:08:59 mbuna Exp $ |
20 |
*/ |
21 |
#ifndef INCLUDED_PXSERVICEMSG_H |
22 |
#define INCLUDED_PXSERVICEMSG_H |
23 |
|
24 |
/* This C/C++ header defines service messages implemented by pxyscand, which |
25 |
* are available thru the OPAS protocol as custom user messages. Integers are |
26 |
* in network byte order (big endian). |
27 |
*/ |
28 |
|
29 |
/* PXSHeader - pxyscand service header |
30 |
* sig: 32 bit vector to identify this service. I think I should add this to |
31 |
* the OPAS protocol as there is currently no way to provide completely |
32 |
* independant services over OPAS user msgs. |
33 |
* ver: version of this header, to avoid header version conflict (bumped for |
34 |
* any structure changes). |
35 |
* cmd: command ID (as defined below). |
36 |
*/ |
37 |
typedef struct |
38 |
{ |
39 |
uint32_t sig; |
40 |
uint32_t ver; |
41 |
uint32_t cmd; |
42 |
} PXSHeader; |
43 |
|
44 |
#define PX_VERSION 1 |
45 |
#define PXYSCAND_SIG 0x50585953 |
46 |
|
47 |
|
48 |
/* STATUS command |
49 |
* -------------- |
50 |
* Query: only the header |
51 |
* Reply: header + a structure with status info in it + PXSMInfo's appended |
52 |
* |
53 |
*/ |
54 |
#define PX_CMD_STATUS 1 |
55 |
|
56 |
// activity, timeout, uptime, scans completed |
57 |
// open gates found, cache hits |
58 |
// cache times: proxy, noproxy |
59 |
// current target IP and port, last target_check |
60 |
// scan queue size |
61 |
|
62 |
typedef struct |
63 |
{ |
64 |
PXSHeader head; |
65 |
|
66 |
int32_t uptime; // Daemon's uptime in seconds |
67 |
uint32_t curIPScan; // Current number of IPs being scanned |
68 |
uint32_t maxIPScan; // Max simult. number of IPs that can be scanned |
69 |
uint32_t curRunScan; // Current number of launched scans |
70 |
uint32_t maxRunScan; // Max number of scans that can be launched |
71 |
uint32_t scanQSize; // Current number of IPs in scan queue |
72 |
|
73 |
struct in_addr targetAddr; // Current target IP# |
74 |
uint32_t targetPort; // Current target port |
75 |
int32_t targetLastCheck; // Last target check time in seconds |
76 |
|
77 |
uint32_t sessScannedCount; // Number of scans done under the current session |
78 |
uint32_t sessProxyCount; // Number of proxy found under the current session |
79 |
|
80 |
uint32_t servScannedCount; // Total number of scans done by the daemon |
81 |
uint32_t servProxyCount; // Total number of proxy found by the daemon |
82 |
|
83 |
int32_t timeout; // Connections timeout (from config) |
84 |
|
85 |
uint32_t numMInfo; // Number of PXM info structures appended |
86 |
} PXSStatus; |
87 |
|
88 |
typedef struct |
89 |
{ |
90 |
uint32_t port; |
91 |
uint32_t connCount; |
92 |
uint32_t proxyCount; |
93 |
char shortName[16]; |
94 |
} PXSMInfo; |
95 |
|
96 |
|
97 |
/* STATS command |
98 |
* ------------- |
99 |
* Query: only the header |
100 |
* Reply: header + a simple structure with stats info in it |
101 |
* |
102 |
*/ |
103 |
|
104 |
#define PX_CMD_STATS 2 |
105 |
|
106 |
// number of sessions opened |
107 |
// total queries |
108 |
// unreach, proxy cache size |
109 |
|
110 |
typedef struct |
111 |
{ |
112 |
PXSHeader head; |
113 |
|
114 |
uint32_t servQueryCount; // Total number of queries |
115 |
uint32_t servScannedCount; // Total number of scans done by the daemon |
116 |
uint32_t servProxyCount; // Total number of proxy found by the daemon |
117 |
uint32_t servNoScanHits; // Number of queries that matched the NoScan list |
118 |
uint32_t servIPCacheHits; // Number of successful IP cache hits (no-proxy) |
119 |
uint32_t servPXCacheHits; // Number of successful proxy cache hits |
120 |
uint32_t servInProgressCount; // Number of scan query already in progress |
121 |
|
122 |
uint32_t servIP4CacheCount; // IPv4 "no proxy" cache current count |
123 |
uint32_t servIP4CacheSize; // Max IPv4 in "no proxy" cache |
124 |
int32_t servIP4CacheExpire; // Expiration delay in seconds |
125 |
uint32_t servPX4CacheCount; // IPv4 "proxy" cache current count |
126 |
uint32_t servPX4CacheSize; // Max IPv4 in "proxy" cache |
127 |
int32_t servPX4CacheExpire; // Expiration delay in seconds |
128 |
|
129 |
uint32_t sessQueryCount; // Number of queries for the current session |
130 |
uint32_t sessScannedCount; // Number of scans done under the current session |
131 |
uint32_t sessProxyCount; // Number of proxy found under the current session |
132 |
uint32_t sessErrorCount; // Number of errors encountered under the session |
133 |
|
134 |
uint32_t sessCurrent; // Number of OPAS sessions currently opened |
135 |
uint32_t sessCount; // OPAS sessions count |
136 |
uint32_t sessRejectedCount; // Rejected OPAS sessions count |
137 |
|
138 |
uint32_t sessReadBytes; // Bytes read during the current OPAS session |
139 |
uint32_t sessWriteBytes; // Bytes written during the current OPAS session |
140 |
|
141 |
char version[64]; // Server version |
142 |
|
143 |
} PXSStats; |
144 |
|
145 |
|
146 |
|
147 |
/* REMOVE command |
148 |
* -------------- |
149 |
* Invalidate an address in the cache |
150 |
* Query: header + address + empty status |
151 |
* Reply: same + status=1 if address found in the cache and removed |
152 |
* |
153 |
*/ |
154 |
|
155 |
#define PX_CMD_REMOVE 3 |
156 |
|
157 |
typedef struct |
158 |
{ |
159 |
PXSHeader head; |
160 |
|
161 |
struct in_addr addr; |
162 |
uint32_t status; |
163 |
|
164 |
} PXSRemove4; |
165 |
|
166 |
typedef struct |
167 |
{ |
168 |
PXSHeader head; |
169 |
|
170 |
struct in6_addr addr; |
171 |
uint32_t status; |
172 |
|
173 |
} PXSRemove6; |
174 |
|
175 |
|
176 |
|
177 |
#endif /* INCLUDED_PXSERVICEMSG_H */ |
178 |
|