~ubuntu-branches/debian/sid/kamailio/sid

« back to all changes in this revision

Viewing changes to modules/snmpstats/kamailioNet.c

  • Committer: Package Import Robot
  • Author(s): Victor Seva
  • Date: 2014-01-06 11:47:13 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20140106114713-t8xidp4arzrnyeya
Tags: 4.1.1-1
* New upstream release
* debian/patches:
  - add upstream fixes
* Added tls outbound websocket autheph dnssec modules
  - openssl exception added to their license
* removing sparc and ia64 from supported archs
  for mono module (Closes: #728915)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * SNMPStats Module  - Network Statistics
 
3
 *
 
4
 * Kamailio Server Net objects addition
 
5
 * Copyright (C) 2013 Edvina AB, Sollentuna, Sweden
 
6
 * Written by Olle E. Johansson
 
7
 *
 
8
 * This file is part of Kamailio, a free SIP server.
 
9
 *
 
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
 
14
 *
 
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.
 
19
 *
 
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
 
23
 * USA
 
24
 *
 
25
 * History:
 
26
 * --------
 
27
 * 2013-03-24 initial version (oej)
 
28
 * 
 
29
 * Note: this file originally auto-generated by mib2c 
 
30
 *
 
31
 */
 
32
 
 
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"
 
37
 
 
38
#include "snmpstats_globals.h"
 
39
#include "utilities.h"
 
40
#include "../../lib/kcore/statistics.h"
 
41
#include "../../globals.h"
 
42
#include "../../tcp_options.h"
 
43
 
 
44
/** Initializes the kamailioNet module */
 
45
void
 
46
init_kamailioNet(void)
 
47
{
 
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 };
 
78
 
 
79
    /* WebSockets */
 
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 };
 
89
 
 
90
  DEBUGMSGTL(("kamailioNet", "Initializing\n"));
 
91
 
 
92
    netsnmp_register_scalar(
 
93
        netsnmp_create_handler_registration("kamailioNetTcpConnEstablished", handle_kamailioNetTcpConnEstablished,
 
94
                               kamailioNetTcpConnEstablished_oid, OID_LENGTH(kamailioNetTcpConnEstablished_oid),
 
95
                               HANDLER_CAN_RONLY
 
96
        ));
 
97
    netsnmp_register_scalar(
 
98
        netsnmp_create_handler_registration("kamailioNetTcpConnFailed", handle_kamailioNetTcpConnFailed,
 
99
                               kamailioNetTcpConnFailed_oid, OID_LENGTH(kamailioNetTcpConnFailed_oid),
 
100
                               HANDLER_CAN_RONLY
 
101
        ));
 
102
    netsnmp_register_scalar(
 
103
        netsnmp_create_handler_registration("kamailioNetTcpConnReset", handle_kamailioNetTcpConnReset,
 
104
                               kamailioNetTcpConnReset_oid, OID_LENGTH(kamailioNetTcpConnReset_oid),
 
105
                               HANDLER_CAN_RONLY
 
106
        ));
 
107
    netsnmp_register_scalar(
 
108
        netsnmp_create_handler_registration("kamailioNetTcpConnSuccess", handle_kamailioNetTcpConnSuccess,
 
109
                               kamailioNetTcpConnSuccess_oid, OID_LENGTH(kamailioNetTcpConnSuccess_oid),
 
110
                               HANDLER_CAN_RONLY
 
111
        ));
 
112
    netsnmp_register_scalar(
 
113
        netsnmp_create_handler_registration("kamailioNetTcpConnOped", handle_kamailioNetTcpConnOpen,
 
114
                               kamailioNetTcpConnOpen_oid, OID_LENGTH(kamailioNetTcpConnOpen_oid),
 
115
                               HANDLER_CAN_RONLY
 
116
        ));
 
117
    netsnmp_register_scalar(
 
118
        netsnmp_create_handler_registration("kamailioNetTcpConnPassiveOpen", handle_kamailioNetTcpConnPassiveOpen,
 
119
                               kamailioNetTcpConnPassiveOpen_oid, OID_LENGTH(kamailioNetTcpConnPassiveOpen_oid),
 
120
                               HANDLER_CAN_RONLY
 
121
        ));
 
122
    netsnmp_register_scalar(
 
123
        netsnmp_create_handler_registration("kamailioNetTcpConnReject", handle_kamailioNetTcpConnReject,
 
124
                               kamailioNetTcpConnReject_oid, OID_LENGTH(kamailioNetTcpConnReject_oid),
 
125
                               HANDLER_CAN_RONLY
 
126
        ));
 
127
    netsnmp_register_scalar(
 
128
        netsnmp_create_handler_registration("kamailioNetTcpEnabled", handle_kamailioNetTcpEnabled,
 
129
                               kamailioNetTcpEnabled_oid, OID_LENGTH(kamailioNetTcpEnabled_oid),
 
130
                               HANDLER_CAN_RONLY
 
131
        ));
 
132
    netsnmp_register_scalar(
 
133
        netsnmp_create_handler_registration("kamailioNetTcpMaxConns", handle_kamailioNetTcpMaxConns,
 
134
                               kamailioNetTcpMaxConns_oid, OID_LENGTH(kamailioNetTcpMaxConns_oid),
 
135
                               HANDLER_CAN_RONLY
 
136
        ));
 
137
    netsnmp_register_scalar(
 
138
        netsnmp_create_handler_registration("kamailioNetTcpConnTimeout", handle_kamailioNetTcpConnTimeout,
 
139
                               kamailioNetTcpConnTimeout_oid, OID_LENGTH(kamailioNetTcpConnTimeout_oid),
 
140
                               HANDLER_CAN_RONLY
 
141
        ));
 
142
    netsnmp_register_scalar(
 
143
        netsnmp_create_handler_registration("kamailioNetTcpSendTimeout", handle_kamailioNetTcpSendTimeout,
 
144
                               kamailioNetTcpSendTimeout_oid, OID_LENGTH(kamailioNetTcpSendTimeout_oid),
 
145
                               HANDLER_CAN_RONLY
 
146
        ));
 
147
    netsnmp_register_scalar(
 
148
        netsnmp_create_handler_registration("kamailioNetTcpConnLifetime", handle_kamailioNetTcpConnLifetime,
 
149
                               kamailioNetTcpConnLifetime_oid, OID_LENGTH(kamailioNetTcpConnLifetime_oid),
 
150
                               HANDLER_CAN_RONLY
 
151
        ));
 
