aboutsummaryrefslogtreecommitdiffstats
path: root/lib/snmp/doc/src/snmpc.xml
blob: 48d63d6c91a47a7df982fc945231263cc69e4b39 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
<?xml version="1.0" encoding="latin1" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">

<erlref>
  <header>
    <copyright>
      <year>2004</year><year>2009</year>
      <holder>Ericsson AB. All Rights Reserved.</holder>
    </copyright>
    <legalnotice>
      The contents of this file are subject to the Erlang Public License,
      Version 1.1, (the "License"); you may not use this file except in
      compliance with the License. You should have received a copy of the
      Erlang Public License along with this software. If not, it can be
      retrieved online at http://www.erlang.org/.
    
      Software distributed under the License is distributed on an "AS IS"
      basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
      the License for the specific language governing rights and limitations
      under the License.
    
    </legalnotice>

    <title>snmpc</title>
    <prepared></prepared>
    <responsible></responsible>
    <docno></docno>
    <approved></approved>
    <checked></checked>
    <date></date>
    <rev></rev>
    <file>snmpc.xml</file>
  </header>
  <module>snmpc</module>
  <modulesummary>Interface Functions to the SNMP toolkit MIB compiler</modulesummary>
  <description>
    <p>The module <c>snmpc</c> contains interface functions to the 
      SNMP toolkit MIB compiler.</p>

  </description>

  <funcs>
    <func>
      <name>compile(File)</name>
      <name>compile(File, Options) -> {ok, BinFileName} | {error, Reason}</name>
      <fsummary>Compile the specified MIB</fsummary>
      <type>
        <v>File = string()</v>
        <v>Options = [opt()]</v>
        <v>opt() = db() | deprecated() | description() | reference() | group_check() |  i() | il() | imports() | module() | module_identity() | outdir() |  no_defs() | verbosity() | warnings()</v>
        <v>db() = {db, volatile|persistent|mnesia}</v>
        <v>deprecated() = {deprecated, bool()}</v>
        <v>description() = description</v>
        <v>reference() = reference</v>
        <v>group_check() = {group_check, bool()}</v>
        <v>i() = {i, [dir()]}</v>
        <v>il() = {il, [dir()]}</v>
        <v>imports() = imports</v>
        <v>module() = {module, atom()}</v>
        <v>module_identity() = module_identity</v>
        <v>no_defs() = no_defs</v>
        <v>outdir() = {outdir, dir()}</v>
        <v>verbosity() = {verbosity, silence|warning|info|log|debug|trace}</v>
        <v>warnings() = {warnings, bool()}</v>
        <v>dir() = string()</v>
        <v>BinFileName = string()</v>
      </type>
      <desc>
        <marker id="compiler_opts"></marker>
        <p>Compiles the specified MIB file <c><![CDATA[<File>.mib]]></c>.  The
          compiled file <c>BinFileName</c> is called 
          <c><![CDATA[<File>.bin]]></c>. </p>
        <list type="bulleted">
          <item>The option <c>db</c> specifies which database should
           be used for the default instrumentation. Default is
          <c>volatile</c>.
          </item>
          <item>The option <c>deprecated</c> specifies if a deprecated 
           definition should be kept or not. If the option is 
           false the MIB compiler will ignore all deprecated
           definitions. Default is <c>true</c>.
          </item>
          <item>The option <c>description</c> specifies if the text
           of the DESCRIPTION field will be included or not. By default 
           it is not included, but if this option is present it will
           be.
          </item>
          <item>The option <c>reference</c> specifies if the text
           of the REFERENCE field, when found in a table definition, 
           will be included or not. By default 
           it is not included, but if this option is present it will
           be. The reference text will be placed in the allocList field 
           of the mib-entry record (#me{}) for the table.
          </item>
          <item>The option <c>group_check</c> specifies whether the
           mib compiler should check the OBJECT-GROUP macro and
           the NOTIFICATION-GROUP macro for correctness or not.  
           Default is <c>true</c>.
          </item>
          <item>The option <c>i</c> specifies the path to search for
           imported (compiled) MIB files. The directories should be
           strings with a trailing directory delimiter. Default is
          <c>["./"]</c>.
          </item>
          <item>The option <c>il</c> (include_lib) also specifies a
           list of directories to search for imported MIBs. It
           assumes that the first element in the directory name
           corresponds to an OTP application. The compiler will find
           the current installed version. For example, the value
           ["snmp/mibs/"] will be replaced by ["snmp-3.1.1/mibs/"]
           (or what the current version may be in the system). The
           current directory and the <c><![CDATA[<snmp-home>/priv/mibs/]]></c>
           are always listed last in the include path.
          </item>
          <item>The option <c>imports</c>, if present, specifies that the
           IMPORT statement of the MIB shall be included in the compiled mib.
          </item>
          <item>The option <c>module</c>, if present, specifies the
           name of a module which implements all instrumentation
           functions for the MIB.  The name of all instrumentation
           functions must be the same as the corresponding managed
           object it implements.
          </item>
          <item>The option <c>module_identity</c>, if present, specifies 
           that the info part of the MODULE-IDENTITY statement of the MIB 
           shall be included in the compiled mib.
          </item>
          <item>The option <c>no_defs</c>, if present, specifies 
           that if a managed object does not have an instrumentation
           function, the default instrumentation function should NOT
           be used, instead this is reported as an error, and the
           compilation aborts.
          </item>
          <item>The option <c>verbosity</c> specifies the verbosity of
           the SNMP mib compiler. I.e. if warning, info, log, debug 
           and trace messages shall be shown. Default is <c>silence</c>.
           Note that if the option <c>warnings</c> is <c>true</c> and the 
           option <c>verbosity</c> is <c>silence</c>, warning messages will
           still be shown.
          </item>
          <item>The option <c>warnings</c> specifies whether warning
           messages should be shown. Default is <c>true</c>.
          </item>
        </list>
        <p>The MIB compiler understands both SMIv1 and SMIv2 MIBs.  It
          uses the <c>MODULE-IDENTITY</c> statement to determine if the MIB is
          version 1 or 2.
          </p>
        <p>The MIB compiler can be invoked from the OS command line by
          using the command <c>erlc</c>.  <c>erlc</c> recognizes the
          extension <c>.mib</c>, and invokes the SNMP MIB compiler for
          files with that extension. The options <c>db</c>, 
          <c>group_check</c>, <c>deprecated</c>, <c>description</c>,
          <c>verbosity</c>, <c>imports</c> and <c>module_identity</c>
          have to be specified to <c>erlc</c> using the syntax 
          <c>+term</c>.  See <c>erlc(1)</c> for details.
          </p>
      </desc>
    </func>
    <func>
      <name>is_consistent(Mibs) -> ok | {error, Reason}</name>
      <fsummary>Check for OID conflicts between MIBs</fsummary>
      <type>
        <v>Mibs = [MibName]</v>
        <v>MibName = string()</v>
      </type>
      <desc>
        <p>Checks for multiple usage of object identifiers and traps
          between MIBs.
          </p>
      </desc>
    </func>
    <func>
      <name>mib_to_hrl(MibName) -> ok | {error, Reason}</name>
      <fsummary>Generate constants for the objects in the MIB</fsummary>
      <type>
        <v>MibName = string()</v>
      </type>
      <desc>
        <p>Generates a <c>.hrl</c> file with definitions of Erlang
          constants for the objects in the MIB. The <c>.hrl</c> file is
          called <c><![CDATA[<MibName>.hrl]]></c>. The MIB must be compiled, and
          present in the current directory.
          </p>
        <p>The <c>mib_to_hrl</c> generator can be invoked from the OS
          command line by using the command <c>erlc</c>.  <c>erlc</c>
          recognizes the extension <c>.bin</c>, and invokes this function
          for files with that extension.
          </p>
      </desc>
    </func>
  </funcs>

  <section>
    <title>See Also</title>
    <p>erlc(1)
      </p>
  </section>
  
</erlref>