diff options
author | Martin Kaiser <wireshark@kaiser.cx> | 2017-06-20 13:56:14 -0400 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2017-06-21 04:25:58 +0000 |
commit | 64a78e122a811db433dd20738f984ad13b22878b (patch) | |
tree | c9a8dc09468e7cdb2548d2fd4b7f12f17bb29c7b | |
parent | 050da447424223d39d1e494b8daab840a100d05e (diff) |
GSM SIM: define a dissector for both request and response
Define a dissector that can handle both requests and responses.
Look at pino->p2p_dir to detect if we have a request or repsonse.
(At the moment, there's a dissector for request+response in one packet
and two other dissectors for request and response messages.)
Use the new mechanism for USB CCID.
Change-Id: I7eb9861802b4244f92770602179f39642eb28641
Reviewed-on: https://code.wireshark.org/review/22289
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
-rw-r--r-- | epan/dissectors/packet-gsm_sim.c | 12 | ||||
-rw-r--r-- | epan/dissectors/packet-usb-ccid.c | 12 |
2 files changed, 17 insertions, 7 deletions
diff --git a/epan/dissectors/packet-gsm_sim.c b/epan/dissectors/packet-gsm_sim.c index 286921a267..73145678a4 100644 --- a/epan/dissectors/packet-gsm_sim.c +++ b/epan/dissectors/packet-gsm_sim.c @@ -1522,6 +1522,17 @@ dissect_gsm_sim_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, vo return tvb_captured_length(tvb); } +static int +dissect_gsm_sim_part(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) +{ + if (pinfo->p2p_dir == P2P_DIR_SENT) + return dissect_gsm_sim_command(tvb, pinfo, tree, data); + else if (pinfo->p2p_dir == P2P_DIR_RECV) + return dissect_gsm_sim_response(tvb, pinfo, tree, data); + + return 0; +} + void proto_register_gsm_sim(void) { @@ -2931,6 +2942,7 @@ proto_register_gsm_sim(void) register_dissector("gsm_sim.command", dissect_gsm_sim_command, proto_gsm_sim); register_dissector("gsm_sim.response", dissect_gsm_sim_response, proto_gsm_sim); register_dissector("gsm_sim.bertlv", dissect_bertlv, proto_gsm_sim); + register_dissector("gsm_sim.part", dissect_gsm_sim_part, proto_gsm_sim); } void diff --git a/epan/dissectors/packet-usb-ccid.c b/epan/dissectors/packet-usb-ccid.c index 241c1e0233..7709c7560f 100644 --- a/epan/dissectors/packet-usb-ccid.c +++ b/epan/dissectors/packet-usb-ccid.c @@ -340,10 +340,9 @@ static gint ett_ccid_status = -1; enum { SUB_DATA = 0, SUB_ISO7816, - SUB_GSM_SIM_CMD, + SUB_GSM_SIM, SUB_PN532, SUB_ACR122_PN532, - SUB_GSM_SIM_RSP, SUB_MAX }; @@ -603,8 +602,8 @@ dissect_ccid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) if (sub_selected == SUB_PN532) { call_dissector_with_data(sub_handles[SUB_PN532], next_tvb, pinfo, tree, usb_conv_info); - } else if (sub_selected == SUB_GSM_SIM_CMD) { /* Try to dissect responses to GSM SIM packets */ - call_dissector(sub_handles[SUB_GSM_SIM_RSP], next_tvb, pinfo, tree); + } else if (sub_selected == SUB_GSM_SIM) { /* Try to dissect responses to GSM SIM packets */ + call_dissector(sub_handles[SUB_GSM_SIM], next_tvb, pinfo, tree); } else if (sub_selected == SUB_ACR122_PN532) { call_dissector_with_data(sub_handles[SUB_ACR122_PN532], next_tvb, pinfo, tree, usb_conv_info); } else if (sub_selected == SUB_ISO7816) { @@ -901,7 +900,7 @@ proto_register_ccid(void) static const enum_val_t sub_enum_vals[] = { { "data", "Data", SUB_DATA }, { "iso7816", "Generic ISO 7816", SUB_ISO7816 }, - { "gsm_sim", "GSM SIM", SUB_GSM_SIM_CMD }, + { "gsm_sim", "GSM SIM", SUB_GSM_SIM }, { "pn532", "NXP PN532", SUB_PN532}, { "acr122", "ACR122 PN532", SUB_ACR122_PN532}, { NULL, NULL, 0 } @@ -938,10 +937,9 @@ proto_reg_handoff_ccid(void) sub_handles[SUB_DATA] = find_dissector("data"); sub_handles[SUB_ISO7816] = find_dissector_add_dependency("iso7816", proto_ccid); - sub_handles[SUB_GSM_SIM_CMD] = find_dissector_add_dependency("gsm_sim.command", proto_ccid); + sub_handles[SUB_GSM_SIM] = find_dissector_add_dependency("gsm_sim.part", proto_ccid); sub_handles[SUB_PN532] = find_dissector_add_dependency("pn532", proto_ccid); sub_handles[SUB_ACR122_PN532] = find_dissector_add_dependency("acr122", proto_ccid); - sub_handles[SUB_GSM_SIM_RSP] = find_dissector_add_dependency("gsm_sim.response", proto_ccid); } /* |