From 88254761fd314d5139542df000d04613f5f499cc Mon Sep 17 00:00:00 2001 From: Martin Karlgren <marty@roxen.com> Date: Tue, 11 Nov 2014 21:17:04 +0100 Subject: [PATCH] Standards.ASN1.Decode.simple_der_decode requires combined tag ids in "types". --- .../Protocols.pmod/SNMP.pmod/protocol.pike | 22 ++++++++++--------- .../Standards.pmod/ASN1.pmod/Decode.pmod | 7 ++++-- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/lib/modules/Protocols.pmod/SNMP.pmod/protocol.pike b/lib/modules/Protocols.pmod/SNMP.pmod/protocol.pike index fab879b9b9..cdef4a9985 100644 --- a/lib/modules/Protocols.pmod/SNMP.pmod/protocol.pike +++ b/lib/modules/Protocols.pmod/SNMP.pmod/protocol.pike @@ -24,23 +24,25 @@ inherit Stdio.UDP : snmp; import Standards.ASN1.Types; +#define U(x) make_combined_tag(0, (x)) + protected mapping snmp_type_proc = ([ // from RFC-1065 : - 64 : OctetString, // ipaddress - 65 : Integer, // counter - 66 : Integer, // gauge - 67 : Integer, // timeticks - 68 : OctetString, // opaque + U(64) : OctetString, // ipaddress + U(65) : Integer, // counter + U(66) : Integer, // gauge + U(67) : Integer, // timeticks + U(68) : OctetString, // opaque // v2 - 70 : Integer, // counter64 + U(70) : Integer, // counter64 // context PDU - 128 : Sequence, - 129 : Sequence, - 130 : Sequence, - 131 : Sequence, + U(128) : Sequence, + U(129) : Sequence, + U(130) : Sequence, + U(131) : Sequence, ]); diff --git a/lib/modules/Standards.pmod/ASN1.pmod/Decode.pmod b/lib/modules/Standards.pmod/ASN1.pmod/Decode.pmod index 7d0e8841d3..e936ecfb1d 100644 --- a/lib/modules/Standards.pmod/ASN1.pmod/Decode.pmod +++ b/lib/modules/Standards.pmod/ASN1.pmod/Decode.pmod @@ -207,8 +207,11 @@ mapping(int:program(.Types.Object)) universal_types = //! a DER encoded object //! //! @param types -//! An optional set of application-specific types. -//! This set is used to extend @[universal_types]. +//! An optional set of application-specific types. Should map +//! combined tag numbers to classes from or derived from +//! @[Standards.ASN1.Types]. Combined tag numbers may be generated +//! using @[Standards.ASN1.Types.make_combined_tag]. This set is +//! used to extend @[universal_types]. //! //! @returns //! an object from @[Standards.ASN1.Types] or -- GitLab