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, blockHeaderLenghtblockHeader {}
 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 1537 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 1602 of file protocol.h.

References blockHeader, profinet::blockHeaderLenght, 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.

+ Here is the call 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 1639 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().

+ 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

Block type identifier for IOCRBlockReq.

Definition at line 1541 of file protocol.h.

Referenced by profinet::rpc::RPCCon::BuildIocrBlock().

◆ blockHeader

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

Nested 6-byte block header.

Definition at line 1545 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 1584 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 1560 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 1554 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 1563 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 1578 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 1590 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 1557 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 1551 of file protocol.h.

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

◆ iocrTagHeader

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

VLAN tag header used for cyclic frames.

Definition at line 1587 of file protocol.h.

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

◆ iocrType

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

IOCR type (Input/Output/MulticastProvider/MulticastConsumer).

Definition at line 1548 of file protocol.h.

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

◆ kSize

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

Size in bytes of this header.

Definition at line 1596 of file protocol.h.

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

◆ numberOfApis

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

Number of API entries that follow this header.

Definition at line 1593 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 1572 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 1569 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 1566 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 1575 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 1581 of file protocol.h.

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


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