… | |
… | |
141 | |
141 | |
142 | # it is possible to do this without loading |
142 | # it is possible to do this without loading |
143 | # Net::SNMP::Dispatcher, but much more awkward. |
143 | # Net::SNMP::Dispatcher, but much more awkward. |
144 | use Net::SNMP::Dispatcher; |
144 | use Net::SNMP::Dispatcher; |
145 | |
145 | |
|
|
146 | # we could inherit fro Net:SNMP::Dispatcher, but since this is undocumented, |
|
|
147 | # I'd rather see it die (and reported) than silenty and subtly fail. |
|
|
148 | *msg_handle_alloc = \&Net::SNMP::Dispatcher::msg_handle_alloc; |
|
|
149 | |
146 | sub Net::SNMP::Dispatcher::instance { |
150 | sub Net::SNMP::Dispatcher::instance { |
147 | AnyEvent::SNMP:: |
151 | AnyEvent::SNMP:: |
148 | } |
152 | } |
149 | |
153 | |
150 | use Net::SNMP (); |
154 | use Net::SNMP (); |
151 | use AnyEvent (); |
155 | use AnyEvent (); |
152 | |
156 | |
153 | our $VERSION = '1.0'; |
157 | our $VERSION = '6.0'; |
154 | |
158 | |
155 | $Net::SNMP::DISPATCHER = instance Net::SNMP::Dispatcher; |
159 | $Net::SNMP::DISPATCHER = instance Net::SNMP::Dispatcher; |
156 | |
160 | |
157 | our $MESSAGE_PROCESSING = $Net::SNMP::Dispatcher::MESSAGE_PROCESSING; |
161 | our $MESSAGE_PROCESSING = $Net::SNMP::Dispatcher::MESSAGE_PROCESSING; |
158 | |
162 | |
… | |
… | |
337 | kick_job; |
341 | kick_job; |
338 | |
342 | |
339 | 1 |
343 | 1 |
340 | } |
344 | } |
341 | |
345 | |
342 | sub activate($) { |
346 | sub loop($) { |
343 | while ($BUSY) { |
347 | while ($BUSY) { |
344 | $DONE = AE::cv; |
348 | $DONE = AE::cv; |
345 | $DONE->recv; |
349 | $DONE->recv; |
346 | undef $DONE; |
350 | undef $DONE; |
347 | } |
351 | } |
348 | } |
352 | } |
349 | |
353 | |
|
|
354 | *activate = \&loop; # 5.x compatibility? |
|
|
355 | *listen = \&loop; # 5.x compatibility? |
|
|
356 | |
350 | sub one_event($) { |
357 | sub one_event($) { |
351 | # should not ever be used |
358 | # should not ever be used |
352 | AnyEvent->one_event; #d# todo |
359 | AnyEvent->one_event; #d# todo |
353 | } |
360 | } |
354 | |
361 | |
355 | sub set_max_outstanding($) { |
362 | sub set_max_outstanding($) { |
356 | $MAX_OUTSTANDING = $_[0]; |
363 | $MAX_OUTSTANDING = $_[0]; |
357 | kick_job; |
364 | kick_job; |
358 | } |
365 | } |
359 | |
366 | |
|
|
367 | # not provided yet: |
|
|
368 | # schedule # apparently only used by Net::SNMP::Dispatcher itself |
|
|
369 | # register # apparently only used by Net::SNMP::Dispatcher itself |
|
|
370 | # deregister # apparently only used by Net::SNMP::Dispatcher itself |
|
|
371 | # cancel # apparently only used by Net::SNMP::Dispatcher itself |
|
|
372 | # return_response_pdu # apparently not used at all? |
|
|
373 | # error # only used by Net::SNMP::Dispatcher itself? |
|
|
374 | # debug # only used by Net::SNMP::Dispatcher itself? |
|
|
375 | |
360 | =head1 SEE ALSO |
376 | =head1 SEE ALSO |
361 | |
377 | |
362 | L<AnyEvent>, L<Net::SNMP>, L<Net::SNMP::XS>, L<Net::SNMP::EV>. |
378 | L<AnyEvent>, L<Net::SNMP>, L<Net::SNMP::XS>, L<Net::SNMP::EV>. |
363 | |
379 | |
364 | =head1 AUTHOR |
380 | =head1 AUTHOR |