| 1 | # -*- mode: perl -*- | ||||||||||||||||||||||||||||
| 2 | # ============================================================================ | ||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||
| 4 | package Net::SNMP::MessageProcessing; | ||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | # $Id: MessageProcessing.pm,v 3.1 2010/09/10 00:01:22 dtown Rel $ | ||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | # Object that implements the Message Processing module. | ||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | # Copyright (c) 2001-2010 David M. Town <dtown@cpan.org> | ||||||||||||||||||||||||||||
| 11 | # All rights reserved. | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | # This program is free software; you may redistribute it and/or modify it | ||||||||||||||||||||||||||||
| 14 | # under the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | # ============================================================================ | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 2 | ▶ | use Net::SNMP::PDU qw( | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | :types :msgFlags :securityLevels asn1_itoa SNMP_VERSION_3 TRUE FALSE | ||||||||||||||||||||||||||||
| 22 | 2 | ); | |||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 2 | srand( time() ^ ($$ + ($$ <<15)) ); | |||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | ## Version of the Net::SNMP::MessageProcessing module | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 2 | our $VERSION = v3.0.1; | |||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | ## Package variables | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 2 | our $INSTANCE; # Reference to the Singleton object | |||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 2 | our $DEBUG = FALSE; # Debug flag | |||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | ## Object array indexes | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 8 | ▶ | sub _ERROR { 0 } # Error message | ||||||||||||||||||||||||||
|
Subroutine
_ERROR: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 39 | 0 | ▶ | sub _HANDLES { 1 } # Cached request messages | ||||||||||||||||||||||||||
|
Subroutine
_HANDLES: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | BEGIN | ||||||||||||||||||||||||||||
| 42 | 2 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=9.2
| |||||||||||||||||||||||||||||
| 43 | # See if there is a better pseudorandom number generator (PRNG) available. | ||||||||||||||||||||||||||||
| 44 | 2 | ▶ | if (eval 'require Math::Random::MT::Auto') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 45 | 0 | Math::Random::MT::Auto->import('rand'); | |||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | # [public methods] ----------------------------------------------------------- | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | sub instance | ||||||||||||||||||||||||||||
| 52 | 2 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
instance: called CC=2 SCAR=9.2
Pod
undocumented
| |||||||||||||||||||||||||||||
| 53 | 2 | ▶ | return $INSTANCE ||= Net::SNMP::MessageProcessing->_new(); | ||||||||||||||||||||||||||
|
Condition33%1/3
$Net::SNMP::MessageProcessing::INSTANCE ||= "Net::SNMP::MessageProcessing"->_new
MC/DC0%0/2
$Net::SNMP::MessageProcessing::INSTANCE ||= "Net::SNMP::MessageProcessing"->_new
$Net::SNMP::MessageProcessing::INSTANCE
"Net::SNMP::MessageProcessing"->_new
Truth table33%1/3
A ||= B
A= $Net::SNMP::MessageProcessing::INSTANCEB= "Net::SNMP::MessageProcessing"->_new
| |||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | sub prepare_outgoing_msg | ||||||||||||||||||||||||||||
| 57 | 1 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
prepare_outgoing_msg: called CC=12 SCAR=46.7
Pod
undocumented
| |||||||||||||||||||||||||||||
| 58 | 1 | my ($this, $pdu) = @_; | |||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | # Clear any previous errors | ||||||||||||||||||||||||||||
| 61 | 1 | $this->_error_clear(); | |||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 1 | ▶ | if ((@_ != 2) || (!ref $pdu)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@_ != 2 or not ref $pdu
MC/DC0%0/2
@_ != 2 or not ref $pdu
@_ != 2
not ref $pdu
Truth table33%1/3
A or not(B)
A= @_ != 2B= not ref $pdu
| |||||||||||||||||||||||||||||
| 64 | 1 | return $this->_error('The PDU object is missing or invalid'); | |||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | # We must have a Security Model in order to prepare the message. | ||||||||||||||||||||||||||||
| 68 | 0 | ▶ | if (!defined $pdu->security()) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 69 | 0 | return $this->_error('The Security Model object is not defined'); | |||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | # Create a new Message | ||||||||||||||||||||||||||||
| 73 | 0 | my ($msg, $error) = Net::SNMP::Message->new( | |||||||||||||||||||||||||||
| 74 | -callback => $pdu->callback(), | ||||||||||||||||||||||||||||
| 75 | -leadingdot => $pdu->leading_dot(), | ||||||||||||||||||||||||||||
| 76 | -requestid => $pdu->request_id(), | ||||||||||||||||||||||||||||
| 77 | -security => $pdu->security(), | ||||||||||||||||||||||||||||
| 78 | -translate => $pdu->translate(), | ||||||||||||||||||||||||||||
| 79 | -transport => $pdu->transport(), | ||||||||||||||||||||||||||||
| 80 | -version => $pdu->version() | ||||||||||||||||||||||||||||
| 81 | ); | ||||||||||||||||||||||||||||
| 82 | 0 | ▶ | return $this->_error($error) if !defined $msg; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | 0 | ▶ | if ($pdu->version() == SNMP_VERSION_3) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | # ScopedPDU::=SEQUENCE | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | 0 | ▶ | if (!defined $pdu->prepare_pdu_scope()) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 89 | 0 | return $this->_error($pdu->error()); | |||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | # We need to copy the contextEngineID and contextName to the | ||||||||||||||||||||||||||||
| 93 | # request message so that they are available for comparison | ||||||||||||||||||||||||||||
| 94 | # with the response message. | ||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | 0 | $msg->context_engine_id($pdu->context_engine_id()); | |||||||||||||||||||||||||||
| 97 | 0 | $msg->context_name($pdu->context_name()); | |||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | # Set a new msgID for each message unless the PDU type is a | ||||||||||||||||||||||||||||
| 100 | # GetResponse-PDU or a Report-PDU. | ||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | 0 | ▶ | if (($pdu->pdu_type() != GET_RESPONSE) && ($pdu->pdu_type() != REPORT)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$pdu->pdu_type != GET_RESPONSE() and $pdu->pdu_type != REPORT()
MC/DC0%0/2
$pdu->pdu_type != GET_RESPONSE() and $pdu->pdu_type != REPORT()
$pdu->pdu_type != GET_RESPONSE()
$pdu->pdu_type != REPORT()
Truth table0%0/3
A and B
A= $pdu->pdu_type != GET_RESPONSE()B= $pdu->pdu_type != REPORT()
| |||||||||||||||||||||||||||||
| 103 | 0 | $pdu->msg_id($this->msg_handle_alloc()); | |||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | # msgGlobalData::=SEQUENCE | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | 0 | ▶ | if (!defined $this->_prepare_global_data($pdu, $msg)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 109 | 0 | return $this->_error(); | |||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | # Pass off to the Security Model | ||||||||||||||||||||||||||||
| 115 | 0 | ▶ | if (!defined $pdu->security()->generate_request_msg($pdu, $msg)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 116 | 0 | return $this->_error($pdu->security()->error()); | |||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||
| 119 | # If a response to the message is expected, add the message to the | ||||||||||||||||||||||||||||
| 120 | # cache using the msgId (request-id) has the lookup "handle". | ||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | 0 | ▶ | if ($pdu->expect_response()) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 123 | 0 | $this->[_HANDLES]->{$msg->msg_id()} = $msg; | |||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | # Return the new message. | ||||||||||||||||||||||||||||
| 127 | 0 | return $msg; | |||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | sub prepare_data_elements | ||||||||||||||||||||||||||||
| 131 | 1 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
prepare_data_elements: called CC=26 SCAR=64.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 132 | 1 | my ($this, $msg) = @_; | |||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | # Clear any previous errors | ||||||||||||||||||||||||||||
| 135 | 1 | $this->_error_clear(); | |||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||
| 137 | 1 | ▶ | if ((@_ != 2) || (!ref $msg)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@_ != 2 or not ref $msg
MC/DC0%0/2
@_ != 2 or not ref $msg
@_ != 2
not ref $msg
Truth table33%1/3
A or not(B)
A= @_ != 2B= not ref $msg
| |||||||||||||||||||||||||||||
| 138 | 1 | return $this->_error('The Message object is missing or invalid'); | |||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | # message::=SEQUENCE | ||||||||||||||||||||||||||||
| 142 | 0 | ▶ | return $this->_error($msg->error()) if !defined $msg->process(SEQUENCE); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||
| 144 | # version::=INTEGER | ||||||||||||||||||||||||||||
| 145 | 0 | ▶ | if (!defined $msg->version($msg->process(INTEGER))) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 146 | 0 | return $this->_error($msg->error()); | |||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | # Find the request message in the cache. We are assuming this | ||||||||||||||||||||||||||||
| 150 | # message is a response to an outstanding request. | ||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | 0 | my $request; | |||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||
| 154 | 0 | ▶ | if ($msg->version() == SNMP_VERSION_3) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | # msgGlobalData::=SEQUENCE | ||||||||||||||||||||||||||||
| 157 | 0 | ▶ | if (!defined $this->_process_global_data($msg)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 158 | 0 | return $this->_error(); | |||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||
| 161 | 0 | $request = $this->msg_handle_delete($msg->msg_id()); | |||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | } else { | ||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||
| 165 | # community::=OCTET STRING | ||||||||||||||||||||||||||||
| 166 | 0 | ▶ | if (!defined $msg->security_name($msg->process(OCTET_STRING))) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 167 | 0 | return $this->_error($msg->error()); | |||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||
| 170 | # Cast the Message to a PDU | ||||||||||||||||||||||||||||
| 171 | 0 | ▶ | if (!defined($msg = Net::SNMP::PDU->new($msg))) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 172 | 0 | return $this->_error('Failed to allocate a new PDU object'); | |||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||
| 175 | # PDU::=SEQUENCE | ||||||||||||||||||||||||||||
| 176 | 0 | ▶ | if (!defined $msg->process_pdu_sequence()) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 177 | 0 | return $this->_error($msg->error()); | |||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||
| 180 | 0 | ▶ | if ($msg->pdu_type() != GET_RESPONSE) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 181 | 0 | return $this->_error( | |||||||||||||||||||||||||||
| 182 | 'A %s was expected, but %s was found', | ||||||||||||||||||||||||||||
| 183 | asn1_itoa(GET_RESPONSE), asn1_itoa($msg->pdu_type()) | ||||||||||||||||||||||||||||
| 184 | ); | ||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||
| 187 | 0 | $request = $this->msg_handle_delete($msg->request_id()); | |||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||
| 191 | # Was a matching request found? | ||||||||||||||||||||||||||||
| 192 | 0 | ▶ | if (!defined $request) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 193 | 0 | return $this->_error('No matching request message was found'); | |||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||
| 196 | # Update the received message with the relevant request data. | ||||||||||||||||||||||||||||
| 197 | 0 | $msg->callback($request->callback()); | |||||||||||||||||||||||||||
| 198 | 0 | $msg->timeout_id($request->timeout_id()); | |||||||||||||||||||||||||||
| 199 | 0 | $msg->transport($request->transport()); | |||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||
| 201 | # Now that we have found the matching request for this response | ||||||||||||||||||||||||||||
| 202 | # we return a FALSE error instead of undefined so that the error | ||||||||||||||||||||||||||||
| 203 | # gets propagated back to the user. | ||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||
| 205 | # Compare the Security Models | ||||||||||||||||||||||||||||
| 206 | 0 | ▶ | if ($msg->msg_security_model() != $request->msg_security_model()) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 207 | 0 | $this->_error( | |||||||||||||||||||||||||||
| 208 | 'The msgSecurityModel %d was expected, but %d was found', | ||||||||||||||||||||||||||||
| 209 | $request->msg_security_model(), $msg->msg_security_model() | ||||||||||||||||||||||||||||
| 210 | ); | ||||||||||||||||||||||||||||
| 211 | 0 | return FALSE; | |||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||
| 214 | 0 | $msg->security($request->security()); | |||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||
| 216 | # Pass off to the Security Model | ||||||||||||||||||||||||||||
| 217 | 0 | ▶ | if (!defined $request->security()->process_incoming_msg($msg)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 218 | 0 | $this->_error($request->security()->error()); | |||||||||||||||||||||||||||
| 219 | 0 | return FALSE; | |||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||
| 222 | 0 | ▶ | if ($msg->version() == SNMP_VERSION_3) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||
| 224 | # Adjust our maxMsgSize if necessary | ||||||||||||||||||||||||||||
| 225 | 0 | ▶ | if ($msg->msg_max_size() < $request->max_msg_size()) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 226 | 0 | DEBUG_INFO('new maxMsgSize = %d', $msg->msg_max_size()); | |||||||||||||||||||||||||||
| 227 | 0 | ▶ | if (!defined $request->max_msg_size($msg->msg_max_size())) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 228 | 0 | $this->_error($request->error()); | |||||||||||||||||||||||||||
| 229 | 0 | return FALSE; | |||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||
| 233 | # Cast the Message to a PDU | ||||||||||||||||||||||||||||
| 234 | 0 | ▶ | if (!defined($msg = Net::SNMP::PDU->new($msg))) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 235 | 0 | $this->_error('Failed to allocate new PDU object'); | |||||||||||||||||||||||||||
| 236 | 0 | return FALSE; | |||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||
| 239 | # ScopedPDU::=SEQUENCE | ||||||||||||||||||||||||||||
| 240 | 0 | ▶ | if (!defined $msg->process_pdu_scope()) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 241 | 0 | $this->_error($msg->error()); | |||||||||||||||||||||||||||
| 242 | 0 | return FALSE; | |||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||
| 245 | # PDU::=SEQUENCE | ||||||||||||||||||||||||||||
| 246 | 0 | ▶ | if (!defined $msg->process_pdu_sequence()) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 247 | 0 | $this->_error($msg->error()); | |||||||||||||||||||||||||||
| 248 | 0 | return FALSE; | |||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||
| 251 | 0 | ▶ | if ($msg->pdu_type() != REPORT) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||
| 253 | 0 | ▶ | if ($msg->pdu_type() != GET_RESPONSE) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 254 | 0 | $this->_error( | |||||||||||||||||||||||||||
| 255 | 'A %s was expected, but %s was found', | ||||||||||||||||||||||||||||
| 256 | asn1_itoa(GET_RESPONSE), asn1_itoa($msg->pdu_type()) | ||||||||||||||||||||||||||||
| 257 | ); | ||||||||||||||||||||||||||||
| 258 | 0 | return FALSE; | |||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||
| 261 | # Compare the contextEngineID | ||||||||||||||||||||||||||||
| 262 | 0 | ▶ | if ($msg->context_engine_id() ne $request->context_engine_id()) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 263 | 0 | $this->_error( | |||||||||||||||||||||||||||
| 264 | 'The contextEngineID "%s" was expected, but "%s" was found', | ||||||||||||||||||||||||||||
| 265 | unpack('H*', $request->context_engine_id()), | ||||||||||||||||||||||||||||
| 266 | unpack('H*', $msg->context_engine_id()), | ||||||||||||||||||||||||||||
| 267 | ); | ||||||||||||||||||||||||||||
| 268 | 0 | return FALSE; | |||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||
| 271 | # Compare the contextName | ||||||||||||||||||||||||||||
| 272 | 0 | ▶ | if ($msg->context_name() ne $request->context_name()) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 273 | 0 | $this->_error( | |||||||||||||||||||||||||||
| 274 | 'The contextName "%s" was expected, but "%s" was found', | ||||||||||||||||||||||||||||
| 275 | $request->context_name(), $msg->context_name() | ||||||||||||||||||||||||||||
| 276 | ); | ||||||||||||||||||||||||||||
| 277 | 0 | return FALSE; | |||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||
| 280 | # Check the request-id | ||||||||||||||||||||||||||||
| 281 | 0 | ▶ | if ($msg->request_id() != $request->request_id()) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 282 | 0 | $this->_error( | |||||||||||||||||||||||||||
| 283 | 'The request-id %d was expected, but %d was found', | ||||||||||||||||||||||||||||
| 284 | $request->request_id(), $msg->request_id() | ||||||||||||||||||||||||||||
| 285 | ); | ||||||||||||||||||||||||||||
| 286 | 0 | return FALSE; | |||||||||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||
| 292 | # Now update the message with format parameters. | ||||||||||||||||||||||||||||
| 293 | 0 | $msg->leading_dot($request->leading_dot()); | |||||||||||||||||||||||||||
| 294 | 0 | $msg->translate($request->translate()); | |||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||
| 296 | # VarBindList::=SEQUENCE OF VarBind | ||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||
| 298 | 0 | ▶ | if (!defined $msg->process_var_bind_list()) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 299 | 0 | $this->_error($msg->error()); | |||||||||||||||||||||||||||
| 300 | 0 | return FALSE; | |||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||
| 303 | # Return the PDU | ||||||||||||||||||||||||||||
| 304 | 0 | return $msg; | |||||||||||||||||||||||||||
| 305 | } | ||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||
| 307 | sub msg_handle_alloc | ||||||||||||||||||||||||||||
| 308 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
msg_handle_alloc: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 309 | 0 | my ($this) = @_; | |||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||
| 311 | # Limit message handles by RFC 3412 - msgID::=INTEGER (0..2147483647) | ||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||
| 313 | 0 | my $handle = int rand(2147483648); | |||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||
| 315 | 0 | ▶ | while (exists $this->[_HANDLES]->{$handle} && | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $$this[_HANDLES()]{$handle} and keys %{$$this[_HANDLES()]{$handle};} < 2147483648
MC/DC0%0/2
exists $$this[_HANDLES()]{$handle} and keys %{$$this[_HANDLES()]{$handle};} < 2147483648
exists $$this[_HANDLES()]{$handle}
keys %{$$this[_HANDLES()]{$handle};} < 2147483648
Truth table0%0/3
A and B
A= exists $$this[_HANDLES()]{$handle}B= keys %{$$this[_HANDLES()]{$handle};} < 2147483648
| |||||||||||||||||||||||||||||
| 316 | 0 | keys %{$this->[_HANDLES]->{$handle}} < 2147483648) | |||||||||||||||||||||||||||
| 317 | { | ||||||||||||||||||||||||||||
| 318 | 0 | $handle = int rand(2147483648); | |||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||
| 321 | 0 | return $handle; | |||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||
| 324 | sub msg_handle_delete | ||||||||||||||||||||||||||||
| 325 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
msg_handle_delete: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 326 | 0 | my ($this, $handle) = @_; | |||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||
| 328 | # Clear any previous errors | ||||||||||||||||||||||||||||
| 329 | 0 | $this->_error_clear(); | |||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||
| 331 | 0 | ▶ | return $this->_error('No msgHandle was specified') if (@_ < 2); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||
| 333 | 0 | ▶ | if (!exists $this->[_HANDLES]->{$handle}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 334 | 0 | return $this->_error('The msgHandle %d was not found', $handle); | |||||||||||||||||||||||||||
| 335 | } | ||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||
| 337 | 0 | return delete $this->[_HANDLES]->{$handle}; | |||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||
| 340 | sub error | ||||||||||||||||||||||||||||
| 341 | 2 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
error: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||||||||||
| 342 | 2 | ▶ | return $_[0]->[_ERROR] || q{}; | ||||||||||||||||||||||||||
|
Condition50%1/2
$_[0][_ERROR()] || ''
MC/DC0%0/1
$_[0][_ERROR()] || ''
$_[0][_ERROR()]
Truth table50%1/2
A
A= $_[0][_ERROR()]
| |||||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||
| 345 | sub debug | ||||||||||||||||||||||||||||
| 346 | 2 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
debug: called CC=3 SCAR=16.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 347 | 2 | ▶ | return (@_ == 2) ? $DEBUG = ($_[1]) ? TRUE : FALSE : $DEBUG; | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 348 | } | ||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||
| 350 | # [private methods] ---------------------------------------------------------- | ||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||
| 352 | sub _new | ||||||||||||||||||||||||||||
| 353 | 2 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
_new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 354 | 2 | my ($class) = @_; | |||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||
| 356 | # The constructor is private since we only want one MessageProcessing | ||||||||||||||||||||||||||||
| 357 | # object. We also reserve message handle (request-id/msgID) 0 so that | ||||||||||||||||||||||||||||
| 358 | # it is not used for valid messages. | ||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||
| 360 | 2 | return bless [ undef, { 0, undef } ], $class; | |||||||||||||||||||||||||||
| 361 | } | ||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||
| 363 | sub _prepare_global_data | ||||||||||||||||||||||||||||
| 364 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
_prepare_global_data: not called CC=9 SCAR=45.0
| |||||||||||||||||||||||||||||
| 365 | 0 | my ($this, $pdu, $msg) = @_; | |||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||
| 367 | # msgSecurityModel::=INTEGER | ||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||
| 369 | 0 | ▶ | if (!defined | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 370 | $msg->prepare( | ||||||||||||||||||||||||||||
| 371 | INTEGER, $msg->msg_security_model($pdu->msg_security_model()) | ||||||||||||||||||||||||||||
| 372 | ) | ||||||||||||||||||||||||||||
| 373 | ) | ||||||||||||||||||||||||||||
| 374 | { | ||||||||||||||||||||||||||||
| 375 | 0 | return $this->_error($msg->error()); | |||||||||||||||||||||||||||
| 376 | } | ||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||
| 378 | # msgFlags::=OCTET STRING | ||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||
| 380 | 0 | my $security_level = $pdu->security_level(); | |||||||||||||||||||||||||||
| 381 | 0 | my $msg_flags = MSG_FLAGS_NOAUTHNOPRIV | MSG_FLAGS_REPORTABLE; | |||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||
| 383 | 0 | ▶ | if ($security_level > SECURITY_LEVEL_NOAUTHNOPRIV) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 384 | 0 | $msg_flags |= MSG_FLAGS_AUTH; | |||||||||||||||||||||||||||
| 385 | 0 | ▶ | if ($security_level > SECURITY_LEVEL_AUTHNOPRIV) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 386 | 0 | $msg_flags |= MSG_FLAGS_PRIV; | |||||||||||||||||||||||||||
| 387 | } | ||||||||||||||||||||||||||||
| 388 | } | ||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||
| 390 | 0 | ▶ | if (!$pdu->expect_response()) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 391 | 0 | $msg_flags &= ~MSG_FLAGS_REPORTABLE; | |||||||||||||||||||||||||||
| 392 | } | ||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||
| 394 | 0 | ▶ | if (!defined $msg->prepare(OCTET_STRING, pack 'C', $msg_flags)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 395 | 0 | $this->_error($msg->error()); | |||||||||||||||||||||||||||
| 396 | } | ||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||
| 398 | 0 | $msg->msg_flags($msg_flags); | |||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||
| 400 | # msgMaxSize::=INTEGER | ||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||
| 402 | 0 | ▶ | if (!defined | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 403 | $msg->prepare(INTEGER, $msg->msg_max_size($pdu->max_msg_size())) | ||||||||||||||||||||||||||||
| 404 | ) | ||||||||||||||||||||||||||||
| 405 | { | ||||||||||||||||||||||||||||
| 406 | 0 | return $this->_error($msg->error()); | |||||||||||||||||||||||||||
| 407 | } | ||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||
| 409 | # msgID::=INTEGER | ||||||||||||||||||||||||||||
| 410 | 0 | ▶ | if (!defined $msg->prepare(INTEGER, $msg->msg_id($pdu->msg_id()))) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 411 | 0 | return $this->_error($msg->error()); | |||||||||||||||||||||||||||
| 412 | } | ||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||
| 414 | # msgGlobalData::=SEQUENCE | ||||||||||||||||||||||||||||
| 415 | 0 | ▶ | if (!defined $msg->prepare(SEQUENCE)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 416 | 0 | return $this->_error($msg->error()); | |||||||||||||||||||||||||||
| 417 | } | ||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||
| 419 | 0 | return TRUE; | |||||||||||||||||||||||||||
| 420 | } | ||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||
| 422 | sub _process_global_data | ||||||||||||||||||||||||||||
| 423 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
_process_global_data: not called CC=11 SCAR=48.8
| |||||||||||||||||||||||||||||
| 424 | 0 | my ($this, $msg) = @_; | |||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||
| 426 | # msgGlobalData::=SEQUENCE | ||||||||||||||||||||||||||||
| 427 | 0 | ▶ | return $this->_error($msg->error()) if !defined $msg->process(SEQUENCE); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||
| 429 | # msgID::=INTEGER | ||||||||||||||||||||||||||||
| 430 | 0 | ▶ | if (!defined $msg->msg_id($msg->process(INTEGER))) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 431 | 0 | return $this->_error($msg->error()); | |||||||||||||||||||||||||||
| 432 | } | ||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||
| 434 | # msgMaxSize::=INTEGER | ||||||||||||||||||||||||||||
| 435 | 0 | ▶ | if (!defined $msg->msg_max_size($msg->process(INTEGER))) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 436 | 0 | return $this->_error($msg->error()); | |||||||||||||||||||||||||||
| 437 | } | ||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||
| 439 | # msgFlags::=OCTET STRING | ||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||
| 441 | 0 | my $msg_flags = $msg->process(OCTET_STRING); | |||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||
| 443 | 0 | ▶ | if (!defined $msg_flags) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 444 | 0 | return $this->_error($msg->error()); | |||||||||||||||||||||||||||
| 445 | } | ||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||
| 447 | 0 | ▶ | if (CORE::length($msg_flags) != 1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 448 | 0 | return $this->_error( | |||||||||||||||||||||||||||
| 449 | 'The msgFlags length of %d is invalid', CORE::length($msg_flags) | ||||||||||||||||||||||||||||
| 450 | ); | ||||||||||||||||||||||||||||
| 451 | } | ||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||
| 453 | 0 | $msg->msg_flags($msg_flags = unpack 'C', $msg_flags); | |||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||
| 455 | # Validate the msgFlags and derive the securityLevel. | ||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||
| 457 | 0 | my $security_level = SECURITY_LEVEL_NOAUTHNOPRIV; | |||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||
| 459 | 0 | ▶ | if ($msg_flags & MSG_FLAGS_AUTH) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 460 | 0 | $security_level = SECURITY_LEVEL_AUTHNOPRIV; | |||||||||||||||||||||||||||
| 461 | 0 | ▶ | if ($msg_flags & MSG_FLAGS_PRIV) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 462 | 0 | $security_level = SECURITY_LEVEL_AUTHPRIV; | |||||||||||||||||||||||||||
| 463 | } | ||||||||||||||||||||||||||||
| 464 | } elsif ($msg_flags & MSG_FLAGS_PRIV) { | ||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||
| 466 | # RFC 3412 - Section 7.2 1d: "If the authFlag is not set | ||||||||||||||||||||||||||||
| 467 | # and privFlag is set... ...the message is discarded..." | ||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||
| 469 | 0 | return $this->_error('The msgFlags value 0x%02x is invalid', $msg_flags); | |||||||||||||||||||||||||||
| 470 | } | ||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||
| 472 | # RFC 3412 - Section 7.2 1e: "Any other bits... ...are ignored." | ||||||||||||||||||||||||||||
| 473 | 0 | ▶ | if ($msg_flags & ~MSG_FLAGS_MASK) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 474 | 0 | DEBUG_INFO('questionable msgFlags value 0x%02x', $msg_flags); | |||||||||||||||||||||||||||
| 475 | } | ||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||
| 477 | 0 | $msg->security_level($security_level); | |||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||
| 479 | # msgSecurityModel::=INTEGER | ||||||||||||||||||||||||||||
| 480 | 0 | ▶ | if (!defined $msg->msg_security_model($msg->process(INTEGER))) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 481 | 0 | return $this->_error($msg->error()); | |||||||||||||||||||||||||||
| 482 | } | ||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||
| 484 | 0 | return TRUE; | |||||||||||||||||||||||||||
| 485 | } | ||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||
| 487 | sub _error | ||||||||||||||||||||||||||||
| 488 | 2 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
_error: called CC=4 SCAR=15.2
| |||||||||||||||||||||||||||||
| 489 | 2 | my $this = shift; | |||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||
| 491 | 2 | ▶ | if (!defined $this->[_ERROR]) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 492 | 2 | ▶ | $this->[_ERROR] = (@_ > 1) ? sprintf(shift(@_), @_) : $_[0]; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 493 | 2 | ▶ | if ($this->debug()) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 494 | 0 | printf "error: [%d] %s(): %s\n", | |||||||||||||||||||||||||||
| 495 | (caller 0)[2], (caller 1)[3], $this->[_ERROR]; | ||||||||||||||||||||||||||||
| 496 | } | ||||||||||||||||||||||||||||
| 497 | } | ||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||
| 499 | 2 | return; | |||||||||||||||||||||||||||
| 500 | } | ||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||
| 502 | sub _error_clear | ||||||||||||||||||||||||||||
| 503 | 2 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
_error_clear: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 504 | 2 | return $_[0]->[_ERROR] = undef; | |||||||||||||||||||||||||||
| 505 | } | ||||||||||||||||||||||||||||
| 506 | |||||||||||||||||||||||||||||
| 507 | sub DEBUG_INFO | ||||||||||||||||||||||||||||
| 508 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
DEBUG_INFO: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 509 | 0 | ▶ | return $DEBUG if (!$DEBUG); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||
| 511 | 0 | ▶ | return printf | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 512 | sprintf('debug: [%d] %s(): ', (caller 0)[2], (caller 1)[3]) . | ||||||||||||||||||||||||||||
| 513 | ((@_ > 1) ? shift(@_) : '%s') . | ||||||||||||||||||||||||||||
| 514 | "\n", | ||||||||||||||||||||||||||||
| 515 | @_; | ||||||||||||||||||||||||||||
| 516 | } | ||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||
| 518 | # ============================================================================ | ||||||||||||||||||||||||||||
| 519 | 2 | 1; # [end Net::SNMP::MessageProcessing] | |||||||||||||||||||||||||||