📄 inetcidrroutetable_interface.c
字号:
SNMP_ERR_RESOURCEUNAVAILABLE); return SNMP_ERR_NOERROR; } /* * row undo setup */ rowreq_ctx->column_set_flags = 0; rc = inetCidrRouteTable_undo_setup(rowreq_ctx); if (MFD_SUCCESS != rc) { DEBUGMSGTL(("verbose:inetCidrRouteTable:mfd", "error %d from " "inetCidrRouteTable_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 = _inetCidrRouteTable_undo_setup_column(rowreq_ctx, tri->colnum); if (MFD_SUCCESS != rc) { DEBUGMSGTL(("verbose:inetCidrRouteTable:mfd", "error %d from " "inetCidrRouteTable_undo_setup_column\n", rc)); netsnmp_set_request_error(agtreq_info, requests, SNMP_VALIDATE_ERR(rc)); } } /* for results */ } return SNMP_ERR_NOERROR;} /* _mfd_inetCidrRouteTable_undo_setup *//** * @internal * undo setup */int_mfd_inetCidrRouteTable_undo_cleanup(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *agtreq_info, netsnmp_request_info *requests){ inetCidrRouteTable_rowreq_ctx *rowreq_ctx = netsnmp_container_table_row_extract(requests); int rc; DEBUGMSGTL(("internal:inetCidrRouteTable:_mfd_inetCidrRouteTable_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 = inetCidrRouteTable_undo_cleanup(rowreq_ctx); if (MFD_SUCCESS != rc) { /* * nothing we can do about it but log it */ DEBUGMSGTL(("verbose:inetCidrRouteTable:mfd", "error %d from " "inetCidrRouteTable_undo_cleanup\n", rc)); } /* * release undo context, if needed */ if (rowreq_ctx->undo) { inetCidrRouteTable_release_data(rowreq_ctx->undo); rowreq_ctx->undo = NULL; } /* * clear set flags */ rowreq_ctx->column_set_flags = 0; return SNMP_ERR_NOERROR;} /* _mfd_inetCidrRouteTable_undo_cleanup *//*---------------------------------------------------------------------- * * SET: Set values * *---------------------------------------------------------------------*//* * @internal * Set the value for a particular column */NETSNMP_STATIC_INLINE int_inetCidrRouteTable_set_column(inetCidrRouteTable_rowreq_ctx * rowreq_ctx, netsnmp_variable_list * var, int column){ int rc = SNMPERR_SUCCESS; DEBUGMSGTL(("internal:inetCidrRouteTable:_inetCidrRouteTable_set_column", "called\n")); netsnmp_assert(NULL != rowreq_ctx); switch (column) { /* * inetCidrRouteIfIndex(7)/InterfaceIndexOrZero/ASN_INTEGER/long(long)//l/A/W/e/R/d/H */ case COLUMN_INETCIDRROUTEIFINDEX: if (var->val_len != sizeof(long)) { rc = SNMP_ERR_WRONGLENGTH; snmp_log(LOG_ERR, "varbind size of %d does not match expected size %d\n", var->val_len, sizeof(long)); break; } rowreq_ctx->column_set_flags |= FLAG_INETCIDRROUTEIFINDEX; rc = inetCidrRouteIfIndex_set(rowreq_ctx, *((long *) var->val.string)); break; /* * inetCidrRouteType(8)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h */ case COLUMN_INETCIDRROUTETYPE: if (var->val_len != sizeof(u_long)) { rc = SNMP_ERR_WRONGLENGTH; snmp_log(LOG_ERR, "varbind size of %d does not match expected size %d\n", var->val_len, sizeof(u_long)); break; } rowreq_ctx->column_set_flags |= FLAG_INETCIDRROUTETYPE; rc = inetCidrRouteType_set(rowreq_ctx, *((u_long *) var->val.string)); break; /* * inetCidrRouteNextHopAS(11)/InetAutonomousSystemNumber/ASN_UNSIGNED/u_long(u_long)//l/A/W/e/r/D/H */ case COLUMN_INETCIDRROUTENEXTHOPAS: if (var->val_len != sizeof(u_long)) { rc = SNMP_ERR_WRONGLENGTH; snmp_log(LOG_ERR, "varbind size of %d does not match expected size %d\n", var->val_len, sizeof(u_long)); break; } rowreq_ctx->column_set_flags |= FLAG_INETCIDRROUTENEXTHOPAS; rc = inetCidrRouteNextHopAS_set(rowreq_ctx, *((u_long *) var->val.string)); break; /* * inetCidrRouteMetric1(12)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h */ case COLUMN_INETCIDRROUTEMETRIC1: if (var->val_len != sizeof(long)) { rc = SNMP_ERR_WRONGLENGTH; snmp_log(LOG_ERR, "varbind size of %d does not match expected size %d\n", var->val_len, sizeof(long)); break; } rowreq_ctx->column_set_flags |= FLAG_INETCIDRROUTEMETRIC1; rc = inetCidrRouteMetric1_set(rowreq_ctx, *((long *) var->val.string)); break; /* * inetCidrRouteMetric2(13)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h */ case COLUMN_INETCIDRROUTEMETRIC2: if (var->val_len != sizeof(long)) { rc = SNMP_ERR_WRONGLENGTH; snmp_log(LOG_ERR, "varbind size of %d does not match expected size %d\n", var->val_len, sizeof(long)); break; } rowreq_ctx->column_set_flags |= FLAG_INETCIDRROUTEMETRIC2; rc = inetCidrRouteMetric2_set(rowreq_ctx, *((long *) var->val.string)); break; /* * inetCidrRouteMetric3(14)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h */ case COLUMN_INETCIDRROUTEMETRIC3: if (var->val_len != sizeof(long)) { rc = SNMP_ERR_WRONGLENGTH; snmp_log(LOG_ERR, "varbind size of %d does not match expected size %d\n", var->val_len, sizeof(long)); break; } rowreq_ctx->column_set_flags |= FLAG_INETCIDRROUTEMETRIC3; rc = inetCidrRouteMetric3_set(rowreq_ctx, *((long *) var->val.string)); break; /* * inetCidrRouteMetric4(15)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h */ case COLUMN_INETCIDRROUTEMETRIC4: if (var->val_len != sizeof(long)) { rc = SNMP_ERR_WRONGLENGTH; snmp_log(LOG_ERR, "varbind size of %d does not match expected size %d\n", var->val_len, sizeof(long)); break; } rowreq_ctx->column_set_flags |= FLAG_INETCIDRROUTEMETRIC4; rc = inetCidrRouteMetric4_set(rowreq_ctx, *((long *) var->val.string)); break; /* * inetCidrRouteMetric5(16)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h */ case COLUMN_INETCIDRROUTEMETRIC5: if (var->val_len != sizeof(long)) { rc = SNMP_ERR_WRONGLENGTH; snmp_log(LOG_ERR, "varbind size of %d does not match expected size %d\n", var->val_len, sizeof(long)); break; } rowreq_ctx->column_set_flags |= FLAG_INETCIDRROUTEMETRIC5; rc = inetCidrRouteMetric5_set(rowreq_ctx, *((long *) var->val.string)); break; /* * inetCidrRouteStatus(17)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h */ case COLUMN_INETCIDRROUTESTATUS: if (var->val_len != sizeof(u_long)) { rc = SNMP_ERR_WRONGLENGTH; snmp_log(LOG_ERR, "varbind size of %d does not match expected size %d\n", var->val_len, sizeof(u_long)); break; } rowreq_ctx->column_set_flags |= FLAG_INETCIDRROUTESTATUS; rc = inetCidrRouteStatus_set(rowreq_ctx, *((u_long *) var->val.string)); break; default: snmp_log(LOG_ERR, "unknown column %d in _inetCidrRouteTable_set_column\n", column); break; } return rc;} /* _inetCidrRouteTable_set_column */int_mfd_inetCidrRouteTable_set_values(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *agtreq_info, netsnmp_request_info *requests){ inetCidrRouteTable_rowreq_ctx *rowreq_ctx = netsnmp_container_table_row_extract(requests); netsnmp_table_request_info *tri; int rc = SNMP_ERR_NOERROR; DEBUGMSGTL(("internal:inetCidrRouteTable:_mfd_inetCidrRouteTable_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 = _inetCidrRouteTable_set_column(rowreq_ctx, requests->requestvb, tri->colnum); if (MFD_SUCCESS != rc) { DEBUGMSGTL(("verbose:inetCidrRouteTable:mfd", "error %d from " "inetCidrRouteTable_set_column\n", rc)); netsnmp_set_request_error(agtreq_info, requests, SNMP_VALIDATE_ERR(rc)); } } /* for results */ return SNMP_ERR_NOERROR;} /* _mfd_inetCidrRouteTable_set_values *//*---------------------------------------------------------------------- * * SET: commit * *---------------------------------------------------------------------*//** * @internal * commit the values */int_mfd_inetCidrRouteTable_commit(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *agtreq_info, netsnmp_request_info *requests){ int rc; inetCidrRouteTable_rowreq_ctx *rowreq_ctx = netsnmp_container_table_row_extract(requests); DEBUGMSGTL(("internal:inetCidrRouteTable:_mfd_inetCidrRouteTable_commit", "called\n")); netsnmp_assert(NULL != rowreq_ctx); rc = inetCidrRouteTable_commit(rowreq_ctx); if (MFD_SUCCESS != rc) { DEBUGMSGTL(("verbose:inetCidrRouteTable:mfd", "error %d from " "inetCidrRouteTable_commit\n", rc)); netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc)); } return SNMP_ERR_NOERROR;}int_mfd_inetCidrRouteTable_undo_commit(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *agtreq_info, netsnmp_request_info *requests){ int rc; inetCidrRouteTable_rowreq_ctx *rowreq_ctx = netsnmp_container_table_row_extract(requests); DEBUGMSGTL(("internal:inetCidrRouteTable:_mfd_inetCidrRouteTable_undo_commit", "called\n")); netsnmp_assert(NULL != rowreq_ctx); rc = inetCidrRouteTable_undo_commit(rowreq_ctx); if (MFD_SUCCESS != rc) { /* * nothing we can do about it but log it */ DEBUGMSGTL(("verbose:inetCidrRouteTable:mfd", "error %d from " "inetCidrRouteTable_undo_commit\n", rc)); } return SNMP_ERR_NOERROR;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -