blob: ae44cb1b899dba5478d761ba8deed2c1e40dc7d3 [file] [log] [blame]
Myles Watsona4cd53c2019-03-25 15:25:08 -07001little_endian_packets
2
Myles Watson9ad9dfd2019-04-16 17:05:10 -07003checksum Fcs : 16 "l2cap/"
4
Myles Watsona4cd53c2019-03-25 15:25:08 -07005packet BasicFrame {
Myles Watson1d8aa282019-04-22 14:16:41 -07006 _size_(_payload_) : 16,
7 channel_id : 16,
8 _payload_,
Myles Watsona4cd53c2019-03-25 15:25:08 -07009}
10
Myles Watson9ad9dfd2019-04-16 17:05:10 -070011packet BasicFrameWithFcs {
Myles Watson1d8aa282019-04-22 14:16:41 -070012 _checksum_start_(fcs),
13 _size_(_payload_) : 16,
14 channel_id : 16,
15 _payload_ : [+2*8], // Include Fcs in the _size_
16 fcs : Fcs,
Myles Watson9ad9dfd2019-04-16 17:05:10 -070017}
18
Myles Watson2df67032019-07-11 16:17:05 -070019enum Continuation : 1 {
20 END = 0,
21 CONTINUE = 1,
22}
23
Myles Watsona4cd53c2019-03-25 15:25:08 -070024// ChannelId 2 is connectionless
Myles Watson1d8aa282019-04-22 14:16:41 -070025packet GroupFrame : BasicFrame (channel_id = 0x02) {
26 psm : 16,
27 _payload_,
Myles Watsona4cd53c2019-03-25 15:25:08 -070028}
29
30enum FrameType : 1 {
31 I_FRAME = 0,
32 S_FRAME = 1,
33}
34
35enum SupervisoryFunction : 2 {
36 RECEIVER_READY = 0,
37 REJECT = 1,
38 RECEIVER_NOT_READY = 2,
39 SELECT_REJECT = 3,
40}
41
42enum RetransmissionDisable : 1 {
43 NORMAL = 0,
44 DISABLE = 1,
45}
46
47enum SegmentationAndReassembly : 2 {
48 UNSEGMENTED = 0,
49 START = 1,
50 END = 2,
51 CONTINUATION = 3,
52}
53
54packet StandardFrame : BasicFrame {
Myles Watson1d8aa282019-04-22 14:16:41 -070055 frame_type : FrameType,
56 _body_,
Myles Watsona4cd53c2019-03-25 15:25:08 -070057}
58
Myles Watson9ad9dfd2019-04-16 17:05:10 -070059packet StandardFrameWithFcs : BasicFrameWithFcs {
Myles Watson1d8aa282019-04-22 14:16:41 -070060 frame_type : FrameType,
61 _body_,
Myles Watson9ad9dfd2019-04-16 17:05:10 -070062}
63
Myles Watsona4cd53c2019-03-25 15:25:08 -070064group StandardSupervisoryControl {
Myles Watson1d8aa282019-04-22 14:16:41 -070065 _fixed_ = 0 : 1,
Myles Watsond68d6ce2019-05-22 10:52:49 -070066 s : SupervisoryFunction,
Myles Watson1d8aa282019-04-22 14:16:41 -070067 _reserved_ : 3,
Myles Watsond68d6ce2019-05-22 10:52:49 -070068 r : RetransmissionDisable,
Myles Watson1d8aa282019-04-22 14:16:41 -070069 req_seq : 6,
70 _reserved_ : 2,
Myles Watsona4cd53c2019-03-25 15:25:08 -070071}
72
73group StandardInformationControl {
Myles Watson1d8aa282019-04-22 14:16:41 -070074 tx_seq : 6,
Myles Watsond68d6ce2019-05-22 10:52:49 -070075 r : RetransmissionDisable,
Myles Watson1d8aa282019-04-22 14:16:41 -070076 req_seq : 6,
77 sar : SegmentationAndReassembly,
Myles Watsona4cd53c2019-03-25 15:25:08 -070078}
79
Myles Watson1d8aa282019-04-22 14:16:41 -070080packet StandardSupervisoryFrame : StandardFrame (frame_type = S_FRAME) {
Myles Watsona4cd53c2019-03-25 15:25:08 -070081 StandardSupervisoryControl,
82}
83
Myles Watson1d8aa282019-04-22 14:16:41 -070084packet StandardSupervisoryFrameWithFcs : StandardFrameWithFcs (frame_type = S_FRAME) {
Myles Watsona4cd53c2019-03-25 15:25:08 -070085 StandardSupervisoryControl,
Myles Watsona4cd53c2019-03-25 15:25:08 -070086}
87
Myles Watson1d8aa282019-04-22 14:16:41 -070088packet StandardInformationFrame : StandardFrame (frame_type = I_FRAME) {
Myles Watsona4cd53c2019-03-25 15:25:08 -070089 StandardInformationControl,
Myles Watson1d8aa282019-04-22 14:16:41 -070090 _payload_,
Myles Watsona4cd53c2019-03-25 15:25:08 -070091}
92
Myles Watson1d8aa282019-04-22 14:16:41 -070093packet StandardInformationFrameWithFcs : StandardFrameWithFcs (frame_type = I_FRAME) {
Myles Watsona4cd53c2019-03-25 15:25:08 -070094 StandardInformationControl,
Myles Watson1d8aa282019-04-22 14:16:41 -070095 _payload_,
Myles Watsona4cd53c2019-03-25 15:25:08 -070096}
97
Myles Watson1d8aa282019-04-22 14:16:41 -070098packet StandardInformationStartFrame : StandardInformationFrame (sar = START) {
Myles Watsond68d6ce2019-05-22 10:52:49 -070099 l2cap_sdu_length : 16,
Myles Watson1d8aa282019-04-22 14:16:41 -0700100 _payload_,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700101}
102
Myles Watson1d8aa282019-04-22 14:16:41 -0700103packet StandardInformationStartFrameWithFcs : StandardInformationFrameWithFcs (sar = START) {
Myles Watsond68d6ce2019-05-22 10:52:49 -0700104 l2cap_sdu_length : 16,
Myles Watson1d8aa282019-04-22 14:16:41 -0700105 _payload_,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700106}
107
108enum Poll : 1 {
109 NOT_SET = 0,
110 POLL = 1,
111}
112
113enum Final : 1 {
114 NOT_SET = 0,
115 POLL_RESPONSE = 1,
116}
117
118group EnhancedSupervisoryControl {
Myles Watson1d8aa282019-04-22 14:16:41 -0700119 _fixed_ = 0 : 1,
Myles Watsond68d6ce2019-05-22 10:52:49 -0700120 s : SupervisoryFunction,
121 p : Poll,
Myles Watson1d8aa282019-04-22 14:16:41 -0700122 _reserved_ : 2,
Myles Watsond68d6ce2019-05-22 10:52:49 -0700123 f : Final,
Myles Watson1d8aa282019-04-22 14:16:41 -0700124 req_seq : 6,
125 _reserved_ : 2,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700126}
127
128group EnhancedInformationControl {
Myles Watson1d8aa282019-04-22 14:16:41 -0700129 tx_seq : 6,
Myles Watsond68d6ce2019-05-22 10:52:49 -0700130 f : Final,
Myles Watson1d8aa282019-04-22 14:16:41 -0700131 req_seq : 6,
132 sar : SegmentationAndReassembly,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700133}
134
Myles Watson1d8aa282019-04-22 14:16:41 -0700135packet EnhancedSupervisoryFrame : StandardFrame (frame_type = S_FRAME) {
Myles Watsona4cd53c2019-03-25 15:25:08 -0700136 EnhancedSupervisoryControl,
137}
138
Myles Watson1d8aa282019-04-22 14:16:41 -0700139packet EnhancedSupervisoryFrameWithFcs : StandardFrameWithFcs (frame_type = S_FRAME) {
Myles Watsona4cd53c2019-03-25 15:25:08 -0700140 EnhancedSupervisoryControl,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700141}
142
Myles Watson1d8aa282019-04-22 14:16:41 -0700143packet EnhancedInformationFrame : StandardFrame (frame_type = I_FRAME) {
Myles Watsona4cd53c2019-03-25 15:25:08 -0700144 EnhancedInformationControl,
Myles Watson1d8aa282019-04-22 14:16:41 -0700145 _payload_,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700146}
147
Myles Watson1d8aa282019-04-22 14:16:41 -0700148packet EnhancedInformationFrameWithFcs : StandardFrameWithFcs (frame_type = I_FRAME) {
Myles Watsona4cd53c2019-03-25 15:25:08 -0700149 EnhancedInformationControl,
Myles Watson1d8aa282019-04-22 14:16:41 -0700150 _payload_,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700151}
152
Myles Watson1d8aa282019-04-22 14:16:41 -0700153packet EnhancedInformationStartFrame : EnhancedInformationFrame (sar = START) {
Myles Watsond68d6ce2019-05-22 10:52:49 -0700154 l2cap_sdu_length : 16,
Myles Watson1d8aa282019-04-22 14:16:41 -0700155 _payload_,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700156}
157
Myles Watson1d8aa282019-04-22 14:16:41 -0700158packet EnhancedInformationStartFrameWithFcs : EnhancedInformationFrameWithFcs (sar = START) {
Myles Watsond68d6ce2019-05-22 10:52:49 -0700159 l2cap_sdu_length : 16,
Myles Watson1d8aa282019-04-22 14:16:41 -0700160 _payload_,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700161}
162
163group ExtendedSupervisoryControl {
Myles Watsond68d6ce2019-05-22 10:52:49 -0700164 f : Final,
Myles Watson1d8aa282019-04-22 14:16:41 -0700165 req_seq : 14,
Myles Watsond68d6ce2019-05-22 10:52:49 -0700166 s : SupervisoryFunction,
167 p : Poll,
Myles Watson1d8aa282019-04-22 14:16:41 -0700168 _reserved_ : 5,
169 _reserved_ : 8,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700170}
171
172group ExtendedInformationControl {
Myles Watsond68d6ce2019-05-22 10:52:49 -0700173 f : Final,
Myles Watson1d8aa282019-04-22 14:16:41 -0700174 req_seq : 14,
175 sar : SegmentationAndReassembly,
176 tx_seq : 14,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700177}
178
Myles Watson1d8aa282019-04-22 14:16:41 -0700179packet ExtendedSupervisoryFrame : StandardFrame (frame_type = S_FRAME) {
Myles Watsona4cd53c2019-03-25 15:25:08 -0700180 ExtendedSupervisoryControl,
181}
182
Myles Watson1d8aa282019-04-22 14:16:41 -0700183packet ExtendedSupervisoryFrameWithFcs : StandardFrameWithFcs (frame_type = S_FRAME) {
Myles Watsona4cd53c2019-03-25 15:25:08 -0700184 ExtendedSupervisoryControl,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700185}
186
Myles Watson1d8aa282019-04-22 14:16:41 -0700187packet ExtendedInformationFrame : StandardFrame (frame_type = I_FRAME) {
Myles Watsona4cd53c2019-03-25 15:25:08 -0700188 ExtendedInformationControl,
Myles Watson1d8aa282019-04-22 14:16:41 -0700189 _payload_,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700190}
191
Myles Watson1d8aa282019-04-22 14:16:41 -0700192packet ExtendedInformationFrameWithFcs : StandardFrameWithFcs (frame_type = I_FRAME) {
Myles Watsona4cd53c2019-03-25 15:25:08 -0700193 ExtendedInformationControl,
Myles Watson1d8aa282019-04-22 14:16:41 -0700194 _payload_,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700195}
196
Myles Watson1d8aa282019-04-22 14:16:41 -0700197packet ExtendedInformationStartFrame : ExtendedInformationFrame (sar = START) {
Myles Watsond68d6ce2019-05-22 10:52:49 -0700198 l2cap_sdu_length : 16,
Myles Watson1d8aa282019-04-22 14:16:41 -0700199 _payload_,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700200}
201
Myles Watson1d8aa282019-04-22 14:16:41 -0700202packet ExtendedInformationStartFrameWithFcs : ExtendedInformationFrameWithFcs (sar = START) {
Myles Watsond68d6ce2019-05-22 10:52:49 -0700203 l2cap_sdu_length : 16,
Myles Watson1d8aa282019-04-22 14:16:41 -0700204 _payload_,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700205}
206
207packet FirstLeInformationFrame : BasicFrame {
Myles Watsond68d6ce2019-05-22 10:52:49 -0700208 l2cap_sdu_length : 16,
Myles Watson1d8aa282019-04-22 14:16:41 -0700209 _payload_,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700210}
211
212enum CommandCode : 8 {
213 COMMAND_REJECT = 0x01,
214 CONNECTION_REQUEST = 0x02,
215 CONNECTION_RESPONSE = 0x03,
216 CONFIGURATION_REQUEST = 0x04,
217 CONFIGURATION_RESPONSE = 0x05,
218 DISCONNECTION_REQUEST = 0x06,
219 DISCONNECTION_RESPONSE = 0x07,
220 ECHO_REQUEST = 0x08,
221 ECHO_RESPONSE = 0x09,
222 INFORMATION_REQUEST = 0x0A,
223 INFORMATION_RESPONSE = 0x0B,
224 CREATE_CHANNEL_REQUEST = 0x0C,
225 CREATE_CHANNEL_RESPONSE = 0x0D,
226 MOVE_CHANNEL_REQUEST = 0x0E,
227 MOVE_CHANNEL_RESPONSE = 0x0F,
228 MOVE_CHANNEL_CONFIRMATION_REQUEST = 0x10,
229 MOVE_CHANNEL_CONFIRMATION_RESPONSE = 0x11,
230}
231
Myles Watson1d8aa282019-04-22 14:16:41 -0700232packet ControlFrame : BasicFrame (channel_id = 0x0001) {
Chris Manton3360b8d2019-07-17 11:37:27 -0700233 _payload_,
234}
235
236packet Control {
Myles Watson1d8aa282019-04-22 14:16:41 -0700237 code : CommandCode,
238 identifier : 8,
239 _size_(_payload_) : 16,
240 _payload_,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700241}
242
Myles Watsona4cd53c2019-03-25 15:25:08 -0700243enum CommandRejectReason : 16 {
244 COMMAND_NOT_UNDERSTOOD = 0x0000,
245 SIGNALING_MTU_EXCEEDED = 0x0001,
246 INVALID_CID_IN_REQUEST = 0x0002,
247}
248
Chris Manton3360b8d2019-07-17 11:37:27 -0700249packet CommandReject : Control (code = COMMAND_REJECT) {
Myles Watson1d8aa282019-04-22 14:16:41 -0700250 reason : CommandRejectReason,
251 _body_,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700252}
253
Myles Watson1d8aa282019-04-22 14:16:41 -0700254packet CommandRejectNotUnderstood : CommandReject (reason = COMMAND_NOT_UNDERSTOOD) {
Myles Watsona4cd53c2019-03-25 15:25:08 -0700255}
256
Myles Watson1d8aa282019-04-22 14:16:41 -0700257packet CommandRejectMtuExceeded : CommandReject (reason = SIGNALING_MTU_EXCEEDED) {
258 actual_mtu : 16,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700259}
260
Myles Watson1d8aa282019-04-22 14:16:41 -0700261packet CommandRejectInvalidCid : CommandReject (reason = INVALID_CID_IN_REQUEST) {
262 local_channel : 16, // Relative to the sender of the CommandReject
263 remote_channel : 16,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700264}
265
Chris Manton3360b8d2019-07-17 11:37:27 -0700266packet ConnectionRequest : Control (code = CONNECTION_REQUEST) {
Myles Watson1d8aa282019-04-22 14:16:41 -0700267 psm : 16,
268 source_cid : 16,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700269}
270
271enum ConnectionResponseResult : 16 {
Myles Watsona6b27a52019-05-15 07:18:18 -0700272 SUCCESS = 0x0000,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700273 PENDING = 0x0001,
274 PSM_NOT_SUPPORTED = 0x0002,
275 SECURITY_BLOCK = 0x0003,
276 NO_RESOURCES_AVAILABLE = 0x0004,
277 INVALID_CID = 0x0006,
278 SOURCE_CID_ALREADY_ALLOCATED = 0x0007,
279}
280
281enum ConnectionResponseStatus : 16 {
282 NO_FURTHER_INFORMATION_AVAILABLE = 0x0000,
283 AUTHENTICATION_PENDING = 0x0001,
284 AUTHORIZATION_PENDING = 0x0002,
285}
286
Chris Manton3360b8d2019-07-17 11:37:27 -0700287packet ConnectionResponse : Control (code = CONNECTION_RESPONSE) {
Myles Watson1d8aa282019-04-22 14:16:41 -0700288 destination_cid : 16,
289 source_cid : 16,
290 result : ConnectionResponseResult,
291 status : ConnectionResponseStatus,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700292}
293
Myles Watson2df67032019-07-11 16:17:05 -0700294enum ConfigurationOptionType : 7 {
Myles Watsona4cd53c2019-03-25 15:25:08 -0700295 MTU = 0x01,
296 FLUSH_TIMEOUT = 0x02,
297 QUALITY_OF_SERVICE = 0x03,
298 RETRANSMISSION_AND_FLOW_CONTROL = 0x04,
299 FRAME_CHECK_SEQUENCE = 0x05,
300 EXTENDED_FLOW_SPECIFICATION = 0x06,
301 EXTENDED_WINDOW_SIZE = 0x07,
302}
303
304enum ConfigurationOptionIsHint : 1 {
305 OPTION_MUST_BE_RECOGNIZED = 0,
306 OPTION_IS_A_HINT = 1,
307}
308
Myles Watson2df67032019-07-11 16:17:05 -0700309struct ConfigurationOption {
310 type : ConfigurationOptionType,
Myles Watson1d8aa282019-04-22 14:16:41 -0700311 is_hint : ConfigurationOptionIsHint,
Myles Watson2df67032019-07-11 16:17:05 -0700312 length : 8,
313 _body_,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700314}
315
Myles Watson2df67032019-07-11 16:17:05 -0700316struct MtuConfigurationOption : ConfigurationOption (type = MTU, length = 2) {
Myles Watson1d8aa282019-04-22 14:16:41 -0700317 mtu : 16,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700318}
319
Myles Watson2df67032019-07-11 16:17:05 -0700320struct FlushTimeoutConfigurationOption : ConfigurationOption (type = FLUSH_TIMEOUT, length = 2) {
Myles Watson1d8aa282019-04-22 14:16:41 -0700321 flush_timeout : 16,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700322}
323
324enum QosServiceType : 8 {
325 NO_TRAFFIC = 0x00,
326 BEST_EFFORT = 0x01, // Default
327 GUARANTEED = 0x02,
328}
329
Myles Watson2df67032019-07-11 16:17:05 -0700330struct QualityOfServiceConfigurationOption : ConfigurationOption (type = QUALITY_OF_SERVICE, length = 22) {
Myles Watson1d8aa282019-04-22 14:16:41 -0700331 _reserved_ : 8, // Flags
332 service_type : QosServiceType,
Myles Watson2df67032019-07-11 16:17:05 -0700333 token_rate : 32, // 0 = ignore, 0xffffffff = max available
Myles Watson1d8aa282019-04-22 14:16:41 -0700334 token_bucket_size : 32, // 0 = ignore, 0xffffffff = max available
Myles Watson2df67032019-07-11 16:17:05 -0700335 peak_bandwidth : 32, // Octets/second 0 = ignore
336 latency : 32, // microseconds 0xffffffff = ignore
337 delay_variation : 32, // microseconds 0xffffffff = ignore
Myles Watsona4cd53c2019-03-25 15:25:08 -0700338}
339
340enum RetransmissionAndFlowControlModeOption : 8 {
341 L2CAP_BASIC = 0x00,
342 RETRANSMISSION = 0x01,
343 FLOW_CONTROL = 0x02,
344 ENHANCED_RETRANSMISSION = 0x03,
345 STREAMING = 0x04,
346}
347
348
Hansong Zhanga6312532019-11-19 14:01:36 -0800349struct RetransmissionAndFlowControlConfigurationOption : ConfigurationOption (type = RETRANSMISSION_AND_FLOW_CONTROL, length = 9) {
Myles Watson1d8aa282019-04-22 14:16:41 -0700350 mode : RetransmissionAndFlowControlModeOption,
351 tx_window_size : 8, // 1-32 for Flow Control and Retransmission, 1-63 for Enhanced
352 max_transmit : 8,
Hansong Zhanga6312532019-11-19 14:01:36 -0800353 retransmission_time_out : 16,
Myles Watson1d8aa282019-04-22 14:16:41 -0700354 monitor_time_out : 16,
355 maximum_pdu_size : 16,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700356}
357
358enum FcsType : 8 {
359 NO_FCS = 0,
360 DEFAULT = 1, // 16-bit FCS
361}
362
Myles Watson2df67032019-07-11 16:17:05 -0700363struct FrameCheckSequenceOption : ConfigurationOption (type = FRAME_CHECK_SEQUENCE, length = 1) {
Myles Watson1d8aa282019-04-22 14:16:41 -0700364 fcs_type : FcsType,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700365}
366
367
Myles Watson2df67032019-07-11 16:17:05 -0700368struct ExtendedFlowSpecificationOption : ConfigurationOption (type = EXTENDED_FLOW_SPECIFICATION, length = 16) {
Myles Watson1d8aa282019-04-22 14:16:41 -0700369 identifier : 8, // Default 0x01, must be 0x01 for Extended Flow-Best-Effort
370 service_type : QosServiceType,
371 maximum_sdu_size : 16, // Octets
372 sdu_interarrival_time : 32, // in microseconds
373 access_latency : 32, // in microseconds, without HCI and stack overheads
374 flush_timeout : 32, // in microseconds 0x0 = no retransmissions 0xFFFFFFFF = never flushed
Myles Watsona4cd53c2019-03-25 15:25:08 -0700375}
376
Myles Watson2df67032019-07-11 16:17:05 -0700377struct ExtendedWindowSizeOption : ConfigurationOption (type = EXTENDED_WINDOW_SIZE, length = 2) {
Myles Watson1d8aa282019-04-22 14:16:41 -0700378 max_window_size : 16, // 0x0000 = Valid for streaming, 0x0001-0x3FFF Valid for Enhanced Retransmission
Myles Watsona4cd53c2019-03-25 15:25:08 -0700379}
380
Myles Watson2df67032019-07-11 16:17:05 -0700381packet ConfigurationRequest : Control (code = CONFIGURATION_REQUEST) {
382 destination_cid : 16,
383 continuation : Continuation,
384 _reserved_ : 15,
385 config : ConfigurationOption[],
Myles Watsona4cd53c2019-03-25 15:25:08 -0700386}
387
388enum ConfigurationResponseResult : 16 {
389 SUCCESS = 0x0000,
390 UNACCEPTABLE_PARAMETERS = 0x0001,
391 REJECTED = 0x0002,
392 UNKNOWN_OPTIONS = 0x0003,
393 PENDING = 0x0004,
394 FLOW_SPEC_REJECTED = 0x0005,
395}
396
Myles Watson2df67032019-07-11 16:17:05 -0700397packet ConfigurationResponse : Control (code = CONFIGURATION_RESPONSE) {
Myles Watson1d8aa282019-04-22 14:16:41 -0700398 source_cid : 16,
Myles Watson2df67032019-07-11 16:17:05 -0700399 continuation : Continuation,
Myles Watson1d8aa282019-04-22 14:16:41 -0700400 _reserved_ : 15,
401 result : ConfigurationResponseResult,
Myles Watson2df67032019-07-11 16:17:05 -0700402 config : ConfigurationOption[],
Myles Watsona4cd53c2019-03-25 15:25:08 -0700403}
404
Chris Manton3360b8d2019-07-17 11:37:27 -0700405packet DisconnectionRequest : Control (code = DISCONNECTION_REQUEST) {
Myles Watson1d8aa282019-04-22 14:16:41 -0700406 destination_cid : 16,
407 source_cid : 16,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700408}
409
Chris Manton3360b8d2019-07-17 11:37:27 -0700410packet DisconnectionResponse : Control (code = DISCONNECTION_RESPONSE) {
Myles Watson1d8aa282019-04-22 14:16:41 -0700411 destination_cid : 16,
412 source_cid : 16,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700413}
414
Chris Manton3360b8d2019-07-17 11:37:27 -0700415packet EchoRequest : Control (code = ECHO_REQUEST) {
Myles Watson1d8aa282019-04-22 14:16:41 -0700416 _payload_, // Optional and implementation specific
Myles Watsona4cd53c2019-03-25 15:25:08 -0700417}
418
Chris Manton3360b8d2019-07-17 11:37:27 -0700419packet EchoResponse : Control (code = ECHO_RESPONSE) {
Myles Watson1d8aa282019-04-22 14:16:41 -0700420 _payload_, // Optional and implementation specific
Myles Watsona4cd53c2019-03-25 15:25:08 -0700421}
422
423enum InformationRequestInfoType : 16 {
424 CONNECTIONLESS_MTU = 0x0001,
425 EXTENDED_FEATURES_SUPPORTED = 0x0002,
426 FIXED_CHANNELS_SUPPORTED = 0x0003,
427}
428
Chris Manton3360b8d2019-07-17 11:37:27 -0700429packet InformationRequest : Control (code = INFORMATION_REQUEST) {
Myles Watson1d8aa282019-04-22 14:16:41 -0700430 info_type : InformationRequestInfoType,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700431}
432
433enum InformationRequestResult : 16 {
434 SUCCESS = 0x0000,
435 NOT_SUPPORTED = 0x0001,
436}
437
Chris Manton3360b8d2019-07-17 11:37:27 -0700438packet InformationResponse : Control (code = INFORMATION_RESPONSE) {
Myles Watson1d8aa282019-04-22 14:16:41 -0700439 info_type : InformationRequestInfoType,
440 result : InformationRequestResult,
441 _body_,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700442}
443
Myles Watson1d8aa282019-04-22 14:16:41 -0700444packet InformationResponseConnectionlessMtu : InformationResponse (info_type = CONNECTIONLESS_MTU) {
445 connectionless_mtu : 16,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700446}
447
Myles Watson1d8aa282019-04-22 14:16:41 -0700448packet InformationResponseExtendedFeatures : InformationResponse (info_type = EXTENDED_FEATURES_SUPPORTED) {
Myles Watsona4cd53c2019-03-25 15:25:08 -0700449 // ExtendedFeatureMask : 32,
Myles Watson1d8aa282019-04-22 14:16:41 -0700450 flow_control_mode : 1,
451 retransmission_mode : 1,
452 bi_directional_qoS : 1,
453 enhanced_retransmission_mode : 1,
454 streaming_mode : 1,
455 fcs_option : 1,
456 extended_flow_specification_for_br_edr : 1,
457 fixed_channels : 1,
458 extended_window_size : 1,
459 unicast_connectionless_data_reception : 1,
460 _reserved_ : 22,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700461}
462
Myles Watson1d8aa282019-04-22 14:16:41 -0700463packet InformationResponseFixedChannels : InformationResponse (info_type = FIXED_CHANNELS_SUPPORTED) {
464 fixed_channels : 64, // bit 0 must be 0, bit 1 must be 1, all others 1 = supported
Myles Watsona4cd53c2019-03-25 15:25:08 -0700465}
466
Chris Manton3360b8d2019-07-17 11:37:27 -0700467packet CreateChannelRequest : Control (code = CREATE_CHANNEL_REQUEST) {
Myles Watson1d8aa282019-04-22 14:16:41 -0700468 psm : 16,
469 source_cid : 16,
470 controller_id : 8,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700471}
472
473enum CreateChannelResponseResult : 16 {
Myles Watsona6b27a52019-05-15 07:18:18 -0700474 SUCCESS = 0x0000,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700475 PENDING = 0x0001,
476 PSM_NOT_SUPPORTED = 0x0002,
477 SECURITY_BLOCK = 0x0003,
478 NO_RESOURCES_AVAILABLE = 0x0004,
479 CONTROLLER_ID_NOT_SUPPORTED = 0x0005,
480 INVALID_CID = 0x0006,
481 SOURCE_CID_ALREADY_ALLOCATED = 0x0007,
482}
483
484enum CreateChannelResponseStatus : 16 {
485 NO_FURTHER_INFORMATION_AVAILABLE = 0x0000,
486 AUTHENTICATION_PENDING = 0x0001,
487 AUTHORIZATION_PENDING = 0x0002,
488}
489
Chris Manton3360b8d2019-07-17 11:37:27 -0700490packet CreateChannelResponse : Control (code = CREATE_CHANNEL_RESPONSE) {
Myles Watson1d8aa282019-04-22 14:16:41 -0700491 destination_cid : 16,
492 source_cid : 16,
493 result : CreateChannelResponseResult,
494 status : CreateChannelResponseStatus,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700495}
496
497// AMP Only ?
Chris Manton3360b8d2019-07-17 11:37:27 -0700498packet MoveChannelRequest : Control (code = MOVE_CHANNEL_REQUEST) {
Myles Watson1d8aa282019-04-22 14:16:41 -0700499 initiator_cid : 16,
500 dest_controller_id : 8,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700501}
502
503enum MoveChannelResponseResult : 16 {
504 SUCCESS = 0x0000,
505 PENDING = 0x0001,
506 CONTROLLER_ID_NOT_SUPPORTED = 0x0002,
507 NEW_CONTROLLER_ID_IS_SAME = 0x0003,
508 CONFIGURATION_NOT_SUPPORTED = 0x0004,
509 CHANNEL_COLLISION = 0x0005,
510 CHANNEL_NOT_ALLOWED_TO_BE_MOVED = 0x0006,
511}
512
Chris Manton3360b8d2019-07-17 11:37:27 -0700513packet MoveChannelResponse : Control (code = MOVE_CHANNEL_RESPONSE) {
Myles Watson1d8aa282019-04-22 14:16:41 -0700514 initiator_cid : 16,
515 result : MoveChannelResponseResult,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700516}
517
518enum MoveChannelConfirmationResult : 16 {
519 SUCCESS = 0x0000,
520 FAILURE = 0x0001,
521}
522
Chris Manton3360b8d2019-07-17 11:37:27 -0700523packet MoveChannelConfirmationRequest : Control (code = MOVE_CHANNEL_CONFIRMATION_REQUEST) {
Myles Watson1d8aa282019-04-22 14:16:41 -0700524 initiator_cid : 16,
525 result : MoveChannelConfirmationResult,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700526}
527
Chris Manton3360b8d2019-07-17 11:37:27 -0700528packet MoveChannelConfirmationResponse : Control (code = MOVE_CHANNEL_CONFIRMATION_RESPONSE) {
Myles Watson1d8aa282019-04-22 14:16:41 -0700529 initiator_cid : 16,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700530}
531
532enum LeCommandCode : 8 {
533 COMMAND_REJECT = 0x01,
534 DISCONNECTION_REQUEST = 0x06,
535 DISCONNECTION_RESPONSE = 0x07,
536 CONNECTION_PARAMETER_UPDATE_REQUEST = 0x12,
537 CONNECTION_PARAMETER_UPDATE_RESPONSE = 0x13,
538 LE_CREDIT_BASED_CONNECTION_REQUEST = 0x14,
539 LE_CREDIT_BASED_CONNECTION_RESPONSE = 0x15,
540 LE_FLOW_CONTROL_CREDIT = 0x16,
541}
542
Myles Watson1d8aa282019-04-22 14:16:41 -0700543packet LeControlFrame : BasicFrame (channel_id = 0x0005) {
Chris Manton3360b8d2019-07-17 11:37:27 -0700544 _payload_,
545}
546
547packet LeControl {
Myles Watson1d8aa282019-04-22 14:16:41 -0700548 code : LeCommandCode,
549 identifier : 8, // Must be non-zero
550 _size_(_payload_) : 16,
551 _payload_,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700552}
553
Chris Manton3360b8d2019-07-17 11:37:27 -0700554
555packet LeCommandReject : LeControl (code = COMMAND_REJECT) {
Myles Watson1d8aa282019-04-22 14:16:41 -0700556 reason : CommandRejectReason,
557 _payload_,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700558}
559
Myles Watson1d8aa282019-04-22 14:16:41 -0700560packet LeCommandRejectNotUnderstood : LeCommandReject (reason = COMMAND_NOT_UNDERSTOOD) {
Myles Watsona4cd53c2019-03-25 15:25:08 -0700561}
562
Myles Watson1d8aa282019-04-22 14:16:41 -0700563packet LeCommandRejectMtuExceeded : LeCommandReject (reason = SIGNALING_MTU_EXCEEDED) {
564 actual_mtu : 16,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700565}
566
Myles Watson1d8aa282019-04-22 14:16:41 -0700567packet LeCommandRejectInvalidCid : LeCommandReject (reason = INVALID_CID_IN_REQUEST) {
568 local_channel : 16, // Relative to the sender of the CommandReject
569 remote_channel : 16,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700570}
571
Chris Manton3360b8d2019-07-17 11:37:27 -0700572packet LeDisconnectionRequest : LeControl (code = DISCONNECTION_REQUEST) {
Myles Watson1d8aa282019-04-22 14:16:41 -0700573 destination_cid : 16,
574 source_cid : 16,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700575}
576
Chris Manton3360b8d2019-07-17 11:37:27 -0700577packet LeDisconnectionResponse : LeControl (code = DISCONNECTION_RESPONSE) {
Myles Watson1d8aa282019-04-22 14:16:41 -0700578 destination_cid : 16,
579 source_cid : 16,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700580}
581
Chris Manton3360b8d2019-07-17 11:37:27 -0700582packet ConnectionParameterUpdateRequest : LeControl (code = CONNECTION_PARAMETER_UPDATE_REQUEST) {
Myles Watson1d8aa282019-04-22 14:16:41 -0700583 interval_min : 16,
584 interval_max : 16,
585 slave_latency : 16,
586 timeout_multiplier : 16,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700587}
588
589enum ConnectionParameterUpdateResponseResult : 16 {
590 ACCEPTED = 0,
591 REJECTED = 1,
592}
593
Chris Manton3360b8d2019-07-17 11:37:27 -0700594packet ConnectionParameterUpdateResponse : LeControl (code = CONNECTION_PARAMETER_UPDATE_RESPONSE) {
Myles Watson1d8aa282019-04-22 14:16:41 -0700595 result : ConnectionParameterUpdateResponseResult,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700596}
597
Chris Manton3360b8d2019-07-17 11:37:27 -0700598packet LeCreditBasedConnectionRequest : LeControl (code = LE_CREDIT_BASED_CONNECTION_REQUEST) {
Myles Watson1d8aa282019-04-22 14:16:41 -0700599 le_psm : 16, // 0x0001-0x007F Fixed, 0x0080-0x00FF Dynamic
600 source_cid : 16,
601 mtu : 16,
602 mps : 16,
603 initial_credits : 16,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700604}
605
606enum LeCreditBasedConnectionResponseResult : 16 {
607 SUCCESS = 0x0000,
608 LE_PSM_NOT_SUPPORTED = 0x0002,
609 NO_RESOURCES_AVAILABLE = 0x0004,
610 INSUFFICIENT_AUTHENTICATION = 0x0005,
611 INSUFFICIENT_AUTHORIZATION = 0x0006,
612 INSUFFICIENT_ENCRYPTION_KEY_SIZE = 0x0007,
613 INSUFFICIENT_ENCRYPTION = 0x0008,
614 INVALID_SOURCE_CID = 0x0009,
615 SOURCE_CID_ALREADY_ALLOCATED = 0x000A,
616 UNACCEPTABLE_PARAMETERS = 0x000B,
617}
618
Chris Manton3360b8d2019-07-17 11:37:27 -0700619packet LeCreditBasedConnectionResponse : LeControl (code = LE_CREDIT_BASED_CONNECTION_RESPONSE) {
Myles Watson1d8aa282019-04-22 14:16:41 -0700620 destination_cid : 16,
621 mtu : 16,
622 mps : 16,
623 initial_credits : 16,
624 result : LeCreditBasedConnectionResponseResult,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700625}
626
Chris Manton3360b8d2019-07-17 11:37:27 -0700627packet LeFlowControlCredit : LeControl (code = LE_FLOW_CONTROL_CREDIT) {
Myles Watson1d8aa282019-04-22 14:16:41 -0700628 cid : 16, // Receiver's destination CID
629 credits : 16,
Myles Watsona4cd53c2019-03-25 15:25:08 -0700630}
631