|
PROFINET IO Controller Stack 1.0.0
Modern C++ implementation of a PROFINET IO Controller stack
|
Platform-independent raw Ethernet transport using Asio. More...
#include <asioEthernetSocket.h>
Inheritance diagram for profinet::AsioEthernetSocket:
Collaboration diagram for profinet::AsioEthernetSocket:Classes | |
| class | EthernetPacketBackend |
| Private packet-capture backend for complete Ethernet frames. More... | |
Public Member Functions | |
| AsioEthernetSocket (asio::io_context &ioContext, const std::string &interface, std::uint16_t ethertype=0) | |
| Construct an Ethernet transport for a network interface. | |
| ~AsioEthernetSocket () override | |
| Destroy the Ethernet transport. | |
| AsioEthernetSocket (const AsioEthernetSocket &)=delete | |
| AsioEthernetSocket & | operator= (const AsioEthernetSocket &)=delete |
| AsioEthernetSocket (AsioEthernetSocket &&)=delete | |
| AsioEthernetSocket & | operator= (AsioEthernetSocket &&)=delete |
| void | Send (const std::vector< std::uint8_t > &frame) override |
| Send one complete Ethernet frame. | |
| void | SetTimeout (std::chrono::milliseconds timeout) override |
| Set the receive timeout. | |
| std::vector< std::uint8_t > | Recv () override |
| Receive one complete Ethernet frame. | |
Public Member Functions inherited from profinet::IRawEthernetSocket | |
| virtual | ~IRawEthernetSocket ()=default |
| Virtual destructor for polymorphic use. | |
Private Attributes | |
| asio::io_context & | ioContext |
| Asio execution context supplied by the caller. | |
| std::unique_ptr< EthernetPacketBackend > | backend |
| Platform packet-access implementation. | |
Friends | |
| class | EthernetPacketBackendTestFixture |
| Grants backend tests access to the private packet backend. | |
Platform-independent raw Ethernet transport using Asio.
Provides complete Ethernet frame transmission and reception while hiding the operating-system packet capture mechanism from the rest of the PROFINET stack.
The implementation uses an internal EthernetPacketBackend. Asio remains responsible for asynchronous execution and receive readiness, while the backend handles platform-specific Ethernet packet access.
Protocol components must use IRawEthernetSocket and must not depend on EthernetPacketBackend or any operating-system networking API.
Architecture flow for packet capture backends.
Definition at line 48 of file asioEthernetSocket.h.
| profinet::AsioEthernetSocket::AsioEthernetSocket | ( | asio::io_context & | ioContext, |
| const std::string & | interface, | ||
| std::uint16_t | ethertype = 0 |
||
| ) |
Construct an Ethernet transport for a network interface.
| ioContext | Asio execution context used for receive readiness. |
| interface | Network interface name or packet-capture device name. |
| ethertype | Optional EtherType filter. Zero accepts all Ethernet frame types and filtering is then performed by the backend. |
| SocketError | When the interface cannot be opened. |
| PermissionDeniedError | When packet access is denied. |
Definition at line 10 of file asioEthernetSocket.cpp.
|
overridedefault |
Destroy the Ethernet transport.
|
delete |
|
delete |
|
delete |
|
delete |
|
overridevirtual |
Receive one complete Ethernet frame.
| SocketError | When packet reception fails. |
Implements profinet::IRawEthernetSocket.
Definition at line 27 of file asioEthernetSocket.cpp.
References backend.
Referenced by TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().
Here is the caller graph for this function:
|
overridevirtual |
Send one complete Ethernet frame.
| frame | Complete Ethernet frame including the Ethernet header. |
| SocketError | When packet transmission fails. |
Implements profinet::IRawEthernetSocket.
Definition at line 17 of file asioEthernetSocket.cpp.
References backend, and frame.
Referenced by TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().
Here is the caller graph for this function:
|
overridevirtual |
Set the receive timeout.
| timeout | Receive timeout. Zero means wait indefinitely. |
Implements profinet::IRawEthernetSocket.
Definition at line 22 of file asioEthernetSocket.cpp.
References backend.
Referenced by TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().
Here is the caller graph for this function:
|
friend |
Grants backend tests access to the private packet backend.
The backend remains an implementation detail of AsioEthernetSocket and is not exposed as part of the production transport API.
Definition at line 96 of file asioEthernetSocket.h.
|
private |
Platform packet-access implementation.
Definition at line 102 of file asioEthernetSocket.h.
Referenced by Recv(), Send(), and SetTimeout().
|
private |
Asio execution context supplied by the caller.
Definition at line 99 of file asioEthernetSocket.h.
Referenced by profinet::AsioEthernetSocket::EthernetPacketBackend::Recv().