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

📄 mfd-interface.m2c

📁 开发snmp的开发包有两个开放的SNMP开发库
💻 M2C
📖 第 1 页 / 共 4 页
字号:
#############################################################  -*- c -*-## generic include for XXX. Do not use directly.#### $Id: mfd-interface.m2c 15899 2007-02-27 13:08:24Z rstory $########################################################################@if $m2c_mark_boundary == 1@/** START code generated by $RCSfile$ $Revision: 15899 $ */@end@##################################################################################################################################################@eval $m2c_processing_type = 'h'@@open ${name}_interface.h@@eval $hack = "Id"@/* * Note: this file originally auto-generated by mib2c using *       version $Revision: 15899 $ of $RCSfile$ * * $$hack:$ *//** @ingroup interface: Routines to interface to Net-SNMP * * \warning This code should not be modified, called directly, *          or used to interpret functionality. It is subject to *          change at any time. *  * @{ */@include m2c-internal-warning.m2i@##@eval $m2c_save = "$name"@@eval $name = "${name}_INTERFACE"@@include generic-header-top.m2i@@eval $name = "$m2c_save"@#include "${name}.h"/* ******************************************************************** * Table declarations */@foreach $table table@@    include m2c_setup_table.m2i@/* PUBLIC interface initialization routine */void _${context}_initialize_interface(${context}_registration * user_ctx,                                    u_long flags);void _${context}_shutdown_interface(${context}_registration * user_ctx);${context}_registration *${context}_registration_get( void );${context}_registration *${context}_registration_set( ${context}_registration * newreg );netsnmp_container *${context}_container_get( void );int ${context}_container_size( void );@   if $m2c_table_settable@u_int ${context}_dirty_get( void );void ${context}_dirty_set( u_int status );@   end@@   if $m2c_data_allocate == 1@@      eval $m2c_tmp = "${context}_data *"@@      if $m2c_data_init == 1@@         eval $m2c_tmp = "$m2c_tmp, void *"@@      @end@@   elsif $m2c_data_init == 1@@      eval $m2c_tmp = "void *"@@   else@@      eval $m2c_tmp = "void"@@   end@    ${context}_rowreq_ctx * ${context}_allocate_rowreq_ctx($m2c_tmp);void ${context}_release_rowreq_ctx(${context}_rowreq_ctx *rowreq_ctx);int ${context}_index_to_oid(netsnmp_index *oid_idx,                            ${context}_mib_index *mib_idx);int ${context}_index_from_oid(netsnmp_index *oid_idx,                              ${context}_mib_index *mib_idx);@   if $m2c_table_persistent == 1@@      include mfd-persistence.m2i@@   end@/* * access to certain internals. use with caution! */void ${context}_valid_columns_set(netsnmp_column_info *vc);@end@ # for each@eval $m2c_save = "$name"@@eval $name = "${name}_INTERFACE"@@include generic-header-bottom.m2i@/** @} */@eval $name = "$m2c_save"@##########################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################@open ${name}_interface.c@/* * Note: this file originally auto-generated by mib2c using *       version $Revision: 15899 $ of $RCSfile$  * * $$hack:$ */@include m2c-internal-warning.m2i@@include generic-source-includes.m2i@#include <net-snmp/agent/table_container.h>#include <net-snmp/library/container.h>#include "${name}_interface.h"#include <ctype.h>@eval $m2c_processing_type = 'i'@@foreach $table table@@   include m2c_setup_table.m2i@@   include details-table.m2i@########################################################################typedef struct ${context}_interface_ctx_s {   netsnmp_container              *container;@   if $m2c_data_cache == 1@   netsnmp_cache                  *cache;@   end@   ${context}_registration *      user_ctx;      netsnmp_table_registration_info  tbl_info;   netsnmp_baby_steps_access_methods access_multiplexer;@  if $m2c_table_settable@    u_int                             table_dirty;@  end@} ${context}_interface_ctx;static ${context}_interface_ctx ${context}_if_ctx;static void _${context}_container_init(    ${context}_interface_ctx *if_ctx);static void _${context}_container_shutdown(    ${context}_interface_ctx *if_ctx);netsnmp_container *${context}_container_get( void ){    return ${context}_if_ctx.container;}${context}_registration *${context}_registration_get( void ){    return ${context}_if_ctx.user_ctx;}${context}_registration *${context}_registration_set( ${context}_registration * newreg ){    ${context}_registration * old = ${context}_if_ctx.user_ctx;    ${context}_if_ctx.user_ctx = newreg;    return old;}int${context}_container_size( void ){    return CONTAINER_SIZE(${context}_if_ctx.container);}@  if $m2c_table_settable@u_int${context}_dirty_get( void ){    return ${context}_if_ctx.table_dirty;}void${context}_dirty_set( u_int status ){    DEBUGMSGTL(("${context}:${context}_dirty_set",                "called. was %d, now %d\n",                ${context}_if_ctx.table_dirty, status));    ${context}_if_ctx.table_dirty = status;}@end@/* * mfd multiplexer modes */static Netsnmp_Node_Handler _mfd_${context}_pre_request;static Netsnmp_Node_Handler _mfd_${context}_post_request;static Netsnmp_Node_Handler _mfd_${context}_object_lookup;static Netsnmp_Node_Handler _mfd_${context}_get_values;@   if $m2c_table_settable@static Netsnmp_Node_Handler _mfd_${context}_check_objects;static Netsnmp_Node_Handler _mfd_${context}_undo_setup;static Netsnmp_Node_Handler _mfd_${context}_set_values;static Netsnmp_Node_Handler _mfd_${context}_undo_cleanup;static Netsnmp_Node_Handler _mfd_${context}_undo_values;static Netsnmp_Node_Handler _mfd_${context}_commit;static Netsnmp_Node_Handler _mfd_${context}_undo_commit;static Netsnmp_Node_Handler _mfd_${context}_irreversible_commit;@      if $m2c_table_dependencies == 1@static Netsnmp_Node_Handler _mfd_${context}_check_dependencies;@      end@NETSNMP_STATIC_INLINE int _${context}_undo_column( ${context}_rowreq_ctx *rowreq_ctx,                                                   netsnmp_variable_list *var, int column );@   end@ # writable@if ($m2c_table_persistent == 1) || ($m2c_table_row_creation == 1)@NETSNMP_STATIC_INLINE int _${context}_check_indexes(${context}_rowreq_ctx * rowreq_ctx);@end@@   if ("$m2c_data_context" eq "generated") && (($m2c_undo_embed == 0) || ($m2c_data_allocate == 1))@${context}_data *${context}_allocate_data(void);@   end@/** * @internal * Initialize the table $context  *    (Define its contents and how it's structured) */void_${context}_initialize_interface(${context}_registration * reg_ptr,  u_long flags){    netsnmp_baby_steps_access_methods *access_multiplexer =        &${context}_if_ctx.access_multiplexer;    netsnmp_table_registration_info *tbl_info = &${context}_if_ctx.tbl_info;    netsnmp_handler_registration *reginfo;    netsnmp_mib_handler *handler;    int    mfd_modes = 0;    DEBUGMSGTL(("internal:${context}:_${context}_initialize_interface","called\n"));    /*************************************************     *     * save interface context for ${context}     */    /*     * Setting up the table's definition     */    netsnmp_table_helper_add_indexes(tbl_info,    @foreach $tabledx index@                                  $tabledx.type, /** index: $tabledx */    @end@                             0);    /*  Define the minimum and maximum accessible columns.  This        optimizes retrival. */    tbl_info->min_column = $context.uc_MIN_COL;    tbl_info->max_column = $context.uc_MAX_COL;    /*     * save users context     */    ${context}_if_ctx.user_ctx = reg_ptr;    /*     * call data access initialization code     */    ${context}_init_data(reg_ptr);    /*     * set up the container     */    _${context}_container_init(&${context}_if_ctx);    if (NULL == ${context}_if_ctx.container) {        snmp_log(LOG_ERR,"could not initialize container for ${context}\n");        return;    }        /*     * access_multiplexer: REQUIRED wrapper for get request handling     */    access_multiplexer->object_lookup = _mfd_${context}_object_lookup;    access_multiplexer->get_values = _mfd_${context}_get_values;    /*     * no wrappers yet     */    access_multiplexer->pre_request = _mfd_${context}_pre_request;    access_multiplexer->post_request = _mfd_${context}_post_request;##@   if $m2c_table_settable@    /*     * REQUIRED wrappers for set request handling     */    access_multiplexer->object_syntax_checks = _mfd_${context}_check_objects;    access_multiplexer->undo_setup = _mfd_${context}_undo_setup;    access_multiplexer->undo_cleanup = _mfd_${context}_undo_cleanup;    access_multiplexer->set_values = _mfd_${context}_set_values;    access_multiplexer->undo_sets = _mfd_${context}_undo_values;    /*     * no wrappers yet     */    access_multiplexer->commit = _mfd_${context}_commit;    access_multiplexer->undo_commit = _mfd_${context}_undo_commit;    access_multiplexer->irreversible_commit = _mfd_${context}_irreversible_commit;##@      if $m2c_table_dependencies == 1@        /*     * REQUIRED for tables with dependencies     */    access_multiplexer->consistency_checks = _mfd_${context}_check_dependencies;@      end@@   end@ # writable    /*************************************************     *     * Create a registration, save our reg data, register table.     */    DEBUGMSGTL(("$name:init_$context",                "Registering $context as a mibs-for-dummies table.\n"));		     handler = netsnmp_baby_steps_access_multiplexer_get(access_multiplexer);    reginfo = netsnmp_handler_registration_create("${context}", handler,                                                  ${context}_oid,                                                  ${context}_oid_size,                                                  HANDLER_CAN_BABY_STEP |@if $m2c_table_settable == 1@                                                  HANDLER_CAN_RWRITE@else@                                                  HANDLER_CAN_RONLY@end@                                                  );    if(NULL == reginfo) {        snmp_log(LOG_ERR,"error registering table ${context}\n");        return;    }    reginfo->my_reg_void = &${context}_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,                                            ${context}_if_ctx.container,                                            TABLE_CONTAINER_KEY_NETSNMP_INDEX);    netsnmp_inject_handler( reginfo, handler );@   if $m2c_data_cache == 1@    /*************************************************     *     * inject cache helper     */    if(NULL != ${context}_if_ctx.cache) {        handler = netsnmp_cache_handler_get(${context}_if_ctx.cache);        netsnmp_inject_handler( reginfo, handler );    }@   end@    /*     * register table     */    netsnmp_register_table(reginfo, tbl_info);@if $m2c_table_persistent == 1@    /*     * register config/persistence callbacks     */    ${context}_container_init_persistence(${context}_if_ctx.container);    @end@} /* _${context}_initialize_interface *//** * @internal * Shutdown the table $context */

⌨️ 快捷键说明

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