103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
# File 'lib/netsnmp/pdu.rb', line 103
def to_asn
request_id_asn = OpenSSL::ASN1::Integer.new(@request_id).with_label(:request_id)
error_asn = OpenSSL::ASN1::Integer.new(@error_status).with_label(:error)
error_index_asn = OpenSSL::ASN1::Integer.new(@error_index).with_label(:error_index)
varbind_asns = OpenSSL::ASN1::Sequence.new(@varbinds.map(&:to_asn)).with_label(:varbinds)
request_asn = OpenSSL::ASN1::ASN1Data.new([request_id_asn,
error_asn, error_index_asn,
varbind_asns], @type,
:CONTEXT_SPECIFIC).with_label(:request)
OpenSSL::ASN1::Sequence.new([*, request_asn]).with_label(:pdu)
end
|