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

📄 ipcidrroutetable.c

📁 snmp的源代码,已经在我的ubuntu下编译通过
💻 C
📖 第 1 页 / 共 5 页
字号:
         * If the index can not be created under the present circumstances         * (even though it could be created under other circumstances),         * return MFD_NOT_NOW.         */        if (0) {            return MFD_CANNOT_CREATE_EVER;        } else {            return MFD_CANNOT_CREATE_NOW;        }    }    return rc;}                               /* ipCidrRouteTable_validate_index *//** * Setup up context with information needed to undo a set request. * * This function will be called before the individual node undo setup * functions are called. If you need to do any undo setup that is not * related to a specific column, you can do it here. * * Note that an individual node's undo_setup function will only be called * if that node is being set to a new value. * * If there is any setup specific to a particular column (e.g. allocating * memory for a string), you should do that setup in the node's undo_setup * function, so it won't be done unless it is necessary. * * @param rowreq_ctx *        Pointer to the table context (ipCidrRouteTable_rowreq_ctx) * * @retval MFD_SUCCESS : success * @retval MFD_ERROR   : error. set will fail. */intipCidrRouteTable_undo_setup(ipCidrRouteTable_rowreq_ctx * rowreq_ctx){    int             rc = MFD_SUCCESS;    DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTable_undo_setup",                "called\n"));    /** we should have a non-NULL pointer */    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:451:M: |-> Setup ipCidrRouteTable undo.     * set up ipCidrRouteTable undo information, in preparation for a set.     */    return rc;}                               /* ipCidrRouteTable_undo_setup *//** * Cleanup up context undo information. * * This function will be called after set/commit processing. If you * allocated any resources in undo_setup, this is the place to release * those resources. * * This function is called regardless of the success or failure of the set * request. If you need to perform different steps for cleanup depending * on success or failure, you can add a flag to the rowreq_ctx. * * @param rowreq_ctx *        Pointer to the table context (ipCidrRouteTable_rowreq_ctx) * * @retval MFD_SUCCESS : success * @retval MFD_ERROR   : error */intipCidrRouteTable_undo_cleanup(ipCidrRouteTable_rowreq_ctx * rowreq_ctx){    int             rc = MFD_SUCCESS;    DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTable_undo_cleanup",                "called\n"));    /** we should have a non-NULL pointer */    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:452:M: |-> Cleanup ipCidrRouteTable undo.     */    return rc;}                               /* ipCidrRouteTable_undo_cleanup *//** * commit new values. * * At this point, you should have done everything you can to ensure that * this commit will not fail. * * 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 FLAG_* bits can be found in * ipCidrRouteTable.h. * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags. * * @param ipCidrRouteTable_rowreq_ctx *        Pointer to the users context. * * @retval MFD_SUCCESS : success * @retval MFD_ERROR   : error */intipCidrRouteTable_commit(ipCidrRouteTable_rowreq_ctx * rowreq_ctx){    int             rc = MFD_SUCCESS;    int             save_flags;    DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTable_commit",                "called\n"));    /** we should have a non-NULL pointer */    netsnmp_assert(NULL != rowreq_ctx);    /*     * save flags, then clear until we actually do something     */    save_flags = rowreq_ctx->column_set_flags;    rowreq_ctx->column_set_flags = 0;    /*     * commit ipCidrRouteTable data     * 1) check the column's flag in save_flags to see if it was set.     * 2) clear the flag when you handle that column     * 3) set the column's flag in column_set_flags if it needs undo     *    processing in case of a failure.     */    if (save_flags & FLAG_IPCIDRROUTEIFINDEX) {        save_flags &= ~FLAG_IPCIDRROUTEIFINDEX; /* clear ipCidrRouteIfIndex */        /*         * TODO:482:o: |-> commit column ipCidrRouteIfIndex.         */        rc = -1;        if (-1 == rc) {            snmp_log(LOG_ERR,                     "ipCidrRouteTable column ipCidrRouteIfIndex commit failed\n");        } else {            /*             * set flag, in case we need to undo ipCidrRouteIfIndex             */            rowreq_ctx->column_set_flags |= FLAG_IPCIDRROUTEIFINDEX;        }    }    if (save_flags & FLAG_IPCIDRROUTETYPE) {        save_flags &= ~FLAG_IPCIDRROUTETYPE;    /* clear ipCidrRouteType */        /*         * TODO:482:o: |-> commit column ipCidrRouteType.         */        rc = -1;        if (-1 == rc) {            snmp_log(LOG_ERR,                     "ipCidrRouteTable column ipCidrRouteType commit failed\n");        } else {            /*             * set flag, in case we need to undo ipCidrRouteType             */            rowreq_ctx->column_set_flags |= FLAG_IPCIDRROUTETYPE;        }    }    if (save_flags & FLAG_IPCIDRROUTEINFO) {        save_flags &= ~FLAG_IPCIDRROUTEINFO;    /* clear ipCidrRouteInfo */        /*         * TODO:482:o: |-> commit column ipCidrRouteInfo.         */        rc = -1;        if (-1 == rc) {            snmp_log(LOG_ERR,                     "ipCidrRouteTable column ipCidrRouteInfo commit failed\n");        } else {            /*             * set flag, in case we need to undo ipCidrRouteInfo             */            rowreq_ctx->column_set_flags |= FLAG_IPCIDRROUTEINFO;        }    }    if (save_flags & FLAG_IPCIDRROUTENEXTHOPAS) {        save_flags &= ~FLAG_IPCIDRROUTENEXTHOPAS;       /* clear ipCidrRouteNextHopAS */        /*         * TODO:482:o: |-> commit column ipCidrRouteNextHopAS.         */        rc = -1;        if (-1 == rc) {            snmp_log(LOG_ERR,                     "ipCidrRouteTable column ipCidrRouteNextHopAS commit failed\n");        } else {            /*             * set flag, in case we need to undo ipCidrRouteNextHopAS             */            rowreq_ctx->column_set_flags |= FLAG_IPCIDRROUTENEXTHOPAS;        }    }    if (save_flags & FLAG_IPCIDRROUTEMETRIC1) {        save_flags &= ~FLAG_IPCIDRROUTEMETRIC1; /* clear ipCidrRouteMetric1 */        /*         * TODO:482:o: |-> commit column ipCidrRouteMetric1.         */        rc = -1;        if (-1 == rc) {            snmp_log(LOG_ERR,                     "ipCidrRouteTable column ipCidrRouteMetric1 commit failed\n");        } else {            /*             * set flag, in case we need to undo ipCidrRouteMetric1             */            rowreq_ctx->column_set_flags |= FLAG_IPCIDRROUTEMETRIC1;        }    }    if (save_flags & FLAG_IPCIDRROUTEMETRIC2) {        save_flags &= ~FLAG_IPCIDRROUTEMETRIC2; /* clear ipCidrRouteMetric2 */        /*         * TODO:482:o: |-> commit column ipCidrRouteMetric2.         */        rc = -1;        if (-1 == rc) {            snmp_log(LOG_ERR,                     "ipCidrRouteTable column ipCidrRouteMetric2 commit failed\n");        } else {            /*             * set flag, in case we need to undo ipCidrRouteMetric2             */            rowreq_ctx->column_set_flags |= FLAG_IPCIDRROUTEMETRIC2;        }    }    if (save_flags & FLAG_IPCIDRROUTEMETRIC3) {        save_flags &= ~FLAG_IPCIDRROUTEMETRIC3; /* clear ipCidrRouteMetric3 */        /*         * TODO:482:o: |-> commit column ipCidrRouteMetric3.         */        rc = -1;        if (-1 == rc) {            snmp_log(LOG_ERR,                     "ipCidrRouteTable column ipCidrRouteMetric3 commit failed\n");        } else {            /*             * set flag, in case we need to undo ipCidrRouteMetric3             */            rowreq_ctx->column_set_flags |= FLAG_IPCIDRROUTEMETRIC3;        }    }    if (save_flags & FLAG_IPCIDRROUTEMETRIC4) {        save_flags &= ~FLAG_IPCIDRROUTEMETRIC4; /* clear ipCidrRouteMetric4 */        /*         * TODO:482:o: |-> commit column ipCidrRouteMetric4.         */        rc = -1;        if (-1 == rc) {            snmp_log(LOG_ERR,                     "ipCidrRouteTable column ipCidrRouteMetric4 commit failed\n");        } else {            /*             * set flag, in case we need to undo ipCidrRouteMetric4             */            rowreq_ctx->column_set_flags |= FLAG_IPCIDRROUTEMETRIC4;        }    }    if (save_flags & FLAG_IPCIDRROUTEMETRIC5) {        save_flags &= ~FLAG_IPCIDRROUTEMETRIC5; /* clear ipCidrRouteMetric5 */        /*         * TODO:482:o: |-> commit column ipCidrRouteMetric5.         */        rc = -1;        if (-1 == rc) {            snmp_log(LOG_ERR,                     "ipCidrRouteTable column ipCidrRouteMetric5 commit failed\n");        } else {            /*             * set flag, in case we need to undo ipCidrRouteMetric5             */            rowreq_ctx->column_set_flags |= FLAG_IPCIDRROUTEMETRIC5;        }    }    if (save_flags & FLAG_IPCIDRROUTESTATUS) {        save_flags &= ~FLAG_IPCIDRROUTESTATUS;  /* clear ipCidrRouteStatus */        /*         * TODO:482:o: |-> commit column ipCidrRouteStatus.         */        rc = -1;        if (-1 == rc) {            snmp_log(LOG_ERR,                     "ipCidrRouteTable column ipCidrRouteStatus commit failed\n");        } else {            /*             * set flag, in case we need to undo ipCidrRouteStatus             */            rowreq_ctx->column_set_flags |= FLAG_IPCIDRROUTESTATUS;        }    }    if (save_flags) {        snmp_log(LOG_ERR, "unhandled columns (0x%x) in commit\n",                 save_flags);        return MFD_ERROR;    }    return rc;}                               /* ipCidrRouteTable_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 FLAG_* bits can be found in * ipCidrRouteTable.h. * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags. * * @param ipCidrRouteTable_rowreq_ctx *        Pointer to the users context. * * @retval MFD_SUCCESS : success * @retval MFD_ERROR   : error */intipCidrRouteTable_undo_commit(ipCidrRouteTable_rowreq_ctx * rowreq_ctx){    int             rc = MFD_SUCCESS;    DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTable_undo_commit",                "called\n"));    /** we should have a non-NULL pointer */    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:485:M: |-> Undo ipCidrRouteTable 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 & FLAG_) {}     */    return rc;}                               /* ipCidrRouteTable_undo_commit *//* * TODO:420:r: Implement ipCidrRouteTable index validation. *//*--------------------------------------------------------------------- * IP-FORWARD-MIB::ipCidrRouteEntry.ipCidrRouteDest * ipCidrRouteDest is subid 1 of ipCidrRouteEntry. * Its status is Deprecated, and its access level is ReadOnly. * OID: .1.3.6.1.2.1.4.24.4.1.1 * Description:The destination IP address of this route.                 This object may not take a Multicast (Class D) address                 value.                 Any assignment (implicit or otherwise) of an instance                  of this object to a value x must be rejected if the                  bitwise logical-AND of x with the value of the                  corresponding instance of the ipCidrRouteMask object is                  not equal to x. * * Attributes: *   accessible 1     isscalar 0     enums  0      hasdefval 0 *   readable   1     iscolumn 1     ranges 0      hashint   0 *   settable   0 * * * Its syntax is IPADDR (based on perltype IPADDR) * The net-snmp type is ASN_IPADDRESS. The C type decl is u_long (u_long) *//** * check validity of ipCidrRouteDest index portion * * @retval MFD_SUCCESS   : the incoming value is legal

⌨️ 快捷键说明

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