Class: NETSNMP::ScopedPDU

Inherits:
PDU
  • Object
show all
Defined in:
lib/netsnmp/scoped_pdu.rb

Constant Summary

Constants inherited from PDU

PDU::MAXREQUESTID

Instance Attribute Summary collapse

Attributes inherited from PDU

#community, #request_id, #type, #varbinds, #version

Instance Method Summary collapse

Methods inherited from PDU

#add_varbind, build, decode, #to_asn, #to_der

Constructor Details

#initialize(type:, headers:, request_id: nil, error_status: 0, error_index: 0, varbinds: []) ⇒ ScopedPDU

Returns a new instance of ScopedPDU.



8
9
10
11
12
13
14
15
# File 'lib/netsnmp/scoped_pdu.rb', line 8

def initialize(type: , headers:,
                       request_id: nil,
                       error_status: 0,
                       error_index: 0,
                       varbinds: [])
  @engine_id, @context = headers
  super(type: type, headers: [3, nil], request_id: request_id, varbinds: varbinds)
end

Instance Attribute Details

#engine_idObject (readonly)

Returns the value of attribute engine_id.



6
7
8
# File 'lib/netsnmp/scoped_pdu.rb', line 6

def engine_id
  @engine_id
end

Instance Method Details

#encode_headers_asnObject



17
18
19
20
# File 'lib/netsnmp/scoped_pdu.rb', line 17

def encode_headers_asn
  [ OpenSSL::ASN1::OctetString.new(@engine_id || ""),
    OpenSSL::ASN1::OctetString.new(@context   || "") ] 
end