PcapPlusPlus  Next
pcpp::GvcpAcknowledgeLayer Class Reference

#include <GvcpLayer.h>

Inheritance diagram for pcpp::GvcpAcknowledgeLayer:
pcpp::GvcpLayer pcpp::Layer pcpp::IDataContainer pcpp::GvcpDiscoveryAcknowledgeLayer pcpp::GvcpForceIpAcknowledgeLayer

Classes

struct  gvcp_ack_header
 
struct  SerializedFields
 

Public Types

enum class  GvcpResponseStatus : uint16_t {
  Success = 0x0000 , PacketResend = 0x0100 , NotImplemented = 0x8001 , InvalidParameter = 0x8002 ,
  InvalidAddress = 0x8003 , WriteProtect = 0x8004 , BadAlignment = 0x8005 , AccessDenied = 0x8006 ,
  Busy = 0x8007 , LocalProblem = 0x8008 , MsgMismatch = 0x8009 , InvalidProtocol = 0x800A ,
  NoMsg = 0x800B , PacketUnavailable = 0x800C , DataOverrun = 0x800D , InvalidHeader = 0x800E ,
  WrongConfig = 0x800F , PacketNotYetAvailable = 0x8010 , PacketAndPrevRemovedFromMemory = 0x8011 , PacketRemovedFromMemory = 0x8012 ,
  NoRefTime = 0x8013 , PacketTemporarilyUnavailable = 0x8014 , Overflow = 0x8015 , ActionLate = 0x8016 ,
  LeaderTrailerOverflow = 0x8017 , Error = 0x8FFF , Unknown = 0xFFFF
}
 
- 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
}
 

Public Member Functions

 GvcpAcknowledgeLayer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
 
 GvcpAcknowledgeLayer (GvcpResponseStatus status, GvcpCommand command, uint16_t ackId=0)
 
GvcpResponseStatus getStatus () const
 
void setStatus (GvcpResponseStatus status)
 
uint16_t getAckId () const
 
void setAckId (uint16_t ackId)
 
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
 

Static Public Member Functions

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)
 

Protected Member Functions

