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

📄 inetcidrroutetable_data_access.c

📁 开发snmp的开发包有两个开放的SNMP开发库
💻 C
📖 第 1 页 / 共 3 页
字号:
 * inetCidrRoutePolicy is subid 4 of inetCidrRouteEntry. * Its status is Current, and its access level is NoAccess. * OID: .1.3.6.1.2.1.4.24.7.1.4 * Description:This object is an opaque object without any defined                 semantics.  Its purpose is to serve as an additional                 index which may delineate between multiple entries to                 the same destination.  The value { 0 0 } shall be used                 as the default value for this object. * * Attributes: *   accessible 0     isscalar 0     enums  0      hasdefval 0 *   readable   0     iscolumn 1     ranges 0      hashint   0 *   settable   0 * * * Its syntax is OBJECTID (based on perltype OBJECTID) * The net-snmp type is ASN_OBJECT_ID. The C type decl is oid (oid) * This data type requires a length.  (Max 2040) * * * * NOTE: NODE inetCidrRoutePolicy IS NOT ACCESSIBLE * * *//** * check validity of inetCidrRoutePolicy index portion * * @retval MFD_SUCCESS   : the incoming value is legal * @retval MFD_ERROR     : the incoming value is NOT legal * * @note this is not the place to do any checks for the sanity *       of multiple indexes. Those types of checks should be done in the *       inetCidrRouteTable_validate_index() function. * * @note Also keep in mind that if the index refers to a row in this or *       some other table, you can't check for that row here to make *       decisions, since that row might not be created yet, but may *       be created during the processing this request. If you have *       such checks, they should be done in the check_dependencies *       function, because any new/deleted/changed rows should be *       available then. * * The following checks have already been done for you: * * If there a no other checks you need to do, simply return MFD_SUCCESS. */intinetCidrRoutePolicy_check_index(inetCidrRouteTable_rowreq_ctx * rowreq_ctx){    DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRoutePolicy_check_index", "called\n"));    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:426:M: |-> Check inetCidrRouteTable index inetCidrRoutePolicy.     * check that index value in the table context is legal.     * (rowreq_ctx->tbl_index.inetCidrRoutePolicy)     */    return MFD_SUCCESS;         /* inetCidrRoutePolicy index ok */}                               /* inetCidrRoutePolicy_check_index *//*--------------------------------------------------------------------- * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteNextHopType * inetCidrRouteNextHopType is subid 5 of inetCidrRouteEntry. * Its status is Current, and its access level is NoAccess. * OID: .1.3.6.1.2.1.4.24.7.1.5 * Description:The type of the inetCidrRouteNextHop address, as                  defined in the InetAddress MIB.                 Value should be set to unknown(0) for non-remote                  routes.                 Only those address types that may appear in an actual                 routing table are allowed as values of this object. * * Attributes: *   accessible 0     isscalar 0     enums  1      hasdefval 0 *   readable   0     iscolumn 1     ranges 0      hashint   0 *   settable   0 * * Enum range: 5/8. Values:  unknown(0), ipv4(1), ipv6(2), ipv4z(3), ipv6z(4), dns(16) * * Its syntax is InetAddressType (based on perltype INTEGER) * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) * * * * NOTE: NODE inetCidrRouteNextHopType IS NOT ACCESSIBLE * * *//** * check validity of inetCidrRouteNextHopType index portion * * @retval MFD_SUCCESS   : the incoming value is legal * @retval MFD_ERROR     : the incoming value is NOT legal * * @note this is not the place to do any checks for the sanity *       of multiple indexes. Those types of checks should be done in the *       inetCidrRouteTable_validate_index() function. * * @note Also keep in mind that if the index refers to a row in this or *       some other table, you can't check for that row here to make *       decisions, since that row might not be created yet, but may *       be created during the processing this request. If you have *       such checks, they should be done in the check_dependencies *       function, because any new/deleted/changed rows should be *       available then. * * The following checks have already been done for you: *    The value is one of  unknown(0), ipv4(1), ipv6(2), ipv4z(3), ipv6z(4), dns(16) * * If there a no other checks you need to do, simply return MFD_SUCCESS. */intinetCidrRouteNextHopType_check_index(inetCidrRouteTable_rowreq_ctx *                                     rowreq_ctx){    DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteNextHopType_check_index", "called\n"));    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:426:M: |-> Check inetCidrRouteTable index inetCidrRouteNextHopType.     * check that index value in the table context is legal.     * (rowreq_ctx->tbl_index.inetCidrRouteNextHopType)     */    /*     * we don't support all types     */    switch (rowreq_ctx->tbl_idx.inetCidrRouteDestType) {    case INETADDRESSTYPE_IPV4:    case INETADDRESSTYPE_IPV6:        break;    case INETADDRESSTYPE_UNKNOWN:    case INETADDRESSTYPE_IPV4Z:    case INETADDRESSTYPE_IPV6Z:    case INETADDRESSTYPE_DNS:        /*         * fall through          */    default:        return MFD_ERROR;    }    return MFD_SUCCESS;         /* inetCidrRouteNextHopType index ok */}                               /* inetCidrRouteNextHopType_check_index *//*--------------------------------------------------------------------- * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteNextHop * inetCidrRouteNextHop is subid 6 of inetCidrRouteEntry. * Its status is Current, and its access level is NoAccess. * OID: .1.3.6.1.2.1.4.24.7.1.6 * Description:On remote routes, the address of the next system en                              route.  For non-remote routes, a zero length string.                 The type of this address is determined by the value of                 the inetCidrRouteNextHopType object. * * Attributes: *   accessible 0     isscalar 0     enums  0      hasdefval 0 *   readable   0     iscolumn 1     ranges 1      hashint   0 *   settable   0 * * Ranges:  0 - 255; * * Its syntax is InetAddress (based on perltype OCTETSTR) * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char) * This data type requires a length.  (Max 255) * * * * NOTE: NODE inetCidrRouteNextHop IS NOT ACCESSIBLE * * *//** * check validity of inetCidrRouteNextHop index portion * * @retval MFD_SUCCESS   : the incoming value is legal * @retval MFD_ERROR     : the incoming value is NOT legal * * @note this is not the place to do any checks for the sanity *       of multiple indexes. Those types of checks should be done in the *       inetCidrRouteTable_validate_index() function. * * @note Also keep in mind that if the index refers to a row in this or *       some other table, you can't check for that row here to make *       decisions, since that row might not be created yet, but may *       be created during the processing this request. If you have *       such checks, they should be done in the check_dependencies *       function, because any new/deleted/changed rows should be *       available then. * * The following checks have already been done for you: *    The length is in (one of) the range set(s):  0 - 255 * * If there a no other checks you need to do, simply return MFD_SUCCESS. */intinetCidrRouteNextHop_check_index(inetCidrRouteTable_rowreq_ctx *                                 rowreq_ctx){    DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteNextHop_check_index", "called\n"));    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:426:M: |-> Check inetCidrRouteTable index inetCidrRouteNextHop.     * check that index value in the table context is legal.     * (rowreq_ctx->tbl_index.inetCidrRouteNextHop)     */    return MFD_SUCCESS;         /* inetCidrRouteNextHop index ok */}                               /* inetCidrRouteNextHop_check_index *//** * verify specified index is valid. * * This check is independent of whether or not the values specified for * the columns of the new row are valid. Column values and row consistency * will be checked later. At this point, only the index values should be * checked. * * All of the individual index validation functions have been called, so this * is the place to make sure they are valid as a whole when combined. If * you only have one index, then you probably don't need to do anything else * here. *  * @note Keep in mind that if the indexes refer to a row in this or *       some other table, you can't check for that row here to make *       decisions, since that row might not be created yet, but may *       be created during the processing this request. If you have *       such checks, they should be done in the check_dependencies *       function, because any new/deleted/changed rows should be *       available then. * * * @param inetCidrRouteTable_reg *        Pointer to the user registration data * @param rowreq_ctx *        Pointer to the users context. * @retval MFD_SUCCESS            : success * @retval MFD_CANNOT_CREATE_NOW  : index not valid right now * @retval MFD_CANNOT_CREATE_EVER : index never valid */intinetCidrRouteTable_validate_index(inetCidrRouteTable_registration *                                  inetCidrRouteTable_reg,                                  inetCidrRouteTable_rowreq_ctx *                                  rowreq_ctx){    int             rc = MFD_SUCCESS;    DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteTable_validate_index", "called\n"));    /** we should have a non-NULL pointer */    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:430:M: |-> Validate potential inetCidrRouteTable index.     */    if (rowreq_ctx->tbl_idx.inetCidrRouteDestType !=        rowreq_ctx->tbl_idx.inetCidrRouteNextHopType) {        DEBUGMSGTL(("inetCidrRouteTable:validate_index",                    "ipv4/v6 cross routing not supported\n"));        return MFD_CANNOT_CREATE_EVER;    }    /*     * InetAddress     */    if (((INETADDRESSTYPE_IPV4 ==          rowreq_ctx->tbl_idx.inetCidrRouteDestType)         && (4 != rowreq_ctx->tbl_idx.inetCidrRouteDest_len))        ||        ((INETADDRESSTYPE_IPV6 ==          rowreq_ctx->tbl_idx.inetCidrRouteDestType)         && (16 != rowreq_ctx->tbl_idx.inetCidrRouteDest_len))) {        DEBUGMSGTL(("inetCidrRouteTable:validate_index",                    "dest addr type/size mismatch\n"));        return MFD_CANNOT_CREATE_EVER;    }    /*     * InetAddress     */    if (((INETADDRESSTYPE_IPV4 ==          rowreq_ctx->tbl_idx.inetCidrRouteNextHopType)         && (4 != rowreq_ctx->tbl_idx.inetCidrRouteNextHop_len))        ||        ((INETADDRESSTYPE_IPV6 ==          rowreq_ctx->tbl_idx.inetCidrRouteNextHopType)         && (16 != rowreq_ctx->tbl_idx.inetCidrRouteNextHop_len))) {        DEBUGMSGTL(("inetCidrRouteTable:validate_index",                    "next hop addr type/size mismatch\n"));        return MFD_CANNOT_CREATE_EVER;    }    return rc;}                               /* inetCidrRouteTable_validate_index *//** @} */

⌨️ 快捷键说明

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