|
PROFINET IO Controller Stack 1.0.0
Modern C++ implementation of a PROFINET IO Controller stack
|
Small virtual Ethernet switch suitable for deterministic tests and demos. More...
#include <in_memory_ethernet.h>
Collaboration diagram for profinet::sim::InMemoryEthernetBus:Public Member Functions | |
| InMemoryEthernetBus ()=default | |
| Construct an empty bus. | |
| ~InMemoryEthernetBus ()=default | |
| InMemoryEthernetBus (const InMemoryEthernetBus &)=delete | |
| InMemoryEthernetBus & | operator= (const InMemoryEthernetBus &)=delete |
| std::unique_ptr< InMemoryEthernetSocket > | CreateSocket (MacAddress localMac) |
| Create one virtual raw-Ethernet endpoint. | |
| std::size_t | EndpointCount () const |
| Return the number of currently connected socket endpoints. | |
| void | ClearQueues () |
| Remove all queued frames without disconnecting endpoints. | |
Private Member Functions | |
| void | Attach (InMemoryEthernetSocket *socket) |
| Attach one socket. | |
| void | Detach (InMemoryEthernetSocket *socket) |
| Detach one socket. | |
| void | Transmit (InMemoryEthernetSocket &sender, const std::vector< std::uint8_t > &frame) |
| Route a frame to matching endpoints. | |
Private Attributes | |
| std::mutex | mutex |
| std::vector< InMemoryEthernetSocket * > | endpoints |
Friends | |
| class | InMemoryEthernetSocket |
Small virtual Ethernet switch suitable for deterministic tests and demos.
Unicast frames are delivered to endpoints with a matching destination MAC. Broadcast and multicast frames are flooded to all other MAC endpoints. A frame is never reflected into another socket belonging to the same MAC address as its source. This is important because one virtual controller intentionally owns separate TX and RX sockets with the same MAC address.
Definition at line 91 of file in_memory_ethernet.h.
|
default |
Construct an empty bus.
|
default |
|
delete |
|
private |
Attach one socket.
Definition at line 143 of file in_memory_ethernet.cpp.
References endpoints, and mutex.
Referenced by profinet::sim::InMemoryEthernetSocket::InMemoryEthernetSocket().
Here is the caller graph for this function:| void profinet::sim::InMemoryEthernetBus::ClearQueues | ( | ) |
Remove all queued frames without disconnecting endpoints.
Definition at line 223 of file in_memory_ethernet.cpp.
References endpoints, and mutex.
Referenced by profinet::sim::TEST().
Here is the caller graph for this function:| std::unique_ptr< InMemoryEthernetSocket > profinet::sim::InMemoryEthernetBus::CreateSocket | ( | MacAddress | localMac | ) |
Create one virtual raw-Ethernet endpoint.
| localMac | MAC address represented by the endpoint. |
Definition at line 212 of file in_memory_ethernet.cpp.
Referenced by profinet::sim::VirtualPhoenixPlc::Connect(), profinet::sim::VirtualAumaValve::Start(), profinet::sim::TEST(), profinet::sim::TEST(), profinet::sim::TEST(), profinet::sim::TEST(), profinet::sim::TEST(), profinet::sim::TEST(), profinet::sim::TEST(), profinet::sim::TEST(), profinet::sim::TEST(), profinet::sim::TEST(), profinet::sim::TEST(), profinet::sim::TEST(), profinet::sim::TEST(), profinet::sim::TEST(), profinet::sim::TEST(), profinet::sim::TEST(), profinet::sim::TEST(), profinet::sim::TEST(), and profinet::sim::TEST().
Here is the caller graph for this function:
|
private |
Detach one socket.
Definition at line 155 of file in_memory_ethernet.cpp.
References profinet::sim::InMemoryEthernetSocket::condition, profinet::sim::InMemoryEthernetSocket::connected, endpoints, profinet::sim::InMemoryEthernetSocket::mutex, mutex, and profinet::sim::InMemoryEthernetSocket::receiveQueue.
Referenced by profinet::sim::InMemoryEthernetSocket::~InMemoryEthernetSocket().
Here is the caller graph for this function:| std::size_t profinet::sim::InMemoryEthernetBus::EndpointCount | ( | ) | const |
Return the number of currently connected socket endpoints.
Definition at line 217 of file in_memory_ethernet.cpp.
References endpoints, and mutex.
Referenced by profinet::sim::VirtualProfinetLab::StatusReport(), profinet::sim::TEST(), profinet::sim::TEST(), and profinet::sim::TEST().
Here is the caller graph for this function:
|
delete |
|
private |
Route a frame to matching endpoints.
Definition at line 174 of file in_memory_ethernet.cpp.
References endpoints, frame, and mutex.
Referenced by profinet::sim::InMemoryEthernetSocket::Send().
Here is the caller graph for this function:
|
friend |
Definition at line 113 of file in_memory_ethernet.h.
|
private |
Definition at line 126 of file in_memory_ethernet.h.
Referenced by Attach(), ClearQueues(), Detach(), EndpointCount(), and Transmit().
|
mutableprivate |
Definition at line 125 of file in_memory_ethernet.h.
Referenced by Attach(), ClearQueues(), Detach(), EndpointCount(), and Transmit().