1little_endian_packets
2
3custom_field Address : 48 "hci/"
4custom_field ClassOfDevice : 24 "hci/"
5
6enum PacketType : 8 {
7    UNKNOWN = 0x00,
8    ACL = 0x01,
9    DISCONNECT = 0x02,
10    ENCRYPT_CONNECTION = 0x03,
11    ENCRYPT_CONNECTION_RESPONSE = 0x04,
12    EVENT = 0x05,
13    INQUIRY = 0x06,
14    INQUIRY_RESPONSE = 0x07,
15    IO_CAPABILITY_REQUEST = 0x08,
16    IO_CAPABILITY_RESPONSE = 0x09,
17    IO_CAPABILITY_NEGATIVE_RESPONSE = 0x0A,
18    LE_ADVERTISEMENT = 0x0B,
19    LE_CONNECT = 0x0C,
20    LE_CONNECT_COMPLETE = 0x0D,
21    LE_SCAN = 0x0E,
22    LE_SCAN_RESPONSE = 0x0F,
23    PAGE = 0x10,
24    PAGE_RESPONSE = 0x11,
25    PAGE_REJECT = 0x12,
26    READ_CLOCK_OFFSET = 0x13,
27    READ_CLOCK_OFFSET_RESPONSE = 0x14,
28    READ_REMOTE_SUPPORTED_FEATURES = 0x15,
29    READ_REMOTE_SUPPORTED_FEATURES_RESPONSE = 0x16,
30    READ_REMOTE_LMP_FEATURES = 0x17,
31    READ_REMOTE_LMP_FEATURES_RESPONSE = 0x18,
32    READ_REMOTE_EXTENDED_FEATURES = 0x19,
33    READ_REMOTE_EXTENDED_FEATURES_RESPONSE = 0x1A,
34    READ_REMOTE_VERSION_INFORMATION = 0x1B,
35    READ_REMOTE_VERSION_INFORMATION_RESPONSE = 0x1C,
36    REMOTE_NAME_REQUEST = 0x1D,
37    REMOTE_NAME_REQUEST_RESPONSE = 0x1E,
38    SCO = 0x1F,
39    LE_ENCRYPT_CONNECTION = 0x20,
40    LE_ENCRYPT_CONNECTION_RESPONSE = 0x21,
41}
42
43packet LinkLayerPacket {
44  type : PacketType,
45  source_address : Address,
46  destination_address : Address,
47  _body_,
48}
49
50packet AclPacket : LinkLayerPacket (type = ACL) {
51  _payload_,
52}
53
54packet Disconnect : LinkLayerPacket (type = DISCONNECT) {
55  reason : 8,
56}
57
58packet EncryptConnection : LinkLayerPacket (type = ENCRYPT_CONNECTION) {
59  key : 8[],
60}
61
62packet EncryptConnectionResponse : LinkLayerPacket (type = ENCRYPT_CONNECTION_RESPONSE) {
63  key : 8[],
64}
65
66enum InquiryState : 8 {
67  STANDBY = 0x00,
68  INQUIRY = 0x01,
69}
70
71enum InquiryType : 8 {
72  STANDARD = 0x00,
73  RSSI = 0x01,
74  EXTENDED = 0x02,
75}
76
77packet Inquiry : LinkLayerPacket (type = INQUIRY) {
78  inquiry_type : InquiryType,
79}
80
81packet BasicInquiryResponse : LinkLayerPacket(type = INQUIRY_RESPONSE) {
82  inquiry_type : InquiryType,
83  page_scan_repetition_mode : 8,
84  class_of_device : ClassOfDevice,
85  clock_offset : 15,
86  _reserved_ : 1,
87  _body_,
88}
89
90packet InquiryResponse : BasicInquiryResponse (inquiry_type = STANDARD) {
91}
92
93packet InquiryResponseWithRssi : BasicInquiryResponse (inquiry_type = RSSI)  {
94  rssi: 8,
95}
96
97packet ExtendedInquiryResponse : BasicInquiryResponse (inquiry_type = EXTENDED)  {
98  rssi: 8,
99  extended_data : 8[],
100}
101
102packet IoCapabilityRequest : LinkLayerPacket (type = IO_CAPABILITY_REQUEST) {
103  io_capability : 8,
104  oob_data_present : 8,
105  authentication_requirements : 8,
106}
107
108packet IoCapabilityResponse : LinkLayerPacket (type = IO_CAPABILITY_RESPONSE) {
109  io_capability : 8,
110  oob_data_present : 8,
111  authentication_requirements : 8,
112}
113
114packet IoCapabilityNegativeResponse : LinkLayerPacket (type = IO_CAPABILITY_NEGATIVE_RESPONSE) {
115  reason : 8,
116}
117
118enum AddressType : 8 {
119  PUBLIC = 0,
120  RANDOM = 1,
121  PUBLIC_IDENTITY = 2,
122  RANDOM_IDENTITY = 3,
123}
124
125enum AdvertisementType : 8 {
126    ADV_IND = 0,          // Connectable and scannable
127    ADV_DIRECT_IND = 1,   // Connectable directed
128    ADV_SCAN_IND = 2,     // Scannable undirected
129    ADV_NONCONN_IND = 3,  // Non connectable undirected
130    SCAN_RESPONSE = 4,
131}
132
133packet LeAdvertisement : LinkLayerPacket (type = LE_ADVERTISEMENT) {
134  address_type : AddressType,
135  advertisement_type : AdvertisementType,
136  data : 8[],
137}
138
139packet LeConnect : LinkLayerPacket (type = LE_CONNECT) {
140  le_connection_interval_min : 16,
141  le_connection_interval_max : 16,
142  le_connection_latency : 16,
143  le_connection_supervision_timeout : 16,
144  address_type : 8,
145}
146
147packet LeConnectComplete : LinkLayerPacket (type = LE_CONNECT_COMPLETE) {
148  le_connection_interval : 16,
149  le_connection_latency : 16,
150  le_connection_supervision_timeout : 16,
151  address_type : 8,
152}
153
154packet LeScan : LinkLayerPacket (type = LE_SCAN) {
155}
156
157packet LeScanResponse : LinkLayerPacket (type = LE_SCAN_RESPONSE) {
158  address_type : AddressType,
159  advertisement_type : AdvertisementType,
160  data : 8[],
161}
162
163packet Page : LinkLayerPacket (type = PAGE) {
164  class_of_device : ClassOfDevice,
165  allow_role_switch : 8,
166}
167
168packet PageResponse : LinkLayerPacket (type = PAGE_RESPONSE) {
169  try_role_switch : 8,
170}
171
172packet PageReject : LinkLayerPacket (type = PAGE_REJECT) {
173  reason : 8,
174}
175
176packet ReadClockOffset : LinkLayerPacket (type = READ_CLOCK_OFFSET) {
177}
178
179packet ReadClockOffsetResponse : LinkLayerPacket (type = READ_CLOCK_OFFSET_RESPONSE) {
180  offset : 16,
181}
182
183packet ReadRemoteSupportedFeatures : LinkLayerPacket (type = READ_REMOTE_SUPPORTED_FEATURES) {
184}
185
186packet ReadRemoteSupportedFeaturesResponse : LinkLayerPacket (type = READ_REMOTE_SUPPORTED_FEATURES_RESPONSE) {
187  features : 64,
188}
189
190packet ReadRemoteLmpFeatures : LinkLayerPacket (type = READ_REMOTE_LMP_FEATURES) {
191}
192
193packet ReadRemoteLmpFeaturesResponse : LinkLayerPacket (type = READ_REMOTE_LMP_FEATURES_RESPONSE) {
194  features : 64,
195}
196
197packet ReadRemoteExtendedFeatures : LinkLayerPacket (type = READ_REMOTE_EXTENDED_FEATURES) {
198  page_number : 8,
199}
200
201packet ReadRemoteExtendedFeaturesResponse : LinkLayerPacket (type = READ_REMOTE_EXTENDED_FEATURES_RESPONSE) {
202  status : 8,
203  page_number : 8,
204  max_page_number : 8,
205  features : 64,
206}
207
208packet ReadRemoteVersionInformation : LinkLayerPacket (type = READ_REMOTE_VERSION_INFORMATION) {
209}
210
211packet ReadRemoteVersionInformationResponse : LinkLayerPacket (type = READ_REMOTE_VERSION_INFORMATION_RESPONSE) {
212  lmp_version : 8,
213  lmp_subversion : 8,
214  manufacturer_name : 16,
215}
216
217packet RemoteNameRequest : LinkLayerPacket (type = REMOTE_NAME_REQUEST) {
218}
219
220packet RemoteNameRequestResponse : LinkLayerPacket (type = REMOTE_NAME_REQUEST_RESPONSE) {
221  name : 8[248],
222}
223
224packet ScoPacket : LinkLayerPacket (type = SCO) {
225  _payload_,
226}
227
228packet LeEncryptConnection : LinkLayerPacket (type = LE_ENCRYPT_CONNECTION) {
229  rand : 8[8],
230  ediv : 16,
231  ltk : 8[16],
232}
233
234packet LeEncryptConnectionResponse : LinkLayerPacket (type = LE_ENCRYPT_CONNECTION_RESPONSE) {
235  rand : 8[8],
236  ediv : 16,
237  ltk : 8[16],
238}
239
240