From Roland Knall <rknall [AT] gmail.com>: allow heuristic subdissectors

for SERCOS III packets.

svn path=/trunk/; revision=36214
This commit is contained in:
Guy Harris 2011-03-20 00:47:18 +00:00
parent 5c3d724bca
commit 7dfd6b1e09
2 changed files with 18 additions and 1 deletions

View File

@ -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>

View 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));