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

DCE/RPC PDU header used to carry PROFINET connect/read/write/control requests. More...

#include <protocol.h>

+ Collaboration diagram for profinet::PNRPCHeader:

Public Member Functions

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

Static Public Member Functions

static std::array< std::uint8_t, uuidLenghtIfaceUuidDevice ()
 Interface UUID identifying the IO-Device role.
 
static std::array< std::uint8_t, uuidLenghtIfaceUuidController ()
 Interface UUID identifying the IO-Controller role.
 
static std::array< std::uint8_t, uuidLenghtIfaceUuidSupervisor ()
 Interface UUID identifying the IO-Supervisor role.
 
static std::array< std::uint8_t, uuidLenghtIfaceUuidParamserver ()
 Interface UUID identifying the Parameter Server role.
 
static PNRPCHeader Parse (const Bytes &data)
 Parse an RPC header and body from raw bytes.
 

Public Attributes

std::uint8_t version = 4
 DCE/RPC version (always 4 for PROFINET).
 
std::uint8_t packetType = 0
 Packet type (REQUEST/RESPONSE/FAULT/...).
 
std::uint8_t flags1 = 0
 Packet flags, first byte.
 
std::uint8_t flags2 = 0
 Packet flags, second byte.
 
std::array< std::uint8_t, 3 > dataRepresentation {}
 Data representation format label.
 
std::uint8_t serialNrHigh = 0
 High byte of the serial number.
 
std::array< std::uint8_t, uuidLenghtobjectUuid {}
 Target object UUID.
 
std::array< std::uint8_t, uuidLenghtinterfaceUuid {}
 Target interface UUID (identifies device/controller/supervisor role).
 
std::array< std::uint8_t, uuidLenghtactivityUuid {}
 Activity (call) UUID correlating request/response pairs.
 
std::uint32_t serverBootTime = 0
 Server boot time counter.
 
std::uint32_t interfaceVersion = 1
 Interface version.
 
std::uint32_t sequenceNumber = 0
 Sequence number within the activity.
 
std::uint16_t operationNumber = 0
 Operation number (CONNECT/RELEASE/READ/WRITE/CONTROL/IMPLICIT_READ).
 
std::uint16_t interfaceHint = 0xFFFF
 Interface hint (0xFFFF if unused).
 
std::uint16_t activityHint = 0xFFFF
 Activity hint (0xFFFF if unused).
 
std::uint16_t lengthOfBody = 0
 Length in bytes of Payload.
 
std::uint16_t fragmentNumber = 0
 Fragment number for fragmented PDUs.
 
std::uint8_t authenticationProtocol = 0
 Authentication protocol identifier (unused by PROFINET).
 
std::uint8_t serialNrLow = 0
 Low byte of the serial number.
 
Bytes payload
 PDU body (NRD data for read/write/control, etc.).
 

Static Public Attributes

static constexpr std::uint8_t REQUEST = 0x00
 Packet type: REQUEST.
 
static constexpr std::uint8_t PING = 0x01
 Packet type: PING.
 
static constexpr std::uint8_t RESPONSE = 0x02
 Packet type: RESPONSE.
 
static constexpr std::uint8_t FAULT = 0x03
 Packet type: FAULT.
 
static constexpr std::uint8_t WORKING = 0x04
 Packet type: WORKING.
 
static constexpr std::uint8_t PONG = 0x05
 Packet type: PONG.
 
static constexpr std::uint8_t REJECT = 0x06
 Packet type: REJECT.
 
static constexpr std::uint8_t ACK = 0x07
 Packet type: ACK.
 
static constexpr std::uint8_t CANCEL = 0x08
 Packet type: CANCEL.
 
static constexpr std::uint8_t FRAG_ACK = 0x09
 Packet type: FRAG_ACK.
 
static constexpr std::uint8_t CANCEL_ACK = 0x0A
 Packet type: CANCEL_ACK.
 
static constexpr std::uint16_t CONNECT = 0x00
 Operation number: CONNECT.
 
static constexpr std::uint16_t RELEASE = 0x01
 Operation number: RELEASE.
 
static constexpr std::uint16_t READ = 0x02
 Operation number: READ.
 
