mirror of
https://github.com/Icinga/icinga2.git
synced 2025-09-26 02:58:43 +02:00
Cleaned up #includes (Part 1).
This commit is contained in:
parent
4e765c58de
commit
3073200b53
@ -40,7 +40,7 @@ void CheckerComponent::Start(void)
|
|||||||
|
|
||||||
m_Stopped = false;
|
m_Stopped = false;
|
||||||
|
|
||||||
m_Thread = thread(boost::bind(&CheckerComponent::CheckThreadProc, this));
|
m_Thread = boost::thread(boost::bind(&CheckerComponent::CheckThreadProc, this));
|
||||||
|
|
||||||
m_ResultTimer = boost::make_shared<Timer>();
|
m_ResultTimer = boost::make_shared<Timer>();
|
||||||
m_ResultTimer->SetInterval(5);
|
m_ResultTimer->SetInterval(5);
|
||||||
|
@ -74,7 +74,7 @@ private:
|
|||||||
boost::mutex m_Mutex;
|
boost::mutex m_Mutex;
|
||||||
boost::condition_variable m_CV;
|
boost::condition_variable m_CV;
|
||||||
bool m_Stopped;
|
bool m_Stopped;
|
||||||
thread m_Thread;
|
boost::thread m_Thread;
|
||||||
|
|
||||||
ServiceSet m_IdleServices;
|
ServiceSet m_IdleServices;
|
||||||
ServiceSet m_PendingServices;
|
ServiceSet m_PendingServices;
|
||||||
|
@ -41,7 +41,7 @@ void CompatComponent::Start(void)
|
|||||||
m_StatusTimer->Reschedule(0);
|
m_StatusTimer->Reschedule(0);
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
m_CommandThread = thread(boost::bind(&CompatComponent::CommandPipeThread, this, GetCommandPath()));
|
m_CommandThread = boost::thread(boost::bind(&CompatComponent::CommandPipeThread, this, GetCommandPath()));
|
||||||
m_CommandThread.detach();
|
m_CommandThread.detach();
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ private:
|
|||||||
Attribute<String> m_CommandPath;
|
Attribute<String> m_CommandPath;
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
thread m_CommandThread;
|
boost::thread m_CommandThread;
|
||||||
|
|
||||||
void CommandPipeThread(const String& commandPath);
|
void CommandPipeThread(const String& commandPath);
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
@ -26,8 +26,8 @@ namespace livestatus
|
|||||||
class Column
|
class Column
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef function<Value (const Object::Ptr&)> ValueAccessor;
|
typedef boost::function<Value (const Object::Ptr&)> ValueAccessor;
|
||||||
typedef function<Object::Ptr (const Object::Ptr&)> ObjectAccessor;
|
typedef boost::function<Object::Ptr (const Object::Ptr&)> ObjectAccessor;
|
||||||
|
|
||||||
Column(const ValueAccessor& valueAccessor, const ObjectAccessor& objectAccessor);
|
Column(const ValueAccessor& valueAccessor, const ObjectAccessor& objectAccessor);
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "i2-livestatus.h"
|
#include "i2-livestatus.h"
|
||||||
|
#include <boost/tuple/tuple.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
using namespace livestatus;
|
using namespace livestatus;
|
||||||
@ -50,7 +51,7 @@ String CommentsTable::GetName(void) const
|
|||||||
return "comments";
|
return "comments";
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommentsTable::FetchRows(const function<void (const Object::Ptr&)>& addRowFn)
|
void CommentsTable::FetchRows(const AddRowFunction& addRowFn)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("Service")) {
|
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("Service")) {
|
||||||
Service::Ptr service = static_pointer_cast<Service>(object);
|
Service::Ptr service = static_pointer_cast<Service>(object);
|
||||||
@ -62,7 +63,7 @@ void CommentsTable::FetchRows(const function<void (const Object::Ptr&)>& addRowF
|
|||||||
ObjectLock olock(comments);
|
ObjectLock olock(comments);
|
||||||
|
|
||||||
Value comment;
|
Value comment;
|
||||||
BOOST_FOREACH(tie(tuples::ignore, comment), comments) {
|
BOOST_FOREACH(boost::tie(boost::tuples::ignore, comment), comments) {
|
||||||
addRowFn(comment);
|
addRowFn(comment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ public:
|
|||||||
virtual String GetName(void) const;
|
virtual String GetName(void) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void FetchRows(const function<void (const Object::Ptr&)>& addRowFn);
|
virtual void FetchRows(const AddRowFunction& addRowFn);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ String ContactGroupsTable::GetName(void) const
|
|||||||
return "contactgroups";
|
return "contactgroups";
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContactGroupsTable::FetchRows(const function<void (const Object::Ptr&)>& addRowFn)
|
void ContactGroupsTable::FetchRows(const AddRowFunction& addRowFn)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("UserGroup")) {
|
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("UserGroup")) {
|
||||||
addRowFn(object);
|
addRowFn(object);
|
||||||
@ -61,4 +61,4 @@ Value ContactGroupsTable::MembersAccessor(const Object::Ptr& object)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return members;
|
return members;
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ public:
|
|||||||
virtual String GetName(void) const;
|
virtual String GetName(void) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void FetchRows(const function<void (const Object::Ptr&)>& addRowFn);
|
virtual void FetchRows(const AddRowFunction& addRowFn);
|
||||||
|
|
||||||
static Value NameAccessor(const Object::Ptr& object);
|
static Value NameAccessor(const Object::Ptr& object);
|
||||||
static Value MembersAccessor(const Object::Ptr& object);
|
static Value MembersAccessor(const Object::Ptr& object);
|
||||||
|
@ -53,7 +53,7 @@ String ContactsTable::GetName(void) const
|
|||||||
return "contacts";
|
return "contacts";
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContactsTable::FetchRows(const function<void (const Object::Ptr&)>& addRowFn)
|
void ContactsTable::FetchRows(const AddRowFunction& addRowFn)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("User")) {
|
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("User")) {
|
||||||
addRowFn(object);
|
addRowFn(object);
|
||||||
|
@ -40,7 +40,7 @@ public:
|
|||||||
virtual String GetName(void) const;
|
virtual String GetName(void) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void FetchRows(const function<void (const Object::Ptr&)>& addRowFn);
|
virtual void FetchRows(const AddRowFunction& addRowFn);
|
||||||
|
|
||||||
static Value NameAccessor(const Object::Ptr& object);
|
static Value NameAccessor(const Object::Ptr& object);
|
||||||
static Value MembersAccessor(const Object::Ptr& object);
|
static Value MembersAccessor(const Object::Ptr& object);
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "i2-livestatus.h"
|
#include "i2-livestatus.h"
|
||||||
|
#include <boost/tuple/tuple.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
using namespace livestatus;
|
using namespace livestatus;
|
||||||
@ -50,7 +51,7 @@ String DowntimesTable::GetName(void) const
|
|||||||
return "downtimes";
|
return "downtimes";
|
||||||
}
|
}
|
||||||
|
|
||||||
void DowntimesTable::FetchRows(const function<void (const Object::Ptr&)>& addRowFn)
|
void DowntimesTable::FetchRows(const AddRowFunction& addRowFn)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("Service")) {
|
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("Service")) {
|
||||||
Service::Ptr service = static_pointer_cast<Service>(object);
|
Service::Ptr service = static_pointer_cast<Service>(object);
|
||||||
@ -62,7 +63,7 @@ void DowntimesTable::FetchRows(const function<void (const Object::Ptr&)>& addRow
|
|||||||
ObjectLock olock(downtimes);
|
ObjectLock olock(downtimes);
|
||||||
|
|
||||||
Value downtime;
|
Value downtime;
|
||||||
BOOST_FOREACH(tie(tuples::ignore, downtime), downtimes) {
|
BOOST_FOREACH(boost::tie(boost::tuples::ignore, downtime), downtimes) {
|
||||||
addRowFn(downtime);
|
addRowFn(downtime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ public:
|
|||||||
virtual String GetName(void) const;
|
virtual String GetName(void) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void FetchRows(const function<void (const Object::Ptr&)>& addRowFn);
|
virtual void FetchRows(const AddRowFunction& addRowFn);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ String HostsTable::GetName(void) const
|
|||||||
return "hosts";
|
return "hosts";
|
||||||
}
|
}
|
||||||
|
|
||||||
void HostsTable::FetchRows(const function<void (const Object::Ptr&)>& addRowFn)
|
void HostsTable::FetchRows(const AddRowFunction& addRowFn)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("Host")) {
|
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("Host")) {
|
||||||
addRowFn(object);
|
addRowFn(object);
|
||||||
|
@ -40,7 +40,7 @@ public:
|
|||||||
virtual String GetName(void) const;
|
virtual String GetName(void) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void FetchRows(const function<void (const Object::Ptr&)>& addRowFn);
|
virtual void FetchRows(const AddRowFunction& addRowFn);
|
||||||
|
|
||||||
static Value NameAccessor(const Object::Ptr& object);
|
static Value NameAccessor(const Object::Ptr& object);
|
||||||
static Value DisplayNameAccessor(const Object::Ptr& object);
|
static Value DisplayNameAccessor(const Object::Ptr& object);
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "i2-livestatus.h"
|
#include "i2-livestatus.h"
|
||||||
|
#include <boost/algorithm/string/classification.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
using namespace livestatus;
|
using namespace livestatus;
|
||||||
@ -62,11 +63,11 @@ Query::Query(const vector<String>& lines)
|
|||||||
else if (header == "OutputFormat")
|
else if (header == "OutputFormat")
|
||||||
m_OutputFormat = params;
|
m_OutputFormat = params;
|
||||||
else if (header == "Columns")
|
else if (header == "Columns")
|
||||||
m_Columns = params.Split(is_any_of(" "));
|
m_Columns = params.Split(boost::is_any_of(" "));
|
||||||
else if (header == "ColumnHeaders")
|
else if (header == "ColumnHeaders")
|
||||||
m_ColumnHeaders = (params == "on");
|
m_ColumnHeaders = (params == "on");
|
||||||
else if (header == "Filter" || header == "Stats") {
|
else if (header == "Filter" || header == "Stats") {
|
||||||
vector<String> tokens = params.Split(is_any_of(" "));
|
vector<String> tokens = params.Split(boost::is_any_of(" "));
|
||||||
|
|
||||||
if (tokens.size() == 2)
|
if (tokens.size() == 2)
|
||||||
tokens.push_back("");
|
tokens.push_back("");
|
||||||
|
@ -121,7 +121,7 @@ String ServicesTable::GetName(void) const
|
|||||||
return "services";
|
return "services";
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServicesTable::FetchRows(const function<void (const Object::Ptr&)>& addRowFn)
|
void ServicesTable::FetchRows(const AddRowFunction& addRowFn)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("Service")) {
|
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("Service")) {
|
||||||
addRowFn(object);
|
addRowFn(object);
|
||||||
|
@ -40,7 +40,7 @@ public:
|
|||||||
virtual String GetName(void) const;
|
virtual String GetName(void) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void FetchRows(const function<void (const Object::Ptr&)>& addRowFn);
|
virtual void FetchRows(const AddRowFunction& addRowFn);
|
||||||
|
|
||||||
static Object::Ptr HostAccessor(const Object::Ptr& object);
|
static Object::Ptr HostAccessor(const Object::Ptr& object);
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ String StatusTable::GetName(void) const
|
|||||||
return "status";
|
return "status";
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatusTable::FetchRows(const function<void (const Object::Ptr&)>& addRowFn)
|
void StatusTable::FetchRows(const AddRowFunction& addRowFn)
|
||||||
{
|
{
|
||||||
Object::Ptr obj = boost::make_shared<Object>();
|
Object::Ptr obj = boost::make_shared<Object>();
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ public:
|
|||||||
virtual String GetName(void) const;
|
virtual String GetName(void) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void FetchRows(const function<void (const Object::Ptr&)>& addRowFn);
|
virtual void FetchRows(const AddRowFunction& addRowFn);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "i2-livestatus.h"
|
#include "i2-livestatus.h"
|
||||||
|
#include <boost/tuple/tuple.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
using namespace livestatus;
|
using namespace livestatus;
|
||||||
@ -70,7 +71,7 @@ vector<String> Table::GetColumnNames(void) const
|
|||||||
vector<String> names;
|
vector<String> names;
|
||||||
|
|
||||||
String name;
|
String name;
|
||||||
BOOST_FOREACH(tie(name, tuples::ignore), m_Columns) {
|
BOOST_FOREACH(boost::tie(name, boost::tuples::ignore), m_Columns) {
|
||||||
names.push_back(name);
|
names.push_back(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,8 @@ public:
|
|||||||
typedef shared_ptr<Table> Ptr;
|
typedef shared_ptr<Table> Ptr;
|
||||||
typedef weak_ptr<Table> WeakPtr;
|
typedef weak_ptr<Table> WeakPtr;
|
||||||
|
|
||||||
|
typedef boost::function<void (const Object::Ptr&)> AddRowFunction;
|
||||||
|
|
||||||
static Table::Ptr GetByName(const String& name);
|
static Table::Ptr GetByName(const String& name);
|
||||||
|
|
||||||
|
|
||||||
@ -48,7 +50,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
Table(void);
|
Table(void);
|
||||||
|
|
||||||
virtual void FetchRows(const function<void (const Object::Ptr&)>& addRowFn) = 0;
|
virtual void FetchRows(const AddRowFunction& addRowFn) = 0;
|
||||||
|
|
||||||
static Value ZeroAccessor(const Object::Ptr&);
|
static Value ZeroAccessor(const Object::Ptr&);
|
||||||
static Value OneAccessor(const Object::Ptr&);
|
static Value OneAccessor(const Object::Ptr&);
|
||||||
|
@ -18,7 +18,8 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include <i2-icinga.h>
|
#include <i2-icinga.h>
|
||||||
|
#include <boost/program_options.hpp>
|
||||||
|
#include <boost/tuple/tuple.hpp>
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
# include "icinga-version.h"
|
# include "icinga-version.h"
|
||||||
@ -49,7 +50,7 @@ static bool LoadConfigFiles(bool validateOnly)
|
|||||||
}
|
}
|
||||||
|
|
||||||
String name, fragment;
|
String name, fragment;
|
||||||
BOOST_FOREACH(tie(name, fragment), ConfigFragmentRegistry::GetInstance()->GetItems()) {
|
BOOST_FOREACH(boost::tie(name, fragment), ConfigFragmentRegistry::GetInstance()->GetItems()) {
|
||||||
ConfigCompiler::CompileText(name, fragment);
|
ConfigCompiler::CompileText(name, fragment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,9 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "i2-base.h"
|
#include "i2-base.h"
|
||||||
|
#include <boost/algorithm/string/classification.hpp>
|
||||||
|
#include <boost/thread/thread.hpp>
|
||||||
|
#include <boost/bind.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
@ -126,7 +129,7 @@ void Application::ShutdownTimerHandler(void)
|
|||||||
void Application::RunEventLoop(void) const
|
void Application::RunEventLoop(void) const
|
||||||
{
|
{
|
||||||
/* Start the system time watch thread. */
|
/* Start the system time watch thread. */
|
||||||
thread t(&Application::TimeWatchThreadProc);
|
boost::thread t(&Application::TimeWatchThreadProc);
|
||||||
t.detach();
|
t.detach();
|
||||||
|
|
||||||
/* Set up a timer that watches the m_Shutdown flag. */
|
/* Set up a timer that watches the m_Shutdown flag. */
|
||||||
|
@ -20,6 +20,11 @@
|
|||||||
#ifndef ASYNCTASK_H
|
#ifndef ASYNCTASK_H
|
||||||
#define ASYNCTASK_H
|
#define ASYNCTASK_H
|
||||||
|
|
||||||
|
#include <boost/function.hpp>
|
||||||
|
#include <boost/thread/mutex.hpp>
|
||||||
|
#include <boost/thread/condition_variable.hpp>
|
||||||
|
#include <boost/bind.hpp>
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -38,7 +43,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* A completion callback for an AsyncTask.
|
* A completion callback for an AsyncTask.
|
||||||
*/
|
*/
|
||||||
typedef function<void (const shared_ptr<TClass>&)> CompletionCallback;
|
typedef boost::function<void (const shared_ptr<TClass>&)> CompletionCallback;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for the AsyncTask class.
|
* Constructor for the AsyncTask class.
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "i2-base.h"
|
#include "i2-base.h"
|
||||||
|
#include <boost/bind.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "i2-base.h"
|
#include "i2-base.h"
|
||||||
|
#include <boost/lexical_cast.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "i2-base.h"
|
#include "i2-base.h"
|
||||||
#include <cJSON.h>
|
#include <cJSON.h>
|
||||||
|
#include <boost/tuple/tuple.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
@ -248,7 +249,7 @@ Dictionary::Ptr Dictionary::ShallowClone(void) const
|
|||||||
|
|
||||||
String key;
|
String key;
|
||||||
Value value;
|
Value value;
|
||||||
BOOST_FOREACH(tie(key, value), m_Data) {
|
BOOST_FOREACH(boost::tie(key, value), m_Data) {
|
||||||
clone->Set(key, value);
|
clone->Set(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,7 +295,7 @@ cJSON *Dictionary::ToJson(void) const
|
|||||||
|
|
||||||
String key;
|
String key;
|
||||||
Value value;
|
Value value;
|
||||||
BOOST_FOREACH(tie(key, value), m_Data) {
|
BOOST_FOREACH(boost::tie(key, value), m_Data) {
|
||||||
cJSON_AddItemToObject(json, key.CStr(), value.ToJson());
|
cJSON_AddItemToObject(json, key.CStr(), value.ToJson());
|
||||||
}
|
}
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
#ifndef DYNAMICOBJECT_H
|
#ifndef DYNAMICOBJECT_H
|
||||||
#define DYNAMICOBJECT_H
|
#define DYNAMICOBJECT_H
|
||||||
|
|
||||||
|
#include <boost/thread/once.hpp>
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
#ifndef DYNAMICTYPE_H
|
#ifndef DYNAMICTYPE_H
|
||||||
#define DYNAMICTYPE_H
|
#define DYNAMICTYPE_H
|
||||||
|
|
||||||
|
#include <boost/function.hpp>
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -29,7 +31,7 @@ public:
|
|||||||
typedef shared_ptr<DynamicType> Ptr;
|
typedef shared_ptr<DynamicType> Ptr;
|
||||||
typedef weak_ptr<DynamicType> WeakPtr;
|
typedef weak_ptr<DynamicType> WeakPtr;
|
||||||
|
|
||||||
typedef function<DynamicObject::Ptr (const Dictionary::Ptr&)> ObjectFactory;
|
typedef boost::function<DynamicObject::Ptr (const Dictionary::Ptr&)> ObjectFactory;
|
||||||
|
|
||||||
DynamicType(const String& name, const ObjectFactory& factory);
|
DynamicType(const String& name, const ObjectFactory& factory);
|
||||||
|
|
||||||
@ -73,7 +75,7 @@ private:
|
|||||||
*
|
*
|
||||||
* @ingroup base
|
* @ingroup base
|
||||||
*/
|
*/
|
||||||
class I2_BASE_API DynamicTypeRegistry : public Registry<DynamicType::Ptr>
|
class DynamicTypeRegistry : public Registry<DynamicType::Ptr>
|
||||||
{ };
|
{ };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "i2-base.h"
|
#include "i2-base.h"
|
||||||
|
#include <boost/bind.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
@ -27,7 +28,7 @@ using namespace icinga;
|
|||||||
EventQueue::EventQueue(void)
|
EventQueue::EventQueue(void)
|
||||||
: m_Stopped(false)
|
: m_Stopped(false)
|
||||||
{
|
{
|
||||||
unsigned int threads = thread::hardware_concurrency();
|
unsigned int threads = boost::thread::hardware_concurrency();
|
||||||
|
|
||||||
if (threads == 0)
|
if (threads == 0)
|
||||||
threads = 1;
|
threads = 1;
|
||||||
@ -37,7 +38,7 @@ EventQueue::EventQueue(void)
|
|||||||
for (unsigned int i = 0; i < threads; i++)
|
for (unsigned int i = 0; i < threads; i++)
|
||||||
m_Threads.create_thread(boost::bind(&EventQueue::QueueThreadProc, this));
|
m_Threads.create_thread(boost::bind(&EventQueue::QueueThreadProc, this));
|
||||||
|
|
||||||
thread reportThread(boost::bind(&EventQueue::ReportThreadProc, this));
|
boost::thread reportThread(boost::bind(&EventQueue::ReportThreadProc, this));
|
||||||
reportThread.detach();
|
reportThread.detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,11 @@
|
|||||||
#ifndef EVENTQUEUE_H
|
#ifndef EVENTQUEUE_H
|
||||||
#define EVENTQUEUE_H
|
#define EVENTQUEUE_H
|
||||||
|
|
||||||
|
#include <boost/function.hpp>
|
||||||
|
#include <boost/thread/thread.hpp>
|
||||||
|
#include <boost/thread/mutex.hpp>
|
||||||
|
#include <boost/thread/condition_variable.hpp>
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -33,7 +38,7 @@ class Timer;
|
|||||||
class I2_BASE_API EventQueue
|
class I2_BASE_API EventQueue
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef function<void ()> Callback;
|
typedef boost::function<void ()> Callback;
|
||||||
|
|
||||||
EventQueue(void);
|
EventQueue(void);
|
||||||
~EventQueue(void);
|
~EventQueue(void);
|
||||||
@ -44,10 +49,10 @@ public:
|
|||||||
void Post(const Callback& callback);
|
void Post(const Callback& callback);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
thread_group m_Threads;
|
boost::thread_group m_Threads;
|
||||||
|
|
||||||
boost::mutex m_Mutex;
|
boost::mutex m_Mutex;
|
||||||
condition_variable m_CV;
|
boost::condition_variable m_CV;
|
||||||
|
|
||||||
bool m_Stopped;
|
bool m_Stopped;
|
||||||
stack<Callback> m_Events;
|
stack<Callback> m_Events;
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
#ifndef EXCEPTION_H
|
#ifndef EXCEPTION_H
|
||||||
#define EXCEPTION_H
|
#define EXCEPTION_H
|
||||||
|
|
||||||
|
#include <boost/thread/tss.hpp>
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -126,21 +126,8 @@ using std::type_info;
|
|||||||
#include <boost/smart_ptr.hpp>
|
#include <boost/smart_ptr.hpp>
|
||||||
#include <boost/make_shared.hpp>
|
#include <boost/make_shared.hpp>
|
||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
#include <boost/function.hpp>
|
|
||||||
#include <boost/signals2.hpp>
|
#include <boost/signals2.hpp>
|
||||||
#include <boost/algorithm/string/trim.hpp>
|
|
||||||
#include <boost/algorithm/string/split.hpp>
|
|
||||||
#include <boost/algorithm/string/join.hpp>
|
|
||||||
#include <boost/algorithm/string/compare.hpp>
|
|
||||||
#include <boost/thread.hpp>
|
|
||||||
#include <boost/variant.hpp>
|
|
||||||
#include <boost/lexical_cast.hpp>
|
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
#include <boost/tuple/tuple.hpp>
|
|
||||||
#include <boost/uuid/uuid.hpp>
|
|
||||||
#include <boost/uuid/uuid_generators.hpp>
|
|
||||||
#include <boost/uuid/uuid_io.hpp>
|
|
||||||
#include <boost/program_options.hpp>
|
|
||||||
#include <boost/exception/diagnostic_information.hpp>
|
#include <boost/exception/diagnostic_information.hpp>
|
||||||
#include <boost/exception/error_info.hpp>
|
#include <boost/exception/error_info.hpp>
|
||||||
#include <boost/exception/errinfo_api_function.hpp>
|
#include <boost/exception/errinfo_api_function.hpp>
|
||||||
@ -149,23 +136,11 @@ using std::type_info;
|
|||||||
#include <boost/multi_index_container.hpp>
|
#include <boost/multi_index_container.hpp>
|
||||||
#include <boost/multi_index/ordered_index.hpp>
|
#include <boost/multi_index/ordered_index.hpp>
|
||||||
#include <boost/multi_index/key_extractors.hpp>
|
#include <boost/multi_index/key_extractors.hpp>
|
||||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
|
||||||
|
|
||||||
using boost::shared_ptr;
|
using boost::shared_ptr;
|
||||||
using boost::weak_ptr;
|
using boost::weak_ptr;
|
||||||
using boost::enable_shared_from_this;
|
|
||||||
using boost::dynamic_pointer_cast;
|
using boost::dynamic_pointer_cast;
|
||||||
using boost::static_pointer_cast;
|
using boost::static_pointer_cast;
|
||||||
using boost::function;
|
|
||||||
using boost::thread;
|
|
||||||
using boost::thread_group;
|
|
||||||
using boost::recursive_mutex;
|
|
||||||
using boost::condition_variable;
|
|
||||||
using boost::system_time;
|
|
||||||
using boost::posix_time::millisec;
|
|
||||||
using boost::tie;
|
|
||||||
using boost::rethrow_exception;
|
|
||||||
using boost::current_exception;
|
|
||||||
using boost::diagnostic_information;
|
using boost::diagnostic_information;
|
||||||
using boost::errinfo_api_function;
|
using boost::errinfo_api_function;
|
||||||
using boost::errinfo_errno;
|
using boost::errinfo_errno;
|
||||||
@ -177,7 +152,6 @@ using boost::multi_index::ordered_unique;
|
|||||||
using boost::multi_index::ordered_non_unique;
|
using boost::multi_index::ordered_non_unique;
|
||||||
using boost::multi_index::nth_index;
|
using boost::multi_index::nth_index;
|
||||||
|
|
||||||
namespace tuples = boost::tuples;
|
|
||||||
namespace signals2 = boost::signals2;
|
namespace signals2 = boost::signals2;
|
||||||
|
|
||||||
#if defined(__APPLE__) && defined(__MACH__)
|
#if defined(__APPLE__) && defined(__MACH__)
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
#ifndef OBJECT_H
|
#ifndef OBJECT_H
|
||||||
#define OBJECT_H
|
#define OBJECT_H
|
||||||
|
|
||||||
|
#include <boost/thread/mutex.hpp>
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -31,7 +33,7 @@ class SharedPtrHolder;
|
|||||||
*
|
*
|
||||||
* @ingroup base
|
* @ingroup base
|
||||||
*/
|
*/
|
||||||
class I2_BASE_API Object : public enable_shared_from_this<Object>
|
class I2_BASE_API Object : public boost::enable_shared_from_this<Object>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef shared_ptr<Object> Ptr;
|
typedef shared_ptr<Object> Ptr;
|
||||||
|
@ -18,13 +18,15 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "i2-base.h"
|
#include "i2-base.h"
|
||||||
|
#include <boost/bind.hpp>
|
||||||
|
#include <boost/tuple/tuple.hpp>
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#include <execvpe.h>
|
#include <execvpe.h>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
condition_variable Process::m_CV;
|
boost::condition_variable Process::m_CV;
|
||||||
int Process::m_TaskFd;
|
int Process::m_TaskFd;
|
||||||
Timer::Ptr Process::m_StatusTimer;
|
Timer::Ptr Process::m_StatusTimer;
|
||||||
|
|
||||||
@ -60,7 +62,7 @@ void Process::Initialize(void)
|
|||||||
|
|
||||||
m_TaskFd = fds[1];
|
m_TaskFd = fds[1];
|
||||||
|
|
||||||
unsigned int threads = thread::hardware_concurrency();
|
unsigned int threads = boost::thread::hardware_concurrency();
|
||||||
|
|
||||||
if (threads == 0)
|
if (threads == 0)
|
||||||
threads = 2;
|
threads = 2;
|
||||||
@ -77,7 +79,7 @@ void Process::Initialize(void)
|
|||||||
Utility::SetNonBlocking(childTaskFd);
|
Utility::SetNonBlocking(childTaskFd);
|
||||||
Utility::SetCloExec(childTaskFd);
|
Utility::SetCloExec(childTaskFd);
|
||||||
|
|
||||||
thread t(&Process::WorkerThreadProc, childTaskFd);
|
boost::thread t(&Process::WorkerThreadProc, childTaskFd);
|
||||||
t.detach();
|
t.detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +110,7 @@ void Process::WorkerThreadProc(int taskFd)
|
|||||||
int idx = 0;
|
int idx = 0;
|
||||||
|
|
||||||
int fd;
|
int fd;
|
||||||
BOOST_FOREACH(tie(fd, tuples::ignore), tasks) {
|
BOOST_FOREACH(boost::tie(fd, boost::tuples::ignore), tasks) {
|
||||||
pfds[idx].fd = fd;
|
pfds[idx].fd = fd;
|
||||||
pfds[idx].events = POLLIN | POLLHUP;
|
pfds[idx].events = POLLIN | POLLHUP;
|
||||||
idx++;
|
idx++;
|
||||||
@ -284,7 +286,7 @@ void Process::InitTask(void)
|
|||||||
String key;
|
String key;
|
||||||
Value value;
|
Value value;
|
||||||
int index = envc;
|
int index = envc;
|
||||||
BOOST_FOREACH(tie(key, value), m_ExtraEnvironment) {
|
BOOST_FOREACH(boost::tie(key, value), m_ExtraEnvironment) {
|
||||||
String kv = key + "=" + Convert::ToString(value);
|
String kv = key + "=" + Convert::ToString(value);
|
||||||
envp[index] = strdup(kv.CStr());
|
envp[index] = strdup(kv.CStr());
|
||||||
index++;
|
index++;
|
||||||
|
@ -20,6 +20,10 @@
|
|||||||
#ifndef PROCESS_H
|
#ifndef PROCESS_H
|
||||||
#define PROCESS_H
|
#define PROCESS_H
|
||||||
|
|
||||||
|
#include <boost/thread/mutex.hpp>
|
||||||
|
#include <boost/thread/condition_variable.hpp>
|
||||||
|
#include <boost/thread/once.hpp>
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -71,7 +75,7 @@ private:
|
|||||||
static boost::mutex m_Mutex;
|
static boost::mutex m_Mutex;
|
||||||
static deque<Process::Ptr> m_Tasks;
|
static deque<Process::Ptr> m_Tasks;
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
static condition_variable m_CV;
|
static boost::condition_variable m_CV;
|
||||||
static int m_TaskFd;
|
static int m_TaskFd;
|
||||||
|
|
||||||
static Timer::Ptr m_StatusTimer;
|
static Timer::Ptr m_StatusTimer;
|
||||||
|
@ -18,6 +18,9 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "i2-base.h"
|
#include "i2-base.h"
|
||||||
|
#include <boost/algorithm/string/trim.hpp>
|
||||||
|
#include <boost/algorithm/string/join.hpp>
|
||||||
|
#include <boost/algorithm/string/compare.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
#ifndef STRING_H
|
#ifndef STRING_H
|
||||||
#define STRING_H
|
#define STRING_H
|
||||||
|
|
||||||
|
#include <boost/algorithm/string/split.hpp>
|
||||||
|
|
||||||
namespace icinga {
|
namespace icinga {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,7 +29,7 @@ namespace icinga
|
|||||||
* @ingroup base
|
* @ingroup base
|
||||||
*/
|
*/
|
||||||
template<typename T>
|
template<typename T>
|
||||||
class Registry
|
class I2_BASE_API Registry
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef map<String, T, string_iless> ItemMap;
|
typedef map<String, T, string_iless> ItemMap;
|
||||||
|
@ -26,10 +26,10 @@ REGISTER_TYPE(Script);
|
|||||||
/**
|
/**
|
||||||
* Constructor for the Script class.
|
* Constructor for the Script class.
|
||||||
*
|
*
|
||||||
* @param properties A serialized dictionary containing attributes.
|
* @param serializedUpdate A serialized dictionary containing attributes.
|
||||||
*/
|
*/
|
||||||
Script::Script(const Dictionary::Ptr& properties)
|
Script::Script(const Dictionary::Ptr& serializedUpdate)
|
||||||
: DynamicObject(properties)
|
: DynamicObject(serializedUpdate)
|
||||||
{
|
{
|
||||||
RegisterAttribute("language", Attribute_Config, &m_Language);
|
RegisterAttribute("language", Attribute_Config, &m_Language);
|
||||||
RegisterAttribute("code", Attribute_Config, &m_Code);
|
RegisterAttribute("code", Attribute_Config, &m_Code);
|
||||||
|
@ -36,7 +36,7 @@ public:
|
|||||||
typedef shared_ptr<Script> Ptr;
|
typedef shared_ptr<Script> Ptr;
|
||||||
typedef weak_ptr<Script> WeakPtr;
|
typedef weak_ptr<Script> WeakPtr;
|
||||||
|
|
||||||
Script(const Dictionary::Ptr& properties);
|
Script(const Dictionary::Ptr& serializedUpdate);
|
||||||
|
|
||||||
virtual void Start(void);
|
virtual void Start(void);
|
||||||
|
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
#ifndef SCRIPTFUNCTION_H
|
#ifndef SCRIPTFUNCTION_H
|
||||||
#define SCRIPTFUNCTION_H
|
#define SCRIPTFUNCTION_H
|
||||||
|
|
||||||
|
#include <boost/function.hpp>
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -36,7 +38,7 @@ public:
|
|||||||
typedef shared_ptr<ScriptFunction> Ptr;
|
typedef shared_ptr<ScriptFunction> Ptr;
|
||||||
typedef weak_ptr<ScriptFunction> WeakPtr;
|
typedef weak_ptr<ScriptFunction> WeakPtr;
|
||||||
|
|
||||||
typedef function<void (const shared_ptr<ScriptTask>&, const vector<Value>& arguments)> Callback;
|
typedef boost::function<void (const shared_ptr<ScriptTask>&, const vector<Value>& arguments)> Callback;
|
||||||
|
|
||||||
explicit ScriptFunction(const Callback& function);
|
explicit ScriptFunction(const Callback& function);
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ namespace icinga
|
|||||||
* @ingroup base
|
* @ingroup base
|
||||||
*/
|
*/
|
||||||
template<typename T>
|
template<typename T>
|
||||||
class Singleton
|
class I2_BASE_API Singleton
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static T *GetInstance(void)
|
static T *GetInstance(void)
|
||||||
@ -38,17 +38,20 @@ public:
|
|||||||
static boost::mutex mutex;
|
static boost::mutex mutex;
|
||||||
boost::mutex::scoped_lock lock(mutex);
|
boost::mutex::scoped_lock lock(mutex);
|
||||||
|
|
||||||
static T *instance = NULL;
|
if (!m_Instance)
|
||||||
|
m_Instance = new T();
|
||||||
|
|
||||||
if (!instance)
|
return m_Instance;
|
||||||
instance = new T();
|
|
||||||
|
|
||||||
return instance;
|
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
friend T *T::GetInstance(void);
|
friend T *T::GetInstance(void);
|
||||||
|
|
||||||
|
static T *m_Instance;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
T *Singleton<T>::m_Instance = NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* SINGLETON_H */
|
#endif /* SINGLETON_H */
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "i2-base.h"
|
#include "i2-base.h"
|
||||||
|
#include <boost/bind.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
@ -51,11 +52,11 @@ void Socket::Start(void)
|
|||||||
ASSERT(!m_ReadThread.joinable() && !m_WriteThread.joinable());
|
ASSERT(!m_ReadThread.joinable() && !m_WriteThread.joinable());
|
||||||
ASSERT(GetFD() != INVALID_SOCKET);
|
ASSERT(GetFD() != INVALID_SOCKET);
|
||||||
|
|
||||||
// TODO: figure out why we're not using "this" here
|
// TODO: figure out why we're not using "this" here (hint: to keep the object alive until the threads are done)
|
||||||
m_ReadThread = thread(boost::bind(&Socket::ReadThreadProc, static_cast<Socket::Ptr>(GetSelf())));
|
m_ReadThread = boost::thread(boost::bind(&Socket::ReadThreadProc, static_cast<Socket::Ptr>(GetSelf())));
|
||||||
m_ReadThread.detach();
|
m_ReadThread.detach();
|
||||||
|
|
||||||
m_WriteThread = thread(boost::bind(&Socket::WriteThreadProc, static_cast<Socket::Ptr>(GetSelf())));
|
m_WriteThread = boost::thread(boost::bind(&Socket::WriteThreadProc, static_cast<Socket::Ptr>(GetSelf())));
|
||||||
m_WriteThread.detach();
|
m_WriteThread.detach();
|
||||||
|
|
||||||
Stream::Start();
|
Stream::Start();
|
||||||
|
@ -20,6 +20,10 @@
|
|||||||
#ifndef SOCKET_H
|
#ifndef SOCKET_H
|
||||||
#define SOCKET_H
|
#define SOCKET_H
|
||||||
|
|
||||||
|
#include <boost/thread/thread.hpp>
|
||||||
|
#include <boost/thread/mutex.hpp>
|
||||||
|
#include <boost/thread/condition_variable.hpp>
|
||||||
|
|
||||||
namespace icinga {
|
namespace icinga {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -69,10 +73,10 @@ private:
|
|||||||
bool m_Connected;
|
bool m_Connected;
|
||||||
bool m_Listening;
|
bool m_Listening;
|
||||||
|
|
||||||
thread m_ReadThread;
|
boost::thread m_ReadThread;
|
||||||
thread m_WriteThread;
|
boost::thread m_WriteThread;
|
||||||
|
|
||||||
condition_variable m_WriteCV;
|
boost::condition_variable m_WriteCV;
|
||||||
|
|
||||||
void ReadThreadProc(void);
|
void ReadThreadProc(void);
|
||||||
void WriteThreadProc(void);
|
void WriteThreadProc(void);
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
#ifndef STACKTRACE_H
|
#ifndef STACKTRACE_H
|
||||||
#define STACKTRACE_H
|
#define STACKTRACE_H
|
||||||
|
|
||||||
|
#include <boost/thread/once.hpp>
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "i2-base.h"
|
#include "i2-base.h"
|
||||||
|
#include <boost/algorithm/string/trim.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
#ifndef STREAM_H
|
#ifndef STREAM_H
|
||||||
#define STREAM_H
|
#define STREAM_H
|
||||||
|
|
||||||
|
#include <boost/exception_ptr.hpp>
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -18,11 +18,12 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "i2-base.h"
|
#include "i2-base.h"
|
||||||
|
#include <boost/bind.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
Timer::TimerSet Timer::m_Timers;
|
Timer::TimerSet Timer::m_Timers;
|
||||||
thread Timer::m_Thread;
|
boost::thread Timer::m_Thread;
|
||||||
boost::mutex Timer::m_Mutex;
|
boost::mutex Timer::m_Mutex;
|
||||||
boost::condition_variable Timer::m_CV;
|
boost::condition_variable Timer::m_CV;
|
||||||
bool Timer::m_StopThread;
|
bool Timer::m_StopThread;
|
||||||
@ -62,7 +63,7 @@ void Timer::Initialize(void)
|
|||||||
{
|
{
|
||||||
boost::mutex::scoped_lock lock(m_Mutex);
|
boost::mutex::scoped_lock lock(m_Mutex);
|
||||||
m_StopThread = false;
|
m_StopThread = false;
|
||||||
m_Thread = thread(boost::bind(&Timer::TimerThreadProc));
|
m_Thread = boost::thread(boost::bind(&Timer::TimerThreadProc));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -20,7 +20,9 @@
|
|||||||
#ifndef TIMER_H
|
#ifndef TIMER_H
|
||||||
#define TIMER_H
|
#define TIMER_H
|
||||||
|
|
||||||
#include <time.h>
|
#include <boost/thread/thread.hpp>
|
||||||
|
#include <boost/thread/mutex.hpp>
|
||||||
|
#include <boost/thread/condition_variable.hpp>
|
||||||
|
|
||||||
namespace icinga {
|
namespace icinga {
|
||||||
|
|
||||||
@ -82,7 +84,7 @@ private:
|
|||||||
|
|
||||||
static boost::mutex m_Mutex;
|
static boost::mutex m_Mutex;
|
||||||
static boost::condition_variable m_CV;
|
static boost::condition_variable m_CV;
|
||||||
static thread m_Thread;
|
static boost::thread m_Thread;
|
||||||
static bool m_StopThread;
|
static bool m_StopThread;
|
||||||
static TimerSet m_Timers;
|
static TimerSet m_Timers;
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "i2-base.h"
|
#include "i2-base.h"
|
||||||
|
#include <boost/bind.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
|
@ -19,6 +19,11 @@
|
|||||||
|
|
||||||
#include "i2-base.h"
|
#include "i2-base.h"
|
||||||
#include <mmatch.h>
|
#include <mmatch.h>
|
||||||
|
#include <boost/uuid/uuid.hpp>
|
||||||
|
#include <boost/uuid/uuid_generators.hpp>
|
||||||
|
#include <boost/uuid/uuid_io.hpp>
|
||||||
|
#include <boost/lexical_cast.hpp>
|
||||||
|
#include <boost/function.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
@ -402,7 +407,7 @@ String Utility::NewUUID(void)
|
|||||||
*
|
*
|
||||||
* @param pathSpec The path specification.
|
* @param pathSpec The path specification.
|
||||||
*/
|
*/
|
||||||
bool Utility::Glob(const String& pathSpec, const function<void (const String&)>& callback)
|
bool Utility::Glob(const String& pathSpec, const boost::function<void (const String&)>& callback)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
HANDLE handle;
|
HANDLE handle;
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
#ifndef UTILITY_H
|
#ifndef UTILITY_H
|
||||||
#define UTILITY_H
|
#define UTILITY_H
|
||||||
|
|
||||||
|
#include <boost/function.hpp>
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -53,7 +55,7 @@ public:
|
|||||||
|
|
||||||
static String NewUUID(void);
|
static String NewUUID(void);
|
||||||
|
|
||||||
static bool Glob(const String& pathSpec, const function<void (const String&)>& callback);
|
static bool Glob(const String& pathSpec, const boost::function<void (const String&)>& callback);
|
||||||
|
|
||||||
static void QueueAsyncCallback(const boost::function<void (void)>& callback);
|
static void QueueAsyncCallback(const boost::function<void (void)>& callback);
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "i2-base.h"
|
#include "i2-base.h"
|
||||||
#include <cJSON.h>
|
#include <cJSON.h>
|
||||||
|
#include <boost/lexical_cast.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
#ifndef VALUE_H
|
#ifndef VALUE_H
|
||||||
#define VALUE_H
|
#define VALUE_H
|
||||||
|
|
||||||
|
#include <boost/variant.hpp>
|
||||||
|
|
||||||
struct cJSON;
|
struct cJSON;
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
|
@ -32,7 +32,7 @@ namespace icinga
|
|||||||
class I2_CONFIG_API ConfigCompiler
|
class I2_CONFIG_API ConfigCompiler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef function<void (const String&, bool, const DebugInfo&)> HandleIncludeFunc;
|
typedef boost::function<void (const String&, bool, const DebugInfo&)> HandleIncludeFunc;
|
||||||
|
|
||||||
explicit ConfigCompiler(const String& path, istream *input = &cin,
|
explicit ConfigCompiler(const String& path, istream *input = &cin,
|
||||||
HandleIncludeFunc includeHandler = &ConfigCompiler::HandleFileInclude);
|
HandleIncludeFunc includeHandler = &ConfigCompiler::HandleFileInclude);
|
||||||
@ -72,7 +72,7 @@ private:
|
|||||||
void DestroyScanner(void);
|
void DestroyScanner(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
class I2_CONFIG_API ConfigFragmentRegistry : public Registry<String>
|
class ConfigFragmentRegistry : public Registry<String>
|
||||||
{ };
|
{ };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,10 +18,11 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "i2-config.h"
|
#include "i2-config.h"
|
||||||
|
#include <boost/tuple/tuple.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
recursive_mutex ConfigItem::m_Mutex;
|
boost::mutex ConfigItem::m_Mutex;
|
||||||
ConfigItem::ItemMap ConfigItem::m_Items;
|
ConfigItem::ItemMap ConfigItem::m_Items;
|
||||||
signals2::signal<void (const ConfigItem::Ptr&)> ConfigItem::OnCommitted;
|
signals2::signal<void (const ConfigItem::Ptr&)> ConfigItem::OnCommitted;
|
||||||
signals2::signal<void (const ConfigItem::Ptr&)> ConfigItem::OnRemoved;
|
signals2::signal<void (const ConfigItem::Ptr&)> ConfigItem::OnRemoved;
|
||||||
@ -184,7 +185,7 @@ DynamicObject::Ptr ConfigItem::Commit(void)
|
|||||||
ConfigItem::Ptr oldItem;
|
ConfigItem::Ptr oldItem;
|
||||||
|
|
||||||
{
|
{
|
||||||
recursive_mutex::scoped_lock lock(m_Mutex);
|
boost::mutex::scoped_lock lock(m_Mutex);
|
||||||
|
|
||||||
ItemMap::iterator it = m_Items.find(ikey);
|
ItemMap::iterator it = m_Items.find(ikey);
|
||||||
|
|
||||||
@ -212,7 +213,7 @@ DynamicObject::Ptr ConfigItem::Commit(void)
|
|||||||
ConfigItem::Ptr self = GetSelf();
|
ConfigItem::Ptr self = GetSelf();
|
||||||
|
|
||||||
{
|
{
|
||||||
recursive_mutex::scoped_lock lock(m_Mutex);
|
boost::mutex::scoped_lock lock(m_Mutex);
|
||||||
|
|
||||||
/* Register this item. */
|
/* Register this item. */
|
||||||
m_Items[ikey] = self;
|
m_Items[ikey] = self;
|
||||||
@ -242,7 +243,7 @@ DynamicObject::Ptr ConfigItem::Commit(void)
|
|||||||
|
|
||||||
String key;
|
String key;
|
||||||
Value data;
|
Value data;
|
||||||
BOOST_FOREACH(tie(key, data), properties) {
|
BOOST_FOREACH(boost::tie(key, data), properties) {
|
||||||
Dictionary::Ptr attr = boost::make_shared<Dictionary>();
|
Dictionary::Ptr attr = boost::make_shared<Dictionary>();
|
||||||
attr->Set("data", data);
|
attr->Set("data", data);
|
||||||
attr->Set("type", Attribute_Config);
|
attr->Set("type", Attribute_Config);
|
||||||
@ -377,7 +378,7 @@ DynamicObject::Ptr ConfigItem::GetDynamicObject(void) const
|
|||||||
*/
|
*/
|
||||||
ConfigItem::Ptr ConfigItem::GetObject(const String& type, const String& name)
|
ConfigItem::Ptr ConfigItem::GetObject(const String& type, const String& name)
|
||||||
{
|
{
|
||||||
recursive_mutex::scoped_lock lock(m_Mutex);
|
boost::mutex::scoped_lock lock(m_Mutex);
|
||||||
|
|
||||||
ConfigItem::ItemMap::iterator it;
|
ConfigItem::ItemMap::iterator it;
|
||||||
|
|
||||||
@ -425,20 +426,22 @@ void ConfigItem::Dump(ostream& fp) const
|
|||||||
*/
|
*/
|
||||||
void ConfigItem::UnloadUnit(const String& unit)
|
void ConfigItem::UnloadUnit(const String& unit)
|
||||||
{
|
{
|
||||||
recursive_mutex::scoped_lock lock(m_Mutex);
|
|
||||||
|
|
||||||
Logger::Write(LogInformation, "config", "Unloading config items from compilation unit '" + unit + "'");
|
|
||||||
|
|
||||||
vector<ConfigItem::Ptr> obsoleteItems;
|
vector<ConfigItem::Ptr> obsoleteItems;
|
||||||
|
|
||||||
ConfigItem::Ptr item;
|
{
|
||||||
BOOST_FOREACH(tie(tuples::ignore, item), m_Items) {
|
boost::mutex::scoped_lock lock(m_Mutex);
|
||||||
ObjectLock olock(item);
|
|
||||||
|
|
||||||
if (item->m_Unit != unit)
|
Logger::Write(LogInformation, "config", "Unloading config items from compilation unit '" + unit + "'");
|
||||||
continue;
|
|
||||||
|
|
||||||
obsoleteItems.push_back(item);
|
ConfigItem::Ptr item;
|
||||||
|
BOOST_FOREACH(boost::tie(boost::tuples::ignore, item), m_Items) {
|
||||||
|
ObjectLock olock(item);
|
||||||
|
|
||||||
|
if (item->m_Unit != unit)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
obsoleteItems.push_back(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const ConfigItem::Ptr& item, obsoleteItems) {
|
BOOST_FOREACH(const ConfigItem::Ptr& item, obsoleteItems) {
|
||||||
|
@ -89,7 +89,7 @@ private:
|
|||||||
set<ConfigItem::WeakPtr> m_ChildObjects; /**< Instantiated items
|
set<ConfigItem::WeakPtr> m_ChildObjects; /**< Instantiated items
|
||||||
* that inherit from this item */
|
* that inherit from this item */
|
||||||
|
|
||||||
static recursive_mutex m_Mutex;
|
static boost::mutex m_Mutex;
|
||||||
|
|
||||||
typedef map<pair<String, String>, ConfigItem::Ptr> ItemMap;
|
typedef map<pair<String, String>, ConfigItem::Ptr> ItemMap;
|
||||||
static ItemMap m_Items; /**< All registered configuration items. */
|
static ItemMap m_Items; /**< All registered configuration items. */
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "i2-config.h"
|
#include "i2-config.h"
|
||||||
|
#include <boost/tuple/tuple.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
@ -141,7 +142,7 @@ void ConfigType::ValidateDictionary(const Dictionary::Ptr& dictionary,
|
|||||||
|
|
||||||
String key;
|
String key;
|
||||||
Value value;
|
Value value;
|
||||||
BOOST_FOREACH(tie(key, value), dictionary) {
|
BOOST_FOREACH(boost::tie(key, value), dictionary) {
|
||||||
TypeValidationResult overallResult = ValidationUnknownField;
|
TypeValidationResult overallResult = ValidationUnknownField;
|
||||||
vector<TypeRuleList::Ptr> subRuleLists;
|
vector<TypeRuleList::Ptr> subRuleLists;
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "i2-config.h"
|
#include "i2-config.h"
|
||||||
|
#include <boost/tuple/tuple.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
@ -89,7 +90,7 @@ void Expression::Execute(const Dictionary::Ptr& dictionary) const
|
|||||||
|
|
||||||
String key;
|
String key;
|
||||||
Value value;
|
Value value;
|
||||||
BOOST_FOREACH(tie(key, value), valueDict) {
|
BOOST_FOREACH(boost::tie(key, value), valueDict) {
|
||||||
dict->Set(key, value);
|
dict->Set(key, value);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -134,7 +135,7 @@ void Expression::DumpValue(ostream& fp, int indent, const Value& value, bool inl
|
|||||||
|
|
||||||
String k;
|
String k;
|
||||||
Value v;
|
Value v;
|
||||||
BOOST_FOREACH(tie(k, v), static_cast<Dictionary::Ptr>(value)) {
|
BOOST_FOREACH(boost::tie(k, v), static_cast<Dictionary::Ptr>(value)) {
|
||||||
for (int i = 0; i < indent; i++)
|
for (int i = 0; i < indent; i++)
|
||||||
fp << "\t";
|
fp << "\t";
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "i2-icinga.h"
|
#include "i2-icinga.h"
|
||||||
|
#include <boost/algorithm/string/classification.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
@ -49,7 +50,7 @@ void ExternalCommandProcessor::Execute(const String& line)
|
|||||||
if (ts == 0)
|
if (ts == 0)
|
||||||
BOOST_THROW_EXCEPTION(invalid_argument("Invalid timestamp in command: " + line));
|
BOOST_THROW_EXCEPTION(invalid_argument("Invalid timestamp in command: " + line));
|
||||||
|
|
||||||
vector<String> argv = args.Split(is_any_of(";"));
|
vector<String> argv = args.Split(boost::is_any_of(";"));
|
||||||
|
|
||||||
if (argv.empty())
|
if (argv.empty())
|
||||||
BOOST_THROW_EXCEPTION(invalid_argument("Missing arguments in command: " + line));
|
BOOST_THROW_EXCEPTION(invalid_argument("Missing arguments in command: " + line));
|
||||||
|
@ -29,7 +29,7 @@ public:
|
|||||||
static void Execute(double time, const String& command, const vector<String>& arguments);
|
static void Execute(double time, const String& command, const vector<String>& arguments);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef function<void (double time, const vector<String>& arguments)> Callback;
|
typedef boost::function<void (double time, const vector<String>& arguments)> Callback;
|
||||||
|
|
||||||
static boost::once_flag m_InitializeOnce;
|
static boost::once_flag m_InitializeOnce;
|
||||||
static boost::mutex m_Mutex;
|
static boost::mutex m_Mutex;
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "i2-icinga.h"
|
#include "i2-icinga.h"
|
||||||
|
#include <boost/tuple/tuple.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
@ -48,7 +49,7 @@ Host::~Host(void)
|
|||||||
|
|
||||||
if (m_SlaveServices) {
|
if (m_SlaveServices) {
|
||||||
ConfigItem::Ptr service;
|
ConfigItem::Ptr service;
|
||||||
BOOST_FOREACH(tie(tuples::ignore, service), m_SlaveServices) {
|
BOOST_FOREACH(boost::tie(boost::tuples::ignore, service), m_SlaveServices) {
|
||||||
service->Unregister();
|
service->Unregister();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -225,7 +226,7 @@ void Host::UpdateSlaveServices(void)
|
|||||||
ObjectLock olock(serviceDescs);
|
ObjectLock olock(serviceDescs);
|
||||||
String svcname;
|
String svcname;
|
||||||
Value svcdesc;
|
Value svcdesc;
|
||||||
BOOST_FOREACH(tie(svcname, svcdesc), serviceDescs) {
|
BOOST_FOREACH(boost::tie(svcname, svcdesc), serviceDescs) {
|
||||||
if (svcdesc.IsScalar())
|
if (svcdesc.IsScalar())
|
||||||
svcname = svcdesc;
|
svcname = svcdesc;
|
||||||
|
|
||||||
@ -270,7 +271,7 @@ void Host::UpdateSlaveServices(void)
|
|||||||
ObjectLock olock(oldServices);
|
ObjectLock olock(oldServices);
|
||||||
|
|
||||||
ConfigItem::Ptr service;
|
ConfigItem::Ptr service;
|
||||||
BOOST_FOREACH(tie(tuples::ignore, service), oldServices) {
|
BOOST_FOREACH(boost::tie(boost::tuples::ignore, service), oldServices) {
|
||||||
if (!service)
|
if (!service)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -306,7 +307,7 @@ set<Service::Ptr> Host::GetServices(void) const
|
|||||||
boost::mutex::scoped_lock lock(m_ServiceMutex);
|
boost::mutex::scoped_lock lock(m_ServiceMutex);
|
||||||
|
|
||||||
Service::WeakPtr wservice;
|
Service::WeakPtr wservice;
|
||||||
BOOST_FOREACH(tie(tuples::ignore, wservice), m_ServicesCache[GetName()]) {
|
BOOST_FOREACH(boost::tie(boost::tuples::ignore, wservice), m_ServicesCache[GetName()]) {
|
||||||
Service::Ptr service = wservice.lock();
|
Service::Ptr service = wservice.lock();
|
||||||
|
|
||||||
if (!service)
|
if (!service)
|
||||||
@ -383,7 +384,7 @@ void Host::ValidateServiceDictionary(const ScriptTask::Ptr& task, const vector<V
|
|||||||
|
|
||||||
String key;
|
String key;
|
||||||
Value value;
|
Value value;
|
||||||
BOOST_FOREACH(tie(key, value), attrs) {
|
BOOST_FOREACH(boost::tie(key, value), attrs) {
|
||||||
vector<String> templates;
|
vector<String> templates;
|
||||||
|
|
||||||
if (!value.IsObjectType<Dictionary>())
|
if (!value.IsObjectType<Dictionary>())
|
||||||
|
@ -31,9 +31,6 @@
|
|||||||
#include <i2-config.h>
|
#include <i2-config.h>
|
||||||
#include <i2-remoting.h>
|
#include <i2-remoting.h>
|
||||||
|
|
||||||
using boost::iterator_range;
|
|
||||||
using boost::algorithm::is_any_of;
|
|
||||||
|
|
||||||
#ifdef I2_ICINGA_BUILD
|
#ifdef I2_ICINGA_BUILD
|
||||||
# define I2_ICINGA_API I2_EXPORT
|
# define I2_ICINGA_API I2_EXPORT
|
||||||
#else /* I2_ICINGA_BUILD */
|
#else /* I2_ICINGA_BUILD */
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "i2-icinga.h"
|
#include "i2-icinga.h"
|
||||||
|
#include <boost/tuple/tuple.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
@ -93,7 +94,7 @@ Dictionary::Ptr MacroProcessor::MergeMacroDicts(const vector<Dictionary::Ptr>& d
|
|||||||
|
|
||||||
String key;
|
String key;
|
||||||
Value value;
|
Value value;
|
||||||
BOOST_FOREACH(tie(key, value), dict) {
|
BOOST_FOREACH(boost::tie(key, value), dict) {
|
||||||
if (!value.IsScalar())
|
if (!value.IsScalar())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "i2-icinga.h"
|
#include "i2-icinga.h"
|
||||||
|
#include <boost/tuple/tuple.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
@ -88,13 +89,12 @@ set<User::Ptr> Notification::GetUsers(void) const
|
|||||||
{
|
{
|
||||||
set<User::Ptr> result;
|
set<User::Ptr> result;
|
||||||
|
|
||||||
Dictionary::Ptr users = m_Users;
|
Array::Ptr users = m_Users;
|
||||||
|
|
||||||
if (users) {
|
if (users) {
|
||||||
ObjectLock olock(users);
|
ObjectLock olock(users);
|
||||||
|
|
||||||
String name;
|
BOOST_FOREACH(const String& name, users) {
|
||||||
BOOST_FOREACH(tie(tuples::ignore, name), users) {
|
|
||||||
User::Ptr user = User::GetByName(name);
|
User::Ptr user = User::GetByName(name);
|
||||||
|
|
||||||
if (!user)
|
if (!user)
|
||||||
@ -114,13 +114,12 @@ set<UserGroup::Ptr> Notification::GetGroups(void) const
|
|||||||
{
|
{
|
||||||
set<UserGroup::Ptr> result;
|
set<UserGroup::Ptr> result;
|
||||||
|
|
||||||
Dictionary::Ptr groups = m_Groups;
|
Array::Ptr groups = m_Groups;
|
||||||
|
|
||||||
if (groups) {
|
if (groups) {
|
||||||
ObjectLock olock(groups);
|
ObjectLock olock(groups);
|
||||||
|
|
||||||
String name;
|
BOOST_FOREACH(const String& name, groups) {
|
||||||
BOOST_FOREACH(tie(tuples::ignore, name), groups) {
|
|
||||||
UserGroup::Ptr ug = UserGroup::GetByName(name);
|
UserGroup::Ptr ug = UserGroup::GetByName(name);
|
||||||
|
|
||||||
if (!ug)
|
if (!ug)
|
||||||
|
@ -73,8 +73,8 @@ protected:
|
|||||||
private:
|
private:
|
||||||
Attribute<Value> m_NotificationCommand;
|
Attribute<Value> m_NotificationCommand;
|
||||||
Attribute<Dictionary::Ptr> m_Macros;
|
Attribute<Dictionary::Ptr> m_Macros;
|
||||||
Attribute<Dictionary::Ptr> m_Users;
|
Attribute<Array::Ptr> m_Users;
|
||||||
Attribute<Dictionary::Ptr> m_Groups;
|
Attribute<Array::Ptr> m_Groups;
|
||||||
Attribute<String> m_HostName;
|
Attribute<String> m_HostName;
|
||||||
Attribute<String> m_Service;
|
Attribute<String> m_Service;
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "i2-icinga.h"
|
#include "i2-icinga.h"
|
||||||
|
#include <boost/algorithm/string/classification.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
@ -104,7 +105,7 @@ Dictionary::Ptr PluginCheckTask::ParseCheckOutput(const String& output)
|
|||||||
String text;
|
String text;
|
||||||
String perfdata;
|
String perfdata;
|
||||||
|
|
||||||
vector<String> lines = output.Split(is_any_of("\r\n"));
|
vector<String> lines = output.Split(boost::is_any_of("\r\n"));
|
||||||
|
|
||||||
BOOST_FOREACH (const String& line, lines) {
|
BOOST_FOREACH (const String& line, lines) {
|
||||||
size_t delim = line.FindFirstOf("|");
|
size_t delim = line.FindFirstOf("|");
|
||||||
|
@ -578,7 +578,7 @@ bool Service::IsAllowedChecker(const String& checker) const
|
|||||||
/**
|
/**
|
||||||
* @threadsafety Always.
|
* @threadsafety Always.
|
||||||
*/
|
*/
|
||||||
void Service::BeginExecuteCheck(const function<void (void)>& callback)
|
void Service::BeginExecuteCheck(const boost::function<void (void)>& callback)
|
||||||
{
|
{
|
||||||
ASSERT(!OwnsLock());
|
ASSERT(!OwnsLock());
|
||||||
|
|
||||||
@ -629,7 +629,7 @@ void Service::BeginExecuteCheck(const function<void (void)>& callback)
|
|||||||
* @threadsafety Always.
|
* @threadsafety Always.
|
||||||
*/
|
*/
|
||||||
void Service::CheckCompletedHandler(const Dictionary::Ptr& checkInfo,
|
void Service::CheckCompletedHandler(const Dictionary::Ptr& checkInfo,
|
||||||
const ScriptTask::Ptr& task, const function<void (void)>& callback)
|
const ScriptTask::Ptr& task, const boost::function<void (void)>& callback)
|
||||||
{
|
{
|
||||||
ASSERT(!OwnsLock());
|
ASSERT(!OwnsLock());
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "i2-icinga.h"
|
#include "i2-icinga.h"
|
||||||
|
#include <boost/tuple/tuple.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
@ -137,7 +138,7 @@ void Service::TriggerDowntimes(void)
|
|||||||
ObjectLock olock(downtimes);
|
ObjectLock olock(downtimes);
|
||||||
|
|
||||||
String id;
|
String id;
|
||||||
BOOST_FOREACH(tie(id, tuples::ignore), downtimes) {
|
BOOST_FOREACH(boost::tie(id, boost::tuples::ignore), downtimes) {
|
||||||
TriggerDowntime(id);
|
TriggerDowntime(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -165,7 +166,7 @@ void Service::TriggerDowntime(const String& id)
|
|||||||
Dictionary::Ptr triggers = downtime->Get("triggers");
|
Dictionary::Ptr triggers = downtime->Get("triggers");
|
||||||
ObjectLock olock(triggers);
|
ObjectLock olock(triggers);
|
||||||
String tid;
|
String tid;
|
||||||
BOOST_FOREACH(tie(tid, tuples::ignore), triggers) {
|
BOOST_FOREACH(boost::tie(tid, boost::tuples::ignore), triggers) {
|
||||||
TriggerDowntime(tid);
|
TriggerDowntime(tid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,7 +296,7 @@ void Service::RefreshDowntimesCache(void)
|
|||||||
|
|
||||||
String id;
|
String id;
|
||||||
Dictionary::Ptr downtime;
|
Dictionary::Ptr downtime;
|
||||||
BOOST_FOREACH(tie(id, downtime), downtimes) {
|
BOOST_FOREACH(boost::tie(id, downtime), downtimes) {
|
||||||
int legacy_id = downtime->Get("legacy_id");
|
int legacy_id = downtime->Get("legacy_id");
|
||||||
|
|
||||||
if (legacy_id >= m_NextDowntimeID)
|
if (legacy_id >= m_NextDowntimeID)
|
||||||
@ -344,7 +345,7 @@ void Service::RemoveExpiredDowntimes(void)
|
|||||||
|
|
||||||
String id;
|
String id;
|
||||||
Dictionary::Ptr downtime;
|
Dictionary::Ptr downtime;
|
||||||
BOOST_FOREACH(tie(id, downtime), downtimes) {
|
BOOST_FOREACH(boost::tie(id, downtime), downtimes) {
|
||||||
if (IsDowntimeExpired(downtime))
|
if (IsDowntimeExpired(downtime))
|
||||||
expiredDowntimes.push_back(id);
|
expiredDowntimes.push_back(id);
|
||||||
}
|
}
|
||||||
@ -383,7 +384,7 @@ bool Service::IsInDowntime(void) const
|
|||||||
ObjectLock olock(downtimes);
|
ObjectLock olock(downtimes);
|
||||||
|
|
||||||
Dictionary::Ptr downtime;
|
Dictionary::Ptr downtime;
|
||||||
BOOST_FOREACH(tie(tuples::ignore, downtime), downtimes) {
|
BOOST_FOREACH(boost::tie(boost::tuples::ignore, downtime), downtimes) {
|
||||||
if (Service::IsDowntimeActive(downtime))
|
if (Service::IsDowntimeActive(downtime))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "i2-icinga.h"
|
#include "i2-icinga.h"
|
||||||
|
#include <boost/tuple/tuple.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
@ -220,7 +221,7 @@ void Service::UpdateSlaveNotifications(void)
|
|||||||
|
|
||||||
String nfcname;
|
String nfcname;
|
||||||
Value nfcdesc;
|
Value nfcdesc;
|
||||||
BOOST_FOREACH(tie(nfcname, nfcdesc), notificationDescs) {
|
BOOST_FOREACH(boost::tie(nfcname, nfcdesc), notificationDescs) {
|
||||||
stringstream namebuf;
|
stringstream namebuf;
|
||||||
namebuf << GetName() << "-" << nfcname;
|
namebuf << GetName() << "-" << nfcname;
|
||||||
String name = namebuf.str();
|
String name = namebuf.str();
|
||||||
@ -261,7 +262,7 @@ void Service::UpdateSlaveNotifications(void)
|
|||||||
ObjectLock olock(oldNotifications);
|
ObjectLock olock(oldNotifications);
|
||||||
|
|
||||||
ConfigItem::Ptr notification;
|
ConfigItem::Ptr notification;
|
||||||
BOOST_FOREACH(tie(tuples::ignore, notification), oldNotifications) {
|
BOOST_FOREACH(boost::tie(boost::tuples::ignore, notification), oldNotifications) {
|
||||||
if (!notification)
|
if (!notification)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ public:
|
|||||||
void AcknowledgeProblem(AcknowledgementType type, double expiry = 0);
|
void AcknowledgeProblem(AcknowledgementType type, double expiry = 0);
|
||||||
void ClearAcknowledgement(void);
|
void ClearAcknowledgement(void);
|
||||||
|
|
||||||
void BeginExecuteCheck(const function<void (void)>& callback);
|
void BeginExecuteCheck(const boost::function<void (void)>& callback);
|
||||||
void ProcessCheckResult(const Dictionary::Ptr& cr);
|
void ProcessCheckResult(const Dictionary::Ptr& cr);
|
||||||
|
|
||||||
static double CalculateExecutionTime(const Dictionary::Ptr& cr);
|
static double CalculateExecutionTime(const Dictionary::Ptr& cr);
|
||||||
@ -288,7 +288,7 @@ private:
|
|||||||
long m_SchedulingOffset;
|
long m_SchedulingOffset;
|
||||||
|
|
||||||
void CheckCompletedHandler(const Dictionary::Ptr& checkInfo,
|
void CheckCompletedHandler(const Dictionary::Ptr& checkInfo,
|
||||||
const ScriptTask::Ptr& task, const function<void (void)>& callback);
|
const ScriptTask::Ptr& task, const boost::function<void (void)>& callback);
|
||||||
|
|
||||||
/* Downtimes */
|
/* Downtimes */
|
||||||
Attribute<Dictionary::Ptr> m_Downtimes;
|
Attribute<Dictionary::Ptr> m_Downtimes;
|
||||||
|
@ -199,7 +199,7 @@ void Endpoint::SetSubscriptions(const Dictionary::Ptr& subscriptions)
|
|||||||
Touch("subscriptions");
|
Touch("subscriptions");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Endpoint::RegisterTopicHandler(const String& topic, const function<Endpoint::Callback>& callback)
|
void Endpoint::RegisterTopicHandler(const String& topic, const boost::function<Endpoint::Callback>& callback)
|
||||||
{
|
{
|
||||||
ObjectLock olock(this);
|
ObjectLock olock(this);
|
||||||
|
|
||||||
@ -222,7 +222,7 @@ void Endpoint::RegisterTopicHandler(const String& topic, const function<Endpoint
|
|||||||
RegisterSubscription(topic);
|
RegisterSubscription(topic);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Endpoint::UnregisterTopicHandler(const String&, const function<Endpoint::Callback>&)
|
void Endpoint::UnregisterTopicHandler(const String&, const boost::function<Endpoint::Callback>&)
|
||||||
{
|
{
|
||||||
// TODO: implement
|
// TODO: implement
|
||||||
//m_TopicHandlers[method] -= callback;
|
//m_TopicHandlers[method] -= callback;
|
||||||
|
@ -61,8 +61,8 @@ public:
|
|||||||
|
|
||||||
void ClearSubscriptions(void);
|
void ClearSubscriptions(void);
|
||||||
|
|
||||||
void RegisterTopicHandler(const String& topic, const function<Callback>& callback);
|
void RegisterTopicHandler(const String& topic, const boost::function<Callback>& callback);
|
||||||
void UnregisterTopicHandler(const String& topic, const function<Callback>& callback);
|
void UnregisterTopicHandler(const String& topic, const boost::function<Callback>& callback);
|
||||||
|
|
||||||
String GetNode(void) const;
|
String GetNode(void) const;
|
||||||
String GetService(void) const;
|
String GetService(void) const;
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "i2-remoting.h"
|
#include "i2-remoting.h"
|
||||||
|
#include <boost/tuple/tuple.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
@ -357,7 +358,7 @@ void EndpointManager::SubscriptionTimerHandler(void)
|
|||||||
ObjectLock olock(endpointSubscriptions);
|
ObjectLock olock(endpointSubscriptions);
|
||||||
|
|
||||||
String topic;
|
String topic;
|
||||||
BOOST_FOREACH(tie(tuples::ignore, topic), endpointSubscriptions) {
|
BOOST_FOREACH(boost::tie(boost::tuples::ignore, topic), endpointSubscriptions) {
|
||||||
subscriptions->Set(topic, topic);
|
subscriptions->Set(topic, topic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ public:
|
|||||||
void SendMulticastMessage(const RequestMessage& message);
|
void SendMulticastMessage(const RequestMessage& message);
|
||||||
void SendMulticastMessage(const Endpoint::Ptr& sender, const RequestMessage& message);
|
void SendMulticastMessage(const Endpoint::Ptr& sender, const RequestMessage& message);
|
||||||
|
|
||||||
typedef function<void(const Endpoint::Ptr, const RequestMessage&, const ResponseMessage&, bool TimedOut)> APICallback;
|
typedef boost::function<void(const Endpoint::Ptr, const RequestMessage&, const ResponseMessage&, bool TimedOut)> APICallback;
|
||||||
|
|
||||||
void SendAPIMessage(const Endpoint::Ptr& sender, const Endpoint::Ptr& recipient, RequestMessage& message,
|
void SendAPIMessage(const Endpoint::Ptr& sender, const Endpoint::Ptr& recipient, RequestMessage& message,
|
||||||
const APICallback& callback, double timeout = 30);
|
const APICallback& callback, double timeout = 30);
|
||||||
@ -84,7 +84,7 @@ private:
|
|||||||
{
|
{
|
||||||
double Timeout;
|
double Timeout;
|
||||||
RequestMessage Request;
|
RequestMessage Request;
|
||||||
function<void(const Endpoint::Ptr, const RequestMessage&, const ResponseMessage&, bool TimedOut)> Callback;
|
boost::function<void(const Endpoint::Ptr, const RequestMessage&, const ResponseMessage&, bool TimedOut)> Callback;
|
||||||
|
|
||||||
bool HasTimedOut(void) const
|
bool HasTimedOut(void) const
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user