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

📄 inetnettomediatable.c

📁 snmp的源代码,已经在我的ubuntu下编译通过
💻 C
📖 第 1 页 / 共 5 页
字号:
 * 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,  *  * * * @param inetNetToMediaTable_reg *        Pointer to the user registration data * @param inetNetToMediaTable_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 */intinetNetToMediaTable_validate_index(inetNetToMediaTable_registration_ptr                                   inetNetToMediaTable_reg,                                   inetNetToMediaTable_rowreq_ctx *                                   rowreq_ctx){    int             rc = MFD_SUCCESS;    DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_validate_index", "called\n"));    /** we should have a non-NULL pointer */    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:430:M: |-> Validate potential inetNetToMediaTable index.     */    if (1) {        snmp_log(LOG_WARNING, "invalid index for a new row in the "                 "inetNetToMediaTable table.\n");        /*         * determine failure type.         *         * If the index could not ever be created, return MFD_NOT_EVER         * 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;}                               /* inetNetToMediaTable_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 (inetNetToMediaTable_rowreq_ctx) * * @retval MFD_SUCCESS : success * @retval MFD_ERROR   : error. set will fail. */intinetNetToMediaTable_undo_setup(inetNetToMediaTable_rowreq_ctx * rowreq_ctx){    int             rc = MFD_SUCCESS;    DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_undo_setup", "called\n"));    /** we should have a non-NULL pointer */    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:451:M: |-> Setup inetNetToMediaTable undo.     * set up inetNetToMediaTable undo information, in preparation for a set.     */    return rc;}                               /* inetNetToMediaTable_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 (inetNetToMediaTable_rowreq_ctx) * * @retval MFD_SUCCESS : success * @retval MFD_ERROR   : error */intinetNetToMediaTable_undo_cleanup(inetNetToMediaTable_rowreq_ctx *                                 rowreq_ctx){    int             rc = MFD_SUCCESS;    DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_undo_cleanup", "called\n"));    /** we should have a non-NULL pointer */    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:452:M: |-> Cleanup inetNetToMediaTable undo.     */    return rc;}                               /* inetNetToMediaTable_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 * inetNetToMediaTable.h. * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags. * * @param inetNetToMediaTable_rowreq_ctx *        Pointer to the users context. * * @retval MFD_SUCCESS : success * @retval MFD_ERROR   : error */intinetNetToMediaTable_commit(inetNetToMediaTable_rowreq_ctx * rowreq_ctx){    int             rc = MFD_SUCCESS;    int             save_flags;    DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_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 inetNetToMediaTable 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 1#warning nettomedia commit#else    if (save_flags & FLAG_INETNETTOMEDIAPHYSADDRESS) {        save_flags &= ~FLAG_INETNETTOMEDIAPHYSADDRESS;  /* clear inetNetToMediaPhysAddress */        /*         * TODO:482:o: |-> commit column inetNetToMediaPhysAddress.         */        rc = -1;        if (-1 == rc) {            snmp_log(LOG_ERR,                     "inetNetToMediaTable column inetNetToMediaPhysAddress commit failed\n");        } else {            /*             * set flag, in case we need to undo inetNetToMediaPhysAddress             */            rowreq_ctx->column_set_flags |= FLAG_INETNETTOMEDIAPHYSADDRESS;        }    }    if (save_flags & FLAG_INETNETTOMEDIATYPE) {        save_flags &= ~FLAG_INETNETTOMEDIATYPE; /* clear inetNetToMediaType */        /*         * TODO:482:o: |-> commit column inetNetToMediaType.         */        rc = -1;        if (-1 == rc) {            snmp_log(LOG_ERR,                     "inetNetToMediaTable column inetNetToMediaType commit failed\n");        } else {            /*             * set flag, in case we need to undo inetNetToMediaType             */            rowreq_ctx->column_set_flags |= FLAG_INETNETTOMEDIATYPE;        }    }    if (save_flags & FLAG_INETNETTOMEDIAROWSTATUS) {        save_flags &= ~FLAG_INETNETTOMEDIAROWSTATUS;    /* clear inetNetToMediaRowStatus */        /*         * TODO:482:o: |-> commit column inetNetToMediaRowStatus.         */        rc = -1;        if (-1 == rc) {            snmp_log(LOG_ERR,                     "inetNetToMediaTable column inetNetToMediaRowStatus commit failed\n");        } else {            /*             * set flag, in case we need to undo inetNetToMediaRowStatus             */            rowreq_ctx->column_set_flags |= FLAG_INETNETTOMEDIAROWSTATUS;        }    }#endif    if (save_flags) {        snmp_log(LOG_ERR, "unhandled columns (0x%x) in commit\n",                 save_flags);        return MFD_ERROR;    }    return rc;}                               /* inetNetToMediaTable_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 * inetNetToMediaTable.h. * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags. * * @param inetNetToMediaTable_rowreq_ctx *        Pointer to the users context. * * @retval MFD_SUCCESS : success * @retval MFD_ERROR   : error */intinetNetToMediaTable_undo_commit(inetNetToMediaTable_rowreq_ctx *                                rowreq_ctx){    int             rc = MFD_SUCCESS;    DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_undo_commit", "called\n"));    /** we should have a non-NULL pointer */    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:485:M: |-> Undo inetNetToMediaTable 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;}                               /* inetNetToMediaTable_undo_commit *//* * TODO:420:r: Implement inetNetToMediaTable index validation. *//*--------------------------------------------------------------------- * IP-MIB::inetNetToMediaEntry.inetNetToMediaIfIndex * inetNetToMediaIfIndex is subid 1 of inetNetToMediaEntry. * Its status is Current, and its access level is NoAccess. * OID: .1.3.6.1.2.1.4.35.1.1 * Description:The index value which uniquely identifies the interface to            which this entry is applicable.  The interface identified by            a particular value of this index is the same interface as            identified by the same value of the IF-MIB's ifIndex. * * Attributes: *   accessible 0     isscalar 0     enums  0      hasdefval 0 *   readable   0     iscolumn 1     ranges 1      hashint   1 *   settable   0 *   hint: d * * Ranges:  1 - 2147483647; * * Its syntax is InterfaceIndex (based on perltype INTEGER32) * The net-snmp type is ASN_INTEGER. The C type decl is long (long) * * * * NOTE: NODE inetNetToMediaIfIndex IS NOT ACCESSIBLE * * *//** * check validity of inetNetToMediaIfIndex index portion * * @retval MFD_SUCCESS   : the incoming value is legal * @retval MFD_BAD_VALUE : 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 *       inetNetToMediaTable_validate_index() function. */intinetNetToMediaIfIndex_check_index(inetNetToMediaTable_rowreq_ctx *                                  rowreq_ctx){    DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaIfIndex_check_index", "called\n"));    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:426:M: |-> Check inetNetToMediaTable index inetNetToMediaIfIndex.     * check that index value in the table context (rowreq_ctx)     * for inetNetToMediaIfIndex is legal.     */    return MFD_SUCCESS;         /* inetNetToMediaIfIndex index ok */}                               /* inetNetToMediaIfIndex_check_index *//*--------------------------------------------------------------------- * IP-MIB::inetNetToMediaEntry.inetNetToMediaNetAddressType * inetNetToMediaNetAddressType is subid 2 of inetNetToMediaEntry. * Its status is Current, and its access level is NoAccess. * OID: .1.3.6.1.2.1.4.35.1.2 * Description:The type of inetNetToMediaNetAddress. * * 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 inetNetToMediaNetAddressType IS NOT ACCESSIBLE * * *//** * check validity of inetNetToMediaNetAddressType index portion * * @retval MFD_SUCCESS   : the incoming value is legal * @retval MFD_BAD_VALUE : 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 *       inetNetToMediaTable_validate_index() function. */intinetNetToMediaNetAddressType_check_index(inetNetToMediaTable_rowreq_ctx *                                         rowreq_ctx){    DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaNetAddressType_check_index", "called\n"));    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:426:M: |-> Check inetNetToMediaTable index inetNetToMediaNetAddressType.     * check that index value in the table context (rowreq_ctx)     * for inetNetToMediaNetAddressType is legal.     */

⌨️ 快捷键说明

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