PROFINET IO Controller Stack 1.0.0
Modern C++ implementation of a PROFINET IO Controller stack
Loading...
Searching...
No Matches
profinet::cyclic::test::BlockingRawEthernetSocket Class Referencefinal

#include <cyclic_raw_ethernet_socket_stub.h>

+ Inheritance diagram for profinet::cyclic::test::BlockingRawEthernetSocket:
+ Collaboration diagram for profinet::cyclic::test::BlockingRawEthernetSocket:

Public Member Functions

void Send (const Bytes &frame) override
 Send one complete raw Ethernet frame.
 
Bytes Recv () override
 Receive one raw Ethernet frame.
 
void SetTimeout (std::chrono::milliseconds timeout) override
 Set the receive timeout.
 
void BlockReceive ()
 
void ReleaseReceive ()
 
void WaitUntilReceiveEntered ()
 
- Public Member Functions inherited from profinet::IRawEthernetSocket
virtual ~IRawEthernetSocket ()=default
 Virtual destructor for polymorphic use.
 

Private Attributes

std::mutex mutex
 
std::condition_variable receiveCv
 
std::condition_variable receiveEnteredCv
 
bool receiveEntered {false}
 
bool receiveReleased {false}
 

Detailed Description

Definition at line 184 of file cyclic_raw_ethernet_socket_stub.h.

Member Function Documentation

◆ BlockReceive()

void profinet::cyclic::test::BlockingRawEthernetSocket::BlockReceive ( )
inline

Definition at line 202 of file cyclic_raw_ethernet_socket_stub.h.

References mutex, receiveCv, receiveEntered, receiveEnteredCv, and receiveReleased.

Referenced by Recv().

+ Here is the caller graph for this function:

◆ Recv()

Bytes profinet::cyclic::test::BlockingRawEthernetSocket::Recv ( )
inlineoverridevirtual

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.

Implements profinet::IRawEthernetSocket.

Definition at line 191 of file cyclic_raw_ethernet_socket_stub.h.

References BlockReceive().

+ Here is the call graph for this function:

◆ ReleaseReceive()

void profinet::cyclic::test::BlockingRawEthernetSocket::ReleaseReceive ( )
inline

Definition at line 214 of file cyclic_raw_ethernet_socket_stub.h.

References mutex, receiveCv, and receiveReleased.

◆ Send()

void profinet::cyclic::test::BlockingRawEthernetSocket::Send ( const Bytes &  frame)
inlineoverridevirtual

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.

Implements profinet::IRawEthernetSocket.

Definition at line 187 of file cyclic_raw_ethernet_socket_stub.h.

◆ SetTimeout()

void profinet::cyclic::test::BlockingRawEthernetSocket::SetTimeout ( std::chrono::milliseconds  timeout)
inlineoverridevirtual

Set the receive timeout.

Parameters
timeoutMaximum time that Recv() waits for a matching frame. Zero means wait indefinitely.

The timeout is an abstraction-level receive timeout. The concrete transport is responsible for implementing the timeout using its underlying packet-access mechanism.

Implements profinet::IRawEthernetSocket.

Definition at line 198 of file cyclic_raw_ethernet_socket_stub.h.

◆ WaitUntilReceiveEntered()

void profinet::cyclic::test::BlockingRawEthernetSocket::WaitUntilReceiveEntered ( )
inline

Definition at line 224 of file cyclic_raw_ethernet_socket_stub.h.

References mutex, receiveEntered, and receiveEnteredCv.

Member Data Documentation

◆ mutex

std::mutex profinet::cyclic::test::BlockingRawEthernetSocket::mutex
private

◆ receiveCv

std::condition_variable profinet::cyclic::test::BlockingRawEthernetSocket::receiveCv
private

Definition at line 240 of file cyclic_raw_ethernet_socket_stub.h.

Referenced by BlockReceive(), and ReleaseReceive().

◆ receiveEntered

bool profinet::cyclic::test::BlockingRawEthernetSocket::receiveEntered {false}
private

Definition at line 243 of file cyclic_raw_ethernet_socket_stub.h.

Referenced by BlockReceive(), and WaitUntilReceiveEntered().

◆ receiveEnteredCv

std::condition_variable profinet::cyclic::test::BlockingRawEthernetSocket::receiveEnteredCv
private

Definition at line 241 of file cyclic_raw_ethernet_socket_stub.h.

Referenced by BlockReceive(), and WaitUntilReceiveEntered().

◆ receiveReleased

bool profinet::cyclic::test::BlockingRawEthernetSocket::receiveReleased {false}
private

Definition at line 244 of file cyclic_raw_ethernet_socket_stub.h.

Referenced by BlockReceive(), and ReleaseReceive().


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