static constexpr std::uint16_t WRITE = 0x03
 Operation number: WRITE.
 
static constexpr std::uint16_t CONTROL = 0x04
 Operation number: CONTROL.
 
static constexpr std::uint16_t IMPLICIT_READ = 0x05
 Operation number: IMPLICIT_READ.
 
static constexpr std::size_t kFixedSize = 80
 Size in bytes of the fixed portion of this header.
 

Static Private Member Functions

static std::array< std::uint8_t, uuidLenghtPrefixedUuid (std::uint8_t b2, std::uint8_t b3)
 Build a 16-byte PROFINET interface/object UUID from its two distinguishing bytes.
 

Detailed Description

DCE/RPC PDU header used to carry PROFINET connect/read/write/control requests.

Definition at line 464 of file protocol.h.

Member Function Documentation

◆ IfaceUuidController()

static std::array< std::uint8_t, uuidLenght > profinet::PNRPCHeader::IfaceUuidController ( )
inlinestatic

Interface UUID identifying the IO-Controller role.

Returns
The 16-byte interface UUID.

Definition at line 592 of file protocol.h.

References PrefixedUuid().

+ Here is the call graph for this function:

◆ IfaceUuidDevice()

static std::array< std::uint8_t, uuidLenght > profinet::PNRPCHeader::IfaceUuidDevice ( )
inlinestatic

Interface UUID identifying the IO-Device role.

Returns
The 16-byte interface UUID.

Definition at line 585 of file protocol.h.

References PrefixedUuid().

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

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

◆ IfaceUuidParamserver()

static std::array< std::uint8_t, uuidLenght > profinet::PNRPCHeader::IfaceUuidParamserver ( )
inlinestatic

Interface UUID identifying the Parameter Server role.

Returns
The 16-byte interface UUID.

Definition at line 606 of file protocol.h.

References PrefixedUuid().

+ Here is the call graph for this function:

◆ IfaceUuidSupervisor()

static std::array< std::uint8_t, uuidLenght > profinet::PNRPCHeader::IfaceUuidSupervisor ( )
inlinestatic

Interface UUID identifying the IO-Supervisor role.

Returns
The 16-byte interface UUID.

Definition at line 599 of file protocol.h.

References PrefixedUuid().

+ Here is the call graph for this function:

◆ Parse()

static PNRPCHeader profinet::PNRPCHeader::Parse ( const Bytes data)
inlinestatic

Parse an RPC header and body from raw bytes.

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

Definition at line 614 of file protocol.h.

References activityHint, activityUuid, authenticationProtocol, dataRepresentation, profinet::wire::Reader::Fixed(), flags1, flags2, fragmentNumber, interfaceHint, interfaceUuid, interfaceVersion, kFixedSize, lengthOfBody, objectUuid, operationNumber, packetType, payload, profinet::wire::Reader::ReadBytes(), profinet::wire::Reader::Remaining(), sequenceNumber, serialNrHigh, serialNrLow, serverBootTime, profinet::wire::Reader::U16(), profinet::wire::Reader::U32(), profinet::wire::Reader::U8(), profinet::uuidLenght, and version.

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

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

◆ PrefixedUuid()

static std::array< std::uint8_t, uuidLenght > profinet::PNRPCHeader::PrefixedUuid ( std::uint8_t  b2,
std::uint8_t  b3 
)
inlinestaticprivate

Build a 16-byte PROFINET interface/object UUID from its two distinguishing bytes.

Parameters
b2Third UUID byte (role selector).
b3Fourth UUID byte (role selector).
Returns
The complete 16-byte UUID.

Definition at line 678 of file protocol.h.

References profinet::kPnUuidSuffix.

Referenced by IfaceUuidController(), IfaceUuidDevice(), IfaceUuidParamserver(), and IfaceUuidSupervisor().

+ Here is the caller graph for this function:

◆ ToBytes()

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

Serialize this header and body back to raw bytes.

Returns
The encoded bytes.

Definition at line 647 of file protocol.h.

