summaryrefslogtreecommitdiff
path: root/epan/dissectors/packet-usb-ccid.c
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2013-09-10 05:43:17 +0000
committerAnders Broman <anders.broman@ericsson.com>2013-09-10 05:43:17 +0000
commitb1e6fc8411e40cc3048f257cca9148f2e5d9f1e8 (patch)
treef6cbd77cedcbd786a50b9b38346fd2290c27c725 /epan/dissectors/packet-usb-ccid.c
parent8646abfc17597479812c2b5bbf401c7060e57984 (diff)
downloadwireshark-b1e6fc8411e40cc3048f257cca9148f2e5d9f1e8.tar.gz
From: Michal Labedzki <michal.labedzki@tieto.com>
Subject: [PATCH] NFC: PN532: Implement half of PN532 specification Implement TG_* and RF_* commands/responses. Also decode "status" field in all commands. Update USB CCID to decode "escaped" payload. https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9119 svn path=/trunk/; revision=51916
Diffstat (limited to 'epan/dissectors/packet-usb-ccid.c')
-rw-r--r--epan/dissectors/packet-usb-ccid.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/epan/dissectors/packet-usb-ccid.c b/epan/dissectors/packet-usb-ccid.c
index d6a3b019cc..8ebf97c1f4 100644
--- a/epan/dissectors/packet-usb-ccid.c
+++ b/epan/dissectors/packet-usb-ccid.c
@@ -58,6 +58,8 @@ static int hf_ccid_dwProtocols = -1;
static int hf_ccid_dwDefaultClock = -1;
static int hf_ccid_dwMaximumClock = -1;
static int hf_ccid_bNumClockSupported = -1;
+static int hf_ccid_bRFU = -1;
+static int hf_ccid_abRFU = -1;
static const int *bVoltageLevel_fields[] = {
&hf_ccid_bVoltageSupport50,
@@ -94,6 +96,8 @@ static const int *bVoltageLevel_fields[] = {
#define RDR_PC_ESCAPE 0x83
#define RDR_PC_DATA_CLOCK 0x84
+void proto_register_ccid(void);
+void proto_reg_handoff_ccid(void);
static const value_string ccid_descriptor_type_vals[] = {
{USB_DESC_TYPE_SMARTCARD, "smart card"},
@@ -352,11 +356,17 @@ dissect_ccid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
case PC_RDR_XFR_BLOCK:
+ case PC_RDR_ESCAPE:
proto_tree_add_item(ccid_tree, hf_ccid_dwLength, tvb, 1, 4, ENC_LITTLE_ENDIAN);
proto_tree_add_item(ccid_tree, hf_ccid_bSlot, tvb, 5, 1, ENC_LITTLE_ENDIAN);
proto_tree_add_item(ccid_tree, hf_ccid_bSeq, tvb, 6, 1, ENC_LITTLE_ENDIAN);
- proto_tree_add_item(ccid_tree, hf_ccid_bBWI, tvb, 7, 1, ENC_LITTLE_ENDIAN);
- proto_tree_add_item(ccid_tree, hf_ccid_wLevelParameter, tvb, 8, 2, ENC_LITTLE_ENDIAN);
+
+ if (cmd == PC_RDR_ESCAPE) {
+ proto_tree_add_item(ccid_tree, hf_ccid_abRFU, tvb, 7, 3, ENC_NA);
+ } else {
+ proto_tree_add_item(ccid_tree, hf_ccid_bBWI, tvb, 7, 1, ENC_LITTLE_ENDIAN);
+ proto_tree_add_item(ccid_tree, hf_ccid_wLevelParameter, tvb, 8, 2, ENC_LITTLE_ENDIAN);
+ }
if (tvb_get_letohl(tvb, 1) != 0)
{
@@ -403,12 +413,16 @@ dissect_ccid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
case RDR_PC_DATA_BLOCK:
+ case RDR_PC_ESCAPE:
proto_tree_add_item(ccid_tree, hf_ccid_dwLength, tvb, 1, 4, ENC_LITTLE_ENDIAN);
proto_tree_add_item(ccid_tree, hf_ccid_bSlot, tvb, 5, 1, ENC_LITTLE_ENDIAN);
proto_tree_add_item(ccid_tree, hf_ccid_bSeq, tvb, 6, 1, ENC_LITTLE_ENDIAN);
proto_tree_add_item(ccid_tree, hf_ccid_bStatus, tvb, 7, 1, ENC_LITTLE_ENDIAN);
proto_tree_add_item(ccid_tree, hf_ccid_bError, tvb, 8, 1, ENC_LITTLE_ENDIAN);
- proto_tree_add_item(ccid_tree, hf_ccid_bChainParameter, tvb, 9, 1, ENC_LITTLE_ENDIAN);
+ if (cmd == RDR_PC_ESCAPE)
+ proto_tree_add_item(ccid_tree, hf_ccid_bRFU, tvb, 9, 1, ENC_LITTLE_ENDIAN);
+ else
+ proto_tree_add_item(ccid_tree, hf_ccid_bChainParameter, tvb, 9, 1, ENC_LITTLE_ENDIAN);
if (tvb_get_letohl(tvb, 1) != 0)
{
@@ -423,7 +437,7 @@ dissect_ccid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
/* Try to dissect responses to GSM SIM packets */
- if (sub_selected == SUB_GSM_SIM_CMD) {
+ else if (sub_selected == SUB_GSM_SIM_CMD) {
call_dissector(sub_handles[SUB_GSM_SIM_RSP], next_tvb, pinfo, tree);
}
@@ -472,6 +486,12 @@ proto_register_ccid(void)
{&hf_ccid_bError,
{ "Error", "usbccid.bError", FT_UINT8, BASE_DEC,
NULL, 0x0, NULL, HFILL }},
+ {&hf_ccid_bRFU,
+ { "RFU", "usbccid.bRFU", FT_UINT8, BASE_HEX,
+ NULL, 0x0, NULL, HFILL }},
+ {&hf_ccid_abRFU,
+ { "RFU", "usbccid.abRFU", FT_BYTES, BASE_NONE,
+ NULL, 0x0, NULL, HFILL }},
{&hf_ccid_bChainParameter,
{ "Chain Parameter", "usbccid.bChainParameter", FT_UINT8, BASE_DEC,
NULL, 0x0, NULL, HFILL }},