35#ifndef _UTILS_SOCKETCLIENTPARAMS_HXX_
36#define _UTILS_SOCKETCLIENTPARAMS_HXX_
54 string hostname,
int port);
62 string hostname,
int port,
string mdns_service);
123 virtual void set_last(
const char *hostname,
int port)
269 string hostname,
int port);
270 friend std::unique_ptr<SocketClientParams>
272 string hostname,
int port,
string mdns_service);
Default implementation that supplies parametrized values for static and mdns connection methods.
int staticPort_
what to return for manual_port
string staticHost_
what to return for manual_host_name
string mdnsService_
what to return for mdns_service_name
int manual_port() override
string manual_host_name() override
string mdns_service_name() override
Default implementation that supplies no connection method.
string last_host_name() override
int manual_port() override
string manual_host_name() override
string mdns_host_name() override
string mdns_service_name() override
bool enable_last() override
SearchMode search_mode() override
Abstract interface to represent parameters to the socket client.
virtual string last_host_name()=0
virtual int retry_seconds()
virtual void set_last(const char *hostname, int port)
This function is called on an unspecified thread when a connection is successfully established.
virtual string mdns_service_name()=0
virtual string mdns_host_name()=0
virtual bool enable_last()=0
SearchMode
Parameter that determines what order we will attempt to connect.
@ AUTO_MANUAL
Try mDNS first, then (if it failed) try manual address.
@ MANUAL_ONLY
Try only manual address, never try mDNS lookups.
@ MANUAL_AUTO
Try manual address first, then (if it failed) try mDNS.
@ AUTO_ONLY
Try only mDNS, ignore manual address.
virtual string manual_host_name()=0
virtual bool disallow_local()
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)
virtual int last_port()=0
virtual SearchMode search_mode()=0
virtual int timeout_seconds()
virtual void log_message(LogMessage id, const string &arg=string())
Notifies the caller about the current phase of the connection.
virtual int manual_port()=0
LogMessage
Enum for sending connection status updates to the caller.
@ MDNS_NOT_FOUND
mDNS lookup failed.
@ CONNECT_FAILED_SELF
Connection dropped because target is localhost.
@ MDNS_FOUND
mDNS lookup suceeded.
@ CONNECT_MDNS
Connecting to mDNS target. Arg is host:port.
@ CONNECT_MANUAL
Connecting to manual target. Arg is hostname:port.
@ MDNS_SEARCH
Starting mDNS lookup. Argument: mdns [hostname.]service_name.
@ CONNECT_FAILED_ONESHOT
Attempt to search & connect failed, given up. No arg.
@ CONNECT_RE
Attempting to reconnect. Arg is host:port.