ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Convert-BER-XS/XS.pm
(Generate patch)

Comparing Convert-BER-XS/XS.pm (file contents):
Revision 1.47 by root, Sun Apr 21 10:40:30 2019 UTC vs.
Revision 1.51 by root, Mon Apr 22 00:53:54 2019 UTC

412use Exporter qw(import); 412use Exporter qw(import);
413 413
414our $VERSION; 414our $VERSION;
415 415
416BEGIN { 416BEGIN {
417 $VERSION = '1.0'; 417 $VERSION = 1.1;
418 XSLoader::load __PACKAGE__, $VERSION; 418 XSLoader::load __PACKAGE__, $VERSION;
419} 419}
420 420
421our %EXPORT_TAGS = ( 421our %EXPORT_TAGS = (
422 const_index => [qw( 422 const_index => [qw(
496Example output: 496Example output:
497 497
498 SEQUENCE 498 SEQUENCE
499 | OCTET_STRING bytes 800063784300454045045400000001 499 | OCTET_STRING bytes 800063784300454045045400000001
500 | OCTET_STRING bytes 500 | OCTET_STRING bytes
501 | CONTEXT (7) bytes CONSTRUCTED 501 | CONTEXT (7) CONSTRUCTED
502 | | INTEGER int 1058588941 502 | | INTEGER int 1058588941
503 | | INTEGER int 0 503 | | INTEGER int 0
504 | | INTEGER int 0 504 | | INTEGER int 0
505 | | SEQUENCE 505 | | SEQUENCE
506 | | | SEQUENCE 506 | | | SEQUENCE
549 $class =~ s/^ASN_//; 549 $class =~ s/^ASN_//;
550 $tag =~ s/^(ASN_|SNMP_)//; 550 $tag =~ s/^(ASN_|SNMP_)//;
551 $type =~ s/^BER_TYPE_//; 551 $type =~ s/^BER_TYPE_//;
552 552
553 if ($ber->[BER_FLAGS]) { 553 if ($ber->[BER_FLAGS]) {
554 printf "$indent%-16.16s %-6.6s CONSTRUCTED\n", $tag, lc $type; 554 printf "$indent%-16.16s\n", $tag;
555 &_ber_dump ($_, $profile, "$indent| ") 555 &_ber_dump ($_, $profile, "$indent| ")
556 for @$data; 556 for @$data;
557 } else { 557 } else {
558 if ($data =~ y/\x20-\x7e//c / (length $data || 1) > 0.2 or $data =~ /\x00./s) { 558 if ($data =~ y/\x20-\x7e//c / (length $data || 1) > 0.2 or $data =~ /\x00./s) {
559 # assume binary 559 # assume binary
560 $data = unpack "H*", $data; 560 $data = unpack "H*", $data;
561 } else { 561 } else {
562 $data =~ s/[^\x20-\x7e]/./g; 562 $data =~ s/[^\x20-\x7e]/./g;
563 $data = "\"$data\"" if $type =~ /string/i || !length $data; 563 $data = "\"$data\"" if $tag =~ /string/i || !length $data;
564 } 564 }
565 565
566 substr $data, 40, 1e9, "..." if 40 < length $data; 566 substr $data, 40, 1e9, "..." if 40 < length $data;
567 567
568 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;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines