blob: 0c27d9730d26a127c2862943a97454235c133283 [file] [log] [blame]
Chienyuandb55f312019-10-31 14:01:28 +08001little_endian_packets
2
Chienyuan3d8a8032019-11-01 18:04:07 +08003custom_field Address : 48 "hci/"
4custom_field ClassOfDevice : 24 "hci/"
Chienyuandb55f312019-10-31 14:01:28 +08005
6enum PacketType : 8 {
7 UNKNOWN = 0x00,
8 ACL = 0x01,
Myles Watson901f82b2019-11-19 09:18:38 -08009 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 COMMAND = 0x23, // Remove
40 RESPONSE = 0x24, // Remove
Chienyuandb55f312019-10-31 14:01:28 +080041}
42
43packet LinkLayerPacket {
44 type : PacketType,
45 source_address : Address,
46 destination_address : Address,
47 _body_,
48}
49
Myles Watson901f82b2019-11-19 09:18:38 -080050packet Command : LinkLayerPacket (type = COMMAND) {
Chienyuandb55f312019-10-31 14:01:28 +080051 _payload_,
52}
53
Myles Watson901f82b2019-11-19 09:18:38 -080054packet Response : LinkLayerPacket (type = RESPONSE) {
55 opcode : 16,
56 _payload_,
57}
58
59packet AclPacket : LinkLayerPacket (type = ACL) {
Chienyuandb55f312019-10-31 14:01:28 +080060 _payload_,
61}
62
63packet Disconnect : LinkLayerPacket (type = DISCONNECT) {
64 reason : 8,
65}
66
67packet EncryptConnection : LinkLayerPacket (type = ENCRYPT_CONNECTION) {
68 key : 8[],
69}
70
71packet EncryptConnectionResponse : LinkLayerPacket (type = ENCRYPT_CONNECTION_RESPONSE) {
72 key : 8[],
73}
74
75enum InquiryState : 8 {
76 STANDBY = 0x00,
77 INQUIRY = 0x01,
78}
79
80enum InquiryType : 8 {
81 STANDARD = 0x00,
82 RSSI = 0x01,
83 EXTENDED = 0x02,
84}
85
86packet Inquiry : LinkLayerPacket (type = INQUIRY) {
87 inquiry_type : InquiryType,
88}
89
90packet BasicInquiryResponse : LinkLayerPacket(type = INQUIRY_RESPONSE) {
91 inquiry_type : InquiryType,
92 page_scan_repetition_mode : 8,
93 class_of_device : ClassOfDevice,
94 clock_offset : 15,
95 _reserved_ : 1,
96 _body_,
97}
98
99packet InquiryResponse : BasicInquiryResponse (inquiry_type = STANDARD) {
100}
101
102packet InquiryResponseWithRssi : BasicInquiryResponse (inquiry_type = RSSI) {
103 rssi: 8,
104}
105
106packet ExtendedInquiryResponse : BasicInquiryResponse (inquiry_type = EXTENDED) {
107 rssi: 8,
108 extended_data : 8[],
109}
110
111packet IoCapabilityRequest : LinkLayerPacket (type = IO_CAPABILITY_REQUEST) {
112 io_capability : 8,
113 oob_data_present : 8,
114 authentication_requirements : 8,
115}
116
117packet IoCapabilityResponse : LinkLayerPacket (type = IO_CAPABILITY_RESPONSE) {
118 io_capability : 8,
119 oob_data_present : 8,
120 authentication_requirements : 8,
121}
122
123packet IoCapabilityNegativeResponse : LinkLayerPacket (type = IO_CAPABILITY_NEGATIVE_RESPONSE) {
124 reason : 8,
125}
126
127enum AddressType : 8 {
128 PUBLIC = 0,
129 RANDOM = 1,
130 PUBLIC_IDENTITY = 2,
131 RANDOM_IDENTITY = 3,
132}
133
134enum AdvertisementType : 8 {
135 ADV_IND = 0, // Connectable and scannable
136 ADV_DIRECT_IND = 1, // Connectable directed
137 ADV_SCAN_IND = 2, // Scannable undirected
138 ADV_NONCONN_IND = 3, // Non connectable undirected
139 SCAN_RESPONSE = 4,
140}
141
142packet LeAdvertisement : LinkLayerPacket (type = LE_ADVERTISEMENT) {
143 address_type : AddressType,
144 advertisement_type : AdvertisementType,
145 data : 8[],
146}
147
148packet LeConnect : LinkLayerPacket (type = LE_CONNECT) {
149 le_connection_interval_min : 16,
150 le_connection_interval_max : 16,
151 le_connection_latency : 16,
152 le_connection_supervision_timeout : 16,
153 address_type : 8,
154}
155
156packet LeConnectComplete : LinkLayerPacket (type = LE_CONNECT_COMPLETE) {
157 le_connection_interval : 16,
158 le_connection_latency : 16,
159 le_connection_supervision_timeout : 16,
160 address_type : 8,
161}
162
163packet LeScan : LinkLayerPacket (type = LE_SCAN) {
164}
165
166packet LeScanResponse : LinkLayerPacket (type = LE_SCAN_RESPONSE) {
167 address_type : AddressType,
168 advertisement_type : AdvertisementType,
169 data : 8[],
170}
171
172packet Page : LinkLayerPacket (type = PAGE) {
173 class_of_device : ClassOfDevice,
174 allow_role_switch : 8,
175}
176
177packet PageResponse : LinkLayerPacket (type = PAGE_RESPONSE) {
178 try_role_switch : 8,
179}
180
181packet PageReject : LinkLayerPacket (type = PAGE_REJECT) {
182 reason : 8,
183}
184
Myles Watson901f82b2019-11-19 09:18:38 -0800185packet ReadClockOffset : LinkLayerPacket (type = READ_CLOCK_OFFSET) {
186}
187
188packet ReadClockOffsetResponse : LinkLayerPacket (type = READ_CLOCK_OFFSET_RESPONSE) {
189 offset : 16,
190}
191
192packet ReadRemoteSupportedFeatures : LinkLayerPacket (type = READ_REMOTE_SUPPORTED_FEATURES) {
193}
194
195packet ReadRemoteSupportedFeaturesResponse : LinkLayerPacket (type = READ_REMOTE_SUPPORTED_FEATURES_RESPONSE) {
196 features : 64,
197}
198
199packet ReadRemoteLmpFeatures : LinkLayerPacket (type = READ_REMOTE_LMP_FEATURES) {
200}
201
202packet ReadRemoteLmpFeaturesResponse : LinkLayerPacket (type = READ_REMOTE_LMP_FEATURES_RESPONSE) {
203 features : 64,
204}
205
206packet ReadRemoteExtendedFeatures : LinkLayerPacket (type = READ_REMOTE_EXTENDED_FEATURES) {
207 page_number : 8,
208}
209
210packet ReadRemoteExtendedFeaturesResponse : LinkLayerPacket (type = READ_REMOTE_EXTENDED_FEATURES_RESPONSE) {
211 status : 8,
212 page_number : 8,
213 max_page_number : 8,
214 features : 64,
215}
216
217packet ReadRemoteVersionInformation : LinkLayerPacket (type = READ_REMOTE_VERSION_INFORMATION) {
218}
219
220packet ReadRemoteVersionInformationResponse : LinkLayerPacket (type = READ_REMOTE_VERSION_INFORMATION_RESPONSE) {
221 lmp_version : 8,
222 lmp_subversion : 8,
223 manufacturer_name : 16,
224}
225
226packet RemoteNameRequest : LinkLayerPacket (type = REMOTE_NAME_REQUEST) {
227}
228
229packet RemoteNameRequestResponse : LinkLayerPacket (type = REMOTE_NAME_REQUEST_RESPONSE) {
230 _size_(name) : 8,
231 name : 8[],
232}
233
234packet ScoPacket : LinkLayerPacket (type = SCO) {
Chienyuandb55f312019-10-31 14:01:28 +0800235 _payload_,
236}
Myles Watson901f82b2019-11-19 09:18:38 -0800237