152
    netsnmp_register_scalar(
 
153
        netsnmp_create_handler_registration("kamailioNetTcpNoConnect", handle_kamailioNetTcpNoConnect,
 
154
                               kamailioNetTcpNoConnect_oid, OID_LENGTH(kamailioNetTcpNoConnect_oid),
 
155
                               HANDLER_CAN_RONLY
 
156
        ));
 
157
    netsnmp_register_scalar(
 
158
        netsnmp_create_handler_registration("kamailioNetTcpFdCache", handle_kamailioNetTcpFdCache,
 
159
                               kamailioNetTcpFdCache_oid, OID_LENGTH(kamailioNetTcpFdCache_oid),
 
160
                               HANDLER_CAN_RONLY
 
161
        ));
 
162
    netsnmp_register_scalar(
 
163
        netsnmp_create_handler_registration("kamailioNetTcpAsync", handle_kamailioNetTcpAsync,
 
164
                               kamailioNetTcpAsync_oid, OID_LENGTH(kamailioNetTcpAsync_oid),
 
165
                               HANDLER_CAN_RONLY
 
166
        ));
 
167
    netsnmp_register_scalar(
 
168
        netsnmp_create_handler_registration("kamailioNetTcpAsyncConnWait", handle_kamailioNetTcpAsyncConnWait,
 
169
                               kamailioNetTcpAsyncConnWait_oid, OID_LENGTH(kamailioNetTcpAsyncConnWait_oid),
 
170
                               HANDLER_CAN_RONLY
 
171
        ));
 
172
    netsnmp_register_scalar(
 
173
        netsnmp_create_handler_registration("kamailioNetTcpAsyncConnWqMax", handle_kamailioNetTcpAsyncConnWqMax,
 
174
                               kamailioNetTcpAsyncConnWqMax_oid, OID_LENGTH(kamailioNetTcpAsyncConnWqMax_oid),
 
175
                               HANDLER_CAN_RONLY
 
176
        ));
 
177
    netsnmp_register_scalar(
 
178
        netsnmp_create_handler_registration("kamailioNetTcpAsyncWqMax", handle_kamailioNetTcpAsyncWqMax,
 
179
                               kamailioNetTcpAsyncWqMax_oid, OID_LENGTH(kamailioNetTcpAsyncWqMax_oid),
 
180
                               HANDLER_CAN_RONLY
 
181
        ));
 
182
    netsnmp_register_scalar(
 
183
        netsnmp_create_handler_registration("kamailioNetTcpRdBufSize", handle_kamailioNetTcpRdBufSize,
 
184
                               kamailioNetTcpRdBufSize_oid, OID_LENGTH(kamailioNetTcpRdBufSize_oid),
 
185
                               HANDLER_CAN_RONLY
 
186
        ));
 
187
    netsnmp_register_scalar(
 
188
        netsnmp_create_handler_registration("kamailioNetTcpDeferAccept", handle_kamailioNetTcpDeferAccept,
 
189
                               kamailioNetTcpDeferAccept_oid, OID_LENGTH(kamailioNetTcpDeferAccept_oid),
 
190
                               HANDLER_CAN_RONLY
 
191
        ));
 
192
    netsnmp_register_scalar(
 
193
        netsnmp_create_handler_registration("kamailioNetTcpDelayedAck", handle_kamailioNetTcpDelayedAck,
 
194
                               kamailioNetTcpDelayedAck_oid, OID_LENGTH(kamailioNetTcpDelayedAck_oid),
 
195
                               HANDLER_CAN_RONLY
 
196
        ));
 
197
    netsnmp_register_scalar(
 
198
        netsnmp_create_handler_registration("kamailioNetTcpSynCnt", handle_kamailioNetTcpSynCnt,
 
199
                               kamailioNetTcpSynCnt_oid, OID_LENGTH(kamailioNetTcpSynCnt_oid),
 
200
                               HANDLER_CAN_RONLY
 
201
        ));
 
202
    netsnmp_register_scalar(
 
203
        netsnmp_create_handler_registration("kamailioNetTcpLinger", handle_kamailioNetTcpLinger,
 
204
                               kamailioNetTcpLinger_oid, OID_LENGTH(kamailioNetTcpLinger_oid),
 
205
                               HANDLER_CAN_RONLY
 
206
        ));
 
207
    netsnmp_register_scalar(
 
208
        netsnmp_create_handler_registration("kamailioNetTcpKeepAlive", handle_kamailioNetTcpKeepAlive,
 
209
                               kamailioNetTcpKeepAlive_oid, OID_LENGTH(kamailioNetTcpKeepAlive_oid),
 
210
                               HANDLER_CAN_RONLY
 
211
        ));
 
212
    netsnmp_register_scalar(
 
213
        netsnmp_create_handler_registration("kamailioNetTcpKeepIdle", handle_kamailioNetTcpKeepIdle,
 
214
                               kamailioNetTcpKeepIdle_oid, OID_LENGTH(kamailioNetTcpKeepIdle_oid),
 
215
                               HANDLER_CAN_RONLY
 
216
        ));
 
217
    netsnmp_register_scalar(
 
218
        netsnmp_create_handler_registration("kamailioNetTcpKeepIntvl", handle_kamailioNetTcpKeepIntvl,
 
219
                               kamailioNetTcpKeepIntvl_oid, OID_LENGTH(kamailioNetTcpKeepIntvl_oid),
 
220
                               HANDLER_CAN_RONLY
 
221
        ));
 
222
    netsnmp_register_scalar(
 
223
        netsnmp_create_handler_registration("kamailioNetTcpKeepCnt", handle_kamailioNetTcpKeepCnt,
 
224
                               kamailioNetTcpKeepCnt_oid, OID_LENGTH(kamailioNetTcpKeepCnt_oid),
 
225
                               HANDLER_CAN_RONLY
 
226
        ));
 
227
    netsnmp_register_scalar(
 
228
        netsnmp_create_handler_registration("kamailioNetTcpCrlfPing", handle_kamailioNetTcpCrlfPing,
 
229
                               kamailioNetTcpCrlfPing_oid, OID_LENGTH(kamailioNetTcpCrlfPing_oid),
 
230
                               HANDLER_CAN_RONLY
 
231
        ));
 
