… | |
… | |
41 | |
41 | |
42 | =cut |
42 | =cut |
43 | |
43 | |
44 | package Net::SNMP::XS; |
44 | package Net::SNMP::XS; |
45 | |
45 | |
46 | use strict qw(vars subs); |
46 | use common::sense; |
47 | no warnings; |
|
|
48 | |
|
|
49 | use Guard; |
|
|
50 | |
47 | |
51 | use Net::SNMP (); |
48 | use Net::SNMP (); |
52 | use Net::SNMP::PDU (); |
49 | use Net::SNMP::PDU (); |
53 | use Net::SNMP::Message (); |
50 | use Net::SNMP::Message (); |
54 | use Net::SNMP::MessageProcessing (); |
51 | use Net::SNMP::MessageProcessing (); |
55 | |
52 | |
56 | our $VERSION; |
53 | our $VERSION; |
57 | our $old_prepare; |
|
|
58 | |
54 | |
59 | BEGIN { |
55 | BEGIN { |
60 | $VERSION = '0.03'; |
56 | $VERSION = 1.32; |
61 | |
57 | |
62 | $old_prepare = \&Net::SNMP::MessageProcessing::prepare_data_elements; |
58 | # this overrides many methods inside Net::SNMP and it's submodules |
63 | |
|
|
64 | # this overrides many methods inside |
|
|
65 | require XSLoader; |
59 | require XSLoader; |
66 | XSLoader::load Net::SNMP::XS, $VERSION; |
60 | XSLoader::load Net::SNMP::XS, $VERSION; |
67 | } |
|
|
68 | |
|
|
69 | sub Net::SNMP::MessageProcessing::prepare_data_elements { |
|
|
70 | my ($self, $msg) = @_; |
|
|
71 | |
|
|
72 | set_msg $msg, $msg->{_buffer}; |
|
|
73 | scope_guard \&clr_msg; |
|
|
74 | &$old_prepare |
|
|
75 | } |
61 | } |
76 | |
62 | |
77 | package Net::SNMP::Message; |
63 | package Net::SNMP::Message; |
78 | |
64 | |
79 | Net::SNMP::XS::set_type INTEGER , \&_process_integer32; |
65 | Net::SNMP::XS::set_type INTEGER , \&_process_integer32; |
… | |
… | |
100 | Net::SNMP::XS::set_type SNMPV2_TRAP , \&_process_v2_trap; |
86 | Net::SNMP::XS::set_type SNMPV2_TRAP , \&_process_v2_trap; |
101 | Net::SNMP::XS::set_type REPORT , \&_process_report; |
87 | Net::SNMP::XS::set_type REPORT , \&_process_report; |
102 | |
88 | |
103 | package Net::SNMP::PDU; |
89 | package Net::SNMP::PDU; |
104 | |
90 | |
105 | # var_bind_list hardcodes oid_lext_sort. *sigh* |
91 | # var_bind_list hardcodes oid_lex_sort. *sigh* |
106 | # we copy it 1:1, except for using oid_lex_sort. |
92 | # we copy it 1:1, except for using oid_lex_sort. |
107 | |
93 | |
108 | sub var_bind_list |
94 | sub var_bind_list |
109 | { |
95 | { |
110 | my ($this, $vbl, $types) = @_; |
96 | my ($this, $vbl, $types) = @_; |