📄 inetnettomediatable_interface.c
字号:
"bad rc %d from inetNetToMediaPhysAddress_check_value\n", rc); rc = SNMP_ERR_GENERR; } } break; /* * inetNetToMediaLastUpdated(5)/TimeStamp/ASN_TIMETICKS/u_long(u_long)//l/A/w/e/r/d/h */ case COLUMN_INETNETTOMEDIALASTUPDATED: rc = SNMP_ERR_NOTWRITABLE; break; /* * inetNetToMediaType(6)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h */ case COLUMN_INETNETTOMEDIATYPE: rc = netsnmp_check_vb_type(var, ASN_INTEGER); /* * check that the value is one of defined enums */ if ((SNMPERR_SUCCESS == rc) && (*var->val.integer != INETNETTOMEDIATYPE_OTHER) && (*var->val.integer != INETNETTOMEDIATYPE_INVALID) && (*var->val.integer != INETNETTOMEDIATYPE_DYNAMIC) && (*var->val.integer != INETNETTOMEDIATYPE_STATIC) && (*var->val.integer != INETNETTOMEDIATYPE_LOCAL) ) { rc = SNMP_ERR_WRONGVALUE; } if (SNMPERR_SUCCESS != rc) { DEBUGMSGTL(("inetNetToMediaTable:_inetNetToMediaTable_check_column:inetNetToMediaType", "varbind validation failed (eg bad type or size)\n")); } else { rc = inetNetToMediaType_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 inetNetToMediaType_check_value\n", rc); rc = SNMP_ERR_GENERR; } } break; /* * inetNetToMediaState(7)/INTEGER/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h */ case COLUMN_INETNETTOMEDIASTATE: rc = SNMP_ERR_NOTWRITABLE; break; /* * inetNetToMediaRowStatus(8)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h */ case COLUMN_INETNETTOMEDIAROWSTATUS: rc = netsnmp_check_vb_rowstatus_value(var); if (SNMPERR_SUCCESS != rc) { DEBUGMSGTL(("inetNetToMediaTable:_inetNetToMediaTable_check_column:inetNetToMediaRowStatus", "varbind validation failed (eg bad type or size)\n")); } else { rc = inetNetToMediaRowStatus_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 inetNetToMediaRowStatus_check_value\n", rc); rc = SNMP_ERR_GENERR; } } break; default: /** We shouldn't get here */ rc = SNMP_ERR_GENERR; snmp_log(LOG_ERR, "unknown column %d in _inetNetToMediaTable_check_column\n", column); } return rc;} /* _inetNetToMediaTable_check_column */int_mfd_inetNetToMediaTable_check_objects(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *agtreq_info, netsnmp_request_info *requests){ inetNetToMediaTable_rowreq_ctx *rowreq_ctx = netsnmp_container_table_row_extract(requests); netsnmp_table_request_info *tri; int rc; DEBUGMSGTL(("internal:inetNetToMediaTable:_mfd_inetNetToMediaTable_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 = _inetNetToMediaTable_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_inetNetToMediaTable_check_objects *//*---------------------------------------------------------------------- * * SET: check dependencies * *---------------------------------------------------------------------*//* * @internal * Check dependencies wrapper */static int_mfd_inetNetToMediaTable_check_dependencies(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *agtreq_info, netsnmp_request_info *requests){ int rc; inetNetToMediaTable_rowreq_ctx *rowreq_ctx = netsnmp_container_table_row_extract(requests); DEBUGMSGTL(("internal:inetNetToMediaTable:_mfd_inetNetToMediaTable_check_dependencies", "called\n")); netsnmp_assert(NULL != rowreq_ctx); rc = inetNetToMediaTable_check_dependencies(rowreq_ctx); if (rc) { DEBUGMSGTL(("inetNetToMediaTable:mfd", "error %d from " "inetNetToMediaTable_check_dependencies\n", rc)); netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc)); } return SNMP_ERR_NOERROR;} /* _mfd_inetNetToMediaTable_check_dependencies *//*---------------------------------------------------------------------- * * SET: Undo setup * *---------------------------------------------------------------------*//* * @internal * Set the value for a particular column */NETSNMP_STATIC_INLINE int_inetNetToMediaTable_undo_setup_column(inetNetToMediaTable_rowreq_ctx * rowreq_ctx, int column){ int rc = SNMPERR_SUCCESS; DEBUGMSGTL(("internal:inetNetToMediaTable:_inetNetToMediaTable_undo_setup_column", "called for %d\n", column)); netsnmp_assert(NULL != rowreq_ctx); switch (column) { /* * inetNetToMediaPhysAddress(4)/PhysAddress/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/H */ case COLUMN_INETNETTOMEDIAPHYSADDRESS: rowreq_ctx->column_set_flags |= COLUMN_INETNETTOMEDIAPHYSADDRESS_FLAG; rc = inetNetToMediaPhysAddress_undo_setup(rowreq_ctx); break; /* * inetNetToMediaType(6)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h */ case COLUMN_INETNETTOMEDIATYPE: rowreq_ctx->column_set_flags |= COLUMN_INETNETTOMEDIATYPE_FLAG; rc = inetNetToMediaType_undo_setup(rowreq_ctx); break; /* * inetNetToMediaRowStatus(8)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h */ case COLUMN_INETNETTOMEDIAROWSTATUS: rowreq_ctx->column_set_flags |= COLUMN_INETNETTOMEDIAROWSTATUS_FLAG; rc = inetNetToMediaRowStatus_undo_setup(rowreq_ctx); break; default: snmp_log(LOG_ERR, "unknown column %d in _inetNetToMediaTable_undo_setup_column\n", column); break; } return rc;} /* _inetNetToMediaTable_undo_setup_column *//** * @internal * undo setup */int_mfd_inetNetToMediaTable_undo_setup(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *agtreq_info, netsnmp_request_info *requests){ int rc; inetNetToMediaTable_rowreq_ctx *rowreq_ctx = netsnmp_container_table_row_extract(requests); DEBUGMSGTL(("internal:inetNetToMediaTable:_mfd_inetNetToMediaTable_undo_setup", "called\n")); netsnmp_assert(NULL != rowreq_ctx); /* * allocate undo context */ rowreq_ctx->undo = inetNetToMediaTable_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 = inetNetToMediaTable_undo_setup(rowreq_ctx); if (MFD_SUCCESS != rc) { DEBUGMSGTL(("inetNetToMediaTable:mfd", "error %d from " "inetNetToMediaTable_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 = _inetNetToMediaTable_undo_setup_column(rowreq_ctx, tri->colnum); if (MFD_SUCCESS != rc) { DEBUGMSGTL(("inetNetToMediaTable:mfd", "error %d from " "inetNetToMediaTable_undo_setup_column\n", rc)); netsnmp_set_request_error(agtreq_info, requests, SNMP_VALIDATE_ERR(rc)); } } /* for results */ } return SNMP_ERR_NOERROR;} /* _mfd_inetNetToMediaTable_undo_setup *//** * @internal * undo setup */int_mfd_inetNetToMediaTable_undo_cleanup(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *agtreq_info, netsnmp_request_info *requests){ inetNetToMediaTable_rowreq_ctx *rowreq_ctx = netsnmp_container_table_row_extract(requests); int rc; DEBUGMSGTL(("internal:inetNetToMediaTable:_mfd_inetNetToMediaTable_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 = inetNetToMediaTable_undo_cleanup(rowreq_ctx); if (MFD_SUCCESS != rc) { /* * nothing we can do about it but log it */ DEBUGMSGTL(("inetNetToMediaTable:mfd", "error %d from " "inetNetToMediaTable_undo_cleanup\n", rc)); } /* * release undo context, if needed */ if (rowreq_ctx->undo) { inetNetToMediaTable_release_data(rowreq_ctx->undo); rowreq_ctx->undo = NULL; } return SNMP_ERR_NOERROR;} /* _mfd_inetNetToMediaTable_undo_cleanup *//*---------------------------------------------------------------------- * * SET: Set values * *---------------------------------------------------------------------*//* * @internal * Set the value for a particular column */NETSNMP_STATIC_INLINE int_inetNetToMediaTable_set_column(inetNetToMediaTable_rowreq_ctx * rowreq_ctx, netsnmp_variable_list * var, int column){ int rc = SNMPERR_SUCCESS; DEBUGMSGTL(("internal:inetNetToMediaTable:_inetNetToMediaTable_set_column", "called for %d\n", column)); netsnmp_assert(NULL != rowreq_ctx); switch (column) { /* * inetNetToMediaPhysAddress(4)/PhysAddress/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/H */ case COLUMN_INETNETTOMEDIAPHYSADDRESS: rowreq_ctx->column_set_flags |= COLUMN_INETNETTOMEDIAPHYSADDRESS_FLAG; rc = inetNetToMediaPhysAddress_set(rowreq_ctx, (char *) var->val.string, var->val_len); break; /* * inetNetToMediaType(6)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h */ case COLUMN_INETNETTOMEDIATYPE: rowreq_ctx->column_set_flags |= COLUMN_INETNETTOMEDIATYPE_FLAG; rc = inetNetToMediaType_set(rowreq_ctx, *((u_long *) var->val.string)); break; /* * inetNetToMediaRowStatus(8)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h */ case COLUMN_INETNETTOMEDIAROWSTATUS: rowreq_ctx->column_set_flags |= COLUMN_INETNETTOMEDIAROWSTATUS_FLAG; rc = inetNetToMediaRowStatus_set(rowreq_ctx, *((u_long *) var->val.string)); break; default: snmp_log(LOG_ERR, "unknown column %d in _inetNetToMediaTable_set_column\n", column); rc = SNMP_ERR_GENERR; break; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -