PROFINET IO Controller Stack 1.0.0
Modern C++ implementation of a PROFINET IO Controller stack
Loading...
Searching...
No Matches
profinet::PNIODHeader Struct Reference

IOD read/write request/response header (RPC body for READ/WRITE/IMPLICIT_READ). More...

#include <protocol.h>

+ Collaboration diagram for profinet::PNIODHeader:

Public Member Functions

Bytes ToBytes () const
 Serialize this header and payload back to raw bytes.
 

Static Public Member Functions

static PNIODHeader Parse (const Bytes &data)
 Parse an IOD header and payload from raw bytes.
 

Public Attributes

std::array< std::uint8_t, blockHeaderLength > blockHeader {}
 Nested 6-byte block header (type + length + version).
 
std::uint16_t sequenceNumber = 0
 Sequence number for tracking retries.
 
std::array< std::uint8_t, uuidLenght > arUuid {}
 AR (Application Relationship) UUID this record belongs to.
 
std::uint32_t api = 0
 API number.
 
std::uint16_t slot = 0
 Slot number.
 
std::uint16_t subslot = 0
 Subslot number.
 
std::uint16_t padding1 = 0
 Reserved/padding.
 
std::uint16_t index = 0
 Record data index being read or written.
 
std::uint32_t length = 0
 Length in bytes of Payload.
 
std::array< std::uint8_t, uuidLenght > targetArUuid {}
 Target AR UUID for AR handover scenarios (usually zero).
 
std::array< std::uint8_t, 8 > padding2 {}
 Reserved/padding.
 
Bytes payload
 Record data payload.
 

Static Public Attributes

static constexpr std::uint16_t kContolCommandOffset = 28U
 ControlCommand is located at offset 28 inside PNIODControlBlockReq (Block Header: 6 bytes + ARUUID: 16 bytes + SessionKey: 2 bytes + Reserved: 4 bytes = 28 bytes)
 
static constexpr std::size_t kFixedSize = 64
 Size in bytes of the fixed portion of this header.
 

Detailed Description

IOD read/write request/response header (RPC body for READ/WRITE/IMPLICIT_READ).

Definition at line 1189 of file protocol.h.

Member Function Documentation

◆ Parse()

static PNIODHeader profinet::PNIODHeader::Parse ( const Bytes &  data)
inlinestatic

Parse an IOD header and payload from raw bytes.

Parameters
dataBytes starting at the BlockHeader field.
Returns
The parsed header.

Definition at line 1237 of file protocol.h.

References api, arUuid, blockHeader, profinet::blockHeaderLength, profinet::wire::Reader::Fixed(), index, kFixedSize, length, padding1, padding2, payload, profinet::wire::Reader::ReadBytes(), profinet::wire::Reader::Remaining(), sequenceNumber, slot, subslot, targetArUuid, profinet::wire::Reader::U16(), profinet::wire::Reader::U32(), and profinet::uuidLenght.

Referenced by TestRpcDevice::HandleRead(), TestRpcDevice::HandleWrite(), profinet::rpc::RPCCon::Read(), profinet::rpc::RPCCon::ReadImplicit(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), and profinet::rpc::TEST_F().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ToBytes()

Bytes profinet::PNIODHeader::ToBytes ( ) const
inline

Serialize this header and payload back to raw bytes.

Returns
The encoded bytes.

Definition at line 1262 of file protocol.h.

References api, arUuid, blockHeader, index, length, padding1, padding2, payload, profinet::wire::PutFixed(), profinet::wire::PutU16(), profinet::wire::PutU32(), sequenceNumber, slot, subslot, and targetArUuid.

Referenced by TestRpcDevice::HandleRead(), profinet::rpc::RpcTests::MakeIodResponsePayload(), profinet::rpc::RPCCon::Read(), profinet::rpc::RPCCon::ReadImplicit(), profinet::rpc::RPCCon::Write(), and profinet::rpc::RPCCon::WriteMultiple().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ api

◆ arUuid

std::array<std::uint8_t, uuidLenght> profinet::PNIODHeader::arUuid {}

AR (Application Relationship) UUID this record belongs to.

Definition at line 1202 of file protocol.h.

Referenced by Parse(), profinet::rpc::RPCCon::Read(), profinet::rpc::RPCCon::ReadImplicit(), ToBytes(), profinet::rpc::RPCCon::Write(), and profinet::rpc::RPCCon::WriteMultiple().

◆ blockHeader

std::array<std::uint8_t, blockHeaderLength> profinet::PNIODHeader::blockHeader {}

◆ index

◆ kContolCommandOffset

constexpr std::uint16_t profinet::PNIODHeader::kContolCommandOffset = 28U
staticconstexpr

ControlCommand is located at offset 28 inside PNIODControlBlockReq (Block Header: 6 bytes + ARUUID: 16 bytes + SessionKey: 2 bytes + Reserved: 4 bytes = 28 bytes)

Definition at line 1193 of file protocol.h.

Referenced by profinet::rpc::RPCCon::ApplicationReady(), and profinet::sim::VirtualProfinetRpcDevice::HandleControl().

◆ kFixedSize

constexpr std::size_t profinet::PNIODHeader::kFixedSize = 64
staticconstexpr

Size in bytes of the fixed portion of this header.

Definition at line 1232 of file protocol.h.

Referenced by profinet::rpc::RpcTests::MakeIodResponsePayload(), Parse(), and TEST_F().

◆ length

◆ padding1

std::uint16_t profinet::PNIODHeader::padding1 = 0

◆ padding2

std::array<std::uint8_t, 8> profinet::PNIODHeader::padding2 {}

◆ payload

◆ sequenceNumber

std::uint16_t profinet::PNIODHeader::sequenceNumber = 0

◆ slot

◆ subslot

◆ targetArUuid

std::array<std::uint8_t, uuidLenght> profinet::PNIODHeader::targetArUuid {}

Target AR UUID for AR handover scenarios (usually zero).

Definition at line 1223 of file protocol.h.

Referenced by Parse(), profinet::rpc::RPCCon::Read(), profinet::rpc::RPCCon::ReadImplicit(), ToBytes(), profinet::rpc::RPCCon::Write(), and profinet::rpc::RPCCon::WriteMultiple().


The documentation for this struct was generated from the following file: