📄 x-mibcompout.html
字号:
; <b class="command">mibcomp</b> SNMP MIB Compiler. ; This MIB schema file was generated using the -readtree switch. ; ; This file contains a listing of object identifiers and ; enumerated integers suitable for loading into an SNMP manager ; at run-time. ; ; DO NOT MODIFY THIS FILE BY HAND. ; ; Last build date: Fri May 26 22:06:23 1995; from files: ; example1.mib, example2.mib, examples.ctl $obj 1 iso 0 $obj 1.3 org 0 $obj 1.3.6 dod 0 $obj 1.3.6.1 internet 0 $obj 1.3.6.1.1 directory 0 $obj 1.3.6.1.2 mgmt 0 $obj 1.3.6.1.3 experimental 0 $obj 1.3.6.1.4 private 0 $obj 1.3.6.1.4.1 enterprises 0 $obj 1.3.6.1.4.1.731 wrs 0 $obj 1.3.6.1.4.1.731.8 examples 0 $obj 1.3.6.1.4.1.731.8.1 ex1 0 $obj 1.3.6.1.4.1.731.8.1.1 ex1Objs 0 $obj 1.3.6.1.4.1.731.8.1.1.1 ex1Obj1 VT_NUMBER $enum 1.3.6.1.4.1.731.8.1.1.1 one(1) $enum 1.3.6.1.4.1.731.8.1.1.1 two(2) $obj 1.3.6.1.4.1.731.8.1.1.2 ex1Obj2 VT_STRING $obj 1.3.6.1.4.1.731.8.2 ex2 0 $obj 1.3.6.1.4.1.731.8.2.1 ex2Objs 0 $obj 1.3.6.1.4.1.731.8.2.1.1 ex2Obj1 VT_NUMBER $enum 1.3.6.1.4.1.731.8.2.1.1 one(1) $enum 1.3.6.1.4.1.731.8.2.1.1 two(2) $obj 1.3.6.1.4.1.731.8.2.1.2 ex2Obj2 VT_STRING $obj 1.3.6.1.4.1.731.8.2.2 ex2Traps 0 $obj 1.3.6.1.4.1.731.8.2.2.1 ex2Trap 0</a></b></pre></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="83578"><b class="command">-skel</b> </a></i></h4></font><dl class="margin"><dl class="margin"><dd><pre class="Code"><b><a name="83579">mibcomp -skel -o skel.out example.mib</a></b></pre></dl><dl class="margin"><dd><p class="Body"><a name="83580"> </a>The <b class="command">-skel</b> output mode generates C code containing empty definitions for all the method routines that would be referenced in the output generated by a run of <b class="command">mibcomp</b> with the <b class="command">-mib.c</b> option and the same input files. Such skeleton functions may be useful as a starting point when writing your method routines.</p><dd><p class="Body"><a name="83581"> </a>If you use this output mode, you will probably want to use the <b class="command">-skel.h</b> output mode as well, as described in <a href="x-mibcompOut.html#83589"><i class="title">-skel.h</i></a>.</p><dd><p class="Body"><a name="83585"> </a>Since the <b class="command">-skel</b> output format, unlike most <b class="command">mibcomp</b> output formats, is intended for use as a starting point for code that you write, you almost certainly do not want to run <b class="command">mibcomp</b> in this output mode very often. When you do run <b class="command">mibcomp</b> in this output mode, be careful to make sure you do not accidently overwrite a modified version of the output from a previous run.</p><dd><p class="Body"><a name="83586"> </a>Here is an example of <b class="command">mibcomp</b> output when given the <b class="command">-skel</b> option:</p></dl><dl class="margin"><dd><pre class="Code"><b><a name="83587">/************************************************************************ ************************************************************************* **** This file was automatically generated by Wind River Systems' **** mibcomp SNMP MIB Compiler. **** This file was generated using the -skel switch. **** **** This file contains stub function declarations to aid in building **** the agent MIB interface. It defines all the MIB get, set, test and **** next method routines that you will need to supply. **** Filling in the skeletal function with useful code is up to you. **** **** YOU MAY MODIFY THIS FILE BUT BEWARE ACCIDENTALLY OVERWRITING IT **** BY REGENERATING IT WITH THE MIB COMPILER. **** **** Last build date: Fri May 26 22:06:23 1995 **** from files: **** example1.mib, example2.mib, examples.ctl ************************************************************************* ************************************************************************* */ #include "example.h" INT_32_T get_ex1Obj1( OIDC_T lastmatch, int compc, OIDC_T* compl, char* cookie, SNMP_PKT_T* pktp) { } void set_ex1Obj1( OIDC_T lastmatch, int compc, OIDC_T* compl, char* cookie, INT_32_T value, SNMP_PKT_T* pktp, int indx) { } OCTET_T* get_ex1Obj2( OIDC_T lastmatch, int compc, OIDC_T* compl, char* cookie, int* len, SNMP_PKT_T* pktp, int* dynamic) { } INT_32_T get_ex2Obj1( OIDC_T lastmatch, int compc, OIDC_T* compl, char* cookie, SNMP_PKT_T* pktp) { } void set_ex2Obj1( OIDC_T lastmatch, int compc, OIDC_T* compl, char* cookie, INT_32_T value, SNMP_PKT_T* pktp, int indx) { } OCTET_T* get_ex2Obj2( OIDC_T lastmatch, int compc, OIDC_T* compl, char* cookie, int* len, SNMP_PKT_T* pktp, int* dynamic) { }</a></b></pre></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="83589"><b class="command">-skel.h</b> </a></i></h4></font><dl class="margin"><dl class="margin"><dd><pre class="Code"><b><a name="83590">mibcomp -skel.h -o skelh.out example.mib</a></b></pre></dl><dl class="margin"><dd><p class="Body"><a name="83591"> </a>The <b class="command">-skel.h</b> output mode generates a C header file that declares all the functions that would be defined in the C code generated by <b class="command">mibcomp</b> running with the <b class="command">-skel</b> option (<a href="x-mibcompOut.html#83578"><i class="title">-skel</i></a>) and the same input files. This is the same set of functions that would be referenced by the C code generated by <b class="command">mibcomp</b> running with the <b class="command">-mib.c</b> option and the same input files.</p><dd><p class="Body"><a name="83595"> </a>Here is an example of <b class="command">mibcomp</b> output when given the <b class="command">-skel.h</b> option:</p></dl><dl class="margin"><dd><pre class="Code"><b><a name="83596">/************************************************************************ ****************************************************************************** **** This file was automatically generated by Wind River Systems' **** mibcomp SNMP MIB Compiler. **** This file was generated using the -skel.h switch. **** **** This file contains declarations of stub functions to aid in building **** the agent MIB interface. It declares all the MIB get, set, test and **** next method routines that you will need to supply. You'll probably **** want to FORCE-INCLUDE this file when using the -mib.c output mode. **** **** To generate the skeletal stub functions themselves, run <b class="command">mibcomp </b>**** with the -skel switch. **** **** YOU MAY MODIFY THIS FILE BUT BEWARE ACCIDENTALLY OVERWRITING IT **** BY REGENERATING IT WITH THE MIB COMPILER. **** **** Last build date: Fri May 26 22:06:23 1995 **** from files: **** example1.mib, example2.mib, examples.ctl ************************************************************************* ************************************************************************* */ INT_32_T get_ex1Obj1(OIDC_T, int, OIDC_T*, char*, SNMP_PKT_T*); void set_ex1Obj1(OIDC_T, int, OIDC_T*, char*, INT_32_T, SNMP_PKT_T*, int); OCTET_T* get_ex1Obj2(OIDC_T, int, OIDC_T*, char*, int*, SNMP_PKT_T*, int*); INT_32_T get_ex2Obj1(OIDC_T, int, OIDC_T*, char*, SNMP_PKT_T*); void set_ex2Obj1(OIDC_T, int, OIDC_T*, char*, INT_32_T, SNMP_PKT_T*, int); OCTET_T* get_ex2Obj2(OIDC_T, int, OIDC_T*, char*, int*, SNMP_PKT_T*, int*);</a></b></pre></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="83598"><b class="command">-stub</b> </a></i></h4></font><dl class="margin"><dl class="margin"><dd><pre class="Code"><b><a name="83599">mibcomp -stub -o stub.c example.mib</a></b></pre></dl><dl class="margin"><dd><p class="Body"><a name="83600"> </a>The<b class="command"> -stub</b> output mode attempts to write your method routines for you. It cannot know how your data structures are set up, so it's only a start, but it's a start that can save you a lot of typing.</p><dd><p class="Body"><a name="83601"> </a>First, the <b class="command">-stub</b> output makes some assumptions about how to group MIB variables. It considers any variables which possess a common parent a group. For instance, all the variables in the system group of MIB-II, which all have the parent node <b class="symbol_lc">system</b>, are considered a group. Also, all the variables which form the columns of a table are considered a group.</p><dd><p class="Body"><a name="83602"> </a>Then, for each group of variables the <b class="command">-stub</b> output writes out up to five routines. These are the four method routines for the SNMP agent and an internal routine, shared by the <b class="routine"><i class="routine">getproc</i></b><b>( )</b> and <b class="routine"><i class="routine">nextproc</i></b><b>( )</b><b class="routine"><i class="routine"> </i></b>routines, that retrieves the values of variables. If none of the variables in the group is writable, the <b class="routine"><i class="routine">testproc</i></b><b>( )</b> and <b class="routine"><i class="routine">setproc</i></b><b>( )</b> routines ore omitted and if none of the variables are readable, the <b class="routine"><i class="routine">getproc</i></b><b>( )</b> and <b class="routine"><i class="routine">nextproc</i></b><b>( )</b> routines are omitted. </p><dd><p class="Body"><a name="83603"> </a>Now you need to modify the method routines to fit your system. <b class="command">mibcomp</b> includes a comment of the form <b class="symbol_lc">/* !!! */</b> on each line we think you might want to consider modifying. <b class="command">mibcomp</b> also includes substantial comments to guide you through the code so you can understand what it is trying to do. </p><dd><p class="Body"><a name="83604"> </a>The generated output <b class="symbol_lc">#include</b>s the file <b class="file">mibleaf.h</b>, which should be generated by the MIB compiler using the <b class="command">-leaf</b> option. The constants defined in there are used through the code to make it more readable. </p><dd><p class="Body"><a name="83605"> </a>The <b class="command">-stub</b> output mode understands the <b class="command">-start</b> command line option, which lets it write out only part of the MIBs that were read in from the command line. </p><dd><p class="Body"><a name="83606"> </a>To get the <b class="command">-mib.c</b> output mode to use the same function names, it is not necessary to specify them explicitly in your control file. If you set the method routine names to "<b class="symbol_lc">-stub</b>", then <b class="command">-mib.c</b> uses the same names that <b class="command">-stub</b> would choose. If all of your MIBs are handled by method routines which follow the <b class="command">-stub</b> names, then you do not need to set the method routine names in your control file at all. In fact, you may not even need a control file.</p><dd><p class="Body"><a name="83607"> </a>Since the <b class="command">-stub</b> output format, unlike most <b class="command">mibcomp</b> output formats, is intended for use as a starting point for code that you write, you almost certainly will not run <b class="command">mibcomp</b> in this output mode very often. When you do run <b class="command">mibcomp</b> in this output mode, be careful to make sure you do not accidentally overwrite a modified version of the output from a previous run. </p><dd><p class="Body"><a name="83608"> </a>Here is an example of <b class="command">mibcomp</b> output when given the <b class="command">-stub</b> option: </p></dl><dl class="margin"><dd><pre class="Code"><b><a name="83609">/************************************************************************ ************************************************************************* **** This file was automatically generated by Wind River Systems' **** mibcomp SNMP MIB Compiler. **** This file was generated using the -stub switch. **** **** This file contains stub function declarations to aid in building **** the agent MIB interface. It creates all the MIB get, set, test, and **** next method routines that you will need to supply. However, **** since it doesn't know your system, several things are left to you. **** Look for comments containing \Q!!!' for places you're likely to want **** to change for your system. Also, while the layout of the method **** routines is a commonly useful one, it does not fit all data **** structures and systems. Look at this output as a guide to how to **** write your method routines; a guide that, in most cases, **** significantly reduces the amount of typing you need to do. **** **** The code here assumes you've created a file called \Qmibleaf.h' with **** the -leaf option to the mibcompiler. **** **** YOU WILL PROBABLY MODIFY THIS FILE BUT BEWARE ACCIDENTALLY **** OVERWRITING IT BY REGENERATING IT WITH THE MIB COMPILER. **** **** Last build date: Mon Mar 18 15:45:02 1996 **** from files: example1.mib, example2.mib, examples.ctl ************************************************************************* ************************************************************************* */ #include <h/snmp/asn1conf.h> #include <h/snmp/asn1.h> #include <h/snmp/buffer.h> #include <h/snmp/mib.h> #include <h/snmp/localio.h> #include <h/snmp/snmpdefs.h> #include <h/snmp/snmp.h> #include <h/snmp/auxfuncs.h> #include "mibleaf.h" /* * Method routines fo
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -