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

📄 ipv4interfacetable.c

📁 开发snmp的开发包有两个开放的SNMP开发库
💻 C
📖 第 1 页 / 共 3 页
字号:
/*--------------------------------------------------------------------- * IP-MIB::ipv4InterfaceEntry.ipv4InterfaceEnableStatus * ipv4InterfaceEnableStatus is subid 3 of ipv4InterfaceEntry. * Its status is Current, and its access level is ReadWrite. * OID: .1.3.6.1.2.1.4.28.1.3 * Description:The indication of whether IPv4 is enabled (up) or disabled            (down) on this interface.  This object does not affect the            state of the interface itself, only its connection to an            IPv4 stack.  The IF-MIB should be used to control the state            of the interface. * * Attributes: *   accessible 1     isscalar 0     enums  1      hasdefval 0 *   readable   1     iscolumn 1     ranges 0      hashint   0 *   settable   1 * * Enum range: 1/8. Values:  up(1), down(2) * * Its syntax is INTEGER (based on perltype INTEGER) * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) *//** * Extract the current value of the ipv4InterfaceEnableStatus data. * * Set a value using the data context for the row. * * @param rowreq_ctx *        Pointer to the row request context. * @param ipv4InterfaceEnableStatus_val_ptr *        Pointer to storage for a long variable * * @retval MFD_SUCCESS         : success * @retval MFD_SKIP            : skip this node (no value for now) * @retval MFD_ERROR           : Any other error */intipv4InterfaceEnableStatus_get(ipv4InterfaceTable_rowreq_ctx * rowreq_ctx,                              u_long * ipv4InterfaceEnableStatus_val_ptr){   /** we should have a non-NULL pointer */    netsnmp_assert(NULL != ipv4InterfaceEnableStatus_val_ptr);    DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceEnableStatus_get",                "called\n"));    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:231:o: |-> Extract the current value of the ipv4InterfaceEnableStatus data.     * copy (* ipv4InterfaceEnableStatus_val_ptr ) from rowreq_ctx->data     */    (*ipv4InterfaceEnableStatus_val_ptr) =        rowreq_ctx->data.ipv4InterfaceEnableStatus;    return MFD_SUCCESS;}                               /* ipv4InterfaceEnableStatus_get *//*--------------------------------------------------------------------- * IP-MIB::ipv4InterfaceEntry.ipv4InterfaceRetransmitTime * ipv4InterfaceRetransmitTime is subid 4 of ipv4InterfaceEntry. * Its status is Current, and its access level is ReadOnly. * OID: .1.3.6.1.2.1.4.28.1.4 * Description:The time between retransmissions of ARP requests to a            neighbor when resolving the address or when probing the            reachability of a neighbor. * * Attributes: *   accessible 1     isscalar 0     enums  0      hasdefval 1 *   readable   1     iscolumn 1     ranges 0      hashint   0 *   settable   0 *   defval: 1000 * * * Its syntax is UNSIGNED32 (based on perltype UNSIGNED32) * The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long) *//** * Extract the current value of the ipv4InterfaceRetransmitTime data. * * Set a value using the data context for the row. * * @param rowreq_ctx *        Pointer to the row request context. * @param ipv4InterfaceRetransmitTime_val_ptr *        Pointer to storage for a u_long variable * * @retval MFD_SUCCESS         : success * @retval MFD_SKIP            : skip this node (no value for now) * @retval MFD_ERROR           : Any other error */intipv4InterfaceRetransmitTime_get(ipv4InterfaceTable_rowreq_ctx * rowreq_ctx,                                u_long *                                ipv4InterfaceRetransmitTime_val_ptr){   /** we should have a non-NULL pointer */    netsnmp_assert(NULL != ipv4InterfaceRetransmitTime_val_ptr);    DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceRetransmitTime_get", "called\n"));    netsnmp_assert(NULL != rowreq_ctx);    if (!        (rowreq_ctx->data.ifentry->         ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_V4_RETRANSMIT))        return MFD_SKIP;    /*     * TODO:231:o: |-> Extract the current value of the ipv4InterfaceRetransmitTime data.     * copy (* ipv4InterfaceRetransmitTime_val_ptr ) from rowreq_ctx->data     */    (*ipv4InterfaceRetransmitTime_val_ptr) =        rowreq_ctx->data.ipv4InterfaceRetransmitTime;    return MFD_SUCCESS;}                               /* ipv4InterfaceRetransmitTime_get *//** @} *//********************************************************************** ********************************************************************** *** *** Table ipv4InterfaceTable *** ********************************************************************** **********************************************************************//* * IP-MIB::ipv4InterfaceTable is subid 28 of ip. * Its status is Current. * OID: .1.3.6.1.2.1.4.28, length: 8 */    /*     * NOTE: if you update this chart, please update the versions in     *       local/mib2c-conf.d/parent-set.m2i     *       agent/mibgroup/helpers/baby_steps.c     * while you're at it.     */    /*     ***********************************************************************     * Baby Steps Flow Chart (2004.06.05)                                  *     *                                                                     *     * +--------------+    +================+    U = unconditional path    *     * |optional state|    ||required state||    S = path for success      *     * +--------------+    +================+    E = path for error        *     ***********************************************************************     *     *                        +--------------+     *                        |     pre      |     *                        |   request    |     *                        +--------------+     *                               | U     *                        +==============+     *       +----------------||  object    ||     *       |              E ||  lookup    ||     *       |                +==============+     *       |                       | S     *       |                +==============+     *       |              E ||   check    ||     *       |<---------------||   values   ||     *       |                +==============+     *       |                       | S     *       |                +==============+     *       |       +<-------||   undo     ||     *       |       |      E ||   setup    ||     *       |       |        +==============+     *       |       |               | S     *       |       |        +==============+     *       |       |        ||    set     ||-------------------------->+     *       |       |        ||   value    || E                         |     *       |       |        +==============+                           |     *       |       |               | S                                 |     *       |       |        +--------------+                           |     *       |       |        |    check     |-------------------------->|     *       |       |        |  consistency | E                         |     *       |       |        +--------------+                           |     *       |       |               | S                                 |     *       |       |        +==============+         +==============+  |     *       |       |        ||   commit   ||-------->||     undo   ||  |     *       |       |        ||            || E       ||    commit  ||  |     *       |       |        +==============+         +==============+  |     *       |       |               | S                     U |<--------+     *       |       |        +--------------+         +==============+     *       |       |        | irreversible |         ||    undo    ||     *       |       |        |    commit    |         ||     set    ||     *       |       |        +--------------+         +==============+     *       |       |               | U                     U |     *       |       +-------------->|<------------------------+     *       |                +==============+     *       |                ||   undo     ||     *       |                ||  cleanup   ||     *       |                +==============+     *       +---------------------->| U     *                        +--------------+     *                        |    post      |     *                        |   request    |     *                        +--------------+     *     *//** * 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 the undo context has been allocated with * ipv4InterfaceTable_allocate_data(), but may need extra * initialization similar to what you may have done in * ipv4InterfaceTable_rowreq_ctx_init(). * 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 (ipv4InterfaceTable_rowreq_ctx) * * @retval MFD_SUCCESS : success * @retval MFD_ERROR   : error. set will fail. */intipv4InterfaceTable_undo_setup(ipv4InterfaceTable_rowreq_ctx * rowreq_ctx){    int             rc = MFD_SUCCESS;    DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceTable_undo_setup",                "called\n"));    /** we should have a non-NULL pointer */    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:451:M: |-> Setup ipv4InterfaceTable undo.     * set up ipv4InterfaceTable undo information, in preparation for a set.     * Undo storage is in (* ipv4InterfaceRetransmitTime_val_ptr )*     */    return rc;}                               /* ipv4InterfaceTable_undo_setup *//** * Undo a set request. * * This function will be called before the individual node undo * functions are called. If you need to do any undo that is not * related to a specific column, you can do it here. * * Note that an individual node's undo function will only be called * if that node is being set to a new value. * * If there is anything  specific to a particular column (e.g. releasing * memory for a string), you should do that setup in the node's undo * function, so it won't be done unless it is necessary. * * @param rowreq_ctx *        Pointer to the table context (ipv4InterfaceTable_rowreq_ctx) * * @retval MFD_SUCCESS : success * @retval MFD_ERROR   : error. set will fail. */intipv4InterfaceTable_undo(ipv4InterfaceTable_rowreq_ctx * rowreq_ctx){    int             rc = MFD_SUCCESS;    DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceTable_undo",                "called\n"));    /** we should have a non-NULL pointer */    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:451:M: |-> ipv4InterfaceTable undo.     * ipv4InterfaceTable undo information, in response to a failed set.     * Undo storage is in (* ipv4InterfaceRetransmitTime_val_ptr )*     */    return rc;}                               /* ipv4InterfaceTable_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 (ipv4InterfaceTable_rowreq_ctx) * * @retval MFD_SUCCESS : success * @retval MFD_ERROR   : error */intipv4InterfaceTable_undo_cleanup(ipv4InterfaceTable_rowreq_ctx * rowreq_ctx){    int             rc = MFD_SUCCESS;    DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceTable_undo_cleanup", "called\n"));    /** we should have a non-NULL pointer */    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:452:M: |-> Cleanup ipv4InterfaceTable undo.     * Undo storage is in (* ipv4InterfaceRetransmitTime_val_ptr )*     */

⌨️ 快捷键说明

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