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

📄 ipv4interfacetable_interface.c

📁 开发snmp的开发包有两个开放的SNMP开发库
💻 C
📖 第 1 页 / 共 3 页
字号:
/* * Note: this file originally auto-generated by mib2c using *       version : 1.67 $ of : mfd-interface.m2c,v $  * * $Id: ipv4InterfaceTable_interface.c 14142 2006-01-15 19:55:17Z rstory $ *//* * ********************************************************************* * ********************************************************************* * ********************************************************************* * ***                                                               *** * ***  NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE  *** * ***                                                               *** * ***                                                               *** * ***       THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE.      *** * ***                                                               *** * ***                                                               *** * ***       THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND      *** * ***                                                               *** * ***                                                               *** * ***    IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES.   *** * ***                                                               *** * ***                                                               *** * ********************************************************************* * ********************************************************************* * ********************************************************************* *//* * standard Net-SNMP includes  */#include <net-snmp/net-snmp-config.h>#include <net-snmp/net-snmp-includes.h>#include <net-snmp/agent/net-snmp-agent-includes.h>/* * include our parent header  */#include "ipv4InterfaceTable.h"#include <net-snmp/agent/table_container.h>#include <net-snmp/library/container.h>#include "ipv4InterfaceTable_interface.h"#include <ctype.h>/********************************************************************** ********************************************************************** *** *** 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 */typedef struct ipv4InterfaceTable_interface_ctx_s {    netsnmp_container *container;    ipv4InterfaceTable_registration *user_ctx;    netsnmp_table_registration_info tbl_info;    netsnmp_baby_steps_access_methods access_multiplexer;    u_long          last_changed;} ipv4InterfaceTable_interface_ctx;static ipv4InterfaceTable_interface_ctx ipv4InterfaceTable_if_ctx;static void                _ipv4InterfaceTable_container_init(ipv4InterfaceTable_interface_ctx *                                                   if_ctx);static void                _ipv4InterfaceTable_container_shutdown(ipv4InterfaceTable_interface_ctx *                                                       if_ctx);netsnmp_container *ipv4InterfaceTable_container_get(void){    return ipv4InterfaceTable_if_ctx.container;}ipv4InterfaceTable_registration *ipv4InterfaceTable_registration_get(void){    return ipv4InterfaceTable_if_ctx.user_ctx;}ipv4InterfaceTable_registration *ipv4InterfaceTable_registration_set(ipv4InterfaceTable_registration *                                    newreg){    ipv4InterfaceTable_registration *old =        ipv4InterfaceTable_if_ctx.user_ctx;    ipv4InterfaceTable_if_ctx.user_ctx = newreg;    return old;}intipv4InterfaceTable_container_size(void){    return CONTAINER_SIZE(ipv4InterfaceTable_if_ctx.container);}u_intipv4InterfaceTable_dirty_get(void){    return ifTable_dirty_get();}voidipv4InterfaceTable_dirty_set(u_int status){    ifTable_dirty_set(status);}/* * ipv4InterfaceTableLastChanged, which is  the last time that a row in * the table was changed or the last time a row was added/deleted from the * table. */voidipv4InterfaceTable_lastChange_set(u_long table_changed){    DEBUGMSGTL(("ipv4InterfaceTable:lastChanged_set",                "called. was %ld, now %ld\n",                ipv4InterfaceTable_if_ctx.last_changed, table_changed));    ipv4InterfaceTable_if_ctx.last_changed = table_changed;}/* * mfd multiplexer modes */static Netsnmp_Node_Handler _mfd_ipv4InterfaceTable_pre_request;static Netsnmp_Node_Handler _mfd_ipv4InterfaceTable_post_request;static Netsnmp_Node_Handler _mfd_ipv4InterfaceTable_object_lookup;static Netsnmp_Node_Handler _mfd_ipv4InterfaceTable_get_values;static Netsnmp_Node_Handler _mfd_ipv4InterfaceTable_check_objects;static Netsnmp_Node_Handler _mfd_ipv4InterfaceTable_undo_setup;static Netsnmp_Node_Handler _mfd_ipv4InterfaceTable_set_values;static Netsnmp_Node_Handler _mfd_ipv4InterfaceTable_undo_cleanup;static Netsnmp_Node_Handler _mfd_ipv4InterfaceTable_undo_values;static Netsnmp_Node_Handler _mfd_ipv4InterfaceTable_commit;static Netsnmp_Node_Handler _mfd_ipv4InterfaceTable_undo_commit;static Netsnmp_Node_Handler _mfd_ipv4InterfaceTable_irreversible_commit;NETSNMP_STATIC_INLINE int                _ipv4InterfaceTable_undo_column(ipv4InterfaceTable_rowreq_ctx * rowreq_ctx,                                                netsnmp_variable_list *                                                var, int column);ipv4InterfaceTable_data *ipv4InterfaceTable_allocate_data(void);/** * @internal * Initialize the table ipv4InterfaceTable  *    (Define its contents and how it's structured) */void_ipv4InterfaceTable_initialize_interface(ipv4InterfaceTable_registration *                                         reg_ptr, u_long flags){    netsnmp_baby_steps_access_methods *access_multiplexer =        &ipv4InterfaceTable_if_ctx.access_multiplexer;    netsnmp_table_registration_info *tbl_info =        &ipv4InterfaceTable_if_ctx.tbl_info;    netsnmp_handler_registration *reginfo;    netsnmp_mib_handler *handler;    int             mfd_modes = 0;    DEBUGMSGTL(("internal:ipv4InterfaceTable:_ipv4InterfaceTable_initialize_interface", "called\n"));    /*************************************************     *     * save interface context for ipv4InterfaceTable     */    /*     * Setting up the table's definition     */    netsnmp_table_helper_add_indexes(tbl_info, ASN_INTEGER,                                               /** index: ipv4InterfaceIfIndex */                                     0);    /*     * Define the minimum and maximum accessible columns.  This     * optimizes retrival.      */    tbl_info->min_column = IPV4INTERFACETABLE_MIN_COL;    tbl_info->max_column = IPV4INTERFACETABLE_MAX_COL;    /*     * save users context     */    ipv4InterfaceTable_if_ctx.user_ctx = reg_ptr;    /*     * call data access initialization code     */    ipv4InterfaceTable_init_data(reg_ptr);    /*     * set up the container     */    _ipv4InterfaceTable_container_init(&ipv4InterfaceTable_if_ctx);    if (NULL == ipv4InterfaceTable_if_ctx.container) {        snmp_log(LOG_ERR,                 "could not initialize container for ipv4InterfaceTable\n");        return;    }    /*     * access_multiplexer: REQUIRED wrapper for get request handling     */    access_multiplexer->object_lookup =        _mfd_ipv4InterfaceTable_object_lookup;    access_multiplexer->get_values = _mfd_ipv4InterfaceTable_get_values;    /*     * no wrappers yet     */    access_multiplexer->pre_request = _mfd_ipv4InterfaceTable_pre_request;    access_multiplexer->post_request =        _mfd_ipv4InterfaceTable_post_request;    /*     * REQUIRED wrappers for set request handling     */    access_multiplexer->object_syntax_checks =        _mfd_ipv4InterfaceTable_check_objects;    access_multiplexer->undo_setup = _mfd_ipv4InterfaceTable_undo_setup;    access_multiplexer->undo_cleanup =        _mfd_ipv4InterfaceTable_undo_cleanup;    access_multiplexer->set_values = _mfd_ipv4InterfaceTable_set_values;    access_multiplexer->undo_sets = _mfd_ipv4InterfaceTable_undo_values;    /*     * no wrappers yet     */    access_multiplexer->commit = _mfd_ipv4InterfaceTable_commit;    access_multiplexer->undo_commit = _mfd_ipv4InterfaceTable_undo_commit;    access_multiplexer->irreversible_commit =        _mfd_ipv4InterfaceTable_irreversible_commit;    /*************************************************     *     * Create a registration, save our reg data, register table.     */    DEBUGMSGTL(("ipv4InterfaceTable:init_ipv4InterfaceTable",                "Registering ipv4InterfaceTable as a mibs-for-dummies table.\n"));    handler =        netsnmp_baby_steps_access_multiplexer_get(access_multiplexer);    reginfo =        netsnmp_handler_registration_create("ipv4InterfaceTable", handler,                                            ipv4InterfaceTable_oid,                                            ipv4InterfaceTable_oid_size,                                            HANDLER_CAN_BABY_STEP |                                            HANDLER_CAN_RWRITE);    if (NULL == reginfo) {        snmp_log(LOG_ERR, "error registering table ipv4InterfaceTable\n");        return;    }    reginfo->my_reg_void = &ipv4InterfaceTable_if_ctx;    /*************************************************     *     * set up baby steps handler, create it and inject it     */    if (access_multiplexer->object_lookup)        mfd_modes |= BABY_STEP_OBJECT_LOOKUP;    if (access_multiplexer->set_values)        mfd_modes |= BABY_STEP_SET_VALUES;    if (access_multiplexer->irreversible_commit)        mfd_modes |= BABY_STEP_IRREVERSIBLE_COMMIT;    if (access_multiplexer->object_syntax_checks)        mfd_modes |= BABY_STEP_CHECK_OBJECT;    if (access_multiplexer->pre_request)        mfd_modes |= BABY_STEP_PRE_REQUEST;    if (access_multiplexer->post_request)        mfd_modes |= BABY_STEP_POST_REQUEST;    if (access_multiplexer->undo_setup)        mfd_modes |= BABY_STEP_UNDO_SETUP;    if (access_multiplexer->undo_cleanup)        mfd_modes |= BABY_STEP_UNDO_CLEANUP;    if (access_multiplexer->undo_sets)        mfd_modes |= BABY_STEP_UNDO_SETS;    if (access_multiplexer->row_creation)        mfd_modes |= BABY_STEP_ROW_CREATE;    if (access_multiplexer->consistency_checks)        mfd_modes |= BABY_STEP_CHECK_CONSISTENCY;    if (access_multiplexer->commit)        mfd_modes |= BABY_STEP_COMMIT;    if (access_multiplexer->undo_commit)        mfd_modes |= BABY_STEP_UNDO_COMMIT;    handler = netsnmp_baby_steps_handler_get(mfd_modes);    netsnmp_inject_handler(reginfo, handler);    /*************************************************     *     * inject row_merge helper with prefix rootoid_len + 2 (entry.col)     */    handler = netsnmp_get_row_merge_handler(reginfo->rootoid_len + 2);    netsnmp_inject_handler(reginfo, handler);    /*************************************************     *     * inject container_table helper     */    handler =        netsnmp_container_table_handler_get(tbl_info,                                            ipv4InterfaceTable_if_ctx.                                            container,                                            TABLE_CONTAINER_KEY_NETSNMP_INDEX);    netsnmp_inject_handler(reginfo, handler);    /*     * register table     */    netsnmp_register_table(reginfo, tbl_info);    /*     * register LastChanged     */    {        oid             lc_oid[] = { IPV4INTERFACETABLELASTCHANGE_OID };        netsnmp_register_watched_scalar(netsnmp_create_handler_registration                                        ("ipv4TableLastChanged", NULL,                                         lc_oid, OID_LENGTH(lc_oid),                                         HANDLER_CAN_RONLY),                                        netsnmp_create_watcher_info((void                                                                     *)                                                                    &ipv4InterfaceTable_if_ctx.                                                                    last_changed,                                                                    sizeof                                                                    (u_long),                                                                    ASN_TIMETICKS,                                                                    WATCHER_FIXED_SIZE));    }}                               /* _ipv4InterfaceTable_initialize_interface *//** * @internal * Shutdown the table ipv4InterfaceTable */void_ipv4InterfaceTable_shutdown_interface(ipv4InterfaceTable_registration *                                       reg_ptr){    /*     * shutdown the container     */    _ipv4InterfaceTable_container_shutdown(&ipv4InterfaceTable_if_ctx);}voidipv4InterfaceTable_valid_columns_set(netsnmp_column_info *vc){    ipv4InterfaceTable_if_ctx.tbl_info.valid_columns = vc;}                               /* ipv4InterfaceTable_valid_columns_set *//* * ipv4InterfaceTable_allocate_data * * Purpose: create new ipv4InterfaceTable_data. */ipv4InterfaceTable_data *ipv4InterfaceTable_allocate_data(void){    ipv4InterfaceTable_data *rtn =        SNMP_MALLOC_TYPEDEF(ipv4InterfaceTable_data);    DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceTable_allocate_data", "called\n"));    if (NULL == rtn) {        snmp_log(LOG_ERR, "unable to malloc memory for new "                 "ipv4InterfaceTable_data.\n");    }    return rtn;}                               /* ipv4InterfaceTable_allocate_data *//** * @internal * wrapper */static int_mfd_ipv4InterfaceTable_pre_request(netsnmp_mib_handler *handler,                                    netsnmp_handler_registration *reginfo,                                    netsnmp_agent_request_info                                    *agtreq_info,                                    netsnmp_request_info *requests){    int             rc;    DEBUGMSGTL(("internal:ipv4InterfaceTable:_mfd_ipv4InterfaceTable_pre_request", "called\n"));    if (1 != netsnmp_row_merge_status_first(reginfo, agtreq_info)) {        DEBUGMSGTL(("internal:ipv4InterfaceTable",                    "skipping additional pre_request\n"));        return SNMP_ERR_NOERROR;    }    rc = ipv4InterfaceTable_pre_request(ipv4InterfaceTable_if_ctx.                                        user_ctx);    if (MFD_SUCCESS != rc) {        /*         * nothing we can do about it but log it         */        DEBUGMSGTL(("ipv4InterfaceTable", "error %d from "                    "ipv4InterfaceTable_pre_request\n", rc));        netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));    }    return SNMP_ERR_NOERROR;}                               /* _mfd_ipv4InterfaceTable_pre_request *//** * @internal * wrapper */static int_mfd_ipv4InterfaceTable_post_request(netsnmp_mib_handler *handler,                                     netsnmp_handler_registration *reginfo,                                     netsnmp_agent_request_info

⌨️ 快捷键说明

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