29 static_assert(
sizeof(
s7commhdr) == 10,
"s7commhdr size is not 10 bytes");
42 static_assert(
sizeof(
s7comm_ack_data_hdr) == 12,
"s7comm_ack_data_hdr size is not 12 bytes");
68 S7CommParameter(uint8_t* data,
size_t dataLen) : m_Data(data), m_DataLen(dataLen)
85 S7CommLayer(uint8_t msgType, uint16_t pduRef, uint16_t paramLength, uint16_t dataLength, uint8_t errorClass = 0,
86 uint8_t errorCode = 0);
96 m_Parameter =
nullptr;
174 return reinterpret_cast<s7commhdr*
>(m_Data);
177 s7comm_ack_data_hdr* getS7commAckDataHeader()
const
179 if (getS7commHeader()->msgType == 0x03)
181 return reinterpret_cast<s7comm_ack_data_hdr*
>(m_Data);
186 size_t getS7commHeaderLength()
const;
188 S7CommParameter* m_Parameter;
Definition: S7CommLayer.h:76
void setErrorCode(uint8_t errorCode) const
uint16_t getPduRef() const
void computeCalculateFields() override
Does nothing for this layer (S7CommLayer is always last)
Definition: S7CommLayer.h:151
const S7CommParameter * getParameter()
uint8_t getProtocolId() const
void setErrorClass(uint8_t errorClass) const
static bool isDataValid(const uint8_t *data, size_t dataSize)
OsiModelLayer getOsiModelLayer() const override
Definition: S7CommLayer.h:166
void setPduRef(uint16_t pduRef) const
size_t getHeaderLen() const override
Definition: S7CommLayer.h:145
uint8_t getErrorClass() const
uint16_t getDataLength() const
S7CommLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: S7CommLayer.h:93
uint8_t getMsgType() const
uint8_t getErrorCode() const
void setMsgType(uint8_t msgType) const
S7CommLayer(uint8_t msgType, uint16_t pduRef, uint16_t paramLength, uint16_t dataLength, uint8_t errorClass=0, uint8_t errorCode=0)
std::string toString() const override
uint16_t getParamLength() const
void parseNextLayer() override
Does nothing for this layer (S7CommLayer is always last)
Definition: S7CommLayer.h:155
Definition: S7CommLayer.h:47
size_t getDataLength() const
Definition: S7CommLayer.h:62
uint8_t * getData() const
Definition: S7CommLayer.h:57
The main namespace for the PcapPlusPlus lib.
const ProtocolType S7COMM
S7COMM protocol.
Definition: ProtocolType.h:206
OsiModelLayer
An enum representing OSI model layers.
Definition: ProtocolType.h:225
@ OsiModelApplicationLayer
Application layer (layer 7)
Definition: ProtocolType.h:239
Definition: S7CommLayer.h:35
uint8_t errorClass
error class
Definition: S7CommLayer.h:37
uint8_t errorCode
error code
Definition: S7CommLayer.h:39
Definition: S7CommLayer.h:14
uint16_t dataLength
data length
Definition: S7CommLayer.h:26
uint16_t paramLength
parameter length
Definition: S7CommLayer.h:24
uint8_t protocolId
protocol id
Definition: S7CommLayer.h:16
uint8_t msgType
message type
Definition: S7CommLayer.h:18
uint16_t reserved
redundancy identification (reserved)
Definition: S7CommLayer.h:20
uint16_t pduRef
protocol data unit reference
Definition: S7CommLayer.h:22