References activityHint, activityUuid, authenticationProtocol, dataRepresentation, flags1, flags2, fragmentNumber, interfaceHint, interfaceUuid, interfaceVersion, lengthOfBody, objectUuid, operationNumber, packetType, payload, profinet::wire::PutFixed(), profinet::wire::PutU16(), profinet::wire::PutU32(), profinet::wire::PutU8(), sequenceNumber, serialNrHigh, serialNrLow, serverBootTime, and version.

Referenced by profinet::rpc::RPCCon::Disconnect(), profinet::rpc::RPCCon::SendControl(), and profinet::rpc::RPCCon::SendReceive().

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

Member Data Documentation

◆ ACK

constexpr std::uint8_t profinet::PNRPCHeader::ACK = 0x07
staticconstexpr

Packet type: ACK.

Definition at line 489 of file protocol.h.

◆ activityHint

std::uint16_t profinet::PNRPCHeader::activityHint = 0xFFFF

Activity hint (0xFFFF if unused).

Definition at line 563 of file protocol.h.

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

◆ activityUuid

std::array<std::uint8_t, uuidLenght> profinet::PNRPCHeader::activityUuid {}

Activity (call) UUID correlating request/response pairs.

Definition at line 545 of file protocol.h.

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

◆ authenticationProtocol

std::uint8_t profinet::PNRPCHeader::authenticationProtocol = 0

Authentication protocol identifier (unused by PROFINET).

Definition at line 572 of file protocol.h.

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

◆ CANCEL

constexpr std::uint8_t profinet::PNRPCHeader::CANCEL = 0x08
staticconstexpr

Packet type: CANCEL.

Definition at line 492 of file protocol.h.

◆ CANCEL_ACK

constexpr std::uint8_t profinet::PNRPCHeader::CANCEL_ACK = 0x0A
staticconstexpr

Packet type: CANCEL_ACK.

Definition at line 498 of file protocol.h.

◆ CONNECT

constexpr std::uint16_t profinet::PNRPCHeader::CONNECT = 0x00
staticconstexpr

Operation number: CONNECT.

Definition at line 501 of file protocol.h.

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

◆ CONTROL

constexpr std::uint16_t profinet::PNRPCHeader::CONTROL = 0x04
staticconstexpr

Operation number: CONTROL.

Definition at line 513 of file protocol.h.

Referenced by profinet::rpc::RPCCon::ApplicationReady(), and profinet::rpc::RPCCon::SendControl().

◆ dataRepresentation

std::array<std::uint8_t, 3> profinet::PNRPCHeader::dataRepresentation {}

Data representation format label.

Definition at line 533 of file protocol.h.

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

◆ FAULT

constexpr std::uint8_t profinet::PNRPCHeader::FAULT = 0x03
staticconstexpr

Packet type: FAULT.

Definition at line 477 of file protocol.h.

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

◆ flags1

std::uint8_t profinet::PNRPCHeader::flags1 = 0

Packet flags, first byte.

Definition at line 527 of file protocol.h.

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

◆ flags2

std::uint8_t profinet::PNRPCHeader::flags2 = 0

Packet flags, second byte.

Definition at line 530 of file protocol.h.

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

◆ FRAG_ACK

constexpr std::uint8_t profinet::PNRPCHeader::FRAG_ACK = 0x09
staticconstexpr

Packet type: FRAG_ACK.

Definition at line 495 of file protocol.h.

◆ fragmentNumber

std::uint16_t profinet::PNRPCHeader::fragmentNumber = 0

Fragment number for fragmented PDUs.

Definition at line 569 of file protocol.h.

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

◆ IMPLICIT_READ

constexpr std::uint16_t profinet::PNRPCHeader::IMPLICIT_READ = 0x05
staticconstexpr

Operation number: IMPLICIT_READ.

Definition at line 516 of file protocol.h.

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

◆ interfaceHint

std::uint16_t profinet::PNRPCHeader::interfaceHint = 0xFFFF

Interface hint (0xFFFF if unused).

Definition at line 560 of file protocol.h.

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

◆ interfaceUuid

std::array<std::uint8_t, uuidLenght> profinet::PNRPCHeader::interfaceUuid {}

Target interface UUID (identifies device/controller/supervisor role).

