aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-btle.c
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2016-08-11 17:57:25 +0200
committerAnders Broman <a.broman58@gmail.com>2016-08-11 18:28:12 +0000
commitd0fad45910c6cf2e5ad9154de29a9d30a057a8b7 (patch)
tree3714247dbbe1a5e9a78c60c7e485f7eedbdc075e /epan/dissectors/packet-btle.c
parent00f631fce4db82fe1185abb0de1d01def60e4f33 (diff)
btle: Improved packet header display
Show elements in correct order. Show TxAdd and RxAdd values as "Random" or "Public". Change-Id: Ie75716d05d2aadf3d573a9dc078f32e6f981a691 Reviewed-on: https://code.wireshark.org/review/17012 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-btle.c')
-rw-r--r--epan/dissectors/packet-btle.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/epan/dissectors/packet-btle.c b/epan/dissectors/packet-btle.c
index 2229cc73ea..444f226b22 100644
--- a/epan/dissectors/packet-btle.c
+++ b/epan/dissectors/packet-btle.c
@@ -271,6 +271,11 @@ static const value_string ll_version_number_vals[] = {
};
static value_string_ext ll_version_number_vals_ext = VALUE_STRING_EXT_INIT(ll_version_number_vals);
+static const true_false_string tfs_random_public = {
+ "Random",
+ "Public"
+};
+
void proto_register_btle(void);
void proto_reg_handoff_btle(void);
@@ -473,8 +478,9 @@ dissect_btle(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
advertising_header_tree = proto_item_add_subtree(advertising_header_item, ett_advertising_header);
pdu_type = tvb_get_guint8(tvb, offset) & 0x0F;
- proto_tree_add_item(advertising_header_tree, hf_advertising_header_rfu_1, tvb, offset, 1, ENC_LITTLE_ENDIAN);
- proto_tree_add_item(advertising_header_tree, hf_advertising_header_randomized_tx, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ proto_item_append_text(advertising_header_item, " (PDU Type: %s, TxAdd: %s",
+ val_to_str_ext_const(pdu_type, &pdu_type_vals_ext, "Unknown"),
+ (tvb_get_guint8(tvb, offset) & 0x40) ? tfs_random_public.true_string : tfs_random_public.false_string);
switch (pdu_type) {
case 0x00: /* ADV_IND */
case 0x02: /* ADV_NONCONN_IND */
@@ -484,12 +490,13 @@ dissect_btle(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
break;
default:
proto_tree_add_item(advertising_header_tree, hf_advertising_header_randomized_rx, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ proto_item_append_text(advertising_header_item, ", RxAdd: %s",
+ (tvb_get_guint8(tvb, offset) & 0x80) ? tfs_random_public.true_string : tfs_random_public.false_string);
}
+ proto_item_append_text(advertising_header_item, ")");
+ proto_tree_add_item(advertising_header_tree, hf_advertising_header_randomized_tx, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ proto_tree_add_item(advertising_header_tree, hf_advertising_header_rfu_1, tvb, offset, 1, ENC_LITTLE_ENDIAN);
proto_tree_add_item(advertising_header_tree, hf_advertising_header_pdu_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
- proto_item_append_text(advertising_header_item, " (PDU Type: %s, RandomRxBdAddr=%s, RandomTxBdAddr=%s)",
- val_to_str_ext_const(pdu_type, &pdu_type_vals_ext, "Unknown"),
- (tvb_get_guint8(tvb, offset) & 0x80) ? "true" : "false",
- (tvb_get_guint8(tvb, offset) & 0x40) ? "true" : "false");
offset += 1;
col_set_str(pinfo->cinfo, COL_INFO, val_to_str_ext_const(pdu_type, &pdu_type_vals_ext, "Unknown"));
@@ -1216,13 +1223,13 @@ proto_register_btle(void)
NULL, HFILL }
},
{ &hf_advertising_header_randomized_tx,
- { "Randomized Tx Address", "btle.advertising_header.randomized_tx",
- FT_BOOLEAN, 8, NULL, 0x40,
+ { "Tx Address", "btle.advertising_header.randomized_tx",
+ FT_BOOLEAN, 8, TFS(&tfs_random_public), 0x40,
NULL, HFILL }
},
{ &hf_advertising_header_randomized_rx,
- { "Randomized Rx Address", "btle.advertising_header.randomized_rx",
- FT_BOOLEAN, 8, NULL, 0x80,
+ { "Rx Address", "btle.advertising_header.randomized_rx",
+ FT_BOOLEAN, 8, TFS(&tfs_random_public), 0x80,
NULL, HFILL }
},
{ &hf_advertising_header_reserved,