7 #include <initializer_list>
133 static std::vector<FieldDescriptor>
all()
137 std::copy(extra.begin(), extra.end(), std::back_inserter(result));
158 :
Layer(data, dataLen, prevLayer, packet,
GVCP)
168 static uint16_t getRawCommand(
const uint8_t* data);
187 :
GvcpLayer(data, dataLen, prevLayer, packet)
250 static std::vector<FieldDescriptor>
all()
254 std::copy(extra.begin(), extra.end(), std::back_inserter(result));
275 #pragma pack(push, 1)
292 static_assert(
sizeof(
gvcp_request_header) == 8,
"gvcp_request_header size is not 8 bytes");
388 :
GvcpLayer(data, dataLen, prevLayer, packet)
448 static std::vector<FieldDescriptor>
all()
452 std::copy(extra.begin(), extra.end(), std::back_inserter(result));
473 #pragma pack(push, 1)
488 static_assert(
sizeof(
gvcp_ack_header) == 8,
"gvcp_ack_header size is not 8 bytes");
531 uint16_t requestId = 1);
546 static std::vector<FieldDescriptor>
all()
550 std::copy(extra.begin(), extra.end(), std::back_inserter(result));
695 static std::vector<FieldDescriptor>
all()
698 std::initializer_list<FieldDescriptor> extra{
703 std::copy(extra.begin(), extra.end(), std::back_inserter(result));
752 #pragma pack(push, 1)
754 struct gvcp_discovery_body
757 uint16_t versionMajor;
759 uint16_t versionMinor;
765 uint8_t macAddress[6];
767 uint32_t supportedIpConfigOptions;
769 uint32_t ipConfigCurrent;
771 uint8_t reserved2[12];
775 uint8_t reserved3[12];
779 uint8_t reserved4[12];
781 uint32_t defaultGateway;
783 char manufacturerName[32];
787 char deviceVersion[32];
789 char manufacturerSpecificInformation[48];
791 char serialNumber[16];
793 char userDefinedName[16];
796 static_assert(
sizeof(gvcp_discovery_body) == 248,
"gvcp_discovery_body size is not 248 bytes");
798 gvcp_discovery_body* getGvcpDiscoveryBody()
const
800 return reinterpret_cast<gvcp_discovery_body*
>(m_Data +
sizeof(gvcp_ack_header));
827 uint16_t requestId = 1);
879 static std::vector<FieldDescriptor>
all()
883 std::copy(extra.begin(), extra.end(), std::back_inserter(result));
908 #pragma pack(push, 1)
910 struct gvcp_forceip_body
915 uint8_t macAddress[6];
917 uint8_t reserved2[12];
921 uint8_t reserved3[12];
925 uint8_t reserved4[12];
930 static_assert(
sizeof(gvcp_forceip_body) == 56,
"gvcp_forceip_body size is not 56 bytes");
932 gvcp_forceip_body* getGvcpForceIpBody()
const
934 return reinterpret_cast<gvcp_forceip_body*
>(m_Data +
sizeof(gvcp_request_header));
Definition: GvcpLayer.h:316
GvcpResponseStatus getStatus() const
void serializeLayer(ObjectScope &serializer) const override
GvcpCommand getCommand() const override
GvcpAcknowledgeLayer(GvcpResponseStatus status, GvcpCommand command, uint16_t ackId, size_t bodyLen)
uint16_t getAckId() const
void setAckId(uint16_t ackId)
static bool isDataValid(const uint8_t *data, size_t dataLen)
void setStatus(GvcpResponseStatus status)
GvcpAcknowledgeLayer(GvcpResponseStatus status, GvcpCommand command, uint16_t ackId=0)
Definition: GvcpLayer.h:397
uint16_t getDataSize() const override
std::string toString() const override
size_t getHeaderLen() const override
Definition: GvcpLayer.h:431
void computeCalculateFields() override
Calculate the data size field in the header according to the size of the data that follows the header...
GvcpAcknowledgeLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: GvcpLayer.h:387
GvcpResponseStatus
Definition: GvcpLayer.h:321
@ Overflow
A device queue or packet data has overflowed.
@ DataOverrun
Internal memory of GVSP transmitter overrun (typically for image acquisition)
@ WriteProtect
The addressed register cannot be written to.
@ Success
Command executed successfully.
@ 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.
@ ActionLate
The requested scheduled action command was requested at a time that is already past.
@ PacketResend
Only applies to packet being resent.
@ NoRefTime
The device is not synchronized to a master clock to be used as time reference.
@ PacketRemovedFromMemory
The requested packet is not available anymore and has been discarded from the GVSP transmitter memory...
@ PacketUnavailable
The requested packet is not available anymore.
@ LocalProblem
Deprecated.
@ NotImplemented
Command is not supported by the device.
@ LeaderTrailerOverflow
Leader or trailer overflow (GEV 2.1)
@ PacketAndPrevRemovedFromMemory
@ PacketTemporarilyUnavailable
@ AccessDenied
An attempt was made to access an address location which is currently/momentary not accessible.
@ BadAlignment
A badly aligned address offset or data size was specified.
@ InvalidHeader
The message header is not valid. Some of its fields do not match the specification.
@ InvalidProtocol
Deprecated.
Definition: GvcpLayer.h:569
std::string getUserDefinedName() const
void serializeLayer(ObjectScope &serializer) const override
size_t getHeaderLen() const override
Definition: GvcpLayer.h:684
void setModelName(const std::string &modelName)
void setUserDefinedName(const std::string &userDefinedName)
std::string getModelName() const
std::string getDeviceVersion() const
void setVersion(const GvcpVersion &version)
GvcpDiscoveryAcknowledgeLayer(GvcpResponseStatus status=GvcpResponseStatus::Success, uint16_t ackId=0)
void setMacAddress(const MacAddress &macAddress)
IPv4Address getIpAddress() const
static bool isDataValid(const uint8_t *data, size_t dataLen)
std::string getSerialNumber() const
void setSubnetMask(const IPv4Address &subnetMask)
void setManufacturerName(const std::string &manufacturerName)
IPv4Address getGatewayIpAddress() const
void setManufacturerSpecificInformation(const std::string &info)
std::string getManufacturerSpecificInformation() const
std::string getManufacturerName() const
GvcpVersion getVersion() const
void setSerialNumber(const std::string &serialNumber)
void setGatewayIpAddress(const IPv4Address &gatewayIpAddress)
void setIpAddress(const IPv4Address &ipAddress)
GvcpDiscoveryAcknowledgeLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: GvcpLayer.h:586
MacAddress getMacAddress() const
IPv4Address getSubnetMask() const
void setDeviceVersion(const std::string &deviceVersion)
Definition: GvcpLayer.h:515
void serializeLayer(ObjectScope &serializer) const override
void setAllowBroadcastAckFlag(bool allowBroadcastAck)
bool hasAllowBroadcastAckFlag() const
GvcpDiscoveryRequestLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: GvcpLayer.h:522
GvcpDiscoveryRequestLayer(bool allowBroadcastAck=false, bool acknowledgeRequired=true, uint16_t requestId=1)
Definition: GvcpLayer.h:941
GvcpForceIpAcknowledgeLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: GvcpLayer.h:948
GvcpForceIpAcknowledgeLayer(GvcpResponseStatus status=GvcpResponseStatus::Success, uint16_t ackId=0)
Definition: GvcpLayer.h:955
Definition: GvcpLayer.h:807
void setSubnetMask(const IPv4Address &subnetMask)
IPv4Address getGatewayIpAddress() const
IPv4Address getIpAddress() const
IPv4Address getSubnetMask() const
MacAddress getMacAddress() const
GvcpForceIpRequestLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: GvcpLayer.h:814
void setIpAddress(const IPv4Address &ipAddress)
static bool isDataValid(const uint8_t *data, size_t dataLen)
GvcpForceIpRequestLayer(const MacAddress &macAddress, const IPv4Address &ipAddress, const IPv4Address &subnetMask, const IPv4Address &gatewayIpAddress, GvcpFlag flag=0, uint16_t requestId=1)
void setGatewayIpAddress(const IPv4Address &gatewayIpAddress)
void serializeLayer(ObjectScope &serializer) const override
size_t getHeaderLen() const override
Definition: GvcpLayer.h:868
void setMacAddress(const MacAddress &macAddress)
Definition: GvcpLayer.h:33
virtual GvcpCommand getCommand() const =0
OsiModelLayer getOsiModelLayer() const override
Definition: GvcpLayer.h:122
GvcpCommand
Definition: GvcpLayer.h:38
@ ReadMemCmd
Read memory command (Device Memory Access)
@ ForceIpCmd
Force IP command (Discovery Protocol Control)
@ ForceIpAck
Force IP acknowledge (Discovery Protocol Control)
@ DiscoveredAck
Discovery acknowledge (Discovery Protocol Control)
@ WriteRegCmd
Write register command (Device Memory Access)
@ ReadRegCmd
Read register command (Device Memory Access)
@ EventDataAck
Event data acknowledge (Asynchronous Events)
@ ActionCmd
Action command (Miscellaneous)
@ ActionAck
Action acknowledge (Miscellaneous)
@ WriteMemAck
Write memory acknowledge (Device Memory Access)
@ WriteRegAck
Write register acknowledge (Device Memory Access)
@ WriteMemCmd
Write memory command (Device Memory Access)
@ EventAck
Event acknowledge (Asynchronous Events)
@ ReadMemAck
Read memory acknowledge (Device Memory Access)
@ PendingAck
Pending acknowledge (Device Memory Access)
@ Unknown
Unknown command.
@ PacketResendAck
Packet resend acknowledge (Streaming Protocol Control). The resent packet must be on the stream chann...
@ EventCmd
Event command (Asynchronous Events)
@ EventDataCmd
Event data command (Asynchronous Events)
@ ReadRegAck
Read register acknowledge (Device Memory Access)
@ PacketResendCmd
Packet resend command (Streaming Protocol Control)
@ DiscoveredCmd
Discovery command (Discovery Protocol Control)
virtual uint16_t getDataSize() const =0
void parseNextLayer() override
Creates a PayloadLayer from the rest of the message, if there is data after this layer.
void initLayer(size_t dataLen)
void serializeLayer(ObjectScope &serializer) const override
static bool isGvcpPort(uint16_t port)
Definition: GvcpLayer.h:93
static GvcpLayer * parseGvcpLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: GvcpLayer.h:179
std::string toString() const override
static bool isDataValid(const uint8_t *data, size_t dataLen)
bool hasAcknowledgeFlag() const
GvcpRequestLayer(GvcpCommand command, GvcpFlag flag, uint16_t requestId, size_t bodyLen)
GvcpRequestLayer(GvcpCommand command, GvcpFlag flag=0, uint16_t requestId=1)
Definition: GvcpLayer.h:196
void serializeLayer(ObjectScope &serializer) const override
GvcpCommand getCommand() const override
uint16_t getRequestId() const
uint16_t getDataSize() const override
void setRequestId(uint16_t requestId)
void computeCalculateFields() override
Calculate the data size field in the header according to the size of the data that follows the header...
size_t getHeaderLen() const override
Definition: GvcpLayer.h:233
GvcpRequestLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: GvcpLayer.h:186
void setFlag(GvcpFlag flag)
Definition: IpAddress.h:30
Definition: MacAddress.h:24
Definition: Serializers.h:230
const ProtocolType GVCP
GigE Vision Control Protocol (GVCP)
Definition: ProtocolType.h:270
The main namespace for the PcapPlusPlus lib.
Definition: AssertionUtils.h:19
uint8_t GvcpFlag
Definition: GvcpLayer.h:22
OsiModelLayer
An enum representing OSI model layers.
Definition: ProtocolType.h:420
@ OsiModelApplicationLayer
Application layer (layer 7)
Definition: ProtocolType.h:436
std::ostream & operator<<(std::ostream &os, GvcpAcknowledgeLayer::GvcpResponseStatus status)
Definition: Serializers.h:18
Definition: GvcpLayer.h:446
static const FieldDescriptor Status
Response status value.
Definition: GvcpLayer.h:457
static constexpr uint16_t MaxID
Maximum field ID used by GvcpAcknowledgeLayer.
Definition: GvcpLayer.h:467
static std::vector< FieldDescriptor > all()
Definition: GvcpLayer.h:448
static const FieldDescriptor AckId
Acknowledge ID.
Definition: GvcpLayer.h:463
static const FieldDescriptor StatusName
Name of the response status, or "Unknown".
Definition: GvcpLayer.h:460
Definition: GvcpLayer.h:574
uint16_t minor
The version minor number.
Definition: GvcpLayer.h:578
uint16_t major
The version major number.
Definition: GvcpLayer.h:576
Definition: GvcpLayer.h:693
static const FieldDescriptor SubnetMask
Device subnet mask, as a string.
Definition: GvcpLayer.h:720
static constexpr uint16_t MaxID
Maximum field ID used by GvcpDiscoveryAcknowledgeLayer.
Definition: GvcpLayer.h:745
static const FieldDescriptor ManufacturerSpecificInformation
Manufacturer specific information.
Definition: GvcpLayer.h:735
static const FieldDescriptor ManufacturerName
Manufacturer name.
Definition: GvcpLayer.h:726
static std::vector< FieldDescriptor > all()
Definition: GvcpLayer.h:695
static const FieldDescriptor UserDefinedName
User defined name.
Definition: GvcpLayer.h:741
static const FieldDescriptor GatewayIpAddress
Device default gateway IP address, as a string.
Definition: GvcpLayer.h:723
static const FieldDescriptor ModelName
Model name.
Definition: GvcpLayer.h:729
static const FieldDescriptor DeviceVersion
Device version.
Definition: GvcpLayer.h:732
static const FieldDescriptor IpAddress
Device IP address, as a string.
Definition: GvcpLayer.h:717
static const FieldDescriptor SerialNumber
Serial number.
Definition: GvcpLayer.h:738
static const FieldDescriptor VersionMajor
GigE Vision spec version major number.
Definition: GvcpLayer.h:708
static const FieldDescriptor MacAddress
Device MAC address, as a string.
Definition: GvcpLayer.h:714
static const FieldDescriptor VersionMinor
GigE Vision spec version minor number.
Definition: GvcpLayer.h:711
Definition: GvcpLayer.h:544
static const FieldDescriptor AllowBroadcastAck
Whether the allow-broadcast-acknowledge bit is set.
Definition: GvcpLayer.h:555
static constexpr uint16_t MaxID
Maximum field ID used by GvcpDiscoveryRequestLayer.
Definition: GvcpLayer.h:559
static std::vector< FieldDescriptor > all()
Definition: GvcpLayer.h:546
Definition: GvcpLayer.h:877
static const FieldDescriptor MacAddress
MAC address of the device to configure, as a string.
Definition: GvcpLayer.h:888
static const FieldDescriptor GatewayIpAddress
Default gateway IP address to force on the device, as a string.
Definition: GvcpLayer.h:897
static std::vector< FieldDescriptor > all()
Definition: GvcpLayer.h:879
static const FieldDescriptor IpAddress
IP address to force on the device, as a string.
Definition: GvcpLayer.h:891
static const FieldDescriptor SubnetMask
Subnet mask to force on the device, as a string.
Definition: GvcpLayer.h:894
static constexpr uint16_t MaxID
Maximum field ID used by GvcpForceIpRequestLayer.
Definition: GvcpLayer.h:901
Definition: GvcpLayer.h:131
static constexpr uint16_t MaxID
Maximum field ID used by GvcpLayer.
Definition: GvcpLayer.h:149
static const FieldDescriptor CommandName
Name of the command or acknowledge value, or "Unknown".
Definition: GvcpLayer.h:145
static std::vector< FieldDescriptor > all()
Definition: GvcpLayer.h:133
static const FieldDescriptor Command
Command or acknowledge value.
Definition: GvcpLayer.h:142
Definition: GvcpLayer.h:248
static const FieldDescriptor RequestId
Request ID.
Definition: GvcpLayer.h:265
static constexpr uint16_t MaxID
Maximum field ID used by GvcpRequestLayer.
Definition: GvcpLayer.h:269
static std::vector< FieldDescriptor > all()
Definition: GvcpLayer.h:250
static const FieldDescriptor AcknowledgeRequired
Whether the acknowledge-required bit is set.
Definition: GvcpLayer.h:262
static const FieldDescriptor Flag
Flag from the header.
Definition: GvcpLayer.h:259
static std::vector< FieldDescriptor > all()
Definition: Layer.h:214
static constexpr uint16_t MaxID
Maximum field ID used by the layer.
Definition: Layer.h:229