232
    netsnmp_register_scalar(
 
233
        netsnmp_create_handler_registration("kamailioNetTcpAcceptAliases", handle_kamailioNetTcpAcceptAliases,
 
234
                               kamailioNetTcpAcceptAliases_oid, OID_LENGTH(kamailioNetTcpAcceptAliases_oid),
 
235
                               HANDLER_CAN_RONLY
 
236
        ));
 
237
    netsnmp_register_scalar(
 
238
        netsnmp_create_handler_registration("kamailioNetTcpAcceptNoCl", handle_kamailioNetTcpAcceptNoCl,
 
239
                               kamailioNetTcpAcceptNoCl_oid, OID_LENGTH(kamailioNetTcpAcceptNoCl_oid),
 
240
                               HANDLER_CAN_RONLY
 
241
        ));
 
242
    netsnmp_register_scalar(
 
243
        netsnmp_create_handler_registration("kamailioNetWsConnsActive", handle_kamailioNetWsConnsActive,
 
244
                               kamailioNetWsConnsActive_oid, OID_LENGTH(kamailioNetWsConnsActive_oid),
 
245
                               HANDLER_CAN_RONLY
 
246
        ));
 
247
    netsnmp_register_scalar(
 
248
        netsnmp_create_handler_registration("kamailioNetWsConnsActiveMax", handle_kamailioNetWsConnsActiveMax,
 
249
                               kamailioNetWsConnsActiveMax_oid, OID_LENGTH(kamailioNetWsConnsActiveMax_oid),
 
250
                               HANDLER_CAN_RONLY
 
251
        ));
 
252
    netsnmp_register_scalar(
 
253
        netsnmp_create_handler_registration("kamailioNetWsConnsFailed", handle_kamailioNetWsConnsFailed,
 
254
                               kamailioNetWsConnsFailed_oid, OID_LENGTH(kamailioNetWsConnsFailed_oid),
 
255
                               HANDLER_CAN_RONLY
 
256
        ));
 
257
    netsnmp_register_scalar(
 
258
        netsnmp_create_handler_registration("kamailioNetWsConnsClosedLocal", handle_kamailioNetWsConnsClosedLocal,
 
259
                               kamailioNetWsConnsClosedLocal_oid, OID_LENGTH(kamailioNetWsConnsClosedLocal_oid),
 
260
                               HANDLER_CAN_RONLY
 
261
        ));
 
262
    netsnmp_register_scalar(
 
263
        netsnmp_create_handler_registration("kamailioNetWsConnsClosedRemote", handle_kamailioNetWsConnsClosedRemote,
 
264
                               kamailioNetWsConnsClosedRemote_oid, OID_LENGTH(kamailioNetWsConnsClosedRemote_oid),
 
265
                               HANDLER_CAN_RONLY
 
266
        ));
 
267
    netsnmp_register_scalar(
 
268
        netsnmp_create_handler_registration("kamailioNetWsFramesRx", handle_kamailioNetWsFramesRx,
 
269
                               kamailioNetWsFramesRx_oid, OID_LENGTH(kamailioNetWsFramesRx_oid),
 
270
                               HANDLER_CAN_RONLY
 
271
        ));
 
272
    netsnmp_register_scalar(
 
273
        netsnmp_create_handler_registration("kamailioNetWsFramesTx", handle_kamailioNetWsFramesTx,
 
274
                               kamailioNetWsFramesTx_oid, OID_LENGTH(kamailioNetWsFramesTx_oid),
 
275
                               HANDLER_CAN_RONLY
 
276
        ));
 
277
    netsnmp_register_scalar(
 
278
        netsnmp_create_handler_registration("kamailioNetWsHandshakeSuccess", handle_kamailioNetWsHandshakeSuccess,
 
279
                               kamailioNetWsHandshakeSuccess_oid, OID_LENGTH(kamailioNetWsHandshakeSuccess_oid),
 
280
                               HANDLER_CAN_RONLY
 
281
        ));
 
282
    netsnmp_register_scalar(
 
283
        netsnmp_create_handler_registration("kamailioNetWsHandshakeFailed", handle_kamailioNetWsHandshakeFailed,
 
284
                               kamailioNetWsHandshakeFailed_oid, OID_LENGTH(kamailioNetWsHandshakeFailed_oid),
 
285
                               HANDLER_CAN_RONLY
 
286
        ));
 
287
}
 
288
 
 
289
int
 
290
handle_kamailioNetTcpConnEstablished(netsnmp_mib_handler *handler,
 
291
                          netsnmp_handler_registration *reginfo,
 
292
                          netsnmp_agent_request_info   *reqinfo,
 
293
                          netsnmp_request_info         *requests)
 
294
{
 
295
    /* We are never called for a GETNEXT if it's registered as a
 
296
       "instance", as it's "magically" handled for us.  */
 
297
 
 
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. */
 
300
 
 
301
        int datafield = get_statistic("established");
 
302
    
 
303
    switch(reqinfo->mode) {
 
304
 
 
305
        case MODE_GET:
 
306
            snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
 
307
                        (u_char *) &datafield, sizeof(int));
 
308
            break;
 
309
 
 
310
 
 
311
        default:
 
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;
 
315
    }
 
316
 
 
317
    return SNMP_ERR_NOERROR;
 
318
}
 
319
int
 
320
handle_kamailioNetTcpConnFailed(netsnmp_mib_handler *handler,
 
321
                          netsnmp_handler_registration *reginfo,
 
322
                          netsnmp_agent_request_info   *reqinfo,
 
323
                          netsnmp_request_info         *requests)
 
324
{
 
325
 
 
326
        int datafield = get_statistic("connect_failed");
 
327
    
 
328
    switch(reqinfo->mode) {
 
329
 
 
330
        case MODE_GET:
 
331
            snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
 
332
                        (u_char *) &datafield, sizeof(int));
 
333
            break;
 
334
 
 
335
 
 
336
        default:
 
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;
 
340
    }
 
341
 
 
342
    return SNMP_ERR_NOERROR;
 
343
}
 
344
int
 
345
handle_kamailioNetTcpConnReset(netsnmp_mib_handler *handler,
 
346
                          netsnmp_handler_registration *reginfo,
 
347
                          netsnmp_agent_request_info   *reqinfo,
 
348
                          netsnmp_request_info         *requests)
 
