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

RTA-PDU Header - Real-Time Acyclic PDU for Layer 2 alarm transport. More...

#include <protocol.h>

+ Collaboration diagram for profinet::PNRTAHeader:

Public Member Functions

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

Static Public Member Functions

static PNRTAHeader Parse (const Bytes &data)
 Parse an RTA header and variable part from raw bytes.
 

Public Attributes

std::uint16_t alarmDstEndpoint = 0
 Destination alarm endpoint (AlarmCR reference on the receiver).
 
std::uint16_t alarmSrcEndpoint = 0
 Source alarm endpoint (AlarmCR reference on the sender).
 
std::uint8_t pduType = 0
 PDU type and protocol version, packed as type(bits 4-7) + version(bits 0-3).
 
std::uint8_t addFlags = 0
 Additional flags (window size, TACK flag).
 
std::uint16_t sendSeqNum = 0
 Sender's sequence number for this PDU.
 
std::uint16_t ackSeqNum = 0
 Sequence number being acknowledged.
 
std::uint16_t variablePartLenght = 0
 Length in bytes of the variable part (Payload).
 
Bytes payload
 RTA variable part (e.g. an AlarmNotification-PDU or AlarmAck-PDU).
 

Static Public Attributes

static constexpr std::uint8_t RTA_TYPE_DATA = 0x01
 PDU type: DATA.
 
static constexpr std::uint8_t RTA_TYPE_NACK = 0x02
 PDU type: NACK.
 
static constexpr std::uint8_t RTA_TYPE_ACK = 0x03
 PDU type: ACK.
 
static constexpr std::uint8_t RTA_TYPE_ERR = 0x04
 PDU type: ERR.
 
static constexpr std::uint8_t VERSION_1 = 0x01
 RTA protocol version 1.
 
static constexpr std::uint8_t VERSION_2 = 0x02
 RTA protocol version 2.
 
static constexpr std::uint8_t ADD_FLAGS_WINDOW_1 = 0x01
 RTA AddFlags bits: window size in bits 0-3.
 
static constexpr std::uint8_t ADD_FLAGS_TACK = 0x10
 TACK(transport ack request) in bit 4(IEC 61158-6-10; cf. p-net pf_put_alarm_fixed)
 
static constexpr std::size_t kFixedSize = 12
 Size in bytes of the fixed portion of this header.
 

Detailed Description

RTA-PDU Header - Real-Time Acyclic PDU for Layer 2 alarm transport.

Definition at line 2389 of file protocol.h.

Member Function Documentation

◆ Parse()

static PNRTAHeader profinet::PNRTAHeader::Parse ( const Bytes &  data)
inlinestatic

Parse an RTA header and variable part from raw bytes.

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

Definition at line 2448 of file protocol.h.

References ackSeqNum, addFlags, alarmDstEndpoint, alarmSrcEndpoint, kFixedSize, payload, pduType, profinet::wire::Reader::ReadBytes(), profinet::wire::Reader::Remaining(), sendSeqNum, profinet::wire::Reader::U16(), profinet::wire::Reader::U8(), and variablePartLenght.

Referenced by profinet::ParseRtaError(), and profinet::AlarmListener::ProcessAlarm().

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

◆ ToBytes()

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

Serialize this header and variable part back to raw bytes.

Returns
The encoded bytes.

Definition at line 2469 of file protocol.h.

References ackSeqNum, addFlags, alarmDstEndpoint, alarmSrcEndpoint, payload, pduType, profinet::wire::PutU16(), profinet::wire::PutU8(), sendSeqNum, and variablePartLenght.

Referenced by profinet::AlarmListener::SendRtaFrame(), and TEST_F().

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

Member Data Documentation

◆ ackSeqNum

std::uint16_t profinet::PNRTAHeader::ackSeqNum = 0

Sequence number being acknowledged.

Definition at line 2434 of file protocol.h.

Referenced by Parse(), profinet::AlarmListener::SendRtaFrame(), and ToBytes().

◆ ADD_FLAGS_TACK

constexpr std::uint8_t profinet::PNRTAHeader::ADD_FLAGS_TACK = 0x10
staticconstexpr

TACK(transport ack request) in bit 4(IEC 61158-6-10; cf. p-net pf_put_alarm_fixed)

Definition at line 2414 of file protocol.h.

Referenced by profinet::AlarmListener::ProcessAlarm(), and profinet::AlarmListener::SendLayer2Ack().

◆ ADD_FLAGS_WINDOW_1

constexpr std::uint8_t profinet::PNRTAHeader::ADD_FLAGS_WINDOW_1 = 0x01
staticconstexpr

RTA AddFlags bits: window size in bits 0-3.

Definition at line 2411 of file protocol.h.

