2
* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
5
* Copyright (C) 1998-2004 Luca Deri <deri@ntop.org>
7
* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
9
* This program is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation; either version 2 of the License, or
12
* (at your option) any later version.
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
19
* You should have received a copy of the GNU General Public License
20
* along with this program; if not, write to the Free Software Foundation,
21
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24
/* ************************************************************* */
26
typedef struct simpleProtoTrafficInfo {
27
TrafficCounter local, local2remote, remote, remote2local;
28
TrafficCounter lastLocal, lastLocal2remote, lastRem, lastRem2local;
29
} SimpleProtoTrafficInfo;
30
/*XMLSECTIONBEGIN xml_s_simpleprototrafficinfo.inc parent input */
31
/*XML e SimpleProtoTrafficInfo parent:Work "" */
32
/*XML trafficcounter local Work "" */
33
/*XML trafficcounter local2remote Work "" */
34
/*XML trafficcounter remote Work "" */
35
/*XML trafficcounter remote2local Work "" */
36
/*XML trafficcounter lastLocal Work "" */
37
/*XML trafficcounter lastLocal2remote Work "" */
38
/*XML trafficcounter lastRem Work "" */
39
/*XML trafficcounter lastRem2local Work "" */
43
/*XMLSECTIONBEGIN xml_s_ntopinterface.inc parent input */
44
/*XMLNOTE - use parent, not work, because the parent node is defined in g_intf.inc */
45
/*XML s name parent "" */
46
/*XML s humanFriendlyName parent "" */
47
/*XML h flags parent "status of the interface" */
48
/*XML h addr parent "" */
49
/*XML s ipdot parent "" */
50
/*XML s fqdn parent "" */
52
/*XML in_addr network parent "" */
53
/*XML in_addr netmask parent "" */
54
/*XML n:u numHosts parent "" */
55
/*XML in_addr ifAddr parent "" */
56
/*XML time_t started parent "" */
57
/*XML time_t firstpkt parent "" */
58
/*XML time_t lastpkt parent "" */
60
/*XMLNOTE TODO pcap_t *pcapPtr; */
61
/*XMLNOTE TODO pcap_dumper_t *pcapDumper; */
62
/*XMLNOTE TODO pcap_dumper_t *pcapErrDumper */
63
/*XMLNOTE TODO pcap_dumper_t *pcapOtherDumper */
65
/*XML b virtualDevice parent "" */
66
/*XML b dummyDevice parent "" */
67
/*XML n snaplen parent "" */
68
/*XML h datalink parent "" */
69
/*XML s filter parent "" */
70
/*XML n fd parent "" */
72
/*XML e packetStats parent:Work "" */
73
/*XML trafficcounter receivedPkts Work "" */
74
/*XML trafficcounter droppedPkts Work "" */
75
/*XML trafficcounter ethernetPkts Work "" */
76
/*XML trafficcounter broadcastPkts Work "" */
77
/*XML trafficcounter multicastPkts Work "" */
78
/*XML trafficcounter ipPkts Work "" */
79
/*XML trafficcounter lastMinEthernetPkts Work "" */
80
/*XML trafficcounter lastFiveMinsEthernetPkts Work "" */
81
/*XML trafficcounter lastNumEthernetPkts Work "" */
82
/*XML trafficcounter lastEthernetPkts Work "" */
83
/*XML trafficcounter lastTotalPkts Work "" */
84
/*XML trafficcounter lastBroadcastPkts Work "" */
85
/*XML trafficcounter lastMulticastPkts Work "" */
87
/*XML e byteStats parent:Work "" */
88
/*XML trafficcounter ethernetBytes Work "" */
89
/*XML trafficcounter ipBytes Work "" */
90
/*XML trafficcounter fragmentedIpBytes Work "" */
91
/*XML trafficcounter tcpBytes Work "" */
92
/*XML trafficcounter udpBytes Work "" */
93
/*XML trafficcounter otherIpBytes Work "" */
94
/*XML trafficcounter icmpBytes Work "" */
95
/*XML trafficcounter dlcBytes Work "" */
96
/*XML trafficcounter ipxBytes Work "" */
97
/*XML trafficcounter stpBytes Work "" */
98
/*XML trafficcounter decnetBytes Work "" */
99
/*XML trafficcounter netbiosBytes Work "" */
100
/*XML trafficcounter arpRarpBytes Work "" */
101
/*XML trafficcounter atalkBytes Work "" */
102
/*XML trafficcounter egpBytes Work "" */
103
/*XML trafficcounter osiBytes Work "" */
104
/*XML trafficcounter ipv6Bytes Work "" */
105
/*XML trafficcounter otherBytes Work "" */
106
/*XML trafficcounter lastMinEthernetBytes Work "" */
107
/*XML trafficcounter lastFiveMinsEthernetBytes Work "" */
108
/*XML trafficcounter lastEthernetBytes Work "" */
109
/*XML trafficcounter lastIpBytes Work "" */
110
/*XML trafficcounter lastNonIpBytes Work "" */
112
/*XMLNOTE TODO PortCounter *ipPorts[MAX_IP_PORT]; */
114
/*XML &packetstats rcvdPktStats parent "" */
115
/*XML &ttlstats rcvdPktTTLStats parent "" */
117
/*XML e throughputStats parent:Work "" */
118
/*XML n:f peakThroughput Work "" */
119
/*XML n:f actualThpt Work "" */
120
/*XML n:f lastMinThpt Work "" */
121
/*XML n:f lastFiveMinsThpt Work "" */
122
/*XML n:f peakPacketThroughput Work "" */
123
/*XML n:f actualPktsThpt Work "" */
124
/*XML n:f lastMinPktsThpt Work "" */
125
/*XML n:f lastFiveMinsPktsThpt Work "" */
126
/*XML time_t lastThptUpdate Work "" */
127
/*XML time_t lastMinThptUpdate Work "" */
128
/*XML time_t lastHourThptUpdate Work "" */
129
/*XML time_t lastFiveMinsThptUpdate Work "" */
130
/*XML n:f throughput Work "" */
131
/*XML n:f packetThroughput Work "" */
132
/*XML n:u numThptSamples Work "" */
133
/*XML e last60MinutesThpt Work:Work2 "" */
134
/*XML n:u last60MinutesThptIdx Work2 "" */
135
/*XMLFOR indexT 0 59 <= */
136
/*XML * indexT Work2:Work3 ""
137
if (snprintf(buf, sizeof(buf), "%d", indexT) < 0) BufferTooShort();
138
elWork3 = newxml_simplestring(elWork2,
143
/*XMLIF input->last60MinutesThpt[indexT].trafficValue != 0.0 */
144
/*XML &thptentry last60MinutesThpt[indexT] Work3 "" */
147
/*XML e last24HoursThpt Work:Work2 "" */
148
/*XML n:u last24HoursThptIdx Work2 "" */
149
/*XMLFOR indexT 0 23 <= */
150
/*XML * indexT Work2:Work3 ""
151
if (snprintf(buf, sizeof(buf), "%d", indexT) < 0) BufferTooShort();
152
elWork3 = newxml_simplestring(elWork2,
157
/*XMLIF input->last24HoursThpt[indexT].trafficValue != 0.0 */
158
/*XML &thptentry last24HoursThpt[indexT] Work3 "" */
161
/*XML e last30daysThpr Work:Work2 "" */
162
/*XML n:u last30daysThptIdx Work2 "" */
163
/*XMLFOR indexT 0 29 <= */
164
/*XMLIF input->last30daysThpt[indexT] != 0.0 */
165
/*XML * indexT Work2 ""
166
if (snprintf(buf, sizeof(buf), "%d", indexT) < 0) BufferTooShort();
167
if (snprintf(buf2, sizeof(buf2), "%f", input->last30daysThpt[indexT]) < 0) BufferTooShort();
168
newxml_simplestring(elWork2,
176
/*XML e protocolStats parent:Work "" */
177
/*XML e tcp Work:Work2 "" */
178
/*XML &simpleprototrafficinfo tcpGlobalTrafficStats Work2 "" */
179
/*XML e udp Work:Work2 "" */
180
/*XML &simpleprototrafficinfo udpGlobalTrafficStats Work2 "" */
181
/*XML e icmp Work:Work2 "" */
182
/*XML &simpleprototrafficinfo icmpGlobalTrafficStats Work2 "" */
183
/*XMLFOR iProtoIndex 0 myGlobals.numIpProtosToMonitor */
184
/*XMLPREFIX myGlobals */
185
/*XML s protoIPTrafficInfos[iProtoIndex]!ipprotocol Work:Work2 "" */
187
/*XML &simpleprototrafficinfo ipProtoStats[iProtoIndex] Work2 "" */
190
/*XML trafficcounter numEstablishedTCPConnections parent "" */
192
/*XML n:u hostsno parent "" */
193
/*XML n:u actualHashSize parent "" */
195
/*XMLNOTE Special handling for the big sub-structures */
196
/*XMLNOTE ipSession ... */
197
/*XMLNOTE ipTrafficMatrix ... */
198
/*XMLNOTE ipTrafficMatrixHosts ... */
206
* Technically, this is all one structure - literally EVERYTHING is in myGlobals,
207
* so we can't really just dump it as one structure - it's huge, unwieldy, etc.
209
* So we impose an arbitrary organization, grouping the sections into things
210
* to request by switches on the dump.xml URL. We do this based on the comments
211
* which split up the sections.
215
/*XMLSECTIONBEGIN xml_g_invoke.inc root myGlobals */
216
/*XML e Invoke root:Invoke "" */
217
/*XML e ExecutionEnvironment Invoke:Execenv "" */
218
/*XML e paths Invoke:Paths "" */
219
/*XML e CommandLineOptions Invoke:Options "" */
221
/* How is ntop run? */
223
/*XML s program_name Execenv "" */
224
/*XML n basentoppid Execenv "" */
226
/*XML s startedAs Execenv "" */
227
/*XML n ntop_argc Execenv "" */
228
/*XML e ntop_argv Execenv:Arg "" */
229
/*XML * ntop_argc Arg ""
230
for (i=0; i<myGlobals.ntop_argc; i++) {
231
if (snprintf(buf, sizeof(buf), "%d", i) < 0)
233
newxml(GDOME_ELEMENT_NODE, elArg, "parameter",
235
"value", myGlobals.ntop_argv[i]);
239
/*XMLNOTE TODO dataFileDirs */
240
/*XMLNOTE TODO pluginDirs */
241
/*XMLNOTE TODO configFileDirs */
243
/*XML s accessLogFile Options "-a | --access-log-file" */
244
/*XML b enablePacketDecoding Options "-b | --disable-decoders" */
245
/*XML b stickyHosts Options "-c | --sticky-hosts" */
246
/*XML b daemonMode Options "-d | --daemon: run as daemon flag" */
247
/*XML n maxNumLines Options "-e | --max-table-rows: maximum lines/page" */
248
/*XML s rFileName Options "-f | --traffic-dump-file: input packet capture file" */
249
/*XML s trackOnlyLocalHosts Options "-g | --track-local-hosts" */
250
/*XML s devices Options "-i | --interface" */
251
/*XML b enableOtherPacketDump Options "-j | --create-other-packets" */
252
/*XML s filterExpressionInExtraFrame Options "-k | --filter-expression-in-extra-frame" */
253
/*XML s pcapLog Options "-l | --pcap-log" */
254
/*XML s localAddresses Options "-m | --local-subnets" */
255
/*XML b numericFlag Options "-n | --numeric-ip-addresses" */
256
/*XML b dontTrustMACaddr Options "-o | --no-mac" */
257
/*XML s protoSpecs Options "-p | --protocols" */
258
/*XML b enableSuspiciousPacketDump Options "-q | --create-suspicious-packets" */
259
/*XML n refreshRate Options "-r | --refresh-time" */
260
/*XML b disablePromiscuousMode Options "-s | --no-promiscuous" */
261
/*XML n traceLevel Options "-t | --trace-level" */
262
/*XML n maxNumHashEntries Options "-x <max num hash entries>" */
263
/*XML n maxNumSessions Options "-X <max num TCP sessions>" */
265
/*XML * effectiveUserName Options ""
266
if (snprintf(buf, sizeof(buf), "(uid=%d, gid=%d)",
268
myGlobals.groupId) < 0)
270
newxml(GDOME_ELEMENT_NODE, elOptions, "effectiveUserName",
271
"value", myGlobals.effectiveUserName,
273
"description", "-u | --user");
276
/*XML n defaultVsan Options "-v | --default-vsan" */
277
/*XML s webAddr Options "-w | --http-server address" */
278
/*XML n webPort Options "-w | --http-server :port" */
279
//TODO int ipv4or6; /* '6/4' */
280
/*XML b enableSessionHandling Options "-z | --disable-sessions" */
281
/*XML s currentFilterExpression Options "-B | --filter-expression" */
282
/*XML s domainName Options "-D | --domain" */
283
/*XML b flowSpecs Options "-F | --flow-spec" */
286
/*XML b debugMode Options "-K | --enable-debug" */
287
/*XML n useSyslog Options "-L | --use-syslog" */
290
/*XML b mergeInterfaces Options "-M | --no-interface-merge" */
291
/*XML s pcapLogBasePath Options "-O | --pcap-file-path" */
292
/*XML s fcNSCacheFile Options "-N | --wwn-map" */
293
/*XML s dbPath Options "-P | --db-file-path" */
294
/*XML s spoolPath Options "-Q | --spool-file-path" */
295
/*XML s printFcOnly Options "-S | --fc-only" */
296
/*XML s mapperURL Options "-U | --mapper" */
299
/*XML s sslAddr Options "-W | --https-server address" */
300
/*XML n sslPort Options "-W | --https-server :port" */
303
#ifdef MAKE_WITH_SSLWATCHDOG_RUNTIME
304
/*XML b useSSLwatchdog Options "--ssl-watchdog" */
307
#if defined(CFG_MULTITHREADED) && defined(MAKE_WITH_SCHED_YIELD)
308
/*XML b disableSchedYield Options "--disable-schedyield" */
311
/*XML s P3Pcp Options "--p3p-cp" */
312
/*XML s P3Puri Options "--p3p-uri" */
314
/*XML b disableStopcap Options "--disable-stopcap" */
316
/*XML b disableInstantSessionPurge Options "--disable-instantsessionpurge" */
317
/*XML b noFc Options "--no-fc" */
318
/*XML b noInvalidLunDisplay Options "--no-invalid-lun" */
320
/*XML b disableMutexExtraInfo Options "--disable-mutexextrainfo" */
322
/*XML b skipVersionCheck Options "--skip-version-check" */
324
/*XML b enableFragmentHandling Options "" */
327
// Physical and Logical network interfaces
329
/*XMLSECTIONBEGIN xml_g_intf.inc root myGlobals */
330
/*XML e Interfaces root:Interfaces "" */
332
/*XML n numDevices Interfaces "" */
333
/*XMLFOR i 0 myGlobals.numDevices */
334
/*XML * device Interfaces ""
335
if (snprintf(buf, sizeof(buf), "%d", i) < 0)
337
elWork = newxml(GDOME_ELEMENT_NODE,
343
/*XML &ntopinterface device[i] Work "" */
347
#ifdef CFG_MULTITHREADED
348
/*XMLSECTIONBEGIN xml_g_multithread.inc root myGlobals */
349
/*XML e ThreadInfo root:multithread "" */
350
/*XML n:u numThreads multithread "" */
351
/*XML n:u numDequeueThreads multithread "" */
353
#endif /* CFG_MULTITHREADED */