2
* Note: this file originally auto-generated by mib2c using
6
#include <net-snmp/net-snmp-config.h>
7
#include <net-snmp/net-snmp-includes.h>
8
#include <net-snmp/agent/net-snmp-agent-includes.h>
9
#include <net-snmp/agent/net-snmp-agent-includes.h>
10
#include <net-snmp/agent/table_container.h>
11
#include "sctpLookupLocalPortTable.h"
13
static netsnmp_container *sctpLookupLocalPortTable_container;
15
/** Initializes the sctpLookupLocalPortTable module */
17
init_sctpLookupLocalPortTable(void)
20
* here we initialize all the tables we're planning on supporting
22
initialize_table_sctpLookupLocalPortTable();
26
shutdown_sctpLookupLocalPortTable(void)
28
sctpLookupLocalPortTable_container_clear
29
(sctpLookupLocalPortTable_container);
32
/** Initialize the sctpLookupLocalPortTable table by defining its contents and how it's structured */
34
initialize_table_sctpLookupLocalPortTable(void)
36
static oid sctpLookupLocalPortTable_oid[] =
37
{ 1, 3, 6, 1, 2, 1, 104, 1, 6 };
38
size_t sctpLookupLocalPortTable_oid_len =
39
OID_LENGTH(sctpLookupLocalPortTable_oid);
40
netsnmp_handler_registration *reg = NULL;
41
netsnmp_mib_handler *handler = NULL;
42
netsnmp_container *container = NULL;
43
netsnmp_table_registration_info *table_info = NULL;
46
netsnmp_create_handler_registration("sctpLookupLocalPortTable",
47
sctpLookupLocalPortTable_handler,
48
sctpLookupLocalPortTable_oid,
49
sctpLookupLocalPortTable_oid_len,
53
"error creating handler registration for sctpLookupLocalPortTable\n");
58
netsnmp_container_find("sctpLookupLocalPortTable:table_container");
59
if (NULL == container) {
61
"error creating container for sctpLookupLocalPortTable\n");
64
sctpLookupLocalPortTable_container = container;
66
table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
67
if (NULL == table_info) {
69
"error allocating table registration for sctpLookupLocalPortTable\n");
72
netsnmp_table_helper_add_indexes(table_info, ASN_UNSIGNED, /* index: sctpAssocLocalPort */
73
ASN_UNSIGNED, /* index: sctpAssocId */
75
table_info->min_column = COLUMN_SCTPLOOKUPLOCALPORTSTARTTIME;
76
table_info->max_column = COLUMN_SCTPLOOKUPLOCALPORTSTARTTIME;
78
/*************************************************
80
* inject container_table helper
82
handler = netsnmp_container_table_handler_get(table_info, container,
83
TABLE_CONTAINER_KEY_NETSNMP_INDEX);
84
if (NULL == handler) {
86
"error allocating table registration for sctpLookupLocalPortTable\n");
89
if (SNMPERR_SUCCESS != netsnmp_inject_handler(reg, handler)) {
91
"error injecting container_table handler for sctpLookupLocalPortTable\n");
94
handler = NULL; /* reg has it, will reuse below */
99
if (SNMPERR_SUCCESS != netsnmp_register_table(reg, table_info)) {
101
"error registering table handler for sctpLookupLocalPortTable\n");
106
* Initialise the contents of the table here
113
* Some error occurred during registration. Clean up and bail.
118
netsnmp_handler_free(handler);
121
netsnmp_table_registration_info_free(table_info);
124
CONTAINER_FREE(container);
127
netsnmp_handler_registration_free(reg);
131
/** handles requests for the sctpLookupLocalPortTable table */
133
sctpLookupLocalPortTable_handler(netsnmp_mib_handler *handler,
134
netsnmp_handler_registration *reginfo,
135
netsnmp_agent_request_info *reqinfo,
136
netsnmp_request_info *requests)
139
netsnmp_request_info *request;
140
netsnmp_table_request_info *table_info;
141
sctpLookupLocalPortTable_entry *table_entry;
143
switch (reqinfo->mode) {
145
* Read-support (also covers GetNext requests)
148
for (request = requests; request; request = request->next) {
149
if (request->processed)
151
table_entry = (sctpLookupLocalPortTable_entry *)
152
netsnmp_container_table_extract_context(request);
153
table_info = netsnmp_extract_table_info(request);
154
if ((NULL == table_entry) || (NULL == table_info)) {
156
"could not extract table entry or info for sctpLookupLocalPortTable\n");
157
snmp_set_var_typed_value(request->requestvb,
158
SNMP_ERR_GENERR, NULL, 0);
162
switch (table_info->colnum) {
163
case COLUMN_SCTPLOOKUPLOCALPORTSTARTTIME:
165
netsnmp_set_request_error(reqinfo, request,
166
SNMP_NOSUCHINSTANCE);
169
snmp_set_var_typed_integer(request->requestvb,
171
table_entry->sctpLookupLocalPortStartTime);
174
netsnmp_set_request_error(reqinfo, request,
182
return SNMP_ERR_NOERROR;
185
sctpLookupLocalPortTable_entry *
186
sctpLookupLocalPortTable_entry_create(void)
188
sctpLookupLocalPortTable_entry *entry =
189
SNMP_MALLOC_TYPEDEF(sctpLookupLocalPortTable_entry);
191
entry->oid_index.len = SCTP_LOOKUP_LOCAL_PORT_TABLE_INDEX_SIZE;
192
entry->oid_index.oids = entry->oid_tmp;
199
sctpLookupLocalPortTable_entry_update_index(sctpLookupLocalPortTable_entry
202
netsnmp_variable_list var_sctpAssocLocalPort;
203
netsnmp_variable_list var_sctpAssocId;
207
* prepare the value to be converted
209
memset(&var_sctpAssocLocalPort, 0, sizeof(var_sctpAssocLocalPort));
210
var_sctpAssocLocalPort.type = ASN_UNSIGNED;
211
var_sctpAssocLocalPort.next_variable = &var_sctpAssocId;
212
snmp_set_var_value(&var_sctpAssocLocalPort,
213
(u_char *) & entry->sctpAssocLocalPort,
214
sizeof(entry->sctpAssocLocalPort));
216
memset(&var_sctpAssocId, 0, sizeof(var_sctpAssocId));
217
var_sctpAssocId.type = ASN_UNSIGNED;
218
var_sctpAssocId.next_variable = NULL;
219
snmp_set_var_value(&var_sctpAssocId, (u_char *) & entry->sctpAssocId,
220
sizeof(entry->sctpAssocId));
226
build_oid_noalloc(entry->oid_index.oids, entry->oid_index.len,
227
&entry->oid_index.len, NULL, 0,
228
&var_sctpAssocLocalPort);
230
snmp_log(LOG_ERR, "error %d converting index to oid\n", err);
233
* release any memory allocated during the conversion
235
snmp_reset_var_buffers(&var_sctpAssocLocalPort);
241
sctpLookupLocalPortTable_entry_copy(sctpLookupLocalPortTable_entry * from,
242
sctpLookupLocalPortTable_entry * to)
244
memcpy(to, from, sizeof(sctpLookupLocalPortTable_entry));
245
to->oid_index.oids = to->oid_tmp;
250
sctpLookupLocalPortTable_entry_free(sctpLookupLocalPortTable_entry * entry)
257
sctpLookupLocalPortTable_get_container(void)
259
return sctpLookupLocalPortTable_container;
264
sctpLookupLocalPortTable_entry_clear(void *what, void *magic)
266
sctpLookupLocalPortTable_entry_free(what);
270
sctpLookupLocalPortTable_container_clear(netsnmp_container *container)
272
CONTAINER_CLEAR(container, sctpLookupLocalPortTable_entry_clear, NULL);