/**
 * @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 */
Ejemplo n.º 2
0
/** initializes the baby_steps helper which then registers a baby_steps
 *  handler as a run-time injectable handler for configuration file
 *  use.
 */
void
netsnmp_baby_steps_handler_init(void)
{
    netsnmp_register_handler_by_name("baby_steps",
                                     netsnmp_baby_steps_handler_get(BABY_STEP_ALL));
}
/**
 * @internal
 * Initialize the table dot11ConfTotalTrapGroupTable 
 *    (Define its contents and how it's structured)
 */
void
_dot11ConfTotalTrapGroupTable_initialize_interface(dot11ConfTotalTrapGroupTable_registration_ptr reg_ptr,  u_long flags)
{
    netsnmp_baby_steps_access_methods *access_multiplexer =
        &dot11ConfTotalTrapGroupTable_if_ctx.access_multiplexer;
    netsnmp_table_registration_info *tbl_info = &dot11ConfTotalTrapGroupTable_if_ctx.tbl_info;
    netsnmp_handler_registration *reginfo;
    netsnmp_mib_handler *handler;
    int    mfd_modes = 0;

    DEBUGMSGTL(("internal:dot11ConfTotalTrapGroupTable:_dot11ConfTotalTrapGroupTable_initialize_interface","called\n"));


    /*************************************************
     *
     * save interface context for dot11ConfTotalTrapGroupTable
     */
    /*
     * Setting up the table's definition
     */
    netsnmp_table_helper_add_indexes(tbl_info,
                                  ASN_INTEGER, /** index: NewTrapIndex */
                             0);

    /*  Define the minimum and maximum accessible columns.  This
        optimizes retrival. */
    tbl_info->min_column = DOT11CONFTOTALTRAPGROUPTABLE_MIN_COL;
    tbl_info->max_column = DOT11CONFTOTALTRAPGROUPTABLE_MAX_COL;

    /*
     * save users context
     */
    dot11ConfTotalTrapGroupTable_if_ctx.user_ctx = reg_ptr;

    /*
     * call data access initialization code
     */
    dot11ConfTotalTrapGroupTable_init_data(reg_ptr);

    /*
     * set up the container
     */
    _dot11ConfTotalTrapGroupTable_container_init(&dot11ConfTotalTrapGroupTable_if_ctx);
    if (NULL == dot11ConfTotalTrapGroupTable_if_ctx.container) {
        snmp_log(LOG_ERR,"could not initialize container for dot11ConfTotalTrapGroupTable\n");
        return;
    }
    
    /*
     * access_multiplexer: REQUIRED wrapper for get request handling
     */
    access_multiplexer->object_lookup = _mfd_dot11ConfTotalTrapGroupTable_object_lookup;
    access_multiplexer->get_values = _mfd_dot11ConfTotalTrapGroupTable_get_values;

    /*
     * no wrappers yet
     */
    access_multiplexer->pre_request = _mfd_dot11ConfTotalTrapGroupTable_pre_request;
    access_multiplexer->post_request = _mfd_dot11ConfTotalTrapGroupTable_post_request;


    /*
     * REQUIRED wrappers for set request handling
     */
    access_multiplexer->object_syntax_checks = _mfd_dot11ConfTotalTrapGroupTable_check_objects;
    access_multiplexer->undo_setup = _mfd_dot11ConfTotalTrapGroupTable_undo_setup;
    access_multiplexer->undo_cleanup = _mfd_dot11ConfTotalTrapGroupTable_undo_cleanup;
    access_multiplexer->set_values = _mfd_dot11ConfTotalTrapGroupTable_set_values;
    access_multiplexer->undo_sets = _mfd_dot11ConfTotalTrapGroupTable_undo_values;

    /*
     * no wrappers yet
     */
    access_multiplexer->commit = _mfd_dot11ConfTotalTrapGroupTable_commit;
    access_multiplexer->undo_commit = _mfd_dot11ConfTotalTrapGroupTable_undo_commit;
    
    /*
     * REQUIRED for tables with dependencies
     */
    access_multiplexer->consistency_checks = _mfd_dot11ConfTotalTrapGroupTable_check_dependencies;

    /*************************************************
     *
     * Create a registration, save our reg data, register table.
     */
    DEBUGMSGTL(("dot11ConfTotalTrapGroupTable:init_dot11ConfTotalTrapGroupTable",
                "Registering dot11ConfTotalTrapGroupTable as a mibs-for-dummies table.\n"));		 
    handler = netsnmp_baby_steps_access_multiplexer_get(access_multiplexer);
    reginfo = netsnmp_handler_registration_create("dot11ConfTotalTrapGroupTable", handler,
                                                  dot11ConfTotalTrapGroupTable_oid,
                                                  dot11ConfTotalTrapGroupTable_oid_size,
                                                  HANDLER_CAN_BABY_STEP |
                                                  HANDLER_CAN_RWRITE
                                                  );
    if(NULL == reginfo) {
        snmp_log(LOG_ERR,"error registering table dot11ConfTotalTrapGroupTable\n");
        return;
    }
    reginfo->my_reg_void = &dot11ConfTotalTrapGroupTable_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,
                                            dot11ConfTotalTrapGroupTable_if_ctx.container,
                                            TABLE_CONTAINER_KEY_NETSNMP_INDEX);
    netsnmp_inject_handler( reginfo, handler );

    /*************************************************
     *
     * inject cache helper
     */
    if(NULL != dot11ConfTotalTrapGroupTable_if_ctx.cache) {
        handler = netsnmp_cache_handler_get(dot11ConfTotalTrapGroupTable_if_ctx.cache);
        netsnmp_inject_handler( reginfo, handler );
    }

    /*
     * register table
     */
    netsnmp_register_table(reginfo, tbl_info);
} /* _dot11ConfTotalTrapGroupTable_initialize_interface */
/**
 * @internal
 * Initialize the table ipDefaultRouterTable 
 *    (Define its contents and how it's structured)
 */
