mirror of https://github.com/Icinga/icinga2.git
Cleaned up application initialization.
Made code documentation more doxygen-friendly. Added doxygen config file.
This commit is contained in:
parent
bec30888f7
commit
d9b7debdcc
|
@ -28,8 +28,6 @@ using namespace icinga;
|
|||
Application::Ptr I2_EXPORT Application::Instance;
|
||||
|
||||
/**
|
||||
* Application
|
||||
*
|
||||
* Constructor for the Application class.
|
||||
*/
|
||||
Application::Application(void)
|
||||
|
@ -57,8 +55,6 @@ Application::Application(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* ~Application
|
||||
*
|
||||
* Destructor for the application class.
|
||||
*/
|
||||
Application::~Application(void)
|
||||
|
@ -79,8 +75,6 @@ Application::~Application(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* RunEventLoop
|
||||
*
|
||||
* Processes events (e.g. sockets and timers).
|
||||
*/
|
||||
void Application::RunEventLoop(void)
|
||||
|
@ -180,8 +174,6 @@ void Application::RunEventLoop(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* Shutdown
|
||||
*
|
||||
* Signals the application to shut down during the next
|
||||
* execution of the event loop.
|
||||
*/
|
||||
|
@ -191,8 +183,6 @@ void Application::Shutdown(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* GetConfigHive
|
||||
*
|
||||
* Returns the application's configuration hive.
|
||||
*
|
||||
* @returns The config hive.
|
||||
|
@ -203,9 +193,7 @@ ConfigHive::Ptr Application::GetConfigHive(void) const
|
|||
}
|
||||
|
||||
/**
|
||||
* LoadComponent
|
||||
*
|
||||
* Loads a component from a library.
|
||||
* Loads a component from a shared library.
|
||||
*
|
||||
* @param path The path of the component library.
|
||||
* @param componentConfig The configuration for the component.
|
||||
|
@ -251,8 +239,6 @@ Component::Ptr Application::LoadComponent(const string& path,
|
|||
}
|
||||
|
||||
/**
|
||||
* RegisterComponent
|
||||
*
|
||||
* Registers a component object and starts it.
|
||||
*
|
||||
* @param component The component.
|
||||
|
@ -266,8 +252,6 @@ void Application::RegisterComponent(Component::Ptr component)
|
|||
}
|
||||
|
||||
/**
|
||||
* UnregisterComponent
|
||||
*
|
||||
* Unregisters a component object and stops it.
|
||||
*
|
||||
* @param component The component.
|
||||
|
@ -285,8 +269,6 @@ void Application::UnregisterComponent(Component::Ptr component)
|
|||
}
|
||||
|
||||
/**
|
||||
* GetComponent
|
||||
*
|
||||
* Finds a loaded component by name.
|
||||
*
|
||||
* @param name The name of the component.
|
||||
|
@ -303,8 +285,6 @@ Component::Ptr Application::GetComponent(const string& name)
|
|||
}
|
||||
|
||||
/**
|
||||
* Log
|
||||
*
|
||||
* Logs a message.
|
||||
*
|
||||
* @param message The message.
|
||||
|
@ -323,9 +303,7 @@ void Application::Log(string message)
|
|||
}
|
||||
|
||||
/**
|
||||
* SetArguments
|
||||
*
|
||||
* Sets the application's arguments.
|
||||
* Sets the application's command line arguments.
|
||||
*
|
||||
* @param arguments The arguments.
|
||||
*/
|
||||
|
@ -335,9 +313,7 @@ void Application::SetArguments(const vector<string>& arguments)
|
|||
}
|
||||
|
||||
/**
|
||||
* GetArguments
|
||||
*
|
||||
* Retrieves the application's arguments.
|
||||
* Retrieves the application's command line arguments.
|
||||
*
|
||||
* @returns The arguments.
|
||||
*/
|
||||
|
@ -347,8 +323,6 @@ const vector<string>& Application::GetArguments(void) const
|
|||
}
|
||||
|
||||
/**
|
||||
* GetExeDirectory
|
||||
*
|
||||
* Retrieves the directory the application's binary is contained in.
|
||||
*
|
||||
* @returns The directory.
|
||||
|
@ -429,8 +403,6 @@ string Application::GetExeDirectory(void) const
|
|||
}
|
||||
|
||||
/**
|
||||
* AddComponentSearchDir
|
||||
*
|
||||
* Adds a directory to the component search path.
|
||||
*
|
||||
* @param componentDirectory The directory.
|
||||
|
@ -445,8 +417,6 @@ void Application::AddComponentSearchDir(const string& componentDirectory)
|
|||
}
|
||||
|
||||
/**
|
||||
* IsDebugging
|
||||
*
|
||||
* Retrieves the debugging mode of the application.
|
||||
*
|
||||
* @returns true if the application is being debugged, false otherwise
|
||||
|
@ -458,8 +428,6 @@ bool Application::IsDebugging(void) const
|
|||
|
||||
#ifndef _WIN32
|
||||
/**
|
||||
* ApplicationSigIntHandler
|
||||
*
|
||||
* Signal handler for SIGINT.
|
||||
*
|
||||
* @param signum The signal number.
|
||||
|
@ -478,8 +446,6 @@ static void ApplicationSigIntHandler(int signum)
|
|||
#endif /* _WIN32 */
|
||||
|
||||
/**
|
||||
* RunApplication
|
||||
*
|
||||
* Runs the specified application.
|
||||
*
|
||||
* @param argc The number of arguments.
|
||||
|
@ -487,11 +453,13 @@ static void ApplicationSigIntHandler(int signum)
|
|||
* @param instance The application instance.
|
||||
* @returns The application's exit code.
|
||||
*/
|
||||
int icinga::RunApplication(int argc, char **argv, Application *instance)
|
||||
int icinga::RunApplication(int argc, char **argv, Application::Ptr instance)
|
||||
{
|
||||
int result;
|
||||
|
||||
Application::Instance = Application::Ptr(instance);
|
||||
assert(!Application::Instance);
|
||||
|
||||
Application::Instance = instance;
|
||||
|
||||
#ifndef _WIN32
|
||||
struct sigaction sa;
|
||||
|
|
|
@ -68,14 +68,8 @@ public:
|
|||
bool IsDebugging(void) const;
|
||||
};
|
||||
|
||||
int I2_EXPORT RunApplication(int argc, char **argv, Application *instance);
|
||||
int I2_EXPORT RunApplication(int argc, char **argv, Application::Ptr instance);
|
||||
|
||||
}
|
||||
|
||||
#define IMPLEMENT_ENTRY_POINT(klass) \
|
||||
int main(int argc, char **argv) { \
|
||||
klass *instance = new klass(); \
|
||||
return icinga::RunApplication(argc, argv, instance); \
|
||||
}
|
||||
|
||||
#endif /* APPLICATION_H */
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
using namespace icinga;
|
||||
|
||||
/**
|
||||
* SetApplication
|
||||
*
|
||||
* Sets the application this component belongs to.
|
||||
*
|
||||
* @param application The application.
|
||||
|
@ -34,8 +32,6 @@ void Component::SetApplication(const Application::WeakPtr& application)
|
|||
}
|
||||
|
||||
/**
|
||||
* GetApplication
|
||||
*
|
||||
* Retrieves the application this component belongs to.
|
||||
*
|
||||
* @returns The application.
|
||||
|
@ -46,8 +42,6 @@ Application::Ptr Component::GetApplication(void) const
|
|||
}
|
||||
|
||||
/**
|
||||
* SetConfig
|
||||
*
|
||||
* Sets the configuration for this component.
|
||||
*
|
||||
* @param componentConfig The configuration.
|
||||
|
@ -58,8 +52,6 @@ void Component::SetConfig(const ConfigObject::Ptr& componentConfig)
|
|||
}
|
||||
|
||||
/**
|
||||
* GetConfig
|
||||
*
|
||||
* Retrieves the configuration for this component.
|
||||
*
|
||||
* @returns The configuration.
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
using namespace icinga;
|
||||
|
||||
/**
|
||||
* CondVar
|
||||
*
|
||||
* Constructor for the CondVar class.
|
||||
*/
|
||||
CondVar::CondVar(void)
|
||||
|
@ -36,8 +34,6 @@ CondVar::CondVar(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* ~CondVar
|
||||
*
|
||||
* Destructor for the CondVar class.
|
||||
*/
|
||||
CondVar::~CondVar(void)
|
||||
|
@ -50,8 +46,6 @@ CondVar::~CondVar(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* Wait
|
||||
*
|
||||
* Waits for the condition variable to be signaled. Releases the specified mutex
|
||||
* before it begins to wait and re-acquires the mutex after waiting.
|
||||
*
|
||||
|
@ -67,8 +61,6 @@ void CondVar::Wait(Mutex& mtx)
|
|||
}
|
||||
|
||||
/**
|
||||
* Signal
|
||||
*
|
||||
* Wakes up at least one waiting thread.
|
||||
*/
|
||||
void CondVar::Signal(void)
|
||||
|
@ -81,8 +73,6 @@ void CondVar::Signal(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* Broadcast
|
||||
*
|
||||
* Wakes up all waiting threads.
|
||||
*/
|
||||
void CondVar::Broadcast(void)
|
||||
|
@ -95,8 +85,6 @@ void CondVar::Broadcast(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* Get
|
||||
*
|
||||
* Retrieves the platform-specific condition variable handle.
|
||||
*
|
||||
* @returns The platform-specific condition variable handle.
|
||||
|
|
|
@ -24,8 +24,6 @@ namespace icinga
|
|||
{
|
||||
|
||||
/**
|
||||
* CondVar
|
||||
*
|
||||
* A wrapper around OS-specific condition variable functionality.
|
||||
*/
|
||||
class I2_BASE_API CondVar
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
using namespace icinga;
|
||||
|
||||
/**
|
||||
* SetHive
|
||||
*
|
||||
* Sets the hive this collection belongs to.
|
||||
*
|
||||
* @param hive The hive.
|
||||
|
@ -34,8 +32,6 @@ void ConfigCollection::SetHive(const ConfigHive::WeakPtr& hive)
|
|||
}
|
||||
|
||||
/**
|
||||
* GetHive
|
||||
*
|
||||
* Retrieves the hive this collection belongs to.
|
||||
*
|
||||
* @returns The hive.
|
||||
|
@ -46,8 +42,6 @@ ConfigHive::WeakPtr ConfigCollection::GetHive(void) const
|
|||
}
|
||||
|
||||
/**
|
||||
* AddObject
|
||||
*
|
||||
* Adds a new object to this collection.
|
||||
*
|
||||
* @param object The new object.
|
||||
|
@ -61,8 +55,6 @@ void ConfigCollection::AddObject(const ConfigObject::Ptr& object)
|
|||
}
|
||||
|
||||
/**
|
||||
* RemoveObject
|
||||
*
|
||||
* Removes an object from this collection
|
||||
*
|
||||
* @param object The object that is to be removed.
|
||||
|
@ -85,8 +77,6 @@ void ConfigCollection::RemoveObject(const ConfigObject::Ptr& object)
|
|||
}
|
||||
|
||||
/**
|
||||
* GetObject
|
||||
*
|
||||
* Retrieves an object by name.
|
||||
*
|
||||
* @param name The name of the object.
|
||||
|
@ -104,8 +94,6 @@ ConfigObject::Ptr ConfigCollection::GetObject(const string& name) const
|
|||
}
|
||||
|
||||
/**
|
||||
* ForEachObject
|
||||
*
|
||||
* Invokes the specified callback for each object contained in this collection.
|
||||
*
|
||||
* @param callback The callback.
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
using namespace icinga;
|
||||
|
||||
/**
|
||||
* AddObject
|
||||
*
|
||||
* Adds a new object to this hive.
|
||||
*
|
||||
* @param object The new object.
|
||||
|
@ -35,8 +33,6 @@ void ConfigHive::AddObject(const ConfigObject::Ptr& object)
|
|||
}
|
||||
|
||||
/**
|
||||
* RemoveObject
|
||||
*
|
||||
* Removes an object from this hive.
|
||||
*
|
||||
* @param object The object that is to be removed.
|
||||
|
@ -47,8 +43,6 @@ void ConfigHive::RemoveObject(const ConfigObject::Ptr& object)
|
|||
}
|
||||
|
||||
/**
|
||||
* GetObject
|
||||
*
|
||||
* Retrieves an object by type and name.
|
||||
*
|
||||
* @param type The type of the object.
|
||||
|
@ -62,8 +56,6 @@ ConfigObject::Ptr ConfigHive::GetObject(const string& type, const string& name)
|
|||
}
|
||||
|
||||
/**
|
||||
* GetCollection
|
||||
*
|
||||
* Retrieves a collection by name. Creates an empty collection
|
||||
* if the collection doesn't already exist.
|
||||
*
|
||||
|
@ -84,8 +76,6 @@ ConfigCollection::Ptr ConfigHive::GetCollection(const string& collection)
|
|||
}
|
||||
|
||||
/**
|
||||
* ForEachObject
|
||||
*
|
||||
* Invokes the specified callback for each object contained in this hive.
|
||||
*
|
||||
* @param callback The callback.
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
using namespace icinga;
|
||||
|
||||
/**
|
||||
* ConfigObject
|
||||
*
|
||||
* Constructor for the ConfigObject class.
|
||||
*
|
||||
* @param type The type of the object.
|
||||
|
@ -37,8 +35,6 @@ ConfigObject::ConfigObject(const string& type, const string& name)
|
|||
}
|
||||
|
||||
/**
|
||||
* SetHive
|
||||
*
|
||||
* Sets the hive this object belongs to.
|
||||
*
|
||||
* @param hive The hive.
|
||||
|
@ -52,8 +48,6 @@ void ConfigObject::SetHive(const ConfigHive::WeakPtr& hive)
|
|||
}
|
||||
|
||||
/**
|
||||
* GetHive
|
||||
*
|
||||
* Retrieves the hive this object belongs to.
|
||||
*
|
||||
* @returns The hive.
|
||||
|
@ -64,8 +58,6 @@ ConfigHive::WeakPtr ConfigObject::GetHive(void) const
|
|||
}
|
||||
|
||||
/**
|
||||
* SetName
|
||||
*
|
||||
* Sets the name of this object.
|
||||
*
|
||||
* @param name The name.
|
||||
|
@ -76,8 +68,6 @@ void ConfigObject::SetName(const string& name)
|
|||
}
|
||||
|
||||
/**
|
||||
* GetName
|
||||
*
|
||||
* Retrieves the name of this object.
|
||||
*
|
||||
* @returns The name.
|
||||
|
@ -88,8 +78,6 @@ string ConfigObject::GetName(void) const
|
|||
}
|
||||
|
||||
/**
|
||||
* SetType
|
||||
*
|
||||
* Sets the type of this object.
|
||||
*
|
||||
* @param type The type.
|
||||
|
@ -100,8 +88,6 @@ void ConfigObject::SetType(const string& type)
|
|||
}
|
||||
|
||||
/**
|
||||
* GetType
|
||||
*
|
||||
* Retrieves the type of this object.
|
||||
*
|
||||
* @returns The type.
|
||||
|
@ -112,8 +98,6 @@ string ConfigObject::GetType(void) const
|
|||
}
|
||||
|
||||
/**
|
||||
* SetReplicated
|
||||
*
|
||||
* Sets whether this object was replicated.
|
||||
*
|
||||
* @param replicated Whether this object was replicated.
|
||||
|
@ -124,8 +108,6 @@ void ConfigObject::SetReplicated(bool replicated)
|
|||
}
|
||||
|
||||
/**
|
||||
* GetReplicated
|
||||
*
|
||||
* Retrieves whether this object was replicated.
|
||||
*
|
||||
* @returns Whether this object was replicated.
|
||||
|
@ -136,8 +118,6 @@ bool ConfigObject::GetReplicated(void) const
|
|||
}
|
||||
|
||||
/**
|
||||
* Commit
|
||||
*
|
||||
* Handles changed properties by propagating them to the hive
|
||||
* and collection this object is contained in.
|
||||
*
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
using namespace icinga;
|
||||
|
||||
/**
|
||||
* GetProperty
|
||||
*
|
||||
* Retrieves a value from the dictionary.
|
||||
*
|
||||
* @param key The key.
|
||||
|
@ -42,8 +40,6 @@ bool Dictionary::GetProperty(string key, Variant *value) const
|
|||
}
|
||||
|
||||
/**
|
||||
* SetProperty
|
||||
*
|
||||
* Sets a value in the dictionary.
|
||||
*
|
||||
* @param key The key.
|
||||
|
@ -70,8 +66,6 @@ void Dictionary::SetProperty(string key, const Variant& value)
|
|||
}
|
||||
|
||||
/**
|
||||
* GetPropertyString
|
||||
*
|
||||
* Retrieves a value from the dictionary and converts it to a string.
|
||||
*
|
||||
* @param key The key.
|
||||
|
@ -90,8 +84,6 @@ bool Dictionary::GetPropertyString(string key, string *value)
|
|||
}
|
||||
|
||||
/**
|
||||
* SetPropertyString
|
||||
*
|
||||
* Sets a value in the dictionary.
|
||||
*
|
||||
* @param key The key.
|
||||
|
@ -103,8 +95,6 @@ void Dictionary::SetPropertyString(string key, const string& value)
|
|||
}
|
||||
|
||||
/**
|
||||
* GetPropertyInteger
|
||||
*
|
||||
* Retrieves a value from the dictionary and converts it to an integer.
|
||||
*
|
||||
* @param key The key.
|
||||
|
@ -123,8 +113,6 @@ bool Dictionary::GetPropertyInteger(string key, long *value)
|
|||
}
|
||||
|
||||
/**
|
||||
* SetPropertyInteger
|
||||
*
|
||||
* Sets a value in the dictionary.
|
||||
*
|
||||
* @param key The key.
|
||||
|
@ -136,8 +124,6 @@ void Dictionary::SetPropertyInteger(string key, long value)
|
|||
}
|
||||
|
||||
/**
|
||||
* GetPropertyDictionary
|
||||
*
|
||||
* Retrieves a value from the dictionary and converts it to a dictionary.
|
||||
*
|
||||
* @param key The key.
|
||||
|
@ -163,8 +149,6 @@ bool Dictionary::GetPropertyDictionary(string key, Dictionary::Ptr *value)
|
|||
}
|
||||
|
||||
/**
|
||||
* SetPropertyDictionary
|
||||
*
|
||||
* Sets a value in the dictionary.
|
||||
*
|
||||
* @param key The key.
|
||||
|
@ -176,8 +160,6 @@ void Dictionary::SetPropertyDictionary(string key, const Dictionary::Ptr& value)
|
|||
}
|
||||
|
||||
/**
|
||||
* GetPropertyObject
|
||||
*
|
||||
* Retrieves a value from the dictionary and converts it to an object.
|
||||
*
|
||||
* @param key The key.
|
||||
|
@ -196,8 +178,6 @@ bool Dictionary::GetPropertyObject(string key, Object::Ptr *value)
|
|||
}
|
||||
|
||||
/**
|
||||
* SetPropertyObject
|
||||
*
|
||||
* Sets a value in the dictionary.
|
||||
*
|
||||
* @param key The key.
|
||||
|
@ -209,8 +189,6 @@ void Dictionary::SetPropertyObject(string key, const Object::Ptr& value)
|
|||
}
|
||||
|
||||
/**
|
||||
* Begin
|
||||
*
|
||||
* Returns an iterator to the beginning of the dictionary.
|
||||
*
|
||||
* @returns An iterator.
|
||||
|
@ -221,8 +199,6 @@ DictionaryIterator Dictionary::Begin(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* End
|
||||
*
|
||||
* Returns an iterator to the end of the dictionary.
|
||||
*
|
||||
* @returns An iterator.
|
||||
|
@ -233,8 +209,6 @@ DictionaryIterator Dictionary::End(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* GetLength
|
||||
*
|
||||
* Returns the number of elements in the dictionary.
|
||||
*
|
||||
* @returns Number of elements.
|
||||
|
@ -245,8 +219,6 @@ long Dictionary::GetLength(void) const
|
|||
}
|
||||
|
||||
/**
|
||||
* AddUnnamedProperty
|
||||
*
|
||||
* Adds an unnamed value to the dictionary.
|
||||
*
|
||||
* @param value The value.
|
||||
|
@ -269,8 +241,6 @@ void Dictionary::AddUnnamedProperty(const Variant& value)
|
|||
}
|
||||
|
||||
/**
|
||||
* AddUnnamedPropertyString
|
||||
*
|
||||
* Adds an unnamed value to the dictionary.
|
||||
*
|
||||
* @param value The value.
|
||||
|
@ -281,8 +251,6 @@ void Dictionary::AddUnnamedPropertyString(const string& value)
|
|||
}
|
||||
|
||||
/**
|
||||
* AddUnnamedPropertyInteger
|
||||
*
|
||||
* Adds an unnamed value to the dictionary.
|
||||
*
|
||||
* @param value The value.
|
||||
|
@ -293,8 +261,6 @@ void Dictionary::AddUnnamedPropertyInteger(long value)
|
|||
}
|
||||
|
||||
/**
|
||||
* AddUnnamedPropertyDictionary
|
||||
*
|
||||
* Adds an unnamed value to the dictionary.
|
||||
*
|
||||
* @param value The value.
|
||||
|
@ -305,8 +271,6 @@ void Dictionary::AddUnnamedPropertyDictionary(const Dictionary::Ptr& value)
|
|||
}
|
||||
|
||||
/**
|
||||
* AddUnnamedPropertyObject
|
||||
*
|
||||
* Adds an unnamed value to the dictionary.
|
||||
*
|
||||
* @param value The value.
|
||||
|
|
|
@ -39,8 +39,6 @@ private:
|
|||
|
||||
public:
|
||||
/**
|
||||
* operator +=
|
||||
*
|
||||
* Adds a delegate to this event.
|
||||
*
|
||||
* @param rhs The delegate.
|
||||
|
@ -52,8 +50,6 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* operator -=
|
||||
*
|
||||
* Removes a delegate from this event.
|
||||
*
|
||||
* @param rhs The delegate.
|
||||
|
@ -65,8 +61,6 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* operator ()
|
||||
*
|
||||
* Invokes each delegate that is registered for this event. Any delegates
|
||||
* which return -1 are removed.
|
||||
*
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
using namespace icinga;
|
||||
|
||||
/**
|
||||
* Exception
|
||||
*
|
||||
* Default constructor for the Exception class.
|
||||
*/
|
||||
Exception::Exception(void)
|
||||
|
@ -31,8 +29,6 @@ Exception::Exception(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* Exception
|
||||
*
|
||||
* Constructor for the exception class.
|
||||
*
|
||||
* @param message A message describing the exception.
|
||||
|
@ -43,8 +39,6 @@ Exception::Exception(const string& message)
|
|||
}
|
||||
|
||||
/**
|
||||
* GetMessage
|
||||
*
|
||||
* Retrieves the description for the exception.
|
||||
*
|
||||
* @returns The description.
|
||||
|
@ -55,8 +49,6 @@ string Exception::GetMessage(void) const
|
|||
}
|
||||
|
||||
/**
|
||||
* SetMessage
|
||||
*
|
||||
* Sets the description for the exception.
|
||||
*
|
||||
* @param message The description.
|
||||
|
@ -68,8 +60,6 @@ void Exception::SetMessage(string message)
|
|||
|
||||
#ifdef _WIN32
|
||||
/**
|
||||
* FormatError
|
||||
*
|
||||
* Formats an Win32 error code.
|
||||
*
|
||||
* @param code The error code.
|
||||
|
@ -94,8 +84,6 @@ string Win32Exception::FormatErrorCode(int code)
|
|||
#endif /* _WIN32 */
|
||||
|
||||
/**
|
||||
* FormatError
|
||||
*
|
||||
* Formats a Posix error code.
|
||||
*
|
||||
* @param code The error code.
|
||||
|
@ -107,8 +95,6 @@ string PosixException::FormatErrorCode(int code)
|
|||
}
|
||||
|
||||
/**
|
||||
* FormatError
|
||||
*
|
||||
* Formats an OpenSSL error code.
|
||||
*
|
||||
* @param code The error code.
|
||||
|
|
|
@ -41,9 +41,7 @@ public:
|
|||
Exception(const string& message);
|
||||
|
||||
/**
|
||||
* ~Exception
|
||||
*
|
||||
* Required for RTTI.
|
||||
* Destructor for the Exception class. Required for RTTI.
|
||||
*/
|
||||
virtual ~Exception(void)
|
||||
{
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
using namespace icinga;
|
||||
|
||||
/**
|
||||
* FIFO
|
||||
*
|
||||
* Constructor for the FIFO class.
|
||||
*/
|
||||
FIFO::FIFO(void)
|
||||
|
@ -35,8 +33,6 @@ FIFO::FIFO(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* ~FIFO
|
||||
*
|
||||
* Destructor for the FIFO class.
|
||||
*/
|
||||
FIFO::~FIFO(void)
|
||||
|
@ -45,8 +41,6 @@ FIFO::~FIFO(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* ResizeBuffer
|
||||
*
|
||||
* Resizes the FIFO's buffer so that it is at least newSize bytes long.
|
||||
*
|
||||
* @param newSize The minimum new size of the FIFO buffer.
|
||||
|
@ -63,8 +57,6 @@ void FIFO::ResizeBuffer(size_t newSize)
|
|||
}
|
||||
|
||||
/**
|
||||
* Optimize
|
||||
*
|
||||
* Optimizes memory usage of the FIFO buffer by reallocating
|
||||
* and moving the buffer.
|
||||
*/
|
||||
|
@ -93,8 +85,6 @@ void FIFO::Optimize(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* GetSize
|
||||
*
|
||||
* Returns the number of bytes that are contained in the FIFO.
|
||||
*
|
||||
* @returns The number of bytes.
|
||||
|
@ -105,8 +95,6 @@ size_t FIFO::GetSize(void) const
|
|||
}
|
||||
|
||||
/**
|
||||
* GetReadBuffer
|
||||
*
|
||||
* Returns a pointer to the start of the read buffer.
|
||||
*
|
||||
* @returns Pointer to the read buffer.
|
||||
|
@ -117,8 +105,6 @@ const void *FIFO::GetReadBuffer(void) const
|
|||
}
|
||||
|
||||
/**
|
||||
* Read
|
||||
*
|
||||
* Reads data from the FIFO and places it in the specified buffer.
|
||||
*
|
||||
* @param buffer The buffer where the data should be placed (can be NULL if
|
||||
|
@ -142,8 +128,6 @@ size_t FIFO::Read(void *buffer, size_t count)
|
|||
}
|
||||
|
||||
/**
|
||||
* GetWriteBuffer
|
||||
*
|
||||
* Returns a pointer to the start of the write buffer.
|
||||
*
|
||||
* @param count Minimum size of the buffer; on return this parameter
|
||||
|
@ -159,8 +143,6 @@ void *FIFO::GetWriteBuffer(size_t *count)
|
|||
}
|
||||
|
||||
/**
|
||||
* Write
|
||||
*
|
||||
* Writes data to the FIFO.
|
||||
*
|
||||
* @param buffer The data that is to be written (can be NULL if the writer has
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
using namespace icinga;
|
||||
|
||||
/**
|
||||
* Memory
|
||||
*
|
||||
* Constructor for the memory class.
|
||||
*/
|
||||
Memory::Memory(void)
|
||||
|
@ -31,8 +29,6 @@ Memory::Memory(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* Allocate
|
||||
*
|
||||
* Allocates memory. Throws an exception if no memory is available. Alignment
|
||||
* guarantees are the same like for malloc().
|
||||
*
|
||||
|
@ -50,8 +46,6 @@ void *Memory::Allocate(size_t size)
|
|||
}
|
||||
|
||||
/**
|
||||
* Reallocate
|
||||
*
|
||||
* Resizes a block of memory. Throws an exception if no memory is available.
|
||||
*
|
||||
* @param ptr The old memory block or NULL.
|
||||
|
@ -69,8 +63,6 @@ void *Memory::Reallocate(void *ptr, size_t size)
|
|||
}
|
||||
|
||||
/**
|
||||
* StrDup
|
||||
*
|
||||
* Duplicates a string. Throws an exception if no memory is available.
|
||||
*
|
||||
* @param str The string.
|
||||
|
@ -87,8 +79,6 @@ char *Memory::StrDup(const char *str)
|
|||
}
|
||||
|
||||
/**
|
||||
* Free
|
||||
*
|
||||
* Frees a memory block.
|
||||
*
|
||||
* @param ptr The memory block.
|
||||
|
|
|
@ -26,8 +26,6 @@ namespace icinga
|
|||
DEFINE_EXCEPTION_CLASS(OutOfMemoryException);
|
||||
|
||||
/**
|
||||
* Memory
|
||||
*
|
||||
* Singleton class which implements memory allocation helpers.
|
||||
*/
|
||||
class I2_BASE_API Memory
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
using namespace icinga;
|
||||
|
||||
/**
|
||||
* Mutex
|
||||
*
|
||||
* Constructor for the Mutex class.
|
||||
*/
|
||||
Mutex::Mutex(void)
|
||||
|
@ -36,8 +34,6 @@ Mutex::Mutex(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* ~Mutex
|
||||
*
|
||||
* Destructor for the Mutex class.
|
||||
*/
|
||||
Mutex::~Mutex(void)
|
||||
|
@ -50,8 +46,6 @@ Mutex::~Mutex(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* TryEnter
|
||||
*
|
||||
* Tries to lock the mutex. If the mutex cannot be immediatelly
|
||||
* locked the operation fails.
|
||||
*
|
||||
|
@ -67,8 +61,6 @@ bool Mutex::TryEnter(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* Enter
|
||||
*
|
||||
* Locks the mutex.
|
||||
*/
|
||||
void Mutex::Enter(void)
|
||||
|
@ -81,8 +73,6 @@ void Mutex::Enter(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* Exit
|
||||
*
|
||||
* Unlocks the mutex.
|
||||
*/
|
||||
void Mutex::Exit(void)
|
||||
|
@ -95,8 +85,6 @@ void Mutex::Exit(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* Get
|
||||
*
|
||||
* Retrieves the platform-specific mutex handle.
|
||||
*
|
||||
* @returns The platform-specific mutex handle.
|
||||
|
|
|
@ -24,8 +24,6 @@ namespace icinga
|
|||
{
|
||||
|
||||
/**
|
||||
* Mutex
|
||||
*
|
||||
* A wrapper around OS-specific mutex functionality.
|
||||
*/
|
||||
class I2_BASE_API Mutex
|
||||
|
|
|
@ -20,3 +20,17 @@
|
|||
#include "i2-base.h"
|
||||
|
||||
using namespace icinga;
|
||||
|
||||
/**
|
||||
* Default constructor for the Object class.
|
||||
*/
|
||||
Object::Object(void)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor for the Object class.
|
||||
*/
|
||||
Object::~Object(void)
|
||||
{
|
||||
}
|
|
@ -24,8 +24,6 @@ namespace icinga
|
|||
{
|
||||
|
||||
/**
|
||||
* Object
|
||||
*
|
||||
* Base class for all heap-allocated objects. At least one of its methods
|
||||
* has to be virtual for RTTI to work.
|
||||
*/
|
||||
|
@ -35,13 +33,8 @@ private:
|
|||
Object(const Object& other);
|
||||
|
||||
protected:
|
||||
inline Object(void)
|
||||
{
|
||||
}
|
||||
|
||||
inline virtual ~Object(void)
|
||||
{
|
||||
}
|
||||
Object(void);
|
||||
virtual ~Object(void);
|
||||
|
||||
public:
|
||||
typedef shared_ptr<Object> Ptr;
|
||||
|
|
|
@ -22,16 +22,12 @@
|
|||
using namespace icinga;
|
||||
|
||||
/**
|
||||
* Socket::Sockets
|
||||
*
|
||||
* A collection of weak pointers to Socket objects which have been
|
||||
* registered with the socket sub-system.
|
||||
*/
|
||||
Socket::CollectionType Socket::Sockets;
|
||||
|
||||
/**
|
||||
* Socket
|
||||
*
|
||||
* Constructor for the Socket class.
|
||||
*/
|
||||
Socket::Socket(void)
|
||||
|
@ -40,8 +36,6 @@ Socket::Socket(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* ~Socket
|
||||
*
|
||||
* Destructor for the Socket class.
|
||||
*/
|
||||
Socket::~Socket(void)
|
||||
|
@ -50,8 +44,6 @@ Socket::~Socket(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* Start
|
||||
*
|
||||
* Registers the socket and starts handling events for it.
|
||||
*/
|
||||
void Socket::Start(void)
|
||||
|
@ -64,8 +56,6 @@ void Socket::Start(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* Stop
|
||||
*
|
||||
* Unregisters the sockets and stops handling events for it.
|
||||
*/
|
||||
void Socket::Stop(void)
|
||||
|
@ -74,8 +64,6 @@ void Socket::Stop(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* SetFD
|
||||
*
|
||||
* Sets the file descriptor for this socket object.
|
||||
*
|
||||
* @param fd The file descriptor.
|
||||
|
@ -102,8 +90,6 @@ void Socket::SetFD(SOCKET fd)
|
|||
}
|
||||
|
||||
/**
|
||||
* GetFD
|
||||
*
|
||||
* Retrieves the file descriptor for this socket object.
|
||||
*
|
||||
* @returns The file descriptor.
|
||||
|
@ -114,8 +100,6 @@ SOCKET Socket::GetFD(void) const
|
|||
}
|
||||
|
||||
/**
|
||||
* Close
|
||||
*
|
||||
* Closes the socket.
|
||||
*/
|
||||
void Socket::Close(void)
|
||||
|
@ -124,8 +108,6 @@ void Socket::Close(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* CloseInternal
|
||||
*
|
||||
* Closes the socket.
|
||||
*
|
||||
* @param from_dtor Whether this method was called from the destructor.
|
||||
|
@ -150,8 +132,6 @@ void Socket::CloseInternal(bool from_dtor)
|
|||
}
|
||||
|
||||
/**
|
||||
* HandleSocketError
|
||||
*
|
||||
* Handles a socket error by calling the OnError event.
|
||||
*/
|
||||
void Socket::HandleSocketError(void)
|
||||
|
@ -177,8 +157,6 @@ void Socket::HandleSocketError(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* ExceptionEventHandler
|
||||
*
|
||||
* Processes errors that have occured for the socket.
|
||||
*
|
||||
* @param - Event arguments for the socket error.
|
||||
|
@ -192,8 +170,6 @@ int Socket::ExceptionEventHandler(const EventArgs&)
|
|||
}
|
||||
|
||||
/**
|
||||
* WantsToRead
|
||||
*
|
||||
* Checks whether data should be read for this socket object.
|
||||
*
|
||||
* @returns true if the socket should be registered for reading, false otherwise.
|
||||
|
@ -204,8 +180,6 @@ bool Socket::WantsToRead(void) const
|
|||
}
|
||||
|
||||
/**
|
||||
* WantsToWrite
|
||||
*
|
||||
* Checks whether data should be written for this socket object.
|
||||
*
|
||||
* @returns true if the socket should be registered for writing, false otherwise.
|
||||
|
@ -216,8 +190,6 @@ bool Socket::WantsToWrite(void) const
|
|||
}
|
||||
|
||||
/**
|
||||
* GetAddressFromSockaddr
|
||||
*
|
||||
* Formats a sockaddr in a human-readable way.
|
||||
*
|
||||
* @returns A string describing the sockaddr.
|
||||
|
@ -236,8 +208,6 @@ string Socket::GetAddressFromSockaddr(sockaddr *address, socklen_t len)
|
|||
}
|
||||
|
||||
/**
|
||||
* GetClientAddress
|
||||
*
|
||||
* Returns a string describing the local address of the socket.
|
||||
*
|
||||
* @returns A string describing the local address.
|
||||
|
@ -257,8 +227,6 @@ string Socket::GetClientAddress(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* GetPeerAddress
|
||||
*
|
||||
* Returns a string describing the peer address of the socket.
|
||||
*
|
||||
* @returns A string describing the peer address.
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
using namespace icinga;
|
||||
|
||||
/**
|
||||
* TCPClient
|
||||
*
|
||||
* Constructor for the TCPClient class.
|
||||
*
|
||||
* @param role The role of the TCP client socket.
|
||||
|
@ -37,8 +35,6 @@ TCPClient::TCPClient(TCPClientRole role)
|
|||
}
|
||||
|
||||
/**
|
||||
* GetRole
|
||||
*
|
||||
* Retrieves the role of the socket.
|
||||
*
|
||||
* @returns The role.
|
||||
|
@ -49,8 +45,6 @@ TCPClientRole TCPClient::GetRole(void) const
|
|||
}
|
||||
|
||||
/**
|
||||
* Start
|
||||
*
|
||||
* Registers the socket and starts processing events for it.
|
||||
*/
|
||||
void TCPClient::Start(void)
|
||||
|
@ -62,8 +56,6 @@ void TCPClient::Start(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* Connect
|
||||
*
|
||||
* Creates a socket and connects to the specified node and service.
|
||||
*
|
||||
* @param node The node.
|
||||
|
@ -118,8 +110,6 @@ void TCPClient::Connect(const string& node, const string& service)
|
|||
}
|
||||
|
||||
/**
|
||||
* GetSendQueue
|
||||
*
|
||||
* Retrieves the send queue for the socket.
|
||||
*
|
||||
* @returns The send queue.
|
||||
|
@ -130,8 +120,6 @@ FIFO::Ptr TCPClient::GetSendQueue(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* GetRecvQueue
|
||||
*
|
||||
* Retrieves the recv queue for the socket.
|
||||
*
|
||||
* @returns The recv queue.
|
||||
|
@ -142,8 +130,6 @@ FIFO::Ptr TCPClient::GetRecvQueue(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* ReadableEventHandler
|
||||
*
|
||||
* Processes data that is available for this socket.
|
||||
*
|
||||
* @param - Event arguments.
|
||||
|
@ -179,8 +165,6 @@ int TCPClient::ReadableEventHandler(const EventArgs&)
|
|||
}
|
||||
|
||||
/**
|
||||
* WritableEventHandler
|
||||
*
|
||||
* Processes data that can be written for this socket.
|
||||
*
|
||||
* @param - Event arguments.
|
||||
|
@ -203,8 +187,6 @@ int TCPClient::WritableEventHandler(const EventArgs&)
|
|||
}
|
||||
|
||||
/**
|
||||
* WantsToRead
|
||||
*
|
||||
* Checks whether data should be read for this socket.
|
||||
*
|
||||
* @returns true
|
||||
|
@ -215,8 +197,6 @@ bool TCPClient::WantsToRead(void) const
|
|||
}
|
||||
|
||||
/**
|
||||
* WantsToWrite
|
||||
*
|
||||
* Checks whether data should be written for this socket.
|
||||
*
|
||||
* @returns true if data should be written, false otherwise.
|
||||
|
@ -227,8 +207,6 @@ bool TCPClient::WantsToWrite(void) const
|
|||
}
|
||||
|
||||
/**
|
||||
* TCPClientFactory
|
||||
*
|
||||
* Default factory function for TCP clients.
|
||||
*
|
||||
* @param role The role of the new client.
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
using namespace icinga;
|
||||
|
||||
/**
|
||||
* TCPServer
|
||||
*
|
||||
* Constructor for the TCPServer class.
|
||||
*/
|
||||
TCPServer::TCPServer(void)
|
||||
|
@ -32,8 +30,6 @@ TCPServer::TCPServer(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* SetClientFactory
|
||||
*
|
||||
* Sets the client factory.
|
||||
*
|
||||
* @param clientFactory The client factory function.
|
||||
|
@ -44,8 +40,6 @@ void TCPServer::SetClientFactory(function<TCPClient::Ptr()> clientFactory)
|
|||
}
|
||||
|
||||
/**
|
||||
* GetFactoryFunction
|
||||
*
|
||||
* Retrieves the client factory.
|
||||
*
|
||||
* @returns The client factory function.
|
||||
|
@ -56,8 +50,6 @@ function<TCPClient::Ptr()> TCPServer::GetFactoryFunction(void) const
|
|||
}
|
||||
|
||||
/**
|
||||
* Start
|
||||
*
|
||||
* Registers the TCP server and starts processing events for it.
|
||||
*/
|
||||
void TCPServer::Start(void)
|
||||
|
@ -68,8 +60,6 @@ void TCPServer::Start(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* Listen
|
||||
*
|
||||
* Starts listening for incoming client connections.
|
||||
*/
|
||||
void TCPServer::Listen(void)
|
||||
|
@ -83,8 +73,6 @@ void TCPServer::Listen(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* ReadableEventHandler
|
||||
*
|
||||
* Accepts a new client and creates a new client object for it
|
||||
* using the client factory function.
|
||||
*
|
||||
|
@ -115,8 +103,6 @@ int TCPServer::ReadableEventHandler(const EventArgs&)
|
|||
}
|
||||
|
||||
/**
|
||||
* WantsToRead
|
||||
*
|
||||
* Checks whether the TCP server wants to read (i.e. accept new clients).
|
||||
*
|
||||
* @returns true
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
using namespace icinga;
|
||||
|
||||
/**
|
||||
* MakeSocket
|
||||
*
|
||||
* Creates a socket.
|
||||
*
|
||||
* @param family The socket family for the new socket.
|
||||
|
@ -44,8 +42,6 @@ void TCPSocket::MakeSocket(int family)
|
|||
}
|
||||
|
||||
/**
|
||||
* Bind
|
||||
*
|
||||
* Creates a socket and binds it to the specified service.
|
||||
*
|
||||
* @param service The service.
|
||||
|
@ -57,8 +53,6 @@ void TCPSocket::Bind(string service, int family)
|
|||
}
|
||||
|
||||
/**
|
||||
* Bind
|
||||
*
|
||||
* Creates a socket and binds it to the specified node and service.
|
||||
*
|
||||
* @param service The service.
|
||||
|
|
|
@ -28,8 +28,6 @@ typedef struct threadparam_s
|
|||
} threadparam_t;
|
||||
|
||||
/**
|
||||
* ThreadStartProc
|
||||
*
|
||||
* Helper function that deals with OS-specific differences in the thread
|
||||
* proc's function signature.
|
||||
*/
|
||||
|
@ -52,8 +50,6 @@ static void *ThreadStartProc(void *param)
|
|||
#endif /* _WIN32 */
|
||||
|
||||
/**
|
||||
* Thread
|
||||
*
|
||||
* Constructor for the thread class. Creates a new thread that begins
|
||||
* executing immediately.
|
||||
*/
|
||||
|
@ -78,8 +74,6 @@ Thread::Thread(ThreadProc callback, void *param)
|
|||
}
|
||||
|
||||
/**
|
||||
* ~Thread
|
||||
*
|
||||
* Destructor for the Thread class. Cleans up the resources associated
|
||||
* with the thread.
|
||||
*/
|
||||
|
@ -93,8 +87,6 @@ Thread::~Thread(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* Join
|
||||
*
|
||||
* Waits until the thread has finished executing.
|
||||
*/
|
||||
void Thread::Join(void)
|
||||
|
|
|
@ -26,8 +26,6 @@ namespace icinga
|
|||
typedef void (*ThreadProc)(void *);
|
||||
|
||||
/**
|
||||
* Thread
|
||||
*
|
||||
* A wrapper around OS-specific thread functionality.
|
||||
*/
|
||||
class I2_BASE_API Thread
|
||||
|
|
|
@ -33,8 +33,6 @@ Timer::Timer(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* GetNextCall
|
||||
*
|
||||
* Retrieves when the next timer is due.
|
||||
*
|
||||
* @returns Time when the next timer is due.
|
||||
|
@ -48,8 +46,6 @@ time_t Timer::GetNextCall(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* RescheduleTimers
|
||||
*
|
||||
* Reschedules all timers, thereby updating the NextCall
|
||||
* timestamp used by the GetNextCall() function.
|
||||
*/
|
||||
|
@ -70,8 +66,6 @@ void Timer::RescheduleTimers(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* CallExpiredTimers
|
||||
*
|
||||
* Calls all expired timers and reschedules them.
|
||||
*/
|
||||
void Timer::CallExpiredTimers(void)
|
||||
|
@ -100,8 +94,6 @@ void Timer::CallExpiredTimers(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* Call
|
||||
*
|
||||
* Calls this timer. Note: the timer delegate must not call
|
||||
* Disable() on any other timers than the timer that originally
|
||||
* invoked the delegate.
|
||||
|
@ -115,8 +107,6 @@ void Timer::Call(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* SetInterval
|
||||
*
|
||||
* Sets the interval for this timer.
|
||||
*
|
||||
* @param interval The new interval.
|
||||
|
@ -127,8 +117,6 @@ void Timer::SetInterval(unsigned int interval)
|
|||
}
|
||||
|
||||
/**
|
||||
* GetInterval
|
||||
*
|
||||
* Retrieves the interval for this timer.
|
||||
*
|
||||
* @returns The interval.
|
||||
|
@ -139,8 +127,6 @@ unsigned int Timer::GetInterval(void) const
|
|||
}
|
||||
|
||||
/**
|
||||
* SetUserArgs
|
||||
*
|
||||
* Sets user arguments for the timer callback.
|
||||
*
|
||||
* @param userArgs The user arguments.
|
||||
|
@ -151,8 +137,6 @@ void Timer::SetUserArgs(const EventArgs& userArgs)
|
|||
}
|
||||
|
||||
/**
|
||||
* GetUserArgs
|
||||
*
|
||||
* Retrieves the user arguments for the timer callback.
|
||||
*
|
||||
* @returns The user arguments.
|
||||
|
@ -163,8 +147,6 @@ EventArgs Timer::GetUserArgs(void) const
|
|||
}
|
||||
|
||||
/**
|
||||
* Start
|
||||
*
|
||||
* Registers the timer and starts processing events for it.
|
||||
*/
|
||||
void Timer::Start(void)
|
||||
|
@ -175,8 +157,6 @@ void Timer::Start(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* Stop
|
||||
*
|
||||
* Unregisters the timer and stops processing events for it.
|
||||
*/
|
||||
void Timer::Stop(void)
|
||||
|
@ -185,8 +165,6 @@ void Timer::Stop(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* Reschedule
|
||||
*
|
||||
* Reschedules this timer.
|
||||
*
|
||||
* @param next The time when this timer should be called again.
|
||||
|
|
|
@ -25,8 +25,6 @@ int I2_EXPORT TLSClient::m_SSLIndex;
|
|||
bool I2_EXPORT TLSClient::m_SSLIndexInitialized = false;
|
||||
|
||||
/**
|
||||
* TLSClient
|
||||
*
|
||||
* Constructor for the TLSClient class.
|
||||
*
|
||||
* @param role The role of the client.
|
||||
|
@ -40,8 +38,6 @@ TLSClient::TLSClient(TCPClientRole role, shared_ptr<SSL_CTX> sslContext) : TCPCl
|
|||
}
|
||||
|
||||
/**
|
||||
* NullCertificateDeleter
|
||||
*
|
||||
* Takes a certificate as an argument. Does nothing.
|
||||
*
|
||||
* @param certificate An X509 certificate.
|
||||
|
@ -52,8 +48,6 @@ void TLSClient::NullCertificateDeleter(X509 *certificate)
|
|||
}
|
||||
|
||||
/**
|
||||
* GetClientCertificate
|
||||
*
|
||||
* Retrieves the X509 certficate for this client.
|
||||
*
|
||||
* @returns The X509 certificate.
|
||||
|
@ -64,8 +58,6 @@ shared_ptr<X509> TLSClient::GetClientCertificate(void) const
|
|||
}
|
||||
|
||||
/**
|
||||
* GetPeerCertificate
|
||||
*
|
||||
* Retrieves the X509 certficate for the peer.
|
||||
*
|
||||
* @returns The X509 certificate.
|
||||
|
@ -76,8 +68,6 @@ shared_ptr<X509> TLSClient::GetPeerCertificate(void) const
|
|||
}
|
||||
|
||||
/**
|
||||
* Start
|
||||
*
|
||||
* Registers the TLS socket and starts processing events for it.
|
||||
*/
|
||||
void TLSClient::Start(void)
|
||||
|
@ -114,8 +104,6 @@ void TLSClient::Start(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* ReadableEventHandler
|
||||
*
|
||||
* Processes data that is available for this socket.
|
||||
*
|
||||
* @param - Event arguments.
|
||||
|
@ -160,8 +148,6 @@ int TLSClient::ReadableEventHandler(const EventArgs&)
|
|||
}
|
||||
|
||||
/**
|
||||
* WritableEventHandler
|
||||
*
|
||||
* Processes data that can be written for this socket.
|
||||
*
|
||||
* @param - Event arguments.
|
||||
|
@ -200,8 +186,6 @@ int TLSClient::WritableEventHandler(const EventArgs&)
|
|||
}
|
||||
|
||||
/**
|
||||
* WantsToRead
|
||||
*
|
||||
* Checks whether data should be read for this socket.
|
||||
*
|
||||
* @returns true if data should be read, false otherwise.
|
||||
|
@ -218,8 +202,6 @@ bool TLSClient::WantsToRead(void) const
|
|||
}
|
||||
|
||||
/**
|
||||
* WantsToWrite
|
||||
*
|
||||
* Checks whether data should be written for this socket.
|
||||
*
|
||||
* @returns true if data should be written, false otherwise.
|
||||
|
@ -236,8 +218,6 @@ bool TLSClient::WantsToWrite(void) const
|
|||
}
|
||||
|
||||
/**
|
||||
* CloseInternal
|
||||
*
|
||||
* Closes the socket.
|
||||
*
|
||||
* @param from_dtor Whether this method was invoked from the destructor.
|
||||
|
@ -250,8 +230,6 @@ void TLSClient::CloseInternal(bool from_dtor)
|
|||
}
|
||||
|
||||
/**
|
||||
* HandleSSLError
|
||||
*
|
||||
* Handles an OpenSSL error.
|
||||
*/
|
||||
void TLSClient::HandleSSLError(void)
|
||||
|
@ -270,8 +248,6 @@ void TLSClient::HandleSSLError(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* TLSClientFactory
|
||||
*
|
||||
* Factory function for the TLSClient class.
|
||||
*
|
||||
* @param role The role of the TLS socket.
|
||||
|
@ -284,8 +260,6 @@ TCPClient::Ptr icinga::TLSClientFactory(TCPClientRole role, shared_ptr<SSL_CTX>
|
|||
}
|
||||
|
||||
/**
|
||||
* SSLVerifyCertificate
|
||||
*
|
||||
* Callback function that verifies SSL certificates.
|
||||
*
|
||||
* @param ok Whether pre-checks for the SSL certificates were successful.
|
||||
|
|
|
@ -25,8 +25,6 @@
|
|||
using namespace icinga;
|
||||
|
||||
/**
|
||||
* Sleep
|
||||
*
|
||||
* Sleeps for the specified amount of time.
|
||||
*
|
||||
* @param milliseconds The amount of time in milliseconds.
|
||||
|
@ -37,8 +35,6 @@ void Sleep(unsigned long milliseconds)
|
|||
}
|
||||
|
||||
/**
|
||||
* closesocket
|
||||
*
|
||||
* Closes a socket.
|
||||
*
|
||||
* @param fd The socket that is to be closed.
|
||||
|
|
|
@ -25,8 +25,6 @@ using namespace icinga;
|
|||
bool I2_EXPORT Utility::m_SSLInitialized = false;
|
||||
|
||||
/**
|
||||
* Daemonize
|
||||
*
|
||||
* Detaches from the controlling terminal.
|
||||
*/
|
||||
void Utility::Daemonize(void) {
|
||||
|
@ -64,23 +62,20 @@ void Utility::Daemonize(void) {
|
|||
}
|
||||
|
||||
/**
|
||||
* InitializeOpenSSL
|
||||
*
|
||||
* Initializes the OpenSSL library.
|
||||
*/
|
||||
void Utility::InitializeOpenSSL(void)
|
||||
{
|
||||
if (!m_SSLInitialized) {
|
||||
SSL_library_init();
|
||||
SSL_load_error_strings();
|
||||
if (m_SSLInitialized)
|
||||
return;
|
||||
|
||||
m_SSLInitialized = true;
|
||||
}
|
||||
SSL_library_init();
|
||||
SSL_load_error_strings();
|
||||
|
||||
m_SSLInitialized = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* MakeSSLContext
|
||||
*
|
||||
* Initializes an SSL context using the specified certificates.
|
||||
*
|
||||
* @param pubkey The public key.
|
||||
|
@ -111,9 +106,7 @@ shared_ptr<SSL_CTX> Utility::MakeSSLContext(string pubkey, string privkey, strin
|
|||
}
|
||||
|
||||
/**
|
||||
* GetCertificateCN
|
||||
*
|
||||
* Retrieves the common name for a X509 certificate.
|
||||
* Retrieves the common name for an X509 certificate.
|
||||
*
|
||||
* @param certificate The X509 certificate.
|
||||
* @returns The common name.
|
||||
|
@ -131,8 +124,6 @@ string Utility::GetCertificateCN(const shared_ptr<X509>& certificate)
|
|||
}
|
||||
|
||||
/**
|
||||
* GetX509Certificate
|
||||
*
|
||||
* Retrieves an X509 certificate from the specified file.
|
||||
*
|
||||
* @param pemfile The filename.
|
||||
|
@ -158,6 +149,13 @@ shared_ptr<X509> Utility::GetX509Certificate(string pemfile)
|
|||
return shared_ptr<X509>(cert, X509_free);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs wildcard pattern matching.
|
||||
*
|
||||
* @param pattern The wildcard pattern.
|
||||
* @param text The string that should be checked.
|
||||
* @returns true if the wildcard pattern matches, false otherwise.
|
||||
*/
|
||||
bool Utility::Match(string pattern, string text)
|
||||
{
|
||||
return (match(pattern.c_str(), text.c_str()) == 0);
|
||||
|
|
|
@ -24,8 +24,6 @@ namespace icinga
|
|||
{
|
||||
|
||||
/**
|
||||
* Utility
|
||||
*
|
||||
* Utility functions.
|
||||
*/
|
||||
class I2_BASE_API Utility
|
||||
|
@ -39,8 +37,6 @@ private:
|
|||
|
||||
public:
|
||||
/**
|
||||
* GetTypeName
|
||||
*
|
||||
* Returns the type name of an object (using RTTI).
|
||||
*/
|
||||
template<class T>
|
||||
|
|
|
@ -21,6 +21,11 @@
|
|||
|
||||
using namespace icinga;
|
||||
|
||||
/**
|
||||
* Converts the variant's value to a new type.
|
||||
*
|
||||
* @param newType The new type of the variant.
|
||||
*/
|
||||
void Variant::Convert(VariantType newType) const
|
||||
{
|
||||
if (newType == m_Type)
|
||||
|
@ -37,11 +42,21 @@ void Variant::Convert(VariantType newType) const
|
|||
throw InvalidArgumentException("Invalid variant conversion.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the variant value's type.
|
||||
*
|
||||
* @returns The variant's type.
|
||||
*/
|
||||
VariantType Variant::GetType(void) const
|
||||
{
|
||||
return m_Type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the variant's value as an integer.
|
||||
*
|
||||
* @returns The variant's value as an integer.
|
||||
*/
|
||||
long Variant::GetInteger(void) const
|
||||
{
|
||||
Convert(VariantInteger);
|
||||
|
@ -49,6 +64,11 @@ long Variant::GetInteger(void) const
|
|||
return m_IntegerValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the variant's value as a string.
|
||||
*
|
||||
* @returns The variant's value as a string.
|
||||
*/
|
||||
string Variant::GetString(void) const
|
||||
{
|
||||
Convert(VariantString);
|
||||
|
@ -56,6 +76,11 @@ string Variant::GetString(void) const
|
|||
return m_StringValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the variant's value as an object.
|
||||
*
|
||||
* @returns The variant's value as an object.
|
||||
*/
|
||||
Object::Ptr Variant::GetObject(void) const
|
||||
{
|
||||
Convert(VariantObject);
|
||||
|
@ -63,21 +88,41 @@ Object::Ptr Variant::GetObject(void) const
|
|||
return m_ObjectValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the variant is empty.
|
||||
*
|
||||
* @returns true if the variant is empty, false otherwise.
|
||||
*/
|
||||
bool Variant::IsEmpty(void) const
|
||||
{
|
||||
return (m_Type == VariantEmpty);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the variant's value as an integer.
|
||||
*
|
||||
* @returns The variant's value as an integer.
|
||||
*/
|
||||
Variant::operator long(void) const
|
||||
{
|
||||
return GetInteger();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the variant's value as a string.
|
||||
*
|
||||
* @returns The variant's value as a string.
|
||||
*/
|
||||
Variant::operator string(void) const
|
||||
{
|
||||
return GetString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the variant's value as an object.
|
||||
*
|
||||
* @returns The variant's value as an object.
|
||||
*/
|
||||
Variant::operator Object::Ptr(void) const
|
||||
{
|
||||
return GetObject();
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
using namespace icinga;
|
||||
|
||||
/**
|
||||
* GetName
|
||||
*
|
||||
* Returns the name of the component.
|
||||
*
|
||||
* @returns The name.
|
||||
|
@ -34,8 +32,6 @@ string DemoComponent::GetName(void) const
|
|||
}
|
||||
|
||||
/**
|
||||
* Start
|
||||
*
|
||||
* Starts the component.
|
||||
*/
|
||||
void DemoComponent::Start(void)
|
||||
|
@ -55,8 +51,6 @@ void DemoComponent::Start(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* Stop
|
||||
*
|
||||
* Stops the component.
|
||||
*/
|
||||
void DemoComponent::Stop(void)
|
||||
|
@ -70,8 +64,6 @@ void DemoComponent::Stop(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* DemoTimerHandler
|
||||
*
|
||||
* Periodically sends a demo::HelloWorld message.
|
||||
*
|
||||
* @param - Event arguments for the timer.
|
||||
|
@ -91,8 +83,6 @@ int DemoComponent::DemoTimerHandler(const TimerEventArgs&)
|
|||
}
|
||||
|
||||
/**
|
||||
* HelloWorldRequestHandler
|
||||
*
|
||||
* Processes demo::HelloWorld messages.
|
||||
*/
|
||||
int DemoComponent::HelloWorldRequestHandler(const NewRequestEventArgs& nrea)
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
using namespace icinga;
|
||||
|
||||
/**
|
||||
* GetName
|
||||
*
|
||||
* Returns the name of this component.
|
||||
*
|
||||
* @returns The name.
|
||||
|
@ -34,8 +32,6 @@ string DiscoveryComponent::GetName(void) const
|
|||
}
|
||||
|
||||
/**
|
||||
* Start
|
||||
*
|
||||
* Starts the discovery component.
|
||||
*/
|
||||
void DiscoveryComponent::Start(void)
|
||||
|
@ -69,8 +65,6 @@ void DiscoveryComponent::Start(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* Stop
|
||||
*
|
||||
* Stops the discovery component.
|
||||
*/
|
||||
void DiscoveryComponent::Stop(void)
|
||||
|
@ -82,8 +76,6 @@ void DiscoveryComponent::Stop(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* CheckExistingEndpoint
|
||||
*
|
||||
* Checks whether the specified endpoint is already connected
|
||||
* and disconnects older endpoints.
|
||||
*
|
||||
|
@ -110,8 +102,6 @@ int DiscoveryComponent::CheckExistingEndpoint(Endpoint::Ptr endpoint, const NewE
|
|||
}
|
||||
|
||||
/**
|
||||
* NewEndpointHandler
|
||||
*
|
||||
* Registers handlers for new endpoints.
|
||||
*
|
||||
* @param neea Event arguments for the new endpoint.
|
||||
|
@ -131,8 +121,6 @@ int DiscoveryComponent::NewEndpointHandler(const NewEndpointEventArgs& neea)
|
|||
}
|
||||
|
||||
/**
|
||||
* DiscoverySinkHandler
|
||||
*
|
||||
* Registers a new message sink for a component.
|
||||
*
|
||||
* @param nmea Event args for the new message sink.
|
||||
|
@ -146,8 +134,6 @@ int DiscoveryComponent::DiscoverySinkHandler(const NewMethodEventArgs& nmea, Com
|
|||
}
|
||||
|
||||
/**
|
||||
* DiscoverySourceHandler
|
||||
*
|
||||
* Registers a new message source for a component.
|
||||
*
|
||||
* @param nmea Event args for the new message source.
|
||||
|
@ -161,8 +147,6 @@ int DiscoveryComponent::DiscoverySourceHandler(const NewMethodEventArgs& nmea, C
|
|||
}
|
||||
|
||||
/**
|
||||
* DiscoveryEndpointHandler
|
||||
*
|
||||
* Registers message sinks/sources in the specified component information object.
|
||||
*
|
||||
* @param neea Event arguments for the endpoint.
|
||||
|
@ -177,8 +161,6 @@ int DiscoveryComponent::DiscoveryEndpointHandler(const NewEndpointEventArgs& nee
|
|||
}
|
||||
|
||||
/**
|
||||
* GetComponentDiscoveryInfo
|
||||
*
|
||||
* Retrieves the component information object for the specified component.
|
||||
*
|
||||
* @param component The identity of the component.
|
||||
|
@ -211,8 +193,6 @@ bool DiscoveryComponent::GetComponentDiscoveryInfo(string component, ComponentDi
|
|||
}
|
||||
|
||||
/**
|
||||
* NewIdentityHandler
|
||||
*
|
||||
* Deals with a new endpoint whose identity has just become known.
|
||||
*
|
||||
* @param ea Event arguments for the component.
|
||||
|
@ -283,8 +263,6 @@ int DiscoveryComponent::NewIdentityHandler(const EventArgs& ea)
|
|||
}
|
||||
|
||||
/**
|
||||
* WelcomeMessageHandler
|
||||
*
|
||||
* Processes discovery::Welcome messages.
|
||||
*
|
||||
* @param nrea Event arguments for the request.
|
||||
|
@ -309,8 +287,6 @@ int DiscoveryComponent::WelcomeMessageHandler(const NewRequestEventArgs& nrea)
|
|||
}
|
||||
|
||||
/**
|
||||
* FinishDiscoverySetup
|
||||
*
|
||||
* Finishes the welcome handshake for a new component
|
||||
* by registering message sinks/sources for the component
|
||||
* and sending a welcome message if necessary.
|
||||
|
@ -339,8 +315,6 @@ void DiscoveryComponent::FinishDiscoverySetup(Endpoint::Ptr endpoint)
|
|||
}
|
||||
|
||||
/**
|
||||
* SendDiscoveryMessage
|
||||
*
|
||||
* Sends a discovery message for the specified identity using the
|
||||
* specified message type.
|
||||
*
|
||||
|
@ -415,8 +389,6 @@ bool DiscoveryComponent::HasMessagePermission(Dictionary::Ptr roles, string mess
|
|||
}
|
||||
|
||||
/**
|
||||
* ProcessDiscoveryMessage
|
||||
*
|
||||
* Processes a discovery message by registering the component in the
|
||||
* discovery component registry.
|
||||
*
|
||||
|
@ -488,8 +460,6 @@ void DiscoveryComponent::ProcessDiscoveryMessage(string identity, DiscoveryMessa
|
|||
}
|
||||
|
||||
/**
|
||||
* NewComponentMessageHandler
|
||||
*
|
||||
* Processes "discovery::NewComponent" messages.
|
||||
*
|
||||
* @param nrea Event arguments for the request.
|
||||
|
@ -509,8 +479,6 @@ int DiscoveryComponent::NewComponentMessageHandler(const NewRequestEventArgs& nr
|
|||
}
|
||||
|
||||
/**
|
||||
* RegisterComponentMessageHandler
|
||||
*
|
||||
* Processes "discovery::RegisterComponent" messages.
|
||||
*
|
||||
* @param nrea Event arguments for the request.
|
||||
|
@ -526,8 +494,6 @@ int DiscoveryComponent::RegisterComponentMessageHandler(const NewRequestEventArg
|
|||
}
|
||||
|
||||
/**
|
||||
* EndpointConfigHandler
|
||||
*
|
||||
* Processes "endpoint" config objects.
|
||||
*
|
||||
* @param ea Event arguments for the new config object.
|
||||
|
@ -553,8 +519,6 @@ int DiscoveryComponent::EndpointConfigHandler(const EventArgs& ea)
|
|||
}
|
||||
|
||||
/**
|
||||
* DiscoveryTimerHandler
|
||||
*
|
||||
* Checks whether we have to reconnect to other components and removes stale
|
||||
* components from the registry.
|
||||
*
|
||||
|
|
|
@ -21,4 +21,8 @@
|
|||
|
||||
using namespace icinga;
|
||||
|
||||
IMPLEMENT_ENTRY_POINT(IcingaApplication);
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
IcingaApplication::Ptr instance = make_shared<IcingaApplication>();
|
||||
return icinga::RunApplication(argc, argv, instance);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue