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

📄 inetcidrroutetable.c

📁 开发snmp的开发包有两个开放的SNMP开发库
💻 C
📖 第 1 页 / 共 5 页
字号:
    rc = netsnmp_access_route_entry_set(rowreq_ctx->data);    if (rc) {        snmp_log(LOG_ERR,                 "inetCidrRouteTable column inetCidrRouteStatus commit failed\n");        rc = MFD_ERROR;    } else {        /*         * set flag, in case we need to undo          */        rowreq_ctx->column_set_flags |= save_flags;    }    /*     * if we successfully commited this row, set the dirty flag.     */    if (MFD_SUCCESS == rc) {        rowreq_ctx->rowreq_flags |= MFD_ROW_DIRTY;    }    return rc;}                               /* inetCidrRouteTable_commit *//** * undo commit new values. * * Should you need different behavior depending on which columns were * set, rowreq_ctx->column_set_flags will indicate which writeable columns were * set. The definitions for the COLUMN_*_FLAG bits can be found in * inetCidrRouteTable.h. * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags. * * @param rowreq_ctx *        Pointer to the users context. * * @retval MFD_SUCCESS : success * @retval MFD_ERROR   : error */intinetCidrRouteTable_undo_commit(inetCidrRouteTable_rowreq_ctx * rowreq_ctx){    int             rc = MFD_SUCCESS;    DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteTable_undo_commit", "called\n"));    /** we should have a non-NULL pointer */    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:485:M: |-> Undo inetCidrRouteTable commit.     * check the column's flag in rowreq_ctx->column_set_flags to see     * if it was set during commit, then undo it.     *     * eg: if (rowreq_ctx->column_set_flags & COLUMN__FLAG) {}     */    if (rowreq_ctx->column_set_flags & COLUMN_INETCIDRROUTESTATUS_FLAG) {        /*         * if we created an addr, delete it. if we deleted it,         * re-create it. If we changed it, change it back.         */        if (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED) {            rowreq_ctx->undo->flags |= NETSNMP_ACCESS_ROUTE_DELETE;        } else if (ROWSTATUS_DESTROY == rowreq_ctx->row_status) {            rowreq_ctx->undo->flags |= NETSNMP_ACCESS_ROUTE_CREATE;        } else            rowreq_ctx->undo->flags |= NETSNMP_ACCESS_ROUTE_CHANGE;    } else        rowreq_ctx->undo->flags |= NETSNMP_ACCESS_ROUTE_CHANGE;    /*     * do it     */    rc = netsnmp_access_route_entry_set(rowreq_ctx->undo);    if (rc) {        DEBUGMSGTL(("ipAddressTable",                    "bad rc %d from IP address data access\n", rc));        rc = MFD_ERROR;    }    /*     * if we successfully un-commited this row, clear the dirty flag.     */    if (MFD_SUCCESS == rc) {        rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY;    }    return rc;}                               /* inetCidrRouteTable_undo_commit *//* * TODO:440:M: Implement inetCidrRouteTable node value checks. * TODO:450:M: Implement inetCidrRouteTable undo functions. * TODO:460:M: Implement inetCidrRouteTable set functions. * TODO:480:M: Implement inetCidrRouteTable commit functions. *//*--------------------------------------------------------------------- * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteIfIndex * inetCidrRouteIfIndex is subid 7 of inetCidrRouteEntry. * Its status is Current, and its access level is Create. * OID: .1.3.6.1.2.1.4.24.7.1.7 * Description:The ifIndex value which identifies the local interface                 through which the next hop of this route should be                  reached.  A value of 0 is valid and represents the                 scenario where no interface is specified. * * Attributes: *   accessible 1     isscalar 0     enums  0      hasdefval 0 *   readable   1     iscolumn 1     ranges 1      hashint   1 *   settable   1 *   hint: d * * Ranges:  0 - 2147483647; * * Its syntax is InterfaceIndexOrZero (based on perltype INTEGER32) * The net-snmp type is ASN_INTEGER. The C type decl is long (long) *//** * Check that the proposed new value is potentially valid. * * @param rowreq_ctx *        Pointer to the row request context. * @param inetCidrRouteIfIndex_val *        A long containing the new value. * * @retval MFD_SUCCESS        : incoming value is legal * @retval MFD_NOT_VALID_NOW  : incoming value is not valid now * @retval MFD_NOT_VALID_EVER : incoming value is never valid * * This is the place to check for requirements that are not * expressed in the mib syntax (for example, a requirement that * is detailed in the description for an object). * * You should check that the requested change between the undo value and the * new value is legal (ie, the transistion from one value to another * is legal). *       *@note * This check is only to determine if the new value * is \b potentially valid. This is the first check of many, and * is one of the simplest ones. *  *@note * this is not the place to do any checks for values * which depend on some other value in the mib. Those * types of checks should be done in the * inetCidrRouteTable_check_dependencies() function. * * The following checks have already been done for you: *    The syntax is ASN_INTEGER *    The value is in (one of) the range set(s):  0 - 2147483647 * * If there a no other checks you need to do, simply return MFD_SUCCESS. * */intinetCidrRouteIfIndex_check_value(inetCidrRouteTable_rowreq_ctx *                                 rowreq_ctx, long inetCidrRouteIfIndex_val){    DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteIfIndex_check_value", "called\n"));    /** should never get a NULL pointer */    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:441:o: |-> Check for valid inetCidrRouteIfIndex value.     */    return MFD_SUCCESS;         /* inetCidrRouteIfIndex value not illegal */}                               /* inetCidrRouteIfIndex_check_value *//** * Set the new value. * * @param rowreq_ctx *        Pointer to the users context. You should know how to *        manipulate the value from this object. * @param inetCidrRouteIfIndex_val *        A long containing the new value. */intinetCidrRouteIfIndex_set(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,                         long inetCidrRouteIfIndex_val){    DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteIfIndex_set",                "called\n"));    /** should never get a NULL pointer */    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:461:M: |-> Set inetCidrRouteIfIndex value.     * set inetCidrRouteIfIndex value in rowreq_ctx->data     */    rowreq_ctx->data->if_index = inetCidrRouteIfIndex_val;    return MFD_SUCCESS;}                               /* inetCidrRouteIfIndex_set *//*--------------------------------------------------------------------- * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteType * inetCidrRouteType is subid 8 of inetCidrRouteEntry. * Its status is Current, and its access level is Create. * OID: .1.3.6.1.2.1.4.24.7.1.8 * Description:The type of route.  Note that local(3) refers to a                  route for which the next hop is the final destination;                  remote(4)refers to a route for which the next hop is                  not the final destination.                 Routes which do not result in traffic forwarding or                 rejection should not be displayed even if the                  implementation keeps them stored internally.                 reject(2) refers to a route which, if matched, discards                  the message as unreachable and returns a notification                  (e.g. ICMP error) to the message sender.  This is used                  in some protocols as a means of correctly aggregating                  routes.                 blackhole(5) refers to a route which, if matched,                  discards the message silently. * * Attributes: *   accessible 1     isscalar 0     enums  1      hasdefval 0 *   readable   1     iscolumn 1     ranges 0      hashint   0 *   settable   1 * * Enum range: 3/8. Values:  other(1), reject(2), local(3), remote(4), blackhole(5) * * Its syntax is INTEGER (based on perltype INTEGER) * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) *//** * Check that the proposed new value is potentially valid. * * @param rowreq_ctx *        Pointer to the row request context. * @param inetCidrRouteType_val *        A long containing the new value. * * @retval MFD_SUCCESS        : incoming value is legal * @retval MFD_NOT_VALID_NOW  : incoming value is not valid now * @retval MFD_NOT_VALID_EVER : incoming value is never valid * * This is the place to check for requirements that are not * expressed in the mib syntax (for example, a requirement that * is detailed in the description for an object). * * You should check that the requested change between the undo value and the * new value is legal (ie, the transistion from one value to another * is legal). *       *@note * This check is only to determine if the new value * is \b potentially valid. This is the first check of many, and * is one of the simplest ones. *  *@note * this is not the place to do any checks for values * which depend on some other value in the mib. Those * types of checks should be done in the * inetCidrRouteTable_check_dependencies() function. * * The following checks have already been done for you: *    The syntax is ASN_INTEGER *    The value is one of  other(1), reject(2), local(3), remote(4), blackhole(5) * * If there a no other checks you need to do, simply return MFD_SUCCESS. * */intinetCidrRouteType_check_value(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,                              u_long inetCidrRouteType_val){    DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteType_check_value",                "called\n"));    /** should never get a NULL pointer */    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:441:o: |-> Check for valid inetCidrRouteType value.     */    return MFD_SUCCESS;         /* inetCidrRouteType value not illegal */}                               /* inetCidrRouteType_check_value *//** * Set the new value. * * @param rowreq_ctx *        Pointer to the users context. You should know how to *        manipulate the value from this object. * @param inetCidrRouteType_val *        A long containing the new value. */intinetCidrRouteType_set(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,                      u_long inetCidrRouteType_val){    DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteType_set",                "called\n"));    /** should never get a NULL pointer */    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:461:M: |-> Set inetCidrRouteType value.     * set inetCidrRouteType value in rowreq_ctx->data     */    rowreq_ctx->data->rt_type = inetCidrRouteType_val;    return MFD_SUCCESS;}                               /* inetCidrRouteType_set *//*--------------------------------------------------------------------- * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteNextHopAS * inetCidrRouteNextHopAS is subid 11 of inetCidrRouteEntry. * Its status is Current, and its access level is Create. * OID: .1.3.6.1.2.1.4.24.7.1.11 * Description:The Autonomous System Number of the Next Hop.  The                  semantics of this object are determined by the routing-                 protocol specified in the route's inetCidrRouteProto                  value. When this object is unknown or not relevant its                  value should be set to zero. * * Attributes: *   accessible 1     isscalar 0     enums  0      hasdefval 1 *   readable   1     iscolumn 1     ranges 0      hashint   1 *   settable   1 *   defval: 0 *   hint: d * * * Its syntax is InetAutonomousSystemNumber (based on perltype UNSIGNED32) * The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long) *//** * Check that the proposed new value is potentially valid. * * @param rowreq_ctx *        Pointer to the row request context. * @param inetCidrRouteNextHopAS_val *        A u_long containing the new value. * * @retval MFD_SUCCESS        : incoming value is legal * @retval MFD_NOT_VALID_NOW  : incoming value is not valid now * @retval MFD_NOT_VALID_EVER : incoming value is never valid * * This is the place to check for requirements that are not * expressed in the mib syntax (for example, a requirement that * is detailed in the description for an object). * * You should check that the requested change between the undo value and the * new value is legal (ie, the transistion from one value to another * is legal). *       *@note * This check is only to determine if the new value * is \b potentially valid. This is the first check of many, and * is one of the simplest ones. *  *@note * this is not the 

⌨️ 快捷键说明

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