… | |
… | |
393 | use Exporter qw(import); |
393 | use Exporter qw(import); |
394 | |
394 | |
395 | our $VERSION; |
395 | our $VERSION; |
396 | |
396 | |
397 | BEGIN { |
397 | BEGIN { |
398 | $VERSION = 0.8; |
398 | $VERSION = 0.9; |
399 | XSLoader::load __PACKAGE__, $VERSION; |
399 | XSLoader::load __PACKAGE__, $VERSION; |
400 | } |
400 | } |
401 | |
401 | |
402 | our %EXPORT_TAGS = ( |
402 | our %EXPORT_TAGS = ( |
403 | const_index => [qw( |
403 | const_index => [qw( |
… | |
… | |
582 | C<BER_TYPE_BYTES>. When you don't want that but instead prefer a hard |
582 | C<BER_TYPE_BYTES>. When you don't want that but instead prefer a hard |
583 | error for some types, then C<BER_TYPE_CROAK> is for you. |
583 | error for some types, then C<BER_TYPE_CROAK> is for you. |
584 | |
584 | |
585 | =back |
585 | =back |
586 | |
586 | |
|
|
587 | =head2 Example Profile |
|
|
588 | |
|
|
589 | The following creates a profile suitable for SNMP - it's exactly identical |
|
|
590 | to the C<$Convert::BER::XS::SNMP_PROFILE> profile. |
|
|
591 | |
|
|
592 | our $SNMP_PROFILE = new Convert::BER::XS::Profile; |
|
|
593 | |
|
|
594 | $SNMP_PROFILE->set (ASN_APPLICATION, SNMP_IPADDRESS , BER_TYPE_IPADDRESS); |
|
|
595 | $SNMP_PROFILE->set (ASN_APPLICATION, SNMP_COUNTER32 , BER_TYPE_INT); |
|
|
596 | $SNMP_PROFILE->set (ASN_APPLICATION, SNMP_UNSIGNED32, BER_TYPE_INT); |
|
|
597 | $SNMP_PROFILE->set (ASN_APPLICATION, SNMP_TIMETICKS , BER_TYPE_INT); |
|
|
598 | $SNMP_PROFILE->set (ASN_APPLICATION, SNMP_OPAQUE , BER_TYPE_IPADDRESS); |
|
|
599 | $SNMP_PROFILE->set (ASN_APPLICATION, SNMP_COUNTER64 , BER_TYPE_INT); |
|
|
600 | |
587 | =cut |
601 | =cut |
588 | |
602 | |
589 | our $DEFAULT_PROFILE = new Convert::BER::XS::Profile; |
603 | our $DEFAULT_PROFILE = new Convert::BER::XS::Profile; |
590 | our $SNMP_PROFILE = new Convert::BER::XS::Profile; |
604 | |
|
|
605 | $DEFAULT_PROFILE->_set_default; |
591 | |
606 | |
592 | # additional SNMP application types |
607 | # additional SNMP application types |
|
|
608 | our $SNMP_PROFILE = new Convert::BER::XS::Profile; |
|
|
609 | |
593 | $SNMP_PROFILE->set (ASN_APPLICATION, SNMP_IPADDRESS , BER_TYPE_IPADDRESS); |
610 | $SNMP_PROFILE->set (ASN_APPLICATION, SNMP_IPADDRESS , BER_TYPE_IPADDRESS); |
594 | $SNMP_PROFILE->set (ASN_APPLICATION, SNMP_COUNTER32 , BER_TYPE_INT); |
611 | $SNMP_PROFILE->set (ASN_APPLICATION, SNMP_COUNTER32 , BER_TYPE_INT); |
595 | $SNMP_PROFILE->set (ASN_APPLICATION, SNMP_UNSIGNED32, BER_TYPE_INT); |
612 | $SNMP_PROFILE->set (ASN_APPLICATION, SNMP_UNSIGNED32, BER_TYPE_INT); |
596 | $SNMP_PROFILE->set (ASN_APPLICATION, SNMP_TIMETICKS , BER_TYPE_INT); |
613 | $SNMP_PROFILE->set (ASN_APPLICATION, SNMP_TIMETICKS , BER_TYPE_INT); |
597 | $SNMP_PROFILE->set (ASN_APPLICATION, SNMP_OPAQUE , BER_TYPE_IPADDRESS); |
614 | $SNMP_PROFILE->set (ASN_APPLICATION, SNMP_OPAQUE , BER_TYPE_IPADDRESS); |
598 | $SNMP_PROFILE->set (ASN_APPLICATION, SNMP_COUNTER64 , BER_TYPE_INT); |
615 | $SNMP_PROFILE->set (ASN_APPLICATION, SNMP_COUNTER64 , BER_TYPE_INT); |
599 | |
616 | |
600 | $DEFAULT_PROFILE->_set_default; |
|
|
601 | |
|
|
602 | 1; |
617 | 1; |
603 | |
618 | |
604 | =head2 LIMITATIONS/NOTES |
619 | =head2 LIMITATIONS/NOTES |
605 | |
620 | |
606 | This module can only en-/decode 64 bit signed and unsigned integers, and |
621 | This module can only en-/decode 64 bit signed and unsigned integers, and |
… | |
… | |
619 | Constructed strings are decoded just fine, but there should be a way to |
634 | Constructed strings are decoded just fine, but there should be a way to |
620 | join them for convenience. |
635 | join them for convenience. |
621 | |
636 | |
622 | REAL values are not supported and will currently croak. |
637 | REAL values are not supported and will currently croak. |
623 | |
638 | |
|
|
639 | The encoder and decoder tend to accept more formats than should be |
|
|
640 | strictly supported. |
|
|
641 | |
624 | This module has undergone little to no testing so far. |
642 | This module has undergone little to no testing so far. |
625 | |
643 | |
626 | =head2 ITHREADS SUPPORT |
644 | =head2 ITHREADS SUPPORT |
627 | |
645 | |
628 | This module is unlikely to work when the (officially discouraged) ithreads |
646 | This module is unlikely to work when the (officially discouraged) ithreads |