From Roland Knall <rknall [AT] gmail.com>: allow heuristic subdissectors
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Sun, 20 Mar 2011 00:47:18 +0000 (00:47 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Sun, 20 Mar 2011 00:47:18 +0000 (00:47 +0000)
for SERCOS III packets.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@36214 f5534014-38df-0310-8fa8-9805f1628bb7

AUTHORS
plugins/sercosiii/packet-sercosiii_1v1.c

diff --git a/AUTHORS b/AUTHORS
index f5b210d..0942aff 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -3243,6 +3243,9 @@ Jakub Zawadzki            <darkjames [AT] darkjames.ath.cx> {
        JSON dissector
 }
 
+Roland Knall           <rknall [AT] gmail.com> {
+       Support for heuristic subdissectors for SERCOS III
+}
 
 and by:
 
@@ -3354,7 +3357,7 @@ Brice Augustin            <bricecotte [AT] gmail.com>
 Matt Thornton          <MATT_THORNTON [AT] appsig.com>
 Markus Seehofer                <Markus.Seehofer [AT] hirschmann.de>
 Timo Metsala           <timo.metsala [AT] gmail.com>
-Tomer Shani            <thetour [AT} japan.com>
+Tomer Shani            <thetour [AT] japan.com>
 Manu Pathak            <mapathak [AT] cisco.com>
 Kaul                   <mykaul [AT] gmail.com>
 John Sullivan          <john [AT] kanargh.force9.co.uk>
index fe4c1b5..77dda1a 100644 (file)
@@ -40,6 +40,9 @@ static gint proto_siii = -1;
 static gint ett_siii = -1;
 static gint ett_siii_header = -1;
 
+/* Allow heuristic dissection */
+static heur_dissector_list_t heur_subdissector_list;
+
 /* Main dissector entry */
 static void
 dissect_siii(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
@@ -55,6 +58,14 @@ dissect_siii(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
   col_set_str(pinfo->cinfo, COL_PROTOCOL, "SERCOS III V1.1");
   col_clear(pinfo->cinfo, COL_INFO);
 
+  /*
+   * In case the packet is a protocol encoded in the basic SercosIII transport stream,
+   * give that protocol a chance to make a heuristic dissection, before we continue
+   * to dissect it as a normal SercosIII packet.
+   */
+  if (dissector_try_heuristic(heur_subdissector_list, tvb, pinfo, tree))
+    return;
+
   /* check what we got on our hand */
   type = tvb_get_guint8(tvb, 0);
   if(type&0x80) /* primary or secondary channel */
@@ -97,6 +108,9 @@ proto_register_sercosiii(void)
 
   register_dissector("sercosiii", dissect_siii, proto_siii);
 
+  /* subdissector code */
+  register_heur_dissector_list("sercosiii", &heur_subdissector_list);
+
   /* Required function calls to register the header fields and subtrees used */
   proto_register_subtree_array(ett, array_length(ett));