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

Classes

struct  RawRpcHeader
 DREP-aware fields we need out of a raw incoming RPC request; PROFINET block payloads inside the NRD body are always big-endian regardless of DREP, but the RPC/NRD header fields follow the DREP byte order. More...
 

Enumerations

enum class  Flags1 : std::uint8_t {
  None = 0x00 , Reserved1 = 1 << 7 , Broadcast = 1 << 6 , Idempotent = 1 << 5 ,
  Maybe = 1 << 4 , NoFack = 1 << 3 , Fragment = 1 << 2 , LastFragment = 1 << 1 ,
  Reserved0 = 1 << 0
}
 Represents bitwise flags for Application Ready Response header options (byte 1). More...
 

Functions

constexpr Flags1 operator| (Flags1 lhs, Flags1 rhs) noexcept
 Bitwise OR operator for combining two ApplicationReadyResponseFlags1 values.
 
constexpr Flags1 operator& (Flags1 lhs, Flags1 rhs) noexcept
 Bitwise AND operator for intersecting two ApplicationReadyResponseFlags1 values.
 
constexpr std::uint8_t operator& (std::uint8_t lhs, Flags1 rhs) noexcept
 Bitwise AND between a raw integer byte and an ApplicationReadyResponseFlags1 value.
 
constexpr std::uint8_t operator& (Flags1 lhs, std::uint8_t rhs) noexcept
 Bitwise AND between an ApplicationReadyResponseFlags1 value and a raw integer byte.
 
constexpr std::uint8_t operator| (std::uint8_t lhs, Flags1 rhs) noexcept
 Bitwise OR between a raw integer byte and an ApplicationReadyResponseFlags1 value.
 
constexpr std::uint8_t operator| (Flags1 lhs, std::uint8_t rhs) noexcept
 Bitwise OR between an ApplicationReadyResponseFlags1 value and a raw integer byte.
 
constexpr bool HasFlag (Flags1 flags, Flags1 test) noexcept
 Checks if all flag bits in 'test' are set within 'flags'.
 
constexpr bool HasFlag (std::uint8_t flags, Flags1 test) noexcept
 Checks if all flag bits in 'test' are set within raw integer byte 'flags'.
 
constexpr bool HasFlag (Flags1 flags, std::uint8_t test) noexcept
 Checks if all flag bits in raw integer byte 'test' are set within enum 'flags'.
 
std::optional< RawRpcHeader > ParseRawRpcHeader (const Bytes &data)
 Parses a raw network byte vector into a structured DCE/RPC v4 Connectionless Header.
 

Enumeration Type Documentation

◆ Flags1

enum class profinet::rpc::raw::Flags1 : std::uint8_t
strong

Represents bitwise flags for Application Ready Response header options (byte 1).

Enumerator
None 

No flags set.

Reserved1 

Bit 7 (0x80): Reserved for implementation.

Broadcast 

Bit 6 (0x40): Packet was sent as a broadcast.

Idempotent 

Bit 5 (0x20): Activity call is idempotent (safe to retry).

Maybe 

Bit 4 (0x10): No response or acknowledgment expected from server.

NoFack 

Bit 3 (0x08): Do not send FACK (fragment acknowledgment) frames.

Fragment 

Bit 2 (0x04): Packet is a fragment of a larger body.

LastFragment 

Bit 1 (0x02): Final fragment in the sequence.

Reserved0 

Bit 0 (0x01): Reserved for implementation.

Definition at line 195 of file rpcTypes.h.

Function Documentation

◆ HasFlag() [1/3]

constexpr bool profinet::rpc::raw::HasFlag ( Flags1  flags,
Flags1  test 
)
constexprnoexcept

Checks if all flag bits in 'test' are set within 'flags'.

Parameters
flagsThe flag mask to inspect.
testThe flag bit(s) to test for.
Returns
True if all bits specified in 'test' are set in 'flags', false otherwise.

Definition at line 283 of file rpcTypes.h.

◆ HasFlag() [2/3]

constexpr bool profinet::rpc::raw::HasFlag ( Flags1  flags,
std::uint8_t  test 
)
constexprnoexcept

Checks if all flag bits in raw integer byte 'test' are set within enum 'flags'.

Parameters
flagsThe enum flag mask to inspect.
testThe raw integer bit(s) to test for.
Returns
True if all bits specified in 'test' are set in 'flags', false otherwise.

Definition at line 302 of file rpcTypes.h.

◆ HasFlag() [3/3]

constexpr bool profinet::rpc::raw::HasFlag ( std::uint8_t  flags,
Flags1  test 
)
constexprnoexcept

Checks if all flag bits in 'test' are set within raw integer byte 'flags'.

Parameters
flagsThe raw integer byte to inspect.
testThe enum flag bit(s) to test for.
Returns
True if all bits specified in 'test' are set in 'flags', false otherwise.

Definition at line 292 of file rpcTypes.h.

◆ operator&() [1/3]

constexpr Flags1 profinet::rpc::raw::operator& ( Flags1  lhs,
Flags1  rhs 
)
constexprnoexcept

Bitwise AND operator for intersecting two ApplicationReadyResponseFlags1 values.

Parameters
lhsLeft-hand operand.
rhsRight-hand operand.
Returns
Intersected ApplicationReadyResponseFlags1 flags.

Definition at line 238 of file rpcTypes.h.

◆ operator&() [2/3]

constexpr std::uint8_t profinet::rpc::raw::operator& ( Flags1  lhs,
std::uint8_t  rhs 
)
constexprnoexcept

Bitwise AND between an ApplicationReadyResponseFlags1 value and a raw integer byte.

