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 1903 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 1962 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::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 1983 of file protocol.h.

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

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

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

Referenced by Parse(), profinet::AlarmListener::SendLayer2Ack(), 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 1928 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 1925 of file protocol.h.

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

◆ addFlags

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

Additional flags (window size, TACK flag).

Definition at line 1942 of file protocol.h.

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

◆ alarmDstEndpoint

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

Destination alarm endpoint (AlarmCR reference on the receiver).

Definition at line 1933 of file protocol.h.

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

◆ alarmSrcEndpoint

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

Source alarm endpoint (AlarmCR reference on the sender).

Definition at line 1936 of file protocol.h.

Referenced by Parse(), profinet::AlarmListener::SendLayer2Ack(), 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 1957 of file protocol.h.

Referenced by Parse().

◆ payload

Bytes profinet::PNRTAHeader::payload

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

Definition at line 1954 of file protocol.h.

Referenced by Parse(), 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 1939 of file protocol.h.

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

◆ RTA_TYPE_ACK

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

PDU type: ACK.

Definition at line 1913 of file protocol.h.

◆ RTA_TYPE_DATA

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

PDU type: DATA.

Definition at line 1907 of file protocol.h.

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

◆ RTA_TYPE_ERR

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

PDU type: ERR.

Definition at line 1916 of file protocol.h.

◆ RTA_TYPE_NACK

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

PDU type: NACK.

Definition at line 1910 of file protocol.h.

◆ sendSeqNum

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

Sender's sequence number for this PDU.

Definition at line 1945 of file protocol.h.

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

◆ variablePartLenght

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

Length in bytes of the variable part (Payload).

Definition at line 1951 of file protocol.h.

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

◆ VERSION_1

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

RTA protocol version 1.

Definition at line 1919 of file protocol.h.

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

◆ VERSION_2

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

RTA protocol version 2.

Definition at line 1922 of file protocol.h.


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