1 /* packet-btle.h
2  * Structures for determining the dissection context for BTLE.
3  *
4  * Copyright 2014, Christopher D. Kilgour, techie at whiterocker dot com
5  *
6  * Wireshark - Network traffic analyzer
7  * By Gerald Combs <gerald@wireshark.org>
8  * Copyright 1998 Gerald Combs
9  *
10  * SPDX-License-Identifier: GPL-2.0-or-later
11  */
12 #ifndef __PACKET_BTLE_H__
13 #define __PACKET_BTLE_H__
14 
15 #include "packet-bluetooth.h"
16 
17 /*
18  * These structures are meant to support the provision of contextual
19  * metadata to the BTLE dissector.
20  */
21 typedef struct {
22     guint64 InitA;
23     guint64 AdvA;
24     guint32 LinkAA;
25     guint32 CRCInit;
26     guint8  WinSize;
27     guint16 WinOffset;
28     guint16 Interval;
29     guint16 Latency;
30     guint16 Timeout;
31     guint64 ChM;
32     guint8  Hop;
33     guint8  SCA;
34 } btle_CONNECT_REQ_t;
35 
36 typedef enum {
37     E_AA_NO_COMMENT = 0,
38     E_AA_MATCHED,
39     E_AA_BIT_ERRORS,
40     E_AA_ILLEGAL
41 } btle_AA_category_t;
42 
43 #define BTLE_DIR_UNKNOWN 0
44 #define BTLE_DIR_MASTER_SLAVE 1
45 #define BTLE_DIR_SLAVE_MASTER 2
46 
47 #define BTLE_PDU_TYPE_UNKNOWN       0 /* Unknown physical channel PDU */
48 #define BTLE_PDU_TYPE_ADVERTISING   1 /* Advertising physical channel PDU */
49 #define BTLE_PDU_TYPE_DATA          2 /* Data physical channel PDU */
50 #define BTLE_PDU_TYPE_CONNECTEDISO  3 /* Connected isochronous physical channel PDU */
51 #define BTLE_PDU_TYPE_BROADCASTISO  4 /* Broadcast isochronous physical channel PDU */
52 
53 #define LE_1M_PHY     0
54 #define LE_2M_PHY     1
55 #define LE_CODED_PHY  2
56 
57 typedef struct {
58     btle_AA_category_t aa_category;
59     btle_CONNECT_REQ_t connection_info;
60     guint connection_info_valid: 1;
61     guint crc_checked_at_capture: 1;
62     guint crc_valid_at_capture: 1;
63     guint mic_checked_at_capture: 1;
64     guint mic_valid_at_capture: 1;
65     guint direction: 2; /* 0 Unknown, 1 Master -> Slave, 2 Slave -> Master */
66     guint aux_pdu_type_valid: 1;
67     guint event_counter_valid: 1;
68     guint8 pdu_type;
69     guint8 aux_pdu_type;
70     guint8 channel;
71     guint8 phy;
72     guint16 event_counter;
73 
74     union {
75         void              *data;
76         bluetooth_data_t  *bluetooth_data;
77     } previous_protocol_data;
78 } btle_context_t;
79 
80 #endif /* __PACKET_BTLE_H__ */
81 
82 /*
83  * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
84  *
85  * Local variables:
86  * c-basic-offset: 4
87  * tab-width: 8
88  * indent-tabs-mode: nil
89  * End:
90  *
91  * vi: set shiftwidth=4 tabstop=8 expandtab:
92  * :indentSize=4:tabSize=8:noTabs=true:
93  */
94