aboutsummaryrefslogtreecommitdiffstats
path: root/asn1
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2006-03-15 18:57:47 +0000
committerAnders Broman <anders.broman@ericsson.com>2006-03-15 18:57:47 +0000
commitb4d7dd60603ccab2fbd49f8ec6ab90b18ffe0a6a (patch)
tree1f54365efd0ec249d7f446ecc8417a3a8ad878df /asn1
parent61b223303ab41c0637908bcc7fc7471bd52c7a2d (diff)
Some more variable bindings and add some mising PDU types.
svn path=/trunk/; revision=17637
Diffstat (limited to 'asn1')
-rw-r--r--asn1/snmp/packet-snmp-template.c8
-rw-r--r--asn1/snmp/snmp.asn39
-rw-r--r--asn1/snmp/snmp.cnf97
3 files changed, 133 insertions, 11 deletions
diff --git a/asn1/snmp/packet-snmp-template.c b/asn1/snmp/packet-snmp-template.c
index 23cb4e1c1c..111094db56 100644
--- a/asn1/snmp/packet-snmp-template.c
+++ b/asn1/snmp/packet-snmp-template.c
@@ -739,7 +739,13 @@ dissect_snmp_engineid(proto_tree *tree, tvbuff_t *tvb, int offset, int len)
return offset;
}
-
+/* This code is copied from the original SNMP dissector with minor changes to adapt it to use packet-ber.c routines
+ * TODO:
+ * - Rewrite it completly as OID as subid_t could be returned from dissect_ber_objectidentifier
+ * - vb_type_name is known when calling this routine(?)
+ * - All branches not needed(?)
+ * ...
+ */
static void
snmp_variable_decode(tvbuff_t *tvb, proto_tree *snmp_tree, packet_info *pinfo,tvbuff_t *oid_tvb,
diff --git a/asn1/snmp/snmp.asn b/asn1/snmp/snmp.asn
index a7b271a591..5626538d57 100644
--- a/asn1/snmp/snmp.asn
+++ b/asn1/snmp/snmp.asn
@@ -44,25 +44,31 @@ SimpleSyntax ::=
CHOICE {
-- INTEGERs with a more restrictive range
-- may also be used
- integer-value -- includes Integer32
- INTEGER (-2147483648..2147483647),
+ integer-value Integer-value,
-- OCTET STRINGs with a more restrictive size
-- may also be used
- string-value String-value,
+ string-value String-value,
- objectID-value
- OBJECT IDENTIFIER,
- empty -- Added from RFC 1155 for Ethereal
- NULL
+ objectID-value ObjectID-value,
+ empty Empty
+ -- Added from RFC 1155 for Ethereal
}
String-value ::= OCTET STRING (SIZE (0..65535))
+Integer-value ::= -- includes Integer32
+ INTEGER (-2147483648..2147483647)
+ -- OCTET STRINGs with a more restrictive size
+ -- may also be used
+
-- indistinguishable from INTEGER, but never needs more than
-- 32-bits for a two's complement representation
-Integer32 ::=
- INTEGER (-2147483648..2147483647)
+Integer32 ::= INTEGER (-2147483648..2147483647)
+
+ObjectID-value ::= OBJECT IDENTIFIER
+Empty ::= NULL
+ -- Added from RFC 1155 for Ethereal
-- application-wide types
@@ -261,7 +267,20 @@ SnmpEngineID ::= OCTET STRING
SetRequest-PDU,
trap
- Trap-PDU
+ Trap-PDU,
+ -- v2 added ?
+
+ getBulkRequest
+ GetBulkRequest-PDU,
+
+ informRequest
+ InformRequest-PDU,
+
+ sNMPv2-Trap
+ SNMPv2-Trap-PDU,
+
+ report
+ Report-PDU
}
-- PDUs
diff --git a/asn1/snmp/snmp.cnf b/asn1/snmp/snmp.cnf
index f58f08847c..b409437961 100644
--- a/asn1/snmp/snmp.cnf
+++ b/asn1/snmp/snmp.cnf
@@ -15,6 +15,18 @@ SMUX-PDUs
Messagev2u/datav2u/plaintext v2u_plaintext
BulkPDU/request-id bulkPDU_request-id
+#.FN_PARS PDUs
+
+ VAL_PTR = &pdu_type
+
+#.FN_BODY PDUs
+
+gint pdu_type;
+
+%(DEFAULT_BODY)s
+ if (check_col(pinfo->cinfo, COL_INFO))
+ col_add_str(pinfo->cinfo, COL_INFO, val_to_str(pdu_type, snmp_PDUs_vals,"Unknown PDU type (%%u)"));
+
#.FN_BODY PDUs/get-request
gint8 class;
gboolean pc, ind_field;
@@ -75,6 +87,7 @@ BulkPDU/request-id bulkPDU_request-id
}
offset = dissect_snmp_PDU(TRUE, tvb, offset, pinfo, tree, hf_index);
+
#.FN_BODY PDUs/trap
gint8 class;
gboolean pc, ind_field;
@@ -90,6 +103,66 @@ BulkPDU/request-id bulkPDU_request-id
}
offset = dissect_snmp_Trap_PDU(TRUE, tvb, offset, pinfo, tree, hf_index);
+#.FN_BODY PDUs/getBulkRequest
+ gint8 class;
+ gboolean pc, ind_field;
+ gint32 tag;
+ guint32 len1;
+
+ if(!implicit_tag){
+ /* XXX asn2eth can not yet handle tagged assignment yes so this
+ * XXX is some conformance file magic to work around that bug
+ */
+ offset = get_ber_identifier(tvb, offset, &class, &pc, &tag);
+ offset = get_ber_length(tree, tvb, offset, &len1, &ind_field);
+ }
+ offset = dissect_snmp_GetBulkRequest_PDU(TRUE, tvb, offset, pinfo, tree, hf_index);
+
+#.FN_BODY PDUs/informRequest
+ gint8 class;
+ gboolean pc, ind_field;
+ gint32 tag;
+ guint32 len1;
+
+ if(!implicit_tag){
+ /* XXX asn2eth can not yet handle tagged assignment yes so this
+ * XXX is some conformance file magic to work around that bug
+ */
+ offset = get_ber_identifier(tvb, offset, &class, &pc, &tag);
+ offset = get_ber_length(tree, tvb, offset, &len1, &ind_field);
+ }
+ offset = dissect_snmp_InformRequest_PDU(TRUE, tvb, offset, pinfo, tree, hf_index);
+
+#.FN_BODY PDUs/sNMPv2-Trap
+ gint8 class;
+ gboolean pc, ind_field;
+ gint32 tag;
+ guint32 len1;
+
+ if(!implicit_tag){
+ /* XXX asn2eth can not yet handle tagged assignment yes so this
+ * XXX is some conformance file magic to work around that bug
+ */
+ offset = get_ber_identifier(tvb, offset, &class, &pc, &tag);
+ offset = get_ber_length(tree, tvb, offset, &len1, &ind_field);
+ }
+ offset = dissect_snmp_SNMPv2_Trap_PDU(TRUE, tvb, offset, pinfo, tree, hf_index);
+
+#.FN_BODY PDUs/report
+ gint8 class;
+ gboolean pc, ind_field;
+ gint32 tag;
+ guint32 len1;
+
+ if(!implicit_tag){
+ /* XXX asn2eth can not yet handle tagged assignment yes so this
+ * XXX is some conformance file magic to work around that bug
+ */
+ offset = get_ber_identifier(tvb, offset, &class, &pc, &tag);
+ offset = get_ber_length(tree, tvb, offset, &len1, &ind_field);
+ }
+ offset = dissect_snmp_Report_PDU(TRUE, tvb, offset, pinfo, tree, hf_index);
+
#.FN_PARS HeaderData/msgSecurityModel
VAL_PTR = &MsgSecurityModel
@@ -146,6 +219,30 @@ BulkPDU/request-id bulkPDU_request-id
snmp_variable_decode(tvb, tree, pinfo, oid_tvb, offset, &length, NULL);
offset = offset + length;
+#.FN_BODY Integer-value
+ guint length;
+
+ snmp_variable_decode(tvb, tree, pinfo, oid_tvb, offset, &length, NULL);
+ offset = offset + length;
+
+#.FN_BODY ObjectID-value
+ guint length;
+
+ snmp_variable_decode(tvb, tree, pinfo, oid_tvb, offset, &length, NULL);
+ offset = offset + length;
+
+#.FN_BODY Empty
+ guint length;
+
+ snmp_variable_decode(tvb, tree, pinfo, oid_tvb, offset, &length, NULL);
+ offset = offset + length;
+
+#.FN_BODY TimeTicks
+ guint length;
+
+ snmp_variable_decode(tvb, tree, pinfo, oid_tvb, offset, &length, NULL);
+ offset = offset + length;
+
#.TYPE_ATTR
IpAddress TYPE = FT_IPv4 DISPLAY = BASE_NONE STRINGS = NULL
Message/community TYPE = FT_STRING DISPLAY = BASE_HEX STRINGS = NULL