How to get the number of bits from a scalar of type (SYNTAX BITS) in mib2c.conf?
Question
I couldn't find anything in "man mib2c.conf". Is there something like $var.length/$var.size by any chance?
Solution
Well, it doesn't have a size/length. But it does have the enums available from which you could determine the size. Here's a hack that will get you the maximum enum value, which would mean that the size will be that many bits:
@perleval $vars{'max'} = 0@
@foreach $label, $value enums@
@perleval $vars{'max'} = ($vars{'max'} < $vars{'value'} ? $vars{'value'} : $vars{'max'}); return 0;@
@end@
max: $max
When this is put in a loop over the mteTriggreTable columns for example, you get:
...
mteTriggerEnabled:
max: 2
mteTriggerEntryStatus:
max: 6
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow