summaryrefslogtreecommitdiff
path: root/local/mib2c.genhtml.conf
blob: b0f6284ba3fd5b8853b50edd4cec950911a95533 (plain)
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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
##
## USAGE:
## mib2c -c mib2c.genhtml.conf STARTINGNODE
##
## Optional extra arguments:
##
##    -S cssfile=file.css         (specifies an alternate CSS style
##                                 file to include in the output)
##
##
## try to strip leading white space from text
##
@define DO_FORMATED_TEXT@
@startperl@
  my ($s) = ($vars{'x'} =~ /\n(\s+)/);
  $vars{'x'} =~ s/^$s//gm;
  0;
@endperl@
<pre>
$x
</pre>
@enddefine@
##
## print a description clause (include TC info and references 
##
@define DO_DESCR@
<td>
@if "$i.perltype" ne "$i.syntax"@
<p>
@eval $tmpsyn = "$i.syntax"@
@perleval if (!defined($TCS{$vars{'tmpsyn'}})) { $TCS{$vars{'tmpsyn'}} = $vars{'i'}; }; 0;@
Note: this object is based on the <a href="#$i.syntax"> $i.syntax TEXTUAL-CONVENTION</a>.
</p>
@end@
@eval $x = "$i.description"@
@calldefine DO_FORMATED_TEXT@
##@startperl@
##  my ($s) = ($vars{'x'} =~ /\n(\s+)/);
##  $vars{'x'} =~ s/^$s//gm;
##  0;
##@endperl@
##<pre>
##$x
##</pre>
@if "$i.reference" ne ""@
@eval $x = "$i.reference"@
<p><i>Also see Reference:
@calldefine DO_FORMATED_TEXT@
</i></p>
@end@
</td>
@enddefine@
##
## print information (a row) about a given node
##
@define NODE_INFO@
@if ("$i.status" eq "Current")@
  <td>
@else@
  <td class="deprecated">
@end@
<a name="$i" />
@eval $tmpi = "$i.parent"@
@if "$doindexstuff" ne "" && "$tmpi.parent" ne "$t"@
(external from $tmpi.parent)
@else@
$i.subid
@end@
<br /><b>$i</b>

</td><td>
##
## print the data type
##
@if ("$i.status" ne "Current")@
<font color="red">DEPRECATED</font><br />
@end@
  $i.perltype
##
## print range information
##
  @if "$i.ranges"@
    @if "$i.perltype" eq 'OCTETSTR' || "$i.perltype" eq 'OBJECTID'@
      <br />Legal Lengths:
    @else@
      <br />Legal values:
    @end@
    @eval $tmpdidit = 0@
    @foreach $st $end range $i@
      @if "$tmpdidit" == "1"@
        ,
      @end@
      @if "$st" eq "$end"@
        $st
      @else@
        $st .. $end
      @end@
      @eval $tmpdidit = 1@
    @end@
  @end@
##
## check for TC vs non-TC cases
##
  @if "$i.perltype" ne "$i.syntax"@
 <br>
 @eval $tmpsyn = "$i.syntax"@
 @perleval if (!defined($TCS{$vars{'tmpsyn'}})) { $TCS{$vars{'tmpsyn'}} = $vars{'i'}; }; 0;@
 <a href="#$i.syntax">$i.syntax</a>
    @if $i.enums@
     <br>(ENUM list below)
    @end@
  @else@
    @if $i.enums@
      <table class="enum">
      <tr><th>Value</th><th>Label/Meaning</th></tr>
      @foreach $e $v enum@
        <tr><td>$v</td><td>$e</td></tr>
      @end@
      </table>
    @end@
  @end@

  </td><td>$i.access</td>
  @if !"$dont_do_oids"@
    <td>$i.objectID</td>
  @end@
  @calldefine DO_DESCR@
@enddefine@
@open ${name}.html@
<head>
  <title>MIB information for $name</title>
