76 return m_HasDirectionHeader;
143 #pragma pack(push, 1)
144 struct bluetooth_hci_direction_header
150 "bluetooth_hci_direction_header size does not match directionHeaderSize");
154 bool m_HasDirectionHeader;
182 const std::vector<uint8_t>& parameters = {});
188 return getEventHeader()->eventCode;
195 getEventHeader()->eventCode = eventCode;
239 static std::vector<FieldDescriptor>
all()
243 std::copy(extra.begin(), extra.end(), std::back_inserter(result));
261 #pragma pack(push, 1)
262 struct bluetooth_hci_event_header
265 uint8_t parameterTotalLength;
268 static_assert(
sizeof(bluetooth_hci_event_header) == 2,
"bluetooth_hci_event_header size is not 2 bytes");
284 void initLayer(uint8_t eventCode,
const std::vector<uint8_t>& parameters);
286 bluetooth_hci_event_header* getEventHeader()
const
288 return reinterpret_cast<bluetooth_hci_event_header*
>(m_Data +
getDirectionHeaderLen() +
sizeof(uint8_t));
Definition: BluetoothHciLayer.h:160
void setEventCode(uint8_t eventCode)
Definition: BluetoothHciLayer.h:193
static bool isDataValid(const uint8_t *data, size_t dataLen, bool hasDirectionHeader)
uint8_t getEventCode() const
Definition: BluetoothHciLayer.h:186
size_t getHeaderLen() const override
Definition: BluetoothHciLayer.h:220
void setParameters(const std::vector< uint8_t > ¶meters)
BluetoothHciEventLayer(BluetoothHciDirection direction, uint8_t eventCode, const std::vector< uint8_t > ¶meters={})
uint8_t * getParameters() const
Definition: BluetoothHciLayer.h:205
std::string toString() const override
uint8_t getParameterTotalLength() const
void serializeLayer(ObjectScope &serializer) const override
BluetoothHciEventLayer(uint8_t eventCode, const std::vector< uint8_t > ¶meters={})
Definition: BluetoothHciLayer.h:27
static bool isDataValid(const uint8_t *data, size_t dataLen, bool hasDirectionHeader)
BluetoothHciDirection
Definition: BluetoothHciLayer.h:51
@ HostToController
Sent from the host to the controller.
@ ControllerToHost
Received by the host from the controller.
@ Unknown
The capture has no direction pseudo-header (LINKTYPE_BLUETOOTH_HCI_H4)
static BluetoothHciLayer * parseLayer(uint8_t *data, size_t dataLen, Packet *packet, bool hasDirectionHeader)
OsiModelLayer getOsiModelLayer() const override
Definition: BluetoothHciLayer.h:102
static constexpr size_t directionHeaderSize
Definition: BluetoothHciLayer.h:118
BluetoothHciDirection getDirection() const
void computeCalculateFields() override
Does nothing for this layer.
Definition: BluetoothHciLayer.h:99
BluetoothHciPacketType getPacketType() const
Definition: BluetoothHciLayer.h:86
bool hasDirectionHeader() const
Definition: BluetoothHciLayer.h:74
size_t getDirectionHeaderLen() const
Definition: BluetoothHciLayer.h:137
BluetoothHciPacketType
Definition: BluetoothHciLayer.h:32
@ IsoData
Isochronous (ISO) data.
@ ScoData
Synchronous (SCO) data.
@ Unknown
Not a recognized HCI packet type. 0x00 is not a valid H4 packet indicator value.
@ Event
An event sent from the controller to the host.
@ Command
A command sent from the host to the controller.
void parseNextLayer() override
Definition: BluetoothHciLayer.h:95
BluetoothHciLayer(uint8_t *data, size_t dataLen, Packet *packet, bool hasDirectionHeader)
Definition: BluetoothHciLayer.h:125
BluetoothHciLayer(bool hasDirectionHeader)
Definition: BluetoothHciLayer.h:131
Definition: Serializers.h:230
const ProtocolType BluetoothHCI
Bluetooth HCI Protocol.
Definition: ProtocolType.h:276
The main namespace for the PcapPlusPlus lib.
Definition: AssertionUtils.h:19
OsiModelLayer
An enum representing OSI model layers.
Definition: ProtocolType.h:430
@ OsiModelDataLinkLayer
Data link layer (layer 2)
Definition: ProtocolType.h:434
Definition: BluetoothHciLayer.h:237
static const FieldDescriptor EventCode
HCI event code.
Definition: BluetoothHciLayer.h:251
static std::vector< FieldDescriptor > all()
Definition: BluetoothHciLayer.h:239
static const FieldDescriptor Direction
Packet direction, as "HostToController", "ControllerToHost", or "Unknown".
Definition: BluetoothHciLayer.h:248
static const FieldDescriptor ParameterTotalLength
Length of the parameter bytes.
Definition: BluetoothHciLayer.h:254
Definition: Serializers.h:18
static std::vector< FieldDescriptor > all()
Definition: Layer.h:214