27#ifndef ASYNC_TCP_SERVER_BASE_INCLUDED
28#define ASYNC_TCP_SERVER_BASE_INCLUDED
40#include <sigc++/sigc++.h>
206 int inc_interval_ms);
210 uint16_t remote_port) = 0;
216 using TcpConnectionList = std::vector<TcpConnection*>;
219 ConThrotItem(
float bucket_max) : m_bucket(bucket_max) {}
221 TcpConnectionList m_pending_connections;
223 using ConThrotMap = std::map<IpAddress, ConThrotItem>;
227 TcpConnectionList m_tcpConnectionList;
230 ConThrotMap m_con_throt_map;
231 Timer m_con_throt_timer;
232 unsigned m_con_throt_bucket_max = 0;
233 unsigned m_con_throt_bucket_inc = 0;
236 void onConnection(
FdWatch *watch);
237 void updateConnThrotMap(
Timer*);
SSL context meant to be used with TcpConnection and friends.
Contains a class for handling exiting TCP connections.
Contains a single shot or periodic timer that emits a signal on timeout.
A class for watching file descriptors.
A class for representing an IP address in an OS independent way.
SSL context meant to be used with TcpConnection and friends.
A class for handling exiting TCP connections.
The base class for creating a TCP server.
int writeAll(const void *buf, int count)
Write data to all connected clients.
virtual void emitClientConnected(TcpConnection *con)=0
virtual void createConnection(int sock, const IpAddress &remote_addr, uint16_t remote_port)=0
int numberOfClients(void)
Get the number of clients that is connected to the server.
void setConnectionThrottling(unsigned bucket_max, float bucket_inc, int inc_interval_ms)
Enable connection throttling.
TcpConnection * getClient(unsigned int index)
Get the client object pointer from the server.
void removeConnection(TcpConnection *con)
int writeExcept(TcpConnection *con, const void *buf, int count)
Send data to all connected clients except the given client.
int writeOnly(TcpConnection *con, const void *buf, int count)
Send data only to the given client.
void addConnection(TcpConnection *con)
virtual ~TcpServerBase(void)
Destructor.
TcpServerBase(const std::string &port_str, const Async::IpAddress &bind_ip)
Default constuctor.
void setSslContext(SslContext &ctx)
Set the SSL context for all new connections.
A class that produces timer events.
Namespace for the asynchronous programming classes.