… | |
… | |
4 | |
4 | |
5 | =head1 SYNOPSIS |
5 | =head1 SYNOPSIS |
6 | |
6 | |
7 | use Net::SNMP::XS; |
7 | use Net::SNMP::XS; |
8 | |
8 | |
9 | # loading it is enough, there are no public symbols |
9 | # loading it is enough to speed up Net::SNMP |
|
|
10 | |
|
|
11 | # experimental BER decoder |
|
|
12 | use Net::SNMP::XS ':ber'; |
|
|
13 | |
|
|
14 | # TODO |
10 | |
15 | |
11 | =head1 DESCRIPTION |
16 | =head1 DESCRIPTION |
12 | |
17 | |
13 | This module tries to speed up Net::SNMP response packet decoding. |
18 | This module tries to speed up Net::SNMP response packet decoding. |
14 | |
19 | |
… | |
… | |
37 | |
42 | |
38 | =item REPORT PDUs are not supported |
43 | =item REPORT PDUs are not supported |
39 | |
44 | |
40 | =back |
45 | =back |
41 | |
46 | |
|
|
47 | Beginning with version 2, this module also contains a generic BER decoder, |
|
|
48 | with lacking documentation. More to come, but this might eventually move |
|
|
49 | to it's own module. |
|
|
50 | |
42 | =cut |
51 | =cut |
43 | |
52 | |
44 | package Net::SNMP::XS; |
53 | package Net::SNMP::XS; |
45 | |
54 | |
46 | use common::sense; |
55 | use common::sense; |
|
|
56 | |
|
|
57 | use Exporter qw(import); |
47 | |
58 | |
48 | use Net::SNMP (); |
59 | use Net::SNMP (); |
49 | use Net::SNMP::PDU (); |
60 | use Net::SNMP::PDU (); |
50 | use Net::SNMP::Message (); |
61 | use Net::SNMP::Message (); |
51 | use Net::SNMP::MessageProcessing (); |
62 | use Net::SNMP::MessageProcessing (); |
52 | |
63 | |
53 | our $VERSION; |
64 | our $VERSION; |
54 | |
65 | |
55 | BEGIN { |
66 | BEGIN { |
56 | $VERSION = 1.33; |
67 | $VERSION = '2.0'; |
57 | |
68 | |
58 | # this overrides many methods inside Net::SNMP and it's submodules |
69 | # this overrides many methods inside Net::SNMP and it's submodules |
59 | require XSLoader; |
70 | require XSLoader; |
60 | XSLoader::load Net::SNMP::XS, $VERSION; |
71 | XSLoader::load Net::SNMP::XS, $VERSION; |
61 | } |
72 | } |
|
|
73 | |
|
|
74 | our %EXPORT_TAGS = ( |
|
|
75 | ber => [qw( |
|
|
76 | ber_decode |
|
|
77 | ber_eq ber_seq ber_i32 ber_oid |
|
|
78 | BER_CLASS BER_TAG BER_CONSTRUCTED BER_DATA |
|
|
79 | ASN_BOOLEAN ASN_INTEGER32 ASN_BIT_STRING ASN_OCTET_STRING ASN_NULL ASN_OBJECT_IDENTIFIER ASN_TAG_BER ASN_TAG_MASK |
|
|
80 | ASN_CONSTRUCTED ASN_UNIVERSAL ASN_APPLICATION ASN_CONTEXT ASN_PRIVATE ASN_CLASS_MASK ASN_CLASS_SHIFT |
|
|
81 | ASN_SEQUENCE ASN_IPADDRESS ASN_COUNTER32 ASN_UNSIGNED32 ASN_TIMETICKS ASN_OPAQUE ASN_COUNTER64 |
|
|
82 | )], |
|
|
83 | ); |
|
|
84 | |
|
|
85 | our @EXPORT_OK = @{ $EXPORT_TAGS{ber} }; |
62 | |
86 | |
63 | package Net::SNMP::Message; |
87 | package Net::SNMP::Message; |
64 | |
88 | |
65 | Net::SNMP::XS::set_type INTEGER , \&_process_integer32; |
89 | Net::SNMP::XS::set_type INTEGER , \&_process_integer32; |
66 | Net::SNMP::XS::set_type OCTET_STRING , \&_process_octet_string; |
90 | Net::SNMP::XS::set_type OCTET_STRING , \&_process_octet_string; |