349
{
 
350
        int datafield = get_statistic("con_reset");
 
351
    
 
352
    switch(reqinfo->mode) {
 
353
 
 
354
        case MODE_GET:
 
355
            snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
 
356
                        (u_char *) &datafield, sizeof(int));
 
357
            break;
 
358
 
 
359
 
 
360
        default:
 
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;
 
364
    }
 
365
 
 
366
    return SNMP_ERR_NOERROR;
 
367
}
 
368
int
 
369
handle_kamailioNetTcpConnSuccess(netsnmp_mib_handler *handler,
 
370
                          netsnmp_handler_registration *reginfo,
 
371
                          netsnmp_agent_request_info   *reqinfo,
 
372
                          netsnmp_request_info         *requests)
 
373
{
 
374
 
 
375
        int datafield = get_statistic("connect_success");
 
376
    
 
377
    switch(reqinfo->mode) {
 
378
 
 
379
        case MODE_GET:
 
380
            snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
 
381
                        (u_char *) &datafield, sizeof(int));
 
382
            break;
 
383
 
 
384
 
 
385
        default:
 
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;
 
389
    }
 
390
 
 
391
    return SNMP_ERR_NOERROR;
 
392
}
 
393
int
 
394
handle_kamailioNetTcpConnOpen(netsnmp_mib_handler *handler,
 
395
                          netsnmp_handler_registration *reginfo,
 
396
                          netsnmp_agent_request_info   *reqinfo,
 
397
                          netsnmp_request_info         *requests)
 
398
{
 
399
        int datafield = get_statistic("current_opened_connections");
 
400
    switch(reqinfo->mode) {
 
401
 
 
402
        case MODE_GET:
 
403
            snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE,
 
404
                        (u_char *) &datafield, sizeof(int));
 
405
            break;
 
406
 
 
407
 
 
408
        default:
 
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;
 
412
    }
 
413
 
 
414
    return SNMP_ERR_NOERROR;
 
415
}
 
416
int
 
417
handle_kamailioNetTcpConnPassiveOpen(netsnmp_mib_handler *handler,
 
418
                          netsnmp_handler_registration *reginfo,
 
419
                          netsnmp_agent_request_info   *reqinfo,
 
420
                          netsnmp_request_info         *requests)
 
421
{
 
422
        int datafield = get_statistic("passive_open");
 
423
    
 
424
    switch(reqinfo->mode) {
 
425
 
 
426
        case MODE_GET:
 
427
            snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
 
428
                        (u_char *) &datafield, sizeof(int));
 
429
            break;
 
430
 
 
431
 
 
432
        default:
 
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;
 
436
    }
 
437
 
 
438
    return SNMP_ERR_NOERROR;
 
439
}
 
440
int
 
441
handle_kamailioNetTcpConnReject(netsnmp_mib_handler *handler,
 
442
                          netsnmp_handler_registration *reginfo,
 
443
                          netsnmp_agent_request_info   *reqinfo,
 
444
                          netsnmp_request_info         *requests)
 
445
{
 
446
    /* We are never called for a GETNEXT if it's registered as a
 
447
       "instance", as it's "magically" handled for us.  */
 
448
 
 
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");
 
452
    
 
453
    switch(reqinfo->mode) {
 
454
 
 
455
        case MODE_GET:
 
456
            snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
 
457
                        (u_char *) &datafield, sizeof(int));
 
458
            break;
 
459
 
 
460
 
 
461
        default:
 
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;
 
465
    }
 
466
 
 
467
    return SNMP_ERR_NOERROR;
 
468
}
 
469
int
 
470
handle_kamailioNetTcpEnabled(netsnmp_mib_handler *handler,
 
471
                          netsnmp_handler_registration *reginfo,
 
472
                          netsnmp_agent_request_info   *reqinfo,
 
473
                          netsnmp_request_info         *requests)
 
474
{
 
475
    /* We are never called for a GETNEXT if it's registered as a
 
476
       "instance", as it's "magically" handled for us.  */
 
477
 
 
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);
 
481
    
 
482
    switch(reqinfo->mode) {
 
483
 
 
484
        case MODE_GET:
 
485
            snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
 
486
                        (u_char *) &enabled, sizeof(int));
 
487
            break;
 
488
 
 
489
 
 
490
        default:
 
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;
 
494
    }
 
495
 
 
496
    return SNMP_ERR_NOERROR;
 
497
}
 
498
 
 
499
int
 
500
handle_kamailioNetTcpMaxConns(netsnmp_mib_handler *handler,
 
501
                          netsnmp_handler_registration *reginfo,
 
502
                          netsnmp_agent_request_info   *reqinfo,
 
503
                          netsnmp_request_info         *requests)
 
504
{
 
505
    struct cfg_group_tcp t;
 
506
    unsigned int maxconn;
 
507
 
 
508
    tcp_options_get(&t);
 
509
    maxconn = t.max_connections;
 
510
 
 
511
    switch(reqinfo->mode) {
 
512
 
 
513
        case MODE_GET:
 
514
            snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
 
515
                         (u_char *) &maxconn, sizeof(int));
 
516
            break;
 
517
 
 
518
 
 
519
        default:
 
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;
 
523
    }
 
524
 
 
525
    return SNMP_ERR_NOERROR;
 
526
}
 
527
int
 
528
handle_kamailioNetTcpAsync(netsnmp_mib_handler *handler,
 
529
                          netsnmp_handler_registration *reginfo,
 
530
                          netsnmp_agent_request_info   *reqinfo,
 
531
                          netsnmp_request_info         *requests)
 
532
{
 
533
    struct cfg_group_tcp t;
 
534
    unsigned int value;
 
535
 
 
536
    tcp_options_get(&t);
 
537
    value = t.async;
 
538
    /* We are never called for a GETNEXT if it's registered as a
 
539
       "instance", as it's "magically" handled for us.  */
 
540
 
 
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. */
 
543
    
 
544
    switch(reqinfo->mode) {
 
545
 
 
546
        case MODE_GET:
 
547
            snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
 
548
                         (u_char *) &value, sizeof(int));
 
549
            break;
 
550
 
 
551
 
 
552
        default:
 
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;
 
556
    }
 
557
 
 
558
    return SNMP_ERR_NOERROR;
 
559
}
 
