PROFINET IO Controller Stack 1.0.0
Modern C++ implementation of a PROFINET IO Controller stack
Loading...
Searching...
No Matches
protocol.h File Reference

PROFINET protocol wire-format structures and serialization helpers. More...

#include <algorithm>
#include <array>
#include <cstdint>
#include <stdexcept>
#include <string>
#include <vector>
#include "profinet/indices.h"
#include "profinet/util.h"
#include "profinet/wire.h"
+ Include dependency graph for protocol.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  profinet::EthernetHeader
 Plain (untagged) Ethernet II frame header. More...
 
struct  profinet::EthernetVLANHeader
 802.1Q VLAN-tagged Ethernet II frame header. More...
 
struct  profinet::PNDCPHeader
 DCP (Discovery and Configuration Protocol) frame header. More...
 
struct  profinet::IPConfiguration
 Decoded IPv4 address/netmask/gateway triple. More...
 
struct  profinet::PNDCPBlockRequest
 DCP request block: Option(1) + SubOption(1) + Length(2) + payload(Length). More...
 
struct  profinet::PNDCPBlock
 DCP response block: Option(1) + SubOption(1) + Length(2) + Status(2) + payload. More...
 
struct  profinet::PNRPCHeader
 DCE/RPC PDU header used to carry PROFINET connect/read/write/control requests. More...
 
struct  profinet::PNNRDData
 NRD (Network Representation Data) wrapper carrying the actual IOD payload. More...
 
struct  profinet::PNIODHeader
 IOD read/write request/response header (RPC body for READ/WRITE/IMPLICIT_READ). More...
 
struct  profinet::PNBlockHeader
 
struct  profinet::PNARBlockRequest
 ARBlockReq: establishes an Application Relationship (sent in the CONNECT request). More...
 
struct  profinet::PNIODReleaseBlock
 Control block used for Release/PrmBegin/PrmEnd/ApplicationReady/RTClass3 requests. More...
 
struct  profinet::PNInM0
 I&M0: mandatory identification data (vendor, order ID, serial number, revisions). More...
 
struct  profinet::PNInM1
 I&M1: user-assigned tag function and location strings. More...
 
struct  profinet::PNInM2
 I&M2: installation date. More...
 
struct  profinet::PNInM3
 I&M3: free-text descriptor. More...
 
struct  profinet::PNInM4
 I&M4: PROFIsafe signature (binary, not text). More...
 
struct  profinet::PNInM5
 I&M5: free-text annotation. More...
 
struct  profinet::PNInMReserved< Idx >
 I&M6-I&M15: reserved for future use per IEC 61158-6-10. More...
 
struct  profinet::IOCRAPIObject
 One slot/subslot's placement within an IOCR's cyclic data frame. More...
 
struct  profinet::PNIOCRBlockRes
 IOCRBlockRes: device's response confirming an IOCR (part of the CONNECT response). More...
 
struct  profinet::PNIOCRBlockReqHeader
 IOCRBlockReq header: requests establishment of one IOCR (part of the CONNECT request). More...
 
struct  profinet::PNAlarmCRBlockReq
 AlarmCRBlockReq: requests establishment of the alarm connection (part of the CONNECT request). More...
 
struct  profinet::PNAlarmCRBlockRes
 AlarmCRBlockRes: device's response confirming the alarm connection (part of the CONNECT response). More...
 
struct  profinet::PNAlarmNotificationPDU
 AlarmNotification-PDU: carries a diagnosis/process/pull/plug/... alarm event. More...
 
struct  profinet::PNAlarmAckPDU
 AlarmAck-PDU: acknowledges receipt of an AlarmNotification-PDU. More...
 
struct  profinet::PNRTAHeader
 RTA-PDU Header - Real-Time Acyclic PDU for Layer 2 alarm transport. More...
 
struct  profinet::PNExpectedSubmoduleDataDescription
 Describes one direction (input or output) of a submodule's cyclic data. More...
 
struct  profinet::PNIODWriteReq
 IODWriteReqHeader: request header for writing a data record. More...
 
struct  profinet::PNIODWriteRes
 IODWriteResHeader: response header confirming (or rejecting) a data record write. More...
 

Namespaces

namespace  profinet
 

Typedefs

using profinet::Bytes = std::vector< std::uint8_t >
 Generic byte buffer alias used throughout the library for raw wire data.
 
using profinet::PNInM6 = PNInMReserved< 0xAFF6 >
 I&M6 record type (reserved).
 
using profinet::PNInM7 = PNInMReserved< 0xAFF7 >
 I&M7 record type (reserved).
 
using profinet::PNInM8 = PNInMReserved< 0xAFF8 >
 I&M8 record type (reserved).
 
using profinet::PNInM9 = PNInMReserved< 0xAFF9 >
 I&M9 record type (reserved).
 
using profinet::PNInM10 = PNInMReserved< 0xAFFA >
 I&M10 record type (reserved).
 
using profinet::PNInM11 = PNInMReserved< 0xAFFB >
 I&M11 record type (reserved).
 
using profinet::PNInM12 = PNInMReserved< 0xAFFC >
 I&M12 record type (reserved).
 
using profinet::PNInM13 = PNInMReserved< 0xAFFD >
 I&M13 record type (reserved).
 
using profinet::PNInM14 = PNInMReserved< 0xAFFE >
 I&M14 record type (reserved).
 
using profinet::PNInM15 = PNInMReserved< 0xAFFF >
 I&M15 record type (reserved).
 

Variables

constexpr int profinet::blockHeaderLenght = 6
 Constant lenght of a blockHeader.
 
constexpr std::array< std::uint8_t, 12 > profinet::kPnUuidSuffix
 PROFINET UUID suffix, shared by all interface/object UUIDs.
 

Detailed Description

PROFINET protocol wire-format structures and serialization helpers.

Defines the C++ representations of the PROFINET protocol structures used by the controller, including Ethernet/DCP, DCE/RPC, IOD, IOCR, AlarmCR, RTA, I&M, and record-data blocks.

Each structure provides explicit parsing and/or serialization functionality for converting between strongly typed C++ objects and their binary on-the-wire representation. The layouts are ported from the corresponding profinet-py protocol definitions and are intended to maintain wire-level compatibility with PROFINET devices.

The header includes:

  • Ethernet II and VLAN frame headers.
  • DCP discovery and configuration headers and blocks.
  • DCE/RPC headers and PROFINET interface UUIDs.
  • Network Representation Data (NRD) and IOD record headers.
  • Generic PROFINET block headers.
  • ARBlockReq and control blocks.
  • Identification & Maintenance (I&M0-I&M15) records.
  • IOCR request/response and API objects.
  • AlarmCR request/response blocks.
  • Alarm notification and acknowledgement PDUs.
  • RTA headers for Layer 2 alarm transport.
  • Expected-submodule data descriptions.
  • IOD write request and response blocks.

Fixed-size constants are explicitly defined for wire structures to make their expected binary layout visible and testable. Parsing uses the profinet::wire reader utilities, while serialization uses the corresponding wire-writing helpers.

Definition in file protocol.h.