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

IOCRBlockReq header: requests establishment of one IOCR (part of the CONNECT request). More...

#include <protocol.h>

+ Collaboration diagram for profinet::PNIOCRBlockReqHeader:

Public Member Functions

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

Static Public Member Functions

static PNIOCRBlockReqHeader Parse (const Bytes &data)
 Parse the fixed IOCRBlockReq header.
 

Public Attributes

std::array< std::uint8_t, blockHeaderLength > blockHeader {}
 Nested 6-byte block header.
 
std::uint16_t iocrType = 0
 IOCR type (Input/Output/MulticastProvider/MulticastConsumer).
 
std::uint16_t iocrReference = 0
 IOCR reference chosen by the controller.
 
std::uint16_t etherTypeLT = PROFINET_ETHERTYPE
 EtherType used for cyclic frames (0x8892).
 
std::uint32_t iocrProperties = 0
 IOCR property flags (RT class, redundancy, etc.).
 
std::uint16_t dataLength = 0
 Total cyclic data length in bytes.
 
std::uint16_t frameId = 0
 Requested frame ID (device may reassign in its response).
 
std::uint16_t sendClockFactor = 32
 Send clock base factor (31.25us units).
 
std::uint16_t reductionRatio = 1
 Reduction ratio relative to the send clock.
 
std::uint16_t phase = 1
 Phase offset within the reduction ratio.
 
std::uint16_t sequence = 0
 Sequence value (reserved, usually 0).
 
std::uint32_t frameSendOffset = 0
 Frame send offset within the cycle.
 
std::uint16_t watchdogFactor = 3
 Watchdog factor (missed-frame tolerance before a timeout fault).
 
