PROFINET IO Controller Stack 1.0.0
Modern C++ implementation of a PROFINET IO Controller stack
Loading...
Searching...
No Matches
asioEthernetSocket.h
Go to the documentation of this file.
1
3
4#pragma once
5
6#include <asio/io_context.hpp>
7#include <chrono>
8#include <cstdint>
9#include <memory>
10#include <string>
11#include <vector>
12
14
15namespace profinet
16{
49{
50 public:
60 AsioEthernetSocket(asio::io_context& ioContext, const std::string& interface, std::uint16_t ethertype = 0);
61
64
67
70
75 void Send(const std::vector<std::uint8_t>& frame) override;
76
80 void SetTimeout(std::chrono::milliseconds timeout) override;
81
87 [[nodiscard]] std::vector<std::uint8_t> Recv() override;
88
89 private:
91
97
99 asio::io_context& ioContext;
100
102 std::unique_ptr<EthernetPacketBackend> backend;
103};
104
105} // namespace profinet
Abstraction for sending and receiving raw Ethernet frames.
Private packet-capture backend for complete Ethernet frames.
Platform-independent raw Ethernet transport using Asio.
AsioEthernetSocket & operator=(const AsioEthernetSocket &)=delete
AsioEthernetSocket(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.
asio::io_context & ioContext
Asio execution context supplied by the caller.
std::vector< std::uint8_t > Recv() override
Receive one complete Ethernet frame.
std::unique_ptr< EthernetPacketBackend > backend
Platform packet-access implementation.
void SetTimeout(std::chrono::milliseconds timeout) override
Set the receive timeout.
~AsioEthernetSocket() override
Destroy the Ethernet transport.
Shared fixture for EthernetPacketBackend tests.
Abstract interface for raw Ethernet frame transport.
Bytes frame