⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ipcidrroutetable_interface.c

📁 开发snmp的开发包有两个开放的SNMP开发库
💻 C
📖 第 1 页 / 共 5 页
字号:
    return ipCidrRouteTable_validate_index(ipCidrRouteTable_if_ctx.                                           user_ctx, rowreq_ctx);}                               /* _ipCidrRouteTable_check_indexes *//*********************************************************************** * * 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",                "called for %d\n", column));    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:        rc = SNMP_ERR_NOTWRITABLE;      /* can not change index of active row */        break;        /*         * (INDEX) ipCidrRouteMask(2)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h          */    case COLUMN_IPCIDRROUTEMASK:        rc = SNMP_ERR_NOTWRITABLE;      /* can not change index of active row */        break;        /*         * (INDEX) ipCidrRouteTos(3)/INTEGER32/ASN_INTEGER/long(long)//l/A/w/e/R/d/h          */    case COLUMN_IPCIDRROUTETOS:        rc = SNMP_ERR_NOTWRITABLE;      /* can not change index of active row */        break;        /*         * (INDEX) ipCidrRouteNextHop(4)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h          */    case COLUMN_IPCIDRROUTENEXTHOP:        rc = SNMP_ERR_NOTWRITABLE;      /* can not change index of active row */        break;        /*         * 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);        if (SNMPERR_SUCCESS != rc) {            DEBUGMSGTL(("ipCidrRouteTable:_ipCidrRouteTable_check_column:ipCidrRouteIfIndex", "varbind validation failed (eg bad type or size)\n"));        } else {            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_value\n",                         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);        /*         * check that the value is one of defined enums          */        if ((SNMPERR_SUCCESS == rc)            && (*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) {            DEBUGMSGTL(("ipCidrRouteTable:_ipCidrRouteTable_check_column:ipCidrRouteType", "varbind validation failed (eg bad type or size)\n"));        } else {            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_value\n",                         rc);                rc = SNMP_ERR_GENERR;            }        }        break;        /*         * ipCidrRouteProto(7)/INTEGER/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h          */    case COLUMN_IPCIDRROUTEPROTO:        rc = SNMP_ERR_NOTWRITABLE;        break;        /*         * ipCidrRouteAge(8)/INTEGER32/ASN_INTEGER/long(long)//l/A/w/e/r/D/h          */    case COLUMN_IPCIDRROUTEAGE:        rc = SNMP_ERR_NOTWRITABLE;        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);        if (SNMPERR_SUCCESS != rc) {            DEBUGMSGTL(("ipCidrRouteTable:_ipCidrRouteTable_check_column:ipCidrRouteInfo", "varbind validation failed (eg bad type or size)\n"));        } else {            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_value\n",                         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);        if (SNMPERR_SUCCESS != rc) {            DEBUGMSGTL(("ipCidrRouteTable:_ipCidrRouteTable_check_column:ipCidrRouteNextHopAS", "varbind validation failed (eg bad type or size)\n"));        } else {            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_value\n",                         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);        if (SNMPERR_SUCCESS != rc) {            DEBUGMSGTL(("ipCidrRouteTable:_ipCidrRouteTable_check_column:ipCidrRouteMetric1", "varbind validation failed (eg bad type or size)\n"));        } else {            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_value\n",                         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);        if (SNMPERR_SUCCESS != rc) {            DEBUGMSGTL(("ipCidrRouteTable:_ipCidrRouteTable_check_column:ipCidrRouteMetric2", "varbind validation failed (eg bad type or size)\n"));        } else {            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_value\n",                         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);        if (SNMPERR_SUCCESS != rc) {            DEBUGMSGTL(("ipCidrRouteTable:_ipCidrRouteTable_check_column:ipCidrRouteMetric3", "varbind validation failed (eg bad type or size)\n"));        } else {            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_value\n",                         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);        if (SNMPERR_SUCCESS != rc) {            DEBUGMSGTL(("ipCidrRouteTable:_ipCidrRouteTable_check_column:ipCidrRouteMetric4", "varbind validation failed (eg bad type or size)\n"));        } else {            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_value\n",                         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);        if (SNMPERR_SUCCESS != rc) {            DEBUGMSGTL(("ipCidrRouteTable:_ipCidrRouteTable_check_column:ipCidrRouteMetric5", "varbind validation failed (eg bad type or size)\n"));        } else {            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_value\n",                         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) {            DEBUGMSGTL(("ipCidrRouteTable:_ipCidrRouteTable_check_column:ipCidrRouteStatus", "varbind validation failed (eg bad type or size)\n"));        } else {            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_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 _ipCidrRouteTable_check_column\n",                 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", "called\n"));    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 *//*---------------------------------------------------------------------- * * 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", "called for %d\n", column));    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 |= COLUMN_IPCIDRROUTEIFINDEX_FLAG;        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 |= COLUMN_IPCIDRROUTETYPE_FLAG;        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:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -