PcapPlusPlus  Next
pcpp::GvcpDiscoveryRequestLayer Class Reference

#include <GvcpLayer.h>

Inheritance diagram for pcpp::GvcpDiscoveryRequestLayer:
pcpp::GvcpRequestLayer pcpp::GvcpLayer pcpp::Layer pcpp::IDataContainer

Classes

struct  SerializedFields
 

Public Member Functions

 GvcpDiscoveryRequestLayer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
 
 GvcpDiscoveryRequestLayer (bool allowBroadcastAck=false, bool acknowledgeRequired=true, uint16_t requestId=1)
 
bool hasAllowBroadcastAckFlag () const
 
void setAllowBroadcastAckFlag (bool allowBroadcastAck)
 
- Public Member Functions inherited from pcpp::GvcpRequestLayer
 GvcpRequestLayer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
 
 GvcpRequestLayer (GvcpCommand command, GvcpFlag flag=0, uint16_t requestId=1)
 
GvcpFlag getFlag () const
 
void setFlag (GvcpFlag flag)
 
bool hasAcknowledgeFlag () const
 
uint16_t getRequestId () const
 
void setRequestId (uint16_t requestId)
 
GvcpCommand getCommand () const override
 
uint16_t getDataSize () const override
 
size_t getHeaderLen () const override
 
void computeCalculateFields () override
 Calculate the data size field in the header according to the size of the data that follows the header.
 
std::string toString () const override
 
- Public Member Functions inherited from pcpp::GvcpLayer
void parseNextLayer () override
 Creates a PayloadLayer from the rest of the message, if there is data after 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
 

Protected Member Functions

void serializeLayer (ObjectScope &serializer) const override
 
- Protected Member Functions inherited from pcpp::GvcpRequestLayer
 GvcpRequestLayer (GvcpCommand command, GvcpFlag flag, uint16_t requestId, size_t bodyLen)
 
- Protected Member Functions inherited from pcpp::GvcpLayer
void initLayer (size_t dataLen)
 
- 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...
 

Additional Inherited Members

- Public Types inherited from pcpp::GvcpLayer
enum class  GvcpCommand : uint16_t {
  DiscoveredCmd = 0x0002 , DiscoveredAck = 0x0003 , ForceIpCmd = 0x0004 , ForceIpAck = 0x0005 ,
  PacketResendCmd = 0x0040 , PacketResendAck = 0x0041 , ReadRegCmd = 0x0080 , ReadRegAck = 0x0081 ,
  WriteRegCmd = 0x0082 , WriteRegAck = 0x0083 , ReadMemCmd = 0x0084 , ReadMemAck = 0x0085 ,
  WriteMemCmd = 0x0086 , WriteMemAck = 0x0087 , PendingAck = 0x0089 , EventCmd = 0x00C0 ,
  EventAck = 0x00C1 , EventDataCmd = 0x00C2 , EventDataAck = 0x00C3 , ActionCmd = 0x0100 ,
  ActionAck = 0x0101 , Unknown = 0xFFFF
}
 
- Static Public Member Functions inherited from pcpp::GvcpRequestLayer
static bool isDataValid (const uint8_t *data, size_t dataLen)
 
- Static Public Member Functions inherited from pcpp::GvcpLayer
static bool isGvcpPort (uint16_t port)
 
static GvcpLayer * parseGvcpLayer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
 
- 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...
 

Detailed Description

Represents a GVCP discovery command (DISCOVERY_CMD)

Constructor & Destructor Documentation

◆ GvcpDiscoveryRequestLayer() [1/2]

pcpp::GvcpDiscoveryRequestLayer::GvcpDiscoveryRequestLayer ( uint8_t *  data,
size_t  dataLen,
Layer *  prevLayer,
Packet *  packet 
)
inline

A constructor that creates the layer from an existing packet raw data

Parameters
[in]dataA pointer to the raw data
[in]dataLenSize of the data in bytes
[in]prevLayerA pointer to the previous layer
[in]packetA pointer to the Packet instance where layer will be stored in

◆ GvcpDiscoveryRequestLayer() [2/2]

pcpp::GvcpDiscoveryRequestLayer::GvcpDiscoveryRequestLayer ( bool  allowBroadcastAck = false,
bool  acknowledgeRequired = true,
uint16_t  requestId = 1 
)
explicit

A constructor that creates a new GVCP discovery command

Parameters
[in]allowBroadcastAckWhether the device is allowed to broadcast the acknowledge, optional
[in]acknowledgeRequiredWhether an acknowledge is required, optional
[in]requestIdThe request ID, optional. The spec requires a non-zero value

Member Function Documentation

◆ hasAllowBroadcastAckFlag()

bool pcpp::GvcpDiscoveryRequestLayer::hasAllowBroadcastAckFlag ( ) const
Returns
True if the allow-broadcast-acknowledge bit is set in the flag, meaning the device is allowed to broadcast the acknowledge, false otherwise

◆ serializeLayer()

void pcpp::GvcpDiscoveryRequestLayer::serializeLayer ( ObjectScope &  serializer) const
overrideprotectedvirtual

Serializes the layer's data into a provided serializer object. This is used for generating serialized representations (like JSON) of the packet layers. This method should be overridden by derived layers to provide specific serialization logic.

Parameters
[in]serializerThe object scope serializer to which the layer details should be written.

Reimplemented from pcpp::GvcpRequestLayer.

◆ setAllowBroadcastAckFlag()

void pcpp::GvcpDiscoveryRequestLayer::setAllowBroadcastAckFlag ( bool  allowBroadcastAck)

Set or clear the allow-broadcast-acknowledge bit in the flag

Parameters
[in]allowBroadcastAckTrue to set the bit, false to clear it