mirror of https://github.com/Icinga/icinga2.git
Consistent ordering for method declarations.
This commit is contained in:
parent
918cbad764
commit
59dcfa801c
|
@ -36,28 +36,6 @@ public:
|
|||
typedef shared_ptr<Application> Ptr;
|
||||
typedef weak_ptr<Application> WeakPtr;
|
||||
|
||||
private:
|
||||
static Application::Ptr m_Instance;
|
||||
|
||||
bool m_ShuttingDown; /**< Whether the application is in the process of
|
||||
shutting down. */
|
||||
ConfigHive::Ptr m_ConfigHive; /**< The application's configuration. */
|
||||
map< string, shared_ptr<Component> > m_Components; /**< Components that
|
||||
were loaded by the application. */
|
||||
vector<string> m_Arguments; /**< Command-line arguments */
|
||||
bool m_Debugging; /**< Whether debugging is enabled. */
|
||||
|
||||
#ifndef _WIN32
|
||||
static void SigIntHandler(int signum);
|
||||
#else /* _WIN32 */
|
||||
static BOOL WINAPI CtrlHandler(DWORD type);
|
||||
#endif /* _WIN32 */
|
||||
|
||||
protected:
|
||||
void RunEventLoop(void);
|
||||
string GetExeDirectory(void) const;
|
||||
|
||||
public:
|
||||
Application(void);
|
||||
~Application(void);
|
||||
|
||||
|
@ -81,6 +59,27 @@ public:
|
|||
void AddComponentSearchDir(const string& componentDirectory);
|
||||
|
||||
bool IsDebugging(void) const;
|
||||
|
||||
protected:
|
||||
void RunEventLoop(void);
|
||||
string GetExeDirectory(void) const;
|
||||
|
||||
private:
|
||||
static Application::Ptr m_Instance;
|
||||
|
||||
bool m_ShuttingDown; /**< Whether the application is in the process of
|
||||
shutting down. */
|
||||
ConfigHive::Ptr m_ConfigHive; /**< The application's configuration. */
|
||||
map< string, shared_ptr<Component> > m_Components; /**< Components that
|
||||
were loaded by the application. */
|
||||
vector<string> m_Arguments; /**< Command-line arguments */
|
||||
bool m_Debugging; /**< Whether debugging is enabled. */
|
||||
|
||||
#ifndef _WIN32
|
||||
static void SigIntHandler(int signum);
|
||||
#else /* _WIN32 */
|
||||
static BOOL WINAPI CtrlHandler(DWORD type);
|
||||
#endif /* _WIN32 */
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -31,9 +31,6 @@ namespace icinga
|
|||
*/
|
||||
class I2_BASE_API Component : public Object
|
||||
{
|
||||
private:
|
||||
ConfigObject::Ptr m_Config;
|
||||
|
||||
public:
|
||||
typedef shared_ptr<Component> Ptr;
|
||||
typedef weak_ptr<Component> WeakPtr;
|
||||
|
@ -44,6 +41,9 @@ public:
|
|||
virtual string GetName(void) const = 0;
|
||||
virtual void Start(void) = 0;
|
||||
virtual void Stop(void) = 0;
|
||||
|
||||
private:
|
||||
ConfigObject::Ptr m_Config;
|
||||
};
|
||||
|
||||
typedef Component *(*CreateComponentFunction)(void);
|
||||
|
|
|
@ -32,9 +32,6 @@ class ConfigHive;
|
|||
*/
|
||||
class I2_BASE_API ConfigCollection : public Object
|
||||
{
|
||||
private:
|
||||
weak_ptr<ConfigHive> m_Hive;
|
||||
|
||||
public:
|
||||
typedef shared_ptr<ConfigCollection> Ptr;
|
||||
typedef weak_ptr<ConfigCollection> WeakPtr;
|
||||
|
@ -54,6 +51,10 @@ public:
|
|||
|
||||
Observable<EventArgs> OnObjectCommitted;
|
||||
Observable<EventArgs> OnObjectRemoved;
|
||||
|
||||
private:
|
||||
weak_ptr<ConfigHive> m_Hive;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -34,13 +34,6 @@ class ConfigHive;
|
|||
*/
|
||||
class I2_BASE_API ConfigObject : public Dictionary
|
||||
{
|
||||
private:
|
||||
weak_ptr<ConfigHive> m_Hive;
|
||||
|
||||
string m_Name;
|
||||
string m_Type;
|
||||
bool m_Replicated;
|
||||
|
||||
public:
|
||||
typedef shared_ptr<ConfigObject> Ptr;
|
||||
typedef weak_ptr<ConfigObject> WeakPtr;
|
||||
|
@ -60,6 +53,13 @@ public:
|
|||
bool GetReplicated(void) const;
|
||||
|
||||
void Commit(void);
|
||||
|
||||
private:
|
||||
weak_ptr<ConfigHive> m_Hive;
|
||||
|
||||
string m_Name;
|
||||
string m_Type;
|
||||
bool m_Replicated;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -33,9 +33,6 @@ typedef map<string, Variant>::iterator DictionaryIterator;
|
|||
*/
|
||||
class I2_BASE_API Dictionary : public Object
|
||||
{
|
||||
private:
|
||||
map<string, Variant> m_Data;
|
||||
|
||||
public:
|
||||
typedef shared_ptr<Dictionary> Ptr;
|
||||
typedef weak_ptr<Dictionary> WeakPtr;
|
||||
|
@ -99,6 +96,9 @@ public:
|
|||
DictionaryIterator End(void);
|
||||
|
||||
long GetLength(void) const;
|
||||
|
||||
private:
|
||||
map<string, Variant> m_Data;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -30,12 +30,6 @@ namespace icinga
|
|||
*/
|
||||
class I2_BASE_API Exception : public exception
|
||||
{
|
||||
private:
|
||||
char *m_Message;
|
||||
|
||||
protected:
|
||||
void SetMessage(const char *message);
|
||||
|
||||
public:
|
||||
Exception(void);
|
||||
Exception(const char *message);
|
||||
|
@ -44,6 +38,12 @@ public:
|
|||
const char *GetMessage(void) const;
|
||||
|
||||
virtual const char *what(void) const throw();
|
||||
|
||||
protected:
|
||||
void SetMessage(const char *message);
|
||||
|
||||
private:
|
||||
char *m_Message;
|
||||
};
|
||||
|
||||
#define DEFINE_EXCEPTION_CLASS(klass) \
|
||||
|
|
18
base/fifo.h
18
base/fifo.h
|
@ -30,15 +30,6 @@ namespace icinga
|
|||
*/
|
||||
class I2_BASE_API FIFO : public Object
|
||||
{
|
||||
private:
|
||||
char *m_Buffer;
|
||||
size_t m_DataSize;
|
||||
size_t m_AllocSize;
|
||||
size_t m_Offset;
|
||||
|
||||
void ResizeBuffer(size_t newSize);
|
||||
void Optimize(void);
|
||||
|
||||
public:
|
||||
static const size_t BlockSize = 16 * 1024;
|
||||
|
||||
|
@ -55,6 +46,15 @@ public:
|
|||
|
||||
size_t Read(void *buffer, size_t count);
|
||||
size_t Write(const void *buffer, size_t count);
|
||||
|
||||
private:
|
||||
char *m_Buffer;
|
||||
size_t m_DataSize;
|
||||
size_t m_AllocSize;
|
||||
size_t m_Offset;
|
||||
|
||||
void ResizeBuffer(size_t newSize);
|
||||
void Optimize(void);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
* @mainpage Icinga Documentation
|
||||
*
|
||||
* Icinga implements a framework for run-time-loadable components which can
|
||||
* pass messages between them. These components can either be hosted in the
|
||||
* same process or in several host processes (either on the same machine or
|
||||
* pass messages between each other. These components can either be hosted in
|
||||
* the same process or in several host processes (either on the same machine or
|
||||
* on different machines).
|
||||
*
|
||||
* The framework's code critically depends on the following patterns:
|
||||
|
@ -34,7 +34,8 @@
|
|||
* <item>Smart pointers
|
||||
*
|
||||
* The shared_ptr and weak_ptr template classes are used to simplify memory
|
||||
* management and to avoid accidental memory leaks and use-after-free bugs.</item>
|
||||
* management and to avoid accidental memory leaks and use-after-free
|
||||
* bugs.</item>
|
||||
*
|
||||
* <item>Observer pattern
|
||||
*
|
||||
|
|
|
@ -32,14 +32,14 @@ DEFINE_EXCEPTION_CLASS(OutOfMemoryException);
|
|||
*/
|
||||
class I2_BASE_API Memory
|
||||
{
|
||||
private:
|
||||
Memory(void);
|
||||
|
||||
public:
|
||||
static void *Allocate(size_t size);
|
||||
static void *Reallocate(void *ptr, size_t size);
|
||||
static char *StrDup(const char *str);
|
||||
static void Free(void *ptr);
|
||||
|
||||
private:
|
||||
Memory(void);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -29,19 +29,19 @@ namespace icinga
|
|||
*
|
||||
* @ingroup base
|
||||
*/
|
||||
class I2_BASE_API Object : public enable_shared_from_this<Object>
|
||||
class I2_BASE_API Object : protected enable_shared_from_this<Object>
|
||||
{
|
||||
private:
|
||||
Object(const Object& other);
|
||||
Object operator=(const Object& rhs);
|
||||
public:
|
||||
typedef shared_ptr<Object> Ptr;
|
||||
typedef weak_ptr<Object> WeakPtr;
|
||||
|
||||
protected:
|
||||
Object(void);
|
||||
virtual ~Object(void);
|
||||
|
||||
public:
|
||||
typedef shared_ptr<Object> Ptr;
|
||||
typedef weak_ptr<Object> WeakPtr;
|
||||
private:
|
||||
Object(const Object& other);
|
||||
Object operator=(const Object& rhs);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -44,10 +44,6 @@ class Observable
|
|||
public:
|
||||
typedef function<int (const TArgs&)> ObserverType;
|
||||
|
||||
private:
|
||||
vector<ObserverType> m_Observers;
|
||||
|
||||
public:
|
||||
/**
|
||||
* Adds an observer to this event.
|
||||
*
|
||||
|
@ -89,6 +85,9 @@ public:
|
|||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
vector<ObserverType> m_Observers;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -40,19 +40,6 @@ struct I2_BASE_API SocketErrorEventArgs : public EventArgs
|
|||
*/
|
||||
class I2_BASE_API Socket : public Object
|
||||
{
|
||||
private:
|
||||
SOCKET m_FD; /**< The socket descriptor. */
|
||||
|
||||
int ExceptionEventHandler(const EventArgs& ea);
|
||||
|
||||
static string GetAddressFromSockaddr(sockaddr *address, socklen_t len);
|
||||
|
||||
protected:
|
||||
Socket(void);
|
||||
|
||||
void HandleSocketError(void);
|
||||
virtual void CloseInternal(bool from_dtor);
|
||||
|
||||
public:
|
||||
typedef shared_ptr<Socket> Ptr;
|
||||
typedef weak_ptr<Socket> WeakPtr;
|
||||
|
@ -83,6 +70,19 @@ public:
|
|||
|
||||
string GetClientAddress(void);
|
||||
string GetPeerAddress(void);
|
||||
|
||||
protected:
|
||||
Socket(void);
|
||||
|
||||
void HandleSocketError(void);
|
||||
virtual void CloseInternal(bool from_dtor);
|
||||
|
||||
private:
|
||||
SOCKET m_FD; /**< The socket descriptor. */
|
||||
|
||||
int ExceptionEventHandler(const EventArgs& ea);
|
||||
|
||||
static string GetAddressFromSockaddr(sockaddr *address, socklen_t len);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -43,15 +43,6 @@ enum TcpClientRole
|
|||
*/
|
||||
class I2_BASE_API TcpClient : public TcpSocket
|
||||
{
|
||||
private:
|
||||
TcpClientRole m_Role;
|
||||
|
||||
FIFO::Ptr m_SendQueue;
|
||||
FIFO::Ptr m_RecvQueue;
|
||||
|
||||
virtual int ReadableEventHandler(const EventArgs& ea);
|
||||
virtual int WritableEventHandler(const EventArgs& ea);
|
||||
|
||||
public:
|
||||
typedef shared_ptr<TcpClient> Ptr;
|
||||
typedef weak_ptr<TcpClient> WeakPtr;
|
||||
|
@ -71,6 +62,15 @@ public:
|
|||
virtual bool WantsToWrite(void) const;
|
||||
|
||||
Observable<EventArgs> OnDataAvailable;
|
||||
|
||||
private:
|
||||
TcpClientRole m_Role;
|
||||
|
||||
FIFO::Ptr m_SendQueue;
|
||||
FIFO::Ptr m_RecvQueue;
|
||||
|
||||
virtual int ReadableEventHandler(const EventArgs& ea);
|
||||
virtual int WritableEventHandler(const EventArgs& ea);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -41,11 +41,6 @@ struct I2_BASE_API NewClientEventArgs : public EventArgs
|
|||
*/
|
||||
class I2_BASE_API TcpServer : public TcpSocket
|
||||
{
|
||||
private:
|
||||
int ReadableEventHandler(const EventArgs& ea);
|
||||
|
||||
function<TcpClient::Ptr()> m_ClientFactory;
|
||||
|
||||
public:
|
||||
typedef shared_ptr<TcpServer> Ptr;
|
||||
typedef weak_ptr<TcpServer> WeakPtr;
|
||||
|
@ -62,6 +57,11 @@ public:
|
|||
Observable<NewClientEventArgs> OnNewClient;
|
||||
|
||||
virtual bool WantsToRead(void) const;
|
||||
|
||||
private:
|
||||
int ReadableEventHandler(const EventArgs& ea);
|
||||
|
||||
function<TcpClient::Ptr()> m_ClientFactory;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -30,15 +30,15 @@ namespace icinga
|
|||
*/
|
||||
class I2_BASE_API TcpSocket : public Socket
|
||||
{
|
||||
private:
|
||||
void MakeSocket(int family);
|
||||
|
||||
public:
|
||||
typedef shared_ptr<TcpSocket> Ptr;
|
||||
typedef weak_ptr<TcpSocket> WeakPtr;
|
||||
|
||||
void Bind(string service, int family);
|
||||
void Bind(string node, string service, int family);
|
||||
|
||||
private:
|
||||
void MakeSocket(int family);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
22
base/timer.h
22
base/timer.h
|
@ -41,17 +41,6 @@ struct I2_BASE_API TimerEventArgs : public EventArgs
|
|||
*/
|
||||
class I2_BASE_API Timer : public Object
|
||||
{
|
||||
private:
|
||||
EventArgs m_UserArgs; /**< User-specified event arguments. */
|
||||
unsigned int m_Interval; /**< The interval of the timer. */
|
||||
time_t m_Next; /**< When the next event should happen. */
|
||||
|
||||
static time_t NextCall; /**< When the next event should happen (for all timers). */
|
||||
|
||||
static void RescheduleTimers(void);
|
||||
|
||||
void Call(void);
|
||||
|
||||
public:
|
||||
typedef shared_ptr<Timer> Ptr;
|
||||
typedef weak_ptr<Timer> WeakPtr;
|
||||
|
@ -77,6 +66,17 @@ public:
|
|||
void Reschedule(time_t next);
|
||||
|
||||
Observable<TimerEventArgs> OnTimerExpired;
|
||||
|
||||
private:
|
||||
EventArgs m_UserArgs; /**< User-specified event arguments. */
|
||||
unsigned int m_Interval; /**< The interval of the timer. */
|
||||
time_t m_Next; /**< When the next event should happen. */
|
||||
|
||||
static time_t NextCall; /**< When the next event should happen (for all timers). */
|
||||
|
||||
static void RescheduleTimers(void);
|
||||
|
||||
void Call(void);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -44,6 +44,22 @@ struct I2_BASE_API VerifyCertificateEventArgs : public EventArgs
|
|||
*/
|
||||
class I2_BASE_API TlsClient : public TcpClient
|
||||
{
|
||||
public:
|
||||
TlsClient(TcpClientRole role, shared_ptr<SSL_CTX> sslContext);
|
||||
|
||||
shared_ptr<X509> GetClientCertificate(void) const;
|
||||
shared_ptr<X509> GetPeerCertificate(void) const;
|
||||
|
||||
virtual void Start(void);
|
||||
|
||||
virtual bool WantsToRead(void) const;
|
||||
virtual bool WantsToWrite(void) const;
|
||||
|
||||
Observable<VerifyCertificateEventArgs> OnVerifyCertificate;
|
||||
|
||||
protected:
|
||||
void HandleSSLError(void);
|
||||
|
||||
private:
|
||||
shared_ptr<SSL_CTX> m_SSLContext;
|
||||
shared_ptr<SSL> m_SSL;
|
||||
|
@ -62,22 +78,6 @@ private:
|
|||
static void NullCertificateDeleter(X509 *certificate);
|
||||
|
||||
static int SSLVerifyCertificate(int ok, X509_STORE_CTX *x509Context);
|
||||
|
||||
protected:
|
||||
void HandleSSLError(void);
|
||||
|
||||
public:
|
||||
TlsClient(TcpClientRole role, shared_ptr<SSL_CTX> sslContext);
|
||||
|
||||
shared_ptr<X509> GetClientCertificate(void) const;
|
||||
shared_ptr<X509> GetPeerCertificate(void) const;
|
||||
|
||||
virtual void Start(void);
|
||||
|
||||
virtual bool WantsToRead(void) const;
|
||||
virtual bool WantsToWrite(void) const;
|
||||
|
||||
Observable<VerifyCertificateEventArgs> OnVerifyCertificate;
|
||||
};
|
||||
|
||||
TcpClient::Ptr TlsClientFactory(TcpClientRole role, shared_ptr<SSL_CTX> sslContext);
|
||||
|
|
|
@ -30,13 +30,6 @@ namespace icinga
|
|||
*/
|
||||
class I2_BASE_API Utility
|
||||
{
|
||||
private:
|
||||
static bool m_SSLInitialized;
|
||||
|
||||
Utility(void);
|
||||
|
||||
static void InitializeOpenSSL(void);
|
||||
|
||||
public:
|
||||
/**
|
||||
* Returns a human-readable type name of an object (using RTTI).
|
||||
|
@ -69,6 +62,13 @@ public:
|
|||
static shared_ptr<X509> GetX509Certificate(string pemfile);
|
||||
|
||||
static bool Match(string pattern, string text);
|
||||
|
||||
private:
|
||||
static bool m_SSLInitialized;
|
||||
|
||||
Utility(void);
|
||||
|
||||
static void InitializeOpenSSL(void);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -44,18 +44,6 @@ enum VariantType
|
|||
*/
|
||||
class I2_BASE_API Variant
|
||||
{
|
||||
private:
|
||||
mutable VariantType m_Type; /**< The type of the Variant. */
|
||||
|
||||
mutable long m_IntegerValue; /**< The value of the Variant
|
||||
if m_Type == VariantInteger */
|
||||
mutable string m_StringValue; /**< The value of the Variant
|
||||
if m_Type == VariantString */
|
||||
mutable Object::Ptr m_ObjectValue; /**< The value of the Variant
|
||||
if m_Type == VariantObject */
|
||||
|
||||
void Convert(VariantType newType) const;
|
||||
|
||||
public:
|
||||
inline Variant(void) : m_Type(VariantEmpty) { }
|
||||
|
||||
|
@ -86,6 +74,18 @@ public:
|
|||
operator long(void) const;
|
||||
operator string(void) const;
|
||||
operator Object::Ptr(void) const;
|
||||
|
||||
private:
|
||||
mutable VariantType m_Type; /**< The type of the Variant. */
|
||||
|
||||
mutable long m_IntegerValue; /**< The value of the Variant
|
||||
if m_Type == VariantInteger */
|
||||
mutable string m_StringValue; /**< The value of the Variant
|
||||
if m_Type == VariantString */
|
||||
mutable Object::Ptr m_ObjectValue; /**< The value of the Variant
|
||||
if m_Type == VariantObject */
|
||||
|
||||
void Convert(VariantType newType) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -28,17 +28,17 @@ namespace icinga
|
|||
*/
|
||||
class DemoComponent : public IcingaComponent
|
||||
{
|
||||
public:
|
||||
virtual string GetName(void) const;
|
||||
virtual void Start(void);
|
||||
virtual void Stop(void);
|
||||
|
||||
private:
|
||||
Timer::Ptr m_DemoTimer;
|
||||
VirtualEndpoint::Ptr m_DemoEndpoint;
|
||||
|
||||
int DemoTimerHandler(const TimerEventArgs& tea);
|
||||
int HelloWorldRequestHandler(const NewRequestEventArgs& nrea);
|
||||
|
||||
public:
|
||||
virtual string GetName(void) const;
|
||||
virtual void Start(void);
|
||||
virtual void Stop(void);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -46,6 +46,11 @@ public:
|
|||
*/
|
||||
class DiscoveryComponent : public IcingaComponent
|
||||
{
|
||||
public:
|
||||
virtual string GetName(void) const;
|
||||
virtual void Start(void);
|
||||
virtual void Stop(void);
|
||||
|
||||
private:
|
||||
VirtualEndpoint::Ptr m_DiscoveryEndpoint;
|
||||
map<string, ComponentDiscoveryInfo::Ptr> m_Components;
|
||||
|
@ -76,11 +81,6 @@ private:
|
|||
bool HasMessagePermission(Dictionary::Ptr roles, string messageType, string message);
|
||||
|
||||
static const int RegistrationTTL = 300;
|
||||
|
||||
public:
|
||||
virtual string GetName(void) const;
|
||||
virtual void Start(void);
|
||||
virtual void Stop(void);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -32,21 +32,6 @@ class EndpointManager;
|
|||
*/
|
||||
class I2_ICINGA_API Endpoint : public Object
|
||||
{
|
||||
private:
|
||||
string m_Identity; /**< The identity of this endpoint. */
|
||||
set<string> m_Subscriptions; /**< The topics this endpoint is
|
||||
subscribed to. */
|
||||
set<string> m_Publications; /**< The topics this endpoint is
|
||||
publishing. */
|
||||
bool m_ReceivedWelcome; /**< Have we received a welcome message
|
||||
from this endpoint? */
|
||||
bool m_SentWelcome; /**< Have we sent a welcome message to this
|
||||
endpoint? */
|
||||
|
||||
weak_ptr<EndpointManager> m_EndpointManager; /**< The endpoint manager
|
||||
this endpoint is
|
||||
registered with. */
|
||||
|
||||
public:
|
||||
typedef shared_ptr<Endpoint> Ptr;
|
||||
typedef weak_ptr<Endpoint> WeakPtr;
|
||||
|
@ -96,6 +81,21 @@ public:
|
|||
|
||||
Observable<EventArgs> OnIdentityChanged;
|
||||
Observable<EventArgs> OnSessionEstablished;
|
||||
|
||||
private:
|
||||
string m_Identity; /**< The identity of this endpoint. */
|
||||
set<string> m_Subscriptions; /**< The topics this endpoint is
|
||||
subscribed to. */
|
||||
set<string> m_Publications; /**< The topics this endpoint is
|
||||
publishing. */
|
||||
bool m_ReceivedWelcome; /**< Have we received a welcome message
|
||||
from this endpoint? */
|
||||
bool m_SentWelcome; /**< Have we sent a welcome message to this
|
||||
endpoint? */
|
||||
|
||||
weak_ptr<EndpointManager> m_EndpointManager; /**< The endpoint manager
|
||||
this endpoint is
|
||||
registered with. */
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -40,17 +40,6 @@ struct I2_ICINGA_API NewEndpointEventArgs : public EventArgs
|
|||
*/
|
||||
class I2_ICINGA_API EndpointManager : public Object
|
||||
{
|
||||
string m_Identity;
|
||||
shared_ptr<SSL_CTX> m_SSLContext;
|
||||
|
||||
vector<JsonRpcServer::Ptr> m_Servers;
|
||||
vector<Endpoint::Ptr> m_Endpoints;
|
||||
|
||||
void RegisterServer(JsonRpcServer::Ptr server);
|
||||
void UnregisterServer(JsonRpcServer::Ptr server);
|
||||
|
||||
int NewClientHandler(const NewClientEventArgs& ncea);
|
||||
|
||||
public:
|
||||
typedef shared_ptr<EndpointManager> Ptr;
|
||||
typedef weak_ptr<EndpointManager> WeakPtr;
|
||||
|
@ -76,8 +65,18 @@ public:
|
|||
Endpoint::Ptr GetEndpointByIdentity(string identity) const;
|
||||
|
||||
Observable<NewEndpointEventArgs> OnNewEndpoint;
|
||||
};
|
||||
|
||||
private:
|
||||
string m_Identity;
|
||||
shared_ptr<SSL_CTX> m_SSLContext;
|
||||
|
||||
vector<JsonRpcServer::Ptr> m_Servers;
|
||||
vector<Endpoint::Ptr> m_Endpoints;
|
||||
|
||||
void RegisterServer(JsonRpcServer::Ptr server);
|
||||
void UnregisterServer(JsonRpcServer::Ptr server);
|
||||
|
||||
int NewClientHandler(const NewClientEventArgs& ncea);
|
||||
}
|
||||
|
||||
#endif /* ENDPOINTMANAGER_H */
|
||||
|
|
|
@ -30,29 +30,6 @@ namespace icinga
|
|||
*/
|
||||
class I2_ICINGA_API IcingaApplication : public Application
|
||||
{
|
||||
private:
|
||||
EndpointManager::Ptr m_EndpointManager;
|
||||
|
||||
string m_PrivateKeyFile;
|
||||
string m_PublicKeyFile;
|
||||
string m_CAKeyFile;
|
||||
string m_Node;
|
||||
string m_Service;
|
||||
|
||||
int NewComponentHandler(const EventArgs& ea);
|
||||
int DeletedComponentHandler(const EventArgs& ea);
|
||||
|
||||
int NewIcingaConfigHandler(const EventArgs& ea);
|
||||
int DeletedIcingaConfigHandler(const EventArgs& ea);
|
||||
|
||||
int NewRpcListenerHandler(const EventArgs& ea);
|
||||
int DeletedRpcListenerHandler(const EventArgs& ea);
|
||||
|
||||
int NewRpcConnectionHandler(const EventArgs& ea);
|
||||
int DeletedRpcConnectionHandler(const EventArgs& ea);
|
||||
|
||||
int TestTimerHandler(const TimerEventArgs& tea);
|
||||
|
||||
public:
|
||||
typedef shared_ptr<IcingaApplication> Ptr;
|
||||
typedef weak_ptr<IcingaApplication> WeakPtr;
|
||||
|
@ -75,6 +52,27 @@ public:
|
|||
|
||||
void SetService(string service);
|
||||
string GetService(void) const;
|
||||
|
||||
private:
|
||||
EndpointManager::Ptr m_EndpointManager;
|
||||
|
||||
string m_PrivateKeyFile;
|
||||
string m_PublicKeyFile;
|
||||
string m_CAKeyFile;
|
||||
string m_Node;
|
||||
string m_Service;
|
||||
|
||||
int NewComponentHandler(const EventArgs& ea);
|
||||
int DeletedComponentHandler(const EventArgs& ea);
|
||||
|
||||
int NewIcingaConfigHandler(const EventArgs& ea);
|
||||
int DeletedIcingaConfigHandler(const EventArgs& ea);
|
||||
|
||||
int NewRpcListenerHandler(const EventArgs& ea);
|
||||
int DeletedRpcListenerHandler(const EventArgs& ea);
|
||||
|
||||
int NewRpcConnectionHandler(const EventArgs& ea);
|
||||
int DeletedRpcConnectionHandler(const EventArgs& ea);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -31,17 +31,6 @@ namespace icinga
|
|||
*/
|
||||
class I2_ICINGA_API JsonRpcEndpoint : public Endpoint
|
||||
{
|
||||
private:
|
||||
shared_ptr<SSL_CTX> m_SSLContext;
|
||||
string m_Address;
|
||||
JsonRpcClient::Ptr m_Client;
|
||||
map<string, Endpoint::Ptr> m_PendingCalls;
|
||||
|
||||
int NewMessageHandler(const NewMessageEventArgs& nmea);
|
||||
int ClientClosedHandler(const EventArgs& ea);
|
||||
int ClientErrorHandler(const SocketErrorEventArgs& ea);
|
||||
int VerifyCertificateHandler(const VerifyCertificateEventArgs& ea);
|
||||
|
||||
public:
|
||||
typedef shared_ptr<JsonRpcEndpoint> Ptr;
|
||||
typedef weak_ptr<JsonRpcEndpoint> WeakPtr;
|
||||
|
@ -62,6 +51,17 @@ public:
|
|||
virtual void ProcessResponse(Endpoint::Ptr sender, const ResponseMessage& message);
|
||||
|
||||
virtual void Stop(void);
|
||||
|
||||
private:
|
||||
shared_ptr<SSL_CTX> m_SSLContext;
|
||||
string m_Address;
|
||||
JsonRpcClient::Ptr m_Client;
|
||||
map<string, Endpoint::Ptr> m_PendingCalls;
|
||||
|
||||
int NewMessageHandler(const NewMessageEventArgs& nmea);
|
||||
int ClientClosedHandler(const EventArgs& ea);
|
||||
int ClientErrorHandler(const SocketErrorEventArgs& ea);
|
||||
int VerifyCertificateHandler(const VerifyCertificateEventArgs& ea);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -41,9 +41,6 @@ struct I2_ICINGA_API NewRequestEventArgs : public EventArgs
|
|||
*/
|
||||
class I2_ICINGA_API VirtualEndpoint : public Endpoint
|
||||
{
|
||||
private:
|
||||
map< string, Observable<NewRequestEventArgs> > m_TopicHandlers;
|
||||
|
||||
public:
|
||||
typedef shared_ptr<VirtualEndpoint> Ptr;
|
||||
typedef weak_ptr<VirtualEndpoint> WeakPtr;
|
||||
|
@ -60,6 +57,9 @@ public:
|
|||
virtual void ProcessResponse(Endpoint::Ptr sender, const ResponseMessage& message);
|
||||
|
||||
virtual void Stop(void);
|
||||
|
||||
private:
|
||||
map< string, Observable<NewRequestEventArgs> > m_TopicHandlers;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -40,9 +40,6 @@ struct I2_JSONRPC_API NewMessageEventArgs : public EventArgs
|
|||
*/
|
||||
class I2_JSONRPC_API JsonRpcClient : public TlsClient
|
||||
{
|
||||
private:
|
||||
int DataAvailableHandler(const EventArgs&);
|
||||
|
||||
public:
|
||||
typedef shared_ptr<JsonRpcClient> Ptr;
|
||||
typedef weak_ptr<JsonRpcClient> WeakPtr;
|
||||
|
@ -54,6 +51,9 @@ public:
|
|||
virtual void Start(void);
|
||||
|
||||
Observable<NewMessageEventArgs> OnNewMessage;
|
||||
|
||||
private:
|
||||
int DataAvailableHandler(const EventArgs&);
|
||||
};
|
||||
|
||||
JsonRpcClient::Ptr JsonRpcClientFactory(TcpClientRole role, shared_ptr<SSL_CTX> sslContext);
|
||||
|
|
|
@ -34,12 +34,6 @@ typedef ::cJSON json_t;
|
|||
*/
|
||||
class I2_JSONRPC_API MessagePart
|
||||
{
|
||||
private:
|
||||
Dictionary::Ptr m_Dictionary;
|
||||
|
||||
static Dictionary::Ptr GetDictionaryFromJson(json_t *json);
|
||||
static json_t *GetJsonFromDictionary(const Dictionary::Ptr& dictionary);
|
||||
|
||||
public:
|
||||
MessagePart(void);
|
||||
MessagePart(string json);
|
||||
|
@ -93,6 +87,12 @@ public:
|
|||
|
||||
DictionaryIterator Begin(void);
|
||||
DictionaryIterator End(void);
|
||||
|
||||
private:
|
||||
Dictionary::Ptr m_Dictionary;
|
||||
|
||||
static Dictionary::Ptr GetDictionaryFromJson(json_t *json);
|
||||
static json_t *GetJsonFromDictionary(const Dictionary::Ptr& dictionary);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -39,12 +39,12 @@ DEFINE_EXCEPTION_CLASS(InvalidNetstringException);
|
|||
*/
|
||||
class I2_JSONRPC_API Netstring
|
||||
{
|
||||
private:
|
||||
Netstring(void);
|
||||
|
||||
public:
|
||||
static bool ReadStringFromFIFO(FIFO::Ptr fifo, string *message);
|
||||
static void WriteStringToFIFO(FIFO::Ptr fifo, const string& message);
|
||||
|
||||
private:
|
||||
Netstring(void);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue