mirror of https://github.com/Icinga/icinga2.git
38 lines
1.0 KiB
C++
38 lines
1.0 KiB
C++
#ifndef I2_CONNECTIONMANAGER_H
|
|
#define I2_CONNECTIONMANAGER_H
|
|
|
|
namespace icinga
|
|
{
|
|
|
|
using std::map;
|
|
|
|
class ConnectionManager : public Object
|
|
{
|
|
list<JsonRpcServer::RefType> m_Servers;
|
|
list<JsonRpcClient::RefType> m_Clients;
|
|
map< string, event<NewMessageEventArgs::RefType> > m_Methods;
|
|
|
|
int NewClientHandler(NewClientEventArgs::RefType ncea);
|
|
int CloseClientHandler(EventArgs::RefType ea);
|
|
int NewMessageHandler(NewMessageEventArgs::RefType nmea);
|
|
|
|
public:
|
|
typedef shared_ptr<ConnectionManager> RefType;
|
|
typedef weak_ptr<ConnectionManager> WeakRefType;
|
|
|
|
void RegisterServer(JsonRpcServer::RefType server);
|
|
void UnregisterServer(JsonRpcServer::RefType server);
|
|
|
|
void RegisterClient(JsonRpcClient::RefType client);
|
|
void UnregisterClient(JsonRpcClient::RefType client);
|
|
|
|
void RegisterMethod(string method, function<int (NewMessageEventArgs::RefType)> function);
|
|
void UnregisterMethod(string method, function<int (NewMessageEventArgs::RefType)> function);
|
|
|
|
void SendMessage(JsonRpcMessage::RefType message);
|
|
};
|
|
|
|
}
|
|
|
|
#endif /* I2_CONNECTIONMANAGER_H */
|