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

Receive operation state shared by all asynchronous handlers. More...

+ Collaboration diagram for profinet::AsioEthernetSocket::EthernetPacketBackend::ReceiveOperation:

Public Types

enum class  State : std::uint8_t { Pending , Received , TimedOut , Failed }
 

Public Member Functions

 ReceiveOperation (asio::io_context &ioContext)
 Construct a receive operation with timers on the supplied context.
 

Public Attributes

std::atomic< State > state {State::Pending}
 Completion state shared between asynchronous handlers.
 
std::atomic< std::size_t > pendingHandlers {0U}
 Number of outstanding asynchronous handlers.
 
std::promise< std::vector< std::uint8_t > > completion
 Wait used by the synchronous Recv() API.
 
std::vector< std::uint8_t > frame
 Frame received by the packet handler.
 
std::exception_ptr error
 Exception produced by a failed receive.
 
std::mutex resultMutex
 Protects frame and error completion data.
 
asio::steady_timer timeoutTimer
 Application-level receive timeout.
 
asio::steady_timer pollTimer
 Polling fallback timer for non-selectable packet sources.
 

Detailed Description

Receive operation state shared by all asynchronous handlers.

The operation state is heap-owned so no Asio callback ever references stack-local state belonging to Recv().

Definition at line 100 of file ethernetPacketBackend.h.

Member Enumeration Documentation

◆ State

Enumerator
Pending 
Received 
TimedOut 
Failed 

Definition at line 102 of file ethernetPacketBackend.h.

Constructor & Destructor Documentation

◆ ReceiveOperation()

profinet::AsioEthernetSocket::EthernetPacketBackend::ReceiveOperation::ReceiveOperation ( asio::io_context &  ioContext)
inlineexplicit

Construct a receive operation with timers on the supplied context.

Parameters
ioContextAsio execution context.

Definition at line 112 of file ethernetPacketBackend.h.

Member Data Documentation

◆ completion

std::promise<std::vector<std::uint8_t> > profinet::AsioEthernetSocket::EthernetPacketBackend::ReceiveOperation::completion

Wait used by the synchronous Recv() API.

Definition at line 124 of file ethernetPacketBackend.h.

◆ error

std::exception_ptr profinet::AsioEthernetSocket::EthernetPacketBackend::ReceiveOperation::error

Exception produced by a failed receive.

Definition at line 130 of file ethernetPacketBackend.h.

◆ frame

std::vector<std::uint8_t> profinet::AsioEthernetSocket::EthernetPacketBackend::ReceiveOperation::frame

Frame received by the packet handler.

Definition at line 127 of file ethernetPacketBackend.h.

◆ pendingHandlers

std::atomic<std::size_t> profinet::AsioEthernetSocket::EthernetPacketBackend::ReceiveOperation::pendingHandlers {0U}

Number of outstanding asynchronous handlers.

Definition at line 121 of file ethernetPacketBackend.h.

◆ pollTimer

asio::steady_timer profinet::AsioEthernetSocket::EthernetPacketBackend::ReceiveOperation::pollTimer

Polling fallback timer for non-selectable packet sources.

Definition at line 139 of file ethernetPacketBackend.h.

◆ resultMutex

std::mutex profinet::AsioEthernetSocket::EthernetPacketBackend::ReceiveOperation::resultMutex

Protects frame and error completion data.

Definition at line 133 of file ethernetPacketBackend.h.

◆ state

std::atomic<State> profinet::AsioEthernetSocket::EthernetPacketBackend::ReceiveOperation::state {State::Pending}

Completion state shared between asynchronous handlers.

Definition at line 118 of file ethernetPacketBackend.h.

◆ timeoutTimer

asio::steady_timer profinet::AsioEthernetSocket::EthernetPacketBackend::ReceiveOperation::timeoutTimer

Application-level receive timeout.

Definition at line 136 of file ethernetPacketBackend.h.


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