1little_endian_packets
2
3enum Opcode : 7 {
4  NAME_REQ = 0x1,
5  NAME_RES = 0x2,
6  ACCEPTED = 0x3,
7  NOT_ACCEPTED = 0x4,
8  CLK_OFFSET_REQ = 0x5,
9  CLK_OFFSET_RES = 0x6,
10  DETACH = 0x7,
11  IN_RAND = 0x8,
12  COMB_KEY = 0x9,
13  UNIT_KEY = 10,
14  AU_RAND = 11,
15  SRES = 12,
16  TEMP_RAND = 13,
17  TEMP_KEY = 14,
18  ENCRYPTION_MODE_REQ = 15,
19  ENCRYPTION_KEY_SIZE_REQ = 16,
20  START_ENCRYPTION_REQ = 17,
21  STOP_ENCRYPTION_REQ = 18,
22  SWITCH_REQ = 19,
23  HOLD = 20,
24  HOLD_REQ = 21,
25  SNIFF_REQ = 23,
26  UNSNIFF_REQ = 24,
27  INCR_POWER_REQ = 31,
28  DECR_POWER_REQ = 32,
29  MAX_POWER = 33,
30  MIN_POWER = 34,
31  AUTO_RATE = 35,
32  PREFERRED_RATE = 36,
33  VERSION_REQ = 37,
34  VERSION_RES = 38,
35  FEATURES_REQ = 39,
36  FEATURES_RES = 40,
37  QUALITY_OF_SERVICE = 41,
38  QUALITY_OF_SERVICE_REQ = 42,
39  SCO_LINK_REQ = 43,
40  REMOVE_SCO_LINK_REQ = 44,
41  MAX_SLOT = 45,
42  MAX_SLOT_REQ = 46,
43  TIMING_ACCURACY_REQ = 47,
44  TIMING_ACCURACY_RES = 48,
45  SETYP_COMPLETE = 49,
46  USE_SEMI_PERMANENT_KEY = 50,
47  HOST_CONNECTION_REQ = 51,
48  SLOT_OFFSET = 52,
49  PAGE_MODE_REQ = 53,
50  PAGE_SCAN_MODE_REQ = 54,
51  SUPERVISION_TIMEOUT = 55,
52  TEST_ACTIVATE = 56,
53  TEST_CONTROL = 57,
54  ENCRYPTION_KEY_SIZE_MASK_REQ = 58,
55  ENCRYPTION_KEY_SIZE_MASK_RES = 59,
56  SET_AFH = 60,
57  ENCAPSULATED_HEADER = 61,
58  ENCAPSULATED_PAYLOAD = 62,
59  SIMPLE_PAIRING_CONFIRM = 63,
60  SIMPLE_PAIRING_NUMBER = 64,
61  DHKEY_CHECK = 65,
62  PAUSE_ENCRYPTION_AES_REQ = 66,
63  ESCAPED = 0x7f,
64}
65
66enum ExtendedOpcode : 8 {
67  ACCEPTED = 0x1,
68  NOT_ACCEPTED = 0x2,
69  FEATURES_REQ = 0x3,
70  FEATURES_RES = 0x4,
71  CLK_ADJ = 0x5,
72  CLK_ADJ_ACK = 0x6,
73  CLK_ADJ_REQ = 0x7,
74  PACKET_TYPE_TABLE_REQ = 11,
75  ESCO_LINK_REQ = 12,
76  REMOVE_ESCO_LINK_REQ = 13,
77  CHANNEL_CLASSIFICATION_REQ = 16,
78  CHANNEL_CLASSIFICATION = 17,
79  SNIFF_SUBRATING_REQ = 21,
80  SNIFF_SUBRATING_RES = 22,
81  PAUSE_ENCRYPTION_REQ = 23,
82  RESUME_ENCRYPTION_REQ = 24,
83  IO_CAPABILITY_REQ = 25,
84  IO_CAPABILITY_RES = 26,
85  NUMERIC_COMPARISON_FAILED = 27,
86  PASSKEY_FAILED = 28,
87  OOB_FAILED = 29,
88  KEYPRESS_NOTIFICATION = 30,
89  POWER_CONTROL_REQ = 31,
90  POWER_CONTROL_RES = 32,
91  PING_REQ = 33,
92  PING_RES = 34,
93  SAM_SET_TYPE0 = 35,
94  SAM_DEFINE_MAP = 36,
95  SAM_SWITCH = 37,
96}
97
98packet LmpPacket {
99  transaction_id: 1,
100  opcode: Opcode,
101  _payload_,
102}
103
104packet ExtendedPacket : LmpPacket(opcode = ESCAPED) {
105  extended_opcode: ExtendedOpcode,
106  _payload_,
107}
108
109packet Accepted : LmpPacket(opcode = ACCEPTED) {
110  accepted_opcode: Opcode,
111  _fixed_ = 0 : 1,
112}
113
114packet NotAccepted : LmpPacket(opcode = NOT_ACCEPTED) {
115  not_accepted_opcode: Opcode,
116  _fixed_ = 0 : 1,
117  error_code: 8,
118}
119
120packet AcceptedExt : ExtendedPacket(extended_opcode = ACCEPTED) {
121  accepted_opcode: ExtendedOpcode,
122}
123
124packet NotAcceptedExt : ExtendedPacket(extended_opcode = NOT_ACCEPTED) {
125  not_accepted_opcode: ExtendedOpcode,
126  error_code: 8,
127}
128
129packet IoCapabilityReq : ExtendedPacket(extended_opcode = IO_CAPABILITY_REQ) {
130  io_capabilities: 8,
131  oob_authentication_data: 8,
132  authentication_requirement: 8,
133}
134
135packet IoCapabilityRes : ExtendedPacket(extended_opcode = IO_CAPABILITY_RES) {
136  io_capabilities: 8,
137  oob_authentication_data: 8,
138  authentication_requirement: 8,
139}
140
141packet EncapsulatedHeader : LmpPacket(opcode = ENCAPSULATED_HEADER) {
142  major_type: 8,
143  minor_type: 8,
144  payload_length: 8,
145}
146
147packet EncapsulatedPayload : LmpPacket(opcode = ENCAPSULATED_PAYLOAD) {
148  data: 8[16],
149}
150
151packet SimplePairingConfirm : LmpPacket(opcode = SIMPLE_PAIRING_CONFIRM) {
152  commitment_value: 8[16],
153}
154
155packet SimplePairingNumber : LmpPacket(opcode = SIMPLE_PAIRING_NUMBER) {
156  nonce: 8[16],
157}
158
159packet DhkeyCheck : LmpPacket(opcode = DHKEY_CHECK) {
160  confirmation_value: 8[16],
161}
162
163packet AuRand : LmpPacket(opcode = AU_RAND) {
164  random_number: 8[16],
165}
166
167packet Sres : LmpPacket(opcode = SRES) {
168  authentication_rsp: 8[4],
169}
170
171packet NumericComparisonFailed: ExtendedPacket(extended_opcode = NUMERIC_COMPARISON_FAILED) {}
172
173packet PasskeyFailed: ExtendedPacket(extended_opcode = PASSKEY_FAILED) {}
174
175packet KeypressNotification: ExtendedPacket(extended_opcode = KEYPRESS_NOTIFICATION) {
176  notification_type: 8,
177}
178
179packet InRand : LmpPacket(opcode = IN_RAND) {
180  random_number: 8[16],
181}
182
183packet CombKey : LmpPacket(opcode = COMB_KEY) {
184  random_number: 8[16],
185}
186
187packet EncryptionModeReq : LmpPacket(opcode = ENCRYPTION_MODE_REQ) {
188  encryption_mode: 8,
189}
190
191packet EncryptionKeySizeReq : LmpPacket(opcode = ENCRYPTION_KEY_SIZE_REQ) {
192  key_size: 8,
193}
194
195packet StartEncryptionReq : LmpPacket(opcode = START_ENCRYPTION_REQ) {
196  random_number: 8[16]
197}
198
199packet StopEncryptionReq : LmpPacket(opcode = STOP_ENCRYPTION_REQ) {}
200
201packet FeaturesReqExt : ExtendedPacket(extended_opcode = FEATURES_REQ) {
202  features_page: 8,
203  max_supported_page: 8,
204  extended_features: 8[8],
205}
206
207packet FeaturesResExt : ExtendedPacket(extended_opcode = FEATURES_RES) {
208  features_page: 8,
209  max_supported_page: 8,
210  extended_features: 8[8],
211}
212