- ##
- ## 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@
- <td>
- <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>
- $i.perltype
- @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 border=2 bgcolor="#cccccc">
- <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">
- <!--
- h2{background:#bbeebb}
- h3{background:#ccccee}
- -->
- </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 bgcolor="#ffdddd" border=1><tr><td>
- @else@
- @eval $namestring = "current"@
- @end@
- <a name="scalar_$namestring" />
- <h2>SCALAR OBJECTS</h2>
- <ul>
- <table border=2 bgcolor="#dddddd">
- <tr bgcolor="#bbbbbb"><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 border=2 bgcolor="#dddddd">
- <tr><td bgcolor="#bbbbbb">Table Name</td><td>$t</td></tr>
- <tr><td bgcolor="#bbbbbb">In MIB</td><td>$t.module</td></tr>
- <tr><td bgcolor="#bbbbbb">Registered at OID</td><td>$t.objectID</td></tr>
- <tr><td bgcolor="#bbbbbb">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 bgcolor="#bbbbbb"><a name="$tmpx" />Row Description</td>
- @calldefine DO_DESCR@
- </tr>
- </table>
- <h4>$t Indexes:</h4>
- <table border=2 bgcolor="#dddddd">
- <tr bgcolor="#bbbbbb"><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 border=2 bgcolor="#dddddd">
- <tr bgcolor="#bbbbbb"><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 border=2 bgcolor="#dddddd">
- <tr><td bgcolor="#bbbbbb">Notification Name</td><td>$i</td></tr>
- <tr><td bgcolor="#bbbbbb">In MIB</td><td>$i.module</td></tr>
- <tr><td bgcolor="#bbbbbb">Registered at OID</td><td>$i.objectID</td></tr>
- <tr><td bgcolor="#bbbbbb">Notification Description</td>
- @calldefine DO_DESCR@
- </tr>
- <tr> <td bgcolor="#bbbbbb">Mandatory<br />Objects</td><td>
- <table border=2>
- @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 border=2 bgcolor="#dddddd">");
- mib2c_output("<tr bgcolor="bbbbbb"><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 border=2 bgcolor="#cccccc">");
- 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>