void
_ipDefaultRouterTable_initialize_interface
    (ipDefaultRouterTable_registration * reg_ptr, u_long flags)
{
    netsnmp_baby_steps_access_methods *access_multiplexer =
        &ipDefaultRouterTable_if_ctx.access_multiplexer;
    netsnmp_table_registration_info *tbl_info =
        &ipDefaultRouterTable_if_ctx.tbl_info;
    netsnmp_handler_registration *reginfo;
    netsnmp_mib_handler *handler;
    int             mfd_modes = 0;

    DEBUGMSGTL(("internal:ipDefaultRouterTable:_ipDefaultRouterTable_initialize_interface", "called\n"));


    /*************************************************
     *
     * save interface context for ipDefaultRouterTable
     */
    /*
     * Setting up the table's definition
     */
    netsnmp_table_helper_add_indexes(tbl_info, ASN_INTEGER,
                                               /** index: ipDefaultRouterAddressType */
                                     ASN_OCTET_STR,
                                                 /** index: ipDefaultRouterAddress */
                                     ASN_INTEGER,
                                               /** index: ipDefaultRouterIfIndex */
                                     0);

    /*
     * Define the minimum and maximum accessible columns.  This
     * optimizes retrieval. 
     */
    tbl_info->min_column = IPDEFAULTROUTERTABLE_MIN_COL;
    tbl_info->max_column = IPDEFAULTROUTERTABLE_MAX_COL;

    /*
     * save users context
     */
    ipDefaultRouterTable_if_ctx.user_ctx = reg_ptr;

    /*
     * call data access initialization code
     */
    ipDefaultRouterTable_init_data(reg_ptr);

    /*
     * set up the container
     */
    _ipDefaultRouterTable_container_init(&ipDefaultRouterTable_if_ctx);
    if (NULL == ipDefaultRouterTable_if_ctx.container) {
        snmp_log(LOG_ERR,
                 "could not initialize container for ipDefaultRouterTable\n");
        return;
    }

    /*
     * access_multiplexer: REQUIRED wrapper for get request handling
     */
    access_multiplexer->object_lookup =
        _mfd_ipDefaultRouterTable_object_lookup;
    access_multiplexer->get_values = _mfd_ipDefaultRouterTable_get_values;

    /*
     * no wrappers yet
     */
    access_multiplexer->pre_request =
        _mfd_ipDefaultRouterTable_pre_request;
    access_multiplexer->post_request =
        _mfd_ipDefaultRouterTable_post_request;


    /*************************************************
     *
     * Create a registration, save our reg data, register table.
     */
    DEBUGMSGTL(("ipDefaultRouterTable:init_ipDefaultRouterTable",
                "Registering ipDefaultRouterTable as a mibs-for-dummies table.\n"));
    handler =
        netsnmp_baby_steps_access_multiplexer_get(access_multiplexer);
    reginfo =
        netsnmp_handler_registration_create("ipDefaultRouterTable",
                                            handler,
                                            ipDefaultRouterTable_oid,
                                            ipDefaultRouterTable_oid_size,
                                            HANDLER_CAN_BABY_STEP |
                                            HANDLER_CAN_RONLY);
    if (NULL == reginfo) {
        snmp_log(LOG_ERR,
                 "error registering table ipDefaultRouterTable\n");
        return;
    }
    reginfo->my_reg_void = &ipDefaultRouterTable_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->pre_request)
        mfd_modes |= BABY_STEP_PRE_REQUEST;
    if (access_multiplexer->post_request)
        mfd_modes |= BABY_STEP_POST_REQUEST;

#ifndef NETSNMP_DISABLE_SET_SUPPORT
    /* XXX - are these actually necessary? */
    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->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;
#endif

    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,
                                            ipDefaultRouterTable_if_ctx.
                                            container,
                                            TABLE_CONTAINER_KEY_NETSNMP_INDEX);
    netsnmp_inject_handler(reginfo, handler);

    /*************************************************
     *
     * inject cache helper
     */
    if (NULL != ipDefaultRouterTable_if_ctx.cache) {
        handler =
            netsnmp_cache_handler_get(ipDefaultRouterTable_if_ctx.cache);
        netsnmp_inject_handler(reginfo, handler);
    }

    /*
     * register table
     */
    netsnmp_register_table(reginfo, tbl_info);

}                               /* _ipDefaultRouterTable_initialize_interface */