aboutsummaryrefslogtreecommitdiffstats
path: root/asn1/mms
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2007-04-28 14:38:53 +0000
committerAnders Broman <anders.broman@ericsson.com>2007-04-28 14:38:53 +0000
commit2630b817b082ae8ebcd69e589264184f4e7cfa03 (patch)
tree7219756b59b88420a205a419f8b41ee364cc363f /asn1/mms
parent43bb2aea51286c1b9c2d07e87f9a70374a849323 (diff)
From Gavin Heer:
Here's a patch that decodes MMS(Manufacturing Messaging Specification) when transported over COTP/TPKT/TCP. Previously, MMS would only be decoded if the OSI Presentation Layers were present. Now MMS/COTP/TPKT/TCP is dissected. With a change to use more functions from packet-ber svn path=/trunk/; revision=21608
Diffstat (limited to 'asn1/mms')
-rw-r--r--asn1/mms/mms.asn2
-rw-r--r--asn1/mms/packet-mms-template.c52
2 files changed, 52 insertions, 2 deletions
diff --git a/asn1/mms/mms.asn b/asn1/mms/mms.asn
index bc11a5f8ae..d7d9a7b895 100644
--- a/asn1/mms/mms.asn
+++ b/asn1/mms/mms.asn
@@ -21,7 +21,7 @@ IMPORTS
AP-title,
AP-invocation-identifier,
AE-qualifier,
- AE-invocation-identifier
+ AE-invocation-identifier
FROM ISO-8650-ACSE-1;
diff --git a/asn1/mms/packet-mms-template.c b/asn1/mms/packet-mms-template.c
index b3567c3e1b..776d7b8a8e 100644
--- a/asn1/mms/packet-mms-template.c
+++ b/asn1/mms/packet-mms-template.c
@@ -110,9 +110,59 @@ void proto_register_mms(void) {
}
+static gboolean
+dissect_mms_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
+{
+ /* must check that this really is an mms packet */
+ int offset = 0;
+ guint32 length = 0 ;
+ guint32 oct;
+ gint idx = 0 ;
+
+ gint8 tmp_class;
+ gboolean tmp_pc;
+ gint32 tmp_tag;
+
+ /* first, check do we have at least 2 bytes (pdu) */
+ if (!tvb_bytes_exist(tvb, 0, 2))
+ return FALSE; /* no */
+
+ /* can we recognize MMS PDU ? Return FALSE if not */
+ /* get MMS PDU type */
+ offset = get_ber_identifier(tvb, offset, &tmp_class, &tmp_pc, &tmp_tag);
+
+ /* check MMS type */
+
+ /* Class should be constructed */
+ if (tmp_class!=BER_CLASS_CON)
+ return FALSE;
+
+ /* see if the tag is a valid MMS PDU */
+ match_strval_idx(tmp_tag, mms_MMSpdu_vals, &idx);
+ if (idx == -1) {
+ return FALSE; /* no, it isn't an MMS PDU */
+ }
+
+ /* check MMS length */
+ oct = tvb_get_guint8(tvb, offset)& 0x7F;
+ if (oct==0)
+ /* MMS requires length after tag so not MMS if indefinite length*/
+ return FALSE;
+
+ offset = get_ber_length(NULL, tvb, offset, &length, NULL);
+ /* do we have enough bytes? */
+ if (!tvb_bytes_exist(tvb, offset, length))
+ return FALSE;
+
+ dissect_mms(tvb, pinfo, parent_tree);
+ return TRUE;
+}
+
/*--- proto_reg_handoff_mms --- */
void proto_reg_handoff_mms(void) {
register_ber_oid_dissector("1.0.9506.2.3", dissect_mms, proto_mms,"MMS");
register_ber_oid_dissector("1.0.9506.2.1", dissect_mms, proto_mms,"mms-abstract-syntax-version1(1)");
-
+ heur_dissector_add("cotp", dissect_mms_heur, proto_mms);
+ heur_dissector_add("cotp_is", dissect_mms_heur, proto_mms);
}
+