Deleted Added
full compact
gensnmptree.1 (142810) gensnmptree.1 (150920)
1.\"
1.\"
2.\" Copyright (c) 2001-2003
2.\" Copyright (c) 2001-2005
3.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus).
4.\" All rights reserved.
5.\"
6.\" Author: Harti Brandt <harti@freebsd.org>
7.\"
8.\" Redistribution and use in source and binary forms, with or without
9.\" modification, are permitted provided that the following conditions
10.\" are met:
11.\" 1. Redistributions of source code must retain the above copyright
12.\" notice, this list of conditions and the following disclaimer.
13.\" 2. Redistributions in binary form must reproduce the above copyright
14.\" notice, this list of conditions and the following disclaimer in the
15.\" documentation and/or other materials provided with the distribution.
16.\"
17.\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
21.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27.\" SUCH DAMAGE.
28.\"
3.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus).
4.\" All rights reserved.
5.\"
6.\" Author: Harti Brandt <harti@freebsd.org>
7.\"
8.\" Redistribution and use in source and binary forms, with or without
9.\" modification, are permitted provided that the following conditions
10.\" are met:
11.\" 1. Redistributions of source code must retain the above copyright
12.\" notice, this list of conditions and the following disclaimer.
13.\" 2. Redistributions in binary form must reproduce the above copyright
14.\" notice, this list of conditions and the following disclaimer in the
15.\" documentation and/or other materials provided with the distribution.
16.\"
17.\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
21.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27.\" SUCH DAMAGE.
28.\"
29.\" $Begemot: bsnmp/gensnmptree/gensnmptree.1,v 1.4 2005/02/25 11:55:56 brandt_h Exp $
29.\" $Begemot: bsnmp/gensnmptree/gensnmptree.1,v 1.5 2005/06/15 11:31:25 brandt_h Exp $
30.\"
30.\"
31.Dd October 7, 2003
31.Dd June 14, 2005
32.Dt GENSNMPTREE 1
33.Os
34.Sh NAME
35.Nm gensnmptree
36.Nd "generate C and header files from a MIB description file"
37.Sh SYNOPSIS
38.Nm
39.Op Fl helt
40.Op Fl p Ar prefix
41.Op Ar name Ar ...
42.Sh DESCRIPTION
43The
44.Nm
45utility is used to either generate C language tables and header files from
32.Dt GENSNMPTREE 1
33.Os
34.Sh NAME
35.Nm gensnmptree
36.Nd "generate C and header files from a MIB description file"
37.Sh SYNOPSIS
38.Nm
39.Op Fl helt
40.Op Fl p Ar prefix
41.Op Ar name Ar ...
42.Sh DESCRIPTION
43The
44.Nm
45utility is used to either generate C language tables and header files from
46a MIB description or to numeric OIDs from MIB descriptions. The first form
47is used only for maintaining the
46a MIB description or to numeric OIDs from MIB descriptions.
47The first form is used only for maintaining the
48.Xr snmpd 1
49daemon or for module writers.
50The second form may be used by SNMP client program writers.
51.Pp
52If the
53.Fl e
54option is not used
55.Nm
56reads a MIB description from its standard input and creates two files: a
57C-file
58.Ar prefix Ns tree.c
59containing a table used by
60.Xr snmpd 1
61during PDU processing
62and a header file
63.Ar prefix Ns tree.h
64containing appropriate declarations of the callback functions used in this table
65and the table itself.
66.Pp
67If the
68.Fl e
69option is specified
70.Nm
71expects MIB variable names (only the last component) on its command line.
72It reads a MIB specification from standard input and for each MIB variable
48.Xr snmpd 1
49daemon or for module writers.
50The second form may be used by SNMP client program writers.
51.Pp
52If the
53.Fl e
54option is not used
55.Nm
56reads a MIB description from its standard input and creates two files: a
57C-file
58.Ar prefix Ns tree.c
59containing a table used by
60.Xr snmpd 1
61during PDU processing
62and a header file
63.Ar prefix Ns tree.h
64containing appropriate declarations of the callback functions used in this table
65and the table itself.
66.Pp
67If the
68.Fl e
69option is specified
70.Nm
71expects MIB variable names (only the last component) on its command line.
72It reads a MIB specification from standard input and for each MIB variable
73name emits two C preprocessor defines on its standard output. One define
73name emits two C preprocessor defines on its standard output.
74One define
74.Va OID_ Ns Ar name
75can be used as an array initialized to initialize a
76.Va struct asn_oid .
77The other define
78.Va OIDLEN_ Ns Ar name
79contains the length of the OID.
80.Pp
81The options are as follows:
82.Bl -tag -width ".Fl d Ar argument"
83.It Fl h
84Print a short help page.
85.It Fl e
86Enter extract mode.
87.It Fl l
75.Va OID_ Ns Ar name
76can be used as an array initialized to initialize a
77.Va struct asn_oid .
78The other define
79.Va OIDLEN_ Ns Ar name
80contains the length of the OID.
81.Pp
82The options are as follows:
83.Bl -tag -width ".Fl d Ar argument"
84.It Fl h
85Print a short help page.
86.It Fl e
87Enter extract mode.
88.It Fl l
88Generate local preprocessor includes. This is used for bootstrapping
89Generate local preprocessor includes.
90This is used for bootstrapping
89.Xr snmpd 1 .
90.It Fl t
91Instead of normal output print the resulting tree.
92.It Fl p Ar prefix
93Prefix the file names and the table name with
94.Ar prefix .
95.El
96.Sh MIBS
97The syntax of the MIB description file can formally be specified as follows:
98.Bd -unfilled -offset indent
99file := tree | tree file
100
101tree := head elements ')'
102
103entry := head ':' index STRING elements ')'
104
105leaf := head TYPE STRING ACCESS ')'
106
107column := head TYPE ACCESS ')'
108
109head := '(' INT STRING
110
111elements := EMPTY | elements element
112
113element := tree | leaf
114
115index := TYPE | index TYPE
116.Ed
117.Pp
118.Ar TYPE
119specifies a SNMP data type and may be one of
120.Bl -bullet -offset indent -compact
121.It
122NULL
123.It
124INTEGER
125.It
126INTEGER32 (same as INTEGER)
127.It
128UNSIGNED32 (same as GAUGE)
129.It
130OCTETSTRING
131.It
132IPADDRESS
133.It
134OID
135.It
136TIMETICKS
137.It
138COUNTER
139.It
140GAUGE
141.It
142COUNTER64
143.El
144.Pp
145.Ar ACCESS
146specifies the accessibility of the MIB variable (which operation can be
147performed) and is one of
148.Bl -bullet -offset indent -compact
149.It
150GET
151.It
152SET
153.El
154.Pp
155.Ar INT
156is a decimal integer and
157.Ar STRING
158is any string starting with a letter or underscore and consisting of
159letters, digits and underscores, that is not one of the keywords.
160.Sh EXAMPLES
161The following MIB description describes the system group:
162.Bd -literal -offset indent
163(1 internet
164 (2 mgmt
165 (1 mibII
166 (1 system
167 (1 sysDescr OCTETSTRING op_system_group GET)
168 (2 sysObjectId OID op_system_group GET)
169 (3 sysUpTime TIMETICKS op_system_group GET)
170 (4 sysContact OCTETSTRING op_system_group GET SET)
171 (5 sysName OCTETSTRING op_system_group GET SET)
172 (6 sysLocation OCTETSTRING op_system_group GET SET)
173 (7 sysServices INTEGER op_system_group GET)
174 (8 sysORLastChange TIMETICKS op_system_group GET)
175 (9 sysORTable
176 (1 sysOREntry : INTEGER op_or_table
177 (1 sysORIndex INTEGER)
178 (2 sysORID OID GET)
179 (3 sysORDescr OCTETSTRING GET)
180 (4 sysORUpTime TIMETICKS GET)
181 ))
182 )
183 )
184 )
185)
186.Ed
187.Sh SEE ALSO
188.Xr snmpd 1
189.Sh AUTHORS
190.An Hartmut Brandt Aq harti@freebsd.org
91.Xr snmpd 1 .
92.It Fl t
93Instead of normal output print the resulting tree.
94.It Fl p Ar prefix
95Prefix the file names and the table name with
96.Ar prefix .
97.El
98.Sh MIBS
99The syntax of the MIB description file can formally be specified as follows:
100.Bd -unfilled -offset indent
101file := tree | tree file
102
103tree := head elements ')'
104
105entry := head ':' index STRING elements ')'
106
107leaf := head TYPE STRING ACCESS ')'
108
109column := head TYPE ACCESS ')'
110
111head := '(' INT STRING
112
113elements := EMPTY | elements element
114
115element := tree | leaf
116
117index := TYPE | index TYPE
118.Ed
119.Pp
120.Ar TYPE
121specifies a SNMP data type and may be one of
122.Bl -bullet -offset indent -compact
123.It
124NULL
125.It
126INTEGER
127.It
128INTEGER32 (same as INTEGER)
129.It
130UNSIGNED32 (same as GAUGE)
131.It
132OCTETSTRING
133.It
134IPADDRESS
135.It
136OID
137.It
138TIMETICKS
139.It
140COUNTER
141.It
142GAUGE
143.It
144COUNTER64
145.El
146.Pp
147.Ar ACCESS
148specifies the accessibility of the MIB variable (which operation can be
149performed) and is one of
150.Bl -bullet -offset indent -compact
151.It
152GET
153.It
154SET
155.El
156.Pp
157.Ar INT
158is a decimal integer and
159.Ar STRING
160is any string starting with a letter or underscore and consisting of
161letters, digits and underscores, that is not one of the keywords.
162.Sh EXAMPLES
163The following MIB description describes the system group:
164.Bd -literal -offset indent
165(1 internet
166 (2 mgmt
167 (1 mibII
168 (1 system
169 (1 sysDescr OCTETSTRING op_system_group GET)
170 (2 sysObjectId OID op_system_group GET)
171 (3 sysUpTime TIMETICKS op_system_group GET)
172 (4 sysContact OCTETSTRING op_system_group GET SET)
173 (5 sysName OCTETSTRING op_system_group GET SET)
174 (6 sysLocation OCTETSTRING op_system_group GET SET)
175 (7 sysServices INTEGER op_system_group GET)
176 (8 sysORLastChange TIMETICKS op_system_group GET)
177 (9 sysORTable
178 (1 sysOREntry : INTEGER op_or_table
179 (1 sysORIndex INTEGER)
180 (2 sysORID OID GET)
181 (3 sysORDescr OCTETSTRING GET)
182 (4 sysORUpTime TIMETICKS GET)
183 ))
184 )
185 )
186 )
187)
188.Ed
189.Sh SEE ALSO
190.Xr snmpd 1
191.Sh AUTHORS
192.An Hartmut Brandt Aq harti@freebsd.org