… | |
… | |
52 | use Net::SNMP::PDU (); |
52 | use Net::SNMP::PDU (); |
53 | use Net::SNMP::Message (); |
53 | use Net::SNMP::Message (); |
54 | use Net::SNMP::MessageProcessing (); |
54 | use Net::SNMP::MessageProcessing (); |
55 | |
55 | |
56 | our $VERSION; |
56 | our $VERSION; |
57 | our $old_prepare; |
|
|
58 | |
57 | |
59 | BEGIN { |
58 | BEGIN { |
60 | $VERSION = '0.03'; |
59 | $VERSION = '1.0'; |
61 | |
60 | |
62 | $old_prepare = \&Net::SNMP::MessageProcessing::prepare_data_elements; |
61 | # this overrides many methods inside Net::SNMP and it's submodules |
63 | |
|
|
64 | # this overrides many methods inside |
|
|
65 | require XSLoader; |
62 | require XSLoader; |
66 | XSLoader::load Net::SNMP::XS, $VERSION; |
63 | 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 | } |
64 | } |
76 | |
65 | |
77 | package Net::SNMP::Message; |
66 | package Net::SNMP::Message; |
78 | |
67 | |
79 | Net::SNMP::XS::set_type INTEGER , \&_process_integer32; |
68 | Net::SNMP::XS::set_type INTEGER , \&_process_integer32; |
… | |
… | |
100 | Net::SNMP::XS::set_type SNMPV2_TRAP , \&_process_v2_trap; |
89 | Net::SNMP::XS::set_type SNMPV2_TRAP , \&_process_v2_trap; |
101 | Net::SNMP::XS::set_type REPORT , \&_process_report; |
90 | Net::SNMP::XS::set_type REPORT , \&_process_report; |
102 | |
91 | |
103 | package Net::SNMP::PDU; |
92 | package Net::SNMP::PDU; |
104 | |
93 | |
105 | # var_bind_list hardcodes oid_lext_sort. *sigh* |
94 | # var_bind_list hardcodes oid_lex_sort. *sigh* |
106 | # we copy it 1:1, except for using oid_lex_sort. |
95 | # we copy it 1:1, except for using oid_lex_sort. |
107 | |
96 | |
108 | sub var_bind_list |
97 | sub var_bind_list |
109 | { |
98 | { |
110 | my ($this, $vbl, $types) = @_; |
99 | my ($this, $vbl, $types) = @_; |