560
 
 
561
int
 
562
handle_kamailioNetTcpConnTimeout(netsnmp_mib_handler *handler,
 
563
                          netsnmp_handler_registration *reginfo,
 
564
                          netsnmp_agent_request_info   *reqinfo,
 
565
                          netsnmp_request_info         *requests)
 
566
{
 
567
    struct cfg_group_tcp t;
 
568
    unsigned int value;
 
569
 
 
570
    tcp_options_get(&t);
 
571
    value = t.connect_timeout_s;
 
572
    
 
573
    switch(reqinfo->mode) {
 
574
 
 
575
        case MODE_GET:
 
576
            snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
 
577
                         (u_char *) &value, sizeof(int));
 
578
            break;
 
579
 
 
580
 
 
581
        default:
 
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;
 
585
    }
 
586
 
 
587
    return SNMP_ERR_NOERROR;
 
588
}
 
589
int
 
590
handle_kamailioNetTcpSendTimeout(netsnmp_mib_handler *handler,
 
591
                          netsnmp_handler_registration *reginfo,
 
592
                          netsnmp_agent_request_info   *reqinfo,
 
593
                          netsnmp_request_info         *requests)
 
594
{
 
595
    struct cfg_group_tcp t;
 
596
    unsigned int value;
 
597
 
 
598
    tcp_options_get(&t);
 
599
    value = t.send_timeout;
 
600
    
 
601
    switch(reqinfo->mode) {
 
602
 
 
603
        case MODE_GET:
 
604
            snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
 
605
                         (u_char *) &value, sizeof(int));
 
606
            break;
 
607
 
 
608
 
 
609
        default:
 
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;
 
613
    }
 
614
 
 
615
    return SNMP_ERR_NOERROR;
 
616
}
 
617
int
 
618
handle_kamailioNetTcpConnLifetime(netsnmp_mib_handler *handler,
 
619
                          netsnmp_handler_registration *reginfo,
 
620
                          netsnmp_agent_request_info   *reqinfo,
 
621
                          netsnmp_request_info         *requests)
 
622
{
 
623
    struct cfg_group_tcp t;
 
624
    unsigned int value;
 
625
 
 
626
    tcp_options_get(&t);
 
627
    value = t.con_lifetime;
 
628
    
 
629
    switch(reqinfo->mode) {
 
630
 
 
631
        case MODE_GET:
 
632
            snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
 
633
                         (u_char *) &value, sizeof(int));
 
634
            break;
 
635
 
 
636
 
 
637
        default:
 
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;
 
641
    }
 
642
 
 
643
    return SNMP_ERR_NOERROR;
 
644
}
 
645
 
 
646
int
 
647
handle_kamailioNetTcpNoConnect(netsnmp_mib_handler *handler,
 
648
                          netsnmp_handler_registration *reginfo,
 
649
                          netsnmp_agent_request_info   *reqinfo,
 
650
                          netsnmp_request_info         *requests)
 
651
{
 
652
    struct cfg_group_tcp t;
 
653
    unsigned int value ;
 
654
 
 
655
    tcp_options_get(&t);
 
656
    value = t.no_connect;
 
657
    
 
658
    switch(reqinfo->mode) {
 
659
 
 
660
        case MODE_GET:
 
661
            snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
 
662
                         (u_char *) &value, sizeof(int));
 
663
            break;
 
664
 
 
665
 
 
666
        default:
 
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;
 
670
    }
 
671
 
 
672
    return SNMP_ERR_NOERROR;
 
673
}
 
674
int
 
675
handle_kamailioNetTcpFdCache(netsnmp_mib_handler *handler,
 
676
                          netsnmp_handler_registration *reginfo,
 
677
                          netsnmp_agent_request_info   *reqinfo,
 
678
                          netsnmp_request_info         *requests)
 
679
{
 
680
    struct cfg_group_tcp t;
 
681
    unsigned int value;
 
682
 
 
683
    tcp_options_get(&t);
 
684
    value = t.con_lifetime;
 
685
    
 
686
    switch(reqinfo->mode) {
 
687
 
 
688
        case MODE_GET:
 
689
            snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
 
690
                         (u_char *) &value, sizeof(int));
 
691
            break;
 
692
 
 
693
 
 
694
        default:
 
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;
 
698
    }
 
699
 
 
700
    return SNMP_ERR_NOERROR;
 
701
}
 
702
 
 
703
int
 
704
handle_kamailioNetTcpAsyncConnWait(netsnmp_mib_handler *handler,
 
705
                          netsnmp_handler_registration *reginfo,
 
706
                          netsnmp_agent_request_info   *reqinfo,
 
707
                          netsnmp_request_info         *requests)
 
708
{
 
709
    struct cfg_group_tcp t;
 
710
    unsigned int value;
 
711
 
 
712
    tcp_options_get(&t);
 
713
    value = t.tcp_connect_wait;
 
714
    
 
715
    switch(reqinfo->mode) {
 
716
 
 
717
        case MODE_GET:
 
718
            snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
 
719
                         (u_char *) &value, sizeof(int));
 
720
            break;
 
721
 
 
722
 
 
723
        default:
 
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;
 
727
    }
 
728
 
 
729
    return SNMP_ERR_NOERROR;
 
730
}
 
731
 
 
732
int
 
733
handle_kamailioNetTcpAsyncConnWqMax(netsnmp_mib_handler *handler,
 
734
                          netsnmp_handler_registration *reginfo,
 
735
                          netsnmp_agent_request_info   *reqinfo,
 
736
                          netsnmp_request_info         *requests)
 
737
{
 
738
    struct cfg_group_tcp t;
 
739
    unsigned int value;
 
740
 
 
741
    tcp_options_get(&t);
 
742
    value = t.tcpconn_wq_max;
 
743
    
 
744
    switch(reqinfo->mode) {
 
745
 
 
746
        case MODE_GET:
 
747
            snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
 
748
                         (u_char *) &value, sizeof(int));
 
749
            break;
 
750
 
 
751
 
 
752
        default:
 
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;
 
756
    }
 
757
 
 
758
    return SNMP_ERR_NOERROR;
 
759
}
 
760
 
 
761
int
 
762
handle_kamailioNetTcpAsyncWqMax(netsnmp_mib_handler *handler,
 
763
                          netsnmp_handler_registration *reginfo,
 
764
                          netsnmp_agent_request_info   *reqinfo,
 
765
                          netsnmp_request_info         *requests)
 
