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;
298 using TcpClientBase::operator=;
338 Machine* machine(
void)
const;
340 mutable 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.
A base class for creating a TCP client connection.
A class for handling exiting TCP connections.
DisconnectReason
Reason code for disconnects.
A base class for creating a prio controlled TCP client connection.
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
Check if connected to the primary server.
virtual void disconnect(void)
Disconnect from the remote host.
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.
bool markedAsEstablished(void) const
Check if a connection has been marked as established.
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.
void markAsEstablished(void)
Mark connection as established.
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.