… | |
… | |
22 | |
22 | |
23 | =over 4 |
23 | =over 4 |
24 | |
24 | |
25 | =item overriding internal functions might cause the module to |
25 | =item overriding internal functions might cause the module to |
26 | malfunction with future versions of Net::SNMP |
26 | malfunction with future versions of Net::SNMP |
27 | |
|
|
28 | =item only leading dots for oids are supported |
|
|
29 | |
27 | |
30 | =item error messages will be simpler/different |
28 | =item error messages will be simpler/different |
31 | |
29 | |
32 | =item translation will be ignored (all values will be delivered "raw") |
30 | =item translation will be ignored (all values will be delivered "raw") |
33 | |
31 | |
… | |
… | |
54 | use Net::SNMP::PDU (); |
52 | use Net::SNMP::PDU (); |
55 | use Net::SNMP::Message (); |
53 | use Net::SNMP::Message (); |
56 | use Net::SNMP::MessageProcessing (); |
54 | use Net::SNMP::MessageProcessing (); |
57 | |
55 | |
58 | our $VERSION; |
56 | our $VERSION; |
59 | our $old_prepare; |
|
|
60 | |
57 | |
61 | BEGIN { |
58 | BEGIN { |
62 | $VERSION = '0.02'; |
59 | $VERSION = '1.1'; |
63 | |
60 | |
64 | $old_prepare = \&Net::SNMP::MessageProcessing::prepare_data_elements; |
61 | # this overrides many methods inside Net::SNMP and it's submodules |
65 | |
|
|
66 | # this overrides many methods inside |
|
|
67 | require XSLoader; |
62 | require XSLoader; |
68 | XSLoader::load Net::SNMP::XS, $VERSION; |
63 | XSLoader::load Net::SNMP::XS, $VERSION; |
69 | } |
|
|
70 | |
|
|
71 | sub Net::SNMP::MessageProcessing::prepare_data_elements { |
|
|
72 | my ($self, $msg) = @_; |
|
|
73 | |
|
|
74 | set_msg $msg, $msg->{_buffer}; |
|
|
75 | scope_guard \&clr_msg; |
|
|
76 | &$old_prepare |
|
|
77 | } |
64 | } |
78 | |
65 | |
79 | package Net::SNMP::Message; |
66 | package Net::SNMP::Message; |
80 | |
67 | |
81 | Net::SNMP::XS::set_type INTEGER , \&_process_integer32; |
68 | Net::SNMP::XS::set_type INTEGER , \&_process_integer32; |
… | |
… | |
102 | Net::SNMP::XS::set_type SNMPV2_TRAP , \&_process_v2_trap; |
89 | Net::SNMP::XS::set_type SNMPV2_TRAP , \&_process_v2_trap; |
103 | Net::SNMP::XS::set_type REPORT , \&_process_report; |
90 | Net::SNMP::XS::set_type REPORT , \&_process_report; |
104 | |
91 | |
105 | package Net::SNMP::PDU; |
92 | package Net::SNMP::PDU; |
106 | |
93 | |
107 | # var_bind_list hardcodes oid_lext_sort. *sigh* |
94 | # var_bind_list hardcodes oid_lex_sort. *sigh* |
108 | # we copy it 1:1, except for using oid_lex_sort. |
95 | # we copy it 1:1, except for using oid_lex_sort. |
109 | |
96 | |
110 | sub var_bind_list |
97 | sub var_bind_list |
111 | { |
98 | { |
112 | my ($this, $vbl, $types) = @_; |
99 | my ($this, $vbl, $types) = @_; |