PROFINET IO Controller Stack 1.0.0
Modern C++ implementation of a PROFINET IO Controller stack
Loading...
Searching...
No Matches
profinet::IRawEthernetSocket Class Referenceabstract

Abstract interface for raw Ethernet frame transport. More...

#include <IRawEthernetSocket.h>

+ Inheritance diagram for profinet::IRawEthernetSocket:
+ Collaboration diagram for profinet::IRawEthernetSocket:

Public Member Functions

virtual ~IRawEthernetSocket ()=default
 Virtual destructor for polymorphic use.
 
virtual void Send (const std::vector< std::uint8_t > &frame) const =0
 Send one complete raw Ethernet frame.
 
virtual std::vector< std::uint8_t > Recv () const =0
 Receive one raw Ethernet frame.
 
virtual void SetTimeout (std::chrono::milliseconds timeout) const =0
 Set the receive timeout.
 

Detailed Description

Abstract interface for raw Ethernet frame transport.

Provides the minimal transport functionality required by the PROFINET protocol layers.

Implementations are responsible for transmitting and receiving complete Ethernet frames. The protocol layer does not need to know whether the implementation uses Linux AF_PACKET, another operating-system mechanism, or an in-memory test implementation.

The interface operates on byte spans to avoid imposing ownership or allocation requirements on the transport layer.

Note
Implementations must not retain the span passed to Send() after the call returns unless explicitly documented by the implementation.

Definition at line 42 of file IRawEthernetSocket.h.

Constructor & Destructor Documentation

◆ ~IRawEthernetSocket()

virtual profinet::IRawEthernetSocket::~IRawEthernetSocket ( )
virtualdefault

Virtual destructor for polymorphic use.

Member Function Documentation

◆ Recv()

virtual std::vector< std::uint8_t > profinet::IRawEthernetSocket::Recv ( ) const
pure virtual

Receive one raw Ethernet frame.

Waits for and returns a complete Ethernet frame received from the underlying raw socket.

The returned frame starts at the first byte of the Ethernet header. VLAN tags, when present, remain part of the returned frame and are therefore available to the PROFINET parser.

Returns
Received Ethernet frame.
Exceptions
std::system_errorWhen the underlying socket reports a receive error.
Note
The exact blocking, timeout, and cancellation behavior is defined by the concrete implementation.

Implemented in profinet::EthernetSocket.

Referenced by profinet::dcp::RecvSetResponse().

+ Here is the caller graph for this function:

◆ Send()

virtual void profinet::IRawEthernetSocket::Send ( const std::vector< std::uint8_t > &  frame) const
pure virtual

Send one complete raw Ethernet frame.

Transmits the complete Ethernet frame supplied by the caller. The frame includes all Ethernet-level headers and protocol payload.

Depending on the caller, this may include:

  • Destination MAC address.
  • Source MAC address.
  • One or more VLAN tags.
  • Ethernet EtherType.
  • PROFINET RT or RTA payload.
Parameters
frameComplete Ethernet frame to transmit.
Exceptions
std::system_errorWhen the underlying socket reports a transmission error, if the concrete implementation uses exception-based error reporting.

Implemented in profinet::EthernetSocket.

◆ SetTimeout()

virtual void profinet::IRawEthernetSocket::SetTimeout ( std::chrono::milliseconds  timeout) const
pure virtual

Set the receive timeout.

Parameters
timeoutTimeout duration; a zero duration blocks forever.

Sets SO_RCVTIMEO. Marked const: this only changes a kernel-side socket option, not the object's own identity, which lets read-only call sites keep a const&.

Implemented in profinet::EthernetSocket.

Referenced by profinet::dcp::RecvSetResponse().

+ Here is the caller graph for this function:

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