std::uint16_t dataHoldFactor = 3
 Data hold factor (how long to keep the last good frame's data).
 
std::uint16_t iocrTagHeader = 0xC000
 VLAN tag header used for cyclic frames.
 
MacAddress iocrMulticastMac {}
 Multicast MAC address (used only for multicast IOCRs).
 
std::uint16_t numberOfApis = 1
 Number of API entries that follow this header.
 

Static Public Attributes

static constexpr BlockType BLOCK_TYPE = BlockType::IoCrRequest
 Block type identifier for IOCRBlockReq.
 
static constexpr std::size_t kSize = 46
 Size in bytes of this header.
 

Detailed Description

IOCRBlockReq header: requests establishment of one IOCR (part of the CONNECT request).

Followed by a variable list of IOCRAPIObject entries (not modeled as a field here; callers append them after ToBytes()'s output).

Definition at line 1983 of file protocol.h.

Member Function Documentation

◆ Parse()

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

Parse the fixed IOCRBlockReq header.

Parameters
dataSerialized IOCRBlockReq block.
Returns
Parsed IOCRBlockReq header.
Exceptions
std::runtime_errorif the input is malformed.

Definition at line 2048 of file protocol.h.

References blockHeader, profinet::blockHeaderLength, dataHoldFactor, dataLength, etherTypeLT, profinet::wire::Reader::Fixed(), frameId, frameSendOffset, iocrMulticastMac, iocrProperties, iocrReference, iocrTagHeader, iocrType, kSize, profinet::macAddressLength, numberOfApis, phase, reductionRatio, sendClockFactor, sequence, profinet::wire::Reader::U16(), profinet::wire::Reader::U32(), and watchdogFactor.

Referenced by profinet::sim::VirtualProfinetRpcDevice::HandleConnect(), TestRpcDevice::HandleConnect(), profinet::CyclicCaptureTests::TEST(), profinet::CyclicCaptureTests::TEST(), profinet::CyclicCaptureTests::TEST(), profinet::TEST(), profinet::rpc::TEST_F(), and profinet::sim::VirtualProfinetRpcDevice::ValidateConnect().

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

◆ ToBytes()

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

Serialize this header back to raw bytes.

Returns
The encoded bytes.

Definition at line 2085 of file protocol.h.

References blockHeader, dataHoldFactor, dataLength, etherTypeLT, frameId, frameSendOffset, iocrMulticastMac, iocrProperties, iocrReference, iocrTagHeader, iocrType, numberOfApis, phase, profinet::wire::PutFixed(), profinet::wire::PutU16(), profinet::wire::PutU32(), reductionRatio, sendClockFactor, sequence, and watchdogFactor.

Referenced by profinet::rpc::RPCCon::BuildIocrBlock(), and TEST_F().

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

Member Data Documentation

◆ BLOCK_TYPE

constexpr BlockType profinet::PNIOCRBlockReqHeader::BLOCK_TYPE = BlockType::IoCrRequest
staticconstexpr

◆ blockHeader

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

Nested 6-byte block header.

Definition at line 1991 of file protocol.h.

Referenced by profinet::rpc::RPCCon::BuildIocrBlock(), Parse(), and ToBytes().

◆ dataHoldFactor

std::uint16_t profinet::PNIOCRBlockReqHeader::dataHoldFactor = 3

Data hold factor (how long to keep the last good frame's data).

Definition at line 2030 of file protocol.h.

Referenced by profinet::rpc::RPCCon::BuildIocrBlock(), Parse(), and ToBytes().

◆ dataLength

std::uint16_t profinet::PNIOCRBlockReqHeader::dataLength = 0

Total cyclic data length in bytes.

Definition at line 2006 of file protocol.h.

Referenced by profinet::rpc::RPCCon::BuildIocrBlock(), Parse(), and ToBytes().

◆ etherTypeLT

std::uint16_t profinet::PNIOCRBlockReqHeader::etherTypeLT = PROFINET_ETHERTYPE

EtherType used for cyclic frames (0x8892).

Definition at line 2000 of file protocol.h.

Referenced by profinet::rpc::RPCCon::BuildIocrBlock(), Parse(), and ToBytes().

◆ frameId

std::uint16_t profinet::PNIOCRBlockReqHeader::frameId = 0

Requested frame ID (device may reassign in its response).

Definition at line 2009 of file protocol.h.

Referenced by profinet::rpc::RPCCon::BuildIocrBlock(), Parse(), and ToBytes().

◆ frameSendOffset

std::uint32_t profinet::PNIOCRBlockReqHeader::frameSendOffset = 0

Frame send offset within the cycle.

Definition at line 2024 of file protocol.h.

Referenced by profinet::rpc::RPCCon::BuildIocrBlock(), Parse(), and ToBytes().

◆ iocrMulticastMac

MacAddress profinet::PNIOCRBlockReqHeader::iocrMulticastMac {}

Multicast MAC address (used only for multicast IOCRs).

Definition at line 2036 of file protocol.h.

Referenced by profinet::rpc::RPCCon::BuildIocrBlock(), Parse(), and ToBytes().

◆ iocrProperties

std::uint32_t profinet::PNIOCRBlockReqHeader::iocrProperties = 0

IOCR property flags (RT class, redundancy, etc.).

Definition at line 2003 of file protocol.h.

Referenced by profinet::rpc::RPCCon::BuildIocrBlock(), Parse(), and ToBytes().

◆ iocrReference

std::uint16_t profinet::PNIOCRBlockReqHeader::iocrReference = 0

IOCR reference chosen by the controller.

Definition at line 1997 of file protocol.h.

Referenced by profinet::rpc::RPCCon::BuildIocrBlock(), profinet::sim::VirtualProfinetRpcDevice::MakeIocrResponse(), Parse(), and ToBytes().

◆ iocrTagHeader

std::uint16_t profinet::PNIOCRBlockReqHeader::iocrTagHeader = 0xC000

VLAN tag header used for cyclic frames.

Definition at line 2033 of file protocol.h.

Referenced by profinet::rpc::RPCCon::BuildIocrBlock(), Parse(), and ToBytes().

◆ iocrType

std::uint16_t profinet::PNIOCRBlockReqHeader::iocrType = 0

◆ kSize

constexpr std::size_t profinet::PNIOCRBlockReqHeader::kSize = 46
staticconstexpr

Size in bytes of this header.

Definition at line 2042 of file protocol.h.

Referenced by profinet::rpc::RPCCon::BuildIocrBlock(), Parse(), profinet::CyclicCaptureTests::TEST(), and TEST_F().

◆ numberOfApis

std::uint16_t profinet::PNIOCRBlockReqHeader::numberOfApis = 1

Number of API entries that follow this header.

Definition at line 2039 of file protocol.h.

Referenced by profinet::rpc::RPCCon::BuildIocrBlock(), Parse(), and ToBytes().

◆ phase

std::uint16_t profinet::PNIOCRBlockReqHeader::phase = 1

Phase offset within the reduction ratio.

Definition at line 2018 of file protocol.h.

Referenced by profinet::rpc::RPCCon::BuildIocrBlock(), Parse(), and ToBytes().

◆ reductionRatio

std::uint16_t profinet::PNIOCRBlockReqHeader::reductionRatio = 1

Reduction ratio relative to the send clock.

Definition at line 2015 of file protocol.h.

Referenced by profinet::rpc::RPCCon::BuildIocrBlock(), Parse(), and ToBytes().

◆ sendClockFactor

std::uint16_t profinet::PNIOCRBlockReqHeader::sendClockFactor = 32

Send clock base factor (31.25us units).

Definition at line 2012 of file protocol.h.

Referenced by profinet::rpc::RPCCon::BuildIocrBlock(), Parse(), and ToBytes().

◆ sequence

std::uint16_t profinet::PNIOCRBlockReqHeader::sequence = 0

Sequence value (reserved, usually 0).

Definition at line 2021 of file protocol.h.

Referenced by profinet::rpc::RPCCon::BuildIocrBlock(), Parse(), and ToBytes().

◆ watchdogFactor

std::uint16_t profinet::PNIOCRBlockReqHeader::watchdogFactor = 3

Watchdog factor (missed-frame tolerance before a timeout fault).

Definition at line 2027 of file protocol.h.

Referenced by profinet::rpc::RPCCon::BuildIocrBlock(), Parse(), and ToBytes().


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