1little_endian_packets
2
3custom_field Address : 48 "hci/"
4
5enum PacketType : 8 {
6    UNKNOWN = 0x00,
7    ACL = 0x01,
8    SCO = 0x02,
9
10    LE_CONNECTED_ISOCHRONOUS_PDU = 0x03,
11    LE_BROADCAST_ISOCHRONOUS_PDU = 0x04,
12
13    DISCONNECT = 0x05,
14    INQUIRY = 0x06,
15    INQUIRY_RESPONSE = 0x07,
16    LE_LEGACY_ADVERTISING_PDU = 0x0B,
17    LE_EXTENDED_ADVERTISING_PDU = 0x37,
18    LE_PERIODIC_ADVERTISING_PDU = 0x40,
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    LE_ENCRYPT_CONNECTION = 0x20,
39    LE_ENCRYPT_CONNECTION_RESPONSE = 0x21,
40    LE_READ_REMOTE_FEATURES = 0x2C,
41    LE_READ_REMOTE_FEATURES_RESPONSE = 0x2D,
42    LE_CONNECTION_PARAMETER_REQUEST = 0x2E,
43    LE_CONNECTION_PARAMETER_UPDATE = 0x2F,
44
45    SCO_CONNECTION_REQUEST = 0x30,
46    SCO_CONNECTION_RESPONSE = 0x31,
47    SCO_DISCONNECT = 0x32,
48
49    LMP = 0x34,
50    LLCP = 0x41,
51
52    PING_REQUEST = 0x35,
53    PING_RESPONSE = 0x36,
54    ROLE_SWITCH_REQUEST = 0x38,
55    ROLE_SWITCH_RESPONSE = 0x39,
56
57    LL_PHY_REQ = 0x50,
58    LL_PHY_RSP = 0x51,
59    LL_PHY_UPDATE_IND = 0x52,
60}
61
62packet LinkLayerPacket {
63  type : PacketType,
64  source_address : Address,
65  destination_address : Address,
66  _body_,
67}
68
69packet Acl : LinkLayerPacket (type = ACL) {
70  packet_boundary_flag : 8,
71  broadcast_flag : 8,
72  data: 8[],
73}
74
75packet Sco : LinkLayerPacket (type = SCO) {
76  _payload_,
77}
78
79packet LeConnectedIsochronousPdu : LinkLayerPacket (type = LE_CONNECTED_ISOCHRONOUS_PDU) {
80  cig_id: 8,
81  cis_id: 8,
82  sequence_number: 16,
83  data: 8[],
84}
85
86packet LeBroadcastIsochronousPdu : LinkLayerPacket (type = LE_BROADCAST_ISOCHRONOUS_PDU) {
87}
88
89packet Disconnect : LinkLayerPacket (type = DISCONNECT) {
90  reason : 8,
91}
92
93enum InquiryState : 8 {
94  STANDBY = 0x00,
95  INQUIRY = 0x01,
96}
97
98enum InquiryType : 8 {
99  STANDARD = 0x00,
100  RSSI = 0x01,
101  EXTENDED = 0x02,
102}
103
104packet Inquiry : LinkLayerPacket (type = INQUIRY) {
105  inquiry_type : InquiryType,
106  lap : 8, // The IAC is derived from the LAP
107}
108
109packet BasicInquiryResponse : LinkLayerPacket(type = INQUIRY_RESPONSE) {
110  inquiry_type : InquiryType,
111  page_scan_repetition_mode : 8,
112  class_of_device : 24,
113  clock_offset : 15,
114  _reserved_ : 1,
115  _body_,
116}
117
118packet InquiryResponse : BasicInquiryResponse (inquiry_type = STANDARD) {
119}
120
121packet InquiryResponseWithRssi : BasicInquiryResponse (inquiry_type = RSSI)  {
122  rssi: 8,
123}
124
125packet ExtendedInquiryResponse : BasicInquiryResponse (inquiry_type = EXTENDED)  {
126  rssi: 8,
127  extended_inquiry_response : 8[240],
128}
129
130enum AddressType : 8 {
131  PUBLIC = 0,
132  RANDOM = 1,
133  PUBLIC_IDENTITY = 2,
134  RANDOM_IDENTITY = 3,
135}
136
137// Legacy advertising PDU types.
138// Vol 6, Part B § 2.3.1 Advertising PDUs.
139enum LegacyAdvertisingType : 8 {
140  ADV_IND = 0,          // Connectable and scannable
141  ADV_DIRECT_IND = 1,   // Connectable directed, high duty cycle
142  ADV_SCAN_IND = 2,     // Scannable undirected
143  ADV_NONCONN_IND = 3,  // Non connectable undirected
144}
145
146packet LeLegacyAdvertisingPdu : LinkLayerPacket (type = LE_LEGACY_ADVERTISING_PDU) {
147  advertising_address_type: AddressType,
148  target_address_type: AddressType,
149  advertising_type: LegacyAdvertisingType,
150  advertising_data: 8[],
151}
152
153// PHY type. Matching the primary and secondary PHY types
154// from the following commands and events:
155//  - Vol 4, Part E § 7.7.65.13 LE Extended Advertising Report event
156//  - Vol 4, Part E § 7.8.53 LE Set Extended Advertising Parameters command
157enum PhyType : 8 {
158  NO_PACKETS = 0x00,
159  LE_1M = 0x01,
160  LE_2M = 0x02,
161  LE_CODED_S8 = 0x03,
162  LE_CODED_S2 = 0x04,
163}
164
165packet LeExtendedAdvertisingPdu : LinkLayerPacket (type = LE_EXTENDED_ADVERTISING_PDU) {
166  advertising_address_type: AddressType,
167  target_address_type: AddressType,
168  connectable: 1,
169  scannable: 1,
170  directed: 1,
171  _reserved_: 5,
172  sid: 8, // 0xff when not provided
173  tx_power: 8,
174  primary_phy: PhyType, // LE_1M | LE_CODEC_S8
175  secondary_phy: PhyType,
176  periodic_advertising_interval: 16,
177  advertising_data: 8[],
178}
179
180packet LePeriodicAdvertisingPdu : LinkLayerPacket (type = LE_PERIODIC_ADVERTISING_PDU) {
181  advertising_address_type: AddressType,
182  sid: 8, // 0xff when not provided
183  tx_power: 8,
184  advertising_interval: 16,
185  advertising_data: 8[],
186}
187
188packet LeConnect : LinkLayerPacket (type = LE_CONNECT) {
189  initiating_address_type : AddressType,
190  advertising_address_type : AddressType,
191  conn_interval : 16,
192  conn_peripheral_latency : 16,
193  conn_supervision_timeout : 16,
194}
195
196packet LeConnectComplete : LinkLayerPacket (type = LE_CONNECT_COMPLETE) {
197  initiating_address_type : AddressType,
198  advertising_address_type : AddressType,
199  conn_interval : 16,
200  conn_peripheral_latency : 16,
201  conn_supervision_timeout : 16,
202}
203
204packet LeScan : LinkLayerPacket (type = LE_SCAN) {
205  scanning_address_type : AddressType,
206  advertising_address_type : AddressType,
207}
208
209packet LeScanResponse : LinkLayerPacket (type = LE_SCAN_RESPONSE) {
210  advertising_address_type : AddressType,
211  scan_response_data : 8[],
212}
213
214packet Page : LinkLayerPacket (type = PAGE) {
215  class_of_device : 24,
216  allow_role_switch : 8,
217}
218
219packet PageResponse : LinkLayerPacket (type = PAGE_RESPONSE) {
220  try_role_switch : 8,
221}
222
223packet PageReject : LinkLayerPacket (type = PAGE_REJECT) {
224  reason : 8,
225}
226
227packet ReadClockOffset : LinkLayerPacket (type = READ_CLOCK_OFFSET) {
228}
229
230packet ReadClockOffsetResponse : LinkLayerPacket (type = READ_CLOCK_OFFSET_RESPONSE) {
231  offset : 16,
232}
233
234packet ReadRemoteSupportedFeatures : LinkLayerPacket (type = READ_REMOTE_SUPPORTED_FEATURES) {
235}
236
237packet ReadRemoteSupportedFeaturesResponse : LinkLayerPacket (type = READ_REMOTE_SUPPORTED_FEATURES_RESPONSE) {
238  features : 64,
239}
240
241packet ReadRemoteLmpFeatures : LinkLayerPacket (type = READ_REMOTE_LMP_FEATURES) {
242}
243
244packet ReadRemoteLmpFeaturesResponse : LinkLayerPacket (type = READ_REMOTE_LMP_FEATURES_RESPONSE) {
245  features : 64,
246}
247
248packet ReadRemoteExtendedFeatures : LinkLayerPacket (type = READ_REMOTE_EXTENDED_FEATURES) {
249  page_number : 8,
250}
251
252packet ReadRemoteExtendedFeaturesResponse : LinkLayerPacket (type = READ_REMOTE_EXTENDED_FEATURES_RESPONSE) {
253  status : 8,
254  page_number : 8,
255  max_page_number : 8,
256  features : 64,
257}
258
259packet ReadRemoteVersionInformation : LinkLayerPacket (type = READ_REMOTE_VERSION_INFORMATION) {
260}
261
262packet ReadRemoteVersionInformationResponse : LinkLayerPacket (type = READ_REMOTE_VERSION_INFORMATION_RESPONSE) {
263  lmp_version : 8,
264  lmp_subversion : 8,
265  manufacturer_name : 16,
266}
267
268packet RemoteNameRequest : LinkLayerPacket (type = REMOTE_NAME_REQUEST) {
269}
270
271packet RemoteNameRequestResponse : LinkLayerPacket (type = REMOTE_NAME_REQUEST_RESPONSE) {
272  name : 8[248],
273}
274
275packet LeEncryptConnection : LinkLayerPacket (type = LE_ENCRYPT_CONNECTION) {
276  rand : 8[8],
277  ediv : 16,
278  ltk : 8[16],
279}
280
281packet LeEncryptConnectionResponse : LinkLayerPacket (type = LE_ENCRYPT_CONNECTION_RESPONSE) {
282  rand : 8[8],
283  ediv : 16,
284  ltk : 8[16],
285}
286
287enum PasskeyNotificationType : 8 {
288  ENTRY_STARTED = 0x00,
289  DIGIT_ENTERED = 0x01,
290  DIGIT_ERASED = 0x02,
291  CLEARED = 0x03,
292  ENTRY_COMPLETED = 0x04,
293}
294
295packet LeReadRemoteFeatures : LinkLayerPacket (type = LE_READ_REMOTE_FEATURES) {
296}
297
298packet LeReadRemoteFeaturesResponse : LinkLayerPacket (type = LE_READ_REMOTE_FEATURES_RESPONSE) {
299  features : 64,
300  status : 8,
301}
302
303packet LeConnectionParameterRequest : LinkLayerPacket (type = LE_CONNECTION_PARAMETER_REQUEST) {
304  interval_min : 16,
305  interval_max : 16,
306  latency : 16,
307  timeout : 16,
308}
309
310packet LeConnectionParameterUpdate : LinkLayerPacket (type = LE_CONNECTION_PARAMETER_UPDATE) {
311  status : 8,
312  interval : 16,
313  latency : 16,
314  timeout : 16,
315}
316
317packet ScoConnectionRequest : LinkLayerPacket (type = SCO_CONNECTION_REQUEST) {
318  transmit_bandwidth : 32,
319  receive_bandwidth : 32,
320  max_latency : 16,
321  voice_setting : 10,
322  _reserved_ : 6,
323  retransmission_effort : 8,
324  packet_type : 16,
325  class_of_device : 24,
326}
327
328packet ScoConnectionResponse : LinkLayerPacket (type = SCO_CONNECTION_RESPONSE) {
329  status : 8,
330  transmission_interval : 8,
331  retransmission_window : 8,
332  rx_packet_length : 16,
333  tx_packet_length : 16,
334  air_mode : 8,
335  extended : 1,
336  _reserved_ : 7,
337}
338
339packet ScoDisconnect : LinkLayerPacket (type = SCO_DISCONNECT) {
340  reason : 8,
341}
342
343packet Lmp : LinkLayerPacket (type = LMP) {
344  _payload_,
345}
346
347packet Llcp : LinkLayerPacket (type = LLCP) {
348  _payload_,
349}
350
351packet PingRequest : LinkLayerPacket (type = PING_REQUEST) {
352}
353
354packet PingResponse : LinkLayerPacket (type = PING_RESPONSE) {
355}
356
357packet RoleSwitchRequest : LinkLayerPacket (type = ROLE_SWITCH_REQUEST) {
358}
359
360packet RoleSwitchResponse : LinkLayerPacket (type = ROLE_SWITCH_RESPONSE) {
361  status: 8,
362}
363
364packet LlPhyReq : LinkLayerPacket (type = LL_PHY_REQ) {
365  tx_phys: 8,
366  rx_phys: 8,
367}
368
369packet LlPhyRsp : LinkLayerPacket (type = LL_PHY_RSP) {
370  tx_phys: 8,
371  rx_phys: 8,
372}
373
374packet LlPhyUpdateInd : LinkLayerPacket (type = LL_PHY_UPDATE_IND) {
375  phy_c_to_p: 8,
376  phy_p_to_c: 8,
377  instant: 16,
378}
379