23using std::stringstream;
100 virtual void identify(stringstream* frame,
MessageType& messageType, uint32_t& connectionId, uint32_t& messageId, uint8_t& retries);
107 virtual void validate(stringstream* frame);
125 virtual void writeHeader(stringstream* frame,
MessageType messageType,
const uint32_t clientId,
const uint32_t messageId,
const uint8_t retries);
Base exception class for network server exceptions.
Base class for network server groups.
Simple server worker thread pool class.
Base class for network servers.
Base class for network UDP server clients.
UDP Network server IO thread.
Base class for network UDP servers.
static void initializeHeader(stringstream *frame)
Writes a empty header to message.
UDPServer_Statistics statistics
virtual void run()
main event loop
static const uint32_t MESSAGE_ID_NONE
std::map< string, UDPServerClient * > ClientIpMap
void processAckReceived(UDPServerClient *client, const uint32_t messageId)
Processes an acknowlegdement reception.
unsigned int ioThreadCurrent
ReadWriteLock clientIpMapReadWriteLock
std::map< uint32_t, ClientId * > ClientIdMap
virtual ~UDPServer()
destructor
const UDPServer_Statistics getStatistics()
void addClient(UDPServerClient *client)
maps a new client to a given client id
UDPServerClient * lookupClient(const uint32_t clientId)
Look ups a client by client id.
UDPServer(const std::string &name, const std::string &host, const unsigned int port, const unsigned int maxCCU)
Public constructor.
virtual void identify(stringstream *frame, MessageType &messageType, uint32_t &connectionId, uint32_t &messageId, uint8_t &retries)
Identifies a client message.
std::set< UDPServerClient * > ClientSet
UDPServerClient * getClientByIp(const string &ip, const unsigned int port)
Returns client by host name and port.
void cleanUpClients()
Clean up clients that have been idle for some time or are flagged to be shut down.
static const uint64_t CLIENT_CLEANUP_IDLETIME
@ MESSAGETYPE_ACKNOWLEDGEMENT
ReadWriteLock clientIdMapReadWriteLock
UDPServerIOThread ** ioThreads
virtual void validate(stringstream *frame)
Validates a client message.
const uint32_t allocateClientId()
Allocates a client id for a new client.
virtual UDPServerClient * accept(const uint32_t clientId, const std::string &ip, const unsigned int port)
method to implement for accepting clients
ServerWorkerThreadPool * workerThreadPool
void sendMessage(const UDPServerClient *client, stringstream *frame, const bool safe, const bool deleteFrame, const MessageType messageType, const uint32_t messageId=MESSAGE_ID_NONE)
pushes a message to be send, takes over ownership of frame
void removeClient(UDPServerClient *client)
removes a client
virtual void writeHeader(stringstream *frame, MessageType messageType, const uint32_t clientId, const uint32_t messageId, const uint8_t retries)
Writes a message header to message.
Implementation for read/write lock.