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, uuidLenght > IfaceUuidDevice ()
 Interface UUID identifying the IO-Device role.
 
static std::array< std::uint8_t, uuidLenght > IfaceUuidController ()
 Interface UUID identifying the IO-Controller role.
 
static std::array< std::uint8_t, uuidLenght > IfaceUuidSupervisor ()
 Interface UUID identifying the IO-Supervisor role.
 
static std::array< std::uint8_t, uuidLenght > IfaceUuidParamserver ()
 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, uuidLenght > objectUuid {}
 Target object UUID.
 
std::array< std::uint8_t, uuidLenght > interfaceUuid {}
 Target interface UUID (identifies device/controller/supervisor role).
 
std::array< std::uint8_t, uuidLenght > activityUuid {}
 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::uint16_t defaultInterfaceHint = 0xFFFF
 
static constexpr std::uint16_t defaultActivityHint = 0xFFFF
 
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, uuidLenght > PrefixedUuid (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 859 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 990 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 983 of file protocol.h.

References PrefixedUuid().

Referenced by profinet::rpc::RPCCon::RPCCon(), profinet::sim::VirtualProfinetRpcDevice::SendApplicationReady(), TEST_F(), and profinet::rpc::TEST_F().

+ 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 1004 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 997 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 1012 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 TestRpcDevice::HandleRequest(), profinet::sim::VirtualProfinetRpcDevice::Run(), profinet::StubRpcTransport::SendReceive(), profinet::rpc::RPCCon::SendReceive(), profinet::CyclicCaptureTests::TEST(), profinet::CyclicCaptureTests::TEST(), profinet::CyclicCaptureTests::TEST(), profinet::TEST(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), 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:

◆ 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 1112 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 1045 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(), TestRpcDevice::HandleConnect(), profinet::sim::VirtualProfinetRpcDevice::SendApplicationReady(), profinet::rpc::RPCCon::SendControl(), TestRpcDevice::SendPacket(), profinet::StubRpcTransport::SendReceive(), profinet::rpc::RPCCon::SendReceive(), profinet::sim::VirtualProfinetRpcDevice::SendResponse(), and TestRpcDevice::SendRpcResponse().

+ 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 884 of file protocol.h.

◆ activityHint

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

Activity hint (0xFFFF if unused).

Definition at line 961 of file protocol.h.

Referenced by profinet::rpc::RPCCon::CreateRpc(), Parse(), profinet::sim::VirtualProfinetRpcDevice::SendApplicationReady(), TEST_F(), and ToBytes().

◆ activityUuid

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

◆ authenticationProtocol

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

Authentication protocol identifier (unused by PROFINET).

Definition at line 970 of file protocol.h.

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

◆ CANCEL

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

Packet type: CANCEL.

Definition at line 887 of file protocol.h.

◆ CANCEL_ACK

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

Packet type: CANCEL_ACK.

Definition at line 893 of file protocol.h.

◆ CONNECT

◆ CONTROL

◆ dataRepresentation

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

Data representation format label.

Definition at line 931 of file protocol.h.

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

◆ defaultActivityHint

◆ defaultInterfaceHint

constexpr std::uint16_t profinet::PNRPCHeader::defaultInterfaceHint = 0xFFFF
staticconstexpr

◆ FAULT

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

Packet type: FAULT.

Definition at line 872 of file protocol.h.

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

◆ flags1

◆ flags2

◆ FRAG_ACK

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

Packet type: FRAG_ACK.

Definition at line 890 of file protocol.h.

◆ fragmentNumber

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

Fragment number for fragmented PDUs.

Definition at line 967 of file protocol.h.

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

◆ IMPLICIT_READ

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

Operation number: IMPLICIT_READ.

Definition at line 911 of file protocol.h.

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

◆ interfaceHint

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

Interface hint (0xFFFF if unused).

Definition at line 958 of file protocol.h.

Referenced by profinet::rpc::RPCCon::CreateRpc(), Parse(), profinet::sim::VirtualProfinetRpcDevice::SendApplicationReady(), TEST_F(), and ToBytes().

◆ interfaceUuid

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

◆ interfaceVersion

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

◆ kFixedSize

◆ lengthOfBody

◆ objectUuid

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

◆ operationNumber

◆ packetType

◆ payload

◆ PING

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

Packet type: PING.

Definition at line 866 of file protocol.h.

◆ PONG

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

Packet type: PONG.

Definition at line 878 of file protocol.h.

◆ READ

◆ REJECT

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

Packet type: REJECT.

Definition at line 881 of file protocol.h.

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

◆ RELEASE

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

◆ REQUEST

◆ RESPONSE

◆ sequenceNumber

◆ serialNrHigh

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

High byte of the serial number.

Definition at line 934 of file protocol.h.

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

◆ serialNrLow

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

Low byte of the serial number.

Definition at line 973 of file protocol.h.

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

◆ serverBootTime

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

◆ version

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

◆ WORKING

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

Packet type: WORKING.

Definition at line 875 of file protocol.h.

◆ WRITE

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

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