aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-packetlogger.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2015-06-15 20:23:24 -0700
committerGuy Harris <guy@alum.mit.edu>2015-06-16 03:23:51 +0000
commit68e65021e07914e9be40776ac6cc0b5bc416a718 (patch)
tree1702ea1aa07b91a15e98a896c81bc68dddffe053 /epan/dissectors/packet-packetlogger.c
parent60ab49592b58075d54db68353c60c8cfb2409b31 (diff)
Clean up handling of metadata in Bluetooth dissectors.
Make the "previous protocol data" union in bluetooth_data_t a discriminated union, and use the discriminator to decide whether to use a given member of the union or not (or to check whether the member you plan to use is valid). Have separate top-level dissectors depending on what the data type pointed to by the "data" argument is. Use that member to point to pseudo-header metadata, and, for now, set it to point to the appropriate pinfo->pseudo_header value; eventually, we plan to pass the pseudo-header pointer in as the "data" argument from the "frame" dissector. Don't overwrite the pseudo-header in the packetlogger dissector - construct a new one and pass it in. Change-Id: Ia1ef71e7082a964c5d92d47221f8c00e32f3f087 Reviewed-on: https://code.wireshark.org/review/8943 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/dissectors/packet-packetlogger.c')
-rw-r--r--epan/dissectors/packet-packetlogger.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/epan/dissectors/packet-packetlogger.c b/epan/dissectors/packet-packetlogger.c
index 7b2095be5a..42af360ba8 100644
--- a/epan/dissectors/packet-packetlogger.c
+++ b/epan/dissectors/packet-packetlogger.c
@@ -80,6 +80,7 @@ static int dissect_packetlogger(tvbuff_t *tvb, packet_info *pinfo,
guint8 pl_type;
gint len;
bluetooth_data_t *bluetooth_data;
+ struct bthci_phdr bthci;
bluetooth_data = (bluetooth_data_t *) data;
@@ -100,35 +101,36 @@ static int dissect_packetlogger(tvbuff_t *tvb, packet_info *pinfo,
/* HCI H1 packages */
switch (pl_type) {
case PKT_HCI_COMMAND:
- pinfo->pseudo_header->bthci.channel = BTHCI_CHANNEL_COMMAND;
- pinfo->pseudo_header->bthci.sent = P2P_DIR_SENT;
+ bthci.channel = BTHCI_CHANNEL_COMMAND;
+ bthci.sent = P2P_DIR_SENT;
pinfo->p2p_dir = P2P_DIR_SENT;
break;
case PKT_HCI_EVENT:
- pinfo->pseudo_header->bthci.channel = BTHCI_CHANNEL_EVENT;
- pinfo->pseudo_header->bthci.sent = P2P_DIR_RECV;
+ bthci.channel = BTHCI_CHANNEL_EVENT;
+ bthci.sent = P2P_DIR_RECV;
pinfo->p2p_dir = P2P_DIR_RECV;
break;
case PKT_SENT_ACL_DATA:
- pinfo->pseudo_header->bthci.channel = BTHCI_CHANNEL_ACL;
- pinfo->pseudo_header->bthci.sent = P2P_DIR_SENT;
+ bthci.channel = BTHCI_CHANNEL_ACL;
+ bthci.sent = P2P_DIR_SENT;
pinfo->p2p_dir = P2P_DIR_SENT;
break;
case PKT_RECV_ACL_DATA:
- pinfo->pseudo_header->bthci.channel = BTHCI_CHANNEL_ACL;
- pinfo->pseudo_header->bthci.sent = P2P_DIR_RECV;
+ bthci.channel = BTHCI_CHANNEL_ACL;
+ bthci.sent = P2P_DIR_RECV;
pinfo->p2p_dir = P2P_DIR_RECV;
break;
default:
- pinfo->pseudo_header->bthci.channel = pl_type;
- pinfo->pseudo_header->bthci.sent = P2P_DIR_UNKNOWN;
+ bthci.channel = pl_type;
+ bthci.sent = P2P_DIR_UNKNOWN;
pinfo->p2p_dir = P2P_DIR_UNKNOWN;
break;
}
+ bluetooth_data->previous_protocol_data.bthci = &bthci;
proto_item_set_len (ti, 1);
col_add_fstr (pinfo->cinfo, COL_INFO, "%s", val_to_str(pl_type, type_vals, "Unknown 0x%02x"));
- if (!dissector_try_uint_new(hci_h1_table, pinfo->pseudo_header->bthci.channel,
+ if (!dissector_try_uint_new(hci_h1_table, bthci.channel,
next_tvb, pinfo, tree, TRUE, bluetooth_data)) {
call_dissector (data_handle, next_tvb, pinfo, tree);
}