|
PcapPlusPlus
Next
|
#include <BluetoothHciLayer.h>
Public Types | |
| enum class | BluetoothHciPacketType : uint8_t { Unknown = 0x00 , Command = 0x01 , AclData = 0x02 , ScoData = 0x03 , Event = 0x04 , IsoData = 0x05 } |
| enum class | BluetoothHciDirection : uint32_t { HostToController = 0 , ControllerToHost = 1 , Unknown = 0xffffffff } |
Public Member Functions | |
| bool | hasDirectionHeader () const |
| BluetoothHciDirection | getDirection () const |
| BluetoothHciPacketType | getPacketType () const |
| void | parseNextLayer () override |
| void | computeCalculateFields () override |
| Does nothing for this layer. | |
| OsiModelLayer | getOsiModelLayer () const override |
Public Member Functions inherited from pcpp::Layer | |
| ~Layer () override | |
| Layer * | getNextLayer () const |
| Layer * | getPrevLayer () const |
| ProtocolType | getProtocol () const |
| bool | isMemberOfProtocolFamily (ProtocolTypeFamily protocolTypeFamily) const |
| uint8_t * | getData () const |
| size_t | getDataLen () const |
| uint8_t * | getLayerPayload () const |
| size_t | getLayerPayloadSize () const |
| bool | isAllocatedToPacket () const |
| void | copyData (uint8_t *toArr) const |
| Copy the raw data of this layer to another array. More... | |
| size_t | copyData (uint8_t *dest, size_t destSize) const |
| Copy the raw data of this layer to another array, with a specified maximum size. More... | |
| void | serialize (ISerializer &serializer) const |
| uint8_t * | getDataPtr (size_t offset=0) const override |
| virtual size_t | getHeaderLen () const =0 |
| virtual std::string | toString () const =0 |
Static Public Member Functions | |
| static BluetoothHciLayer * | parseLayer (uint8_t *data, size_t dataLen, Packet *packet, bool hasDirectionHeader) |
| static bool | isDataValid (const uint8_t *data, size_t dataLen, bool hasDirectionHeader) |
Protected Member Functions | |
| BluetoothHciLayer (uint8_t *data, size_t dataLen, Packet *packet, bool hasDirectionHeader) | |
| BluetoothHciLayer (bool hasDirectionHeader) | |
| size_t | getDirectionHeaderLen () const |
Protected Member Functions inherited from pcpp::Layer | |
| Packet * | getAttachedPacket () |
| Get a pointer to the Packet this layer is attached to (if any). More... | |
| Packet const * | getAttachedPacket () const |
| Get a pointer to the Packet this layer is attached to (if any). More... | |
| void | allocData (size_t dataLen, bool zeroInit=true) |
| Requests the layer to allocate a new data buffer of the specified length. More... | |
| template<typename T , typename... Args> | |
| Layer * | constructNextLayer (uint8_t *data, size_t dataLen, Args &&... extraArgs) |
| Construct the next layer in the protocol stack. No validation is performed on the data. More... | |
| template<typename T , typename... Args> | |
| Layer * | constructNextLayer (uint8_t *data, size_t dataLen, Packet *packet, Args &&... extraArgs) |
| template<typename TFactory , typename... Args> | |
| Layer * | constructNextLayerFromFactory (TFactory factoryFn, uint8_t *data, size_t dataLen, Args &&... extraArgs) |
| Construct the next layer in the protocol stack using a factory functor. More... | |
| template<typename TFactory , typename... Args> | |
| Layer * | constructNextLayerFromFactory (TFactory factoryFn, uint8_t *data, size_t dataLen, Packet *packet, Args &&... extraArgs) |
| Construct the next layer in the protocol stack using a factory functor. More... | |
| template<typename T , typename... Args> | |
| Layer * | tryConstructNextLayer (uint8_t *data, size_t dataLen, Args &&... extraArgs) |
| template<typename T , typename... Args> | |
| Layer * | tryConstructNextLayer (uint8_t *data, size_t dataLen, Packet *packet, Args &&... extraArgs) |
| template<typename T , typename TFallback , typename... Args> | |
| Layer * | tryConstructNextLayerWithFallback (uint8_t *data, size_t dataLen, Args &&... extraArgs) |
| Try to construct the next layer in the protocol stack with a fallback option. More... | |
| template<typename T , typename TFallback , typename... Args> | |
| Layer * | tryConstructNextLayerWithFallback (uint8_t *data, size_t dataLen, Packet *packet, Args &&... extraArgs) |
| template<typename TFallback , typename TFactory , typename... Args> | |
| Layer * | tryConstructNextLayerFromFactoryWithFallback (TFactory factoryFn, uint8_t *data, size_t dataLen, Args &&... extraArgs) |
| Try to construct the next layer in the protocol stack using a factory functor with a fallback option. More... | |
| template<typename TFallback , typename TFactory , typename... Args> | |
| Layer * | tryConstructNextLayerFromFactoryWithFallback (TFactory factoryFn, uint8_t *data, size_t dataLen, Packet *packet, Args &&... extraArgs) |
| Try to construct the next layer in the protocol stack using a factory functor with a fallback option. More... | |
| virtual void | serializeLayer (ObjectScope &serializer) const |
Static Protected Attributes | |
| static constexpr size_t | directionHeaderSize = 4 |
Additional Inherited Members | |
Static Protected Member Functions inherited from pcpp::Layer | |
| template<typename T > | |
| static bool | canReinterpretAs (const uint8_t *data, size_t dataLen) |
| Check if the data is large enough to reinterpret as a type. More... | |
An abstract base class for all Bluetooth HCI packet types. It handles the parts common to every HCI packet: the optional direction pseudo-header and the H4 packet indicator octet. Concrete subclasses parse a specific packet type and are created through BluetoothHciLayer::parseLayer()
|
strong |
The direction of an HCI packet, taken from the pseudo-header present in LINKTYPE_BLUETOOTH_HCI_H4_WITH_PHDR captures
|
strong |
The HCI packet type, taken from the H4 packet indicator octet
|
inlineprotected |
A constructor that creates the layer from an existing packet raw data
| [in] | data | A pointer to the raw data |
| [in] | dataLen | Size of the data in bytes |
| [in] | packet | A pointer to the Packet instance where layer will be stored in |
| [in] | hasDirectionHeader | True if the data starts with a 4-byte direction pseudo-header |
|
inlineexplicitprotected |
Constructor used by subclasses that will allocate their own buffer via allocData()
| [in] | hasDirectionHeader | True if the buffer will include a 4-byte direction pseudo-header |
| BluetoothHciDirection pcpp::BluetoothHciLayer::getDirection | ( | ) | const |
Get the direction of this packet
|
inlineprotected |
|
inlineoverridevirtual |
Implements pcpp::Layer.
|
inline |
|
inline |
|
static |
A static method that validates the part of the input data common to all HCI packet types
| [in] | data | The pointer to the beginning of a byte stream of a Bluetooth HCI packet |
| [in] | dataLen | The length of the byte stream |
| [in] | hasDirectionHeader | True if the data is expected to start with a 4-byte direction pseudo-header |
|
static |
A static factory that identifies the HCI packet type and creates the matching layer
| [in] | data | A pointer to the raw data |
| [in] | dataLen | Size of the data in bytes |
| [in] | packet | A pointer to the Packet instance where layer will be stored in |
| [in] | hasDirectionHeader | True if the data starts with a 4-byte direction pseudo-header (LINKTYPE_BLUETOOTH_HCI_H4_WITH_PHDR), false if it starts directly with the H4 packet indicator (LINKTYPE_BLUETOOTH_HCI_H4) |
|
inlineoverridevirtual |
HCI packets don't encapsulate another protocol, so no next layer is parsed. Subclasses that do encapsulate another protocol override this method
Implements pcpp::Layer.
|
staticconstexprprotected |
Size of the direction pseudo-header on the wire. Exposed to derived classes so their static validators can size-check the raw buffer without needing the struct definition itself