Definition at line 542 of file protocol.h.

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

◆ interfaceVersion

std::uint32_t profinet::PNRPCHeader::interfaceVersion = 1

Interface version.

Definition at line 551 of file protocol.h.

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

◆ kFixedSize

constexpr std::size_t profinet::PNRPCHeader::kFixedSize = 80
staticconstexpr

Size in bytes of the fixed portion of this header.

Definition at line 581 of file protocol.h.

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

◆ lengthOfBody

std::uint16_t profinet::PNRPCHeader::lengthOfBody = 0

Length in bytes of Payload.

Definition at line 566 of file protocol.h.

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

◆ objectUuid

std::array<std::uint8_t, uuidLenght> profinet::PNRPCHeader::objectUuid {}

Target object UUID.

Definition at line 539 of file protocol.h.

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

◆ operationNumber

std::uint16_t profinet::PNRPCHeader::operationNumber = 0

Operation number (CONNECT/RELEASE/READ/WRITE/CONTROL/IMPLICIT_READ).

Definition at line 557 of file protocol.h.

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

◆ packetType

std::uint8_t profinet::PNRPCHeader::packetType = 0

Packet type (REQUEST/RESPONSE/FAULT/...).

Definition at line 524 of file protocol.h.

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

◆ payload

◆ PING

constexpr std::uint8_t profinet::PNRPCHeader::PING = 0x01
staticconstexpr

Packet type: PING.

Definition at line 471 of file protocol.h.

◆ PONG

constexpr std::uint8_t profinet::PNRPCHeader::PONG = 0x05
staticconstexpr

Packet type: PONG.

Definition at line 483 of file protocol.h.

◆ READ

constexpr std::uint16_t profinet::PNRPCHeader::READ = 0x02
staticconstexpr

Operation number: READ.

Definition at line 507 of file protocol.h.

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

◆ REJECT

constexpr std::uint8_t profinet::PNRPCHeader::REJECT = 0x06
staticconstexpr

Packet type: REJECT.

Definition at line 486 of file protocol.h.

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

◆ RELEASE

constexpr std::uint16_t profinet::PNRPCHeader::RELEASE = 0x01
staticconstexpr

Operation number: RELEASE.

Definition at line 504 of file protocol.h.

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

◆ REQUEST

constexpr std::uint8_t profinet::PNRPCHeader::REQUEST = 0x00
staticconstexpr

◆ RESPONSE

constexpr std::uint8_t profinet::PNRPCHeader::RESPONSE = 0x02
staticconstexpr

Packet type: RESPONSE.

Definition at line 474 of file protocol.h.

Referenced by profinet::rpc::RPCCon::ApplicationReady(), and profinet::rpc::RPCCon::SendReceive().

◆ sequenceNumber

std::uint32_t profinet::PNRPCHeader::sequenceNumber = 0

Sequence number within the activity.

Definition at line 554 of file protocol.h.

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

◆ serialNrHigh

std::uint8_t profinet::PNRPCHeader::serialNrHigh = 0

High byte of the serial number.

Definition at line 536 of file protocol.h.

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

◆ serialNrLow

std::uint8_t profinet::PNRPCHeader::serialNrLow = 0

Low byte of the serial number.

Definition at line 575 of file protocol.h.

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

◆ serverBootTime

std::uint32_t profinet::PNRPCHeader::serverBootTime = 0

Server boot time counter.

Definition at line 548 of file protocol.h.

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

◆ version

std::uint8_t profinet::PNRPCHeader::version = 4

DCE/RPC version (always 4 for PROFINET).

Definition at line 521 of file protocol.h.

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

◆ WORKING

constexpr std::uint8_t profinet::PNRPCHeader::WORKING = 0x04
staticconstexpr

Packet type: WORKING.

Definition at line 480 of file protocol.h.

◆ WRITE

constexpr std::uint16_t profinet::PNRPCHeader::WRITE = 0x03
staticconstexpr

Operation number: WRITE.

Definition at line 510 of file protocol.h.

Referenced by profinet::rpc::RPCCon::Write(), and profinet::rpc::RPCCon::WriteMultiple().


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