464 lines
11 KiB
Plaintext
464 lines
11 KiB
Plaintext
little_endian_packets
|
|
|
|
custom_field Address : 48 "hci/"
|
|
custom_field ClassOfDevice : 24 "hci/"
|
|
|
|
enum PacketType : 8 {
|
|
UNKNOWN = 0x00,
|
|
ACL = 0x01,
|
|
DISCONNECT = 0x02,
|
|
ENCRYPT_CONNECTION = 0x03,
|
|
ENCRYPT_CONNECTION_RESPONSE = 0x04,
|
|
EVENT = 0x05,
|
|
INQUIRY = 0x06,
|
|
INQUIRY_RESPONSE = 0x07,
|
|
IO_CAPABILITY_REQUEST = 0x08,
|
|
IO_CAPABILITY_RESPONSE = 0x09,
|
|
IO_CAPABILITY_NEGATIVE_RESPONSE = 0x0A,
|
|
LE_LEGACY_ADVERTISING_PDU = 0x0B,
|
|
LE_EXTENDED_ADVERTISING_PDU = 0x37,
|
|
LE_CONNECT = 0x0C,
|
|
LE_CONNECT_COMPLETE = 0x0D,
|
|
LE_SCAN = 0x0E,
|
|
LE_SCAN_RESPONSE = 0x0F,
|
|
PAGE = 0x10,
|
|
PAGE_RESPONSE = 0x11,
|
|
PAGE_REJECT = 0x12,
|
|
READ_CLOCK_OFFSET = 0x13,
|
|
READ_CLOCK_OFFSET_RESPONSE = 0x14,
|
|
READ_REMOTE_SUPPORTED_FEATURES = 0x15,
|
|
READ_REMOTE_SUPPORTED_FEATURES_RESPONSE = 0x16,
|
|
READ_REMOTE_LMP_FEATURES = 0x17,
|
|
READ_REMOTE_LMP_FEATURES_RESPONSE = 0x18,
|
|
READ_REMOTE_EXTENDED_FEATURES = 0x19,
|
|
READ_REMOTE_EXTENDED_FEATURES_RESPONSE = 0x1A,
|
|
READ_REMOTE_VERSION_INFORMATION = 0x1B,
|
|
READ_REMOTE_VERSION_INFORMATION_RESPONSE = 0x1C,
|
|
REMOTE_NAME_REQUEST = 0x1D,
|
|
REMOTE_NAME_REQUEST_RESPONSE = 0x1E,
|
|
SCO = 0x1F,
|
|
LE_ENCRYPT_CONNECTION = 0x20,
|
|
LE_ENCRYPT_CONNECTION_RESPONSE = 0x21,
|
|
ISO = 0x22,
|
|
ISO_CONNECTION_REQUEST = 0x23,
|
|
ISO_CONNECTION_RESPONSE = 0x24,
|
|
OOB_DATA = 0x25,
|
|
OOB_DATA_RESPONSE = 0x26,
|
|
PASSKEY = 0x27,
|
|
PASSKEY_FAILED = 0x28,
|
|
KEYPRESS_NOTIFICATION = 0x29,
|
|
PIN_REQUEST = 0x2A,
|
|
PIN_RESPONSE = 0x2B,
|
|
LE_READ_REMOTE_FEATURES = 0x2C,
|
|
LE_READ_REMOTE_FEATURES_RESPONSE = 0x2D,
|
|
LE_CONNECTION_PARAMETER_REQUEST = 0x2E,
|
|
LE_CONNECTION_PARAMETER_UPDATE = 0x2F,
|
|
|
|
SCO_CONNECTION_REQUEST = 0x30,
|
|
SCO_CONNECTION_RESPONSE = 0x31,
|
|
SCO_DISCONNECT = 0x32,
|
|
RSSI_WRAPPER = 0x33,
|
|
|
|
LMP = 0x34,
|
|
|
|
PING_REQUEST = 0x35,
|
|
PING_RESPONSE = 0x36,
|
|
}
|
|
|
|
packet LinkLayerPacket {
|
|
type : PacketType,
|
|
source_address : Address,
|
|
destination_address : Address,
|
|
_body_,
|
|
}
|
|
|
|
packet Acl : LinkLayerPacket (type = ACL) {
|
|
_payload_,
|
|
}
|
|
|
|
packet Disconnect : LinkLayerPacket (type = DISCONNECT) {
|
|
reason : 8,
|
|
}
|
|
|
|
packet EncryptConnection : LinkLayerPacket (type = ENCRYPT_CONNECTION) {
|
|
key : 8[],
|
|
}
|
|
|
|
packet EncryptConnectionResponse : LinkLayerPacket (type = ENCRYPT_CONNECTION_RESPONSE) {
|
|
key : 8[],
|
|
}
|
|
|
|
enum InquiryState : 8 {
|
|
STANDBY = 0x00,
|
|
INQUIRY = 0x01,
|
|
}
|
|
|
|
enum InquiryType : 8 {
|
|
STANDARD = 0x00,
|
|
RSSI = 0x01,
|
|
EXTENDED = 0x02,
|
|
}
|
|
|
|
packet Inquiry : LinkLayerPacket (type = INQUIRY) {
|
|
inquiry_type : InquiryType,
|
|
lap : 8, // The IAC is derived from the LAP
|
|
}
|
|
|
|
packet BasicInquiryResponse : LinkLayerPacket(type = INQUIRY_RESPONSE) {
|
|
inquiry_type : InquiryType,
|
|
page_scan_repetition_mode : 8,
|
|
class_of_device : ClassOfDevice,
|
|
clock_offset : 15,
|
|
_reserved_ : 1,
|
|
_body_,
|
|
}
|
|
|
|
packet InquiryResponse : BasicInquiryResponse (inquiry_type = STANDARD) {
|
|
}
|
|
|
|
packet InquiryResponseWithRssi : BasicInquiryResponse (inquiry_type = RSSI) {
|
|
rssi: 8,
|
|
}
|
|
|
|
packet ExtendedInquiryResponse : BasicInquiryResponse (inquiry_type = EXTENDED) {
|
|
rssi: 8,
|
|
extended_inquiry_response : 8[240],
|
|
}
|
|
|
|
packet IoCapabilityRequest : LinkLayerPacket (type = IO_CAPABILITY_REQUEST) {
|
|
io_capability : 8,
|
|
oob_data_present : 8,
|
|
authentication_requirements : 8,
|
|
}
|
|
|
|
packet IoCapabilityResponse : LinkLayerPacket (type = IO_CAPABILITY_RESPONSE) {
|
|
io_capability : 8,
|
|
oob_data_present : 8,
|
|
authentication_requirements : 8,
|
|
}
|
|
|
|
packet IoCapabilityNegativeResponse : LinkLayerPacket (type = IO_CAPABILITY_NEGATIVE_RESPONSE) {
|
|
reason : 8,
|
|
}
|
|
|
|
enum AddressType : 8 {
|
|
PUBLIC = 0,
|
|
RANDOM = 1,
|
|
PUBLIC_IDENTITY = 2,
|
|
RANDOM_IDENTITY = 3,
|
|
}
|
|
|
|
// Legacy advertising PDU types.
|
|
// Vol 6, Part B § 2.3.1 Advertising PDUs.
|
|
enum LegacyAdvertisingType : 8 {
|
|
ADV_IND = 0, // Connectable and scannable
|
|
ADV_DIRECT_IND = 1, // Connectable directed, high duty cycle
|
|
ADV_SCAN_IND = 2, // Scannable undirected
|
|
ADV_NONCONN_IND = 3, // Non connectable undirected
|
|
}
|
|
|
|
packet LeLegacyAdvertisingPdu : LinkLayerPacket (type = LE_LEGACY_ADVERTISING_PDU) {
|
|
advertising_address_type: AddressType,
|
|
target_address_type: AddressType,
|
|
advertising_type: LegacyAdvertisingType,
|
|
advertising_data: 8[],
|
|
}
|
|
|
|
enum PrimaryPhyType : 8 {
|
|
LE_1M = 0x01,
|
|
LE_CODED = 0x03,
|
|
}
|
|
|
|
enum SecondaryPhyType : 8 {
|
|
NO_PACKETS = 0x00,
|
|
LE_1M = 0x01,
|
|
LE_2M = 0x02,
|
|
LE_CODED = 0x03,
|
|
}
|
|
|
|
packet LeExtendedAdvertisingPdu : LinkLayerPacket (type = LE_EXTENDED_ADVERTISING_PDU) {
|
|
advertising_address_type: AddressType,
|
|
target_address_type: AddressType,
|
|
connectable: 1,
|
|
scannable: 1,
|
|
directed: 1,
|
|
sid: 4,
|
|
_reserved_: 1,
|
|
tx_power: 8,
|
|
primary_phy: PrimaryPhyType,
|
|
secondary_phy: SecondaryPhyType,
|
|
advertising_data: 8[],
|
|
}
|
|
|
|
packet LeConnect : LinkLayerPacket (type = LE_CONNECT) {
|
|
initiating_address_type : AddressType,
|
|
advertising_address_type : AddressType,
|
|
le_connection_interval_min : 16,
|
|
le_connection_interval_max : 16,
|
|
le_connection_latency : 16,
|
|
le_connection_supervision_timeout : 16,
|
|
}
|
|
|
|
packet LeConnectComplete : LinkLayerPacket (type = LE_CONNECT_COMPLETE) {
|
|
initiating_address_type : AddressType,
|
|
advertising_address_type : AddressType,
|
|
le_connection_interval : 16,
|
|
le_connection_latency : 16,
|
|
le_connection_supervision_timeout : 16,
|
|
}
|
|
|
|
packet LeScan : LinkLayerPacket (type = LE_SCAN) {
|
|
scanning_address_type : AddressType,
|
|
advertising_address_type : AddressType,
|
|
}
|
|
|
|
packet LeScanResponse : LinkLayerPacket (type = LE_SCAN_RESPONSE) {
|
|
advertising_address_type : AddressType,
|
|
scan_response_data : 8[],
|
|
}
|
|
|
|
packet Page : LinkLayerPacket (type = PAGE) {
|
|
class_of_device : ClassOfDevice,
|
|
allow_role_switch : 8,
|
|
}
|
|
|
|
packet PageResponse : LinkLayerPacket (type = PAGE_RESPONSE) {
|
|
try_role_switch : 8,
|
|
}
|
|
|
|
packet PageReject : LinkLayerPacket (type = PAGE_REJECT) {
|
|
reason : 8,
|
|
}
|
|
|
|
packet ReadClockOffset : LinkLayerPacket (type = READ_CLOCK_OFFSET) {
|
|
}
|
|
|
|
packet ReadClockOffsetResponse : LinkLayerPacket (type = READ_CLOCK_OFFSET_RESPONSE) {
|
|
offset : 16,
|
|
}
|
|
|
|
packet ReadRemoteSupportedFeatures : LinkLayerPacket (type = READ_REMOTE_SUPPORTED_FEATURES) {
|
|
}
|
|
|
|
packet ReadRemoteSupportedFeaturesResponse : LinkLayerPacket (type = READ_REMOTE_SUPPORTED_FEATURES_RESPONSE) {
|
|
features : 64,
|
|
}
|
|
|
|
packet ReadRemoteLmpFeatures : LinkLayerPacket (type = READ_REMOTE_LMP_FEATURES) {
|
|
}
|
|
|
|
packet ReadRemoteLmpFeaturesResponse : LinkLayerPacket (type = READ_REMOTE_LMP_FEATURES_RESPONSE) {
|
|
features : 64,
|
|
}
|
|
|
|
packet ReadRemoteExtendedFeatures : LinkLayerPacket (type = READ_REMOTE_EXTENDED_FEATURES) {
|
|
page_number : 8,
|
|
}
|
|
|
|
packet ReadRemoteExtendedFeaturesResponse : LinkLayerPacket (type = READ_REMOTE_EXTENDED_FEATURES_RESPONSE) {
|
|
status : 8,
|
|
page_number : 8,
|
|
max_page_number : 8,
|
|
features : 64,
|
|
}
|
|
|
|
packet ReadRemoteVersionInformation : LinkLayerPacket (type = READ_REMOTE_VERSION_INFORMATION) {
|
|
}
|
|
|
|
packet ReadRemoteVersionInformationResponse : LinkLayerPacket (type = READ_REMOTE_VERSION_INFORMATION_RESPONSE) {
|
|
lmp_version : 8,
|
|
lmp_subversion : 8,
|
|
manufacturer_name : 16,
|
|
}
|
|
|
|
packet RemoteNameRequest : LinkLayerPacket (type = REMOTE_NAME_REQUEST) {
|
|
}
|
|
|
|
packet RemoteNameRequestResponse : LinkLayerPacket (type = REMOTE_NAME_REQUEST_RESPONSE) {
|
|
name : 8[248],
|
|
}
|
|
|
|
packet Sco : LinkLayerPacket (type = SCO) {
|
|
_payload_,
|
|
}
|
|
|
|
packet LeEncryptConnection : LinkLayerPacket (type = LE_ENCRYPT_CONNECTION) {
|
|
rand : 8[8],
|
|
ediv : 16,
|
|
ltk : 8[16],
|
|
}
|
|
|
|
packet LeEncryptConnectionResponse : LinkLayerPacket (type = LE_ENCRYPT_CONNECTION_RESPONSE) {
|
|
rand : 8[8],
|
|
ediv : 16,
|
|
ltk : 8[16],
|
|
}
|
|
|
|
enum StartContinuation : 1 {
|
|
START = 0,
|
|
CONTINUATION = 1,
|
|
}
|
|
|
|
enum Complete : 1 {
|
|
INCOMPLETE = 0,
|
|
COMPLETE = 1,
|
|
}
|
|
|
|
packet IsoDataPacket : LinkLayerPacket (type = ISO) {
|
|
handle : 12,
|
|
_reserved_ : 4,
|
|
sc : StartContinuation,
|
|
cmplt : Complete,
|
|
_reserved_ : 6,
|
|
_size_(_payload_) : 16,
|
|
_payload_,
|
|
}
|
|
|
|
packet IsoStart : IsoDataPacket (sc = START) {
|
|
time_offset : 24,
|
|
_payload_,
|
|
}
|
|
|
|
packet IsoContinuation : IsoDataPacket (sc = CONTINUATION) {
|
|
_payload_,
|
|
}
|
|
|
|
packet IsoConnectionRequest : LinkLayerPacket (type = ISO_CONNECTION_REQUEST) {
|
|
// Group
|
|
cig_id : 8,
|
|
sdu_interval_m_to_s : 32,
|
|
sdu_interval_s_to_m : 32,
|
|
interleaved : 1,
|
|
framed : 1,
|
|
_reserved_ : 6,
|
|
latency_m_to_s : 16,
|
|
latency_s_to_m : 16,
|
|
// Stream parameters
|
|
id : 8,
|
|
max_sdu_m_to_s_ : 16,
|
|
max_sdu_s_to_m_ : 16,
|
|
// For the response
|
|
requester_cis_handle : 12,
|
|
_reserved_ : 4,
|
|
requester_acl_handle : 12,
|
|
_reserved_ : 4,
|
|
}
|
|
|
|
packet IsoConnectionResponse : LinkLayerPacket (type = ISO_CONNECTION_RESPONSE){
|
|
status : 8, // ErrorCode (SUCCESS == connected)
|
|
requester_cis_handle : 12,
|
|
_reserved_ : 4,
|
|
requester_acl_handle : 12,
|
|
_reserved_ : 4,
|
|
// For the link layer
|
|
responder_cis_handle : 12,
|
|
_reserved_ : 4,
|
|
}
|
|
|
|
packet OobData : LinkLayerPacket (type = OOB_DATA){
|
|
c_p_194 : 8[16],
|
|
r_p_194 : 8[16],
|
|
c_p_256 : 8[16],
|
|
r_p_256 : 8[16],
|
|
}
|
|
|
|
packet OobDataResponse : LinkLayerPacket (type = OOB_DATA_RESPONSE){
|
|
matched : 1,
|
|
_reserved_ : 7,
|
|
}
|
|
|
|
enum PasskeyNotificationType : 8 {
|
|
ENTRY_STARTED = 0x00,
|
|
DIGIT_ENTERED = 0x01,
|
|
DIGIT_ERASED = 0x02,
|
|
CLEARED = 0x03,
|
|
ENTRY_COMPLETED = 0x04,
|
|
}
|
|
|
|
packet Passkey : LinkLayerPacket (type = PASSKEY){
|
|
passkey : 20,
|
|
_reserved_ : 4,
|
|
}
|
|
|
|
packet PasskeyFailed : LinkLayerPacket (type = PASSKEY_FAILED){
|
|
}
|
|
|
|
packet KeypressNotification : LinkLayerPacket (type = KEYPRESS_NOTIFICATION){
|
|
notification_type : PasskeyNotificationType,
|
|
}
|
|
|
|
packet PinRequest : LinkLayerPacket (type = PIN_REQUEST) {
|
|
_size_(pin_code) : 5, // 0x01 - 0x10
|
|
_reserved_ : 3,
|
|
pin_code : 8[], // string parameter, first octet first
|
|
}
|
|
|
|
packet PinResponse : LinkLayerPacket (type = PIN_RESPONSE) {
|
|
_size_(pin_code) : 5, // 0x01 - 0x10
|
|
_reserved_ : 3,
|
|
pin_code : 8[], // string parameter, first octet first
|
|
}
|
|
|
|
packet LeReadRemoteFeatures : LinkLayerPacket (type = LE_READ_REMOTE_FEATURES) {
|
|
}
|
|
|
|
packet LeReadRemoteFeaturesResponse : LinkLayerPacket (type = LE_READ_REMOTE_FEATURES_RESPONSE) {
|
|
features : 64,
|
|
status : 8,
|
|
}
|
|
|
|
packet LeConnectionParameterRequest : LinkLayerPacket (type = LE_CONNECTION_PARAMETER_REQUEST) {
|
|
interval_min : 16,
|
|
interval_max : 16,
|
|
latency : 16,
|
|
timeout : 16,
|
|
}
|
|
|
|
packet LeConnectionParameterUpdate : LinkLayerPacket (type = LE_CONNECTION_PARAMETER_UPDATE) {
|
|
status : 8,
|
|
interval : 16,
|
|
latency : 16,
|
|
timeout : 16,
|
|
}
|
|
|
|
packet ScoConnectionRequest : LinkLayerPacket (type = SCO_CONNECTION_REQUEST) {
|
|
transmit_bandwidth : 32,
|
|
receive_bandwidth : 32,
|
|
max_latency : 16,
|
|
voice_setting : 10,
|
|
_reserved_ : 6,
|
|
retransmission_effort : 8,
|
|
packet_type : 16,
|
|
class_of_device : ClassOfDevice,
|
|
}
|
|
|
|
packet ScoConnectionResponse : LinkLayerPacket (type = SCO_CONNECTION_RESPONSE) {
|
|
status : 8,
|
|
transmission_interval : 8,
|
|
retransmission_window : 8,
|
|
rx_packet_length : 16,
|
|
tx_packet_length : 16,
|
|
air_mode : 8,
|
|
extended : 1,
|
|
_reserved_ : 7,
|
|
}
|
|
|
|
packet ScoDisconnect : LinkLayerPacket (type = SCO_DISCONNECT) {
|
|
reason : 8,
|
|
}
|
|
|
|
packet RssiWrapper : LinkLayerPacket (type = RSSI_WRAPPER) {
|
|
rssi : 8,
|
|
_payload_,
|
|
}
|
|
|
|
packet Lmp : LinkLayerPacket (type = LMP) {
|
|
_payload_,
|
|
}
|
|
|
|
packet PingRequest : LinkLayerPacket (type = PING_REQUEST) {
|
|
}
|
|
|
|
packet PingResponse : LinkLayerPacket (type = PING_RESPONSE) {
|
|
}
|