home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / usr / share / snmp / mib2c-data / mfd-top.m2c < prev    next >
Encoding:
Text File  |  2007-02-07  |  11.6 KB  |  421 lines

  1. #############################################################  -*- c -*-
  2. ## generic include for XXX. Do not use directly.
  3. ## $Id: mfd-top.m2c,v 1.32.2.3 2005/03/24 00:41:47 rstory Exp $
  4. ########################################################################
  5. ########################################################################
  6. ##
  7. ## mfd function params
  8. ##
  9. @ifconf ${name}.m2d@
  10. @   include ${name}.m2d@
  11. @end@
  12. ########################################################################
  13. @eval $m2c_processing_type = 'h'@
  14. @open ${name}.h@
  15. @eval $hack = "Id"@
  16. /*
  17.  * Note: this file originally auto-generated by mib2c using
  18.  *       version $Revision: 1.32.2.3 $ of $RCSfile: mfd-top.m2c,v $
  19.  *
  20.  * $$hack:$
  21.  */
  22. @include generic-header-top.m2i@
  23.  
  24. /** @defgroup misc misc: Miscelaneous routines
  25.  *
  26.  * @{
  27.  */
  28. @if $m2c_mark_boundary == 1@
  29. /** START header generated by $RCSfile: mfd-top.m2c,v $ $Revision: 1.32.2.3 $ */
  30. @end@
  31. #include <net-snmp/library/asn1.h>
  32.  
  33. /* other required module components */
  34.     /* *INDENT-OFF*  */
  35. config_require($name.module/${name}/${name}_interface);
  36. config_require($name.module/${name}/${name}_data_access);
  37. @if $m2c_create_fewer_files != 1@
  38. config_require($name.module/${name}/${name}_data_get);
  39. config_require($name.module/${name}/${name}_data_set);
  40.     /* *INDENT-ON*  */
  41.  
  42. /* OID and column number definitions for $context */
  43. #include "${name}_oids.h"
  44.  
  45. /* enum definions */
  46. #include "${name}_enums.h"
  47. @else@
  48.     /* *INDENT-ON*  */
  49.  
  50. /* OID, column number and enum definions for $context */
  51. #include "${name}_constants.h"
  52. @end@ // m2c_create_fewer_files
  53.  
  54. /* *********************************************************************
  55.  * function declarations
  56.  */
  57. void init_$name(void);
  58.  
  59. /* *********************************************************************
  60.  * Table declarations
  61.  */
  62. @foreach $table table@
  63. @    include m2c_setup_table.m2i@
  64. @    include details-table.m2i@
  65. /* *********************************************************************
  66.  * When you register your mib, you get to provide a generic
  67.  * pointer that will be passed back to you for most of the
  68.  * functions calls.
  69.  *
  70.  * TODO:100:r: Review all context structures
  71.  */
  72.     /*
  73.      * TODO:101:o: |-> Review $context registration context.
  74.      */
  75. @    if "x$m2c_context_reg" eq "x"@
  76. @        eval $m2c_context_reg = "void *"@
  77. @    end@
  78. typedef $m2c_context_reg ${context}_registration_ptr;
  79.  
  80. @    include generic-data-context.m2i@
  81.  
  82. @   if $m2c_table_settable@
  83. /* *********************************************************************
  84.  * TODO:115:o: |-> Review $context undo context.
  85.  * We're just going to use the same data structure for our
  86.  * undo_context. If you want to do something more efficent,
  87.  * define your typedef here.
  88.  */
  89. typedef ${context}_data ${context}_undo_data;
  90.  
  91. @    end@
  92. @    include generic-table-indexes.m2i@
  93.  
  94. /* *********************************************************************
  95.  * TODO:130:o: |-> Review $context Row request (rowreq) context.
  96.  * When your functions are called, you will be passed a
  97.  * ${context}_rowreq_ctx pointer.
  98.  */
  99. typedef struct ${context}_rowreq_ctx_s {
  100.  
  101.     /** this must be first for container compare to work */
  102.     netsnmp_index        oid_idx;
  103. ##                                             /* xxx-rks: shrink index oid_tmp? */
  104.     oid                  oid_tmp[MAX_${context}_IDX_LEN];
  105.     
  106.     ${context}_mib_index        tbl_idx;
  107.     
  108. @    if $m2c_data_allocate == 1@
  109. @        eval $mfd_tmp = "*"@
  110. @    else@
  111. @        eval $mfd_tmp = " "@
  112. @    end@
  113.     ${context}_data            $mfd_tmp data;
  114. @   if $m2c_table_settable@
  115. @      if $m2c_undo_embed == 1@
  116. @         eval $mfd_tmp = " "@
  117. @      else@
  118. @         eval $mfd_tmp = "*"@
  119. @      end@ # embed
  120.     ${context}_undo_data       $mfd_tmp undo;
  121.     unsigned int                column_set_flags; /* flags for set columns */
  122.  
  123. @   end@ # settable
  124.  
  125.     /*
  126.      * flags per row. Currently, the first (lower) 8 bits are reserved
  127.      * for the user. See mfd.h for other flags.
  128.      */
  129.     u_int                       rowreq_flags;
  130.  
  131.     /*
  132.      * implementor's context pointer (provided during registration)
  133.      */
  134.     ${context}_registration_ptr ${context}_reg;
  135.  
  136.     /*
  137.      * TODO:131:o: |   |-> Add useful data to $context rowreq context.
  138.      */
  139.     
  140.     /*
  141.      * storage for future expansion
  142.      */
  143.     netsnmp_data_list             *${context}_data_list;
  144.  
  145. } ${context}_rowreq_ctx;
  146.  
  147. typedef struct ${context}_ref_rowreq_ctx_s {
  148.     ${context}_rowreq_ctx *rowreq_ctx;
  149. } ${context}_ref_rowreq_ctx;
  150.  
  151. /* *********************************************************************
  152.  * function prototypes
  153.  */
  154. ## {
  155.     int ${context}_pre_request(${context}_registration_ptr user_context);
  156.     int ${context}_post_request(${context}_registration_ptr user_context);
  157.  
  158. @   if $m2c_data_init == 1@
  159.     int ${context}_rowreq_ctx_init(${context}_rowreq_ctx *rowreq_ctx);
  160.     void ${context}_rowreq_ctx_cleanup(${context}_rowreq_ctx *rowreq_ctx);
  161.  
  162. @   end@
  163. @    if "$m2c_data_context" ne "generated"@
  164. @        if ($m2c_data_allocate == 1) || ($m2c_undo_embed == 1)@
  165.     ${context}_data * ${context}_allocate_data(void);
  166.     void ${context}_release_data(${context}_data *data);
  167.  
  168. @        end@
  169. @   end@
  170. @   if $m2c_table_settable@
  171. @      if $m2c_table_dependencies == 1@
  172.     int ${context}_check_dependencies(${context}_rowreq_ctx * rowreq_ctx); 
  173. @      end@ 
  174.     int ${context}_commit(${context}_rowreq_ctx * rowreq_ctx);
  175. @      if $m2c_irreversible_commit == 1@
  176.     int ${context}_irreversible_commit(${context}_rowreq_ctx * rowreq_ctx);
  177. @      end@
  178. @   end@ # writable
  179.  
  180. extern oid ${context}_oid[];
  181. extern int ${context}_oid_size;
  182.  
  183. @end@ # for each
  184.  
  185. #include "${name}_interface.h"
  186. #include "${name}_data_access.h"
  187. @if $m2c_create_fewer_files != 1@
  188. #include "${name}_data_get.h"
  189. #include "${name}_data_set.h"
  190. @else@
  191. @   eval $mfd_processing_types = "h"@
  192. @   include mfd-data-get.m2c@
  193. @   include mfd-data-set.m2c@
  194. @end@ // m2c_create_fewer_files
  195.  
  196. /*
  197.  * DUMMY markers, ignore
  198.  *
  199.  * TODO:099:x: *************************************************************
  200.  * TODO:199:x: *************************************************************
  201.  * TODO:299:x: *************************************************************
  202.  * TODO:399:x: *************************************************************
  203.  * TODO:499:x: *************************************************************
  204.  */
  205. @if $m2c_mark_boundary == 1@
  206. /** END header generated by $RCSfile: mfd-top.m2c,v $ $Revision: 1.32.2.3 $ */
  207. @end@
  208. @include generic-header-bottom.m2i@
  209. ######################################################################
  210. ## Do the .c file
  211. ######################################################################
  212. @eval $m2c_processing_type = 'c'@
  213. @open ${name}.c@
  214. /*
  215.  * Note: this file originally auto-generated by mib2c using
  216.  *       version $Revision: 1.32.2.3 $ of $RCSfile: mfd-top.m2c,v $ 
  217.  *
  218.  * $$hack:$
  219.  */
  220. /** \mainpage MFD helper for ${name}
  221.  *
  222.  * \section intro Introduction
  223.  * Introductory text.
  224.  *
  225.  */
  226. @include generic-source-includes.m2i@
  227. #include <net-snmp/agent/mib_modules.h>
  228.  
  229. @if $m2c_mark_boundary == 1@
  230. /** START code generated by $RCSfile: mfd-top.m2c,v $ $Revision: 1.32.2.3 $ */
  231. @end@
  232. #include "${name}_interface.h"
  233.  
  234. @foreach $table table@
  235. @    include m2c_setup_table.m2i@
  236. oid ${context}_oid[] = { $context.uc_OID };
  237. int ${context}_oid_size = OID_LENGTH(${context}_oid);
  238.  
  239. void initialize_table_$context(void);
  240.  
  241. @end@
  242.  
  243. /**
  244.  * Initializes the $name module
  245.  */
  246. void
  247. init_$name(void)
  248. {
  249.     DEBUGMSGTL(("verbose:$name:init_$name","called\n"));
  250.  
  251.     /*
  252.      * TODO:300:o: Perform $name one-time module initialization.
  253.      */
  254.      
  255.     /*
  256.      * here we initialize all the tables we're planning on supporting
  257.      */
  258.   @foreach $table table@
  259.     if (should_init("$context"))
  260.         initialize_table_$context();
  261.  
  262.   @end@
  263. } /* init_$name */
  264.  
  265. ########################################################################
  266. ##
  267. @foreach $table table@
  268. @    include m2c_setup_table.m2i@
  269. /**
  270.  * Initialize the table $context 
  271.  *    (Define its contents and how it's structured)
  272.  */
  273. void
  274. initialize_table_$context(void)
  275. {
  276.     ${context}_registration_ptr user_context;
  277.     u_long flags;
  278.  
  279.     DEBUGMSGTL(("verbose:$context:initialize_table_$context","called\n"));
  280.  
  281.     /*
  282.      * TODO:301:o: Perform $context one-time table initialization.
  283.      */
  284.  
  285.     /*
  286.      * TODO:302:o: |->Initialize $context user context
  287.      * if you'd like to pass in a pointer to some data for this
  288.      * table, allocate or set it up here.
  289.      */
  290. @    if "$m2c_context_reg" eq "netsnmp_data_list *"@
  291.     /*
  292.      * a netsnmp_data_list is a simple way to store void pointers. A simple
  293.      * string token is used to add, find or remove pointers.
  294.      */
  295.     user_context = netsnmp_create_data_list("$context", NULL, NULL);
  296. @    else@
  297.     user_context = NULL;
  298. @   end@
  299.     
  300.     /*
  301.      * No support for any flags yet, but in the future you would
  302.      * set any flags here.
  303.      */
  304.     flags = 0;
  305.     
  306.     /*
  307.      * call interface initialization code
  308.      */
  309.     _${context}_initialize_interface(user_context, flags);
  310. } /* initialize_table_$context */
  311.  
  312. ########################################################################
  313. @   if $m2c_data_init == 1@
  314. /**
  315.  * extra context initialization
  316.  *
  317.  * @param rowreq_ctx    : row request context
  318.  * @param user_init_ctx : void pointer for user (parameter to rowreq_ctx_allocate)
  319.  *
  320.  * @retval MFD_SUCCESS  : no errors
  321.  * @retval MFD_ERROR    : error (context allocate will fail)
  322.  */
  323. int
  324. ${context}_rowreq_ctx_init(${context}_rowreq_ctx *rowreq_ctx,
  325.                            void *user_init_ctx)
  326. {
  327.     DEBUGMSGTL(("verbose:$context:${context}_rowreq_ctx_init","called\n"));
  328.  
  329.     netsnmp_assert(NULL != rowreq_ctx);
  330.     
  331.     /*
  332.      * TODO:210:o: |-> Perform extra $context rowreq initialization.
  333.      */
  334.  
  335.     return MFD_SUCCESS;
  336. } /* ${context}_rowreq_ctx_init */
  337.  
  338. /**
  339.  * extra context cleanup
  340.  *
  341.  */
  342. void ${context}_rowreq_ctx_cleanup(${context}_rowreq_ctx *rowreq_ctx)
  343. {
  344.     DEBUGMSGTL(("verbose:$context:${context}_rowreq_ctx_cleanup","called\n"));
  345.  
  346.     netsnmp_assert(NULL != rowreq_ctx);
  347.     
  348.     /*
  349.      * TODO:211:o: |-> Perform extra $context rowreq cleanup.
  350.      */
  351. } /* ${context}_rowreq_ctx_cleanup */
  352.  
  353. @   end@ // data_init
  354. ########################################################################
  355. /**
  356.  * pre-request callback
  357.  *
  358.  *
  359.  * @retval MFD_SUCCESS              : success.
  360.  * @retval MFD_ERROR                : other error
  361.  */
  362. int
  363. ${context}_pre_request(${context}_registration_ptr user_context)
  364. {
  365.     DEBUGMSGTL(("verbose:${context}:${context}_pre_request","called\n"));
  366.  
  367.     /*
  368.      * TODO:510:o: Perform $context pre-request actions.
  369.      */
  370.  
  371.     return MFD_SUCCESS;
  372. } /* ${context}_pre_request */
  373.  
  374. /**
  375.  * post-request callback
  376.  *
  377.  *
  378.  * @retval MFD_SUCCESS : success.
  379.  * @retval MFD_ERROR   : other error (ignored)
  380.  */
  381. int
  382. ${context}_post_request(${context}_registration_ptr user_context)
  383. {
  384.     DEBUGMSGTL(("verbose:${context}:${context}_post_request","called\n"));
  385.  
  386.     /*
  387.      * TODO:511:o: Perform $context pos-request actions.
  388.      */
  389.  
  390.     return MFD_SUCCESS;
  391. } /* ${context}_post_request */
  392.  
  393. @end@ // table
  394.  
  395. ########################################################################
  396. @if $m2c_create_fewer_files == 1@
  397. @   eval $mfd_processing_types = "c"@
  398. @   include mfd-data-get.m2c@
  399. @   include mfd-data-set.m2c@
  400. @else@
  401. @   eval $mfd_processing_types = "chi"@
  402. @   run mfd-data-get.m2c@
  403. @   run mfd-data-set.m2c@
  404. @end@
  405. ########################################################################
  406. /** @{ */
  407. @if $m2c_mark_boundary == 1@
  408. /** END code generated by $RCSfile: mfd-top.m2c,v $ $Revision: 1.32.2.3 $ */
  409. @end@
  410. ##
  411. ########################################################################
  412. ##
  413. ## Do support files
  414. ##
  415. ########################################################################
  416. @run generic-table-constants.m2c@
  417. @run mfd-interface.m2c@
  418. @run mfd-data-access.m2c@
  419. @run mfd-readme.m2c@
  420. ##@run mfd-doxygen.m2c@
  421.