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:, **options) ⇒ ScopedPDU

Returns a new instance of ScopedPDU.



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

def initialize(type:, headers:, **options)
  @engine_id, @context = headers
  super(type: type, headers: [3, nil], **options)
end

Instance Attribute Details

#engine_idObject (readonly)

Returns the value of attribute engine_id.



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

def engine_id
  @engine_id
end

Instance Method Details

#encode_headers_asnObject



12
13
14
15
# File 'lib/netsnmp/scoped_pdu.rb', line 12

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