766
{
 
767
    struct cfg_group_tcp t;
 
768
    unsigned int value;
 
769
 
 
770
    tcp_options_get(&t);
 
771
    value = t.tcp_wq_max;
 
772
    
 
773
    switch(reqinfo->mode) {
 
774
 
 
775
        case MODE_GET:
 
776
            snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
 
777
                         (u_char *) &value, sizeof(int));
 
778
            break;
 
779
 
 
780
 
 
781
        default:
 
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;
 
785
    }
 
786
 
 
787
    return SNMP_ERR_NOERROR;
 
788
}
 
789
 
 
790
int
 
791
handle_kamailioNetTcpRdBufSize(netsnmp_mib_handler *handler,
 
792
                          netsnmp_handler_registration *reginfo,
 
793
                          netsnmp_agent_request_info   *reqinfo,
 
794
                          netsnmp_request_info         *requests)
 
795
{
 
796
    struct cfg_group_tcp t;
 
797
    unsigned int value;
 
798
 
 
799
    tcp_options_get(&t);
 
800
    value = t.rd_buf_size;
 
801
    
 
802
    switch(reqinfo->mode) {
 
803
 
 
804
        case MODE_GET:
 
805
            snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
 
806
                         (u_char *) &value, sizeof(int));
 
807
            break;
 
808
 
 
809
 
 
810
        default:
 
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;
 
814
    }
 
815
 
 
816
    return SNMP_ERR_NOERROR;
 
817
}
 
818
 
 
819
int
 
820
handle_kamailioNetTcpDeferAccept(netsnmp_mib_handler *handler,
 
821
                          netsnmp_handler_registration *reginfo,
 
822
                          netsnmp_agent_request_info   *reqinfo,
 
823
                          netsnmp_request_info         *requests)
 
824
{
 
825
    struct cfg_group_tcp t;
 
826
    unsigned int value;
 
827
 
 
828
    tcp_options_get(&t);
 
829
    value = t.defer_accept;
 
830
 
 
831
    switch(reqinfo->mode) {
 
832
 
 
833
        case MODE_GET:
 
834
            snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
 
835
                         (u_char *) &value, sizeof(int));
 
836
            break;
 
837
 
 
838
 
 
839
        default:
 
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;
 
843
    }
 
844
 
 
845
    return SNMP_ERR_NOERROR;
 
846
}
 
847
 
 
848
int
 
849
handle_kamailioNetTcpDelayedAck(netsnmp_mib_handler *handler,
 
850
                          netsnmp_handler_registration *reginfo,
 
851
                          netsnmp_agent_request_info   *reqinfo,
 
852
                          netsnmp_request_info         *requests)
 
853
{
 
854
    struct cfg_group_tcp t;
 
855
    unsigned int value;
 
856
 
 
857
    tcp_options_get(&t);
 
858
    value = t.delayed_ack;
 
859
    
 
860
    switch(reqinfo->mode) {
 
861
 
 
862
        case MODE_GET:
 
863
            snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
 
864
                         (u_char *) &value, sizeof(int));
 
865
            break;
 
866
 
 
867
 
 
868
        default:
 
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;
 
872
    }
 
873
 
 
874
    return SNMP_ERR_NOERROR;
 
875
}
 
876
 
 
877
int
 
878
handle_kamailioNetTcpSynCnt(netsnmp_mib_handler *handler,
 
879
                          netsnmp_handler_registration *reginfo,
 
880
                          netsnmp_agent_request_info   *reqinfo,
 
881
                          netsnmp_request_info         *requests)
 
882
{
 
883
    struct cfg_group_tcp t;
 
884
    unsigned int value;
 
885
 
 
886
    tcp_options_get(&t);
 
887
    value = t.syncnt;
 
888
    
 
889
    switch(reqinfo->mode) {
 
890
 
 
891
        case MODE_GET:
 
892
            snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
 
893
                         (u_char *) &value, sizeof(int));
 
894
            break;
 
895
 
 
896
 
 
897
        default:
 
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;
 
901
    }
 
902
 
 
903
    return SNMP_ERR_NOERROR;
 
904
}
 
905
 
 
906
int
 
907
handle_kamailioNetTcpLinger(netsnmp_mib_handler *handler,
 
908
                          netsnmp_handler_registration *reginfo,
 
909
                          netsnmp_agent_request_info   *reqinfo,
 
910
                          netsnmp_request_info         *requests)
 
911
{
 
912
    struct cfg_group_tcp t;
 
913
    unsigned int value;
 
914
 
 
915
    tcp_options_get(&t);
 
916
    value = t.linger2;
 
917
    
 
918
    switch(reqinfo->mode) {
 
919
 
 
920
        case MODE_GET:
 
921
            snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
 
922
                         (u_char *) &value, sizeof(int));
 
923
            break;
 
924
 
 
925
 
 
926
        default:
 
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;
 
930
    }
 
931
 
 
932
    return SNMP_ERR_NOERROR;
 
933
}
 
934
 
 
935
int
 
936
handle_kamailioNetTcpKeepAlive(netsnmp_mib_handler *handler,
 
937
                          netsnmp_handler_registration *reginfo,
 
938
                          netsnmp_agent_request_info   *reqinfo,
 
939
                          netsnmp_request_info         *requests)
 
940
{
 
941
    struct cfg_group_tcp t;
 
942
    unsigned int value;
 
943
 
 
944
    tcp_options_get(&t);
 
945
    value = t.keepalive;
 
946
    
 
947
    switch(reqinfo->mode) {
 
948
 
 
949
        case MODE_GET:
 
950
            snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
 
951
                         (u_char *) &value, sizeof(int));
 
952
            break;
 
953
 
 
954
 
 
955
        default:
 
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;
 
959
    }
 
960
 
 
961
    return SNMP_ERR_NOERROR;
 
962
}
 
963
int
 
964
handle_kamailioNetTcpKeepIdle(netsnmp_mib_handler *handler,
 
965
                          netsnmp_handler_registration *reginfo,
 
966
                          netsnmp_agent_request_info   *reqinfo,
 
967
                          netsnmp_request_info         *requests)
 
