aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-bluetooth.c
diff options
context:
space:
mode:
authorMichal Labedzki <michal.labedzki@tieto.com>2017-02-01 18:31:39 +0100
committerAnders Broman <a.broman58@gmail.com>2017-02-07 05:19:52 +0000
commit5d1c478bc15c3b4d843506da4d6f880a0cc32f66 (patch)
treeb67fe999fe73e382ff39e937e05766fcdb938bd7 /epan/dissectors/packet-bluetooth.c
parent912aaf0304b2bc8e7a559825a379f262bffca129 (diff)
Bluetooth: AD: Add support for AltBeacon
Another format of beacon in advertising packet. Based on: https://github.com/AltBeacon/spec User needs to use DecodeAs to use this dissector - any manufacturer's company id may be valid. Change-Id: I5656d9dbb70b648b2fadba7f3b525d38a2fe8e57 Reviewed-on: https://code.wireshark.org/review/19971 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-bluetooth.c')
-rw-r--r--epan/dissectors/packet-bluetooth.c83
1 files changed, 83 insertions, 0 deletions
diff --git a/epan/dissectors/packet-bluetooth.c b/epan/dissectors/packet-bluetooth.c
index cf409a770d..14069cdf1e 100644
--- a/epan/dissectors/packet-bluetooth.c
+++ b/epan/dissectors/packet-bluetooth.c
@@ -2624,6 +2624,89 @@ proto_reg_handoff_bluetooth(void)
/* TODO: Add UUID128 verion of UUID16; UUID32? UUID16? */
}
+
+static int proto_btad_alt_beacon = -1;
+
+static int hf_btad_alt_beacon_code = -1;
+static int hf_btad_alt_beacon_id = -1;
+static int hf_btad_alt_beacon_reference_rssi = -1;
+static int hf_btad_alt_beacon_manufacturer_data = -1;
+
+static gint ett_btad_alt_beacon = -1;
+
+static dissector_handle_t btad_alt_beacon;
+
+void proto_register_btad_alt_beacon(void);
+void proto_reg_handoff_btad_alt_beacon(void);
+
+
+static gint
+dissect_btad_alt_beacon(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
+{
+ proto_tree *main_tree;
+ proto_item *main_item;
+ gint offset = 0;
+
+ main_item = proto_tree_add_item(tree, proto_btad_alt_beacon, tvb, offset, tvb_captured_length(tvb), ENC_NA);
+ main_tree = proto_item_add_subtree(main_item, ett_btad_alt_beacon);
+
+ proto_tree_add_item(main_tree, hf_btad_alt_beacon_code, tvb, offset, 2, ENC_BIG_ENDIAN);
+ offset += 2;
+
+ proto_tree_add_item(main_tree, hf_btad_alt_beacon_id, tvb, offset, 20, ENC_NA /* ENC_BIG_ENDIAN */);
+ offset += 20;
+
+ proto_tree_add_item(main_tree, hf_btad_alt_beacon_reference_rssi, tvb, offset, 1, ENC_NA);
+ offset += 1;
+
+ proto_tree_add_item(main_tree, hf_btad_alt_beacon_manufacturer_data, tvb, offset, 1, ENC_NA);
+ offset += 1;
+
+ return offset;
+}
+
+void
+proto_register_btad_alt_beacon(void)
+{
+ static hf_register_info hf[] = {
+ { &hf_btad_alt_beacon_code,
+ { "Code", "bluetooth.alt_beacon.code",
+ FT_UINT16, BASE_HEX, NULL, 0x0,
+ NULL, HFILL }
+ },
+ {&hf_btad_alt_beacon_id,
+ {"ID", "bluetooth.alt_beacon.id",
+ FT_BYTES, BASE_NONE, NULL, 0x0,
+ NULL, HFILL}
+ },
+ { &hf_btad_alt_beacon_reference_rssi,
+ { "Reference RSSI", "bluetooth.alt_beacon.reference_rssi",
+ FT_INT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_btad_alt_beacon_manufacturer_data,
+ { "Manufacturer Data", "bluetooth.alt_beacon.manufacturer_data",
+ FT_UINT8, BASE_HEX, NULL, 0x0,
+ NULL, HFILL }
+ }
+ };
+
+ static gint *ett[] = {
+ &ett_btad_alt_beacon,
+ };
+
+ proto_btad_alt_beacon = proto_register_protocol("AltBeacon", "AltBeacon", "alt_beacon");
+ proto_register_field_array(proto_btad_alt_beacon, hf, array_length(hf));
+ proto_register_subtree_array(ett, array_length(ett));
+ btad_alt_beacon = register_dissector("bluetooth.alt_beacon", dissect_btad_alt_beacon, proto_btad_alt_beacon);
+}
+
+void
+proto_reg_handoff_btad_alt_beacon(void)
+{
+ dissector_add_for_decode_as("btcommon.eir_ad.manufacturer_company_id", btad_alt_beacon);
+}
+
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*