<style type="text/css">
@if "$cssfile" ne ""@
@startperl@
open(CSS,$vars{'cssfile'});
while(<CSS>) {
  mib2c_output($_);
}
close(CSS);
0;
@endperl@
@else@
<!--
h2{background:#bbeebb}
h3{background:#ccccee}
table {
 border: 1px;
 background: #dddddd;
 style: outset;
}
th {
 border: 1px;
 border: solid;
 border-style: outset;
 background: #bbbbbb;
}
td {
 border: 1px;
 border: solid;
 border-style: inset;
}
table.enums {
 background: #cccccc;
}
table.deprecated {
 background: #ffdddd;
}
td.deprecated {
 background: #ffdddd;
}
.label {
 border-style: outset;
 background: #bbbbbb;
}
-->
@end@
</style>
</head>
<body bgcolor="#ffffff">
<h2>INTRODUCTION</h2>
<ul>
<p>
This is a summary of information regarding objects below the <b>$name</b>
MIB object, which is defined within the <b>$name.module</b> MIB
document as <b>$name.objectID</b>.
</p>
</ul>
##
## Table of contents
##
<h2>TABLE OF CONTENTS</h2>
<ul>
@foreach $Current stuff Current Deprecated@
<h3><a href="#objects_$Current">$Current Objects</a></h3>
<ul>
@if "$Current" eq "Current"@
<li><a href="#scalar_current">Scalars</a></li>
@else@
<li><a href="#scalar_notcurrent">Deprecated Scalars</a></li>
@end@
@foreach $t table@
@if ("$Current" eq "Current" && "$t.status" eq "Current") || ("$Current" ne "Current" && "$t.status" ne "Current")@
  <li><a href="#$t">$t</a></li>
@end@
@end@
</ul>
@end@
<h3><a href="#notifications">Notifications</a></h3>
<h3><a href="#textconventions">Textual Conventions</a></h3>
<h3><a href="#treeview">Tree-based view</a></h3>
</ul>
##
## Start of definitions
##
@foreach $Current stuff Current Deprecated@
<a name="objects_$Current" />
@if "$Current" ne "Current"@
  @eval $namestring = "notcurrent"@
  <hr />
  <h1><font color="red">DEPRECATED OR OBSOLETE OR HISTORIC OBJECTS</font></h1>
  <br>
  <table class="deprecated"><tr><td>
@else@
  @eval $namestring = "current"@
@end@
<a name="scalar_$namestring" />
<h2>SCALAR OBJECTS</h2>
<ul>
<table>
<tr><th>Name</th><th>Type</th><th>Access</th><th>OID</th><th>Description</th></tr>
@foreach $i scalar@
  @if ("$Current" eq "Current" && "$i.status" eq "Current") || ("$Current" ne "Current" && "$i.status" ne "Current")@
  <tr>
  @calldefine NODE_INFO@
  </tr>
  @end@
@end@
</table>
</ul>

<h2>TABLE OBJECTS</h2>
@eval $dont_do_oids = 1@
@foreach $t table@
@if ("$Current" eq "Current" && "$t.status" eq "Current") || ("$Current" ne "Current" && "$t.status" ne "Current")@
<a name="$t" /><h3>Table $t</h3>
<ul>
  <table>
  <tr><td class="label">Table Name</td><td>$t</td></tr>
  <tr><td class="label">In MIB</td><td>$t.module</td></tr>
  <tr><td class="label">Registered at OID</td><td>$t.objectID</td></tr>
  <tr><td class="label">Table Description</td>
@eval $i ="$t"@
@calldefine DO_DESCR@
</tr>
    @eval $tmpx = $t@
    @perleval $vars{'tmpx'} =~ s/Table/Entry/; 0;@
@eval $i = "$tmpx"@
<tr><td class="label"><a name="$tmpx" />Row Description</td>
@calldefine DO_DESCR@
</tr>
  </table>

  <h4>$t Indexes:</h4>

<table>
<tr class="label"><th>Name</th><th>Type</th><th>Access</th><th>Description</th></tr>
@foreach $i index@
  <tr>
  @calldefine NODE_INFO@
  </tr>
@end@
</table>

  <h4>Other $t Columns:</h4>
<table>
<tr class="label"><th>Name</th><th>Type</th><th>Access</th><th>Description</th></tr>
@foreach $i nonindex@
  <tr>
  @calldefine NODE_INFO@
  </tr>
@end@
</table>
</ul>
@end@
@end@
@end@

<br>
  </table>
<hr />
<a name="notifications" />
<h2>NOTIFICATIONS</h2>
<ul>
<p>
@foreach $i notifications@
<a name="$i" /><h3>Notification: $i</h3>

  <table>
  <tr><td class="label">Notification Name</td><td>$i</td></tr>
  <tr><td class="label">In MIB</td><td>$i.module</td></tr>
  <tr><td class="label">Registered at OID</td><td>$i.objectID</td></tr>
  <tr><td class="label">Notification Description</td>
@calldefine DO_DESCR@
  </tr>
  <tr> <td class="label">Mandatory<br />Objects</td><td>
  <table>
    @foreach $v varbinds@
      <tr><td><a href="#$v">$v</a></td></tr>
    @end@
  </table></td></tr>
  </table>
@end@
</ul>


<br>
<hr />
<a name="textconventions" />
<h2>TEXTUAL CONVENTIONS</h2>
<ul>
<p>
These TEXTUAL-CONVENTIONS are used in other parts of the document
above.  They are SNMP's way of defining a datatype that is used
repeatedly by other MIB objects.  Any implementation implementing
objects that use one of these definitions must follow its DESCRIPTION
clause as well as the DESCRIPTION clause of the object itself.
</p>
@startperl@
mib2c_output("<table>");
mib2c_output("<tr class=\"label\"><th>Name</th><th>Type</th><th>Description</th></tr>\n");
map {
    my $desc = $SNMP::MIB{$TCS{$_}}{'TCDescription'};
      my ($s) = ($desc =~ /\n(\s+)/);
      $desc =~ s/^$s//gm;
    mib2c_output("<tr><td><a name=\"$_\">$_</td><td>");
    mib2c_output($SNMP::MIB{$TCS{$_}}{'type'});
    my @enumkeys = keys(%{$SNMP::MIB{$TCS{$_}}{'enums'}});
    if ($#enumkeys > -1) {
       mib2c_output("<table class=\"enums\">");
       mib2c_output("<tr><th>Value</th><th>Label/Meaning</th></tr>");
       foreach $k (sort { $SNMP::MIB{$TCS{$_}}{'enums'}{$a} <=>
			  $SNMP::MIB{$TCS{$_}}{'enums'}{$b} } @enumkeys) {
            mib2c_output("<tr><td>$SNMP::MIB{$TCS{$_}}{'enums'}{$k}</td><td>$k</td></tr>");
       }
       mib2c_output("</table>");
    }
    mib2c_output("</td><td><pre>$desc</pre></td></tr>\n");
} keys(%TCS); 
mib2c_output("</table>");
0;
@endperl@
</ul>

<a name="treeview" />
<h2>TREE VIEW</h2>
@eval $mod = "$name.module"@
<p>Tree view generated by running: <b>snmptranslate -Tp $mod::$name</b></p>
<pre>
@startperl@
open(TREE,"snmptranslate -Tp $vars{mod}::$vars{name}|");
while(<TREE>) {
  s/(\+-- .*\s)(\w+)(\(\d+\))$/$1<a href="#$2">$2<\/a>$3/;
  s/\+--(\w+)/+--<a href="#$1">$1<\/a>/;
  s/Textual Convention: (\w+)/Textual Convention: <a href="#$1">$1<\/a>/;
  mib2c_output($_);
}
close(TREE);
return 0;
@endperl@
</pre>