void serializeLayer (ObjectScope &serializer) const override
 
 GvcpAcknowledgeLayer (GvcpResponseStatus status, GvcpCommand command, uint16_t ackId, 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

- 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 acknowledge message. Acknowledges which don't have a specific layer class are represented by this class

Member Enumeration Documentation

◆ GvcpResponseStatus

GVCP response status can be returned in an acknowledge message or a GVSP header. See more in the spec "Table 19-1: List of Standard Status Codes"

Enumerator
Success 

Command executed successfully.

PacketResend 

Only applies to packet being resent.

NotImplemented 

Command is not supported by the device.

InvalidParameter 

At least one parameter provided in the command is invalid (or out of range) for the device.

InvalidAddress 

An attempt was made to access a non-existent address space location.

WriteProtect 

The addressed register cannot be written to.

BadAlignment 

A badly aligned address offset or data size was specified.

AccessDenied 

An attempt was made to access an address location which is currently/momentary not accessible.

Busy 

A required resource to service the request is not currently available. The request may be retried at a later time

LocalProblem 

Deprecated.

MsgMismatch 

Deprecated.

InvalidProtocol 

Deprecated.

NoMsg 

Deprecated.

PacketUnavailable 

The requested packet is not available anymore.

DataOverrun 

Internal memory of GVSP transmitter overrun (typically for image acquisition)

InvalidHeader 

The message header is not valid. Some of its fields do not match the specification.

WrongConfig 

Deprecated.

PacketNotYetAvailable 

The requested packet has not yet been acquired. Can be used for linescan cameras device when line trigger rate is slower than application timeout

PacketAndPrevRemovedFromMemory 

The requested packet and all previous ones are not available anymore and have been discarded from the GVSP transmitter memory

PacketRemovedFromMemory 

The requested packet is not available anymore and has been discarded from the GVSP transmitter memory.

NoRefTime 

The device is not synchronized to a master clock to be used as time reference.

PacketTemporarilyUnavailable 

The packet cannot be resent at the moment due to temporary bandwidth issues and should be requested again in the future

Overflow 

A device queue or packet data has overflowed.

ActionLate 

The requested scheduled action command was requested at a time that is already past.

LeaderTrailerOverflow 

Leader or trailer overflow (GEV 2.1)

Error 

Generic error.

Unknown 

Unknown status.

Constructor & Destructor Documentation

◆ GvcpAcknowledgeLayer() [1/3]

pcpp::GvcpAcknowledgeLayer::GvcpAcknowledgeLayer ( 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

◆ GvcpAcknowledgeLayer() [2/3]

pcpp::GvcpAcknowledgeLayer::GvcpAcknowledgeLayer ( GvcpResponseStatus  status,
GvcpCommand  command,
uint16_t  ackId = 0 
)
inline

A constructor that creates a new GVCP acknowledge which contains only the GVCP header. To add message data, add a PayloadLayer after this layer

Parameters
[in]statusThe response status
[in]commandThe acknowledge value
[in]ackIdThe acknowledge ID, optional
Exceptions
std::invalid_argumentif the acknowledge value is a command value (an even value)

◆ GvcpAcknowledgeLayer() [3/3]

pcpp::GvcpAcknowledgeLayer::GvcpAcknowledgeLayer ( GvcpResponseStatus  status,
GvcpCommand  command,
uint16_t  ackId,
size_t  bodyLen 
)
protected

A constructor that creates a new GVCP acknowledge with a message body of zeroed bytes after the header

Parameters
[in]statusThe response status
[in]commandThe acknowledge value
[in]ackIdThe acknowledge ID
[in]bodyLenThe size of the message body in bytes
Exceptions
std::invalid_argumentif the acknowledge value is a command value (an even value)

Member Function Documentation

◆ getAckId()

uint16_t pcpp::GvcpAcknowledgeLayer::getAckId ( ) const
Returns
The acknowledge ID from the header

◆ getCommand()

GvcpCommand pcpp::GvcpAcknowledgeLayer::getCommand ( ) const
overridevirtual
Returns
The acknowledge value from the header, GvcpCommand::Unknown if the value isn't defined by the spec

Implements pcpp::GvcpLayer.

◆ getDataSize()

uint16_t pcpp::GvcpAcknowledgeLayer::getDataSize ( ) const
overridevirtual
Returns
The data size from the header

Implements pcpp::GvcpLayer.

◆ getHeaderLen()

size_t pcpp::GvcpAcknowledgeLayer::getHeaderLen ( ) const
inlineoverridevirtual
Returns
The size of the GVCP acknowledge header

Implements pcpp::Layer.

Reimplemented in pcpp::GvcpDiscoveryAcknowledgeLayer.

◆ getStatus()

GvcpResponseStatus pcpp::GvcpAcknowledgeLayer::getStatus ( ) const
Returns
The response status from the header, GvcpResponseStatus::Unknown if the value isn't defined by the spec

◆ isDataValid()

static bool pcpp::GvcpAcknowledgeLayer::isDataValid ( const uint8_t *  data,
size_t  dataLen 
)
static

A static method that checks whether the data is large enough to hold a GVCP acknowledge header

Parameters
[in]dataA pointer to the raw data
[in]dataLenSize of the data in bytes
Returns
True if the data can be parsed as a GVCP acknowledge, false otherwise

◆ serializeLayer()

void pcpp::GvcpAcknowledgeLayer::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::GvcpLayer.

Reimplemented in pcpp::GvcpDiscoveryAcknowledgeLayer.

◆ setAckId()

void pcpp::GvcpAcknowledgeLayer::setAckId ( uint16_t  ackId)

Set the acknowledge ID in the header

Parameters
[in]ackIdThe acknowledge ID to set

◆ setStatus()

void pcpp::GvcpAcknowledgeLayer::setStatus ( GvcpResponseStatus  status)

Set the response status in the header

Parameters
[in]statusThe response status to set

◆ toString()

std::string pcpp::GvcpAcknowledgeLayer::toString ( ) const
overridevirtual
Returns
A string representation of the layer most important data

Implements pcpp::Layer.