Referenced by profinet::AlarmListener::SendLayer2Ack(), profinet::AlarmListener::SendNack(), and profinet::AlarmListener::SendTransportAck().

◆ addFlags

std::uint8_t profinet::PNRTAHeader::addFlags = 0

Additional flags (window size, TACK flag).

Definition at line 2428 of file protocol.h.

Referenced by Parse(), profinet::AlarmListener::ProcessAlarm(), profinet::AlarmListener::SendRtaFrame(), and ToBytes().

◆ alarmDstEndpoint

std::uint16_t profinet::PNRTAHeader::alarmDstEndpoint = 0

Destination alarm endpoint (AlarmCR reference on the receiver).

Definition at line 2419 of file protocol.h.

Referenced by Parse(), profinet::AlarmListener::ProcessAlarm(), profinet::AlarmListener::SendRtaFrame(), and ToBytes().

◆ alarmSrcEndpoint

std::uint16_t profinet::PNRTAHeader::alarmSrcEndpoint = 0

Source alarm endpoint (AlarmCR reference on the sender).

Definition at line 2422 of file protocol.h.

Referenced by Parse(), profinet::AlarmListener::SendRtaFrame(), and ToBytes().

◆ kFixedSize

constexpr std::size_t profinet::PNRTAHeader::kFixedSize = 12
staticconstexpr

Size in bytes of the fixed portion of this header.

Definition at line 2443 of file protocol.h.

Referenced by Parse(), and TEST_F().

◆ payload

Bytes profinet::PNRTAHeader::payload

RTA variable part (e.g. an AlarmNotification-PDU or AlarmAck-PDU).

Definition at line 2440 of file protocol.h.

Referenced by Parse(), profinet::ParseRtaError(), profinet::TEST_F(), profinet::TEST_F(), profinet::TEST_F(), profinet::TEST_P(), and ToBytes().

◆ pduType

std::uint8_t profinet::PNRTAHeader::pduType = 0

PDU type and protocol version, packed as type(bits 4-7) + version(bits 0-3).

Definition at line 2425 of file protocol.h.

Referenced by Parse(), profinet::ParseRtaError(), profinet::AlarmListener::ProcessAlarm(), profinet::AlarmListener::SendRtaFrame(), profinet::TEST_F(), profinet::TEST_F(), profinet::TEST_F(), profinet::TEST_P(), and ToBytes().

◆ RTA_TYPE_ACK

constexpr std::uint8_t profinet::PNRTAHeader::RTA_TYPE_ACK = 0x03
staticconstexpr

PDU type: ACK.

Definition at line 2399 of file protocol.h.

Referenced by profinet::AlarmListener::SendTransportAck().

◆ RTA_TYPE_DATA

constexpr std::uint8_t profinet::PNRTAHeader::RTA_TYPE_DATA = 0x01
staticconstexpr

PDU type: DATA.

Definition at line 2393 of file protocol.h.

Referenced by profinet::AlarmListener::SendLayer2Ack(), and profinet::TEST_F().

◆ RTA_TYPE_ERR

constexpr std::uint8_t profinet::PNRTAHeader::RTA_TYPE_ERR = 0x04
staticconstexpr

PDU type: ERR.

Definition at line 2402 of file protocol.h.

Referenced by profinet::ParseRtaError(), profinet::TEST_F(), profinet::TEST_F(), and profinet::TEST_P().

◆ RTA_TYPE_NACK

constexpr std::uint8_t profinet::PNRTAHeader::RTA_TYPE_NACK = 0x02
staticconstexpr

PDU type: NACK.

Definition at line 2396 of file protocol.h.

Referenced by profinet::AlarmListener::SendNack().

◆ sendSeqNum

std::uint16_t profinet::PNRTAHeader::sendSeqNum = 0

Sender's sequence number for this PDU.

Definition at line 2431 of file protocol.h.

Referenced by Parse(), profinet::AlarmListener::ProcessAlarm(), profinet::AlarmListener::SendRtaFrame(), and ToBytes().

◆ variablePartLenght

std::uint16_t profinet::PNRTAHeader::variablePartLenght = 0

Length in bytes of the variable part (Payload).

Definition at line 2437 of file protocol.h.

Referenced by Parse(), profinet::ParseRtaError(), profinet::AlarmListener::SendRtaFrame(), profinet::TEST_F(), profinet::TEST_F(), profinet::TEST_F(), profinet::TEST_P(), and ToBytes().

◆ VERSION_1

constexpr std::uint8_t profinet::PNRTAHeader::VERSION_1 = 0x01
staticconstexpr

◆ VERSION_2

constexpr std::uint8_t profinet::PNRTAHeader::VERSION_2 = 0x02
staticconstexpr

RTA protocol version 2.

Definition at line 2408 of file protocol.h.


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