##
## 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@
$x
@enddefine@
##
## print a description clause (include TC info and references
##
@define DO_DESCR@
@if "$i.perltype" ne "$i.syntax"@
@eval $tmpsyn = "$i.syntax"@
@perleval if (!defined($TCS{$vars{'tmpsyn'}})) { $TCS{$vars{'tmpsyn'}} = $vars{'i'}; }; 0;@
Note: this object is based on the $i.syntax TEXTUAL-CONVENTION.
@end@
@eval $x = "$i.description"@
@calldefine DO_FORMATED_TEXT@
##@startperl@
## my ($s) = ($vars{'x'} =~ /\n(\s+)/);
## $vars{'x'} =~ s/^$s//gm;
## 0;
##@endperl@
##
##$x
##
@if "$i.reference" ne ""@
@eval $x = "$i.reference"@
Also see Reference:
@calldefine DO_FORMATED_TEXT@
@end@
|
@enddefine@
##
## print information (a row) about a given node
##
@define NODE_INFO@
@if ("$i.status" eq "Current")@
@else@
|
@end@
@eval $tmpi = "$i.parent"@
@if "$doindexstuff" ne "" && "$tmpi.parent" ne "$t"@
(external from $tmpi.parent)
@else@
$i.subid
@end@
$i
|
##
## print the data type
##
@if ("$i.status" ne "Current")@
DEPRECATED
@end@
$i.perltype
##
## print range information
##
@if "$i.ranges"@
@if "$i.perltype" eq 'OCTETSTR' || "$i.perltype" eq 'OBJECTID'@
Legal Lengths:
@else@
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"@
@eval $tmpsyn = "$i.syntax"@
@perleval if (!defined($TCS{$vars{'tmpsyn'}})) { $TCS{$vars{'tmpsyn'}} = $vars{'i'}; }; 0;@
$i.syntax
@if $i.enums@
(ENUM list below)
@end@
@else@
@if $i.enums@
Value | Label/Meaning |
@foreach $e $v enum@
$v | $e |
@end@
@end@
@end@
| $i.access |
@if !"$dont_do_oids"@
$i.objectID |
@end@
@calldefine DO_DESCR@
@enddefine@
@open ${name}.html@
MIB information for $name
INTRODUCTION
This is a summary of information regarding objects below the $name
MIB object, which is defined within the $name.module MIB
document as $name.objectID.
##
## Table of contents
##
TABLE OF CONTENTS
@foreach $Current stuff Current Deprecated@
@if "$Current" eq "Current"@
- Scalars
@else@
- Deprecated Scalars
@end@
@foreach $t table@
@if ("$Current" eq "Current" && "$t.status" eq "Current") || ("$Current" ne "Current" && "$t.status" ne "Current")@
- $t
@end@
@end@
@end@
##
## Start of definitions
##
@foreach $Current stuff Current Deprecated@
@if "$Current" ne "Current"@
@eval $namestring = "notcurrent"@
DEPRECATED OR OBSOLETE OR HISTORIC OBJECTS
@else@
@eval $namestring = "current"@
@end@
SCALAR OBJECTS
Name | Type | Access | OID | Description |
@foreach $i scalar@
@if ("$Current" eq "Current" && "$i.status" eq "Current") || ("$Current" ne "Current" && "$i.status" ne "Current")@
@calldefine NODE_INFO@
@end@
@end@
TABLE OBJECTS
@eval $dont_do_oids = 1@
@foreach $t table@
@if ("$Current" eq "Current" && "$t.status" eq "Current") || ("$Current" ne "Current" && "$t.status" ne "Current")@
Table $t
Table Name | $t |
In MIB | $t.module |
Registered at OID | $t.objectID |
Table Description |
@eval $i ="$t"@
@calldefine DO_DESCR@
@eval $tmpx = $t@
@perleval $vars{'tmpx'} =~ s/Table/Entry/; 0;@
@eval $i = "$tmpx"@
Row Description |
@calldefine DO_DESCR@
$t Indexes:
Name | Type | Access | Description |
@foreach $i index@
@calldefine NODE_INFO@
@end@
Other $t Columns:
Name | Type | Access | Description |
@foreach $i nonindex@
@calldefine NODE_INFO@
@end@
@end@
@end@
@end@
|
NOTIFICATIONS
TEXTUAL CONVENTIONS
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.
@startperl@
mib2c_output("");
mib2c_output("Name | Type | Description |
\n");
map {
my $desc = $SNMP::MIB{$TCS{$_}}{'TCDescription'};
my ($s) = ($desc =~ /\n(\s+)/);
$desc =~ s/^$s//gm;
mib2c_output("$_ | ");
mib2c_output($SNMP::MIB{$TCS{$_}}{'type'});
my @enumkeys = keys(%{$SNMP::MIB{$TCS{$_}}{'enums'}});
if ($#enumkeys > -1) {
mib2c_output("");
mib2c_output("Value | Label/Meaning | ");
foreach $k (sort { $SNMP::MIB{$TCS{$_}}{'enums'}{$a} <=>
$SNMP::MIB{$TCS{$_}}{'enums'}{$b} } @enumkeys) {
mib2c_output("$SNMP::MIB{$TCS{$_}}{'enums'}{$k} | $k | ");
}
mib2c_output(" ");
}
mib2c_output(" | $desc |
\n");
} keys(%TCS);
mib2c_output("
");
0;
@endperl@
TREE VIEW
@eval $mod = "$name.module"@
Tree view generated by running: snmptranslate -Tp $mod::$name
@startperl@
open(TREE,"snmptranslate -Tp $vars{mod}::$vars{name}|");
while() {
s/(\+-- .*\s)(\w+)(\(\d+\))$/$1$2<\/a>$3/;
s/\+--(\w+)/+--$1<\/a>/;
s/Textual Convention: (\w+)/Textual Convention: $1<\/a>/;
mib2c_output($_);
}
close(TREE);
return 0;
@endperl@