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

DCP request block: Option(1) + SubOption(1) + Length(2) + payload(Length). More...

#include <protocol.h>

+ Collaboration diagram for profinet::PNDCPBlockRequest:

Public Member Functions

Bytes ToBytes () const
 Serialize this block back to raw bytes.
 
IPConfiguration ParseIp () const
 Interpret this block's payload as an IP configuration triple.
 

Static Public Member Functions

static PNDCPBlockRequest Parse (const Bytes &data)
 Parse a DCP request block from raw bytes.
 

Public Attributes

std::uint8_t option = 0
 DCP option code.
 
std::uint8_t suboption = 0
 DCP suboption code.
 
std::uint16_t length = 0
 Length in bytes of Payload.
 
Bytes payload
 Block payload.
 

Static Public Attributes

static constexpr std::size_t kFixedSize = 4
 Size in bytes of the fixed portion of this block.
 

Detailed Description

DCP request block: Option(1) + SubOption(1) + Length(2) + payload(Length).

Definition at line 270 of file protocol.h.

Member Function Documentation

◆ Parse()

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

Parse a DCP request block from raw bytes.

Parameters
dataBytes starting at the Option field.
Returns
The parsed block.

Definition at line 290 of file protocol.h.

References kFixedSize, length, option, payload, profinet::wire::Reader::ReadBytes(), profinet::wire::Reader::Remaining(), suboption, profinet::wire::Reader::U16(), and profinet::wire::Reader::U8().

+ Here is the call graph for this function:

◆ ParseIp()

IPConfiguration profinet::PNDCPBlockRequest::ParseIp ( ) const
inline

Interpret this block's payload as an IP configuration triple.

Returns
The decoded address/netmask/gateway.

Throws std::runtime_error if the payload is shorter than 12 bytes.

Definition at line 321 of file protocol.h.

References payload, and profinet::String2Ip().

+ Here is the call graph for this function:

◆ ToBytes()

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

Serialize this block back to raw bytes.

Returns
The encoded bytes.

Definition at line 308 of file protocol.h.

References length, option, payload, profinet::wire::PutU16(), profinet::wire::PutU8(), and suboption.

Referenced by profinet::dcp::BuildDcpSignalRequest(), profinet::dcp::BuildSetParamRequest(), profinet::dcp::GetParam(), profinet::dcp::ResetToFactory(), profinet::dcp::SendDiscover(), profinet::dcp::SendHello(), profinet::dcp::SendRequest(), and profinet::dcp::SetIp().

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

Member Data Documentation

◆ kFixedSize

constexpr std::size_t profinet::PNDCPBlockRequest::kFixedSize = 4
staticconstexpr

Size in bytes of the fixed portion of this block.

Definition at line 285 of file protocol.h.

Referenced by Parse().

◆ length

◆ option

◆ payload

◆ suboption


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