968
{
 
969
    struct cfg_group_tcp t;
 
970
    unsigned int value;
 
971
 
 
972
    tcp_options_get(&t);
 
973
    value = t.keepidle;
 
974
    
 
975
    switch(reqinfo->mode) {
 
976
 
 
977
    struct cfg_group_tcp t;
 
978
    unsigned int value;
 
979
 
 
980
    tcp_options_get(&t);
 
981
    value = t.con_lifetime;
 
982
        case MODE_GET:
 
983
            snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
 
984
                         (u_char *) &value, sizeof(int));
 
985
            break;
 
986
 
 
987
 
 
988
        default:
 
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;
 
992
    }
 
993
 
 
994
    return SNMP_ERR_NOERROR;
 
995
}
 
996
 
 
997
int
 
998
handle_kamailioNetTcpKeepIntvl(netsnmp_mib_handler *handler,
 
999
                          netsnmp_handler_registration *reginfo,
 
1000
                          netsnmp_agent_request_info   *reqinfo,
 
1001
                          netsnmp_request_info         *requests)
 
1002
{
 
1003
    struct cfg_group_tcp t;
 
1004
    unsigned int value;
 
1005
 
 
1006
    tcp_options_get(&t);
 
1007
    value = t.keepintvl;
 
1008
    
 
1009
    switch(reqinfo->mode) {
 
1010
 
 
1011
        case MODE_GET:
 
1012
            snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
 
1013
                         (u_char *) &value, sizeof(int));
 
1014
            break;
 
1015
 
 
1016
 
 
1017
        default:
 
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;
 
1021
    }
 
1022
 
 
1023
    return SNMP_ERR_NOERROR;
 
1024
}
 
1025
 
 
1026
int
 
1027
handle_kamailioNetTcpKeepCnt(netsnmp_mib_handler *handler,
 
1028
                          netsnmp_handler_registration *reginfo,
 
1029
                          netsnmp_agent_request_info   *reqinfo,
 
1030
                          netsnmp_request_info         *requests)
 
1031
{
 
1032
    struct cfg_group_tcp t;
 
1033
    unsigned int value;
 
1034
 
 
1035
    tcp_options_get(&t);
 
1036
    value = t.keepcnt;
 
1037
 
 
1038
    switch(reqinfo->mode) {
 
1039
 
 
1040
        case MODE_GET:
 
1041
            snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
 
1042
                         (u_char *) &value, sizeof(int));
 
1043
            break;
 
1044
 
 
1045
 
 
1046
        default:
 
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;
 
1050
    }
 
1051
 
 
1052
    return SNMP_ERR_NOERROR;
 
1053
}
 
1054
 
 
1055
int
 
1056
handle_kamailioNetTcpCrlfPing(netsnmp_mib_handler *handler,
 
1057
                          netsnmp_handler_registration *reginfo,
 
1058
                          netsnmp_agent_request_info   *reqinfo,
 
1059
                          netsnmp_request_info         *requests)
 
1060
{
 
1061
    struct cfg_group_tcp t;
 
1062
    unsigned int value;
 
1063
 
 
1064
    tcp_options_get(&t);
 
1065
    value = t.crlf_ping;
 
1066
    
 
1067
    switch(reqinfo->mode) {
 
1068
 
 
1069
        case MODE_GET:
 
1070
            snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
 
1071
                         (u_char *) &value, sizeof(int));
 
1072
            break;
 
1073
 
 
1074
 
 
1075
        default:
 
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;
 
1079
    }
 
1080
 
 
1081
    return SNMP_ERR_NOERROR;
 
1082
}
 
1083
 
 
1084
int
 
1085
handle_kamailioNetTcpAcceptAliases(netsnmp_mib_handler *handler,
 
1086
                          netsnmp_handler_registration *reginfo,
 
1087
                          netsnmp_agent_request_info   *reqinfo,
 
1088
                          netsnmp_request_info         *requests)
 
1089
{
 
1090
    struct cfg_group_tcp t;
 
1091
    unsigned int value;
 
1092
 
 
1093
    tcp_options_get(&t);
 
1094
    value = t.accept_aliases;
 
1095
    
 
1096
    switch(reqinfo->mode) {
 
1097
 
 
1098
        case MODE_GET:
 
1099
            snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
 
1100
                         (u_char *) &value, sizeof(int));
 
1101
            break;
 
1102
 
 
1103
 
 
1104
        default:
 
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;
 
1108
    }
 
1109
 
 
1110
    return SNMP_ERR_NOERROR;
 
1111
}
 
1112
 
 
1113
int handle_kamailioNetTcpAcceptNoCl(netsnmp_mib_handler *handler,
 
1114
                          netsnmp_handler_registration *reginfo,
 
1115
                          netsnmp_agent_request_info   *reqinfo,
 
1116
                          netsnmp_request_info         *requests)
 
1117
{
 
1118
    struct cfg_group_tcp t;
 
1119
    unsigned int value;
 
1120
 
 
1121
    tcp_options_get(&t);
 
1122
    value = t.accept_no_cl;
 
1123
    
 
1124
    switch(reqinfo->mode) {
 
1125
 
 
1126
        case MODE_GET:
 
1127
            snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
 
1128
                         (u_char *) &value, sizeof(int));
 
1129
            break;
 
1130
 
 
1131
 
 
1132
        default:
 
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;
 
1136
    }
 
1137
 
 
1138
    return SNMP_ERR_NOERROR;
 
1139
}
 
1140
 
 
1141
int handle_kamailioNetWsConnsActive(netsnmp_mib_handler *handler,
 
1142
                          netsnmp_handler_registration *reginfo,
 
1143
                          netsnmp_agent_request_info   *reqinfo,
 
1144
                          netsnmp_request_info         *requests)
 
1145
{
 
1146
   int datafield = get_statistic("ws_current_connections");
 
1147
    
 
1148
    switch(reqinfo->mode) {
 
1149
        case MODE_GET:
 
1150
            snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE,
 
1151
                        (u_char *) &datafield, sizeof(int));
 
1152
            break;
 
1153
 
 
1154
 
 
1155
        default:
 
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;
 
1159
    }
 
1160
 
 
1161
    return SNMP_ERR_NOERROR;
 
1162
}
 
1163
int
 
1164
handle_kamailioNetWsConnsActiveMax(netsnmp_mib_handler *handler,
 
1165
                          netsnmp_handler_registration *reginfo,
 
1166
                          netsnmp_agent_request_info   *reqinfo,
 
1167
                          netsnmp_request_info         *requests)
 
