iso14443: make the payload dissector configurable
authorMartin Kaiser <wireshark@kaiser.cx>
Sat, 7 Apr 2018 19:44:45 +0000 (21:44 +0200)
committerAnders Broman <a.broman58@gmail.com>
Mon, 9 Apr 2018 09:34:51 +0000 (09:34 +0000)
Add an iso14443.subdissector table where other protocols can register
themselves for iso14443's payload. Register iso7816 dissector in this
table.

Change-Id: Idb17ae014449443448ec4c64017531bc69d806b3
Reviewed-on: https://code.wireshark.org/review/26821
Petri-Dish: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
epan/dissectors/packet-iso14443.c
epan/dissectors/packet-iso7816.c

index 6362449e61856acd545b6d1856346d87dc56995c..4419eb8c5314ca0d8290968b3cb1d74106fafb73 100644 (file)
@@ -27,6 +27,7 @@
 #include "config.h"
 #include <epan/packet.h>
 #include <epan/expert.h>
+#include <epan/decode_as.h>
 #include <epan/conversation.h>
 #include <epan/tfs.h>
 #include <epan/reassemble.h>
@@ -170,6 +171,8 @@ static dissector_handle_t iso14443_handle;
 
 static dissector_table_t iso14443_cmd_type_table;
 
+static dissector_table_t iso14443_subdissector_table;
+
 static int ett_iso14443 = -1;
 static int ett_iso14443_hdr = -1;
 static int ett_iso14443_msg = -1;
@@ -1088,8 +1091,10 @@ dissect_iso14443_cmd_type_block(tvbuff_t *tvb, packet_info *pinfo,
                     &i_block_frag_items, NULL, tree);
 
             if (payload_tvb) {
-                /* XXX - forward to the actual upper layer protocol */
-                call_data_dissector(payload_tvb, pinfo, tree);
+                if (!dissector_try_payload_new(iso14443_subdissector_table,
+                            payload_tvb, pinfo, tree, TRUE, NULL)) {
+                    call_data_dissector(payload_tvb, pinfo, tree);
+                }
             }
         }
 
@@ -1883,6 +1888,11 @@ proto_register_iso14443(void)
         register_dissector("iso14443", dissect_iso14443, proto_iso14443);
 
     transactions = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
+
+    iso14443_subdissector_table =
+        register_decode_as_next_proto(proto_iso14443,
+                "Payload", "iso14443.subdissector",
+                "ISO14443 payload subdissector", NULL);
 }
 
 
index 995438717ebb62adda644c2b8ca08c304639cb98..001112dd83ba1a3ac4c17e88584170c6b3264020 100644 (file)
@@ -928,6 +928,7 @@ proto_register_iso7816(void)
 void proto_reg_handoff_iso7816(void)
 {
     dissector_add_for_decode_as("usbccid.subdissector", iso7816_handle);
+    dissector_add_for_decode_as("iso14443.subdissector", iso7816_handle);
 }