2
* SNMPStats Module - Network Statistics
4
* Kamailio Server Net objects addition
5
* Copyright (C) 2013 Edvina AB, Sollentuna, Sweden
6
* Written by Olle E. Johansson
8
* This file is part of Kamailio, a free SIP server.
10
* Kamailio is free software; you can redistribute it and/or modify it
11
* under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* (at your option) any later version
15
* Kamailio is distributed in the hope that it will be useful, but
16
* WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18
* General Public License for more details.
20
* You should have received a copy of the GNU General Public License
21
* along with this program; if not, write to the Free Software
22
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
27
* 2013-03-24 initial version (oej)
29
* Note: this file originally auto-generated by mib2c
33
#include <net-snmp/net-snmp-config.h>
34
#include <net-snmp/net-snmp-includes.h>
35
#include <net-snmp/agent/net-snmp-agent-includes.h>
36
#include "kamailioNet.h"
38
#include "snmpstats_globals.h"
39
#include "utilities.h"
40
#include "../../lib/kcore/statistics.h"
41
#include "../../globals.h"
42
#include "../../tcp_options.h"
44
/** Initializes the kamailioNet module */
46
init_kamailioNet(void)
48
oid kamailioNetTcpConnEstablished_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,1,2,1 };
49
oid kamailioNetTcpConnFailed_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,1,2,2 };
50
oid kamailioNetTcpConnReset_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,1,2,3 };
51
oid kamailioNetTcpConnSuccess_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,1,2,4 };
52
oid kamailioNetTcpConnOpen_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,1,2,5 };
53
oid kamailioNetTcpConnPassiveOpen_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,1,2,6 };
54
oid kamailioNetTcpConnReject_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,1,2,8 };
55
oid kamailioNetTcpEnabled_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,1,3,1 };
56
oid kamailioNetTcpMaxConns_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,1,3,2 };
57
oid kamailioNetTcpConnTimeout_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,1,3,3 };
58
oid kamailioNetTcpSendTimeout_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,1,3,4 };
59
oid kamailioNetTcpConnLifetime_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,1,3,5 };
60
oid kamailioNetTcpNoConnect_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,1,3,7 };
61
oid kamailioNetTcpFdCache_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,1,3,8 };
62
oid kamailioNetTcpAsync_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,1,3,9 };
63
oid kamailioNetTcpAsyncConnWait_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,1,3,10 };
64
oid kamailioNetTcpAsyncConnWqMax_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,1,3,11 };
65
oid kamailioNetTcpAsyncWqMax_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,1,3,12 };
66
oid kamailioNetTcpRdBufSize_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,1,3,13 };
67
oid kamailioNetTcpDeferAccept_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,1,3,14 };
68
oid kamailioNetTcpDelayedAck_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,1,3,15 };
69
oid kamailioNetTcpSynCnt_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,1,3,16 };
70
oid kamailioNetTcpLinger_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,1,3,17 };
71
oid kamailioNetTcpKeepAlive_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,1,3,18 };
72
oid kamailioNetTcpKeepIdle_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,1,3,19 };
73
oid kamailioNetTcpKeepIntvl_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,1,3,20 };
74
oid kamailioNetTcpKeepCnt_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,1,3,21 };
75
oid kamailioNetTcpCrlfPing_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,1,3,22 };
76
oid kamailioNetTcpAcceptAliases_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,1,3,23 };
77
oid kamailioNetTcpAcceptNoCl_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,1,3,24 };
80
oid kamailioNetWsConnsActive_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,2,1,1 };
81
oid kamailioNetWsConnsActiveMax_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,2,1,2 };
82
oid kamailioNetWsConnsFailed_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,2,1,3 };
83
oid kamailioNetWsConnsClosedLocal_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,2,1,4 };
84
oid kamailioNetWsConnsClosedRemote_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,2,1,5 };
85
oid kamailioNetWsFramesRx_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,2,1,6 };
86
oid kamailioNetWsFramesTx_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,2,1,7 };
87
oid kamailioNetWsHandshakeSuccess_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,2,1,8 };
88
oid kamailioNetWsHandshakeFailed_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,2,1,9 };
90
DEBUGMSGTL(("kamailioNet", "Initializing\n"));
92
netsnmp_register_scalar(
93
netsnmp_create_handler_registration("kamailioNetTcpConnEstablished", handle_kamailioNetTcpConnEstablished,
94
kamailioNetTcpConnEstablished_oid, OID_LENGTH(kamailioNetTcpConnEstablished_oid),
97
netsnmp_register_scalar(
98
netsnmp_create_handler_registration("kamailioNetTcpConnFailed", handle_kamailioNetTcpConnFailed,
99
kamailioNetTcpConnFailed_oid, OID_LENGTH(kamailioNetTcpConnFailed_oid),
102
netsnmp_register_scalar(
103
netsnmp_create_handler_registration("kamailioNetTcpConnReset", handle_kamailioNetTcpConnReset,
104
kamailioNetTcpConnReset_oid, OID_LENGTH(kamailioNetTcpConnReset_oid),
107
netsnmp_register_scalar(
108
netsnmp_create_handler_registration("kamailioNetTcpConnSuccess", handle_kamailioNetTcpConnSuccess,
109
kamailioNetTcpConnSuccess_oid, OID_LENGTH(kamailioNetTcpConnSuccess_oid),
112
netsnmp_register_scalar(
113
netsnmp_create_handler_registration("kamailioNetTcpConnOped", handle_kamailioNetTcpConnOpen,
114
kamailioNetTcpConnOpen_oid, OID_LENGTH(kamailioNetTcpConnOpen_oid),
117
netsnmp_register_scalar(
118
netsnmp_create_handler_registration("kamailioNetTcpConnPassiveOpen", handle_kamailioNetTcpConnPassiveOpen,
119
kamailioNetTcpConnPassiveOpen_oid, OID_LENGTH(kamailioNetTcpConnPassiveOpen_oid),
122
netsnmp_register_scalar(
123
netsnmp_create_handler_registration("kamailioNetTcpConnReject", handle_kamailioNetTcpConnReject,
124
kamailioNetTcpConnReject_oid, OID_LENGTH(kamailioNetTcpConnReject_oid),
127
netsnmp_register_scalar(
128
netsnmp_create_handler_registration("kamailioNetTcpEnabled", handle_kamailioNetTcpEnabled,
129
kamailioNetTcpEnabled_oid, OID_LENGTH(kamailioNetTcpEnabled_oid),
132
netsnmp_register_scalar(
133
netsnmp_create_handler_registration("kamailioNetTcpMaxConns", handle_kamailioNetTcpMaxConns,
134
kamailioNetTcpMaxConns_oid, OID_LENGTH(kamailioNetTcpMaxConns_oid),
137
netsnmp_register_scalar(
138
netsnmp_create_handler_registration("kamailioNetTcpConnTimeout", handle_kamailioNetTcpConnTimeout,
139
kamailioNetTcpConnTimeout_oid, OID_LENGTH(kamailioNetTcpConnTimeout_oid),
142
netsnmp_register_scalar(
143
netsnmp_create_handler_registration("kamailioNetTcpSendTimeout", handle_kamailioNetTcpSendTimeout,
144
kamailioNetTcpSendTimeout_oid, OID_LENGTH(kamailioNetTcpSendTimeout_oid),
147
netsnmp_register_scalar(
148
netsnmp_create_handler_registration("kamailioNetTcpConnLifetime", handle_kamailioNetTcpConnLifetime,
149
kamailioNetTcpConnLifetime_oid, OID_LENGTH(kamailioNetTcpConnLifetime_oid),
152
netsnmp_register_scalar(
153
netsnmp_create_handler_registration("kamailioNetTcpNoConnect", handle_kamailioNetTcpNoConnect,
154
kamailioNetTcpNoConnect_oid, OID_LENGTH(kamailioNetTcpNoConnect_oid),
157
netsnmp_register_scalar(
158
netsnmp_create_handler_registration("kamailioNetTcpFdCache", handle_kamailioNetTcpFdCache,
159
kamailioNetTcpFdCache_oid, OID_LENGTH(kamailioNetTcpFdCache_oid),
162
netsnmp_register_scalar(
163
netsnmp_create_handler_registration("kamailioNetTcpAsync", handle_kamailioNetTcpAsync,
164
kamailioNetTcpAsync_oid, OID_LENGTH(kamailioNetTcpAsync_oid),
167
netsnmp_register_scalar(
168
netsnmp_create_handler_registration("kamailioNetTcpAsyncConnWait", handle_kamailioNetTcpAsyncConnWait,
169
kamailioNetTcpAsyncConnWait_oid, OID_LENGTH(kamailioNetTcpAsyncConnWait_oid),
172
netsnmp_register_scalar(
173
netsnmp_create_handler_registration("kamailioNetTcpAsyncConnWqMax", handle_kamailioNetTcpAsyncConnWqMax,
174
kamailioNetTcpAsyncConnWqMax_oid, OID_LENGTH(kamailioNetTcpAsyncConnWqMax_oid),
177
netsnmp_register_scalar(
178
netsnmp_create_handler_registration("kamailioNetTcpAsyncWqMax", handle_kamailioNetTcpAsyncWqMax,
179
kamailioNetTcpAsyncWqMax_oid, OID_LENGTH(kamailioNetTcpAsyncWqMax_oid),
182
netsnmp_register_scalar(
183
netsnmp_create_handler_registration("kamailioNetTcpRdBufSize", handle_kamailioNetTcpRdBufSize,
184
kamailioNetTcpRdBufSize_oid, OID_LENGTH(kamailioNetTcpRdBufSize_oid),
187
netsnmp_register_scalar(
188
netsnmp_create_handler_registration("kamailioNetTcpDeferAccept", handle_kamailioNetTcpDeferAccept,
189
kamailioNetTcpDeferAccept_oid, OID_LENGTH(kamailioNetTcpDeferAccept_oid),
192
netsnmp_register_scalar(
193
netsnmp_create_handler_registration("kamailioNetTcpDelayedAck", handle_kamailioNetTcpDelayedAck,
194
kamailioNetTcpDelayedAck_oid, OID_LENGTH(kamailioNetTcpDelayedAck_oid),
197
netsnmp_register_scalar(
198
netsnmp_create_handler_registration("kamailioNetTcpSynCnt", handle_kamailioNetTcpSynCnt,
199
kamailioNetTcpSynCnt_oid, OID_LENGTH(kamailioNetTcpSynCnt_oid),
202
netsnmp_register_scalar(
203
netsnmp_create_handler_registration("kamailioNetTcpLinger", handle_kamailioNetTcpLinger,
204
kamailioNetTcpLinger_oid, OID_LENGTH(kamailioNetTcpLinger_oid),
207
netsnmp_register_scalar(
208
netsnmp_create_handler_registration("kamailioNetTcpKeepAlive", handle_kamailioNetTcpKeepAlive,
209
kamailioNetTcpKeepAlive_oid, OID_LENGTH(kamailioNetTcpKeepAlive_oid),
212
netsnmp_register_scalar(
213
netsnmp_create_handler_registration("kamailioNetTcpKeepIdle", handle_kamailioNetTcpKeepIdle,
214
kamailioNetTcpKeepIdle_oid, OID_LENGTH(kamailioNetTcpKeepIdle_oid),
217
netsnmp_register_scalar(
218
netsnmp_create_handler_registration("kamailioNetTcpKeepIntvl", handle_kamailioNetTcpKeepIntvl,
219
kamailioNetTcpKeepIntvl_oid, OID_LENGTH(kamailioNetTcpKeepIntvl_oid),
222
netsnmp_register_scalar(
223
netsnmp_create_handler_registration("kamailioNetTcpKeepCnt", handle_kamailioNetTcpKeepCnt,
224
kamailioNetTcpKeepCnt_oid, OID_LENGTH(kamailioNetTcpKeepCnt_oid),
227
netsnmp_register_scalar(
228
netsnmp_create_handler_registration("kamailioNetTcpCrlfPing", handle_kamailioNetTcpCrlfPing,
229
kamailioNetTcpCrlfPing_oid, OID_LENGTH(kamailioNetTcpCrlfPing_oid),
232
netsnmp_register_scalar(
233
netsnmp_create_handler_registration("kamailioNetTcpAcceptAliases", handle_kamailioNetTcpAcceptAliases,
234
kamailioNetTcpAcceptAliases_oid, OID_LENGTH(kamailioNetTcpAcceptAliases_oid),
237
netsnmp_register_scalar(
238
netsnmp_create_handler_registration("kamailioNetTcpAcceptNoCl", handle_kamailioNetTcpAcceptNoCl,
239
kamailioNetTcpAcceptNoCl_oid, OID_LENGTH(kamailioNetTcpAcceptNoCl_oid),
242
netsnmp_register_scalar(
243
netsnmp_create_handler_registration("kamailioNetWsConnsActive", handle_kamailioNetWsConnsActive,
244
kamailioNetWsConnsActive_oid, OID_LENGTH(kamailioNetWsConnsActive_oid),
247
netsnmp_register_scalar(
248
netsnmp_create_handler_registration("kamailioNetWsConnsActiveMax", handle_kamailioNetWsConnsActiveMax,
249
kamailioNetWsConnsActiveMax_oid, OID_LENGTH(kamailioNetWsConnsActiveMax_oid),
252
netsnmp_register_scalar(
253
netsnmp_create_handler_registration("kamailioNetWsConnsFailed", handle_kamailioNetWsConnsFailed,
254
kamailioNetWsConnsFailed_oid, OID_LENGTH(kamailioNetWsConnsFailed_oid),
257
netsnmp_register_scalar(
258
netsnmp_create_handler_registration("kamailioNetWsConnsClosedLocal", handle_kamailioNetWsConnsClosedLocal,
259
kamailioNetWsConnsClosedLocal_oid, OID_LENGTH(kamailioNetWsConnsClosedLocal_oid),
262
netsnmp_register_scalar(
263
netsnmp_create_handler_registration("kamailioNetWsConnsClosedRemote", handle_kamailioNetWsConnsClosedRemote,
264
kamailioNetWsConnsClosedRemote_oid, OID_LENGTH(kamailioNetWsConnsClosedRemote_oid),
267
netsnmp_register_scalar(
268
netsnmp_create_handler_registration("kamailioNetWsFramesRx", handle_kamailioNetWsFramesRx,
269
kamailioNetWsFramesRx_oid, OID_LENGTH(kamailioNetWsFramesRx_oid),
272
netsnmp_register_scalar(
273
netsnmp_create_handler_registration("kamailioNetWsFramesTx", handle_kamailioNetWsFramesTx,
274
kamailioNetWsFramesTx_oid, OID_LENGTH(kamailioNetWsFramesTx_oid),
277
netsnmp_register_scalar(
278
netsnmp_create_handler_registration("kamailioNetWsHandshakeSuccess", handle_kamailioNetWsHandshakeSuccess,
279
kamailioNetWsHandshakeSuccess_oid, OID_LENGTH(kamailioNetWsHandshakeSuccess_oid),
282
netsnmp_register_scalar(
283
netsnmp_create_handler_registration("kamailioNetWsHandshakeFailed", handle_kamailioNetWsHandshakeFailed,
284
kamailioNetWsHandshakeFailed_oid, OID_LENGTH(kamailioNetWsHandshakeFailed_oid),
290
handle_kamailioNetTcpConnEstablished(netsnmp_mib_handler *handler,
291
netsnmp_handler_registration *reginfo,
292
netsnmp_agent_request_info *reqinfo,
293
netsnmp_request_info *requests)
295
/* We are never called for a GETNEXT if it's registered as a
296
"instance", as it's "magically" handled for us. */
298
/* a instance handler also only hands us one request at a time, so
299
we don't need to loop over a list of requests; we'll only get one. */
301
int datafield = get_statistic("established");
303
switch(reqinfo->mode) {
306
snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
307
(u_char *) &datafield, sizeof(int));
312
/* we should never get here, so this is a really bad error */
313
snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetTcpConnEstablished\n", reqinfo->mode );
314
return SNMP_ERR_GENERR;
317
return SNMP_ERR_NOERROR;
320
handle_kamailioNetTcpConnFailed(netsnmp_mib_handler *handler,
321
netsnmp_handler_registration *reginfo,
322
netsnmp_agent_request_info *reqinfo,
323
netsnmp_request_info *requests)
326
int datafield = get_statistic("connect_failed");
328
switch(reqinfo->mode) {
331
snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
332
(u_char *) &datafield, sizeof(int));
337
/* we should never get here, so this is a really bad error */
338
snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetTcpConnFailed\n", reqinfo->mode );
339
return SNMP_ERR_GENERR;
342
return SNMP_ERR_NOERROR;
345
handle_kamailioNetTcpConnReset(netsnmp_mib_handler *handler,
346
netsnmp_handler_registration *reginfo,
347
netsnmp_agent_request_info *reqinfo,
348
netsnmp_request_info *requests)
350
int datafield = get_statistic("con_reset");
352
switch(reqinfo->mode) {
355
snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
356
(u_char *) &datafield, sizeof(int));
361
/* we should never get here, so this is a really bad error */
362
snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetTcpConnReset\n", reqinfo->mode );
363
return SNMP_ERR_GENERR;
366
return SNMP_ERR_NOERROR;
369
handle_kamailioNetTcpConnSuccess(netsnmp_mib_handler *handler,
370
netsnmp_handler_registration *reginfo,
371
netsnmp_agent_request_info *reqinfo,
372
netsnmp_request_info *requests)
375
int datafield = get_statistic("connect_success");
377
switch(reqinfo->mode) {
380
snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
381
(u_char *) &datafield, sizeof(int));
386
/* we should never get here, so this is a really bad error */
387
snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetTcpConnSuccess\n", reqinfo->mode );
388
return SNMP_ERR_GENERR;
391
return SNMP_ERR_NOERROR;
394
handle_kamailioNetTcpConnOpen(netsnmp_mib_handler *handler,
395
netsnmp_handler_registration *reginfo,
396
netsnmp_agent_request_info *reqinfo,
397
netsnmp_request_info *requests)
399
int datafield = get_statistic("current_opened_connections");
400
switch(reqinfo->mode) {
403
snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE,
404
(u_char *) &datafield, sizeof(int));
409
/* we should never get here, so this is a really bad error */
410
snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetTcpConnOpen\n", reqinfo->mode );
411
return SNMP_ERR_GENERR;
414
return SNMP_ERR_NOERROR;
417
handle_kamailioNetTcpConnPassiveOpen(netsnmp_mib_handler *handler,
418
netsnmp_handler_registration *reginfo,
419
netsnmp_agent_request_info *reqinfo,
420
netsnmp_request_info *requests)
422
int datafield = get_statistic("passive_open");
424
switch(reqinfo->mode) {
427
snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
428
(u_char *) &datafield, sizeof(int));
433
/* we should never get here, so this is a really bad error */
434
snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetTcpConnPassiveOpen\n", reqinfo->mode );
435
return SNMP_ERR_GENERR;
438
return SNMP_ERR_NOERROR;
441
handle_kamailioNetTcpConnReject(netsnmp_mib_handler *handler,
442
netsnmp_handler_registration *reginfo,
443
netsnmp_agent_request_info *reqinfo,
444
netsnmp_request_info *requests)
446
/* We are never called for a GETNEXT if it's registered as a
447
"instance", as it's "magically" handled for us. */
449
/* a instance handler also only hands us one request at a time, so
450
we don't need to loop over a list of requests; we'll only get one. */
451
int datafield = get_statistic("local_reject");
453
switch(reqinfo->mode) {
456
snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
457
(u_char *) &datafield, sizeof(int));
462
/* we should never get here, so this is a really bad error */
463
snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetTcpConnReject\n", reqinfo->mode );
464
return SNMP_ERR_GENERR;
467
return SNMP_ERR_NOERROR;
470
handle_kamailioNetTcpEnabled(netsnmp_mib_handler *handler,
471
netsnmp_handler_registration *reginfo,
472
netsnmp_agent_request_info *reqinfo,
473
netsnmp_request_info *requests)
475
/* We are never called for a GETNEXT if it's registered as a
476
"instance", as it's "magically" handled for us. */
478
/* a instance handler also only hands us one request at a time, so
479
we don't need to loop over a list of requests; we'll only get one. */
480
int enabled = (tcp_disable == 0);
482
switch(reqinfo->mode) {
485
snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
486
(u_char *) &enabled, sizeof(int));
491
/* we should never get here, so this is a really bad error */
492
snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetTcpEnabled\n", reqinfo->mode );
493
return SNMP_ERR_GENERR;
496
return SNMP_ERR_NOERROR;
500
handle_kamailioNetTcpMaxConns(netsnmp_mib_handler *handler,
501
netsnmp_handler_registration *reginfo,
502
netsnmp_agent_request_info *reqinfo,
503
netsnmp_request_info *requests)
505
struct cfg_group_tcp t;
506
unsigned int maxconn;
509
maxconn = t.max_connections;
511
switch(reqinfo->mode) {
514
snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
515
(u_char *) &maxconn, sizeof(int));
520
/* we should never get here, so this is a really bad error */
521
snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetTcpMaxConns\n", reqinfo->mode );
522
return SNMP_ERR_GENERR;
525
return SNMP_ERR_NOERROR;
528
handle_kamailioNetTcpAsync(netsnmp_mib_handler *handler,
529
netsnmp_handler_registration *reginfo,
530
netsnmp_agent_request_info *reqinfo,
531
netsnmp_request_info *requests)
533
struct cfg_group_tcp t;
538
/* We are never called for a GETNEXT if it's registered as a
539
"instance", as it's "magically" handled for us. */
541
/* a instance handler also only hands us one request at a time, so
542
we don't need to loop over a list of requests; we'll only get one. */
544
switch(reqinfo->mode) {
547
snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
548
(u_char *) &value, sizeof(int));
553
/* we should never get here, so this is a really bad error */
554
snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetTcpAsync\n", reqinfo->mode );
555
return SNMP_ERR_GENERR;
558
return SNMP_ERR_NOERROR;
562
handle_kamailioNetTcpConnTimeout(netsnmp_mib_handler *handler,
563
netsnmp_handler_registration *reginfo,
564
netsnmp_agent_request_info *reqinfo,
565
netsnmp_request_info *requests)
567
struct cfg_group_tcp t;
571
value = t.connect_timeout_s;
573
switch(reqinfo->mode) {
576
snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
577
(u_char *) &value, sizeof(int));
582
/* we should never get here, so this is a really bad error */
583
snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetTcpConnTimeout\n", reqinfo->mode );
584
return SNMP_ERR_GENERR;
587
return SNMP_ERR_NOERROR;
590
handle_kamailioNetTcpSendTimeout(netsnmp_mib_handler *handler,
591
netsnmp_handler_registration *reginfo,
592
netsnmp_agent_request_info *reqinfo,
593
netsnmp_request_info *requests)
595
struct cfg_group_tcp t;
599
value = t.send_timeout;
601
switch(reqinfo->mode) {
604
snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
605
(u_char *) &value, sizeof(int));
610
/* we should never get here, so this is a really bad error */
611
snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetTcpSendTimeout\n", reqinfo->mode );
612
return SNMP_ERR_GENERR;
615
return SNMP_ERR_NOERROR;
618
handle_kamailioNetTcpConnLifetime(netsnmp_mib_handler *handler,
619
netsnmp_handler_registration *reginfo,
620
netsnmp_agent_request_info *reqinfo,
621
netsnmp_request_info *requests)
623
struct cfg_group_tcp t;
627
value = t.con_lifetime;
629
switch(reqinfo->mode) {
632
snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
633
(u_char *) &value, sizeof(int));
638
/* we should never get here, so this is a really bad error */
639
snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetTcpConnLifetime\n", reqinfo->mode );
640
return SNMP_ERR_GENERR;
643
return SNMP_ERR_NOERROR;
647
handle_kamailioNetTcpNoConnect(netsnmp_mib_handler *handler,
648
netsnmp_handler_registration *reginfo,
649
netsnmp_agent_request_info *reqinfo,
650
netsnmp_request_info *requests)
652
struct cfg_group_tcp t;
656
value = t.no_connect;
658
switch(reqinfo->mode) {
661
snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
662
(u_char *) &value, sizeof(int));
667
/* we should never get here, so this is a really bad error */
668
snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetTcpNoConnect\n", reqinfo->mode );
669
return SNMP_ERR_GENERR;
672
return SNMP_ERR_NOERROR;
675
handle_kamailioNetTcpFdCache(netsnmp_mib_handler *handler,
676
netsnmp_handler_registration *reginfo,
677
netsnmp_agent_request_info *reqinfo,
678
netsnmp_request_info *requests)
680
struct cfg_group_tcp t;
684
value = t.con_lifetime;
686
switch(reqinfo->mode) {
689
snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
690
(u_char *) &value, sizeof(int));
695
/* we should never get here, so this is a really bad error */
696
snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetTcpFdCache\n", reqinfo->mode );
697
return SNMP_ERR_GENERR;
700
return SNMP_ERR_NOERROR;
704
handle_kamailioNetTcpAsyncConnWait(netsnmp_mib_handler *handler,
705
netsnmp_handler_registration *reginfo,
706
netsnmp_agent_request_info *reqinfo,
707
netsnmp_request_info *requests)
709
struct cfg_group_tcp t;
713
value = t.tcp_connect_wait;
715
switch(reqinfo->mode) {
718
snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
719
(u_char *) &value, sizeof(int));
724
/* we should never get here, so this is a really bad error */
725
snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetTcpAsyncConnWait\n", reqinfo->mode );
726
return SNMP_ERR_GENERR;
729
return SNMP_ERR_NOERROR;
733
handle_kamailioNetTcpAsyncConnWqMax(netsnmp_mib_handler *handler,
734
netsnmp_handler_registration *reginfo,
735
netsnmp_agent_request_info *reqinfo,
736
netsnmp_request_info *requests)
738
struct cfg_group_tcp t;
742
value = t.tcpconn_wq_max;
744
switch(reqinfo->mode) {
747
snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
748
(u_char *) &value, sizeof(int));
753
/* we should never get here, so this is a really bad error */
754
snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetTcpAsyncConnWqMax\n", reqinfo->mode );
755
return SNMP_ERR_GENERR;
758
return SNMP_ERR_NOERROR;
762
handle_kamailioNetTcpAsyncWqMax(netsnmp_mib_handler *handler,
763
netsnmp_handler_registration *reginfo,
764
netsnmp_agent_request_info *reqinfo,
765
netsnmp_request_info *requests)
767
struct cfg_group_tcp t;
771
value = t.tcp_wq_max;
773
switch(reqinfo->mode) {
776
snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
777
(u_char *) &value, sizeof(int));
782
/* we should never get here, so this is a really bad error */
783
snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetTcpAsyncWqMax\n", reqinfo->mode );
784
return SNMP_ERR_GENERR;
787
return SNMP_ERR_NOERROR;
791
handle_kamailioNetTcpRdBufSize(netsnmp_mib_handler *handler,
792
netsnmp_handler_registration *reginfo,
793
netsnmp_agent_request_info *reqinfo,
794
netsnmp_request_info *requests)
796
struct cfg_group_tcp t;
800
value = t.rd_buf_size;
802
switch(reqinfo->mode) {
805
snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
806
(u_char *) &value, sizeof(int));
811
/* we should never get here, so this is a really bad error */
812
snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetTcpRdBufSize\n", reqinfo->mode );
813
return SNMP_ERR_GENERR;
816
return SNMP_ERR_NOERROR;
820
handle_kamailioNetTcpDeferAccept(netsnmp_mib_handler *handler,
821
netsnmp_handler_registration *reginfo,
822
netsnmp_agent_request_info *reqinfo,
823
netsnmp_request_info *requests)
825
struct cfg_group_tcp t;
829
value = t.defer_accept;
831
switch(reqinfo->mode) {
834
snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
835
(u_char *) &value, sizeof(int));
840
/* we should never get here, so this is a really bad error */
841
snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetTcpDeferAccept\n", reqinfo->mode );
842
return SNMP_ERR_GENERR;
845
return SNMP_ERR_NOERROR;
849
handle_kamailioNetTcpDelayedAck(netsnmp_mib_handler *handler,
850
netsnmp_handler_registration *reginfo,
851
netsnmp_agent_request_info *reqinfo,
852
netsnmp_request_info *requests)
854
struct cfg_group_tcp t;
858
value = t.delayed_ack;
860
switch(reqinfo->mode) {
863
snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
864
(u_char *) &value, sizeof(int));
869
/* we should never get here, so this is a really bad error */
870
snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetTcpDelayedAck\n", reqinfo->mode );
871
return SNMP_ERR_GENERR;
874
return SNMP_ERR_NOERROR;
878
handle_kamailioNetTcpSynCnt(netsnmp_mib_handler *handler,
879
netsnmp_handler_registration *reginfo,
880
netsnmp_agent_request_info *reqinfo,
881
netsnmp_request_info *requests)
883
struct cfg_group_tcp t;
889
switch(reqinfo->mode) {
892
snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
893
(u_char *) &value, sizeof(int));
898
/* we should never get here, so this is a really bad error */
899
snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetTcpSynCnt\n", reqinfo->mode );
900
return SNMP_ERR_GENERR;
903
return SNMP_ERR_NOERROR;
907
handle_kamailioNetTcpLinger(netsnmp_mib_handler *handler,
908
netsnmp_handler_registration *reginfo,
909
netsnmp_agent_request_info *reqinfo,
910
netsnmp_request_info *requests)
912
struct cfg_group_tcp t;
918
switch(reqinfo->mode) {
921
snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
922
(u_char *) &value, sizeof(int));
927
/* we should never get here, so this is a really bad error */
928
snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetTcpLinger\n", reqinfo->mode );
929
return SNMP_ERR_GENERR;
932
return SNMP_ERR_NOERROR;
936
handle_kamailioNetTcpKeepAlive(netsnmp_mib_handler *handler,
937
netsnmp_handler_registration *reginfo,
938
netsnmp_agent_request_info *reqinfo,
939
netsnmp_request_info *requests)
941
struct cfg_group_tcp t;
947
switch(reqinfo->mode) {
950
snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
951
(u_char *) &value, sizeof(int));
956
/* we should never get here, so this is a really bad error */
957
snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetTcpKeepAlive\n", reqinfo->mode );
958
return SNMP_ERR_GENERR;
961
return SNMP_ERR_NOERROR;
964
handle_kamailioNetTcpKeepIdle(netsnmp_mib_handler *handler,
965
netsnmp_handler_registration *reginfo,
966
netsnmp_agent_request_info *reqinfo,
967
netsnmp_request_info *requests)
969
struct cfg_group_tcp t;
975
switch(reqinfo->mode) {
977
struct cfg_group_tcp t;
981
value = t.con_lifetime;
983
snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
984
(u_char *) &value, sizeof(int));
989
/* we should never get here, so this is a really bad error */
990
snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetTcpKeepIdle\n", reqinfo->mode );
991
return SNMP_ERR_GENERR;
994
return SNMP_ERR_NOERROR;
998
handle_kamailioNetTcpKeepIntvl(netsnmp_mib_handler *handler,
999
netsnmp_handler_registration *reginfo,
1000
netsnmp_agent_request_info *reqinfo,
1001
netsnmp_request_info *requests)
1003
struct cfg_group_tcp t;
1006
tcp_options_get(&t);
1007
value = t.keepintvl;
1009
switch(reqinfo->mode) {
1012
snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
1013
(u_char *) &value, sizeof(int));
1018
/* we should never get here, so this is a really bad error */
1019
snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetTcpKeepIntvl\n", reqinfo->mode );
1020
return SNMP_ERR_GENERR;
1023
return SNMP_ERR_NOERROR;
1027
handle_kamailioNetTcpKeepCnt(netsnmp_mib_handler *handler,
1028
netsnmp_handler_registration *reginfo,
1029
netsnmp_agent_request_info *reqinfo,
1030
netsnmp_request_info *requests)
1032
struct cfg_group_tcp t;
1035
tcp_options_get(&t);
1038
switch(reqinfo->mode) {
1041
snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
1042
(u_char *) &value, sizeof(int));
1047
/* we should never get here, so this is a really bad error */
1048
snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetTcpKeepCnt\n", reqinfo->mode );
1049
return SNMP_ERR_GENERR;
1052
return SNMP_ERR_NOERROR;
1056
handle_kamailioNetTcpCrlfPing(netsnmp_mib_handler *handler,
1057
netsnmp_handler_registration *reginfo,
1058
netsnmp_agent_request_info *reqinfo,
1059
netsnmp_request_info *requests)
1061
struct cfg_group_tcp t;
1064
tcp_options_get(&t);
1065
value = t.crlf_ping;
1067
switch(reqinfo->mode) {
1070
snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
1071
(u_char *) &value, sizeof(int));
1076
/* we should never get here, so this is a really bad error */
1077
snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetTcpCrlfPing\n", reqinfo->mode );
1078
return SNMP_ERR_GENERR;
1081
return SNMP_ERR_NOERROR;
1085
handle_kamailioNetTcpAcceptAliases(netsnmp_mib_handler *handler,
1086
netsnmp_handler_registration *reginfo,
1087
netsnmp_agent_request_info *reqinfo,
1088
netsnmp_request_info *requests)
1090
struct cfg_group_tcp t;
1093
tcp_options_get(&t);
1094
value = t.accept_aliases;
1096
switch(reqinfo->mode) {
1099
snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
1100
(u_char *) &value, sizeof(int));
1105
/* we should never get here, so this is a really bad error */
1106
snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetTcpAcceptAliases\n", reqinfo->mode );
1107
return SNMP_ERR_GENERR;
1110
return SNMP_ERR_NOERROR;
1113
int handle_kamailioNetTcpAcceptNoCl(netsnmp_mib_handler *handler,
1114
netsnmp_handler_registration *reginfo,
1115
netsnmp_agent_request_info *reqinfo,
1116
netsnmp_request_info *requests)
1118
struct cfg_group_tcp t;
1121
tcp_options_get(&t);
1122
value = t.accept_no_cl;
1124
switch(reqinfo->mode) {
1127
snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
1128
(u_char *) &value, sizeof(int));
1133
/* we should never get here, so this is a really bad error */
1134
snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetTcpAcceptNoCl\n", reqinfo->mode );
1135
return SNMP_ERR_GENERR;
1138
return SNMP_ERR_NOERROR;
1141
int handle_kamailioNetWsConnsActive(netsnmp_mib_handler *handler,
1142
netsnmp_handler_registration *reginfo,
1143
netsnmp_agent_request_info *reqinfo,
1144
netsnmp_request_info *requests)
1146
int datafield = get_statistic("ws_current_connections");
1148
switch(reqinfo->mode) {
1150
snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE,
1151
(u_char *) &datafield, sizeof(int));
1156
/* we should never get here, so this is a really bad error */
1157
snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetWsConnsActive\n", reqinfo->mode );
1158
return SNMP_ERR_GENERR;
1161
return SNMP_ERR_NOERROR;
1164
handle_kamailioNetWsConnsActiveMax(netsnmp_mib_handler *handler,
1165
netsnmp_handler_registration *reginfo,
1166
netsnmp_agent_request_info *reqinfo,
1167
netsnmp_request_info *requests)
1169
int datafield = get_statistic("ws_max_concurrent_connections");
1171
switch(reqinfo->mode) {
1174
snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE,
1175
(u_char *) &datafield, sizeof(int));
1180
/* we should never get here, so this is a really bad error */
1181
snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetWsConnsActiveMax\n", reqinfo->mode );
1182
return SNMP_ERR_GENERR;
1185
return SNMP_ERR_NOERROR;
1188
handle_kamailioNetWsConnsFailed(netsnmp_mib_handler *handler,
1189
netsnmp_handler_registration *reginfo,
1190
netsnmp_agent_request_info *reqinfo,
1191
netsnmp_request_info *requests)
1193
int datafield = get_statistic("ws_failed_connections");
1195
switch(reqinfo->mode) {
1198
snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
1199
(u_char *) &datafield, sizeof(int));
1204
/* we should never get here, so this is a really bad error */
1205
snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetWsConnsFailed\n", reqinfo->mode );
1206
return SNMP_ERR_GENERR;
1209
return SNMP_ERR_NOERROR;
1212
handle_kamailioNetWsConnsClosedLocal(netsnmp_mib_handler *handler,
1213
netsnmp_handler_registration *reginfo,
1214
netsnmp_agent_request_info *reqinfo,
1215
netsnmp_request_info *requests)
1217
int datafield = get_statistic("ws_local_closed_connections");
1219
switch(reqinfo->mode) {
1222
snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
1223
(u_char *) &datafield, sizeof(int));
1228
/* we should never get here, so this is a really bad error */
1229
snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetWsConnsClosedLocal\n", reqinfo->mode );
1230
return SNMP_ERR_GENERR;
1233
return SNMP_ERR_NOERROR;
1236
handle_kamailioNetWsConnsClosedRemote(netsnmp_mib_handler *handler,
1237
netsnmp_handler_registration *reginfo,
1238
netsnmp_agent_request_info *reqinfo,
1239
netsnmp_request_info *requests)
1241
int datafield = get_statistic("ws_remote_closed_connections");
1243
switch(reqinfo->mode) {
1246
snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
1247
(u_char *) &datafield, sizeof(int));
1252
/* we should never get here, so this is a really bad error */
1253
snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetWsConnsClosedRemote\n", reqinfo->mode );
1254
return SNMP_ERR_GENERR;
1257
return SNMP_ERR_NOERROR;
1260
handle_kamailioNetWsFramesRx(netsnmp_mib_handler *handler,
1261
netsnmp_handler_registration *reginfo,
1262
netsnmp_agent_request_info *reqinfo,
1263
netsnmp_request_info *requests)
1265
int datafield = get_statistic("ws_received_frames");
1267
switch(reqinfo->mode) {
1270
snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
1271
(u_char *) &datafield, sizeof(int));
1276
/* we should never get here, so this is a really bad error */
1277
snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetWsFramesRx\n", reqinfo->mode );
1278
return SNMP_ERR_GENERR;
1281
return SNMP_ERR_NOERROR;
1284
handle_kamailioNetWsFramesTx(netsnmp_mib_handler *handler,
1285
netsnmp_handler_registration *reginfo,
1286
netsnmp_agent_request_info *reqinfo,
1287
netsnmp_request_info *requests)
1289
int datafield = get_statistic("ws_transmitted_frames");
1291
switch(reqinfo->mode) {
1294
snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
1295
(u_char *) &datafield, sizeof(int));
1300
/* we should never get here, so this is a really bad error */
1301
snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetWsFramesTx\n", reqinfo->mode );
1302
return SNMP_ERR_GENERR;
1305
return SNMP_ERR_NOERROR;
1308
handle_kamailioNetWsHandshakeSuccess(netsnmp_mib_handler *handler,
1309
netsnmp_handler_registration *reginfo,
1310
netsnmp_agent_request_info *reqinfo,
1311
netsnmp_request_info *requests)
1313
int datafield = get_statistic("ws_successful_handshakes");
1315
switch(reqinfo->mode) {
1318
snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
1319
(u_char *) &datafield, sizeof(int));
1324
/* we should never get here, so this is a really bad error */
1325
snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetWsHandshakeSuccess\n", reqinfo->mode );
1326
return SNMP_ERR_GENERR;
1329
return SNMP_ERR_NOERROR;
1332
handle_kamailioNetWsHandshakeFailed(netsnmp_mib_handler *handler,
1333
netsnmp_handler_registration *reginfo,
1334
netsnmp_agent_request_info *reqinfo,
1335
netsnmp_request_info *requests)
1337
int datafield = get_statistic("ws_failed_handshakes");
1339
switch(reqinfo->mode) {
1342
snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
1343
(u_char *) &datafield, sizeof(int));
1348
/* we should never get here, so this is a really bad error */
1349
snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetWsHandshakeFailed\n", reqinfo->mode );
1350
return SNMP_ERR_GENERR;
1353
return SNMP_ERR_NOERROR;