1168
{
 
1169
   int datafield = get_statistic("ws_max_concurrent_connections");
 
1170
    
 
1171
    switch(reqinfo->mode) {
 
1172
 
 
1173
        case MODE_GET:
 
1174
            snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE,
 
1175
                                (u_char *) &datafield, sizeof(int));
 
1176
            break;
 
1177
 
 
1178
 
 
1179
        default:
 
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;
 
1183
    }
 
1184
 
 
1185
    return SNMP_ERR_NOERROR;
 
1186
}
 
1187
int
 
1188
handle_kamailioNetWsConnsFailed(netsnmp_mib_handler *handler,
 
1189
                          netsnmp_handler_registration *reginfo,
 
1190
                          netsnmp_agent_request_info   *reqinfo,
 
1191
                          netsnmp_request_info         *requests)
 
1192
{
 
1193
   int datafield = get_statistic("ws_failed_connections");
 
1194
    
 
1195
    switch(reqinfo->mode) {
 
1196
 
 
1197
        case MODE_GET:
 
1198
            snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
 
1199
                        (u_char *) &datafield, sizeof(int));
 
1200
            break;
 
1201
 
 
1202
 
 
1203
        default:
 
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;
 
1207
    }
 
1208
 
 
1209
    return SNMP_ERR_NOERROR;
 
1210
}
 
1211
int
 
1212
handle_kamailioNetWsConnsClosedLocal(netsnmp_mib_handler *handler,
 
1213
                          netsnmp_handler_registration *reginfo,
 
1214
                          netsnmp_agent_request_info   *reqinfo,
 
1215
                          netsnmp_request_info         *requests)
 
1216
{
 
1217
   int datafield = get_statistic("ws_local_closed_connections");
 
1218
    
 
1219
    switch(reqinfo->mode) {
 
1220
 
 
1221
        case MODE_GET:
 
1222
            snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
 
1223
                        (u_char *) &datafield, sizeof(int));
 
1224
            break;
 
1225
 
 
1226
 
 
1227
        default:
 
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;
 
1231
    }
 
1232
 
 
1233
    return SNMP_ERR_NOERROR;
 
1234
}
 
1235
int
 
1236
handle_kamailioNetWsConnsClosedRemote(netsnmp_mib_handler *handler,
 
1237
                          netsnmp_handler_registration *reginfo,
 
1238
                          netsnmp_agent_request_info   *reqinfo,
 
1239
                          netsnmp_request_info         *requests)
 
1240
{
 
1241
   int datafield = get_statistic("ws_remote_closed_connections");
 
1242
    
 
1243
    switch(reqinfo->mode) {
 
1244
 
 
1245
        case MODE_GET:
 
1246
            snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
 
1247
                        (u_char *) &datafield, sizeof(int));
 
1248
            break;
 
1249
 
 
1250
 
 
1251
        default:
 
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;
 
1255
    }
 
1256
 
 
1257
    return SNMP_ERR_NOERROR;
 
1258
}
 
1259
int
 
1260
handle_kamailioNetWsFramesRx(netsnmp_mib_handler *handler,
 
1261
                          netsnmp_handler_registration *reginfo,
 
1262
                          netsnmp_agent_request_info   *reqinfo,
 
1263
                          netsnmp_request_info         *requests)
 
1264
{
 
1265
   int datafield = get_statistic("ws_received_frames");
 
1266
    
 
1267
    switch(reqinfo->mode) {
 
1268
 
 
1269
        case MODE_GET:
 
1270
            snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
 
1271
                        (u_char *) &datafield, sizeof(int));
 
1272
            break;
 
1273
 
 
1274
 
 
1275
        default:
 
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;
 
1279
    }
 
1280
 
 
1281
    return SNMP_ERR_NOERROR;
 
1282
}
 
1283
int
 
1284
handle_kamailioNetWsFramesTx(netsnmp_mib_handler *handler,
 
1285
                          netsnmp_handler_registration *reginfo,
 
1286
                          netsnmp_agent_request_info   *reqinfo,
 
1287
                          netsnmp_request_info         *requests)
 
1288
{
 
1289
   int datafield = get_statistic("ws_transmitted_frames");
 
1290
    
 
1291
    switch(reqinfo->mode) {
 
1292
 
 
1293
        case MODE_GET:
 
1294
            snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
 
1295
                        (u_char *) &datafield, sizeof(int));
 
1296
            break;
 
1297
 
 
1298
 
 
1299
        default:
 
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;
 
1303
    }
 
1304
 
 
1305
    return SNMP_ERR_NOERROR;
 
1306
}
 
1307
int
 
1308
handle_kamailioNetWsHandshakeSuccess(netsnmp_mib_handler *handler,
 
1309
                          netsnmp_handler_registration *reginfo,
 
1310
                          netsnmp_agent_request_info   *reqinfo,
 
1311
                          netsnmp_request_info         *requests)
 
1312
{
 
1313
   int datafield = get_statistic("ws_successful_handshakes");
 
1314
    
 
1315
    switch(reqinfo->mode) {
 
1316
 
 
1317
        case MODE_GET:
 
1318
            snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
 
1319
                        (u_char *) &datafield, sizeof(int));
 
1320
            break;
 
1321
 
 
1322
 
 
1323
        default:
 
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;
 
1327
    }
 
1328
 
 
1329
    return SNMP_ERR_NOERROR;
 
1330
}
 
1331
int
 
1332
handle_kamailioNetWsHandshakeFailed(netsnmp_mib_handler *handler,
 
1333
                          netsnmp_handler_registration *reginfo,
 
1334
                          netsnmp_agent_request_info   *reqinfo,
 
1335
                          netsnmp_request_info         *requests)
 
1336
{
 
1337
   int datafield = get_statistic("ws_failed_handshakes");
 
1338
    
 
1339
    switch(reqinfo->mode) {
 
1340
 
 
1341
        case MODE_GET:
 
1342
            snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
 
1343
                        (u_char *) &datafield, sizeof(int));
 
1344
            break;
 
1345
 
 
1346
 
 
1347
        default:
 
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;
 
1351
    }
 
1352
 
 
1353
    return SNMP_ERR_NOERROR;
 
1354
}