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

📄 mfd-readme.m2c

📁 开发snmp的开发包有两个开放的SNMP开发库
💻 M2C
📖 第 1 页 / 共 2 页
字号:
  undo context while processing a set request.  Release data context  -------  TODO : release memory allocated for a data context  FUNC : ${context}_release_data  This function will be called to release any resources held by a  data or undo context. It will be called when a row request context  is released, or during cleanup after a set request.@    end@@    foreach $node index@@        include m2c_setup_node.m2i@@        if ($m2c_skip_mapping != 1)@  Map native data to MIB format  -----------------------------  TODO : convert data from its native format to the format required by the MIB  FUNC : ${node}_map  This function should map between the native format of the node data to  the format or values required by the MIB. For example, a C boolean value  for a MIB node with the TruthValue syntax needs to map the value C  false(0) to TruthValue false(2).@        end@ #// skip mapping@    end@ // foreach index@    foreach $node nonindex@@        include m2c_setup_node.m2i@@        if ($m2c_skip_mapping != 1)@  Map native data to MIB format  -----------------------------  TODO : convert data from its native format to the format required by the MIB  FUNC : ${node}_map  This function should map between the native format of the node data to  the format or values required by the MIB. For example, a C boolean value  for a MIB node with the TruthValue syntax needs to map the value C  false(0) to TruthValue false(2).@        end@ #// skip mapping  Get data for column  -------------------  TODO : retrieve column data from raw data  FUNC : ${node}_get@      ifconf syntax-$node.syntax-readme.m2i@@          include syntax-$node.syntax-readme.m2i@@      elsif ($node.enums == 1) && ("$node.perltype" eq "BITS")@  Since this column has enumerated BITS, you should update or replace the  IS_SET_* macros to properly determine whether or not a particular bit  should be set.@      end@@   end@@if $m2c_create_fewer_files != 1@File: ${name}_data_set.c@else@File: ${name}.c; SET support@end@------------------------------------------------------------------------@if $m2c_table_settable == 0@  This table does not support set requests.@else@  This code was generated based on the following assumptions or settings:@   if $m2c_table_dependencies == 1@  1) None of the values for this table have DEPENDENCIES on other objects.@   else@  1) Some of the values for this table have DEPENDENCIES on other objects.@   end@@   if $mfd_readme_verbose != 0@  DEPENDENCIES on other objects complicates SET request processing. When  one or more columns in a table depend on another object (in the same  table, or in another table), a DEPENDENCY exists. For example, if you  have a table that determine a color with three columns (red, green and  blue) that define the percentage of each primary color, the total for  the three columns must equal 100 percent. So, in addition to checking  that each colums has a valid value between 0 and 100, the total of  all three columns must equal 100.  Set $@m2c_table_dependencies = 0 in ${m2c_defaults_dir}table-${table}.m2d  and regenerate code if this assumption is incorrect.@   end@@if $m2c_table_row_creation == 1@  2) This table supports ROW CREATION.@else@  2) This table does not support ROW CREATION.@end@@if $mfd_readme_verbose != 0@  Supporting ROW CREATION allows new rows to be created via SNMP requests.@end@@if $m2c_table_row_creation == 1@  To support row creation, the index component of an incoming set request must  be validated. A funciton is generated for each individual index component,  and another for validating all the index components together.@    foreach $node externalindex@@        include m2c_setup_node.m2i@  Validate external index  -----------------------  TODO : validate the specified external index component  FUNC : ${context}_${node}_check_index@    end@ # foreach externalindex@    foreach $node internalindex@@        include m2c_setup_node.m2i@  Validate index component  ------------------------  TODO : validate the specified index component  FUNC : ${node}_check_index@    end@  Validate index  --------------  TODO : check that all index components are valid  FUNC : ${context}_validate_index@end@@   if $m2c_table_dependencies == 1@  Check dependencies  ------------------  TODO : check that all dependencies have been satisfied  FUNC : ${context}_check_dependencies  This function will be called after all the individual columns have been  set to their new values. Check for any dependencies between rows or  tables in this function.@   end@  Undo setup  ----------  TODO : save data for undo  FUNC : ${context}_undo_setup  This function will be called before the individual undo_setup functions are  called. This is where you should save any undo information which is not  directly related to a particular column. This function will only be called  once per row. After this function is called, any column which is being  set will have its individual node undo_setup function called.@    foreach $node nonindex@@        include m2c_setup_node.m2i@@        if $node.settable == 0@@            next@ # skip to next column@        end@  Check value for column  ----------------------  TODO : perform additional validations on values for a set request  FUNC : ${node}_check_value  The generated code will automatically validate incoming requests against  all the requirements specified by the syntax of the MIB. However, it is  often the case that additional requirements are specified in the  description of a MIB object. Those type of validations should be checked  in this function.  Undo setup for column  ---------------------  TODO : save the value for column  FUNC : ${node}_undo_setup  After the table level undo setup function has been called, the individual  node undo setup functions will be called for columns which are being set.  Set value for column  --------------------  TODO : set the value for column  FUNC : ${node}_set  After all the validations have been passed, this function will be called to  set the new value.  Undo value for column  ---------------------  TODO : undo set for column  FUNC : ${node}_undo  If an error occurs after a column has been set, this function will be called  to undo the set and restore the previous state.@    end@ # nonindex  Commit changes  --------------  TODO : commit changes  FUNC : ${context}_commit  After all values have been set, the commit function will be called.@   if $m2c_irreversible_commit == 1@  Commit irreversible changes  ---------------------------  FUNC: ${context}_irreversible_commit  This special mode is reserved for committing changes which can not be undone.  (e.g. launching a rocket). It is called after all normal commits have  succeeded.@   end@@end@ # settable************************************************************************${context} Reference------------------------------------------------------------------------Function flow----------------------------------------------------To give you the general idea of how the functions flow works, thisexample flow is from a complete table implementation.NOTE: Depending on your configuration, some of the functions used in the      examples below  may not have been generated for the      ${context} table.      Conversely, the examples below may not include some functions that      were generated for the ${context} table.To watch the flow of the ${context} table, use thefollowing debug tokens:        snmp_agent        helper:table:req        ${context}        verbose:${context}        internal:${context}e.g.        snmpd -f -Le -D${context},verbose:${context},internal:${context}@if $m2c_create_fewer_files == 1@@   eval $tmp_mfd_rm_set = "xxx.c"@@   eval $tmp_mfd_rm_get = "xxx.c"@@else@@   eval $tmp_mfd_rm_set = "xxx_data_set.c"@@   eval $tmp_mfd_rm_get = "xxx_data_get.c"@@end@Initialization--------------------------------init_xxxTable: called                           xxx.c   initialize_table_xxxTable                    xxx.c      _xxxTable_initialize_interface            xxx_interface.c         xxxTable_init_data                     xxx_data_access.c      _xxxTable_container_init                  xxx_interface.c         xxxTable_container_init                xxx_data_access.cGET Request--------------------------------_cache_load                                     xxx_interface.c   xxxTable_cache_load                          xxx_data_access.c      xxxTable_allocate_rowreq_ctx              xxx_interface.c         xxxTable_allocate_data                 $tmp_mfd_rm_get         xxxTable_rowreq_ctx_init               $tmp_mfd_rm_get      xxxTable_indexes_set                      $tmp_mfd_rm_get         xxxTable_indexes_set_tbl_idx           $tmp_mfd_rm_getxxxTable_pre_request                              _mfd_xxxTable_object_lookup                     xxx_interface.c   xxxTable_row_prep                            xxx_data_access.c_mfd_xxxTable_get_values                        xxx_interface.c   _mfd_xxxTable_get_column                     xxx_interface.c      yyy_get                                   $tmp_mfd_rm_getxxxTable_post_requestGETNEXT Request--------------------------------_cache_load                                     ...xxxTable_pre_request                            ..._mfd_xxxTable_object_lookup                     ..._mfd_xxxTable_get_values                        ...xxxTable_post_request                           ...SET Request: success--------------------------------_cache_load                                     ...xxxTable_pre_request_mfd_xxxTable_object_lookup                     ..._mfd_xxxTable_check_objects                     xxx_interface.c   _xxxTable_check_column                       xxx_interface.c      yyy_check_value                           $tmp_mfd_rm_set_mfd_xxxTable_undo_setup                        xxx_interface.c   xxxTable_allocate_data                       ...   xxxTable_undo_setup                          xxx_interface.c      _xxxTable_undo_setup_column               xxx_interface.c         yyy_undo_setup                         $tmp_mfd_rm_set_mfd_xxxTable_set_values                        xxx_interface.c   _xxxTable_set_column                         xxx_interface.c      yyy_set                                   $tmp_mfd_rm_set_mfd_xxxTable_check_dependencies                xxx_interface.c   xxxTable_check_dependencies                  $tmp_mfd_rm_set_mfd_xxxTable_commit                            xxx_interface.c   xxxTable_commit                              $tmp_mfd_rm_set_mfd_xxxTable_undo_cleanup                      xxx_interface.c   xxxTable_undo_cleanup                        $tmp_mfd_rm_set      xxxTable_release_data                     ...xxxTable_post_request                           ...SET Request: row creation--------------------------------_cache_load                                     ...xxxTable_pre_request_mfd_xxxTable_object_lookup                     ...   xxxTable_index_from_oid                      xxx_interface.c   xxxTable_allocate_rowreq_ctx                 ...      ...   _xxxTable_check_indexes                      xxx_interface.c      yyy_check_index                           $tmp_mfd_rm_set      xxxTable_validate_index                   $tmp_mfd_rm_set_mfd_xxxTable_check_objects                     ...   _xxxTable_check_column                       ...      yyy_check_value                           ...   _xxxTable_check_column                       ...      yyy_check_value                           ..._mfd_xxxTable_undo_setup                        ..._mfd_xxxTable_set_values                        ..._mfd_xxxTable_check_dependencies                ..._mfd_xxxTable_commit                            ..._mfd_xxxTable_undo_cleanup                      ...xxxTable_post_request                           ...SET Resuest: value error--------------------------------_cache_load                                     ...xxxTable_pre_request                            ..._mfd_xxxTable_object_lookup                     ..._mfd_xxxTable_check_objects                     ...   _xxxTable_check_column                       ...      yyy_check_value                           ...      ERROR:"yyy value not supported"xxxTable_post_request                           ...SET Request: commit failure--------------------------------_cache_load                                     ...xxxTable_pre_request                            ..._mfd_xxxTable_object_lookup                     ..._mfd_xxxTable_check_objects                     ..._mfd_xxxTable_undo_setup                        ..._mfd_xxxTable_set_values                        ..._mfd_xxxTable_check_dependencies                ..._mfd_xxxTable_commit                            ...   xxxTable_commit                              ...   ERROR: bad rc -1_mfd_xxxTable_undo_commit                       xxx_interface.c   xxxTable_undo_commit                         $tmp_mfd_rm_set_mfd_xxxTable_undo_values                       xxx_interface.c   _xxxTable_undo_column                        xxx_interface.c      yyy_undo                                  $tmp_mfd_rm_set_mfd_xxxTable_undo_cleanup                      ...xxxTable_post_request                           ...Row release (user initiated)--------------------------------xxxTable_release_rowreq_ctx                     xxx_interface.c   xxxTable_rowreq_ctx_cleanup                  $tmp_mfd_rm_get   xxxTable_release_data                        $tmp_mfd_rm_getTable / column details----------------------------------------------------@    include details-table.m2i@@    foreach $node column@@        include m2c_setup_node.m2i@@        include details-node.m2i@@    end@@end@ # foreach table##########################################################################@if $m2c_mark_boundary == 1@/** END code generated by $RCSfile$ $Revision: 12091 $ */@end@

⌨️ 快捷键说明

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