ipCidrRouteTable_interface.c
上传用户:wxp200602
上传日期:2007-10-30
资源大小:4028k
文件大小:67k
源码类别:
SNMP编程
开发平台:
Unix_Linux
- /*
- * Note: this file originally auto-generated by mib2c using
- * version : 1.42 $ of : mfd-interface.m2c,v $
- *
- * $Id: ipCidrRouteTable_interface.c,v 1.9.2.2 2005/09/06 20:26:02 rstory Exp $
- */
- /*
- * *********************************************************************
- * *********************************************************************
- * *********************************************************************
- * *** ***
- * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE ***
- * *** ***
- * *** ***
- * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. ***
- * *** ***
- * *** ***
- * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND ***
- * *** ***
- * *** ***
- * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. ***
- * *** ***
- * *** ***
- * *********************************************************************
- * *********************************************************************
- * *********************************************************************
- */
- /*
- * standard Net-SNMP includes
- */
- #include <net-snmp/net-snmp-config.h>
- #include <net-snmp/net-snmp-includes.h>
- #include <net-snmp/agent/net-snmp-agent-includes.h>
- /*
- * include our parent header
- */
- #include "ipCidrRouteTable.h"
- #include <net-snmp/library/container.h>
- #include "ipCidrRouteTable_interface.h"
- /**********************************************************************
- **********************************************************************
- ***
- *** Table ipCidrRouteTable
- ***
- **********************************************************************
- **********************************************************************/
- /*
- * ipCidrRouteTable is subid 4 of ipForward.
- * Its status is Deprecated.
- * OID: .1.3.6.1.2.1.4.24.4, length: 9
- */
- typedef struct ipCidrRouteTable_interface_ctx_s {
- netsnmp_container *container;
- netsnmp_cache *cache; /* optional cache */
- ipCidrRouteTable_registration_ptr user_ctx;
- netsnmp_table_registration_info tbl_info;
- netsnmp_baby_steps_access_methods access_multiplexer;
- } ipCidrRouteTable_interface_ctx;
- static ipCidrRouteTable_interface_ctx ipCidrRouteTable_if_ctx;
- static void
- _ipCidrRouteTable_container_init(ipCidrRouteTable_interface_ctx * if_ctx);
- static Netsnmp_Node_Handler _mfd_ipCidrRouteTable_pre_request;
- static Netsnmp_Node_Handler _mfd_ipCidrRouteTable_post_request;
- static Netsnmp_Node_Handler _mfd_ipCidrRouteTable_object_lookup;
- static Netsnmp_Node_Handler _mfd_ipCidrRouteTable_get_values;
- static Netsnmp_Node_Handler _mfd_ipCidrRouteTable_check_objects;
- static Netsnmp_Node_Handler _mfd_ipCidrRouteTable_undo_setup;
- static Netsnmp_Node_Handler _mfd_ipCidrRouteTable_set_values;
- static Netsnmp_Node_Handler _mfd_ipCidrRouteTable_undo_cleanup;
- static Netsnmp_Node_Handler _mfd_ipCidrRouteTable_undo_values;
- static Netsnmp_Node_Handler _mfd_ipCidrRouteTable_commit;
- static Netsnmp_Node_Handler _mfd_ipCidrRouteTable_undo_commit;
- NETSNMP_STATIC_INLINE int
- _ipCidrRouteTable_undo_column(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
- netsnmp_variable_list * var,
- int column);
- NETSNMP_STATIC_INLINE int
- _ipCidrRouteTable_check_indexes(ipCidrRouteTable_rowreq_ctx * rowreq_ctx);
- /**
- * @internal
- * Initialize the table ipCidrRouteTable
- * (Define its contents and how it's structured)
- */
- void
- _ipCidrRouteTable_initialize_interface(ipCidrRouteTable_registration_ptr
- reg_ptr, u_long flags)
- {
- netsnmp_baby_steps_access_methods *access_multiplexer =
- &ipCidrRouteTable_if_ctx.access_multiplexer;
- netsnmp_table_registration_info *tbl_info =
- &ipCidrRouteTable_if_ctx.tbl_info;
- netsnmp_handler_registration *reginfo;
- netsnmp_mib_handler *handler;
- int mfd_modes = 0;
- DEBUGMSGTL(("internal:ipCidrRouteTable:_ipCidrRouteTable_initialize_interface", "calledn"));
- /*************************************************
- *
- * save interface context for ipCidrRouteTable
- */
- /*
- * Setting up the table's definition
- */
- netsnmp_table_helper_add_indexes(tbl_info, ASN_IPADDRESS,
- /** index: ipCidrRouteDest */
- ASN_IPADDRESS,
- /** index: ipCidrRouteMask */
- ASN_INTEGER,
- /** index: ipCidrRouteTos */
- ASN_IPADDRESS,
- /** index: ipCidrRouteNextHop */
- 0);
- /*
- * Define the minimum and maximum accessible columns. This
- * optimizes retrival.
- */
- tbl_info->min_column = IPCIDRROUTETABLE_MIN_COL;
- tbl_info->max_column = IPCIDRROUTETABLE_MAX_COL;
- /*
- * save users context
- */
- ipCidrRouteTable_if_ctx.user_ctx = reg_ptr;
- /*
- * call data access initialization code
- */
- ipCidrRouteTable_init_data(reg_ptr);
- /*
- * set up the container
- */
- _ipCidrRouteTable_container_init(&ipCidrRouteTable_if_ctx);
- if (NULL == ipCidrRouteTable_if_ctx.container) {
- snmp_log(LOG_ERR,
- "could not initialize container for ipCidrRouteTablen");
- return;
- }
- /*
- * access_multiplexer: REQUIRED wrapper for get request handling
- */
- access_multiplexer->object_lookup =
- _mfd_ipCidrRouteTable_object_lookup;
- access_multiplexer->get_values = _mfd_ipCidrRouteTable_get_values;
- /*
- * no wrappers yet
- */
- access_multiplexer->pre_request = _mfd_ipCidrRouteTable_pre_request;
- access_multiplexer->post_request = _mfd_ipCidrRouteTable_post_request;
- /*
- * REQUIRED wrappers for set request handling
- */
- access_multiplexer->object_syntax_checks =
- _mfd_ipCidrRouteTable_check_objects;
- access_multiplexer->undo_setup = _mfd_ipCidrRouteTable_undo_setup;
- access_multiplexer->undo_cleanup = _mfd_ipCidrRouteTable_undo_cleanup;
- access_multiplexer->set_values = _mfd_ipCidrRouteTable_set_values;
- access_multiplexer->undo_sets = _mfd_ipCidrRouteTable_undo_values;
- /*
- * no wrappers yet
- */
- access_multiplexer->commit = _mfd_ipCidrRouteTable_commit;
- access_multiplexer->undo_commit = _mfd_ipCidrRouteTable_undo_commit;
- /*************************************************
- *
- * Create a registration, save our reg data, register table.
- */
- DEBUGMSGTL(("ipCidrRouteTable:init_ipCidrRouteTable",
- "Registering ipCidrRouteTable as a mibs-for-dummies table.n"));
- handler =
- netsnmp_baby_steps_access_multiplexer_get(access_multiplexer);
- reginfo =
- netsnmp_handler_registration_create("ipCidrRouteTable", handler,
- ipCidrRouteTable_oid,
- ipCidrRouteTable_oid_size,
- HANDLER_CAN_BABY_STEP |
- HANDLER_CAN_RONLY);
- if (NULL == reginfo) {
- snmp_log(LOG_ERR, "error registering table ipCidrRouteTablen");
- return;
- }
- reginfo->my_reg_void = &ipCidrRouteTable_if_ctx;
- /*************************************************
- *
- * set up baby steps handler, create it and inject it
- */
- if (access_multiplexer->object_lookup)
- mfd_modes |= BABY_STEP_OBJECT_LOOKUP;
- if (access_multiplexer->set_values)
- mfd_modes |= BABY_STEP_SET_VALUES;
- if (access_multiplexer->irreversible_commit)
- mfd_modes |= BABY_STEP_IRREVERSIBLE_COMMIT;
- if (access_multiplexer->object_syntax_checks)
- mfd_modes |= BABY_STEP_CHECK_OBJECT;
- if (access_multiplexer->pre_request)
- mfd_modes |= BABY_STEP_PRE_REQUEST;
- if (access_multiplexer->post_request)
- mfd_modes |= BABY_STEP_POST_REQUEST;
- if (access_multiplexer->undo_setup)
- mfd_modes |= BABY_STEP_UNDO_SETUP;
- if (access_multiplexer->undo_cleanup)
- mfd_modes |= BABY_STEP_UNDO_CLEANUP;
- if (access_multiplexer->undo_sets)
- mfd_modes |= BABY_STEP_UNDO_SETS;
- if (access_multiplexer->row_creation)
- mfd_modes |= BABY_STEP_ROW_CREATE;
- if (access_multiplexer->consistency_checks)
- mfd_modes |= BABY_STEP_CHECK_CONSISTENCY;
- if (access_multiplexer->commit)
- mfd_modes |= BABY_STEP_COMMIT;
- if (access_multiplexer->undo_commit)
- mfd_modes |= BABY_STEP_UNDO_COMMIT;
- handler = netsnmp_baby_steps_handler_get(mfd_modes);
- netsnmp_inject_handler(reginfo, handler);
- /*************************************************
- *
- * inject row_merge helper with prefix rootoid_len + 2 (entry.col)
- */
- handler = netsnmp_get_row_merge_handler(reginfo->rootoid_len + 2);
- netsnmp_inject_handler(reginfo, handler);
- /*************************************************
- *
- * inject container_table helper
- */
- handler =
- netsnmp_container_table_handler_get(tbl_info,
- ipCidrRouteTable_if_ctx.
- container,
- TABLE_CONTAINER_KEY_NETSNMP_INDEX);
- netsnmp_inject_handler(reginfo, handler);
- /*************************************************
- *
- * inject cache helper
- */
- if (NULL != ipCidrRouteTable_if_ctx.cache) {
- handler = netsnmp_cache_handler_get(ipCidrRouteTable_if_ctx.cache);
- netsnmp_inject_handler(reginfo, handler);
- }
- /*
- * register table
- */
- netsnmp_register_table(reginfo, tbl_info);
- } /* _ipCidrRouteTable_initialize_interface */
- void
- ipCidrRouteTable_valid_columns_set(netsnmp_column_info *vc)
- {
- ipCidrRouteTable_if_ctx.tbl_info.valid_columns = vc;
- } /* ipCidrRouteTable_valid_columns_set */
- /**
- * @internal
- * convert the index component stored in the context to an oid
- */
- int
- ipCidrRouteTable_index_to_oid(netsnmp_index * oid_idx,
- ipCidrRouteTable_mib_index * mib_idx)
- {
- int err = SNMP_ERR_NOERROR;
- /*
- * temp storage for parsing indexes
- */
- /*
- * ipCidrRouteDest(1)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h
- */
- netsnmp_variable_list var_ipCidrRouteDest;
- /*
- * ipCidrRouteMask(2)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h
- */
- netsnmp_variable_list var_ipCidrRouteMask;
- /*
- * ipCidrRouteTos(3)/INTEGER32/ASN_INTEGER/long(long)//l/A/w/e/R/d/h
- */
- netsnmp_variable_list var_ipCidrRouteTos;
- /*
- * ipCidrRouteNextHop(4)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h
- */
- netsnmp_variable_list var_ipCidrRouteNextHop;
- /*
- * set up varbinds
- */
- memset(&var_ipCidrRouteDest, 0x00, sizeof(var_ipCidrRouteDest));
- var_ipCidrRouteDest.type = ASN_PRIV_IMPLIED_OCTET_STR;
- memset(&var_ipCidrRouteMask, 0x00, sizeof(var_ipCidrRouteMask));
- var_ipCidrRouteMask.type = ASN_PRIV_IMPLIED_OCTET_STR;
- memset(&var_ipCidrRouteTos, 0x00, sizeof(var_ipCidrRouteTos));
- var_ipCidrRouteTos.type = ASN_INTEGER;
- memset(&var_ipCidrRouteNextHop, 0x00, sizeof(var_ipCidrRouteNextHop));
- var_ipCidrRouteNextHop.type = ASN_PRIV_IMPLIED_OCTET_STR;
- /*
- * chain temp index varbinds together
- */
- var_ipCidrRouteDest.next_variable = &var_ipCidrRouteMask;
- var_ipCidrRouteMask.next_variable = &var_ipCidrRouteTos;
- var_ipCidrRouteTos.next_variable = &var_ipCidrRouteNextHop;
- var_ipCidrRouteNextHop.next_variable = NULL;
- DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTable_index_to_oid",
- "calledn"));
- /*
- * ipCidrRouteDest(1)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h
- */
- snmp_set_var_value(&var_ipCidrRouteDest,
- (u_char *) & mib_idx->ipCidrRouteDest,
- sizeof(mib_idx->ipCidrRouteDest));
- /*
- * ipCidrRouteMask(2)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h
- */
- snmp_set_var_value(&var_ipCidrRouteMask,
- (u_char *) & mib_idx->ipCidrRouteMask,
- sizeof(mib_idx->ipCidrRouteMask));
- /*
- * ipCidrRouteTos(3)/INTEGER32/ASN_INTEGER/long(long)//l/A/w/e/R/d/h
- */
- snmp_set_var_value(&var_ipCidrRouteTos,
- (u_char *) & mib_idx->ipCidrRouteTos,
- sizeof(mib_idx->ipCidrRouteTos));
- /*
- * ipCidrRouteNextHop(4)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h
- */
- snmp_set_var_value(&var_ipCidrRouteNextHop,
- (u_char *) & mib_idx->ipCidrRouteNextHop,
- sizeof(mib_idx->ipCidrRouteNextHop));
- err = build_oid_noalloc(oid_idx->oids, oid_idx->len, &oid_idx->len,
- NULL, 0, &var_ipCidrRouteDest);
- if (err)
- snmp_log(LOG_ERR, "error %d converting index to oidn", err);
- /*
- * parsing may have allocated memory. free it.
- */
- snmp_reset_var_buffers(&var_ipCidrRouteDest);
- return err;
- } /* ipCidrRouteTable_index_to_oid */
- /**
- * extract ipCidrRouteTable indexes from a netsnmp_index
- *
- * @retval SNMP_ERR_NOERROR : no error
- * @retval SNMP_ERR_GENERR : error
- */
- int
- ipCidrRouteTable_index_from_oid(netsnmp_index * oid_idx,
- ipCidrRouteTable_mib_index * mib_idx)
- {
- int err = SNMP_ERR_NOERROR;
- /*
- * temp storage for parsing indexes
- */
- /*
- * ipCidrRouteDest(1)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h
- */
- netsnmp_variable_list var_ipCidrRouteDest;
- /*
- * ipCidrRouteMask(2)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h
- */
- netsnmp_variable_list var_ipCidrRouteMask;
- /*
- * ipCidrRouteTos(3)/INTEGER32/ASN_INTEGER/long(long)//l/A/w/e/R/d/h
- */
- netsnmp_variable_list var_ipCidrRouteTos;
- /*
- * ipCidrRouteNextHop(4)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h
- */
- netsnmp_variable_list var_ipCidrRouteNextHop;
- /*
- * set up varbinds
- */
- memset(&var_ipCidrRouteDest, 0x00, sizeof(var_ipCidrRouteDest));
- var_ipCidrRouteDest.type = ASN_IPADDRESS;
- memset(&var_ipCidrRouteMask, 0x00, sizeof(var_ipCidrRouteMask));
- var_ipCidrRouteMask.type = ASN_IPADDRESS;
- memset(&var_ipCidrRouteTos, 0x00, sizeof(var_ipCidrRouteTos));
- var_ipCidrRouteTos.type = ASN_INTEGER;
- memset(&var_ipCidrRouteNextHop, 0x00, sizeof(var_ipCidrRouteNextHop));
- var_ipCidrRouteNextHop.type = ASN_IPADDRESS;
- /*
- * chain temp index varbinds together
- */
- var_ipCidrRouteDest.next_variable = &var_ipCidrRouteMask;
- var_ipCidrRouteMask.next_variable = &var_ipCidrRouteTos;
- var_ipCidrRouteTos.next_variable = &var_ipCidrRouteNextHop;
- var_ipCidrRouteNextHop.next_variable = NULL;
- DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTable_index_from_oid",
- "calledn"));
- /*
- * parse the oid into the individual index components
- */
- err = parse_oid_indexes(oid_idx->oids, oid_idx->len,
- &var_ipCidrRouteDest);
- if (err == SNMP_ERR_NOERROR) {
- /*
- * copy out values
- */
- mib_idx->ipCidrRouteDest =
- *((u_long *) var_ipCidrRouteDest.val.string);
- mib_idx->ipCidrRouteMask =
- *((u_long *) var_ipCidrRouteMask.val.string);
- mib_idx->ipCidrRouteTos =
- *((long *) var_ipCidrRouteTos.val.string);
- mib_idx->ipCidrRouteNextHop =
- *((u_long *) var_ipCidrRouteNextHop.val.string);
- }
- /*
- * parsing may have allocated memory. free it.
- */
- snmp_reset_var_buffers(&var_ipCidrRouteDest);
- return err;
- } /* ipCidrRouteTable_index_from_oid */
- /*
- *********************************************************************
- * @internal
- * allocate resources for a ipCidrRouteTable_rowreq_ctx
- */
- ipCidrRouteTable_rowreq_ctx *
- ipCidrRouteTable_allocate_rowreq_ctx(ipCidrRouteTable_data * data)
- {
- ipCidrRouteTable_rowreq_ctx *rowreq_ctx =
- SNMP_MALLOC_TYPEDEF(ipCidrRouteTable_rowreq_ctx);
- DEBUGMSGTL(("internal:ipCidrRouteTable:ipCidrRouteTable_allocate_rowreq_ctx", "calledn"));
- if (NULL == rowreq_ctx) {
- snmp_log(LOG_ERR, "Couldn't allocate memory for a "
- "ipCidrRouteTable_rowreq_ctx.n");
- } else {
- if (NULL != data) {
- rowreq_ctx->data = data;
- } else if (NULL ==
- (rowreq_ctx->data = ipCidrRouteTable_allocate_data())) {
- SNMP_FREE(rowreq_ctx);
- return NULL;
- }
- }
- /*
- * undo context will be allocated when needed (in *_undo_setup)
- */
- rowreq_ctx->oid_idx.oids = rowreq_ctx->oid_tmp;
- rowreq_ctx->ipCidrRouteTable_data_list = NULL;
- rowreq_ctx->ipCidrRouteTable_reg = ipCidrRouteTable_if_ctx.user_ctx;
- return rowreq_ctx;
- } /* ipCidrRouteTable_allocate_rowreq_ctx */
- /*
- * @internal
- * release resources for a ipCidrRouteTable_rowreq_ctx
- */
- void
- ipCidrRouteTable_release_rowreq_ctx(ipCidrRouteTable_rowreq_ctx *
- rowreq_ctx)
- {
- DEBUGMSGTL(("internal:ipCidrRouteTable:ipCidrRouteTable_release_rowreq_ctx", "calledn"));
- netsnmp_assert(NULL != rowreq_ctx);
- if (rowreq_ctx->data)
- ipCidrRouteTable_release_data(rowreq_ctx->data);
- if (rowreq_ctx->undo)
- ipCidrRouteTable_release_data(rowreq_ctx->undo);
- /*
- * free index oid pointer
- */
- if (rowreq_ctx->oid_idx.oids != rowreq_ctx->oid_tmp)
- free(rowreq_ctx->oid_idx.oids);
- SNMP_FREE(rowreq_ctx);
- } /* ipCidrRouteTable_release_rowreq_ctx */
- /**
- * @internal
- * wrapper
- */
- static int
- _mfd_ipCidrRouteTable_pre_request(netsnmp_mib_handler *handler,
- netsnmp_handler_registration *reginfo,
- netsnmp_agent_request_info *agtreq_info,
- netsnmp_request_info *requests)
- {
- int rc =
- ipCidrRouteTable_pre_request(ipCidrRouteTable_if_ctx.user_ctx);
- if (MFD_SUCCESS != rc) {
- /*
- * nothing we can do about it but log it
- */
- DEBUGMSGTL(("internal:ipCidrRouteTable", "error %d from "
- "ipCidrRouteTable_pre_requestn", rc));
- netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
- }
- return SNMP_ERR_NOERROR;
- } /* _mfd_ipCidrRouteTable_pre_request */
- /**
- * @internal
- * wrapper
- */
- static int
- _mfd_ipCidrRouteTable_post_request(netsnmp_mib_handler *handler,
- netsnmp_handler_registration *reginfo,
- netsnmp_agent_request_info *agtreq_info,
- netsnmp_request_info *requests)
- {
- ipCidrRouteTable_rowreq_ctx *rowreq_ctx;
- int rc =
- ipCidrRouteTable_post_request(ipCidrRouteTable_if_ctx.user_ctx);
- if (MFD_SUCCESS != rc) {
- /*
- * nothing we can do about it but log it
- */
- DEBUGMSGTL(("internal:ipCidrRouteTable", "error %d from "
- "ipCidrRouteTable_post_requestn", rc));
- }
- /*
- * if it was set, clear row created flag.
- */
- rowreq_ctx = netsnmp_container_table_row_extract(requests);
- if ((NULL != rowreq_ctx)
- && (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED))
- rowreq_ctx->rowreq_flags &= ~MFD_ROW_CREATED;
- return SNMP_ERR_NOERROR;
- } /* _mfd_ipCidrRouteTable_post_request */
- /**
- * @internal
- * wrapper
- */
- static int
- _mfd_ipCidrRouteTable_object_lookup(netsnmp_mib_handler *handler,
- netsnmp_handler_registration *reginfo,
- netsnmp_agent_request_info
- *agtreq_info,
- netsnmp_request_info *requests)
- {
- ipCidrRouteTable_rowreq_ctx *rowreq_ctx =
- netsnmp_container_table_row_extract(requests);
- DEBUGMSGTL(("internal:ipCidrRouteTable:_mfd_ipCidrRouteTable_object_lookup", "calledn"));
- /*
- * get our context from mfd
- * ipCidrRouteTable_interface_ctx *if_ctx =
- * (ipCidrRouteTable_interface_ctx *)reginfo->my_reg_void;
- */
- if (NULL == rowreq_ctx) {
- int rc = MFD_SUCCESS;
- netsnmp_table_request_info *tblreq_info;
- netsnmp_index oid_idx;
- ipCidrRouteTable_mib_index mib_idx;
- tblreq_info = netsnmp_extract_table_info(requests);
- if (NULL == tblreq_info) {
- snmp_log(LOG_ERR, "request had no table infon");
- return MFD_ERROR;
- }
- /*
- * try to parse oid
- */
- oid_idx.oids = tblreq_info->index_oid;
- oid_idx.len = tblreq_info->index_oid_len;
- rc = ipCidrRouteTable_index_from_oid(&oid_idx, &mib_idx);
- if (MFD_SUCCESS != rc) {
- DEBUGMSGT(("ipCidrRouteTable", "error parsing indexn"));
- netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
- } else {
- /*
- * allocate new context
- */
- rowreq_ctx = ipCidrRouteTable_allocate_rowreq_ctx(NULL);
- if (NULL == rowreq_ctx)
- return MFD_ERROR; /* msg already logged */
- memcpy(&rowreq_ctx->tbl_idx, &mib_idx, sizeof(mib_idx));
- /*
- * check indexes
- */
- rc = _ipCidrRouteTable_check_indexes(rowreq_ctx);
- if (MFD_SUCCESS != rc) {
- netsnmp_assert((rc == SNMP_ERR_NOCREATION) ||
- (rc == SNMP_ERR_INCONSISTENTNAME));
- netsnmp_request_set_error_all(requests,
- SNMP_VALIDATE_ERR(rc));
- ipCidrRouteTable_release_rowreq_ctx(rowreq_ctx);
- } else {
- rowreq_ctx->rowreq_flags |= MFD_ROW_CREATED;
- netsnmp_container_table_row_insert(requests, rowreq_ctx);
- }
- }
- } else {
- ipCidrRouteTable_row_prep(rowreq_ctx);
- }
- return SNMP_ERR_NOERROR;
- } /* _mfd_ipCidrRouteTable_object_lookup */
- /***********************************************************************
- *
- * GET processing
- *
- ***********************************************************************/
- /*
- * @internal
- * Retrieve the value for a particular column
- */
- NETSNMP_STATIC_INLINE int
- _ipCidrRouteTable_get_column(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
- netsnmp_variable_list * var, int column)
- {
- int rc = SNMPERR_SUCCESS;
- DEBUGMSGTL(("internal:ipCidrRouteTable:_mfd_ipCidrRouteTable_get_column", "calledn"));
- netsnmp_assert(NULL != rowreq_ctx);
- switch (column) {
- /*
- * (INDEX) ipCidrRouteDest(1)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h
- */
- case COLUMN_IPCIDRROUTEDEST:
- var->type = ASN_IPADDRESS;
- var->val_len = sizeof(u_long);
- (*var->val.integer) = rowreq_ctx->tbl_idx.ipCidrRouteDest;
- break;
- /*
- * (INDEX) ipCidrRouteMask(2)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h
- */
- case COLUMN_IPCIDRROUTEMASK:
- var->type = ASN_IPADDRESS;
- var->val_len = sizeof(u_long);
- (*var->val.integer) = rowreq_ctx->tbl_idx.ipCidrRouteMask;
- break;
- /*
- * (INDEX) ipCidrRouteTos(3)/INTEGER32/ASN_INTEGER/long(long)//l/A/w/e/R/d/h
- */
- case COLUMN_IPCIDRROUTETOS:
- var->type = ASN_INTEGER;
- var->val_len = sizeof(long);
- (*var->val.integer) = rowreq_ctx->tbl_idx.ipCidrRouteTos;
- break;
- /*
- * (INDEX) ipCidrRouteNextHop(4)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h
- */
- case COLUMN_IPCIDRROUTENEXTHOP:
- var->type = ASN_IPADDRESS;
- var->val_len = sizeof(u_long);
- (*var->val.integer) = rowreq_ctx->tbl_idx.ipCidrRouteNextHop;
- break;
- /*
- * ipCidrRouteIfIndex(5)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
- */
- case COLUMN_IPCIDRROUTEIFINDEX:
- var->val_len = sizeof(long);
- var->type = ASN_INTEGER;
- rc = ipCidrRouteIfIndex_get(rowreq_ctx, (long *) var->val.string);
- break;
- /*
- * ipCidrRouteType(6)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
- */
- case COLUMN_IPCIDRROUTETYPE:
- var->val_len = sizeof(u_long);
- var->type = ASN_INTEGER;
- rc = ipCidrRouteType_get(rowreq_ctx, (u_long *) var->val.string);
- break;
- /*
- * ipCidrRouteProto(7)/INTEGER/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
- */
- case COLUMN_IPCIDRROUTEPROTO:
- var->val_len = sizeof(u_long);
- var->type = ASN_INTEGER;
- rc = ipCidrRouteProto_get(rowreq_ctx, (u_long *) var->val.string);
- break;
- /*
- * ipCidrRouteAge(8)/INTEGER32/ASN_INTEGER/long(long)//l/A/w/e/r/D/h
- */
- case COLUMN_IPCIDRROUTEAGE:
- var->val_len = sizeof(long);
- var->type = ASN_INTEGER;
- rc = ipCidrRouteAge_get(rowreq_ctx, (long *) var->val.string);
- break;
- /*
- * ipCidrRouteInfo(9)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/A/W/e/r/d/h
- */
- case COLUMN_IPCIDRROUTEINFO:
- var->type = ASN_OBJECT_ID;
- rc = ipCidrRouteInfo_get(rowreq_ctx, (oid **) & var->val.string,
- &var->val_len);
- break;
- /*
- * ipCidrRouteNextHopAS(10)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
- */
- case COLUMN_IPCIDRROUTENEXTHOPAS:
- var->val_len = sizeof(long);
- var->type = ASN_INTEGER;
- rc = ipCidrRouteNextHopAS_get(rowreq_ctx,
- (long *) var->val.string);
- break;
- /*
- * ipCidrRouteMetric1(11)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
- */
- case COLUMN_IPCIDRROUTEMETRIC1:
- var->val_len = sizeof(long);
- var->type = ASN_INTEGER;
- rc = ipCidrRouteMetric1_get(rowreq_ctx, (long *) var->val.string);
- break;
- /*
- * ipCidrRouteMetric2(12)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
- */
- case COLUMN_IPCIDRROUTEMETRIC2:
- var->val_len = sizeof(long);
- var->type = ASN_INTEGER;
- rc = ipCidrRouteMetric2_get(rowreq_ctx, (long *) var->val.string);
- break;
- /*
- * ipCidrRouteMetric3(13)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
- */
- case COLUMN_IPCIDRROUTEMETRIC3:
- var->val_len = sizeof(long);
- var->type = ASN_INTEGER;
- rc = ipCidrRouteMetric3_get(rowreq_ctx, (long *) var->val.string);
- break;
- /*
- * ipCidrRouteMetric4(14)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
- */
- case COLUMN_IPCIDRROUTEMETRIC4:
- var->val_len = sizeof(long);
- var->type = ASN_INTEGER;
- rc = ipCidrRouteMetric4_get(rowreq_ctx, (long *) var->val.string);
- break;
- /*
- * ipCidrRouteMetric5(15)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
- */
- case COLUMN_IPCIDRROUTEMETRIC5:
- var->val_len = sizeof(long);
- var->type = ASN_INTEGER;
- rc = ipCidrRouteMetric5_get(rowreq_ctx, (long *) var->val.string);
- break;
- /*
- * ipCidrRouteStatus(16)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
- */
- case COLUMN_IPCIDRROUTESTATUS:
- var->val_len = sizeof(u_long);
- var->type = ASN_INTEGER;
- rc = ipCidrRouteStatus_get(rowreq_ctx, (u_long *) var->val.string);
- break;
- default:
- snmp_log(LOG_ERR,
- "unknown column %d in _ipCidrRouteTable_get_columnn",
- column);
- break;
- }
- return rc;
- } /* _ipCidrRouteTable_get_column */
- int
- _mfd_ipCidrRouteTable_get_values(netsnmp_mib_handler *handler,
- netsnmp_handler_registration *reginfo,
- netsnmp_agent_request_info *agtreq_info,
- netsnmp_request_info *requests)
- {
- ipCidrRouteTable_rowreq_ctx *rowreq_ctx =
- netsnmp_container_table_row_extract(requests);
- netsnmp_table_request_info *tri;
- u_char *old_string;
- void (*dataFreeHook) (void *);
- int rc;
- DEBUGMSGTL(("internal:ipCidrRouteTable:_mfd_ipCidrRouteTable_get_values", "calledn"));
- netsnmp_assert(NULL != rowreq_ctx);
- for (; requests; requests = requests->next) {
- /*
- * save old pointer, so we can free it if replaced
- */
- old_string = requests->requestvb->val.string;
- dataFreeHook = requests->requestvb->dataFreeHook;
- if (NULL == requests->requestvb->val.string) {
- requests->requestvb->val.string = requests->requestvb->buf;
- requests->requestvb->val_len =
- sizeof(requests->requestvb->buf);
- } else if (requests->requestvb->buf ==
- requests->requestvb->val.string) {
- if (requests->requestvb->val_len !=
- sizeof(requests->requestvb->buf))
- requests->requestvb->val_len =
- sizeof(requests->requestvb->buf);
- }
- /*
- * get column data
- */
- tri = netsnmp_extract_table_info(requests);
- if (NULL == tri)
- continue;
- rc = _ipCidrRouteTable_get_column(rowreq_ctx, requests->requestvb,
- tri->colnum);
- if (rc) {
- if (MFD_SKIP == rc) {
- requests->requestvb->type = ASN_PRIV_RETRY;
- rc = SNMP_ERR_NOERROR;
- }
- } else if (NULL == requests->requestvb->val.string) {
- snmp_log(LOG_ERR, "NULL varbind data pointer!n");
- rc = SNMP_ERR_GENERR;
- }
- if (rc)
- netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc));
- /*
- * if the buffer wasn't used previously for the old data (i.e. it
- * was allcoated memory) and the get routine replaced the pointer,
- * we need to free the previous pointer.
- */
- if (old_string && (old_string != requests->requestvb->buf) &&
- (requests->requestvb->val.string != old_string)) {
- if (dataFreeHook)
- (*dataFreeHook) (old_string);
- else
- free(old_string);
- }
- } /* for results */
- return SNMP_ERR_NOERROR;
- } /* _mfd_ipCidrRouteTable_get_values */
- /***********************************************************************
- *
- * SET processing
- *
- ***********************************************************************/
- /*----------------------------------------------------------------------
- *
- * SET: Syntax checks
- *
- *---------------------------------------------------------------------*/
- /*
- * @internal
- * Check the syntax for a particular column
- */
- NETSNMP_STATIC_INLINE int
- _ipCidrRouteTable_check_column(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
- netsnmp_variable_list * var, int column)
- {
- int rc = SNMPERR_SUCCESS;
- DEBUGMSGTL(("internal:ipCidrRouteTable:_ipCidrRouteTable_check_column",
- "calledn"));
- netsnmp_assert(NULL != rowreq_ctx);
- switch (column) {
- /*
- * ipCidrRouteIfIndex(5)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
- */
- case COLUMN_IPCIDRROUTEIFINDEX:
- rc = netsnmp_check_vb_type(var, ASN_INTEGER);
- /*
- * yyy-rks: anything else we can do here?
- */
- if (SNMPERR_SUCCESS == rc) {
- rc = ipCidrRouteIfIndex_check_value(rowreq_ctx,
- *((long *) var->val.
- string));
- if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
- && (MFD_NOT_VALID_NOW != rc)) {
- snmp_log(LOG_ERR,
- "bad rc %d from ipCidrRouteIfIndex_check_valuen",
- rc);
- rc = SNMP_ERR_GENERR;
- }
- }
- break;
- /*
- * ipCidrRouteType(6)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
- */
- case COLUMN_IPCIDRROUTETYPE:
- rc = netsnmp_check_vb_type(var, ASN_INTEGER);
- if (SNMPERR_SUCCESS == rc) {
- /*
- * check that the value is one of defined enums
- */
- if (1 && (*var->val.integer != IPCIDRROUTETYPE_OTHER)
- && (*var->val.integer != IPCIDRROUTETYPE_REJECT)
- && (*var->val.integer != IPCIDRROUTETYPE_LOCAL)
- && (*var->val.integer != IPCIDRROUTETYPE_REMOTE)
- ) {
- rc = SNMP_ERR_WRONGVALUE;
- }
- }
- if (SNMPERR_SUCCESS == rc) {
- rc = ipCidrRouteType_check_value(rowreq_ctx,
- *((u_long *) var->val.
- string));
- if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
- && (MFD_NOT_VALID_NOW != rc)) {
- snmp_log(LOG_ERR,
- "bad rc %d from ipCidrRouteType_check_valuen",
- rc);
- rc = SNMP_ERR_GENERR;
- }
- }
- break;
- /*
- * ipCidrRouteInfo(9)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/A/W/e/r/d/h
- */
- case COLUMN_IPCIDRROUTEINFO:
- rc = netsnmp_check_vb_type(var, ASN_OBJECT_ID);
- /*
- * yyy-rks: anything else we can do here?
- */
- if (SNMPERR_SUCCESS == rc) {
- rc = ipCidrRouteInfo_check_value(rowreq_ctx,
- (oid *) var->val.string,
- var->val_len);
- if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
- && (MFD_NOT_VALID_NOW != rc)) {
- snmp_log(LOG_ERR,
- "bad rc %d from ipCidrRouteInfo_check_valuen",
- rc);
- rc = SNMP_ERR_GENERR;
- }
- }
- break;
- /*
- * ipCidrRouteNextHopAS(10)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
- */
- case COLUMN_IPCIDRROUTENEXTHOPAS:
- rc = netsnmp_check_vb_type(var, ASN_INTEGER);
- /*
- * yyy-rks: anything else we can do here?
- */
- if (SNMPERR_SUCCESS == rc) {
- rc = ipCidrRouteNextHopAS_check_value(rowreq_ctx,
- *((long *) var->val.
- string));
- if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
- && (MFD_NOT_VALID_NOW != rc)) {
- snmp_log(LOG_ERR,
- "bad rc %d from ipCidrRouteNextHopAS_check_valuen",
- rc);
- rc = SNMP_ERR_GENERR;
- }
- }
- break;
- /*
- * ipCidrRouteMetric1(11)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
- */
- case COLUMN_IPCIDRROUTEMETRIC1:
- rc = netsnmp_check_vb_type(var, ASN_INTEGER);
- /*
- * yyy-rks: anything else we can do here?
- */
- if (SNMPERR_SUCCESS == rc) {
- rc = ipCidrRouteMetric1_check_value(rowreq_ctx,
- *((long *) var->val.
- string));
- if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
- && (MFD_NOT_VALID_NOW != rc)) {
- snmp_log(LOG_ERR,
- "bad rc %d from ipCidrRouteMetric1_check_valuen",
- rc);
- rc = SNMP_ERR_GENERR;
- }
- }
- break;
- /*
- * ipCidrRouteMetric2(12)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
- */
- case COLUMN_IPCIDRROUTEMETRIC2:
- rc = netsnmp_check_vb_type(var, ASN_INTEGER);
- /*
- * yyy-rks: anything else we can do here?
- */
- if (SNMPERR_SUCCESS == rc) {
- rc = ipCidrRouteMetric2_check_value(rowreq_ctx,
- *((long *) var->val.
- string));
- if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
- && (MFD_NOT_VALID_NOW != rc)) {
- snmp_log(LOG_ERR,
- "bad rc %d from ipCidrRouteMetric2_check_valuen",
- rc);
- rc = SNMP_ERR_GENERR;
- }
- }
- break;
- /*
- * ipCidrRouteMetric3(13)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
- */
- case COLUMN_IPCIDRROUTEMETRIC3:
- rc = netsnmp_check_vb_type(var, ASN_INTEGER);
- /*
- * yyy-rks: anything else we can do here?
- */
- if (SNMPERR_SUCCESS == rc) {
- rc = ipCidrRouteMetric3_check_value(rowreq_ctx,
- *((long *) var->val.
- string));
- if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
- && (MFD_NOT_VALID_NOW != rc)) {
- snmp_log(LOG_ERR,
- "bad rc %d from ipCidrRouteMetric3_check_valuen",
- rc);
- rc = SNMP_ERR_GENERR;
- }
- }
- break;
- /*
- * ipCidrRouteMetric4(14)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
- */
- case COLUMN_IPCIDRROUTEMETRIC4:
- rc = netsnmp_check_vb_type(var, ASN_INTEGER);
- /*
- * yyy-rks: anything else we can do here?
- */
- if (SNMPERR_SUCCESS == rc) {
- rc = ipCidrRouteMetric4_check_value(rowreq_ctx,
- *((long *) var->val.
- string));
- if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
- && (MFD_NOT_VALID_NOW != rc)) {
- snmp_log(LOG_ERR,
- "bad rc %d from ipCidrRouteMetric4_check_valuen",
- rc);
- rc = SNMP_ERR_GENERR;
- }
- }
- break;
- /*
- * ipCidrRouteMetric5(15)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
- */
- case COLUMN_IPCIDRROUTEMETRIC5:
- rc = netsnmp_check_vb_type(var, ASN_INTEGER);
- /*
- * yyy-rks: anything else we can do here?
- */
- if (SNMPERR_SUCCESS == rc) {
- rc = ipCidrRouteMetric5_check_value(rowreq_ctx,
- *((long *) var->val.
- string));
- if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
- && (MFD_NOT_VALID_NOW != rc)) {
- snmp_log(LOG_ERR,
- "bad rc %d from ipCidrRouteMetric5_check_valuen",
- rc);
- rc = SNMP_ERR_GENERR;
- }
- }
- break;
- /*
- * ipCidrRouteStatus(16)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
- */
- case COLUMN_IPCIDRROUTESTATUS:
- rc = netsnmp_check_vb_rowstatus_value(var);
- if (SNMPERR_SUCCESS == rc) {
- rc = ipCidrRouteStatus_check_value(rowreq_ctx,
- *((u_long *) var->val.
- string));
- if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
- && (MFD_NOT_VALID_NOW != rc)) {
- snmp_log(LOG_ERR,
- "bad rc %d from ipCidrRouteStatus_check_valuen",
- rc);
- rc = SNMP_ERR_GENERR;
- }
- }
- break;
- default: /** We shouldn't get here */
- rc = SNMP_ERR_GENERR;
- snmp_log(LOG_ERR,
- "unknown column %d in _ipCidrRouteTable_check_columnn",
- column);
- }
- return rc;
- } /* _ipCidrRouteTable_check_column */
- int
- _mfd_ipCidrRouteTable_check_objects(netsnmp_mib_handler *handler,
- netsnmp_handler_registration *reginfo,
- netsnmp_agent_request_info
- *agtreq_info,
- netsnmp_request_info *requests)
- {
- ipCidrRouteTable_rowreq_ctx *rowreq_ctx =
- netsnmp_container_table_row_extract(requests);
- int rc;
- DEBUGMSGTL(("internal:ipCidrRouteTable:_mfd_ipCidrRouteTable_check_objects", "calledn"));
- netsnmp_assert(NULL != rowreq_ctx);
- for (; requests; requests = requests->next) {
- /*
- * get column number from table request info, and check that column
- */
- netsnmp_table_request_info *tri;
- tri = netsnmp_extract_table_info(requests);
- if (NULL == tri)
- continue;
- rc = _ipCidrRouteTable_check_column(rowreq_ctx,
- requests->requestvb,
- tri->colnum);
- if (rc) {
- netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc));
- break;
- }
- } /* for results */
- return SNMP_ERR_NOERROR;
- } /* _mfd_ipCidrRouteTable_check_objects */
- NETSNMP_STATIC_INLINE int
- _ipCidrRouteTable_check_indexes(ipCidrRouteTable_rowreq_ctx * rowreq_ctx)
- {
- int rc;
- DEBUGMSGTL(("internal:ipCidrRouteTable:_ipCidrRouteTable_check_indexes", "calledn"));
- netsnmp_assert(NULL != rowreq_ctx);
- /*
- * (INDEX) ipCidrRouteDest(1)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h
- */
- rc = ipCidrRouteDest_check_index(rowreq_ctx);
- if (MFD_SUCCESS != rc)
- return SNMP_ERR_NOCREATION;
- /*
- * (INDEX) ipCidrRouteMask(2)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h
- */
- rc = ipCidrRouteMask_check_index(rowreq_ctx);
- if (MFD_SUCCESS != rc)
- return SNMP_ERR_NOCREATION;
- /*
- * (INDEX) ipCidrRouteTos(3)/INTEGER32/ASN_INTEGER/long(long)//l/A/w/e/R/d/h
- */
- rc = ipCidrRouteTos_check_index(rowreq_ctx);
- if (MFD_SUCCESS != rc)
- return SNMP_ERR_NOCREATION;
- /*
- * (INDEX) ipCidrRouteNextHop(4)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h
- */
- rc = ipCidrRouteNextHop_check_index(rowreq_ctx);
- if (MFD_SUCCESS != rc)
- return SNMP_ERR_NOCREATION;
- /*
- * if individual parts look ok, check them as a whole
- */
- return ipCidrRouteTable_validate_index(rowreq_ctx->
- ipCidrRouteTable_reg,
- rowreq_ctx);
- } /* _ipCidrRouteTable_check_indexes */
- /*----------------------------------------------------------------------
- *
- * SET: Undo setup
- *
- *---------------------------------------------------------------------*/
- /*
- * @internal
- * Set the value for a particular column
- */
- NETSNMP_STATIC_INLINE int
- _ipCidrRouteTable_undo_setup_column(ipCidrRouteTable_rowreq_ctx *
- rowreq_ctx, int column)
- {
- int rc = SNMPERR_SUCCESS;
- DEBUGMSGTL(("internal:ipCidrRouteTable:_ipCidrRouteTable_undo_setup_column", "calledn"));
- netsnmp_assert(NULL != rowreq_ctx);
- switch (column) {
- /*
- * ipCidrRouteIfIndex(5)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
- */
- case COLUMN_IPCIDRROUTEIFINDEX:
- rowreq_ctx->column_set_flags |= FLAG_IPCIDRROUTEIFINDEX;
- rc = ipCidrRouteIfIndex_undo_setup(rowreq_ctx);
- break;
- /*
- * ipCidrRouteType(6)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
- */
- case COLUMN_IPCIDRROUTETYPE:
- rowreq_ctx->column_set_flags |= FLAG_IPCIDRROUTETYPE;
- rc = ipCidrRouteType_undo_setup(rowreq_ctx);
- break;
- /*
- * ipCidrRouteInfo(9)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/A/W/e/r/d/h
- */
- case COLUMN_IPCIDRROUTEINFO:
- rowreq_ctx->column_set_flags |= FLAG_IPCIDRROUTEINFO;
- rc = ipCidrRouteInfo_undo_setup(rowreq_ctx);
- break;
- /*
- * ipCidrRouteNextHopAS(10)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
- */
- case COLUMN_IPCIDRROUTENEXTHOPAS:
- rowreq_ctx->column_set_flags |= FLAG_IPCIDRROUTENEXTHOPAS;
- rc = ipCidrRouteNextHopAS_undo_setup(rowreq_ctx);
- break;
- /*
- * ipCidrRouteMetric1(11)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
- */
- case COLUMN_IPCIDRROUTEMETRIC1:
- rowreq_ctx->column_set_flags |= FLAG_IPCIDRROUTEMETRIC1;
- rc = ipCidrRouteMetric1_undo_setup(rowreq_ctx);
- break;
- /*
- * ipCidrRouteMetric2(12)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
- */
- case COLUMN_IPCIDRROUTEMETRIC2:
- rowreq_ctx->column_set_flags |= FLAG_IPCIDRROUTEMETRIC2;
- rc = ipCidrRouteMetric2_undo_setup(rowreq_ctx);
- break;
- /*
- * ipCidrRouteMetric3(13)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
- */
- case COLUMN_IPCIDRROUTEMETRIC3:
- rowreq_ctx->column_set_flags |= FLAG_IPCIDRROUTEMETRIC3;
- rc = ipCidrRouteMetric3_undo_setup(rowreq_ctx);
- break;
- /*
- * ipCidrRouteMetric4(14)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
- */
- case COLUMN_IPCIDRROUTEMETRIC4:
- rowreq_ctx->column_set_flags |= FLAG_IPCIDRROUTEMETRIC4;
- rc = ipCidrRouteMetric4_undo_setup(rowreq_ctx);
- break;
- /*
- * ipCidrRouteMetric5(15)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
- */
- case COLUMN_IPCIDRROUTEMETRIC5:
- rowreq_ctx->column_set_flags |= FLAG_IPCIDRROUTEMETRIC5;
- rc = ipCidrRouteMetric5_undo_setup(rowreq_ctx);
- break;
- /*
- * ipCidrRouteStatus(16)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
- */
- case COLUMN_IPCIDRROUTESTATUS:
- rowreq_ctx->column_set_flags |= FLAG_IPCIDRROUTESTATUS;
- rc = ipCidrRouteStatus_undo_setup(rowreq_ctx);
- break;
- default:
- snmp_log(LOG_ERR,
- "unknown column %d in _ipCidrRouteTable_undo_setup_columnn",
- column);
- break;
- }
- return rc;
- } /* _ipCidrRouteTable_undo_setup_column */
- /**
- * @internal
- * undo setup
- */
- int
- _mfd_ipCidrRouteTable_undo_setup(netsnmp_mib_handler *handler,
- netsnmp_handler_registration *reginfo,
- netsnmp_agent_request_info *agtreq_info,
- netsnmp_request_info *requests)
- {
- int rc;
- ipCidrRouteTable_rowreq_ctx *rowreq_ctx =
- netsnmp_container_table_row_extract(requests);
- DEBUGMSGTL(("internal:ipCidrRouteTable:_mfd_ipCidrRouteTable_undo_setup", "calledn"));
- netsnmp_assert(NULL != rowreq_ctx);
- /*
- * allocate undo context
- */
- rowreq_ctx->undo = ipCidrRouteTable_allocate_data();
- if (NULL == rowreq_ctx->undo) {
- /** msg already logged */
- netsnmp_request_set_error_all(requests,
- SNMP_ERR_RESOURCEUNAVAILABLE);
- return SNMP_ERR_NOERROR;
- }
- /*
- * row undo setup
- */
- rowreq_ctx->column_set_flags = 0;
- rc = ipCidrRouteTable_undo_setup(rowreq_ctx);
- if (MFD_SUCCESS != rc) {
- DEBUGMSGTL(("verbose:ipCidrRouteTable:mfd", "error %d from "
- "ipCidrRouteTable_undo_setupn", rc));
- netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
- } else {
- /*
- * column undo setup
- */
- netsnmp_table_request_info *tri;
- for (; requests; requests = requests->next) {
- /*
- * set column data
- */
- tri = netsnmp_extract_table_info(requests);
- if (NULL == tri)
- continue;
- rc = _ipCidrRouteTable_undo_setup_column(rowreq_ctx,
- tri->colnum);
- if (MFD_SUCCESS != rc) {
- DEBUGMSGTL(("verbose:ipCidrRouteTable:mfd",
- "error %d from "
- "ipCidrRouteTable_undo_setup_columnn", rc));
- netsnmp_set_request_error(agtreq_info, requests,
- SNMP_VALIDATE_ERR(rc));
- }
- } /* for results */
- }
- return SNMP_ERR_NOERROR;
- } /* _mfd_ipCidrRouteTable_undo_setup */
- /**
- * @internal
- * undo setup
- */
- int
- _mfd_ipCidrRouteTable_undo_cleanup(netsnmp_mib_handler *handler,
- netsnmp_handler_registration *reginfo,
- netsnmp_agent_request_info *agtreq_info,
- netsnmp_request_info *requests)
- {
- ipCidrRouteTable_rowreq_ctx *rowreq_ctx =
- netsnmp_container_table_row_extract(requests);
- int rc;
- DEBUGMSGTL(("internal:ipCidrRouteTable:_mfd_ipCidrRouteTable_undo_cleanup", "calledn"));
- /*
- * failed row create in early stages has no rowreq_ctx
- */
- if (NULL == rowreq_ctx)
- return MFD_SUCCESS;
- /*
- * call user cleanup
- */
- rc = ipCidrRouteTable_undo_cleanup(rowreq_ctx);
- if (MFD_SUCCESS != rc) {
- /*
- * nothing we can do about it but log it
- */
- DEBUGMSGTL(("verbose:ipCidrRouteTable:mfd", "error %d from "
- "ipCidrRouteTable_undo_cleanupn", rc));
- }
- /*
- * release undo context, if needed
- */
- if (rowreq_ctx->undo) {
- ipCidrRouteTable_release_data(rowreq_ctx->undo);
- rowreq_ctx->undo = NULL;
- }
- /*
- * clear set flags
- */
- rowreq_ctx->column_set_flags = 0;
- return SNMP_ERR_NOERROR;
- } /* _mfd_ipCidrRouteTable_undo_cleanup */
- /*----------------------------------------------------------------------
- *
- * SET: Set values
- *
- *---------------------------------------------------------------------*/
- /*
- * @internal
- * Set the value for a particular column
- */
- NETSNMP_STATIC_INLINE int
- _ipCidrRouteTable_set_column(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
- netsnmp_variable_list * var, int column)
- {
- int rc = SNMPERR_SUCCESS;
- DEBUGMSGTL(("internal:ipCidrRouteTable:_ipCidrRouteTable_set_column",
- "calledn"));
- netsnmp_assert(NULL != rowreq_ctx);
- switch (column) {
- /*
- * ipCidrRouteIfIndex(5)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
- */
- case COLUMN_IPCIDRROUTEIFINDEX:
- if (var->val_len != sizeof(long)) {
- rc = SNMP_ERR_WRONGLENGTH;
- snmp_log(LOG_ERR,
- "varbind size of %d does not match expected size %dn",
- var->val_len, sizeof(long));
- break;
- }
- rowreq_ctx->column_set_flags |= FLAG_IPCIDRROUTEIFINDEX;
- rc = ipCidrRouteIfIndex_set(rowreq_ctx,
- *((long *) var->val.string));
- break;
- /*
- * ipCidrRouteType(6)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
- */
- case COLUMN_IPCIDRROUTETYPE:
- if (var->val_len != sizeof(u_long)) {
- rc = SNMP_ERR_WRONGLENGTH;
- snmp_log(LOG_ERR,
- "varbind size of %d does not match expected size %dn",
- var->val_len, sizeof(u_long));
- break;
- }
- rowreq_ctx->column_set_flags |= FLAG_IPCIDRROUTETYPE;
- rc = ipCidrRouteType_set(rowreq_ctx,
- *((u_long *) var->val.string));
- break;
- /*
- * ipCidrRouteInfo(9)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/A/W/e/r/d/h
- */
- case COLUMN_IPCIDRROUTEINFO:
- rowreq_ctx->column_set_flags |= FLAG_IPCIDRROUTEINFO;
- rc = ipCidrRouteInfo_set(rowreq_ctx, (oid *) var->val.string,
- var->val_len);
- break;
- /*
- * ipCidrRouteNextHopAS(10)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
- */
- case COLUMN_IPCIDRROUTENEXTHOPAS:
- if (var->val_len != sizeof(long)) {
- rc = SNMP_ERR_WRONGLENGTH;
- snmp_log(LOG_ERR,
- "varbind size of %d does not match expected size %dn",
- var->val_len, sizeof(long));
- break;
- }
- rowreq_ctx->column_set_flags |= FLAG_IPCIDRROUTENEXTHOPAS;
- rc = ipCidrRouteNextHopAS_set(rowreq_ctx,
- *((long *) var->val.string));
- break;
- /*
- * ipCidrRouteMetric1(11)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
- */
- case COLUMN_IPCIDRROUTEMETRIC1:
- if (var->val_len != sizeof(long)) {
- rc = SNMP_ERR_WRONGLENGTH;
- snmp_log(LOG_ERR,
- "varbind size of %d does not match expected size %dn",
- var->val_len, sizeof(long));
- break;
- }
- rowreq_ctx->column_set_flags |= FLAG_IPCIDRROUTEMETRIC1;
- rc = ipCidrRouteMetric1_set(rowreq_ctx,
- *((long *) var->val.string));
- break;
- /*
- * ipCidrRouteMetric2(12)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
- */
- case COLUMN_IPCIDRROUTEMETRIC2:
- if (var->val_len != sizeof(long)) {
- rc = SNMP_ERR_WRONGLENGTH;
- snmp_log(LOG_ERR,
- "varbind size of %d does not match expected size %dn",
- var->val_len, sizeof(long));
- break;
- }
- rowreq_ctx->column_set_flags |= FLAG_IPCIDRROUTEMETRIC2;
- rc = ipCidrRouteMetric2_set(rowreq_ctx,
- *((long *) var->val.string));
- break;
- /*
- * ipCidrRouteMetric3(13)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
- */
- case COLUMN_IPCIDRROUTEMETRIC3:
- if (var->val_len != sizeof(long)) {
- rc = SNMP_ERR_WRONGLENGTH;
- snmp_log(LOG_ERR,
- "varbind size of %d does not match expected size %dn",
- var->val_len, sizeof(long));
- break;
- }
- rowreq_ctx->column_set_flags |= FLAG_IPCIDRROUTEMETRIC3;
- rc = ipCidrRouteMetric3_set(rowreq_ctx,
- *((long *) var->val.string));
- break;
- /*
- * ipCidrRouteMetric4(14)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
- */
- case COLUMN_IPCIDRROUTEMETRIC4:
- if (var->val_len != sizeof(long)) {
- rc = SNMP_ERR_WRONGLENGTH;
- snmp_log(LOG_ERR,
- "varbind size of %d does not match expected size %dn",
- var->val_len, sizeof(long));
- break;
- }
- rowreq_ctx->column_set_flags |= FLAG_IPCIDRROUTEMETRIC4;
- rc = ipCidrRouteMetric4_set(rowreq_ctx,
- *((long *) var->val.string));
- break;
- /*
- * ipCidrRouteMetric5(15)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
- */
- case COLUMN_IPCIDRROUTEMETRIC5:
- if (var->val_len != sizeof(long)) {
- rc = SNMP_ERR_WRONGLENGTH;
- snmp_log(LOG_ERR,
- "varbind size of %d does not match expected size %dn",
- var->val_len, sizeof(long));
- break;
- }
- rowreq_ctx->column_set_flags |= FLAG_IPCIDRROUTEMETRIC5;
- rc = ipCidrRouteMetric5_set(rowreq_ctx,
- *((long *) var->val.string));
- break;
- /*
- * ipCidrRouteStatus(16)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
- */
- case COLUMN_IPCIDRROUTESTATUS:
- if (var->val_len != sizeof(u_long)) {
- rc = SNMP_ERR_WRONGLENGTH;
- snmp_log(LOG_ERR,
- "varbind size of %d does not match expected size %dn",
- var->val_len, sizeof(u_long));
- break;
- }
- rowreq_ctx->column_set_flags |= FLAG_IPCIDRROUTESTATUS;
- rc = ipCidrRouteStatus_set(rowreq_ctx,
- *((u_long *) var->val.string));
- break;
- default:
- snmp_log(LOG_ERR,
- "unknown column %d in _ipCidrRouteTable_set_columnn",
- column);
- break;
- }
- return rc;
- } /* _ipCidrRouteTable_set_column */
- int
- _mfd_ipCidrRouteTable_set_values(netsnmp_mib_handler *handler,
- netsnmp_handler_registration *reginfo,
- netsnmp_agent_request_info *agtreq_info,
- netsnmp_request_info *requests)
- {
- ipCidrRouteTable_rowreq_ctx *rowreq_ctx =
- netsnmp_container_table_row_extract(requests);
- netsnmp_table_request_info *tri;
- int rc = SNMP_ERR_NOERROR;
- DEBUGMSGTL(("internal:ipCidrRouteTable:_mfd_ipCidrRouteTable_set_values", "calledn"));
- netsnmp_assert(NULL != rowreq_ctx);
- rowreq_ctx->column_set_flags = 0;
- for (; requests; requests = requests->next) {
- /*
- * set column data
- */
- tri = netsnmp_extract_table_info(requests);
- if (NULL == tri)
- continue;
- rc = _ipCidrRouteTable_set_column(rowreq_ctx,
- requests->requestvb,
- tri->colnum);
- if (MFD_SUCCESS != rc) {
- DEBUGMSGTL(("verbose:ipCidrRouteTable:mfd", "error %d from "
- "ipCidrRouteTable_set_columnn", rc));
- netsnmp_set_request_error(agtreq_info, requests,
- SNMP_VALIDATE_ERR(rc));
- }
- } /* for results */
- return SNMP_ERR_NOERROR;
- } /* _mfd_ipCidrRouteTable_set_values */
- /*----------------------------------------------------------------------
- *
- * SET: commit
- *
- *---------------------------------------------------------------------*/
- /**
- * @internal
- * commit the values
- */
- int
- _mfd_ipCidrRouteTable_commit(netsnmp_mib_handler *handler,
- netsnmp_handler_registration *reginfo,
- netsnmp_agent_request_info *agtreq_info,
- netsnmp_request_info *requests)
- {
- int rc;
- ipCidrRouteTable_rowreq_ctx *rowreq_ctx =
- netsnmp_container_table_row_extract(requests);
- DEBUGMSGTL(("internal:ipCidrRouteTable:_mfd_ipCidrRouteTable_commit",
- "calledn"));
- netsnmp_assert(NULL != rowreq_ctx);
- rc = ipCidrRouteTable_commit(rowreq_ctx);
- if (MFD_SUCCESS != rc) {
- DEBUGMSGTL(("verbose:ipCidrRouteTable:mfd", "error %d from "
- "ipCidrRouteTable_commitn", rc));
- netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
- }
- return SNMP_ERR_NOERROR;
- }
- int
- _mfd_ipCidrRouteTable_undo_commit(netsnmp_mib_handler *handler,
- netsnmp_handler_registration *reginfo,
- netsnmp_agent_request_info *agtreq_info,
- netsnmp_request_info *requests)
- {
- int rc;
- ipCidrRouteTable_rowreq_ctx *rowreq_ctx =
- netsnmp_container_table_row_extract(requests);
- DEBUGMSGTL(("internal:ipCidrRouteTable:_mfd_ipCidrRouteTable_undo_commit", "calledn"));
- netsnmp_assert(NULL != rowreq_ctx);
- rc = ipCidrRouteTable_undo_commit(rowreq_ctx);
- if (MFD_SUCCESS != rc) {
- /*
- * nothing we can do about it but log it
- */
- DEBUGMSGTL(("verbose:ipCidrRouteTable:mfd", "error %d from "
- "ipCidrRouteTable_undo_commitn", rc));
- }
- return SNMP_ERR_NOERROR;
- } /* _mfd_ipCidrRouteTable_commit */
- /*----------------------------------------------------------------------
- *
- * SET: Undo
- *
- *---------------------------------------------------------------------*/
- /**
- * @internal
- * undo the value for a particular column
- */
- NETSNMP_STATIC_INLINE int
- _ipCidrRouteTable_undo_column(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
- netsnmp_variable_list * var, int column)
- {
- int rc = SNMPERR_SUCCESS;
- DEBUGMSGTL(("internal:ipCidrRouteTable:_ipCidrRouteTable_undo_column",
- "calledn"));
- netsnmp_assert(NULL != rowreq_ctx);
- switch (column) {
- /*
- * ipCidrRouteIfIndex(5)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
- */
- case COLUMN_IPCIDRROUTEIFINDEX:
- rc = ipCidrRouteIfIndex_undo(rowreq_ctx);
- break;
- /*
- * ipCidrRouteType(6)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
- */
- case COLUMN_IPCIDRROUTETYPE:
- rc = ipCidrRouteType_undo(rowreq_ctx);
- break;
- /*
- * ipCidrRouteInfo(9)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/A/W/e/r/d/h
- */
- case COLUMN_IPCIDRROUTEINFO:
- rc = ipCidrRouteInfo_undo(rowreq_ctx);
- break;
- /*
- * ipCidrRouteNextHopAS(10)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
- */
- case COLUMN_IPCIDRROUTENEXTHOPAS:
- rc = ipCidrRouteNextHopAS_undo(rowreq_ctx);
- break;
- /*
- * ipCidrRouteMetric1(11)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
- */
- case COLUMN_IPCIDRROUTEMETRIC1:
- rc = ipCidrRouteMetric1_undo(rowreq_ctx);
- break;
- /*
- * ipCidrRouteMetric2(12)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
- */
- case COLUMN_IPCIDRROUTEMETRIC2:
- rc = ipCidrRouteMetric2_undo(rowreq_ctx);
- break;
- /*
- * ipCidrRouteMetric3(13)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
- */
- case COLUMN_IPCIDRROUTEMETRIC3:
- rc = ipCidrRouteMetric3_undo(rowreq_ctx);
- break;
- /*
- * ipCidrRouteMetric4(14)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
- */
- case COLUMN_IPCIDRROUTEMETRIC4:
- rc = ipCidrRouteMetric4_undo(rowreq_ctx);
- break;
- /*
- * ipCidrRouteMetric5(15)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
- */
- case COLUMN_IPCIDRROUTEMETRIC5:
- rc = ipCidrRouteMetric5_undo(rowreq_ctx);
- break;
- /*
- * ipCidrRouteStatus(16)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
- */
- case COLUMN_IPCIDRROUTESTATUS:
- rc = ipCidrRouteStatus_undo(rowreq_ctx);
- break;
- default:
- snmp_log(LOG_ERR,
- "unknown column %d in _ipCidrRouteTable_undo_columnn",
- column);
- break;
- }
- return rc;
- } /* _ipCidrRouteTable_undo_column */
- int
- _mfd_ipCidrRouteTable_undo_values(netsnmp_mib_handler *handler,
- netsnmp_handler_registration *reginfo,
- netsnmp_agent_request_info *agtreq_info,
- netsnmp_request_info *requests)
- {
- int rc;
- ipCidrRouteTable_rowreq_ctx *rowreq_ctx =
- netsnmp_container_table_row_extract(requests);
- netsnmp_table_request_info *tri;
- DEBUGMSGTL(("internal:ipCidrRouteTable:_mfd_ipCidrRouteTable_undo_values", "calledn"));
- netsnmp_assert(NULL != rowreq_ctx);
- for (; requests; requests = requests->next) {
- /*
- * set column data
- */
- tri = netsnmp_extract_table_info(requests);
- if (NULL == tri)
- continue;
- rc = _ipCidrRouteTable_undo_column(rowreq_ctx, requests->requestvb,
- tri->colnum);
- if (MFD_SUCCESS != rc) {
- /*
- * nothing we can do about it but log it
- */
- DEBUGMSGTL(("verbose:ipCidrRouteTable:mfd", "error %d from "
- "ipCidrRouteTable_undo_columnn", rc));
- }
- } /* for results */
- return SNMP_ERR_NOERROR;
- } /* _mfd_ipCidrRouteTable_undo_values */
- /***********************************************************************
- *
- * DATA ACCESS
- *
- ***********************************************************************/
- /**
- * @internal
- */
- static int
- _cache_load(netsnmp_cache * cache, void *vmagic)
- {
- DEBUGMSGTL(("internal:ipCidrRouteTable:_cache_load", "calledn"));
- if ((NULL == cache) || (NULL == cache->magic)) {
- snmp_log(LOG_ERR,
- "invalid cache for ipCidrRouteTable_cache_loadn");
- return -1;
- }
- /** should only be called for an invalid or expired cache */
- netsnmp_assert((0 == cache->valid) || (1 == cache->expired));
- /*
- * call user code
- */
- return ipCidrRouteTable_cache_load((netsnmp_container *) cache->magic);
- } /* _cache_load */
- /**
- * @internal
- */
- static void
- _cache_item_free(ipCidrRouteTable_rowreq_ctx * rowreq_ctx, void *context)
- {
- DEBUGMSGTL(("internal:ipCidrRouteTable:_cache_item_free", "calledn"));
- if (NULL == rowreq_ctx)
- return;
- ipCidrRouteTable_release_rowreq_ctx(rowreq_ctx);
- } /* _cache_item_free */
- /**
- * @internal
- */
- static void
- _cache_free(netsnmp_cache * cache, void *magic)
- {
- netsnmp_container *container;
- DEBUGMSGTL(("internal:ipCidrRouteTable:_cache_free", "calledn"));
- if ((NULL == cache) || (NULL == cache->magic)) {
- snmp_log(LOG_ERR,
- "invalid cache in ipCidrRouteTable_cache_freen");
- return;
- }
- container = (netsnmp_container *) cache->magic;
- /*
- * call user code
- */
- ipCidrRouteTable_cache_free(container);
- /*
- * free all items. inefficient, but easy.
- */
- CONTAINER_CLEAR(container,
- (netsnmp_container_obj_func *) _cache_item_free, NULL);
- } /* _cache_free */
- /**
- * @internal
- * initialize the iterator container with functions or wrappers
- */
- void
- _ipCidrRouteTable_container_init(ipCidrRouteTable_interface_ctx * if_ctx)
- {
- DEBUGMSGTL(("internal:ipCidrRouteTable:_ipCidrRouteTable_container_init", "calledn"));
- /*
- * set up the cache
- */
- if_ctx->cache = netsnmp_cache_create(30, /* timeout in seconds */
- _cache_load, _cache_free,
- ipCidrRouteTable_oid,
- ipCidrRouteTable_oid_size);
- if (NULL == if_ctx->cache) {
- snmp_log(LOG_ERR, "error creating cache for ipCidrRouteTablen");
- return;
- }
- if_ctx->cache->flags = NETSNMP_CACHE_DONT_INVALIDATE_ON_SET;
- ipCidrRouteTable_container_init(&if_ctx->container, if_ctx->cache);
- if (NULL == if_ctx->container)
- if_ctx->container =
- netsnmp_container_find("ipCidrRouteTable:table_container");
- if (NULL == if_ctx->container) {
- snmp_log(LOG_ERR, "error creating container in "
- "ipCidrRouteTable_container_initn");
- return;
- }
- if_ctx->cache->magic = (void *) if_ctx->container;
- } /* _ipCidrRouteTable_container_init */