int _mfd_dot11ConfTotalTrapGroupTable_undo_commit(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *agtreq_info, netsnmp_request_info *requests) { int rc; dot11ConfTotalTrapGroupTable_rowreq_ctx *rowreq_ctx = netsnmp_container_table_row_extract(requests); DEBUGMSGTL(("internal:dot11ConfTotalTrapGroupTable:_mfd_dot11ConfTotalTrapGroupTable_undo_commit","called\n")); netsnmp_assert(NULL != rowreq_ctx); rc = dot11ConfTotalTrapGroupTable_undo_commit(rowreq_ctx); if (MFD_SUCCESS != rc) { /* * nothing we can do about it but log it */ DEBUGMSGTL(("verbose:dot11ConfTotalTrapGroupTable:mfd","error %d from " "dot11ConfTotalTrapGroupTable_undo_commit\n", rc)); } return SNMP_ERR_NOERROR; } /* _mfd_dot11ConfTotalTrapGroupTable_commit */
int _mfd_dot11ConfTotalTrapGroupTable_set_values(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *agtreq_info, netsnmp_request_info *requests) { dot11ConfTotalTrapGroupTable_rowreq_ctx *rowreq_ctx = netsnmp_container_table_row_extract(requests); netsnmp_table_request_info * tri; int rc = SNMP_ERR_NOERROR; DEBUGMSGTL(("internal:dot11ConfTotalTrapGroupTable:_mfd_dot11ConfTotalTrapGroupTable_set_values","called\n")); 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 = _dot11ConfTotalTrapGroupTable_set_column(rowreq_ctx, requests->requestvb, tri->colnum); if(MFD_SUCCESS != rc) { DEBUGMSGTL(("verbose:dot11ConfTotalTrapGroupTable:mfd","error %d from " "dot11ConfTotalTrapGroupTable_set_column\n", rc)); netsnmp_set_request_error(agtreq_info, requests, SNMP_VALIDATE_ERR(rc)); } } /* for results */ return SNMP_ERR_NOERROR; } /* _mfd_dot11ConfTotalTrapGroupTable_set_values */
int _mfd_ifTable_undo_values(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *agtreq_info, netsnmp_request_info *requests) { ifTable_rowreq_ctx *rowreq_ctx = netsnmp_container_table_row_extract(requests); netsnmp_table_request_info *tri; int rc = SNMP_ERR_NOERROR; DEBUGMSGTL(("internal:_mfd_ifTable_undo_values", "called\n")); netsnmp_assert(NULL != rowreq_ctx); for (; requests; requests = requests->next) { /* * set column data */ tri = netsnmp_extract_table_info(requests); if (NULL == tri) continue; _ifTable_undo_column(rowreq_ctx, requests->requestvb, tri->colnum); } /* for results */ return rc; }
/** * @internal * commit the values */ int _mfd_ipv4InterfaceTable_commit(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *agtreq_info, netsnmp_request_info *requests) { int rc; ipv4InterfaceTable_rowreq_ctx *rowreq_ctx = netsnmp_container_table_row_extract(requests); DEBUGMSGTL(("internal:ipv4InterfaceTable:_mfd_ipv4InterfaceTable_commit", "called\n")); netsnmp_assert(NULL != rowreq_ctx); rc = ipv4InterfaceTable_commit(rowreq_ctx); if (MFD_SUCCESS != rc) { DEBUGMSGTL(("ipv4InterfaceTable:mfd", "error %d from " "ipv4InterfaceTable_commit\n", rc)); netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc)); } if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) { /* * if we successfully commited this row, set the dirty flag. Use the * current value + 1 (i.e. dirty = # rows changed). * this is checked in post_request... */ ipv4InterfaceTable_dirty_set(ipv4InterfaceTable_dirty_get() + 1); /* set table dirty flag */ } return SNMP_ERR_NOERROR; }
/** * @internal * undo setup */ int _mfd_ifTable_undo_cleanup(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *agtreq_info, netsnmp_request_info *requests) { ifTable_rowreq_ctx *rowreq_ctx = netsnmp_container_table_row_extract(requests); int rc; netsnmp_assert(NULL != rowreq_ctx); /* * call user cleanup */ rc = ifTable_undo_cleanup(rowreq_ctx); /* * release undo context, if needed */ if (rowreq_ctx->undo) ifTable_release_data(rowreq_ctx->undo); /* * clear set flags */ rowreq_ctx->set_flags = 0; return rc; }
/** * @internal * wrapper */ static int _mfd_dot11ConfTotalTrapGroupTable_post_request(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *agtreq_info, netsnmp_request_info *requests) { dot11ConfTotalTrapGroupTable_rowreq_ctx *rowreq_ctx; int rc = dot11ConfTotalTrapGroupTable_post_request(dot11ConfTotalTrapGroupTable_if_ctx.user_ctx); if (MFD_SUCCESS != rc) { /* * nothing we can do about it but log it */ DEBUGMSGTL(("internal:dot11ConfTotalTrapGroupTable","error %d from " "dot11ConfTotalTrapGroupTable_post_request\n", rc)); } /* * if there are no errors, check for and handle row creation/deletion */ rc = netsnmp_check_requests_error(requests); if ((SNMP_ERR_NOERROR == rc) && (NULL != (rowreq_ctx = netsnmp_container_table_row_extract(requests)))) { if (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED) { rowreq_ctx->rowreq_flags &= ~MFD_ROW_CREATED; CONTAINER_INSERT(dot11ConfTotalTrapGroupTable_if_ctx.container, rowreq_ctx); } else if (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED) { CONTAINER_REMOVE(dot11ConfTotalTrapGroupTable_if_ctx.container, rowreq_ctx); dot11ConfTotalTrapGroupTable_release_rowreq_ctx(rowreq_ctx); } } return SNMP_ERR_NOERROR; } /* _mfd_dot11ConfTotalTrapGroupTable_post_request */
/** * @internal * wrapper */ static int _mfd_ipv4InterfaceTable_object_lookup(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *agtreq_info, netsnmp_request_info *requests) { int rc = SNMP_ERR_NOERROR; ipv4InterfaceTable_rowreq_ctx *rowreq_ctx = netsnmp_container_table_row_extract(requests); DEBUGMSGTL(("internal:ipv4InterfaceTable:_mfd_ipv4InterfaceTable_object_lookup", "called\n")); /* * get our context from mfd * ipv4InterfaceTable_interface_ctx *if_ctx = * (ipv4InterfaceTable_interface_ctx *)reginfo->my_reg_void; */ if (NULL == rowreq_ctx) { rc = SNMP_ERR_NOCREATION; } if (MFD_SUCCESS != rc) netsnmp_request_set_error_all(requests, rc); else ipv4InterfaceTable_row_prep(rowreq_ctx); return SNMP_VALIDATE_ERR(rc); } /* _mfd_ipv4InterfaceTable_object_lookup */
/** * @internal * commit irreversible actions */ int _mfd_ipv4InterfaceTable_irreversible_commit(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *agtreq_info, netsnmp_request_info *requests) { ipv4InterfaceTable_rowreq_ctx *rowreq_ctx = netsnmp_container_table_row_extract(requests); DEBUGMSGTL(("internal:ipv4InterfaceTable:_mfd_ipv4InterfaceTable_irreversible:commit", "called\n")); netsnmp_assert(NULL != rowreq_ctx); /* * check for and handle row creation/deletion * and update column exist flags... */ if (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED) { CONTAINER_REMOVE(ipv4InterfaceTable_if_ctx.container, rowreq_ctx); } else { if (rowreq_ctx->column_set_flags) { rowreq_ctx->column_set_flags = 0; } } return SNMP_ERR_NOERROR; } /* _mfd_ipv4InterfaceTable_irreversible_commit */
/** * @internal * wrapper */ static int _mfd_ifXTable_post_request(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *agtreq_info, netsnmp_request_info *requests) { ifXTable_rowreq_ctx *rowreq_ctx; int rc = ifXTable_post_request(ifXTable_if_ctx.user_ctx); if (MFD_SUCCESS != rc) { /* * nothing we can do about it but log it */ DEBUGMSGTL(("internal:ifXTable", "error %d from " "ifXTable_post_request\n", 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_ifXTable_post_request */
/** * @internal * wrapper */ static int _mfd_dot11ConfTotalTrapGroupTable_object_lookup(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *agtreq_info, netsnmp_request_info *requests) { dot11ConfTotalTrapGroupTable_rowreq_ctx *rowreq_ctx = netsnmp_container_table_row_extract(requests); DEBUGMSGTL(("internal:dot11ConfTotalTrapGroupTable:_mfd_dot11ConfTotalTrapGroupTable_object_lookup","called\n")); /* * get our context from mfd * dot11ConfTotalTrapGroupTable_interface_ctx *if_ctx = * (dot11ConfTotalTrapGroupTable_interface_ctx *)reginfo->my_reg_void; */ if(NULL == rowreq_ctx) { netsnmp_request_set_error_all(requests, SNMP_ERR_NOCREATION); } else { dot11ConfTotalTrapGroupTable_row_prep(rowreq_ctx); } return SNMP_ERR_NOERROR; } /* _mfd_dot11ConfTotalTrapGroupTable_object_lookup */
/** * @internal * undo setup */ int _mfd_mibtestTable_undo_setup(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *agtreq_info, netsnmp_request_info *requests) { int rc; mibtestTable_rowreq_ctx *rowreq_ctx = netsnmp_container_table_row_extract(requests); DEBUGMSGTL(("internal:mibtestTable:_mfd_mibtestTable_undo_setup", "called\n")); netsnmp_assert(NULL != rowreq_ctx); /* * allocate undo context */ rowreq_ctx->undo = mibtestTable_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 = mibtestTable_undo_setup(rowreq_ctx); if (MFD_SUCCESS != rc) { DEBUGMSGTL(("mibtestTable:mfd", "error %d from " "mibtestTable_undo_setup\n", 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 = _mibtestTable_undo_setup_column(rowreq_ctx, tri->colnum); if (MFD_SUCCESS != rc) { DEBUGMSGTL(("mibtestTable:mfd", "error %d from " "mibtestTable_undo_setup_column\n", rc)); netsnmp_set_request_error(agtreq_info, requests, SNMP_VALIDATE_ERR(rc)); } } /* for results */ } return SNMP_ERR_NOERROR; } /* _mfd_mibtestTable_undo_setup */
int _mfd_dot11ConfTotalTrapGroupTable_check_objects(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *agtreq_info, netsnmp_request_info *requests) { dot11ConfTotalTrapGroupTable_rowreq_ctx *rowreq_ctx = netsnmp_container_table_row_extract(requests); netsnmp_table_request_info * tri; int rc; DEBUGMSGTL(("internal:dot11ConfTotalTrapGroupTable:_mfd_dot11ConfTotalTrapGroupTable_check_objects","called\n")); netsnmp_assert(NULL != rowreq_ctx); for(;requests; requests = requests->next) { /* * get column number from table request info, and check that column */ tri = netsnmp_extract_table_info(requests); if(NULL == tri) continue; rc = _dot11ConfTotalTrapGroupTable_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_dot11ConfTotalTrapGroupTable_check_objects */
/* * The helper handler that takes care of passing a specific row of * data down to the lower handler(s). The table_container helper * has already taken care of identifying the appropriate row of the * table (and converting GETNEXT requests into an equivalent GET request) * So all we need to do here is make sure that the row is accessible * using tdata-style retrieval techniques as well. */ int _netsnmp_tdata_helper_handler (netsnmp_mib_handler * handler, netsnmp_handler_registration * reginfo, netsnmp_agent_request_info * reqinfo, netsnmp_request_info * requests) { netsnmp_tdata *table = (netsnmp_tdata *) handler->myvoid; netsnmp_request_info *request; netsnmp_table_request_info *table_info; netsnmp_tdata_row *row; int need_processing = 1; switch (reqinfo->mode) { case MODE_GET: need_processing = 0; /* only need processing if some vars found */ /** Fall through */ #ifndef NETSNMP_NO_WRITE_SUPPORT case MODE_SET_RESERVE1: #endif /* NETSNMP_NO_WRITE_SUPPORT */ for (request = requests; request; request = request->next) { if (request->processed) continue; table_info = netsnmp_extract_table_info (request); if (!table_info) { netsnmp_assert (table_info); /* yes, this will always hit */ netsnmp_set_request_error (reqinfo, request, SNMP_ERR_GENERR); continue; /* eek */ } row = (netsnmp_tdata_row *) netsnmp_container_table_row_extract (request); if (!row && (reqinfo->mode == MODE_GET)) { netsnmp_assert (row); /* yes, this will always hit */ netsnmp_set_request_error (reqinfo, request, SNMP_ERR_GENERR); continue; /* eek */ } ++need_processing; netsnmp_request_add_list_data (request, netsnmp_create_data_list (TABLE_TDATA_TABLE, table, NULL)); netsnmp_request_add_list_data (request, netsnmp_create_data_list (TABLE_TDATA_ROW, row, NULL)); } /** skip next handler if processing not needed */ if (!need_processing) handler->flags |= MIB_HANDLER_AUTO_NEXT_OVERRIDE_ONCE; } /* next handler called automatically - 'AUTO_NEXT' */ return SNMP_ERR_NOERROR; }
/** * @internal * wrapper */ static int _mfd_ipv6ScopeZoneIndexTable_object_lookup(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *agtreq_info, netsnmp_request_info *requests) { int rc = SNMP_ERR_NOERROR; ipv6ScopeZoneIndexTable_rowreq_ctx *rowreq_ctx = (ipv6ScopeZoneIndexTable_rowreq_ctx*) netsnmp_container_table_row_extract(requests); DEBUGMSGTL(("internal:ipv6ScopeZoneIndexTable:_mfd_ipv6ScopeZoneIndexTable_object_lookup", "called\n")); /* * get our context from mfd * ipv6ScopeZoneIndexTable_interface_ctx *if_ctx = * (ipv6ScopeZoneIndexTable_interface_ctx *)reginfo->my_reg_void; */ if (NULL == rowreq_ctx) { netsnmp_table_request_info *tblreq_info; netsnmp_index oid_idx; tblreq_info = netsnmp_extract_table_info(requests); if (NULL == tblreq_info) { snmp_log(LOG_ERR, "request had no table info\n"); return MFD_ERROR; } /* * try create rowreq */ oid_idx.oids = tblreq_info->index_oid; oid_idx.len = tblreq_info->index_oid_len; rowreq_ctx = _mfd_ipv6ScopeZoneIndexTable_rowreq_from_index(&oid_idx, &rc); if (MFD_SUCCESS == rc) { netsnmp_assert(NULL != rowreq_ctx); rowreq_ctx->rowreq_flags |= MFD_ROW_CREATED; /* * add rowreq_ctx to request data lists */ netsnmp_container_table_row_insert(requests, (netsnmp_index *) rowreq_ctx); } } if (MFD_SUCCESS != rc) netsnmp_request_set_error_all(requests, rc); else ipv6ScopeZoneIndexTable_row_prep(rowreq_ctx); return SNMP_VALIDATE_ERR(rc); } /* _mfd_ipv6ScopeZoneIndexTable_object_lookup */
/** * @internal * undo setup */ int _mfd_ipv4InterfaceTable_undo_setup(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *agtreq_info, netsnmp_request_info *requests) { int rc; ipv4InterfaceTable_rowreq_ctx *rowreq_ctx = netsnmp_container_table_row_extract(requests); DEBUGMSGTL(("internal:ipv4InterfaceTable:_mfd_ipv4InterfaceTable_undo_setup", "called\n")); netsnmp_assert(NULL != rowreq_ctx); /* * allocate undo context */ rc = _mfd_ifTable_undo_setup_allocate(rowreq_ctx); if (MFD_SUCCESS != rc) { netsnmp_request_set_error_all(requests, rc); return SNMP_ERR_NOERROR; } /* * row undo setup */ rc = ipv4InterfaceTable_undo_setup(rowreq_ctx); if (MFD_SUCCESS != rc) { DEBUGMSGTL(("ipv4InterfaceTable:mfd", "error %d from " "ipv4InterfaceTable_undo_setup\n", 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 = _ipv4InterfaceTable_undo_setup_column(rowreq_ctx, tri->colnum); if (MFD_SUCCESS != rc) { DEBUGMSGTL(("ipv4InterfaceTable:mfd", "error %d from " "ipv4InterfaceTable_undo_setup_column\n", rc)); netsnmp_set_request_error(agtreq_info, requests, SNMP_VALIDATE_ERR(rc)); } } /* for results */ } return SNMP_ERR_NOERROR; } /* _mfd_ipv4InterfaceTable_undo_setup */
int _mfd_ifTable_undo_commit(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *agtreq_info, netsnmp_request_info *requests) { ifTable_rowreq_ctx *rowreq_ctx = netsnmp_container_table_row_extract(requests); netsnmp_assert(NULL != rowreq_ctx); return ifTable_undo_commit(rowreq_ctx); }
/** * @internal * wrapper */ static int _mfd_usmDHUserKeyTable_post_request(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *agtreq_info, netsnmp_request_info *requests) { usmDHUserKeyTable_rowreq_ctx *rowreq_ctx = netsnmp_container_table_row_extract(requests); int rc, packet_rc; DEBUGMSGTL(("internal:usmDHUserKeyTable:_mfd_usmDHUserKeyTable_post_request", "called\n")); /* * release row context, if deleted */ if (rowreq_ctx && (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED)) usmDHUserKeyTable_release_rowreq_ctx(rowreq_ctx); /* * wait for last call before calling user */ if (1 != netsnmp_row_merge_status_last(reginfo, agtreq_info)) { DEBUGMSGTL(("internal:usmDHUserKeyTable", "waiting for last post_request\n")); return SNMP_ERR_NOERROR; } packet_rc = netsnmp_check_all_requests_error(agtreq_info->asp, 0); if ((MFD_SUCCESS != packet_rc) && usmDHUserKeyTable_dirty_get()) { /* * we shouldn't get here. the undo steps should also clear * the dirty flags. */ snmp_log(LOG_WARNING, "usmDHUserKeyTable dirty flag set in post_request " "but status != SUCCESS.\n"); } rc = usmDHUserKeyTable_post_request(usmDHUserKeyTable_if_ctx.user_ctx, packet_rc); if (MFD_SUCCESS != rc) { /* * nothing we can do about it but log it */ DEBUGMSGTL(("usmDHUserKeyTable", "error %d from " "usmDHUserKeyTable_post_request\n", rc)); } return SNMP_ERR_NOERROR; } /* _mfd_usmDHUserKeyTable_post_request */
/* * @internal * Check dependencies wrapper */ static int _mfd_ifTable_check_dependencies(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *agtreq_info, netsnmp_request_info *requests) { ifTable_rowreq_ctx *rowreq_ctx = netsnmp_container_table_row_extract(requests); DEBUGMSGTL(("internal:_mfd_ifTable_check_dependencies", "called\n")); netsnmp_assert(NULL != rowreq_ctx); return ifTable_check_dependencies(rowreq_ctx); }
int _mfd_ipv4InterfaceTable_undo_values(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *agtreq_info, netsnmp_request_info *requests) { int rc; ipv4InterfaceTable_rowreq_ctx *rowreq_ctx = netsnmp_container_table_row_extract(requests); netsnmp_table_request_info *tri; DEBUGMSGTL(("internal:ipv4InterfaceTable:_mfd_ipv4InterfaceTable_undo_values", "called\n")); netsnmp_assert(NULL != rowreq_ctx); rc = ipv4InterfaceTable_undo(rowreq_ctx); if (MFD_SUCCESS != rc) { /* * nothing we can do about it but log it */ DEBUGMSGTL(("ipv4InterfaceTable:mfd", "error %d from " "ipv4InterfaceTable_undo\n", rc)); } for (; requests; requests = requests->next) { /* * set column data */ tri = netsnmp_extract_table_info(requests); if (NULL == tri) continue; rc = _ipv4InterfaceTable_undo_column(rowreq_ctx, requests->requestvb, tri->colnum); if (MFD_SUCCESS != rc) { /* * nothing we can do about it but log it */ DEBUGMSGTL(("ipv4InterfaceTable:mfd", "error %d from " "ipv4InterfaceTable_undo_column\n", rc)); } } /* for results */ return SNMP_ERR_NOERROR; } /* _mfd_ipv4InterfaceTable_undo_values */
/** * @internal * undo setup */ int _mfd_ifXTable_undo_cleanup(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *agtreq_info, netsnmp_request_info *requests) { ifXTable_rowreq_ctx *rowreq_ctx = netsnmp_container_table_row_extract(requests); int rc; DEBUGMSGTL(("internal:ifXTable:_mfd_ifXTable_undo_cleanup", "called\n")); /* * failed row create in early stages has no rowreq_ctx */ if (NULL == rowreq_ctx) return MFD_SUCCESS; /* * call user cleanup */ rc = ifXTable_undo_cleanup(rowreq_ctx); if (MFD_SUCCESS != rc) { /* * nothing we can do about it but log it */ DEBUGMSGTL(("verbose:ifXTable:mfd", "error %d from " "ifXTable_undo_cleanup\n", rc)); } /* * release undo context, if needed */ if (rowreq_ctx->undo) { ifXTable_release_data(rowreq_ctx->undo); rowreq_ctx->undo = NULL; } /* * clear set flags */ rowreq_ctx->column_set_flags = 0; return SNMP_ERR_NOERROR; } /* _mfd_ifXTable_undo_cleanup */
/** * @internal * wrapper */ static int _mfd_jmfcNamespaceHttpServerTable_post_request(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *agtreq_info, netsnmp_request_info *requests) { jmfcNamespaceHttpServerTable_rowreq_ctx *rowreq_ctx = netsnmp_container_table_row_extract(requests); int rc, packet_rc; DEBUGMSGTL(("internal:jmfcNamespaceHttpServerTable:_mfd_jmfcNamespaceHttpServerTable_post_request", "called\n")); /* * release row context, if deleted */ if (rowreq_ctx && (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED)) jmfcNamespaceHttpServerTable_release_rowreq_ctx(rowreq_ctx); /* * wait for last call before calling user */ if (1 != netsnmp_row_merge_status_last(reginfo, agtreq_info)) { DEBUGMSGTL(("internal:jmfcNamespaceHttpServerTable", "waiting for last post_request\n")); return SNMP_ERR_NOERROR; } packet_rc = netsnmp_check_all_requests_error(agtreq_info->asp, 0); rc = jmfcNamespaceHttpServerTable_post_request (jmfcNamespaceHttpServerTable_if_ctx.user_ctx, packet_rc); if (MFD_SUCCESS != rc) { /* * nothing we can do about it but log it */ DEBUGMSGTL(("jmfcNamespaceHttpServerTable","error %d from " "jmfcNamespaceHttpServerTable_post_request\n", rc)); } return SNMP_ERR_NOERROR; } /* _mfd_jmfcNamespaceHttpServerTable_post_request */
/** * @internal * undo setup */ int _mfd_ifTable_undo_setup(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *agtreq_info, netsnmp_request_info *requests) { ifTable_rowreq_ctx *rowreq_ctx = netsnmp_container_table_row_extract(requests); netsnmp_assert(NULL != rowreq_ctx); /* * allocate undo context */ rowreq_ctx->undo = ifTable_allocate_data(); if (NULL == rowreq_ctx->undo) { /** msg already logged */ return SNMP_ERR_RESOURCEUNAVAILABLE; } return ifTable_undo_setup(rowreq_ctx); }
int _mfd_ipv4InterfaceTable_undo_commit(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *agtreq_info, netsnmp_request_info *requests) { int rc; ipv4InterfaceTable_rowreq_ctx *rowreq_ctx = netsnmp_container_table_row_extract(requests); DEBUGMSGTL(("internal:ipv4InterfaceTable:_mfd_ipv4InterfaceTable_undo_commit", "called\n")); netsnmp_assert(NULL != rowreq_ctx); if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) { u_int d = ipv4InterfaceTable_dirty_get(); netsnmp_assert(d != 0); if (d) ipv4InterfaceTable_dirty_set(d - 1); } rc = ipv4InterfaceTable_undo_commit(rowreq_ctx); if (MFD_SUCCESS != rc) { /* * nothing we can do about it but log it */ DEBUGMSGTL(("ipv4InterfaceTable:mfd", "error %d from " "ipv4InterfaceTable_undo_commit\n", rc)); } if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) { snmp_log(LOG_WARNING, "ipv4InterfaceTable row dirty flag still set after undo_commit\n"); rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY; } return SNMP_ERR_NOERROR; } /* _mfd_ipv4InterfaceTable_commit */
/* * @internal * Check dependencies wrapper */ static int _mfd_dot11ConfTotalTrapGroupTable_check_dependencies(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *agtreq_info, netsnmp_request_info *requests) { int rc; dot11ConfTotalTrapGroupTable_rowreq_ctx *rowreq_ctx = netsnmp_container_table_row_extract(requests); DEBUGMSGTL(("internal:dot11ConfTotalTrapGroupTable:_mfd_dot11ConfTotalTrapGroupTable_check_dependencies","called\n")); netsnmp_assert(NULL != rowreq_ctx); rc = dot11ConfTotalTrapGroupTable_check_dependencies(rowreq_ctx); if(rc){ DEBUGMSGTL(("verbose:dot11ConfTotalTrapGroupTable:mfd","error %d from " "dot11ConfTotalTrapGroupTable_check_dependencies\n", rc)); netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc)); } return SNMP_ERR_NOERROR; } /* _mfd_dot11ConfTotalTrapGroupTable_check_dependencies */
/** * @internal * commit the values */ int _mfd_dot11WtpIfTable_commit(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *agtreq_info, netsnmp_request_info *requests) { int rc; dot11WtpIfTable_rowreq_ctx *rowreq_ctx = netsnmp_container_table_row_extract(requests); DEBUGMSGTL(("internal:dot11WtpIfTable:_mfd_dot11WtpIfTable_commit","called\n")); netsnmp_assert(NULL != rowreq_ctx); rc = dot11WtpIfTable_commit(rowreq_ctx); if (MFD_SUCCESS != rc) { DEBUGMSGTL(("verbose:dot11WtpIfTable:mfd","error %d from " "dot11WtpIfTable_commit\n", rc)); netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc)); } return SNMP_ERR_NOERROR; }
/* * The helper handler that takes care of passing a specific row of * data down to the lower handler(s). The table_container helper * has already taken care of identifying the appropriate row of the * table (and converting GETNEXT requests into an equivalent GET request) * So all we need to do here is make sure that the row is accessible * using tdata-style retrieval techniques as well. */ int _netsnmp_tdata_helper_handler(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests) { netsnmp_tdata *table = (netsnmp_tdata *) handler->myvoid; netsnmp_request_info *request; netsnmp_table_request_info *table_info; netsnmp_tdata_row *row; switch ( reqinfo->mode ) { case MODE_GET: case MODE_SET_RESERVE1: for (request = requests; request; request = request->next) { if (request->processed) continue; table_info = netsnmp_extract_table_info(request); if (!table_info) continue; /* ack */ row = netsnmp_container_table_row_extract( request ); netsnmp_request_add_list_data(request, netsnmp_create_data_list( TABLE_TDATA_TABLE, table, NULL)); netsnmp_request_add_list_data(request, netsnmp_create_data_list( TABLE_TDATA_ROW, row, NULL)); } } /* next handler called automatically - 'AUTO_NEXT' */ return SNMP_ERR_NOERROR; }
/** extracts the tdata row being accessed from the request structure */ netsnmp_tdata_row *netsnmp_tdata_extract_row (netsnmp_request_info * request) { return (netsnmp_tdata_row *) netsnmp_container_table_row_extract (request); }
int _mfd_ipv4InterfaceTable_get_values(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *agtreq_info, netsnmp_request_info *requests) { ipv4InterfaceTable_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:ipv4InterfaceTable:_mfd_ipv4InterfaceTable_get_values", "called\n")); 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 = _ipv4InterfaceTable_get_column(rowreq_ctx, requests->requestvb, tri->colnum); if (rc) { if (MFD_SKIP == rc) { requests->requestvb->type = SNMP_NOSUCHINSTANCE; 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_ipv4InterfaceTable_get_values */