|
Open Model Railroad Network (OpenMRN)
|
This class runs a CAN-bus HUB listening on TCP socket using the gridconnect format. More...
#include <GcTcpHub.hxx>
Public Member Functions | |
| GcTcpHub (CanHubFlow *can_hub, int port) | |
| Constructor. | |
| bool | is_started () |
| unsigned | get_num_clients () |
Private Member Functions | |
| void | on_new_connection (int fd) |
| Callback when a new connection arrives. | |
| void | notify () override |
| Error callback from the gridconnect socket. | |
Private Member Functions inherited from Atomic | |
| void | lock () |
| void | unlock () |
Private Attributes | |
| CanHubFlow * | canHub_ |
| unsigned | numClients_ {0} |
| How many clients are connected right now. | |
| SocketListener | tcpListener_ |
| Helper object representing the listening on the socket. | |
This class runs a CAN-bus HUB listening on TCP socket using the gridconnect format.
Any new incoming connection will be wired into the same virtual CAN hub. All packets will be forwarded to every participant, without loopback.
Definition at line 46 of file GcTcpHub.hxx.
| GcTcpHub::GcTcpHub | ( | CanHubFlow * | can_hub, |
| int | port | ||
| ) |
Constructor.
| can_hub | Which CAN-hub should we attach the TCP gridconnect hub onto. |
| port | TCp port number to listen on. |
Definition at line 64 of file GcTcpHub.cxx.
| GcTcpHub::~GcTcpHub | ( | ) |
Definition at line 72 of file GcTcpHub.cxx.
|
inline |
Definition at line 64 of file GcTcpHub.hxx.
|
inline |
Definition at line 58 of file GcTcpHub.hxx.
|
overrideprivatevirtual |
Error callback from the gridconnect socket.
This is invoked when a client disconnects.
Implements Notifiable.
Definition at line 55 of file GcTcpHub.cxx.
|
private |
Callback when a new connection arrives.
| fd | filedes of the freshly established incoming connection. |
Definition at line 42 of file GcTcpHub.cxx.
|
private |
| can_hub | Which CAN-hub should we attach the TCP gridconnect hub onto. |
Definition at line 82 of file GcTcpHub.hxx.
|
private |
How many clients are connected right now.
Definition at line 84 of file GcTcpHub.hxx.
|
private |
Helper object representing the listening on the socket.
Definition at line 86 of file GcTcpHub.hxx.