… | |
… | |
505 | | | SEQUENCE |
505 | | | SEQUENCE |
506 | | | | SEQUENCE |
506 | | | | SEQUENCE |
507 | | | | | OID oid 1.3.6.1.2.1.1.3.0 |
507 | | | | | OID oid 1.3.6.1.2.1.1.3.0 |
508 | | | | | TIMETICKS int 638085796 |
508 | | | | | TIMETICKS int 638085796 |
509 | |
509 | |
|
|
510 | =back |
|
|
511 | |
510 | =cut |
512 | =cut |
511 | |
513 | |
512 | # reverse enum, very slow and ugly hack |
514 | # reverse enum, very slow and ugly hack |
513 | sub _re { |
515 | sub _re { |
514 | my ($export_tag, $value) = @_; |
516 | my ($export_tag, $value) = @_; |
… | |
… | |
551 | if ($ber->[BER_FLAGS]) { |
553 | if ($ber->[BER_FLAGS]) { |
552 | printf "$indent%-16.16s %-6.6s CONSTRUCTED\n", $tag, lc $type; |
554 | printf "$indent%-16.16s %-6.6s CONSTRUCTED\n", $tag, lc $type; |
553 | &_ber_dump ($_, $profile, "$indent| ") |
555 | &_ber_dump ($_, $profile, "$indent| ") |
554 | for @$data; |
556 | for @$data; |
555 | } else { |
557 | } else { |
556 | if ($data =~ y/\x20-\x7e//c / length $data > 0.2 or $data =~ /\x00./s) { |
558 | if ($data =~ y/\x20-\x7e//c / (length $data || 1) > 0.2 or $data =~ /\x00./s) { |
557 | # assume binary |
559 | # assume binary |
558 | $data = unpack "H*", $data; |
560 | $data = unpack "H*", $data; |
559 | substr $data, 40, 1e9, "..." if 40 < length $data; |
|
|
560 | } else { |
561 | } else { |
561 | $data =~ s/[^\x20-\x7e]/./g; |
562 | $data =~ s/[^\x20-\x7e]/./g; |
562 | $data = "\"$data\"" if $type =~ /string/i; |
563 | $data = "\"$data\"" if $type =~ /string/i || !length $data; |
563 | substr $data, 40, 1e9, "..." if 40 < length $data; |
|
|
564 | } |
564 | } |
|
|
565 | |
|
|
566 | substr $data, 40, 1e9, "..." if 40 < length $data; |
565 | |
567 | |
566 | printf "$indent%-16.16s %-6.6s %s\n", $tag, lc $type, $data; |
568 | printf "$indent%-16.16s %-6.6s %s\n", $tag, lc $type, $data; |
567 | } |
569 | } |
568 | } |
570 | } |
569 | } |
571 | } |
… | |
… | |
735 | $SNMP_PROFILE->set (ASN_APPLICATION, SNMP_COUNTER64 , BER_TYPE_INT); |
737 | $SNMP_PROFILE->set (ASN_APPLICATION, SNMP_COUNTER64 , BER_TYPE_INT); |
736 | |
738 | |
737 | =head2 LIMITATIONS/NOTES |
739 | =head2 LIMITATIONS/NOTES |
738 | |
740 | |
739 | This module can only en-/decode 64 bit signed and unsigned integers, and |
741 | This module can only en-/decode 64 bit signed and unsigned integers, and |
740 | only when your perl supports those. |
742 | only when your perl supports those. So no UUID OIDs for now. |
741 | |
743 | |
742 | This module does not generally care about ranges, i.e. it will happily |
744 | This module does not generally care about ranges, i.e. it will happily |
743 | de-/encode 64 bit integers into an C<ASN_INTEGER> value, or a negative |
745 | de-/encode 64 bit integers into an C<ASN_INTEGER> value, or a negative |
744 | number into an C<SNMP_COUNTER64>. |
746 | number into an C<SNMP_COUNTER64>. |
745 | |
747 | |