|
PROFINET IO Controller Stack 1.0.0
Modern C++ implementation of a PROFINET IO Controller stack
|
Classes | |
| struct | BlockHeader |
| PROFINET block header (6 bytes). More... | |
| struct | ExpectedSubmodule |
| Expected submodule within a slot. More... | |
| struct | ExpectedSubmoduleAPI |
| Expected submodules for a specific API/slot. More... | |
| class | ExpectedSubmoduleBlockReq |
| ExpectedSubmoduleBlockReq (0x0104) builder. More... | |
| struct | ExpectedSubmoduleDataDescription |
| Describes I/O data for a submodule (one direction: Input or Output). More... | |
| struct | ExpectedSubmoduleSlot |
| One slot with in an api submodule. More... | |
| struct | InterfaceInfo |
| Interface information from PDInterfaceDataReal (0x0240). More... | |
| class | IODWriteMultipleBuilder |
| Builder for IODWriteMultipleReq packets (index 0xE040). More... | |
| struct | ModuleDiffBlock |
| Parsed ModuleDiffBlock (0x8104). More... | |
| struct | ModuleDiffModule |
| Difference info for a single module (slot). More... | |
| struct | ModuleDiffSubmodule |
| Difference info for a single submodule. More... | |
| struct | PDRealData |
| Parsed PDRealData (0xF841) structure. More... | |
| struct | PeerInfo |
| LLDP peer information from PDPortDataReal. More... | |
| struct | PortInfo |
| Port information from PDPortDataReal (0x020F). More... | |
| struct | PortStatistics |
| Parsed PDPortStatistic (0x0251) counters. More... | |
| struct | RealIdentificationData |
| Parsed RealIdentificationData (0xF000/0x0013) structure. More... | |
| struct | SlotInfo |
| Slot/subslot discovered from a device. More... | |
| struct | WriteMultipleResult |
| Result of a single write within a WriteMultiple operation. More... | |
Enumerations | |
| enum class | ModuleType : std::uint16_t { None = 0 , InputOnly = 1 , OutputOnly = 2 , InputAndOutput = 3 } |
Functions | |
| std::pair< BlockHeader, std::size_t > | ParseBlockHeader (const Bytes &data, std::size_t offset=0) |
| Parse a 6-byte PROFINET block header at an offset. | |
| std::size_t | Align4 (std::size_t offset) |
| Round an offset up to the next 4-byte boundary. | |
| std::tuple< std::uint32_t, std::uint16_t, std::uint16_t, std::size_t > | ParseMultipleBlockHeader (const Bytes &data, std::size_t offset=0) |
| Parse a MultipleBlockHeader (0x0400) body. | |
| InterfaceInfo | ParsePdInterfaceDataReal (const Bytes &data, std::size_t offset=0, std::size_t blockHeaderSize=blockHeaderLenght) |
| Parse a PDInterfaceDataReal (0x0240) block body. | |
| PortInfo | ParsePdPortDataReal (const Bytes &data, std::size_t offset=0, std::uint16_t slot=0, std::uint16_t subslot=0) |
| Parse a PDPortDataReal (0x020F) block body. | |
| PDRealData | ParsePdRealData (const Bytes &data) |
| Parse a complete PDRealData (0xF841) response. | |
| RealIdentificationData | ParseRealIdentificationData (const Bytes &data) |
| Parse a RealIdentificationData (0xF000 or 0x0013) response. | |
| std::optional< PortStatistics > | ParsePortStatistics (const Bytes &data, std::size_t offset=0) |
| Parse a PDPortStatistic (0x0251) block body. | |
| ModuleDiffBlock | ParseModuleDiffBlock (const Bytes &data) |
| Parse a ModuleDiffBlock (0x8104) from raw bytes. | |
| std::vector< WriteMultipleResult > | ParseWriteMultipleResponse (const Bytes &data) |
| Parse an IODWriteMultipleRes into individual per-write results. | |
Provides structures used by AR establishment and parameterization, including AR, IOCR, AlarmCR, ExpectedSubmodule, control, read, and related PROFINET block types.
Data classes and parsing functions for PROFINET block structures, extracted from the Wireshark pn_io dissector. Block structures follow the standard format: BlockHeader (6 bytes: Type, Length, Version) + variable body depending on block type.
|
strong |
|
inline |
Round an offset up to the next 4-byte boundary.
| offset | Offset to align. |
Definition at line 266 of file blocks.h.
Referenced by ParsePdInterfaceDataReal(), and ParsePdPortDataReal().
Here is the caller graph for this function:| std::pair< BlockHeader, std::size_t > profinet::blocks::ParseBlockHeader | ( | const Bytes & | data, |
| std::size_t | offset = 0 |
||
| ) |
Parse a 6-byte PROFINET block header at an offset.
| data | Buffer containing the header. |
| offset | Byte offset within Data to start parsing at. |
Throws std::invalid_argument if data is too short.
Definition at line 109 of file blocks.cpp.
References profinet::blockHeaderLenght, profinet::blocks::BlockHeader::blockLength, profinet::blocks::BlockHeader::blockType, profinet::wire::Reader::U16(), profinet::wire::Reader::U8(), profinet::blocks::BlockHeader::versionHigh, and profinet::blocks::BlockHeader::versionLow.
Referenced by ParsePdRealData(), and ParseRealIdentificationData().
Here is the call graph for this function:
Here is the caller graph for this function:| ModuleDiffBlock profinet::blocks::ParseModuleDiffBlock | ( | const Bytes & | data | ) |
Parse a ModuleDiffBlock (0x8104) from raw bytes.
| data | Buffer containing the complete block, including its own 6-byte block header. |
Throws std::invalid_argument if the block type doesn't match 0x8104. Returns an empty ModuleDiffBlock (not an error) if data is merely too short to contain the header, matching blocks.py's lenient handling.
Definition at line 593 of file blocks.cpp.
References profinet::GetBlockTypeName(), profinet::ModuleDifference, profinet::wire::Reader::Remaining(), profinet::wire::Reader::Skip(), profinet::wire::Reader::U16(), and profinet::wire::Reader::U32().
Referenced by profinet::rpc::RPCCon::ReadModuleDiff().
Here is the call graph for this function:
Here is the caller graph for this function:| std::tuple< std::uint32_t, std::uint16_t, std::uint16_t, std::size_t > profinet::blocks::ParseMultipleBlockHeader | ( | const Bytes & | data, |
| std::size_t | offset = 0 |
||
| ) |
Parse a MultipleBlockHeader (0x0400) body.
| data | Buffer containing the body. |
| offset | Byte offset within Data to start parsing at. |
Layout: 2 bytes padding + API(4) + SlotNr(2) + SubslotNr(2). Throws std::invalid_argument if data is too short.
Definition at line 125 of file blocks.cpp.
References profinet::wire::Reader::Skip(), profinet::wire::Reader::U16(), and profinet::wire::Reader::U32().
Referenced by ParsePdRealData().
Here is the call graph for this function:
Here is the caller graph for this function:| InterfaceInfo profinet::blocks::ParsePdInterfaceDataReal | ( | const Bytes & | data, |
| std::size_t | offset = 0, |
||
| std::size_t | blockHeaderSize = blockHeaderLenght |
||
| ) |
Parse a PDInterfaceDataReal (0x0240) block body.
| data | Buffer containing the body. |
| offset | Byte offset within Data to start parsing at. |
| blockHeaderSize | Size used for the alignment calculation (defaults to 6), matching blocks.py's align_from_block behavior. |
Throws std::invalid_argument if data is truncated.
Definition at line 140 of file blocks.cpp.
References Align4(), profinet::blocks::InterfaceInfo::chassisId, profinet::blocks::InterfaceInfo::gateway, profinet::blocks::InterfaceInfo::ipAddress, profinet::blocks::InterfaceInfo::macAddress, and profinet::blocks::InterfaceInfo::subnetMask.
Referenced by ParsePdRealData().
Here is the call graph for this function:
Here is the caller graph for this function:| PortInfo profinet::blocks::ParsePdPortDataReal | ( | const Bytes & | data, |
| std::size_t | offset = 0, |
||
| std::uint16_t | slot = 0, |
||
| std::uint16_t | subslot = 0 |
||
| ) |
Parse a PDPortDataReal (0x020F) block body.
| data | Buffer containing the body. |
| offset | Byte offset within Data to start parsing at. |
| slot | Fallback slot number, used only if not found in the data itself. |
| subslot | Fallback subslot number, used only if not found in the data itself. |
Slot/Subslot are typically overridden by a Slot/Subslot pair found in the data itself, matching blocks.py.
Definition at line 191 of file blocks.cpp.
References Align4(), profinet::OneOctetShift, profinet::blocks::PortInfo::slot, profinet::ThreeOctetsShift, and profinet::TwoOctetsShift.
Referenced by ParsePdRealData().
Here is the call graph for this function:
Here is the caller graph for this function:| PDRealData profinet::blocks::ParsePdRealData | ( | const Bytes & | data | ) |
Parse a complete PDRealData (0xF841) response.
| data | Buffer containing the complete response. |
A sequence of MultipleBlockHeader blocks, each describing a slot/subslot with nested sub-blocks (PDInterfaceDataReal, PDPortDataReal, etc).
Definition at line 313 of file blocks.cpp.
References profinet::blocks::SlotInfo::api, profinet::blockHeaderLenght, profinet::blocks::SlotInfo::blocks, profinet::blocks::BlockHeader::blockType, profinet::blocks::BlockHeader::BodyLength(), profinet::blocks::PDRealData::interface, profinet::MultipleHeader, ParseBlockHeader(), ParseMultipleBlockHeader(), ParsePdInterfaceDataReal(), ParsePdPortDataReal(), profinet::PortDataInterfaceDataReal, profinet::PortDataReal, profinet::blocks::PDRealData::ports, profinet::blocks::PDRealData::rawBlocks, profinet::blocks::SlotInfo::slot, profinet::blocks::PDRealData::slots, profinet::blocks::SlotInfo::subslot, and profinet::blocks::BlockHeader::TypeName().
Referenced by profinet::rpc::RPCCon::ReadPdRealData().
Here is the call graph for this function:
Here is the caller graph for this function:| std::optional< PortStatistics > profinet::blocks::ParsePortStatistics | ( | const Bytes & | data, |
| std::size_t | offset = 0 |
||
| ) |
Parse a PDPortStatistic (0x0251) block body.
| data | Buffer containing the body. |
| offset | Byte offset within Data to start parsing at. |
Definition at line 514 of file blocks.cpp.
References profinet::blocks::PortStatistics::counterStatus, profinet::blocks::PortStatistics::inDiscards, profinet::blocks::PortStatistics::inErrors, profinet::blocks::PortStatistics::inOctets, profinet::blocks::PortStatistics::outDiscards, profinet::blocks::PortStatistics::outErrors, profinet::blocks::PortStatistics::outOctets, profinet::wire::Reader::U16(), and profinet::wire::Reader::U32().
Here is the call graph for this function:| RealIdentificationData profinet::blocks::ParseRealIdentificationData | ( | const Bytes & | data | ) |
Parse a RealIdentificationData (0xF000 or 0x0013) response.
| data | Buffer containing the complete response. |
Handles both version 1.0 (no API level) and version 1.1 (API-grouped) layouts.
Definition at line 407 of file blocks.cpp.
References profinet::blocks::BlockHeader::blockType, ParseBlockHeader(), profinet::RealIdentificationData, profinet::RealIdentificationDataApi, profinet::wire::Reader::Remaining(), profinet::blocks::RealIdentificationData::slots, profinet::wire::Reader::U16(), profinet::wire::Reader::U32(), profinet::blocks::RealIdentificationData::version, profinet::blocks::BlockHeader::versionHigh, and profinet::blocks::BlockHeader::versionLow.
Referenced by profinet::rpc::RPCCon::ReadRealIdentificationData().
Here is the call graph for this function:
Here is the caller graph for this function:| std::vector< WriteMultipleResult > profinet::blocks::ParseWriteMultipleResponse | ( | const Bytes & | data | ) |
Parse an IODWriteMultipleRes into individual per-write results.
| data | Buffer containing the complete response. |
Definition at line 740 of file blocks.cpp.
References profinet::OneOctetShift, profinet::wire::Reader::Skip(), profinet::ThreeOctetsShift, profinet::TwoOctetsShift, profinet::wire::Reader::U16(), profinet::wire::Reader::U32(), and profinet::uuidLenght.
Referenced by profinet::rpc::RPCCon::WriteMultiple().
Here is the call graph for this function:
Here is the caller graph for this function: