📄 inetcidrroutetable_data_access.c
字号:
} /* inetCidrRouteTable_container_free *//** * prepare row for processing. * * When the agent has located the row for a request, this function is * called to prepare the row for processing. If you fully populated * the data context during the index setup phase, you may not need to * do anything. * * @param rowreq_ctx pointer to a context. * * @retval MFD_SUCCESS : success. * @retval MFD_ERROR : other error. */intinetCidrRouteTable_row_prep(inetCidrRouteTable_rowreq_ctx * rowreq_ctx){ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteTable_row_prep", "called\n")); netsnmp_assert(NULL != rowreq_ctx); /* * TODO:390:o: Prepare row for request. * If populating row data was delayed, this is the place to * fill in the row for this request. */ if (MFD_ROW_CREATED & rowreq_ctx->rowreq_flags) { memcpy(rowreq_ctx->data->rt_dest, rowreq_ctx->tbl_idx.inetCidrRouteDest, rowreq_ctx->tbl_idx.inetCidrRouteDest_len); rowreq_ctx->data->rt_dest_len = rowreq_ctx->tbl_idx.inetCidrRouteDest_len; rowreq_ctx->data->rt_dest_type = rowreq_ctx->tbl_idx.inetCidrRouteDestType; memcpy(rowreq_ctx->data->rt_nexthop, rowreq_ctx->tbl_idx.inetCidrRouteNextHop, rowreq_ctx->tbl_idx.inetCidrRouteNextHop_len); rowreq_ctx->data->rt_nexthop_len = rowreq_ctx->tbl_idx.inetCidrRouteNextHop_len; rowreq_ctx->data->rt_nexthop_type = rowreq_ctx->tbl_idx.inetCidrRouteNextHopType; rowreq_ctx->data->rt_pfx_len = rowreq_ctx->tbl_idx.inetCidrRoutePfxLen; rowreq_ctx->data->rt_policy_len = rowreq_ctx->tbl_idx.inetCidrRoutePolicy_len; rowreq_ctx->data->rt_policy = rowreq_ctx->tbl_idx.inetCidrRoutePolicy; /* * policy pointing to rowreq array, set flag so * it won't be freed */ rowreq_ctx->data->flags |= NETSNMP_ACCESS_ROUTE_POLICY_STATIC; } return MFD_SUCCESS;} /* inetCidrRouteTable_row_prep *//* * TODO:420:r: Implement inetCidrRouteTable index validation. *//*--------------------------------------------------------------------- * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteDestType * inetCidrRouteDestType is subid 1 of inetCidrRouteEntry. * Its status is Current, and its access level is NoAccess. * OID: .1.3.6.1.2.1.4.24.7.1.1 * Description:The type of the inetCidrRouteDest address, as defined in the InetAddress MIB. 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 inetCidrRouteDestType IS NOT ACCESSIBLE * * *//** * check validity of inetCidrRouteDestType 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. */intinetCidrRouteDestType_check_index(inetCidrRouteTable_rowreq_ctx * rowreq_ctx){ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteDestType_check_index", "called\n")); netsnmp_assert(NULL != rowreq_ctx); /* * TODO:426:M: |-> Check inetCidrRouteTable index inetCidrRouteDestType. * check that index value in the table context is legal. * (rowreq_ctx->tbl_index.inetCidrRouteDestType) */ /* * 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; /* inetCidrRouteDestType index ok */} /* inetCidrRouteDestType_check_index *//*--------------------------------------------------------------------- * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteDest * inetCidrRouteDest is subid 2 of inetCidrRouteEntry. * Its status is Current, and its access level is NoAccess. * OID: .1.3.6.1.2.1.4.24.7.1.2 * Description:The destination IP address of this route. The type of this address is determined by the value of the inetCidrRouteDestType object. The values for the index objects inetCidrRouteDest and inetCidrRoutePfxLen must be consistent. When the value of inetCidrRouteDest (excluding the zone index, if one is present) is x, then the bitwise logical-AND of x with the value of the mask formed from the corresponding index object inetCidrRoutePfxLen MUST be equal to x. If not, then the index pair is not consistent and an inconsistentName error must be returned on SET or CREATE requests. * * 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 inetCidrRouteDest IS NOT ACCESSIBLE * * *//** * check validity of inetCidrRouteDest 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. */intinetCidrRouteDest_check_index(inetCidrRouteTable_rowreq_ctx * rowreq_ctx){ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteDest_check_index", "called\n")); netsnmp_assert(NULL != rowreq_ctx); /* * TODO:426:M: |-> Check inetCidrRouteTable index inetCidrRouteDest. * check that index value in the table context is legal. * (rowreq_ctx->tbl_index.inetCidrRouteDest) */ return MFD_SUCCESS; /* inetCidrRouteDest index ok */} /* inetCidrRouteDest_check_index *//*--------------------------------------------------------------------- * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRoutePfxLen * inetCidrRoutePfxLen is subid 3 of inetCidrRouteEntry. * Its status is Current, and its access level is NoAccess. * OID: .1.3.6.1.2.1.4.24.7.1.3 * Description:Indicates the number of leading one bits which form the mask to be logical-ANDed with the destination address before being compared to the value in the inetCidrRouteDest field. The values for the index objects inetCidrRouteDest and inetCidrRoutePfxLen must be consistent. When the value of inetCidrRouteDest (excluding the zone index, if one is present) is x, then the bitwise logical-AND of x with the value of the mask formed from the corresponding index object inetCidrRoutePfxLen MUST be equal to x. If not, then the index pair is not consistent and an inconsistentName error must be returned on SET or CREATE requests. * * Attributes: * accessible 0 isscalar 0 enums 0 hasdefval 0 * readable 0 iscolumn 1 ranges 1 hashint 1 * settable 0 * hint: d * * Ranges: 0 - 2040; * * Its syntax is InetAddressPrefixLength (based on perltype UNSIGNED32) * The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long) * * * * NOTE: NODE inetCidrRoutePfxLen IS NOT ACCESSIBLE * * *//** * check validity of inetCidrRoutePfxLen 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 in (one of) the range set(s): 0 - 2040 * * If there a no other checks you need to do, simply return MFD_SUCCESS. */intinetCidrRoutePfxLen_check_index(inetCidrRouteTable_rowreq_ctx * rowreq_ctx){ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRoutePfxLen_check_index", "called\n")); netsnmp_assert(NULL != rowreq_ctx); /* * TODO:426:M: |-> Check inetCidrRouteTable index inetCidrRoutePfxLen. * check that index value in the table context is legal. * (rowreq_ctx->tbl_index.inetCidrRoutePfxLen) */ return MFD_SUCCESS; /* inetCidrRoutePfxLen index ok */} /* inetCidrRoutePfxLen_check_index *//*--------------------------------------------------------------------- * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRoutePolicy
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -