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

📄 inetnettomediatable.c

📁 snmp的源代码,已经在我的ubuntu下编译通过
💻 C
📖 第 1 页 / 共 5 页
字号:
 *@note * this function will only be called if a new value is set for this column. * * If there is any setup specific to a particular column (e.g. allocating * memory for a string), you should do that setup in this function, so it * won't be done unless it is necessary. */intinetNetToMediaType_undo_setup(inetNetToMediaTable_rowreq_ctx * rowreq_ctx){    DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaType_undo_setup", "called\n"));    /** should never get a NULL pointer */    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:455:o: |-> Setup inetNetToMediaType undo.     */    /*     * copy inetNetToMediaType data     * set rowreq_ctx->undo->inetNetToMediaType from rowreq_ctx->data->inetNetToMediaType     */    return MFD_SUCCESS;}                               /* inetNetToMediaType_undo_setup *//** * Set the new value. * * @param rowreq_ctx *        Pointer to the users context. You should know how to *        manipulate the value from this object. * @param inetNetToMediaType_val *        A long containing the new value. */intinetNetToMediaType_set(inetNetToMediaTable_rowreq_ctx * rowreq_ctx,                       u_long inetNetToMediaType_val){    DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaType_set",                "called\n"));    /** should never get a NULL pointer */    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:461:M: |-> Set inetNetToMediaType value.     * set inetNetToMediaType value in rowreq_ctx->data     */    return MFD_SUCCESS;}                               /* inetNetToMediaType_set *//** * undo the previous set. * * @param rowreq_ctx *        Pointer to the users context. */intinetNetToMediaType_undo(inetNetToMediaTable_rowreq_ctx * rowreq_ctx){    DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaType_undo",                "called\n"));    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:456:o: |-> Clean up inetNetToMediaType undo.     */    /*     * copy inetNetToMediaType data     * set rowreq_ctx->data->inetNetToMediaType from rowreq_ctx->undo->inetNetToMediaType     */    return MFD_SUCCESS;}                               /* inetNetToMediaType_undo *//*--------------------------------------------------------------------- * IP-MIB::inetNetToMediaEntry.inetNetToMediaRowStatus * inetNetToMediaRowStatus is subid 8 of inetNetToMediaEntry. * Its status is Current, and its access level is Create. * OID: .1.3.6.1.2.1.4.35.1.8 * Description:The status of this conceptual row.            The RowStatus TC requires that this DESCRIPTION clause            states under which circumstances other objects in this row            can be modified.  The value of this object has no effect on            whether other objects in this conceptual row can be            modified.            A conceptual row can not be made active until the            inetNetToMediaPhysAddress object has been set.            Note that if the inetNetToMediaType is set to 'invalid' the            managed node may delete the entry independent of the state            of this object. * * Attributes: *   accessible 1     isscalar 0     enums  1      hasdefval 0 *   readable   1     iscolumn 1     ranges 0      hashint   0 *   settable   1 * * Enum range: 3/8. Values:  active(1), notInService(2), notReady(3), createAndGo(4), createAndWait(5), destroy(6) * * Its syntax is RowStatus (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 inetNetToMediaRowStatus_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 * inetNetToMediaTable_check_dependencies() function. * * The following checks have already been done for you: *    The syntax is ASN_INTEGER *    The value is one of  active(1), notInService(2), notReady(3), createAndGo(4), createAndWait(5), destroy(6) * * If there a no other checks you need to do, simply return MFD_SUCCESS. * */intinetNetToMediaRowStatus_check_value(inetNetToMediaTable_rowreq_ctx *                                    rowreq_ctx,                                    u_long inetNetToMediaRowStatus_val){    DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaRowStatus_check_value", "called\n"));    /** should never get a NULL pointer */    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:441:o: |-> Check for valid inetNetToMediaRowStatus value.     */    return MFD_SUCCESS;         /* inetNetToMediaRowStatus value not illegal */}                               /* inetNetToMediaRowStatus_check_value *//** * Save old value information * * @param rowreq_ctx *        Pointer to the table context (inetNetToMediaTable_rowreq_ctx) * * @retval MFD_SUCCESS : success * @retval MFD_ERROR   : error. set will fail. * * This function will be called after the table level undo setup function * inetNetToMediaTable_undo_setup has been called. * *@note * this function will only be called if a new value is set for this column. * * If there is any setup specific to a particular column (e.g. allocating * memory for a string), you should do that setup in this function, so it * won't be done unless it is necessary. */intinetNetToMediaRowStatus_undo_setup(inetNetToMediaTable_rowreq_ctx *                                   rowreq_ctx){    DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaRowStatus_undo_setup", "called\n"));    /** should never get a NULL pointer */    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:455:o: |-> Setup inetNetToMediaRowStatus undo.     */    /*     * copy inetNetToMediaRowStatus data     * set rowreq_ctx->undo->inetNetToMediaRowStatus from rowreq_ctx->data->inetNetToMediaRowStatus     */    rowreq_ctx->inetNetToMediaRowStatus_undo =        rowreq_ctx->inetNetToMediaRowStatus;    return MFD_SUCCESS;}                               /* inetNetToMediaRowStatus_undo_setup *//** * Set the new value. * * @param rowreq_ctx *        Pointer to the users context. You should know how to *        manipulate the value from this object. * @param inetNetToMediaRowStatus_val *        A long containing the new value. */intinetNetToMediaRowStatus_set(inetNetToMediaTable_rowreq_ctx * rowreq_ctx,                            u_long inetNetToMediaRowStatus_val){    DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaRowStatus_set",                "called\n"));    /** should never get a NULL pointer */    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:461:M: |-> Set inetNetToMediaRowStatus value.     * set inetNetToMediaRowStatus value in rowreq_ctx->data     */    return MFD_SUCCESS;}                               /* inetNetToMediaRowStatus_set *//** * undo the previous set. * * @param rowreq_ctx *        Pointer to the users context. */intinetNetToMediaRowStatus_undo(inetNetToMediaTable_rowreq_ctx * rowreq_ctx){    DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaRowStatus_undo",                "called\n"));    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:456:o: |-> Clean up inetNetToMediaRowStatus undo.     */    /*     * copy inetNetToMediaRowStatus data     * set rowreq_ctx->data->inetNetToMediaRowStatus from rowreq_ctx->undo->inetNetToMediaRowStatus     */    rowreq_ctx->inetNetToMediaRowStatus =        rowreq_ctx->inetNetToMediaRowStatus_undo;    return MFD_SUCCESS;}                               /* inetNetToMediaRowStatus_undo *//** * check dependencies * * This is useful for for tables which have dependencies between columns * (or rows, or tables). For example, two columns allocating a percentage * of something add up 100%. * * 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. * * @retval MFD_SUCCESS all the changes to the row are legal * @retval MFD_ERROR   one or more changes are not legal * * (see README-table-inetNetToMediaTable if you don't have dependencies) */intinetNetToMediaTable_check_dependencies(inetNetToMediaTable_rowreq_ctx *                                       rowreq_ctx){    int             rc = MFD_SUCCESS;    DEBUGMSGTL(("internal:inetNetToMediaTable:inetNetToMediaTable_check_dependencies", "called\n"));    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:470:o: Check inetNetToMediaTable row dependencies.     * check that all new value are legal and consistent with each other     */    /*     * check RowStatus dependencies     */    if (rowreq_ctx->column_set_flags & FLAG_INETNETTOMEDIAROWSTATUS) {        /*         * check for valid RowStatus transition (old, new)         * (Note: move transition check to          *  to catch errors earlier)         */        rc = check_rowstatus_transition(rowreq_ctx->                                        inetNetToMediaRowStatus_undo,                                        rowreq_ctx->                                        inetNetToMediaRowStatus);        if (MFD_SUCCESS != rc)            return rc;        /*         * row creation requirements         */        if (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED) {            if (ROWSTATUS_CREATEANDGO ==                rowreq_ctx->inetNetToMediaRowStatus) {                if (rowreq_ctx->column_set_flags !=                    INETNETTOMEDIATABLE_REQUIRED_COLS) {                    DEBUGMSGTL(("inetNetToMediaTable",                                "required columns missing\n"));                    return MFD_CANNOT_CREATE_NOW;                }            }        } /* row creation */        else {            /*             * row change requirements             */            /*             * don't allow a destroy if any other value was changed, since             * that might call data access routines with bad info.             *             * you may or may not require the row be notInService before it             * can be destroyed.             */            if (ROWSTATUS_DESTROY == rowreq_ctx->inetNetToMediaRowStatus) {                if (rowreq_ctx->                    column_set_flags & ~FLAG_INETNETTOMEDIAROWSTATUS) {                    DEBUGMSGTL(("inetNetToMediaTable",                                "destroy must be only varbind for row\n"));                    return MFD_NOT_VALID_NOW;                }            }                   /* row destroy */        }                       /* row change */    } else {        /*         * must have row status to create a row         */        if (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED) {            DEBUGMSGTL(("inetNetToMediaTable",                        "must use RowStatus to create rows\n"));            return MFD_CANNOT_CREATE_NOW;        }    }                           /* row status not set */    if (MFD_SUCCESS != rc)        return rc;    return rc;}                               /* inetNetToMediaTable_check_dependencies *//** @} *//** @{ */

⌨️ 快捷键说明

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