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

Plain (untagged) Ethernet II frame header. More...

#include <protocol.h>

+ Collaboration diagram for profinet::EthernetHeader:

Public Member Functions

Bytes ToBytes () const
 Serialize this header and its payload back to raw frame bytes.
 

Static Public Member Functions

static EthernetHeader Parse (const Bytes &data)
 Parse an Ethernet header and payload from raw frame bytes.
 

Public Attributes

MacAddress dst {}
 Destination MAC address.
 
MacAddress src {}
 Source MAC address.
 
std::uint16_t type = 0
 EtherType field.
 
Bytes payload
 Frame payload following the header.
 

Detailed Description

Plain (untagged) Ethernet II frame header.

Definition at line 62 of file protocol.h.

Member Function Documentation

◆ Parse()

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

Parse an Ethernet header and payload from raw frame bytes.

Parameters
dataComplete frame bytes, starting at the destination MAC.
Returns
The parsed header.

Definition at line 79 of file protocol.h.

References dst, profinet::wire::Reader::Fixed(), profinet::macAddressLength, payload, profinet::wire::Reader::ReadBytes(), profinet::wire::Reader::Remaining(), src, type, and profinet::wire::Reader::U16().

Referenced by profinet::dcp::ParseSetResponse(), and profinet::dcp::RecvSetResponse().

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

◆ ToBytes()

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

Serialize this header and its payload back to raw frame bytes.

Returns
The encoded frame bytes.

Definition at line 97 of file protocol.h.

References dst, payload, profinet::wire::PutFixed(), profinet::wire::PutU16(), src, and type.

+ Here is the call graph for this function:

Member Data Documentation

◆ dst

MacAddress profinet::EthernetHeader::dst {}

Destination MAC address.

Definition at line 65 of file protocol.h.

Referenced by Parse(), profinet::dcp::ReadResponse(), profinet::dcp::RecvSetResponse(), and ToBytes().

◆ payload

Bytes profinet::EthernetHeader::payload

◆ src

MacAddress profinet::EthernetHeader::src {}

Source MAC address.

Definition at line 68 of file protocol.h.

Referenced by Parse(), profinet::dcp::ReadResponse(), profinet::dcp::ReceiveHello(), and ToBytes().

◆ type

std::uint16_t profinet::EthernetHeader::type = 0

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