--- Net-SNMP-XS/XS.pm 2010/07/29 02:52:07 1.11 +++ Net-SNMP-XS/XS.pm 2019/04/19 15:50:48 1.18 @@ -6,7 +6,12 @@ use Net::SNMP::XS; - # loading it is enough, there are no public symbols + # loading it is enough to speed up Net::SNMP + + # experimental BER decoder + use Net::SNMP::XS ':ber'; + + # TODO =head1 DESCRIPTION @@ -39,14 +44,17 @@ =back +Beginning with version 2, this module also contains a generic BER decoder, +with lacking documentation. More to come, but this might eventually move +to it's own module. + =cut package Net::SNMP::XS; -use strict qw(vars subs); -no warnings; +use common::sense; -use Guard; +use Exporter qw(import); use Net::SNMP (); use Net::SNMP::PDU (); @@ -56,13 +64,26 @@ our $VERSION; BEGIN { - $VERSION = '1.1'; + $VERSION = '2.0'; # this overrides many methods inside Net::SNMP and it's submodules require XSLoader; XSLoader::load Net::SNMP::XS, $VERSION; } +our %EXPORT_TAGS = ( + ber => [qw( + ber_decode + ber_eq ber_seq ber_i32 ber_oid + BER_CLASS BER_TAG BER_CONSTRUCTED BER_DATA + ASN_BOOLEAN ASN_INTEGER32 ASN_BIT_STRING ASN_OCTET_STRING ASN_NULL ASN_OBJECT_IDENTIFIER ASN_TAG_BER ASN_TAG_MASK + ASN_CONSTRUCTED ASN_UNIVERSAL ASN_APPLICATION ASN_CONTEXT ASN_PRIVATE ASN_CLASS_MASK ASN_CLASS_SHIFT + ASN_SEQUENCE ASN_IPADDRESS ASN_COUNTER32 ASN_UNSIGNED32 ASN_TIMETICKS ASN_OPAQUE ASN_COUNTER64 + )], +); + +our @EXPORT_OK = @{ $EXPORT_TAGS{ber} }; + package Net::SNMP::Message; Net::SNMP::XS::set_type INTEGER , \&_process_integer32;