| Class | SNMP::PDU |
| In: |
lib/snmp/pdu.rb
|
| Parent: | Object |
| ERROR_STATUS_NAME | = | { 0 => :noError, 1 => :tooBig, 2 => :noSuchName, 3 => :badValue, 4 => :readOnly, 5 => :genErr, 6 => :noAccess, 7 => :wrongType, 8 => :wrongLength, 9 => :wrongEncoding, 10 => :wrongValue, 11 => :noCreation, 12 => :inconsistentValue, 13 => :resourceUnavailable, 14 => :commitFailed, 15 => :undoFailed, 16 => :authorizationError, 17 => :notWritable, 18 => :inconsistentName |
| ERROR_STATUS_CODE | = | ERROR_STATUS_NAME.invert |
| varbind_list | -> | vb_list |
| error_index | [RW] | |
| request_id | [RW] | |
| varbind_list | [RW] |
# File lib/snmp/pdu.rb, line 122 def self.decode(pdu_class, pdu_data) request_id, remainder = decode_integer(pdu_data) error_status, remainder = decode_integer(remainder) error_index, remainder = decode_integer(remainder) varbind_list, remainder = VarBindList.decode(remainder) assert_no_remainder(remainder) pdu_class.new(request_id, varbind_list, error_status, error_index) end
# File lib/snmp/pdu.rb, line 155 def initialize(request_id, varbind_list, error_status=0, error_index=0) @request_id = request_id self.error_status = error_status @error_index = error_index.to_int @varbind_list = varbind_list end
# File lib/snmp/pdu.rb, line 177 def encode_pdu(pdu_tag) pdu_data = encode_integer(@request_id) pdu_data << encode_integer(@error_status) pdu_data << encode_integer(@error_index) pdu_data << @varbind_list.encode encode_tlv(pdu_tag, pdu_data) end