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

📄 ipv6interfacetable_interface.c

📁 开发snmp的开发包有两个开放的SNMP开发库
💻 C
📖 第 1 页 / 共 4 页
字号:
        /*         * ipv6InterfaceReasmMaxSize(2)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/R/d/h          */    case COLUMN_IPV6INTERFACEREASMMAXSIZE:        rc = SNMP_ERR_NOTWRITABLE;        break;        /*         * ipv6InterfaceIdentifier(3)/Ipv6AddressIfIdentifierTC/ASN_OCTET_STR/char(char)//L/A/w/e/R/d/H          */    case COLUMN_IPV6INTERFACEIDENTIFIER:        rc = SNMP_ERR_NOTWRITABLE;        break;        /*         * ipv6InterfaceEnableStatus(5)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h          */    case COLUMN_IPV6INTERFACEENABLESTATUS:        rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,                                            sizeof(rowreq_ctx->data.                                                   ipv6InterfaceEnableStatus));        /*         * check that the value is one of defined enums          */        if ((SNMPERR_SUCCESS == rc)            && (*var->val.integer != IPV6INTERFACEENABLESTATUS_UP)            && (*var->val.integer != IPV6INTERFACEENABLESTATUS_DOWN)            ) {            rc = SNMP_ERR_WRONGVALUE;        }        if (SNMPERR_SUCCESS != rc) {            DEBUGMSGTL(("ipv6InterfaceTable:_ipv6InterfaceTable_check_column:ipv6InterfaceEnableStatus", "varbind validation failed (eg bad type or size)\n"));        } else {            rc = ipv6InterfaceEnableStatus_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 ipv6InterfaceEnableStatus_check_value\n",                         rc);                rc = SNMP_ERR_GENERR;            }        }        break;        /*         * ipv6InterfaceReachableTime(6)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/h          */    case COLUMN_IPV6INTERFACEREACHABLETIME:        rc = SNMP_ERR_NOTWRITABLE;        break;        /*         * ipv6InterfaceRetransmitTime(7)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/h          */    case COLUMN_IPV6INTERFACERETRANSMITTIME:        rc = SNMP_ERR_NOTWRITABLE;        break;        /*         * ipv6InterfaceForwarding(8)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h          */    case COLUMN_IPV6INTERFACEFORWARDING:        rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,                                            sizeof(rowreq_ctx->data.                                                   ipv6InterfaceForwarding));        /*         * check that the value is one of defined enums          */        if ((SNMPERR_SUCCESS == rc)            && (*var->val.integer != IPV6INTERFACEFORWARDING_FORWARDING)            && (*var->val.integer != IPV6INTERFACEFORWARDING_NOTFORWARDING)            ) {            rc = SNMP_ERR_WRONGVALUE;        }        if (SNMPERR_SUCCESS != rc) {            DEBUGMSGTL(("ipv6InterfaceTable:_ipv6InterfaceTable_check_column:ipv6InterfaceForwarding", "varbind validation failed (eg bad type or size)\n"));        } else {            rc = ipv6InterfaceForwarding_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 ipv6InterfaceForwarding_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 _ipv6InterfaceTable_check_column\n",                 column);    }    return rc;}                               /* _ipv6InterfaceTable_check_column */int_mfd_ipv6InterfaceTable_check_objects(netsnmp_mib_handler *handler, netsnmp_handler_registration                                      *reginfo, netsnmp_agent_request_info                                      *agtreq_info,                                      netsnmp_request_info *requests){    ipv6InterfaceTable_rowreq_ctx *rowreq_ctx =        netsnmp_container_table_row_extract(requests);    netsnmp_table_request_info *tri;    int             rc;    DEBUGMSGTL(("internal:ipv6InterfaceTable:_mfd_ipv6InterfaceTable_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 = _ipv6InterfaceTable_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_ipv6InterfaceTable_check_objects *//*---------------------------------------------------------------------- * * SET: Undo setup * *---------------------------------------------------------------------*//* * @internal * Set the value for a particular column */NETSNMP_STATIC_INLINE int_ipv6InterfaceTable_undo_setup_column(ipv6InterfaceTable_rowreq_ctx *                                      rowreq_ctx, int column){    int             rc = SNMPERR_SUCCESS;    DEBUGMSGTL(("internal:ipv6InterfaceTable:_ipv6InterfaceTable_undo_setup_column", "called for %d\n", column));    netsnmp_assert(NULL != rowreq_ctx);    switch (column) {        /*         * ipv6InterfaceEnableStatus(5)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h          */    case COLUMN_IPV6INTERFACEENABLESTATUS:        rowreq_ctx->column_set_flags |=            COLUMN_IPV6INTERFACEENABLESTATUS_FLAG;        rc = ipv6InterfaceEnableStatus_undo_setup(rowreq_ctx);        break;        /*         * ipv6InterfaceForwarding(8)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h          */    case COLUMN_IPV6INTERFACEFORWARDING:        rowreq_ctx->column_set_flags |=            COLUMN_IPV6INTERFACEFORWARDING_FLAG;        rc = ipv6InterfaceForwarding_undo_setup(rowreq_ctx);        break;    default:        snmp_log(LOG_ERR,                 "unknown column %d in _ipv6InterfaceTable_undo_setup_column\n",                 column);        break;    }    return rc;}                               /* _ipv6InterfaceTable_undo_setup_column *//** * @internal * undo setup */int_mfd_ipv6InterfaceTable_undo_setup(netsnmp_mib_handler *handler,                                   netsnmp_handler_registration *reginfo,                                   netsnmp_agent_request_info *agtreq_info,                                   netsnmp_request_info *requests){    int             rc;    ipv6InterfaceTable_rowreq_ctx *rowreq_ctx =        netsnmp_container_table_row_extract(requests);    DEBUGMSGTL(("internal:ipv6InterfaceTable:_mfd_ipv6InterfaceTable_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 = ipv6InterfaceTable_undo_setup(rowreq_ctx);    if (MFD_SUCCESS != rc) {        DEBUGMSGTL(("ipv6InterfaceTable:mfd", "error %d from "                    "ipv6InterfaceTable_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 = _ipv6InterfaceTable_undo_setup_column(rowreq_ctx,                                                       tri->colnum);            if (MFD_SUCCESS != rc) {                DEBUGMSGTL(("ipv6InterfaceTable:mfd", "error %d from "                            "ipv6InterfaceTable_undo_setup_column\n", rc));                netsnmp_set_request_error(agtreq_info, requests,                                          SNMP_VALIDATE_ERR(rc));            }        }                       /* for results */    }    return SNMP_ERR_NOERROR;}                               /* _mfd_ipv6InterfaceTable_undo_setup *//** * @internal * undo setup */int_mfd_ipv6InterfaceTable_undo_cleanup(netsnmp_mib_handler *handler,                                     netsnmp_handler_registration *reginfo,                                     netsnmp_agent_request_info                                     *agtreq_info,                                     netsnmp_request_info *requests){    ipv6InterfaceTable_rowreq_ctx *rowreq_ctx =        netsnmp_container_table_row_extract(requests);    int             rc;    DEBUGMSGTL(("internal:ipv6InterfaceTable:_mfd_ipv6InterfaceTable_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 = ipv6InterfaceTable_undo_cleanup(rowreq_ctx);    if (MFD_SUCCESS != rc) {        /*         * nothing we can do about it but log it         */        DEBUGMSGTL(("ipv6InterfaceTable:mfd", "error %d from "                    "ipv6InterfaceTable_undo_cleanup\n", rc));    }    /*     * release undo context, if needed     */    _mfd_ifTable_undo_setup_release(rowreq_ctx);    return SNMP_ERR_NOERROR;}                               /* _mfd_ipv6InterfaceTable_undo_cleanup *//*---------------------------------------------------------------------- * * SET: Set values * *---------------------------------------------------------------------*//* * @internal * Set the value for a particular column */NETSNMP_STATIC_INLINE int_ipv6InterfaceTable_set_column(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx,                               netsnmp_variable_list * var, int column){    int             rc = SNMPERR_SUCCESS;    DEBUGMSGTL(("internal:ipv6InterfaceTable:_ipv6InterfaceTable_set_column", "called for %d\n", column));    netsnmp_assert(NULL != rowreq_ctx);    switch (column) {        /*         * ipv6InterfaceEnableStatus(5)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h          */    case COLUMN_IPV6INTERFACEENABLESTATUS:        rowreq_ctx->column_set_flags |=            COLUMN_IPV6INTERFACEENABLESTATUS_FLAG;        rc = ipv6InterfaceEnableStatus_set(rowreq_ctx,                                           *((u_long *) var->val.string));        break;        /*         * ipv6InterfaceForwarding(8)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h          */    case COLUMN_IPV6INTERFACEFORWARDING:        rowreq_ctx->column_set_flags |=            COLUMN_IPV6INTERFACEFORWARDING_FLAG;        rc = ipv6InterfaceForwarding_set(rowreq_ctx,                                         *((u_long *) var->val.string));        break;    default:        snmp_log(LOG_ERR,                 "unknown column %d in _ipv6InterfaceTable_set_column\n",                 column);        rc = SNMP_ERR_GENERR;        break;    }    return rc;}                               /* _ipv6InterfaceTable_set_column */

⌨️ 快捷键说明

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