icinga2/icinga/virtualendpoint.h

38 lines
1009 B
C
Raw Normal View History

#ifndef VIRTUALENDPOINT_H
#define VIRTUALENDPOINT_H
namespace icinga
{
2012-04-16 16:27:41 +02:00
struct I2_JSONRPC_API NewRequestEventArgs : public EventArgs
{
typedef shared_ptr<NewRequestEventArgs> Ptr;
typedef weak_ptr<NewRequestEventArgs> WeakPtr;
Endpoint::Ptr Sender;
JsonRpcRequest::Ptr Request;
};
class I2_ICINGA_API VirtualEndpoint : public Endpoint
{
private:
2012-04-16 16:27:41 +02:00
map< string, Event<NewRequestEventArgs::Ptr> > m_MethodHandlers;
public:
typedef shared_ptr<VirtualEndpoint> Ptr;
typedef weak_ptr<VirtualEndpoint> WeakPtr;
2012-04-16 16:27:41 +02:00
void RegisterMethodHandler(string method, function<int (NewRequestEventArgs::Ptr)> callback);
void UnregisterMethodHandler(string method, function<int (NewRequestEventArgs::Ptr)> callback);
virtual void RegisterMethodSource(string method);
virtual void UnregisterMethodSource(string method);
2012-04-16 16:27:41 +02:00
virtual void SendRequest(Endpoint::Ptr sender, JsonRpcRequest::Ptr message);
virtual void SendResponse(Endpoint::Ptr sender, JsonRpcResponse::Ptr message);
};
}
#endif /* VIRTUALENDPOINT_H */