30#ifndef ASYNC_TCP_PRIO_CLIENT_BASE_INCLUDED
31#define ASYNC_TCP_PRIO_CLIENT_BASE_INCLUDED
135 uint16_t remote_port) =
delete;
141 uint16_t remote_port) =
delete;
184 void setService(
const std::string& srv_name,
const std::string& srv_proto,
185 const std::string& srv_domain);
245 uint16_t remote_port) =
delete;
251 uint16_t remote_port) =
delete;
272 using TcpClientBase::operator=;
322 Machine* m_machine =
nullptr;
Contains a class for executing DNS queries.
Contains a base class for creating TCP client connections.
Contains a single shot or periodic timer that emits a signal on timeout.
A class for representing an IP address in an OS independent way.
TcpClientBase(TcpConnection *con)
Constructor.
A class for handling exiting TCP connections.
DisconnectReason
Reason code for disconnects.
const std::string & service(void) const
Get the full service name.
virtual void connectionEstablished(void) override
Called when the connection has been established to the server.
virtual ~TcpPrioClientBase(void)
Destructor.
void connect(void)
Connect to the remote host.
bool isPrimary(void) const
virtual void disconnect(void)
Disconnect from the remote host.
void initialize(void)
Must be called from the inheriting class constructor.
void setService(const std::string &srv_name, const std::string &srv_proto, const std::string &srv_domain)
Use a DNS service resource record for connections.
TcpPrioClientBase(TcpConnection *con, const IpAddress &remote_ip, uint16_t remote_port)=delete
Deleted constructor not making sense in this context.
TcpPrioClientBase(TcpConnection *con, const std::string &remote_host, uint16_t remote_port)=delete
Deleted constructor not making sense in this context.
void setReconnectBackoffPercent(unsigned p)
Percent to increase reconnect time with each try.
void connect(const Async::IpAddress &remote_ip, uint16_t remote_port)=delete
Deleted function not making sense in this context.
void setReconnectMinTime(unsigned t)
Minimum time between reconnects.
void connect(const std::string &remote_host, uint16_t remote_port)=delete
Deleted function not making sense in this context.
void addStaticSRVRecord(DnsResourceRecordSRV::Ttl ttl, DnsResourceRecordSRV::Prio prio, DnsResourceRecordSRV::Weight weight, DnsResourceRecordSRV::Port port, DnsResourceRecordSRV::Target target)
Add a static service resource record.
TcpPrioClientBase(TcpConnection *con)
Constructor.
virtual void onDisconnected(TcpConnection::DisconnectReason reason)
Called when a connection has been terminated.
void setReconnectRandomizePercent(unsigned p)
Percent to randomize reconnect time.
virtual void emitDisconnected(TcpConnection::DisconnectReason reason)=0
Emit the disconnected signal.
void setReconnectMaxTime(unsigned t)
Maximum time between reconnects.
bool isIdle(void) const
Check if the connection is idle.
virtual TcpClientBase * newTcpClient(void)=0
Allocate a new TcpClient object.
Namespace for the asynchronous programming classes.