Parameters
lhsEnum flag to test or extract.
rhsRaw integer byte.
Returns
Masked raw integer result.

Definition at line 256 of file rpcTypes.h.

◆ operator&() [3/3]

constexpr std::uint8_t profinet::rpc::raw::operator& ( std::uint8_t  lhs,
Flags1  rhs 
)
constexprnoexcept

Bitwise AND between a raw integer byte and an ApplicationReadyResponseFlags1 value.

Parameters
lhsRaw integer byte.
rhsEnum flag to test or extract.
Returns
Masked raw integer result.

Definition at line 247 of file rpcTypes.h.

◆ operator|() [1/3]

constexpr Flags1 profinet::rpc::raw::operator| ( Flags1  lhs,
Flags1  rhs 
)
constexprnoexcept

Bitwise OR operator for combining two ApplicationReadyResponseFlags1 values.

Parameters
lhsLeft-hand operand.
rhsRight-hand operand.
Returns
Combined ApplicationReadyResponseFlags1 flags.

Definition at line 229 of file rpcTypes.h.

◆ operator|() [2/3]

constexpr std::uint8_t profinet::rpc::raw::operator| ( Flags1  lhs,
std::uint8_t  rhs 
)
constexprnoexcept

Bitwise OR between an ApplicationReadyResponseFlags1 value and a raw integer byte.

Parameters
lhsEnum flag to apply.
rhsRaw integer byte.
Returns
Updated raw integer value with the bit set.

Definition at line 274 of file rpcTypes.h.

◆ operator|() [3/3]

constexpr std::uint8_t profinet::rpc::raw::operator| ( std::uint8_t  lhs,
Flags1  rhs 
)
constexprnoexcept

Bitwise OR between a raw integer byte and an ApplicationReadyResponseFlags1 value.

Parameters
lhsRaw integer byte.
rhsEnum flag to apply.
Returns
Updated raw integer value with the bit set.

Definition at line 265 of file rpcTypes.h.

◆ ParseRawRpcHeader()

std::optional< RawRpcHeader > profinet::rpc::raw::ParseRawRpcHeader ( const Bytes &  data)

Parses a raw network byte vector into a structured DCE/RPC v4 Connectionless Header.

This function extracts the fixed-size 80-byte header from the incoming PROFINET acyclic data stream. It evaluates the DREP (Data Representation) fields to determine the payload's endianness and processes multi-byte numeric fields using safe, endian-aware lambdas.

DCE/RPC v4 Specification Offset Reference

Offset (Dec) Offset (Hex) Field Name Size (Bytes) Description / Parsing Logic
0 0x00 rpc_vers 1 Protocol Version (0x04)
1 0x01 ptype 1 Packet Type (0x00 = Req, 0x02 = Resp)
2 0x02 flags1 1 First flags group
3 0x03 flags2 1 Second flags group
4 0x04 drep 3 Data Representation (drep[0] defines Endianness)
7 0x07 serial_hi 1 Split tracking sequence byte (High)
8 0x08 object 16 Object UUID (DREP-aware)
24 0x18 if_id 16 Interface UUID (DREP-aware)
40 0x28 act_id 16 Activity UUID (DREP-aware)
56 0x38 server_boot 4 Server Boot Time (DREP-aware, skipped here)
60 0x3C if_vers 4 Interface Version (DREP-aware)
64 0x40 seqnum 4 Sequence Number (DREP-aware)
68 0x44 opnum 2 Operation Number (DREP-aware)
70–77 0x46–0x4D Hint/Len/Frag 8 Internal routing data (skipped here)
78 0x4E auth_proto 1 Authentication Protocol ID
79 0x4F serial_lo 1 Split tracking sequence byte (Low)
Parameters
dataThe raw incoming byte stream containing the RPC packet frame.
Returns
std::optional<RawRpcHeader> A populated structural header if the input size is valid; otherwise std::nullopt if the buffer underflows PNRPCHeader::kFixedSize.

Definition at line 1858 of file rpc.cpp.

References profinet::rpc::raw::RawRpcHeader::activityUuid, profinet::rpc::raw::RawRpcHeader::drep, profinet::wire::Reader::Fixed(), profinet::rpc::raw::RawRpcHeader::flags1, profinet::rpc::raw::RawRpcHeader::flags2, profinet::rpc::raw::RawRpcHeader::interfaceUuid, profinet::rpc::raw::RawRpcHeader::interfaceVersion, profinet::rpc::raw::RawRpcHeader::isLittleEndian, profinet::PNRPCHeader::kFixedSize, profinet::rpc::raw::RawRpcHeader::kLittleEndianDrepFlag, profinet::rpc::raw::RawRpcHeader::objectUuid, profinet::rpc::raw::RawRpcHeader::operationNumber, profinet::rpc::raw::RawRpcHeader::packetType, profinet::rpc::raw::RawRpcHeader::payload, profinet::rpc::raw::RawRpcHeader::sequenceNumber, profinet::rpc::raw::RawRpcHeader::serialHigh, profinet::rpc::raw::RawRpcHeader::serialLow, profinet::wire::Reader::SkipTo(), profinet::wire::Reader::U16(), profinet::wire::Reader::U16LittleEndian(), profinet::wire::Reader::U32(), profinet::wire::Reader::U32LittleEndian(), profinet::wire::Reader::U8(), profinet::uuidLenght, and profinet::rpc::raw::RawRpcHeader::version.

Referenced by profinet::rpc::RPCCon::ApplicationReady(), profinet::rpc::RPCCon::Connect(), 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: