2012-04-02 08:56:30 +02:00
|
|
|
#ifndef JSONRPCCLIENT_H
|
|
|
|
#define JSONRPCCLIENT_H
|
2012-03-28 13:24:49 +02:00
|
|
|
|
|
|
|
namespace icinga
|
|
|
|
{
|
|
|
|
|
2012-04-06 08:56:52 +02:00
|
|
|
struct I2_JSONRPC_API NewMessageEventArgs : public EventArgs
|
2012-03-28 13:24:49 +02:00
|
|
|
{
|
2012-04-02 20:50:35 +02:00
|
|
|
typedef shared_ptr<NewMessageEventArgs> Ptr;
|
|
|
|
typedef weak_ptr<NewMessageEventArgs> WeakPtr;
|
2012-03-28 13:24:49 +02:00
|
|
|
|
2012-04-16 16:27:41 +02:00
|
|
|
Message::Ptr Message;
|
2012-03-28 13:24:49 +02:00
|
|
|
};
|
|
|
|
|
2012-04-06 08:56:52 +02:00
|
|
|
class I2_JSONRPC_API JsonRpcClient : public TCPClient
|
2012-03-28 13:24:49 +02:00
|
|
|
{
|
|
|
|
private:
|
2012-04-02 20:50:35 +02:00
|
|
|
int DataAvailableHandler(EventArgs::Ptr ea);
|
2012-03-28 13:24:49 +02:00
|
|
|
|
|
|
|
public:
|
2012-04-02 20:50:35 +02:00
|
|
|
typedef shared_ptr<JsonRpcClient> Ptr;
|
|
|
|
typedef weak_ptr<JsonRpcClient> WeakPtr;
|
2012-03-28 13:24:49 +02:00
|
|
|
|
2012-04-16 16:27:41 +02:00
|
|
|
void SendMessage(Message::Ptr message);
|
2012-03-28 13:24:49 +02:00
|
|
|
|
|
|
|
virtual void Start(void);
|
|
|
|
|
2012-04-16 08:36:50 +02:00
|
|
|
Event<NewMessageEventArgs::Ptr> OnNewMessage;
|
2012-03-28 13:24:49 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2012-04-02 08:56:30 +02:00
|
|
|
#endif /* JSONRPCCLIENT_H */
|