2012-04-02 08:56:30 +02:00
|
|
|
#ifndef TCPCLIENT_H
|
|
|
|
#define TCPCLIENT_H
|
2012-03-28 13:24:49 +02:00
|
|
|
|
|
|
|
namespace icinga
|
|
|
|
{
|
|
|
|
|
|
|
|
class TCPClient : public TCPSocket
|
|
|
|
{
|
|
|
|
private:
|
2012-04-02 20:50:35 +02:00
|
|
|
FIFO::Ptr m_SendQueue;
|
|
|
|
FIFO::Ptr m_RecvQueue;
|
2012-03-28 13:24:49 +02:00
|
|
|
|
2012-04-02 20:50:35 +02:00
|
|
|
int ReadableEventHandler(EventArgs::Ptr ea);
|
|
|
|
int WritableEventHandler(EventArgs::Ptr ea);
|
2012-03-28 13:24:49 +02:00
|
|
|
|
|
|
|
public:
|
2012-04-02 20:50:35 +02:00
|
|
|
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 char *hostname, unsigned short port);
|
|
|
|
|
2012-04-02 20:50:35 +02:00
|
|
|
FIFO::Ptr GetSendQueue(void);
|
|
|
|
FIFO::Ptr GetRecvQueue(void);
|
2012-03-28 13:24:49 +02:00
|
|
|
|
|
|
|
virtual bool WantsToRead(void) const;
|
|
|
|
virtual bool WantsToWrite(void) const;
|
|
|
|
|
2012-04-02 20:50:35 +02:00
|
|
|
event<EventArgs::Ptr> OnDataAvailable;
|
2012-03-28 13:24:49 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2012-04-02 08:56:30 +02:00
|
|
|
#endif /* TCPCLIENT_H */
|