icinga2/base/tcpclient.h

44 lines
756 B
C
Raw Normal View History

#ifndef TCPCLIENT_H
#define TCPCLIENT_H
2012-03-28 13:24:49 +02:00
namespace icinga
{
class I2_BASE_API TCPClient : public TCPSocket
2012-03-28 13:24:49 +02:00
{
private:
string m_PeerHost;
int m_PeerPort;
FIFO::Ptr m_SendQueue;
FIFO::Ptr m_RecvQueue;
2012-03-28 13:24:49 +02:00
2012-04-18 15:22:25 +02:00
int ReadableEventHandler(const EventArgs& ea);
int WritableEventHandler(const EventArgs& ea);
2012-03-28 13:24:49 +02:00
public:
typedef shared_ptr<TCPClient> Ptr;
typedef weak_ptr<TCPClient> WeakPtr;
2012-03-28 13:24:49 +02:00
TCPClient(void);
virtual void Start(void);
void Connect(const string& hostname, unsigned short port);
2012-03-28 13:24:49 +02:00
FIFO::Ptr GetSendQueue(void);
FIFO::Ptr GetRecvQueue(void);
2012-03-28 13:24:49 +02:00
string GetPeerHost(void);
int GetPeerPort(void);
2012-03-28 13:24:49 +02:00
virtual bool WantsToRead(void) const;
virtual bool WantsToWrite(void) const;
2012-04-18 15:22:25 +02:00
Event<EventArgs> OnDataAvailable;
2012-03-28 13:24:49 +02:00
};
}
#endif /* TCPCLIENT_H */