|
Open Model Railroad Network (OpenMRN)
|
Abstract interface to represent parameters to the socket client. More...
#include <SocketClientParams.hxx>
Public Types | |
| enum | SearchMode { AUTO_MANUAL = 0 , MANUAL_AUTO = 1 , AUTO_ONLY = 2 , MANUAL_ONLY = 3 } |
| Parameter that determines what order we will attempt to connect. More... | |
| enum | LogMessage { CYCLE_START = 0 , CONNECT_RE = 1 , MDNS_SEARCH = 2 , MDNS_NOT_FOUND = 3 , MDNS_FOUND = 4 , CONNECT_MDNS = 5 , CONNECT_MANUAL = 6 , CONNECT_FAILED_SELF = 7 , CONNECT_FAILED_ONESHOT = 8 , CONNECTION_LOST } |
| Enum for sending connection status updates to the caller. More... | |
Public Member Functions | |
| virtual SearchMode | search_mode ()=0 |
| virtual string | mdns_service_name ()=0 |
| virtual string | mdns_host_name ()=0 |
| virtual string | manual_host_name ()=0 |
| virtual int | manual_port ()=0 |
| virtual bool | enable_last ()=0 |
| virtual string | last_host_name ()=0 |
| virtual int | last_port ()=0 |
| virtual bool | one_shot () |
| virtual void | set_last (const char *hostname, int port) |
| This function is called on an unspecified thread when a connection is successfully established. | |
| virtual void | log_message (LogMessage id, const string &arg=string()) |
| Notifies the caller about the current phase of the connection. | |
| virtual int | retry_seconds () |
| virtual int | timeout_seconds () |
| virtual bool | disallow_local () |
Static Public Member Functions | |
| static std::unique_ptr< SocketClientParams > | from_static (string hostname, int port) |
| static std::unique_ptr< SocketClientParams > | from_static_and_mdns (string hostname, int port, string mdns_service) |
Abstract interface to represent parameters to the socket client.
This interface can be implemented just purely based on compiled-in values, filled in from optargs or wrapping a configuration location in an openlcb config space.
Implementations must be thread-safe (i.e. do locking internally; all functions of this class may be called from unspecified threads including also concurrently).
Definition at line 46 of file SocketClientParams.hxx.
Enum for sending connection status updates to the caller.
Definition at line 128 of file SocketClientParams.hxx.
Parameter that determines what order we will attempt to connect.
Definition at line 69 of file SocketClientParams.hxx.
|
inlinevirtual |
Definition at line 64 of file SocketClientParams.hxx.
|
inlinevirtual |
Definition at line 174 of file SocketClientParams.hxx.
|
pure virtual |
Implemented in EmptySocketClientParams.
|
static |
| hostname | is the manual hostname |
| port | is the manual port number |
|
static |
| hostname | is the manual hostname |
| port | is the manual port number |
| mdns_service | is the mdns service name |
|
pure virtual |
Implemented in EmptySocketClientParams.
|
pure virtual |
Implemented in EmptySocketClientParams.
|
inlinevirtual |
Notifies the caller about the current phase of the connection.
This function will be called from an unspecified thread, so the callee is responsible for locking.
| id | is the enum of the message to emit. |
| arg | is a parameter to the message (usually hostname, IP address etc. Sometimes empty). |
Definition at line 156 of file SocketClientParams.hxx.
|
pure virtual |
Implemented in EmptySocketClientParams, and DefaultSocketClientParams.
|
pure virtual |
Implemented in EmptySocketClientParams, and DefaultSocketClientParams.
|
pure virtual |
Implemented in EmptySocketClientParams.
|
pure virtual |
Implemented in EmptySocketClientParams, and DefaultSocketClientParams.
|
inlinevirtual |
Definition at line 116 of file SocketClientParams.hxx.
|
inlinevirtual |
Definition at line 161 of file SocketClientParams.hxx.
|
pure virtual |
Implemented in EmptySocketClientParams.
|
inlinevirtual |
This function is called on an unspecified thread when a connection is successfully established.
| hostname | is filled with a dotted decimal representation of the connected remote host when the connection succeeds. |
| port | is the TCP port number. |
Definition at line 123 of file SocketClientParams.hxx.
|
inlinevirtual |
Definition at line 167 of file SocketClientParams.hxx.