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

#include <protocol.h>

+ Collaboration diagram for profinet::PNBlockHeader:

Public Member Functions

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

Static Public Member Functions

static PNBlockHeader Parse (const Bytes &data)
 Parse a block header from raw bytes.
 

Public Attributes

BlockType blockType
 Block type identifier.
 
std::uint16_t blockLength = 0
 Length in bytes of the block body (excludes Type/Length fields).
 
std::uint16_t blockVersion = 0x0100
 Block format version.
 
std::uint8_t blockVersionHigh = 1
 Block format major version.
 
std::uint8_t blockVersionLow = 0
 Block format minor version.
 

Static Public Attributes

static constexpr BlockType IODReadRequestHeader = BlockType::IoDataReadRequest
 Generic 6-byte PROFINET block header (Type + Length + Version).
 
static constexpr std::uint16_t IODReadResponseHeader = 0x8009
 Block type: IODReadResponseHeader.
 
static constexpr std::uint16_t InM0 = 0x0020
 Block type: I&M0.
 
static constexpr std::uint16_t InM0FilterDataSubModul = 0x0030
 Block type: I&M0 filter data (submodule level).
 
static constexpr std::uint16_t InM0FilterDataModul = 0x0031
 Block type: I&M0 filter data (module level).
 
static constexpr std::uint16_t InM0FilterDataDevice = 0x0032
 Block type: I&M0 filter data (device level).
 
static constexpr std::uint16_t DEFAULT_BLOCK_LENGTH = 60
 Default block length.
 
static constexpr std::size_t kSize = sizeof(std::uint16_t) + sizeof(std::uint16_t) + (2 * sizeof(std::uint8_t))
 Size in bytes of this header.
 

Detailed Description

Definition at line 1281 of file protocol.h.

Member Function Documentation

◆ Parse()

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

Parse a block header from raw bytes.

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

Definition at line 1328 of file protocol.h.

References blockLength, blockType, blockVersion, blockVersionHigh, blockVersionLow, kSize, profinet::wire::Reader::SkipTo(), profinet::wire::Reader::U16(), and profinet::wire::Reader::U8().

Referenced by profinet::ParseAlarmNotification(), 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()

Member Data Documentation

◆ blockLength

◆ blockType

◆ blockVersion

std::uint16_t profinet::PNBlockHeader::blockVersion = 0x0100

Block format version.

Definition at line 1314 of file protocol.h.

Referenced by Parse().

◆ blockVersionHigh

◆ blockVersionLow

◆ DEFAULT_BLOCK_LENGTH

constexpr std::uint16_t profinet::PNBlockHeader::DEFAULT_BLOCK_LENGTH = 60
staticconstexpr

Default block length.

Definition at line 1304 of file protocol.h.

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

◆ InM0

constexpr std::uint16_t profinet::PNBlockHeader::InM0 = 0x0020
staticconstexpr

Block type: I&M0.

Definition at line 1292 of file protocol.h.

◆ InM0FilterDataDevice

constexpr std::uint16_t profinet::PNBlockHeader::InM0FilterDataDevice = 0x0032
staticconstexpr

Block type: I&M0 filter data (device level).

Definition at line 1301 of file protocol.h.

◆ InM0FilterDataModul

constexpr std::uint16_t profinet::PNBlockHeader::InM0FilterDataModul = 0x0031
staticconstexpr

Block type: I&M0 filter data (module level).

Definition at line 1298 of file protocol.h.

◆ InM0FilterDataSubModul

constexpr std::uint16_t profinet::PNBlockHeader::InM0FilterDataSubModul = 0x0030
staticconstexpr

Block type: I&M0 filter data (submodule level).

Definition at line 1295 of file protocol.h.

◆ IODReadRequestHeader

constexpr BlockType profinet::PNBlockHeader::IODReadRequestHeader = BlockType::IoDataReadRequest
staticconstexpr

Generic 6-byte PROFINET block header (Type + Length + Version).

Block type: IODReadRequestHeader.

Definition at line 1286 of file protocol.h.

Referenced by profinet::rpc::RPCCon::Read(), and profinet::rpc::RPCCon::ReadImplicit().

◆ IODReadResponseHeader

constexpr std::uint16_t profinet::PNBlockHeader::IODReadResponseHeader = 0x8009
staticconstexpr

Block type: IODReadResponseHeader.

Definition at line 1289 of file protocol.h.

Referenced by profinet::rpc::RpcTests::MakeIodResponsePayload().

◆ kSize

constexpr std::size_t profinet::PNBlockHeader::kSize = sizeof(std::uint16_t) + sizeof(std::uint16_t) + (2 * sizeof(std::uint8_t))
staticconstexpr

Size in bytes of this header.

Definition at line 1323 of file protocol.h.

Referenced by Parse(), and TEST_F().


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