From Roland Knall:
authoretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>
Sun, 3 Jul 2011 19:25:34 +0000 (19:25 +0000)
committeretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>
Sun, 3 Jul 2011 19:25:34 +0000 (19:25 +0000)
implement a named dissector for the PN/IO sub-protocol for
Profinet, as well as a heuristic dissector ("pn_io"), other protocols can
attach too.

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6062

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

plugins/profinet/packet-dcerpc-pn-io.c

index c8a44bb477eaa21d650c8a5d4400305468d8da5e..fd53b17ca49cda29b441caed906157e1174590cb 100644 (file)
@@ -571,6 +571,8 @@ static guint16  ver_pn_io_supervisor = 1;
 static e_uuid_t uuid_pn_io_parameterserver = { 0xDEA00004, 0x6C97, 0x11D1, { 0x82, 0x71, 0x00, 0xA0, 0x24, 0x42, 0xDF, 0x7D } };
 static guint16  ver_pn_io_parameterserver = 1;
 
+/* Allow heuristic dissection */
+static heur_dissector_list_t heur_pn_subdissector_list;
 
 static const value_string pn_io_block_type[] = {
        { 0x0000, "Reserved" },
@@ -7709,6 +7711,13 @@ dissect_PNIO_heur(tvbuff_t *tvb,
        guint8  u8CBAVersion;
     guint16 u16FrameID;
 
+    /*
+     * In case the packet is a protocol encoded in the basic PNIO transport stream,
+     * give that protocol a chance to make a heuristic dissection, before we continue
+     * to dissect it as a normal PNIO packet.
+     */
+    if (dissector_try_heuristic(heur_pn_subdissector_list, tvb, pinfo, tree))
+      return FALSE;
 
     /* the sub tvb will NOT contain the frame_id here! */
     u16FrameID = GPOINTER_TO_UINT(pinfo->private_data);
@@ -8735,6 +8744,10 @@ proto_register_pn_io (void)
        proto_register_field_array (proto_pn_io, hf, array_length (hf));
        proto_register_subtree_array (ett, array_length (ett));
 
+       /* subdissector code */
+    new_register_dissector("pn_io", dissect_PNIO_heur, proto_pn_io);
+    register_heur_dissector_list("pn_io", &heur_pn_subdissector_list);
+
        register_init_routine(pnio_reinit);
 
     register_dissector_filter("PN-IO AR", pn_io_ar_conv_valid, pn_io_ar_conv_filter);