icinga2/base/tcpserver.h

43 lines
746 B
C
Raw Normal View History

#ifndef TCPSERVER_H
#define TCPSERVER_H
2012-03-28 13:24:49 +02:00
namespace icinga
{
struct NewClientEventArgs : public EventArgs
{
typedef shared_ptr<NewClientEventArgs> RefType;
typedef weak_ptr<NewClientEventArgs> WeakRefType;
TCPSocket::RefType Client;
};
class TCPServer : public TCPSocket
{
private:
int ReadableEventHandler(EventArgs::RefType ea);
factory_function m_ClientFactory;
public:
typedef shared_ptr<TCPServer> RefType;
typedef weak_ptr<TCPServer> WeakRefType;
TCPServer(void);
void SetClientFactory(factory_function function);
factory_function GetFactoryFunction(void);
virtual void Start();
void Listen(void);
event<NewClientEventArgs::RefType> OnNewClient;
virtual bool WantsToRead(void) const;
};
}
#endif /* TCPSERVER_H */