Chienyuan | db55f31 | 2019-10-31 14:01:28 +0800 | [diff] [blame] | 1 | little_endian_packets |
| 2 | |
Chienyuan | 3d8a803 | 2019-11-01 18:04:07 +0800 | [diff] [blame] | 3 | custom_field Address : 48 "hci/" |
| 4 | custom_field ClassOfDevice : 24 "hci/" |
Chienyuan | db55f31 | 2019-10-31 14:01:28 +0800 | [diff] [blame] | 5 | |
| 6 | enum PacketType : 8 { |
| 7 | UNKNOWN = 0x00, |
| 8 | ACL = 0x01, |
Myles Watson | 901f82b | 2019-11-19 09:18:38 -0800 | [diff] [blame] | 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 | COMMAND = 0x23, // Remove |
| 40 | RESPONSE = 0x24, // Remove |
Chienyuan | db55f31 | 2019-10-31 14:01:28 +0800 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | packet LinkLayerPacket { |
| 44 | type : PacketType, |
| 45 | source_address : Address, |
| 46 | destination_address : Address, |
| 47 | _body_, |
| 48 | } |
| 49 | |
Myles Watson | 901f82b | 2019-11-19 09:18:38 -0800 | [diff] [blame] | 50 | packet Command : LinkLayerPacket (type = COMMAND) { |
Chienyuan | db55f31 | 2019-10-31 14:01:28 +0800 | [diff] [blame] | 51 | _payload_, |
| 52 | } |
| 53 | |
Myles Watson | 901f82b | 2019-11-19 09:18:38 -0800 | [diff] [blame] | 54 | packet Response : LinkLayerPacket (type = RESPONSE) { |
| 55 | opcode : 16, |
| 56 | _payload_, |
| 57 | } |
| 58 | |
| 59 | packet AclPacket : LinkLayerPacket (type = ACL) { |
Chienyuan | db55f31 | 2019-10-31 14:01:28 +0800 | [diff] [blame] | 60 | _payload_, |
| 61 | } |
| 62 | |
| 63 | packet Disconnect : LinkLayerPacket (type = DISCONNECT) { |
| 64 | reason : 8, |
| 65 | } |
| 66 | |
| 67 | packet EncryptConnection : LinkLayerPacket (type = ENCRYPT_CONNECTION) { |
| 68 | key : 8[], |
| 69 | } |
| 70 | |
| 71 | packet EncryptConnectionResponse : LinkLayerPacket (type = ENCRYPT_CONNECTION_RESPONSE) { |
| 72 | key : 8[], |
| 73 | } |
| 74 | |
| 75 | enum InquiryState : 8 { |
| 76 | STANDBY = 0x00, |
| 77 | INQUIRY = 0x01, |
| 78 | } |
| 79 | |
| 80 | enum InquiryType : 8 { |
| 81 | STANDARD = 0x00, |
| 82 | RSSI = 0x01, |
| 83 | EXTENDED = 0x02, |
| 84 | } |
| 85 | |
| 86 | packet Inquiry : LinkLayerPacket (type = INQUIRY) { |
| 87 | inquiry_type : InquiryType, |
| 88 | } |
| 89 | |
| 90 | packet 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 | |
| 99 | packet InquiryResponse : BasicInquiryResponse (inquiry_type = STANDARD) { |
| 100 | } |
| 101 | |
| 102 | packet InquiryResponseWithRssi : BasicInquiryResponse (inquiry_type = RSSI) { |
| 103 | rssi: 8, |
| 104 | } |
| 105 | |
| 106 | packet ExtendedInquiryResponse : BasicInquiryResponse (inquiry_type = EXTENDED) { |
| 107 | rssi: 8, |
| 108 | extended_data : 8[], |
| 109 | } |
| 110 | |
| 111 | packet IoCapabilityRequest : LinkLayerPacket (type = IO_CAPABILITY_REQUEST) { |
| 112 | io_capability : 8, |
| 113 | oob_data_present : 8, |
| 114 | authentication_requirements : 8, |
| 115 | } |
| 116 | |
| 117 | packet IoCapabilityResponse : LinkLayerPacket (type = IO_CAPABILITY_RESPONSE) { |
| 118 | io_capability : 8, |
| 119 | oob_data_present : 8, |
| 120 | authentication_requirements : 8, |
| 121 | } |
| 122 | |
| 123 | packet IoCapabilityNegativeResponse : LinkLayerPacket (type = IO_CAPABILITY_NEGATIVE_RESPONSE) { |
| 124 | reason : 8, |
| 125 | } |
| 126 | |
| 127 | enum AddressType : 8 { |
| 128 | PUBLIC = 0, |
| 129 | RANDOM = 1, |
| 130 | PUBLIC_IDENTITY = 2, |
| 131 | RANDOM_IDENTITY = 3, |
| 132 | } |
| 133 | |
| 134 | enum 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 | |
| 142 | packet LeAdvertisement : LinkLayerPacket (type = LE_ADVERTISEMENT) { |
| 143 | address_type : AddressType, |
| 144 | advertisement_type : AdvertisementType, |
| 145 | data : 8[], |
| 146 | } |
| 147 | |
| 148 | packet 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 | |
| 156 | packet 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 | |
| 163 | packet LeScan : LinkLayerPacket (type = LE_SCAN) { |
| 164 | } |
| 165 | |
| 166 | packet LeScanResponse : LinkLayerPacket (type = LE_SCAN_RESPONSE) { |
| 167 | address_type : AddressType, |
| 168 | advertisement_type : AdvertisementType, |
| 169 | data : 8[], |
| 170 | } |
| 171 | |
| 172 | packet Page : LinkLayerPacket (type = PAGE) { |
| 173 | class_of_device : ClassOfDevice, |
| 174 | allow_role_switch : 8, |
| 175 | } |
| 176 | |
| 177 | packet PageResponse : LinkLayerPacket (type = PAGE_RESPONSE) { |
| 178 | try_role_switch : 8, |
| 179 | } |
| 180 | |
| 181 | packet PageReject : LinkLayerPacket (type = PAGE_REJECT) { |
| 182 | reason : 8, |
| 183 | } |
| 184 | |
Myles Watson | 901f82b | 2019-11-19 09:18:38 -0800 | [diff] [blame] | 185 | packet ReadClockOffset : LinkLayerPacket (type = READ_CLOCK_OFFSET) { |
| 186 | } |
| 187 | |
| 188 | packet ReadClockOffsetResponse : LinkLayerPacket (type = READ_CLOCK_OFFSET_RESPONSE) { |
| 189 | offset : 16, |
| 190 | } |
| 191 | |
| 192 | packet ReadRemoteSupportedFeatures : LinkLayerPacket (type = READ_REMOTE_SUPPORTED_FEATURES) { |
| 193 | } |
| 194 | |
| 195 | packet ReadRemoteSupportedFeaturesResponse : LinkLayerPacket (type = READ_REMOTE_SUPPORTED_FEATURES_RESPONSE) { |
| 196 | features : 64, |
| 197 | } |
| 198 | |
| 199 | packet ReadRemoteLmpFeatures : LinkLayerPacket (type = READ_REMOTE_LMP_FEATURES) { |
| 200 | } |
| 201 | |
| 202 | packet ReadRemoteLmpFeaturesResponse : LinkLayerPacket (type = READ_REMOTE_LMP_FEATURES_RESPONSE) { |
| 203 | features : 64, |
| 204 | } |
| 205 | |
| 206 | packet ReadRemoteExtendedFeatures : LinkLayerPacket (type = READ_REMOTE_EXTENDED_FEATURES) { |
| 207 | page_number : 8, |
| 208 | } |
| 209 | |
| 210 | packet 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 | |
| 217 | packet ReadRemoteVersionInformation : LinkLayerPacket (type = READ_REMOTE_VERSION_INFORMATION) { |
| 218 | } |
| 219 | |
| 220 | packet ReadRemoteVersionInformationResponse : LinkLayerPacket (type = READ_REMOTE_VERSION_INFORMATION_RESPONSE) { |
| 221 | lmp_version : 8, |
| 222 | lmp_subversion : 8, |
| 223 | manufacturer_name : 16, |
| 224 | } |
| 225 | |
| 226 | packet RemoteNameRequest : LinkLayerPacket (type = REMOTE_NAME_REQUEST) { |
| 227 | } |
| 228 | |
| 229 | packet RemoteNameRequestResponse : LinkLayerPacket (type = REMOTE_NAME_REQUEST_RESPONSE) { |
| 230 | _size_(name) : 8, |
| 231 | name : 8[], |
| 232 | } |
| 233 | |
| 234 | packet ScoPacket : LinkLayerPacket (type = SCO) { |
Chienyuan | db55f31 | 2019-10-31 14:01:28 +0800 | [diff] [blame] | 235 | _payload_, |
| 236 | } |
Myles Watson | 901f82b | 2019-11-19 09:18:38 -0800 | [diff] [blame] | 237 | |