mirror of https://github.com/Icinga/icinga2.git
parent
187d443447
commit
478f03b49a
|
@ -25,7 +25,7 @@ mkclass_target(sysloglogger.ti sysloglogger.thpp)
|
|||
set(base_SOURCES
|
||||
application.cpp application.thpp array.cpp configerror.cpp console.cpp context.cpp
|
||||
convert.cpp debuginfo.cpp dictionary.cpp dynamicobject.cpp dynamicobject.thpp dynamictype.cpp
|
||||
exception.cpp fifo.cpp filelogger.cpp filelogger.thpp json.cpp logger.cpp logger.thpp
|
||||
exception.cpp fifo.cpp filelogger.cpp filelogger.thpp initialize.cpp json.cpp logger.cpp logger.thpp
|
||||
netstring.cpp networkstream.cpp object.cpp objectlock.cpp primitivetype.cpp process.cpp
|
||||
ringbuffer.cpp scriptfunction.cpp scriptfunctionwrapper.cpp
|
||||
scriptutils.cpp scriptvariable.cpp serializer.cpp socket.cpp stacktrace.cpp
|
||||
|
|
|
@ -44,7 +44,7 @@ using namespace icinga;
|
|||
REGISTER_TYPE(Application);
|
||||
|
||||
boost::signals2::signal<void (void)> Application::OnReopenLogs;
|
||||
Application *Application::m_Instance = NULL;
|
||||
Application::Ptr Application::m_Instance = NULL;
|
||||
bool Application::m_ShuttingDown = false;
|
||||
bool Application::m_RequestRestart = false;
|
||||
bool Application::m_RequestReopenLogs = false;
|
||||
|
@ -153,10 +153,7 @@ void Application::InitializeBase(void)
|
|||
*/
|
||||
Application::Ptr Application::GetInstance(void)
|
||||
{
|
||||
if (!m_Instance)
|
||||
return Application::Ptr();
|
||||
|
||||
return m_Instance->GetSelf();
|
||||
return m_Instance;
|
||||
}
|
||||
|
||||
void Application::SetResourceLimits(void)
|
||||
|
@ -341,7 +338,7 @@ pid_t Application::StartReloadProcess(void)
|
|||
Log(LogInformation, "Application", "Got reload command: Starting new instance.");
|
||||
|
||||
// prepare arguments
|
||||
Array::Ptr args = make_shared<Array>();
|
||||
Array::Ptr args = new Array();
|
||||
args->Add(GetExePath(m_ArgV[0]));
|
||||
|
||||
for (int i=1; i < Application::GetArgC(); i++) {
|
||||
|
@ -353,7 +350,7 @@ pid_t Application::StartReloadProcess(void)
|
|||
args->Add("--reload-internal");
|
||||
args->Add(Convert::ToString(Utility::GetPid()));
|
||||
|
||||
Process::Ptr process = make_shared<Process>(Process::PrepareCommand(args));
|
||||
Process::Ptr process = new Process(Process::PrepareCommand(args));
|
||||
process->SetTimeout(300);
|
||||
process->Run(&ReloadProcessCallback);
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ protected:
|
|||
virtual void OnShutdown(void);
|
||||
|
||||
private:
|
||||
static Application *m_Instance; /**< The application instance. */
|
||||
static Application::Ptr m_Instance; /**< The application instance. */
|
||||
|
||||
static bool m_ShuttingDown; /**< Whether the application is in the process of
|
||||
shutting down. */
|
||||
|
|
|
@ -196,21 +196,21 @@ void Array::CopyTo(const Array::Ptr& dest) const
|
|||
*/
|
||||
Array::Ptr Array::ShallowClone(void) const
|
||||
{
|
||||
Array::Ptr clone = make_shared<Array>();
|
||||
Array::Ptr clone = new Array();
|
||||
CopyTo(clone);
|
||||
return clone;
|
||||
}
|
||||
|
||||
Array::Ptr icinga::MakeArray(const Value& val1)
|
||||
{
|
||||
Array::Ptr result = make_shared<Array>();
|
||||
Array::Ptr result = new Array();
|
||||
result->Add(val1);
|
||||
return result;
|
||||
}
|
||||
|
||||
Array::Ptr icinga::MakeArray(const Value& val1, const Value& val2)
|
||||
{
|
||||
Array::Ptr result = make_shared<Array>();
|
||||
Array::Ptr result = new Array();
|
||||
result->Add(val1);
|
||||
result->Add(val2);
|
||||
return result;
|
||||
|
@ -218,7 +218,7 @@ Array::Ptr icinga::MakeArray(const Value& val1, const Value& val2)
|
|||
|
||||
Array::Ptr icinga::MakeArray(const Value& val1, const Value& val2, const Value& val3)
|
||||
{
|
||||
Array::Ptr result = make_shared<Array>();
|
||||
Array::Ptr result = new Array();
|
||||
result->Add(val1);
|
||||
result->Add(val2);
|
||||
result->Add(val3);
|
||||
|
@ -227,7 +227,7 @@ Array::Ptr icinga::MakeArray(const Value& val1, const Value& val2, const Value&
|
|||
|
||||
Array::Ptr icinga::MakeArray(const Value& val1, const Value& val2, const Value& val3, const Value& val4)
|
||||
{
|
||||
Array::Ptr result = make_shared<Array>();
|
||||
Array::Ptr result = new Array();
|
||||
result->Add(val1);
|
||||
result->Add(val2);
|
||||
result->Add(val3);
|
||||
|
|
|
@ -75,6 +75,8 @@ private:
|
|||
int m_Color;
|
||||
};
|
||||
|
||||
I2_BASE_API std::ostream& operator<<(std::ostream& fp, const ConsoleColorTag& cct);
|
||||
|
||||
/**
|
||||
* Console utilities.
|
||||
*
|
||||
|
|
|
@ -211,7 +211,7 @@ void Dictionary::CopyTo(const Dictionary::Ptr& dest) const
|
|||
*/
|
||||
Dictionary::Ptr Dictionary::ShallowClone(void) const
|
||||
{
|
||||
Dictionary::Ptr clone = make_shared<Dictionary>();
|
||||
Dictionary::Ptr clone = new Dictionary();
|
||||
CopyTo(clone);
|
||||
return clone;
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ void DynamicObject::SetExtension(const String& key, const Object::Ptr& object)
|
|||
Dictionary::Ptr extensions = GetExtensions();
|
||||
|
||||
if (!extensions) {
|
||||
extensions = make_shared<Dictionary>();
|
||||
extensions = new Dictionary();
|
||||
SetExtensions(extensions);
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ void DynamicObject::Register(void)
|
|||
ASSERT(!OwnsLock());
|
||||
|
||||
DynamicType::Ptr dtype = GetType();
|
||||
dtype->RegisterObject(GetSelf());
|
||||
dtype->RegisterObject(this);
|
||||
}
|
||||
|
||||
void DynamicObject::Start(void)
|
||||
|
@ -140,7 +140,7 @@ void DynamicObject::Activate(void)
|
|||
SetActive(true);
|
||||
}
|
||||
|
||||
OnStarted(GetSelf());
|
||||
OnStarted(this);
|
||||
|
||||
SetAuthority(true);
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ void DynamicObject::Deactivate(void)
|
|||
|
||||
ASSERT(GetStopCalled());
|
||||
|
||||
OnStopped(GetSelf());
|
||||
OnStopped(this);
|
||||
}
|
||||
|
||||
void DynamicObject::OnConfigLoaded(void)
|
||||
|
@ -204,13 +204,13 @@ void DynamicObject::SetAuthority(bool authority)
|
|||
Resume();
|
||||
ASSERT(GetResumeCalled());
|
||||
SetPaused(false);
|
||||
OnResumed(GetSelf());
|
||||
OnResumed(this);
|
||||
} else if (!authority && !GetPaused()) {
|
||||
SetPauseCalled(false);
|
||||
Pause();
|
||||
ASSERT(GetPauseCalled());
|
||||
SetPaused(true);
|
||||
OnPaused(GetSelf());
|
||||
OnPaused(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -256,11 +256,11 @@ void DynamicObject::DumpObjects(const String& filename, int attributeTypes)
|
|||
if (!fp)
|
||||
BOOST_THROW_EXCEPTION(std::runtime_error("Could not open '" + tempFilename + "' file"));
|
||||
|
||||
StdioStream::Ptr sfp = make_shared<StdioStream>(&fp, false);
|
||||
StdioStream::Ptr sfp = new StdioStream(&fp, false);
|
||||
|
||||
BOOST_FOREACH(const DynamicType::Ptr& type, DynamicType::GetTypes()) {
|
||||
BOOST_FOREACH(const DynamicObject::Ptr& object, type->GetObjects()) {
|
||||
Dictionary::Ptr persistentObject = make_shared<Dictionary>();
|
||||
Dictionary::Ptr persistentObject = new Dictionary();
|
||||
|
||||
persistentObject->Set("type", type->GetName());
|
||||
persistentObject->Set("name", object->GetName());
|
||||
|
@ -331,7 +331,7 @@ void DynamicObject::RestoreObjects(const String& filename, int attributeTypes)
|
|||
std::fstream fp;
|
||||
fp.open(filename.CStr(), std::ios_base::in);
|
||||
|
||||
StdioStream::Ptr sfp = make_shared<StdioStream>(&fp, false);
|
||||
StdioStream::Ptr sfp = new StdioStream (&fp, false);
|
||||
|
||||
unsigned long restored = 0;
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
|
||||
Value InvokeMethod(const String& method, const std::vector<Value>& arguments);
|
||||
|
||||
shared_ptr<DynamicType> GetType(void) const;
|
||||
intrusive_ptr<DynamicType> GetType(void) const;
|
||||
|
||||
DebugInfo GetDebugInfo(void) const;
|
||||
void SetDebugInfo(const DebugInfo& di);
|
||||
|
@ -80,7 +80,7 @@ public:
|
|||
virtual void OnStateLoaded(void);
|
||||
|
||||
template<typename T>
|
||||
static shared_ptr<T> GetObject(const String& name)
|
||||
static intrusive_ptr<T> GetObject(const String& name)
|
||||
{
|
||||
DynamicObject::Ptr object = GetObject(T::GetTypeName(), name);
|
||||
|
||||
|
@ -101,15 +101,15 @@ private:
|
|||
DebugInfo m_DebugInfo;
|
||||
};
|
||||
|
||||
#define DECLARE_OBJECTNAME(klass) \
|
||||
inline static String GetTypeName(void) \
|
||||
{ \
|
||||
return #klass; \
|
||||
} \
|
||||
\
|
||||
inline static shared_ptr<klass> GetByName(const String& name) \
|
||||
{ \
|
||||
return DynamicObject::GetObject<klass>(name); \
|
||||
#define DECLARE_OBJECTNAME(klass) \
|
||||
inline static String GetTypeName(void) \
|
||||
{ \
|
||||
return #klass; \
|
||||
} \
|
||||
\
|
||||
inline static intrusive_ptr<klass> GetByName(const String& name) \
|
||||
{ \
|
||||
return DynamicObject::GetObject<klass>(name); \
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ DynamicType::Ptr DynamicType::GetByName(const String& name)
|
|||
|| type->IsAbstract())
|
||||
return DynamicType::Ptr();
|
||||
|
||||
DynamicType::Ptr dtype = make_shared<DynamicType>(name);
|
||||
DynamicType::Ptr dtype = new DynamicType(name);
|
||||
|
||||
InternalGetTypeMap()[type->GetName()] = dtype;
|
||||
InternalGetTypeVector().push_back(dtype);
|
||||
|
@ -78,8 +78,8 @@ DynamicType::TypeVector DynamicType::GetTypes(void)
|
|||
std::pair<DynamicTypeIterator<DynamicObject>, DynamicTypeIterator<DynamicObject> > DynamicType::GetObjects(void)
|
||||
{
|
||||
return std::make_pair(
|
||||
DynamicTypeIterator<DynamicObject>(GetSelf(), 0),
|
||||
DynamicTypeIterator<DynamicObject>(GetSelf(), -1)
|
||||
DynamicTypeIterator<DynamicObject>(this, 0),
|
||||
DynamicTypeIterator<DynamicObject>(this, -1)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ private:
|
|||
};
|
||||
|
||||
template<typename T>
|
||||
class DynamicTypeIterator : public boost::iterator_facade<DynamicTypeIterator<T>, const shared_ptr<T>, boost::forward_traversal_tag>
|
||||
class DynamicTypeIterator : public boost::iterator_facade<DynamicTypeIterator<T>, const intrusive_ptr<T>, boost::forward_traversal_tag>
|
||||
{
|
||||
public:
|
||||
DynamicTypeIterator(const DynamicType::Ptr& type, int index)
|
||||
|
@ -93,7 +93,7 @@ private:
|
|||
|
||||
DynamicType::Ptr m_Type;
|
||||
DynamicType::ObjectVector::size_type m_Index;
|
||||
mutable shared_ptr<T> m_Current;
|
||||
mutable intrusive_ptr<T> m_Current;
|
||||
|
||||
void increment(void)
|
||||
{
|
||||
|
@ -125,7 +125,7 @@ private:
|
|||
return (other.m_Index == m_Index);
|
||||
}
|
||||
|
||||
const shared_ptr<T>& dereference(void) const
|
||||
const intrusive_ptr<T>& dereference(void) const
|
||||
{
|
||||
ObjectLock olock(m_Type);
|
||||
m_Current = static_pointer_cast<T>(*(m_Type->m_ObjectVector.begin() + m_Index));
|
||||
|
|
|
@ -31,7 +31,7 @@ REGISTER_STATSFUNCTION(FileLoggerStats, &FileLogger::StatsFunc);
|
|||
|
||||
Value FileLogger::StatsFunc(Dictionary::Ptr& status, Array::Ptr&)
|
||||
{
|
||||
Dictionary::Ptr nodes = make_shared<Dictionary>();
|
||||
Dictionary::Ptr nodes = new Dictionary();
|
||||
|
||||
BOOST_FOREACH(const FileLogger::Ptr& filelogger, DynamicType::GetObjectsByType<FileLogger>()) {
|
||||
nodes->Set(filelogger->GetName(), 1); //add more stats
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
/******************************************************************************
|
||||
* Icinga 2 *
|
||||
* Copyright (C) 2012-2014 Icinga Development Team (http://www.icinga.org) *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License *
|
||||
* as published by the Free Software Foundation; either version 2 *
|
||||
* of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the Free Software Foundation *
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||
******************************************************************************/
|
||||
|
||||
#include "base/initialize.hpp"
|
||||
#include "base/utility.hpp"
|
||||
|
||||
using namespace icinga;
|
||||
|
||||
bool icinga::InitializeOnceHelper(void (*func)(void))
|
||||
{
|
||||
Utility::AddDeferredInitializer(func);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -21,22 +21,15 @@
|
|||
#define INITIALIZE_H
|
||||
|
||||
#include "base/i2-base.hpp"
|
||||
#include "base/utility.hpp"
|
||||
|
||||
namespace icinga
|
||||
{
|
||||
|
||||
typedef void (*InitializeFunc)(void);
|
||||
I2_BASE_API bool InitializeOnceHelper(void (*func)(void));
|
||||
|
||||
inline bool InitializeOnceHelper(InitializeFunc func)
|
||||
{
|
||||
Utility::AddDeferredInitializer(func);
|
||||
return true;
|
||||
}
|
||||
|
||||
#define INITIALIZE_ONCE(func) \
|
||||
namespace { namespace UNIQUE_NAME(io) { \
|
||||
I2_EXPORT bool l_InitializeOnce(icinga::InitializeOnceHelper(func)); \
|
||||
#define INITIALIZE_ONCE(func) \
|
||||
namespace { namespace UNIQUE_NAME(io) { \
|
||||
I2_EXPORT bool l_InitializeOnce(icinga::InitializeOnceHelper(func)); \
|
||||
} }
|
||||
|
||||
}
|
||||
|
|
|
@ -263,7 +263,7 @@ static int DecodeStartMap(void *ctx)
|
|||
JsonContext *context = static_cast<JsonContext *>(ctx);
|
||||
|
||||
try {
|
||||
context->Push(make_shared<Dictionary>());
|
||||
context->Push(new Dictionary());
|
||||
} catch (...) {
|
||||
context->SaveException();
|
||||
return 0;
|
||||
|
@ -291,7 +291,7 @@ static int DecodeStartArray(void *ctx)
|
|||
JsonContext *context = static_cast<JsonContext *>(ctx);
|
||||
|
||||
try {
|
||||
context->Push(make_shared<Array>());
|
||||
context->Push(new Array());
|
||||
} catch (...) {
|
||||
context->SaveException();
|
||||
return 0;
|
||||
|
|
|
@ -56,13 +56,13 @@ void Logger::Start(void)
|
|||
DynamicObject::Start();
|
||||
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
m_Loggers.insert(GetSelf());
|
||||
m_Loggers.insert(this);
|
||||
}
|
||||
|
||||
void Logger::Stop(void)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
m_Loggers.erase(GetSelf());
|
||||
m_Loggers.erase(this);
|
||||
}
|
||||
|
||||
std::set<Logger::Ptr> Logger::GetLoggers(void)
|
||||
|
|
|
@ -33,8 +33,9 @@ boost::mutex Object::m_DebugMutex;
|
|||
* Default constructor for the Object class.
|
||||
*/
|
||||
Object::Object(void)
|
||||
: m_References(0)
|
||||
#ifdef _DEBUG
|
||||
: m_Locked(false)
|
||||
, m_Locked(false)
|
||||
#endif /* _DEBUG */
|
||||
{ }
|
||||
|
||||
|
@ -44,16 +45,6 @@ Object::Object(void)
|
|||
Object::~Object(void)
|
||||
{ }
|
||||
|
||||
/**
|
||||
* Returns a reference-counted pointer to this object.
|
||||
*
|
||||
* @returns A shared_ptr object that points to this object
|
||||
*/
|
||||
Object::SharedPtrHolder Object::GetSelf(void)
|
||||
{
|
||||
return Object::SharedPtrHolder(shared_from_this());
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
/**
|
||||
* Checks if the calling thread owns the lock on this object.
|
||||
|
@ -68,11 +59,6 @@ bool Object::OwnsLock(void) const
|
|||
}
|
||||
#endif /* _DEBUG */
|
||||
|
||||
Object::SharedPtrHolder::operator Value(void) const
|
||||
{
|
||||
return m_Object;
|
||||
}
|
||||
|
||||
void Object::SetField(int, const Value&)
|
||||
{
|
||||
BOOST_THROW_EXCEPTION(std::runtime_error("Invalid field ID."));
|
||||
|
|
|
@ -31,28 +31,11 @@
|
|||
#include <boost/thread/recursive_mutex.hpp>
|
||||
#endif /* _DEBUG */
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#include <boost/smart_ptr/shared_ptr.hpp>
|
||||
#include <boost/smart_ptr/weak_ptr.hpp>
|
||||
#include <boost/smart_ptr/enable_shared_from_this.hpp>
|
||||
#include <boost/smart_ptr/make_shared.hpp>
|
||||
#include <boost/smart_ptr/intrusive_ptr.hpp>
|
||||
|
||||
using boost::shared_ptr;
|
||||
using boost::weak_ptr;
|
||||
using boost::enable_shared_from_this;
|
||||
using boost::intrusive_ptr;
|
||||
using boost::dynamic_pointer_cast;
|
||||
using boost::static_pointer_cast;
|
||||
using boost::make_shared;
|
||||
#else /* _MSC_VER */
|
||||
#include <memory>
|
||||
|
||||
using std::shared_ptr;
|
||||
using std::weak_ptr;
|
||||
using std::enable_shared_from_this;
|
||||
using std::dynamic_pointer_cast;
|
||||
using std::static_pointer_cast;
|
||||
using std::make_shared;
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
using boost::tie;
|
||||
|
@ -65,14 +48,13 @@ class Object;
|
|||
class Type;
|
||||
|
||||
#define DECLARE_PTR_TYPEDEFS(klass) \
|
||||
typedef shared_ptr<klass> Ptr; \
|
||||
typedef weak_ptr<klass> WeakPtr
|
||||
typedef intrusive_ptr<klass> Ptr
|
||||
|
||||
#define IMPL_TYPE_LOOKUP(klass) \
|
||||
static shared_ptr<Type> TypeInstance; \
|
||||
inline virtual shared_ptr<Type> GetReflectionType(void) const \
|
||||
{ \
|
||||
return TypeInstance; \
|
||||
#define IMPL_TYPE_LOOKUP(klass) \
|
||||
static intrusive_ptr<Type> TypeInstance; \
|
||||
virtual intrusive_ptr<Type> GetReflectionType(void) const \
|
||||
{ \
|
||||
return TypeInstance; \
|
||||
}
|
||||
|
||||
#define DECLARE_OBJECT(klass) \
|
||||
|
@ -80,12 +62,12 @@ class Type;
|
|||
IMPL_TYPE_LOOKUP(klass);
|
||||
|
||||
template<typename T>
|
||||
shared_ptr<Object> DefaultObjectFactory(void)
|
||||
intrusive_ptr<Object> DefaultObjectFactory(void)
|
||||
{
|
||||
return make_shared<T>();
|
||||
return new T();
|
||||
}
|
||||
|
||||
typedef shared_ptr<Object> (*ObjectFactory)(void);
|
||||
typedef intrusive_ptr<Object> (*ObjectFactory)(void);
|
||||
|
||||
template<typename T>
|
||||
struct TypeHelper
|
||||
|
@ -102,7 +84,7 @@ struct TypeHelper
|
|||
*
|
||||
* @ingroup base
|
||||
*/
|
||||
class I2_BASE_API Object : public enable_shared_from_this<Object>
|
||||
class I2_BASE_API Object
|
||||
{
|
||||
public:
|
||||
DECLARE_OBJECT(Object);
|
||||
|
@ -113,73 +95,15 @@ public:
|
|||
virtual void SetField(int id, const Value& value);
|
||||
virtual Value GetField(int id) const;
|
||||
|
||||
/**
|
||||
* Holds a shared pointer and provides support for implicit upcasts.
|
||||
*
|
||||
* @ingroup base
|
||||
*/
|
||||
class SharedPtrHolder
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Constructor for the SharedPtrHolder class.
|
||||
*
|
||||
* @param object The shared pointer that should be used to
|
||||
* construct this shared pointer holder.
|
||||
*/
|
||||
explicit SharedPtrHolder(const Object::Ptr& object)
|
||||
: m_Object(object)
|
||||
{ }
|
||||
|
||||
/**
|
||||
* Retrieves a shared pointer for the object that is associated
|
||||
* this holder instance.
|
||||
*
|
||||
* @returns A shared pointer.
|
||||
*/
|
||||
template<typename T>
|
||||
operator shared_ptr<T>(void) const
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
shared_ptr<T> other = dynamic_pointer_cast<T>(m_Object);
|
||||
ASSERT(other);
|
||||
#else /* _DEBUG */
|
||||
shared_ptr<T> other = static_pointer_cast<T>(m_Object);
|
||||
#endif /* _DEBUG */
|
||||
|
||||
return other;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a weak pointer for the object that is associated
|
||||
* with this holder instance.
|
||||
*
|
||||
* @returns A weak pointer.
|
||||
*/
|
||||
template<typename T>
|
||||
operator weak_ptr<T>(void) const
|
||||
{
|
||||
return static_cast<shared_ptr<T> >(*this);
|
||||
}
|
||||
|
||||
operator Value(void) const;
|
||||
|
||||
private:
|
||||
Object::Ptr m_Object; /**< The object that belongs to this
|
||||
holder instance */
|
||||
};
|
||||
|
||||
#ifdef _DEBUG
|
||||
bool OwnsLock(void) const;
|
||||
#endif /* _DEBUG */
|
||||
|
||||
protected:
|
||||
SharedPtrHolder GetSelf(void);
|
||||
|
||||
private:
|
||||
Object(const Object& other);
|
||||
Object& operator=(const Object& rhs);
|
||||
|
||||
uintptr_t m_References;
|
||||
mutable ThinMutex m_Mutex;
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
@ -189,38 +113,32 @@ private:
|
|||
#endif /* _DEBUG */
|
||||
|
||||
friend struct ObjectLock;
|
||||
|
||||
friend void intrusive_ptr_add_ref(Object *object);
|
||||
friend void intrusive_ptr_release(Object *object);
|
||||
};
|
||||
|
||||
/**
|
||||
* Compares a weak pointer with a raw pointer.
|
||||
*
|
||||
* @ingroup base
|
||||
*/
|
||||
template<class T>
|
||||
struct WeakPtrEqual
|
||||
inline void intrusive_ptr_add_ref(Object *object)
|
||||
{
|
||||
private:
|
||||
const void *m_Ref; /**< The object. */
|
||||
#ifdef _WIN32
|
||||
InterlockedIncrement(&object->m_References);
|
||||
#else /* _WIN32 */
|
||||
__sync_add_and_fetch(&object->m_References, 1);
|
||||
#endif /* _WIN32 */
|
||||
}
|
||||
|
||||
public:
|
||||
/**
|
||||
* Constructor for the WeakPtrEqual class.
|
||||
*
|
||||
* @param ref The object that should be compared with the weak pointer.
|
||||
*/
|
||||
WeakPtrEqual(const void *ref) : m_Ref(ref) { }
|
||||
inline void intrusive_ptr_release(Object *object)
|
||||
{
|
||||
uintptr_t refs;
|
||||
#ifdef _WIN32
|
||||
refs = InterlockedDecrement(&object->m_References);
|
||||
#else /* _WIN32 */
|
||||
refs = __sync_sub_and_fetch(&object->m_References, 1);
|
||||
#endif /* _WIN32 */
|
||||
|
||||
/**
|
||||
* Compares the two pointers.
|
||||
*
|
||||
* @param wref The weak pointer.
|
||||
* @returns true if the pointers point to the same object, false otherwise.
|
||||
*/
|
||||
bool operator()(const weak_ptr<T>& wref) const
|
||||
{
|
||||
return (wref.lock().get() == static_cast<const T *>(m_Ref));
|
||||
}
|
||||
};
|
||||
if (refs == 0)
|
||||
delete object;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
class ObjectImpl
|
||||
|
@ -230,3 +148,5 @@ class ObjectImpl
|
|||
}
|
||||
|
||||
#endif /* OBJECT_H */
|
||||
|
||||
#include "base/type.hpp"
|
||||
|
|
|
@ -46,15 +46,14 @@ private:
|
|||
String m_Name;
|
||||
};
|
||||
|
||||
#define REGISTER_BUILTIN_TYPE(type) \
|
||||
namespace { namespace UNIQUE_NAME(prt) { namespace prt ## type { \
|
||||
void RegisterPrimitiveType(void) \
|
||||
{ \
|
||||
icinga::Type::Ptr t = make_shared<PrimitiveType>(#type); \
|
||||
icinga::Type::Register(t); \
|
||||
} \
|
||||
\
|
||||
INITIALIZE_ONCE(RegisterPrimitiveType); \
|
||||
#define REGISTER_BUILTIN_TYPE(type) \
|
||||
namespace { namespace UNIQUE_NAME(prt) { namespace prt ## type { \
|
||||
void RegisterPrimitiveType(void) \
|
||||
{ \
|
||||
icinga::Type::Ptr t = new PrimitiveType(#type); \
|
||||
icinga::Type::Register(t); \
|
||||
} \
|
||||
INITIALIZE_ONCE(RegisterPrimitiveType); \
|
||||
} } }
|
||||
|
||||
#define REGISTER_PRIMITIVE_TYPE(type) \
|
||||
|
|
|
@ -586,7 +586,7 @@ void Process::Run(const boost::function<void(const ProcessResult&)>& callback)
|
|||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_ProcessMutex[tid]);
|
||||
l_Processes[tid][m_Process] = GetSelf();
|
||||
l_Processes[tid][m_Process] = this;
|
||||
#ifndef _WIN32
|
||||
l_FDs[tid][m_FD] = m_Process;
|
||||
#endif /* _WIN32 */
|
||||
|
|
|
@ -54,6 +54,6 @@ void ScriptFunction::Unregister(const String& name)
|
|||
|
||||
RegisterFunctionHelper::RegisterFunctionHelper(const String& name, const ScriptFunction::Callback& function)
|
||||
{
|
||||
ScriptFunction::Register(name, make_shared<ScriptFunction>(function));
|
||||
ScriptFunction::Register(name, new ScriptFunction(function));
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ Array::Ptr ScriptUtils::Union(const std::vector<Value>& arguments)
|
|||
}
|
||||
}
|
||||
|
||||
Array::Ptr result = make_shared<Array>();
|
||||
Array::Ptr result = new Array();
|
||||
BOOST_FOREACH(const Value& value, values) {
|
||||
result->Add(value);
|
||||
}
|
||||
|
@ -93,9 +93,9 @@ Array::Ptr ScriptUtils::Union(const std::vector<Value>& arguments)
|
|||
Array::Ptr ScriptUtils::Intersection(const std::vector<Value>& arguments)
|
||||
{
|
||||
if (arguments.size() == 0)
|
||||
return make_shared<Array>();
|
||||
return new Array();
|
||||
|
||||
Array::Ptr result = make_shared<Array>();
|
||||
Array::Ptr result = new Array();
|
||||
|
||||
Array::Ptr arr1 = static_cast<Array::Ptr>(arguments[0])->ShallowClone();
|
||||
|
||||
|
@ -164,7 +164,7 @@ Array::Ptr ScriptUtils::Range(const std::vector<Value>& arguments)
|
|||
BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid number of arguments for range()"));
|
||||
}
|
||||
|
||||
Array::Ptr result = make_shared<Array>();
|
||||
Array::Ptr result = new Array();
|
||||
|
||||
if ((start < end && increment <= 0) ||
|
||||
(start > end && increment >= 0))
|
||||
|
@ -200,7 +200,7 @@ Type::Ptr ScriptUtils::TypeOf(const Value& value)
|
|||
|
||||
Array::Ptr ScriptUtils::Keys(const Dictionary::Ptr& dict)
|
||||
{
|
||||
Array::Ptr result = make_shared<Array>();
|
||||
Array::Ptr result = new Array();
|
||||
|
||||
ObjectLock olock(dict);
|
||||
BOOST_FOREACH(const Dictionary::Pair& kv, dict) {
|
||||
|
|
|
@ -77,7 +77,7 @@ ScriptVariable::Ptr ScriptVariable::Set(const String& name, const Value& value,
|
|||
ScriptVariable::Ptr sv = GetByName(name);
|
||||
|
||||
if (!sv) {
|
||||
sv = make_shared<ScriptVariable>(value);
|
||||
sv = new ScriptVariable(value);
|
||||
ScriptVariableRegistry::GetInstance()->Register(name, sv);
|
||||
} else if (overwrite) {
|
||||
if (sv->IsConstant())
|
||||
|
@ -110,10 +110,10 @@ void ScriptVariable::WriteVariablesFile(const String& filename)
|
|||
if (!fp)
|
||||
BOOST_THROW_EXCEPTION(std::runtime_error("Could not open '" + tempFilename + "' file"));
|
||||
|
||||
StdioStream::Ptr sfp = make_shared<StdioStream>(&fp, false);
|
||||
StdioStream::Ptr sfp = new StdioStream(&fp, false);
|
||||
|
||||
BOOST_FOREACH(const ScriptVariableRegistry::ItemMap::value_type& kv, ScriptVariableRegistry::GetInstance()->GetItems()) {
|
||||
Dictionary::Ptr persistentVariable = make_shared<Dictionary>();
|
||||
Dictionary::Ptr persistentVariable = new Dictionary();
|
||||
|
||||
persistentVariable->Set("name", kv.first);
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace icinga
|
|||
|
||||
class ScriptVariable;
|
||||
|
||||
class I2_BASE_API ScriptVariableRegistry : public Registry<ScriptVariableRegistry, shared_ptr<ScriptVariable> >
|
||||
class I2_BASE_API ScriptVariableRegistry : public Registry<ScriptVariableRegistry, intrusive_ptr<ScriptVariable> >
|
||||
{
|
||||
public:
|
||||
static ScriptVariableRegistry *GetInstance(void);
|
||||
|
|
|
@ -27,7 +27,7 @@ using namespace icinga;
|
|||
|
||||
static Array::Ptr SerializeArray(const Array::Ptr& input, int attributeTypes)
|
||||
{
|
||||
Array::Ptr result = make_shared<Array>();
|
||||
Array::Ptr result = new Array();
|
||||
|
||||
ObjectLock olock(input);
|
||||
|
||||
|
@ -40,7 +40,7 @@ static Array::Ptr SerializeArray(const Array::Ptr& input, int attributeTypes)
|
|||
|
||||
static Dictionary::Ptr SerializeDictionary(const Dictionary::Ptr& input, int attributeTypes)
|
||||
{
|
||||
Dictionary::Ptr result = make_shared<Dictionary>();
|
||||
Dictionary::Ptr result = new Dictionary();
|
||||
|
||||
ObjectLock olock(input);
|
||||
|
||||
|
@ -57,7 +57,7 @@ static Object::Ptr SerializeObject(const Object::Ptr& input, int attributeTypes)
|
|||
|
||||
VERIFY(type);
|
||||
|
||||
Dictionary::Ptr fields = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields = new Dictionary();
|
||||
|
||||
for (int i = 0; i < type->GetFieldCount(); i++) {
|
||||
Field field = type->GetFieldInfo(i);
|
||||
|
@ -75,7 +75,7 @@ static Object::Ptr SerializeObject(const Object::Ptr& input, int attributeTypes)
|
|||
|
||||
static Array::Ptr DeserializeArray(const Array::Ptr& input, bool safe_mode, int attributeTypes)
|
||||
{
|
||||
Array::Ptr result = make_shared<Array>();
|
||||
Array::Ptr result = new Array();
|
||||
|
||||
ObjectLock olock(input);
|
||||
|
||||
|
@ -88,7 +88,7 @@ static Array::Ptr DeserializeArray(const Array::Ptr& input, bool safe_mode, int
|
|||
|
||||
static Dictionary::Ptr DeserializeDictionary(const Dictionary::Ptr& input, bool safe_mode, int attributeTypes)
|
||||
{
|
||||
Dictionary::Ptr result = make_shared<Dictionary>();
|
||||
Dictionary::Ptr result = new Dictionary();
|
||||
|
||||
ObjectLock olock(input);
|
||||
|
||||
|
|
|
@ -341,7 +341,7 @@ Socket::Ptr Socket::Accept(void)
|
|||
#endif /* _WIN32 */
|
||||
}
|
||||
|
||||
return make_shared<Socket>(fd);
|
||||
return new Socket(fd);
|
||||
}
|
||||
|
||||
bool Socket::Poll(bool read, bool write)
|
||||
|
|
|
@ -34,7 +34,7 @@ Value StatsFunction::Invoke(Dictionary::Ptr& status, Array::Ptr& perfdata)
|
|||
|
||||
RegisterStatsFunctionHelper::RegisterStatsFunctionHelper(const String& name, const StatsFunction::Callback& function)
|
||||
{
|
||||
StatsFunction::Ptr func = make_shared<StatsFunction>(function);
|
||||
StatsFunction::Ptr func = new StatsFunction(function);
|
||||
StatsFunctionRegistry::GetInstance()->Register(name, func);
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ void StreamLogger::BindStream(std::ostream *stream, bool ownsStream)
|
|||
m_Stream = stream;
|
||||
m_OwnsStream = ownsStream;
|
||||
|
||||
m_FlushLogTimer = make_shared<Timer>();
|
||||
m_FlushLogTimer = new Timer();
|
||||
m_FlushLogTimer->SetInterval(1);
|
||||
m_FlushLogTimer->OnTimerExpired.connect(boost::bind(&StreamLogger::FlushLogTimerHandler, this));
|
||||
m_FlushLogTimer->Start();
|
||||
|
|
|
@ -30,7 +30,7 @@ REGISTER_STATSFUNCTION(SyslogLoggerStats, &SyslogLogger::StatsFunc);
|
|||
|
||||
Value SyslogLogger::StatsFunc(Dictionary::Ptr& status, Array::Ptr&)
|
||||
{
|
||||
Dictionary::Ptr nodes = make_shared<Dictionary>();
|
||||
Dictionary::Ptr nodes = new Dictionary();
|
||||
|
||||
BOOST_FOREACH(const SyslogLogger::Ptr& sysloglogger, DynamicType::GetObjectsByType<SyslogLogger>()) {
|
||||
nodes->Set(sysloglogger->GetName(), 1); //add more stats
|
||||
|
|
|
@ -43,7 +43,7 @@ void ThinMutex::DebugTimerHandler(void)
|
|||
|
||||
static void InitThinMutex(void)
|
||||
{
|
||||
l_Timer = make_shared<Timer>();
|
||||
l_Timer = new Timer();
|
||||
l_Timer->SetInterval(10);
|
||||
l_Timer->OnTimerExpired.connect(boost::bind(&ThinMutex::DebugTimerHandler));
|
||||
l_Timer->Start();
|
||||
|
|
|
@ -91,10 +91,8 @@ void Timer::Call(void)
|
|||
{
|
||||
ASSERT(!OwnsLock());
|
||||
|
||||
Timer::Ptr self = GetSelf();
|
||||
|
||||
try {
|
||||
OnTimerExpired(self);
|
||||
OnTimerExpired(Timer::Ptr(this));
|
||||
} catch (...) {
|
||||
Reschedule();
|
||||
|
||||
|
@ -272,12 +270,12 @@ void Timer::TimerThreadProc(void)
|
|||
continue;
|
||||
}
|
||||
|
||||
Timer::Ptr ptimer = timer;
|
||||
|
||||
/* Remove the timer from the list so it doesn't get called again
|
||||
* until the current call is completed. */
|
||||
l_Timers.erase(timer);
|
||||
|
||||
Timer::Ptr ptimer = timer->GetSelf();
|
||||
|
||||
lock.unlock();
|
||||
|
||||
/* Asynchronously call the timer. */
|
||||
|
|
|
@ -35,13 +35,13 @@ bool I2_EXPORT TlsStream::m_SSLIndexInitialized = false;
|
|||
* @param role The role of the client.
|
||||
* @param sslContext The SSL context for the client.
|
||||
*/
|
||||
TlsStream::TlsStream(const Socket::Ptr& socket, ConnectionRole role, const shared_ptr<SSL_CTX>& sslContext)
|
||||
TlsStream::TlsStream(const Socket::Ptr& socket, ConnectionRole role, const boost::shared_ptr<SSL_CTX>& sslContext)
|
||||
: m_Eof(false), m_VerifyOK(true), m_Socket(socket), m_Role(role)
|
||||
{
|
||||
std::ostringstream msgbuf;
|
||||
char errbuf[120];
|
||||
|
||||
m_SSL = shared_ptr<SSL>(SSL_new(sslContext.get()), SSL_free);
|
||||
m_SSL = boost::shared_ptr<SSL>(SSL_new(sslContext.get()), SSL_free);
|
||||
|
||||
if (!m_SSL) {
|
||||
msgbuf << "SSL_new() failed with code " << ERR_peek_error() << ", \"" << ERR_error_string(ERR_peek_error(), errbuf) << "\"";
|
||||
|
@ -90,10 +90,10 @@ bool TlsStream::IsVerifyOK(void) const
|
|||
*
|
||||
* @returns The X509 certificate.
|
||||
*/
|
||||
shared_ptr<X509> TlsStream::GetClientCertificate(void) const
|
||||
boost::shared_ptr<X509> TlsStream::GetClientCertificate(void) const
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_SSLLock);
|
||||
return shared_ptr<X509>(SSL_get_certificate(m_SSL.get()), &Utility::NullDeleter);
|
||||
return boost::shared_ptr<X509>(SSL_get_certificate(m_SSL.get()), &Utility::NullDeleter);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -101,10 +101,10 @@ shared_ptr<X509> TlsStream::GetClientCertificate(void) const
|
|||
*
|
||||
* @returns The X509 certificate.
|
||||
*/
|
||||
shared_ptr<X509> TlsStream::GetPeerCertificate(void) const
|
||||
boost::shared_ptr<X509> TlsStream::GetPeerCertificate(void) const
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_SSLLock);
|
||||
return shared_ptr<X509>(SSL_get_peer_certificate(m_SSL.get()), X509_free);
|
||||
return boost::shared_ptr<X509>(SSL_get_peer_certificate(m_SSL.get()), X509_free);
|
||||
}
|
||||
|
||||
void TlsStream::Handshake(void)
|
||||
|
|
|
@ -38,10 +38,10 @@ class I2_BASE_API TlsStream : public Stream
|
|||
public:
|
||||
DECLARE_PTR_TYPEDEFS(TlsStream);
|
||||
|
||||
TlsStream(const Socket::Ptr& socket, ConnectionRole role, const shared_ptr<SSL_CTX>& sslContext);
|
||||
TlsStream(const Socket::Ptr& socket, ConnectionRole role, const boost::shared_ptr<SSL_CTX>& sslContext);
|
||||
|
||||
shared_ptr<X509> GetClientCertificate(void) const;
|
||||
shared_ptr<X509> GetPeerCertificate(void) const;
|
||||
boost::shared_ptr<X509> GetClientCertificate(void) const;
|
||||
boost::shared_ptr<X509> GetPeerCertificate(void) const;
|
||||
|
||||
void Handshake(void);
|
||||
|
||||
|
@ -55,7 +55,7 @@ public:
|
|||
bool IsVerifyOK(void) const;
|
||||
|
||||
private:
|
||||
shared_ptr<SSL> m_SSL;
|
||||
boost::shared_ptr<SSL> m_SSL;
|
||||
bool m_Eof;
|
||||
mutable boost::mutex m_SSLLock;
|
||||
mutable boost::mutex m_IOActionLock;
|
||||
|
|
|
@ -75,14 +75,14 @@ void InitializeOpenSSL(void)
|
|||
* @param cakey CA certificate chain file.
|
||||
* @returns An SSL context.
|
||||
*/
|
||||
shared_ptr<SSL_CTX> MakeSSLContext(const String& pubkey, const String& privkey, const String& cakey)
|
||||
boost::shared_ptr<SSL_CTX> MakeSSLContext(const String& pubkey, const String& privkey, const String& cakey)
|
||||
{
|
||||
std::ostringstream msgbuf;
|
||||
char errbuf[120];
|
||||
|
||||
InitializeOpenSSL();
|
||||
|
||||
shared_ptr<SSL_CTX> sslContext = shared_ptr<SSL_CTX>(SSL_CTX_new(TLSv1_method()), SSL_CTX_free);
|
||||
boost::shared_ptr<SSL_CTX> sslContext = boost::shared_ptr<SSL_CTX>(SSL_CTX_new(TLSv1_method()), SSL_CTX_free);
|
||||
|
||||
SSL_CTX_set_mode(sslContext.get(), SSL_MODE_ENABLE_PARTIAL_WRITE | SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER);
|
||||
|
||||
|
@ -146,7 +146,7 @@ shared_ptr<SSL_CTX> MakeSSLContext(const String& pubkey, const String& privkey,
|
|||
* @param context The SSL context.
|
||||
* @param crlPath The path to the CRL file.
|
||||
*/
|
||||
void AddCRLToSSLContext(const shared_ptr<SSL_CTX>& context, const String& crlPath)
|
||||
void AddCRLToSSLContext(const boost::shared_ptr<SSL_CTX>& context, const String& crlPath)
|
||||
{
|
||||
char errbuf[120];
|
||||
X509_STORE *x509_store = SSL_CTX_get_cert_store(context.get());
|
||||
|
@ -183,7 +183,7 @@ void AddCRLToSSLContext(const shared_ptr<SSL_CTX>& context, const String& crlPat
|
|||
* @param certificate The X509 certificate.
|
||||
* @returns The common name.
|
||||
*/
|
||||
String GetCertificateCN(const shared_ptr<X509>& certificate)
|
||||
String GetCertificateCN(const boost::shared_ptr<X509>& certificate)
|
||||
{
|
||||
char errbuf[120];
|
||||
char buffer[256];
|
||||
|
@ -208,7 +208,7 @@ String GetCertificateCN(const shared_ptr<X509>& certificate)
|
|||
* @param pemfile The filename.
|
||||
* @returns An X509 certificate.
|
||||
*/
|
||||
shared_ptr<X509> GetX509Certificate(const String& pemfile)
|
||||
boost::shared_ptr<X509> GetX509Certificate(const String& pemfile)
|
||||
{
|
||||
char errbuf[120];
|
||||
X509 *cert;
|
||||
|
@ -243,7 +243,7 @@ shared_ptr<X509> GetX509Certificate(const String& pemfile)
|
|||
|
||||
BIO_free(fpcert);
|
||||
|
||||
return shared_ptr<X509>(cert, X509_free);
|
||||
return boost::shared_ptr<X509>(cert, X509_free);
|
||||
}
|
||||
|
||||
int MakeX509CSR(const String& cn, const String& keyfile, const String& csrfile, const String& certfile, bool ca)
|
||||
|
@ -290,7 +290,7 @@ int MakeX509CSR(const String& cn, const String& keyfile, const String& csrfile,
|
|||
X509_NAME *subject = X509_NAME_new();
|
||||
X509_NAME_add_entry_by_txt(subject, "CN", MBSTRING_ASC, (unsigned char *)cn.CStr(), -1, -1, 0);
|
||||
|
||||
shared_ptr<X509> cert = CreateCert(key, subject, subject, key, ca);
|
||||
boost::shared_ptr<X509> cert = CreateCert(key, subject, subject, key, ca);
|
||||
|
||||
X509_NAME_free(subject);
|
||||
|
||||
|
@ -367,7 +367,7 @@ int MakeX509CSR(const String& cn, const String& keyfile, const String& csrfile,
|
|||
return 1;
|
||||
}
|
||||
|
||||
shared_ptr<X509> CreateCert(EVP_PKEY *pubkey, X509_NAME *subject, X509_NAME *issuer, EVP_PKEY *cakey, bool ca, const String& serialfile)
|
||||
boost::shared_ptr<X509> CreateCert(EVP_PKEY *pubkey, X509_NAME *subject, X509_NAME *issuer, EVP_PKEY *cakey, bool ca, const String& serialfile)
|
||||
{
|
||||
X509 *cert = X509_new();
|
||||
X509_gmtime_adj(X509_get_notBefore(cert), 0);
|
||||
|
@ -414,7 +414,7 @@ shared_ptr<X509> CreateCert(EVP_PKEY *pubkey, X509_NAME *subject, X509_NAME *iss
|
|||
|
||||
X509_sign(cert, cakey, NULL);
|
||||
|
||||
return shared_ptr<X509>(cert, X509_free);
|
||||
return boost::shared_ptr<X509>(cert, X509_free);
|
||||
}
|
||||
|
||||
String GetIcingaCADir(void)
|
||||
|
@ -422,7 +422,7 @@ String GetIcingaCADir(void)
|
|||
return Application::GetLocalStateDir() + "/lib/icinga2/ca";
|
||||
}
|
||||
|
||||
shared_ptr<X509> CreateCertIcingaCA(EVP_PKEY *pubkey, X509_NAME *subject)
|
||||
boost::shared_ptr<X509> CreateCertIcingaCA(EVP_PKEY *pubkey, X509_NAME *subject)
|
||||
{
|
||||
char errbuf[120];
|
||||
|
||||
|
@ -437,7 +437,7 @@ shared_ptr<X509> CreateCertIcingaCA(EVP_PKEY *pubkey, X509_NAME *subject)
|
|||
if (!cakeybio) {
|
||||
Log(LogCritical, "SSL")
|
||||
<< "Could not open CA key file '" << cakeyfile << "': " << ERR_peek_error() << ", \"" << ERR_error_string(ERR_peek_error(), errbuf) << "\"";
|
||||
return shared_ptr<X509>();
|
||||
return boost::shared_ptr<X509>();
|
||||
}
|
||||
|
||||
rsa = PEM_read_bio_RSAPrivateKey(cakeybio, NULL, NULL, NULL);
|
||||
|
@ -445,14 +445,14 @@ shared_ptr<X509> CreateCertIcingaCA(EVP_PKEY *pubkey, X509_NAME *subject)
|
|||
if (!rsa) {
|
||||
Log(LogCritical, "SSL")
|
||||
<< "Could not read RSA key from CA key file '" << cakeyfile << "': " << ERR_peek_error() << ", \"" << ERR_error_string(ERR_peek_error(), errbuf) << "\"";
|
||||
return shared_ptr<X509>();
|
||||
return boost::shared_ptr<X509>();
|
||||
}
|
||||
|
||||
BIO_free(cakeybio);
|
||||
|
||||
String cacertfile = cadir + "/ca.crt";
|
||||
|
||||
shared_ptr<X509> cacert = GetX509Certificate(cacertfile);
|
||||
boost::shared_ptr<X509> cacert = GetX509Certificate(cacertfile);
|
||||
|
||||
EVP_PKEY *privkey = EVP_PKEY_new();
|
||||
EVP_PKEY_assign_RSA(privkey, rsa);
|
||||
|
@ -460,7 +460,7 @@ shared_ptr<X509> CreateCertIcingaCA(EVP_PKEY *pubkey, X509_NAME *subject)
|
|||
return CreateCert(pubkey, subject, X509_get_subject_name(cacert.get()), privkey, false, cadir + "/serial.txt");
|
||||
}
|
||||
|
||||
String CertificateToString(const shared_ptr<X509>& cert)
|
||||
String CertificateToString(const boost::shared_ptr<X509>& cert)
|
||||
{
|
||||
BIO *mem = BIO_new(BIO_s_mem());
|
||||
PEM_write_bio_X509(mem, cert.get());
|
||||
|
|
|
@ -32,20 +32,21 @@
|
|||
#include <openssl/x509v3.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/rand.h>
|
||||
#include <boost/smart_ptr/shared_ptr.hpp>
|
||||
|
||||
namespace icinga
|
||||
{
|
||||
|
||||
void I2_BASE_API InitializeOpenSSL(void);
|
||||
shared_ptr<SSL_CTX> I2_BASE_API MakeSSLContext(const String& pubkey, const String& privkey, const String& cakey = String());
|
||||
void I2_BASE_API AddCRLToSSLContext(const shared_ptr<SSL_CTX>& context, const String& crlPath);
|
||||
String I2_BASE_API GetCertificateCN(const shared_ptr<X509>& certificate);
|
||||
shared_ptr<X509> I2_BASE_API GetX509Certificate(const String& pemfile);
|
||||
boost::shared_ptr<SSL_CTX> I2_BASE_API MakeSSLContext(const String& pubkey, const String& privkey, const String& cakey = String());
|
||||
void I2_BASE_API AddCRLToSSLContext(const boost::shared_ptr<SSL_CTX>& context, const String& crlPath);
|
||||
String I2_BASE_API GetCertificateCN(const boost::shared_ptr<X509>& certificate);
|
||||
boost::shared_ptr<X509> I2_BASE_API GetX509Certificate(const String& pemfile);
|
||||
int I2_BASE_API MakeX509CSR(const String& cn, const String& keyfile, const String& csrfile = String(), const String& certfile = String(), bool ca = false);
|
||||
shared_ptr<X509> I2_BASE_API CreateCert(EVP_PKEY *pubkey, X509_NAME *subject, X509_NAME *issuer, EVP_PKEY *cakey, bool ca, const String& serialfile = String());
|
||||
boost::shared_ptr<X509> I2_BASE_API CreateCert(EVP_PKEY *pubkey, X509_NAME *subject, X509_NAME *issuer, EVP_PKEY *cakey, bool ca, const String& serialfile = String());
|
||||
String I2_BASE_API GetIcingaCADir(void);
|
||||
String I2_BASE_API CertificateToString(const shared_ptr<X509>& cert);
|
||||
shared_ptr<X509> I2_BASE_API CreateCertIcingaCA(EVP_PKEY *pubkey, X509_NAME *subject);
|
||||
String I2_BASE_API CertificateToString(const boost::shared_ptr<X509>& cert);
|
||||
boost::shared_ptr<X509> I2_BASE_API CreateCertIcingaCA(EVP_PKEY *pubkey, X509_NAME *subject);
|
||||
String I2_BASE_API PBKDF2_SHA1(const String& password, const String& salt, int iterations);
|
||||
String I2_BASE_API SHA256(const String& s);
|
||||
String I2_BASE_API RandomString(int length);
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include "base/string.hpp"
|
||||
#include "base/object.hpp"
|
||||
#include "base/initialize.hpp"
|
||||
#include "base/utility.hpp"
|
||||
#include <boost/function.hpp>
|
||||
|
||||
namespace icinga
|
||||
|
@ -42,11 +41,11 @@ class Type;
|
|||
struct Field
|
||||
{
|
||||
int ID;
|
||||
shared_ptr<Type> FType;
|
||||
intrusive_ptr<Type> FType;
|
||||
const char *Name;
|
||||
int Attributes;
|
||||
|
||||
Field(int id, const shared_ptr<Type>& type, const char *name, int attributes)
|
||||
Field(int id, const intrusive_ptr<Type>& type, const char *name, int attributes)
|
||||
: ID(id), FType(type), Name(name), Attributes(attributes)
|
||||
{ }
|
||||
};
|
||||
|
@ -95,7 +94,7 @@ class TypeImpl
|
|||
namespace { namespace UNIQUE_NAME(rt) { \
|
||||
void RegisterType ## type(void) \
|
||||
{ \
|
||||
icinga::Type::Ptr t = make_shared<TypeImpl<type> >(); \
|
||||
icinga::Type::Ptr t = new TypeImpl<type>(); \
|
||||
type::TypeInstance = t; \
|
||||
icinga::Type::Register(t); \
|
||||
} \
|
||||
|
@ -105,7 +104,7 @@ class TypeImpl
|
|||
DEFINE_TYPE_INSTANCE(type)
|
||||
|
||||
#define DEFINE_TYPE_INSTANCE(type) \
|
||||
Type::Ptr type::TypeInstance;
|
||||
Type::Ptr type::TypeInstance
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -32,15 +32,6 @@
|
|||
namespace icinga
|
||||
{
|
||||
|
||||
#define TOKENPASTE(x, y) x ## y
|
||||
#define TOKENPASTE2(x, y) TOKENPASTE(x, y)
|
||||
|
||||
#ifdef HAVE_COUNTER_MACRO
|
||||
# define UNIQUE_NAME(prefix) TOKENPASTE2(prefix, __COUNTER__)
|
||||
#else /* HAVE_COUNTER_MACRO */
|
||||
# define UNIQUE_NAME(prefix) prefix
|
||||
#endif /* HAVE_COUNTER_MACRO */
|
||||
|
||||
#ifdef _WIN32
|
||||
#define MS_VC_EXCEPTION 0x406D1388
|
||||
|
||||
|
|
|
@ -203,14 +203,14 @@ Value icinga::operator+(const Value& lhs, const Value& rhs)
|
|||
else if ((lhs.IsNumber() || lhs.IsEmpty()) && (rhs.IsNumber() || rhs.IsEmpty()) && !(lhs.IsEmpty() && rhs.IsEmpty()))
|
||||
return static_cast<double>(lhs) + static_cast<double>(rhs);
|
||||
else if ((lhs.IsObjectType<Array>() || lhs.IsEmpty()) && (rhs.IsObjectType<Array>() || rhs.IsEmpty()) && !(lhs.IsEmpty() && rhs.IsEmpty())) {
|
||||
Array::Ptr result = make_shared<Array>();
|
||||
Array::Ptr result = new Array();
|
||||
if (!lhs.IsEmpty())
|
||||
static_cast<Array::Ptr>(lhs)->CopyTo(result);
|
||||
if (!rhs.IsEmpty())
|
||||
static_cast<Array::Ptr>(rhs)->CopyTo(result);
|
||||
return result;
|
||||
} else if ((lhs.IsObjectType<Dictionary>() || lhs.IsEmpty()) && (rhs.IsObjectType<Dictionary>() || rhs.IsEmpty()) && !(lhs.IsEmpty() && rhs.IsEmpty())) {
|
||||
Dictionary::Ptr result = make_shared<Dictionary>();
|
||||
Dictionary::Ptr result = new Dictionary();
|
||||
if (!lhs.IsEmpty())
|
||||
static_cast<Dictionary::Ptr>(lhs)->CopyTo(result);
|
||||
if (!rhs.IsEmpty())
|
||||
|
@ -247,9 +247,9 @@ Value icinga::operator-(const Value& lhs, const Value& rhs)
|
|||
return static_cast<double>(lhs) - static_cast<double>(rhs);
|
||||
else if ((lhs.IsObjectType<Array>() || lhs.IsEmpty()) && (rhs.IsObjectType<Array>() || rhs.IsEmpty()) && !(lhs.IsEmpty() && rhs.IsEmpty())) {
|
||||
if (lhs.IsEmpty())
|
||||
return make_shared<Array>();
|
||||
return new Array();
|
||||
|
||||
Array::Ptr result = make_shared<Array>();
|
||||
Array::Ptr result = new Array();
|
||||
Array::Ptr left = lhs;
|
||||
Array::Ptr right = rhs;
|
||||
|
||||
|
|
|
@ -58,8 +58,17 @@ public:
|
|||
Value(const String& value);
|
||||
Value(const char *value);
|
||||
|
||||
inline Value(Object *value)
|
||||
: m_Value()
|
||||
{
|
||||
if (!value)
|
||||
return;
|
||||
|
||||
m_Value = Object::Ptr(value);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline Value(const shared_ptr<T>& value)
|
||||
inline Value(const intrusive_ptr<T>& value)
|
||||
: m_Value()
|
||||
{
|
||||
if (!value)
|
||||
|
@ -92,10 +101,10 @@ public:
|
|||
bool operator!=(const Value& rhs) const;
|
||||
|
||||
template<typename T>
|
||||
operator shared_ptr<T>(void) const
|
||||
operator intrusive_ptr<T>(void) const
|
||||
{
|
||||
if (IsEmpty())
|
||||
return shared_ptr<T>();
|
||||
return intrusive_ptr<T>();
|
||||
|
||||
if (!IsObject())
|
||||
BOOST_THROW_EXCEPTION(std::runtime_error("Cannot convert value to object."));
|
||||
|
@ -104,7 +113,7 @@ public:
|
|||
|
||||
ASSERT(object);
|
||||
|
||||
shared_ptr<T> tobject = dynamic_pointer_cast<T>(object);
|
||||
intrusive_ptr<T> tobject = dynamic_pointer_cast<T>(object);
|
||||
|
||||
if (!tobject)
|
||||
BOOST_THROW_EXCEPTION(std::bad_cast());
|
||||
|
|
|
@ -28,4 +28,13 @@
|
|||
# define I2_IMPORT __declspec(dllimport)
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#define TOKENPASTE(x, y) x ## y
|
||||
#define TOKENPASTE2(x, y) TOKENPASTE(x, y)
|
||||
|
||||
#ifdef HAVE_COUNTER_MACRO
|
||||
# define UNIQUE_NAME(prefix) TOKENPASTE2(prefix, __COUNTER__)
|
||||
#else /* HAVE_COUNTER_MACRO */
|
||||
# define UNIQUE_NAME(prefix) prefix
|
||||
#endif /* HAVE_COUNTER_MACRO */
|
||||
|
||||
#endif /* VISIBILITY_H */
|
||||
|
|
|
@ -32,7 +32,7 @@ WorkQueue::WorkQueue(size_t maxItems)
|
|||
: m_ID(m_NextID++), m_MaxItems(maxItems), m_Stopped(false),
|
||||
m_Processing(false), m_ExceptionCallback(WorkQueue::DefaultExceptionCallback)
|
||||
{
|
||||
m_StatusTimer = make_shared<Timer>();
|
||||
m_StatusTimer = new Timer();
|
||||
m_StatusTimer->SetInterval(10);
|
||||
m_StatusTimer->OnTimerExpired.connect(boost::bind(&WorkQueue::StatusTimerHandler, this));
|
||||
m_StatusTimer->Start();
|
||||
|
|
|
@ -39,21 +39,21 @@ REGISTER_STATSFUNCTION(CheckerComponentStats, &CheckerComponent::StatsFunc);
|
|||
|
||||
Value CheckerComponent::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata)
|
||||
{
|
||||
Dictionary::Ptr nodes = make_shared<Dictionary>();
|
||||
Dictionary::Ptr nodes = new Dictionary();
|
||||
|
||||
BOOST_FOREACH(const CheckerComponent::Ptr& checker, DynamicType::GetObjectsByType<CheckerComponent>()) {
|
||||
unsigned long idle = checker->GetIdleCheckables();
|
||||
unsigned long pending = checker->GetPendingCheckables();
|
||||
|
||||
Dictionary::Ptr stats = make_shared<Dictionary>();
|
||||
Dictionary::Ptr stats = new Dictionary();
|
||||
stats->Set("idle", idle);
|
||||
stats->Set("pending", pending);
|
||||
|
||||
nodes->Set(checker->GetName(), stats);
|
||||
|
||||
String perfdata_prefix = "checkercomponent_" + checker->GetName() + "_";
|
||||
perfdata->Add(make_shared<PerfdataValue>(perfdata_prefix + "idle", Convert::ToDouble(idle)));
|
||||
perfdata->Add(make_shared<PerfdataValue>(perfdata_prefix + "pending", Convert::ToDouble(pending)));
|
||||
perfdata->Add(new PerfdataValue(perfdata_prefix + "idle", Convert::ToDouble(idle)));
|
||||
perfdata->Add(new PerfdataValue(perfdata_prefix + "pending", Convert::ToDouble(pending)));
|
||||
}
|
||||
|
||||
status->Set("checkercomponent", nodes);
|
||||
|
@ -79,7 +79,7 @@ void CheckerComponent::Start(void)
|
|||
|
||||
m_Thread = boost::thread(boost::bind(&CheckerComponent::CheckThreadProc, this));
|
||||
|
||||
m_ResultTimer = make_shared<Timer>();
|
||||
m_ResultTimer = new Timer();
|
||||
m_ResultTimer->SetInterval(5);
|
||||
m_ResultTimer->OnTimerExpired.connect(boost::bind(&CheckerComponent::ResultTimerHandler, this));
|
||||
m_ResultTimer->Start();
|
||||
|
@ -189,8 +189,7 @@ void CheckerComponent::CheckThreadProc(void)
|
|||
Log(LogDebug, "CheckerComponent")
|
||||
<< "Executing check for '" << checkable->GetName() << "'";
|
||||
|
||||
CheckerComponent::Ptr self = GetSelf();
|
||||
Utility::QueueAsyncCallback(boost::bind(&CheckerComponent::ExecuteCheckHelper, self, checkable));
|
||||
Utility::QueueAsyncCallback(boost::bind(&CheckerComponent::ExecuteCheckHelper, CheckerComponent::Ptr(this), checkable));
|
||||
|
||||
lock.lock();
|
||||
}
|
||||
|
@ -201,7 +200,7 @@ void CheckerComponent::ExecuteCheckHelper(const Checkable::Ptr& checkable)
|
|||
try {
|
||||
checkable->ExecuteCheck();
|
||||
} catch (const std::exception& ex) {
|
||||
CheckResult::Ptr cr = make_shared<CheckResult>();
|
||||
CheckResult::Ptr cr = new CheckResult();
|
||||
cr->SetState(ServiceUnknown);
|
||||
|
||||
String output = "Exception occured while checking '" + checkable->GetName() + "': " + DiagnosticInformation(ex);
|
||||
|
|
|
@ -97,7 +97,7 @@ public:
|
|||
|
||||
#define REGISTER_CLICOMMAND(name, klass) \
|
||||
namespace { namespace UNIQUE_NAME(cli) { \
|
||||
I2_EXPORT icinga::RegisterCLICommandHelper l_RegisterCLICommand(name, make_shared<klass>()); \
|
||||
I2_EXPORT icinga::RegisterCLICommandHelper l_RegisterCLICommand(name, new klass()); \
|
||||
} }
|
||||
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ static bool LoadConfigFiles(const boost::program_options::variables_map& vm, con
|
|||
ConfigCompiler::CompileText(name, fragment);
|
||||
}
|
||||
|
||||
ConfigItemBuilder::Ptr builder = make_shared<ConfigItemBuilder>();
|
||||
ConfigItemBuilder::Ptr builder = new ConfigItemBuilder();
|
||||
builder->SetType(appType);
|
||||
builder->SetName("application");
|
||||
ConfigItem::Ptr item = builder->Compile();
|
||||
|
|
|
@ -43,13 +43,13 @@ RegisterBlackAndWhitelistCLICommandHelper::RegisterBlackAndWhitelistCLICommandHe
|
|||
name.push_back("node");
|
||||
name.push_back(ltype);
|
||||
name.push_back("add");
|
||||
CLICommand::Register(name, make_shared<BlackAndWhitelistCommand>(type, BlackAndWhitelistCommandAdd));
|
||||
CLICommand::Register(name, new BlackAndWhitelistCommand(type, BlackAndWhitelistCommandAdd));
|
||||
|
||||
name[2] = "remove";
|
||||
CLICommand::Register(name, make_shared<BlackAndWhitelistCommand>(type, BlackAndWhitelistCommandRemove));
|
||||
CLICommand::Register(name, new BlackAndWhitelistCommand(type, BlackAndWhitelistCommandRemove));
|
||||
|
||||
name[2] = "list";
|
||||
CLICommand::Register(name, make_shared<BlackAndWhitelistCommand>(type, BlackAndWhitelistCommandList));
|
||||
CLICommand::Register(name, new BlackAndWhitelistCommand(type, BlackAndWhitelistCommandList));
|
||||
}
|
||||
|
||||
BlackAndWhitelistCommand::BlackAndWhitelistCommand(const String& type, BlackAndWhitelistCommandType command)
|
||||
|
|
|
@ -69,12 +69,12 @@ int NodeUpdateConfigCommand::Run(const boost::program_options::variables_map& vm
|
|||
|
||||
String inventory_path = NodeUtility::GetRepositoryPath() + "/inventory.index";
|
||||
|
||||
Dictionary::Ptr old_inventory = make_shared<Dictionary>();
|
||||
Dictionary::Ptr old_inventory = new Dictionary();
|
||||
if (Utility::PathExists(inventory_path)) {
|
||||
old_inventory = Utility::LoadJsonFile(inventory_path);
|
||||
}
|
||||
|
||||
Dictionary::Ptr inventory = make_shared<Dictionary>();
|
||||
Dictionary::Ptr inventory = new Dictionary();
|
||||
|
||||
Log(LogInformation, "cli")
|
||||
<< "Updating node configuration for ";
|
||||
|
@ -94,16 +94,16 @@ int NodeUpdateConfigCommand::Run(const boost::program_options::variables_map& vm
|
|||
/* store existing structure in index */
|
||||
inventory->Set(endpoint, node);
|
||||
|
||||
Dictionary::Ptr host_services = make_shared<Dictionary>();
|
||||
Dictionary::Ptr host_services = new Dictionary();
|
||||
|
||||
Log(LogInformation, "cli")
|
||||
<< "Adding host '" << zone << "' to the repository.";
|
||||
|
||||
Dictionary::Ptr host_attrs = make_shared<Dictionary>();
|
||||
Dictionary::Ptr host_attrs = new Dictionary();
|
||||
host_attrs->Set("__name", zone);
|
||||
host_attrs->Set("name", zone);
|
||||
host_attrs->Set("check_command", "cluster-zone");
|
||||
Array::Ptr host_imports = make_shared<Array>();
|
||||
Array::Ptr host_imports = new Array();
|
||||
host_imports->Add("satellite-host"); //default host node template
|
||||
host_attrs->Set("import", host_imports);
|
||||
|
||||
|
@ -148,7 +148,7 @@ int NodeUpdateConfigCommand::Run(const boost::program_options::variables_map& vm
|
|||
|
||||
if (!skip_host) {
|
||||
/* add a new host to the config repository */
|
||||
Dictionary::Ptr host_attrs = make_shared<Dictionary>();
|
||||
Dictionary::Ptr host_attrs = new Dictionary();
|
||||
host_attrs->Set("__name", host);
|
||||
host_attrs->Set("name", host);
|
||||
|
||||
|
@ -159,7 +159,7 @@ int NodeUpdateConfigCommand::Run(const boost::program_options::variables_map& vm
|
|||
host_attrs->Set("zone", zone);
|
||||
}
|
||||
|
||||
Array::Ptr host_imports = make_shared<Array>();
|
||||
Array::Ptr host_imports = new Array();
|
||||
host_imports->Add("satellite-host"); //default host node template
|
||||
host_attrs->Set("import", host_imports);
|
||||
|
||||
|
@ -209,7 +209,7 @@ int NodeUpdateConfigCommand::Run(const boost::program_options::variables_map& vm
|
|||
continue;
|
||||
|
||||
/* add a new service for this host to the config repository */
|
||||
Dictionary::Ptr service_attrs = make_shared<Dictionary>();
|
||||
Dictionary::Ptr service_attrs = new Dictionary();
|
||||
String long_name = host + "!" + service; //use NameComposer?
|
||||
service_attrs->Set("__name", long_name);
|
||||
service_attrs->Set("name", service);
|
||||
|
@ -217,7 +217,7 @@ int NodeUpdateConfigCommand::Run(const boost::program_options::variables_map& vm
|
|||
service_attrs->Set("check_command", "dummy");
|
||||
service_attrs->Set("zone", zone);
|
||||
|
||||
Array::Ptr service_imports = make_shared<Array>();
|
||||
Array::Ptr service_imports = new Array();
|
||||
service_imports->Add("satellite-service"); //default service node template
|
||||
service_attrs->Set("import", service_imports);
|
||||
|
||||
|
@ -227,7 +227,7 @@ int NodeUpdateConfigCommand::Run(const boost::program_options::variables_map& vm
|
|||
}
|
||||
|
||||
/* write a new zone and endpoint for the node */
|
||||
Dictionary::Ptr endpoint_attrs = make_shared<Dictionary>();
|
||||
Dictionary::Ptr endpoint_attrs = new Dictionary();
|
||||
endpoint_attrs->Set("__name", endpoint);
|
||||
endpoint_attrs->Set("name", endpoint);
|
||||
|
||||
|
@ -245,8 +245,8 @@ int NodeUpdateConfigCommand::Run(const boost::program_options::variables_map& vm
|
|||
<< "Cannot add node endpoint '" << endpoint << "' to the config repository!\n";
|
||||
}
|
||||
|
||||
Dictionary::Ptr zone_attrs = make_shared<Dictionary>();
|
||||
Array::Ptr zone_members = make_shared<Array>();
|
||||
Dictionary::Ptr zone_attrs = new Dictionary();
|
||||
Array::Ptr zone_members = new Array();
|
||||
|
||||
zone_members->Add(endpoint);
|
||||
zone_attrs->Set("__name", zone);
|
||||
|
@ -296,7 +296,7 @@ int NodeUpdateConfigCommand::Run(const boost::program_options::variables_map& vm
|
|||
BOOST_FOREACH(const Dictionary::Pair& kv, old_node_repository) {
|
||||
String host = kv.first;
|
||||
|
||||
Dictionary::Ptr host_attrs = make_shared<Dictionary>();
|
||||
Dictionary::Ptr host_attrs = new Dictionary();
|
||||
host_attrs->Set("name", host);
|
||||
RepositoryUtility::RemoveObject(host, "Host", host_attrs); //this removes all services for this host as well
|
||||
}
|
||||
|
@ -304,11 +304,11 @@ int NodeUpdateConfigCommand::Run(const boost::program_options::variables_map& vm
|
|||
String zone = old_node->Get("zone");
|
||||
String endpoint = old_node->Get("endpoint");
|
||||
|
||||
Dictionary::Ptr zone_attrs = make_shared<Dictionary>();
|
||||
Dictionary::Ptr zone_attrs = new Dictionary();
|
||||
zone_attrs->Set("name", zone);
|
||||
RepositoryUtility::RemoveObject(zone, "Zone", zone_attrs);
|
||||
|
||||
Dictionary::Ptr endpoint_attrs = make_shared<Dictionary>();
|
||||
Dictionary::Ptr endpoint_attrs = new Dictionary();
|
||||
endpoint_attrs->Set("name", endpoint);
|
||||
RepositoryUtility::RemoveObject(endpoint, "Endpoint", endpoint_attrs);
|
||||
} else {
|
||||
|
@ -341,7 +341,7 @@ int NodeUpdateConfigCommand::Run(const boost::program_options::variables_map& vm
|
|||
Log(LogInformation, "cli")
|
||||
<< "Node update found old host '" << old_host << "' on node '" << old_node_name << "'. Removing it.";
|
||||
|
||||
Dictionary::Ptr host_attrs = make_shared<Dictionary>();
|
||||
Dictionary::Ptr host_attrs = new Dictionary();
|
||||
host_attrs->Set("name", old_host);
|
||||
RepositoryUtility::RemoveObject(old_host, "Host", host_attrs); //this will remove all services for this host too
|
||||
} else {
|
||||
|
@ -365,7 +365,7 @@ int NodeUpdateConfigCommand::Run(const boost::program_options::variables_map& vm
|
|||
<< "Node update found old service '" << old_service << "' on host '" << old_host
|
||||
<< "' on node '" << old_node_name << "'. Removing it.";
|
||||
|
||||
Dictionary::Ptr service_attrs = make_shared<Dictionary>();
|
||||
Dictionary::Ptr service_attrs = new Dictionary();
|
||||
service_attrs->Set("name", old_service);
|
||||
service_attrs->Set("host_name", old_host);
|
||||
RepositoryUtility::RemoveObject(old_service, "Service", service_attrs);
|
||||
|
|
|
@ -122,7 +122,7 @@ void NodeUtility::PrintNodeRepository(std::ostream& fp, const Dictionary::Ptr& r
|
|||
|
||||
void NodeUtility::PrintNodesJson(std::ostream& fp)
|
||||
{
|
||||
Dictionary::Ptr result = make_shared<Dictionary>();
|
||||
Dictionary::Ptr result = new Dictionary();
|
||||
|
||||
BOOST_FOREACH(const Dictionary::Ptr& node, GetNodes()) {
|
||||
result->Set(node->Get("endpoint"), node);
|
||||
|
@ -140,7 +140,7 @@ void NodeUtility::AddNode(const String& name)
|
|||
<< "Node '" << name << "' exists already.";
|
||||
}
|
||||
|
||||
Dictionary::Ptr node = make_shared<Dictionary>();
|
||||
Dictionary::Ptr node = new Dictionary();
|
||||
|
||||
node->Set("seen", Utility::GetTime());
|
||||
node->Set("endpoint", name);
|
||||
|
@ -153,7 +153,7 @@ void NodeUtility::AddNode(const String& name)
|
|||
void NodeUtility::AddNodeSettings(const String& name, const String& host,
|
||||
const String& port, double log_duration)
|
||||
{
|
||||
Dictionary::Ptr settings = make_shared<Dictionary>();
|
||||
Dictionary::Ptr settings = new Dictionary();
|
||||
|
||||
settings->Set("host", host);
|
||||
settings->Set("port", port);
|
||||
|
@ -237,10 +237,10 @@ void NodeUtility::CollectNodes(const String& node_file, std::vector<Dictionary::
|
|||
|
||||
int NodeUtility::GenerateNodeIcingaConfig(const std::vector<std::string>& endpoints, const String& nodename, const String& zonename)
|
||||
{
|
||||
Array::Ptr my_config = make_shared<Array>();
|
||||
Array::Ptr my_config = new Array();
|
||||
|
||||
Dictionary::Ptr my_master_zone = make_shared<Dictionary>();
|
||||
Array::Ptr my_master_zone_members = make_shared<Array>();
|
||||
Dictionary::Ptr my_master_zone = new Dictionary();
|
||||
Array::Ptr my_master_zone_members = new Array();
|
||||
|
||||
String master_zone_name = "master"; //TODO: Find a better name.
|
||||
|
||||
|
@ -250,7 +250,7 @@ int NodeUtility::GenerateNodeIcingaConfig(const std::vector<std::string>& endpoi
|
|||
std::vector<String> tokens;
|
||||
boost::algorithm::split(tokens, endpoint, boost::is_any_of(","));
|
||||
|
||||
Dictionary::Ptr my_master_endpoint = make_shared<Dictionary>();
|
||||
Dictionary::Ptr my_master_endpoint = new Dictionary();
|
||||
|
||||
if (tokens.size() > 1) {
|
||||
String host = tokens[1];
|
||||
|
@ -283,13 +283,13 @@ int NodeUtility::GenerateNodeIcingaConfig(const std::vector<std::string>& endpoi
|
|||
my_config->Add(my_master_zone);
|
||||
|
||||
/* store the local generated node configuration */
|
||||
Dictionary::Ptr my_endpoint = make_shared<Dictionary>();
|
||||
Dictionary::Ptr my_zone = make_shared<Dictionary>();
|
||||
Dictionary::Ptr my_endpoint = new Dictionary();
|
||||
Dictionary::Ptr my_zone = new Dictionary();
|
||||
|
||||
my_endpoint->Set("__name", nodename);
|
||||
my_endpoint->Set("__type", "Endpoint");
|
||||
|
||||
Array::Ptr my_zone_members = make_shared<Array>();
|
||||
Array::Ptr my_zone_members = new Array();
|
||||
my_zone_members->Add(nodename);
|
||||
|
||||
my_zone->Set("__name", nodename);
|
||||
|
@ -312,12 +312,12 @@ int NodeUtility::GenerateNodeIcingaConfig(const std::vector<std::string>& endpoi
|
|||
|
||||
int NodeUtility::GenerateNodeMasterIcingaConfig(const String& nodename)
|
||||
{
|
||||
Array::Ptr my_config = make_shared<Array>();
|
||||
Array::Ptr my_config = new Array();
|
||||
|
||||
/* store the local generated node master configuration */
|
||||
Dictionary::Ptr my_master_endpoint = make_shared<Dictionary>();
|
||||
Dictionary::Ptr my_master_zone = make_shared<Dictionary>();
|
||||
Array::Ptr my_master_zone_members = make_shared<Array>();
|
||||
Dictionary::Ptr my_master_endpoint = new Dictionary();
|
||||
Dictionary::Ptr my_master_zone = new Dictionary();
|
||||
Array::Ptr my_master_zone_members = new Array();
|
||||
|
||||
my_master_endpoint->Set("__name", nodename);
|
||||
my_master_endpoint->Set("__type", "Endpoint");
|
||||
|
@ -402,7 +402,7 @@ Array::Ptr NodeUtility::GetBlackAndWhiteList(const String& type)
|
|||
{
|
||||
String list_path = GetBlackAndWhiteListPath(type);
|
||||
|
||||
Array::Ptr lists = make_shared<Array>();
|
||||
Array::Ptr lists = new Array();
|
||||
|
||||
if (Utility::PathExists(list_path)) {
|
||||
lists = Utility::LoadJsonFile(list_path);
|
||||
|
@ -435,7 +435,7 @@ int NodeUtility::UpdateBlackAndWhiteList(const String& type, const String& zone_
|
|||
}
|
||||
}
|
||||
|
||||
Dictionary::Ptr new_filter = make_shared<Dictionary>();
|
||||
Dictionary::Ptr new_filter = new Dictionary();
|
||||
|
||||
new_filter->Set("zone", zone_filter);
|
||||
new_filter->Set("host", host_filter);
|
||||
|
|
|
@ -78,7 +78,7 @@ int ObjectListCommand::Run(const boost::program_options::variables_map& vm, cons
|
|||
std::fstream fp;
|
||||
fp.open(objectfile.CStr(), std::ios_base::in);
|
||||
|
||||
StdioStream::Ptr sfp = make_shared<StdioStream>(&fp, false);
|
||||
StdioStream::Ptr sfp = new StdioStream(&fp, false);
|
||||
unsigned long objects_count = 0;
|
||||
std::map<String, int> type_count;
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ int PkiUtility::SignCsr(const String& csrfile, const String& certfile)
|
|||
|
||||
BIO_free(csrbio);
|
||||
|
||||
shared_ptr<X509> cert = CreateCertIcingaCA(X509_REQ_get_pubkey(req), X509_REQ_get_subject_name(req));
|
||||
boost::shared_ptr<X509> cert = CreateCertIcingaCA(X509_REQ_get_pubkey(req), X509_REQ_get_subject_name(req));
|
||||
|
||||
X509_REQ_free(req);
|
||||
|
||||
|
@ -129,13 +129,13 @@ int PkiUtility::SignCsr(const String& csrfile, const String& certfile)
|
|||
|
||||
int PkiUtility::SaveCert(const String& host, const String& port, const String& keyfile, const String& certfile, const String& trustedfile)
|
||||
{
|
||||
TcpSocket::Ptr client = make_shared<TcpSocket>();
|
||||
TcpSocket::Ptr client = new TcpSocket();
|
||||
|
||||
client->Connect(host, port);
|
||||
|
||||
shared_ptr<SSL_CTX> sslContext = MakeSSLContext(certfile, keyfile);
|
||||
boost::shared_ptr<SSL_CTX> sslContext = MakeSSLContext(certfile, keyfile);
|
||||
|
||||
TlsStream::Ptr stream = make_shared<TlsStream>(client, RoleClient, sslContext);
|
||||
TlsStream::Ptr stream = new TlsStream(client, RoleClient, sslContext);
|
||||
|
||||
try {
|
||||
stream->Handshake();
|
||||
|
@ -143,7 +143,7 @@ int PkiUtility::SaveCert(const String& host, const String& port, const String& k
|
|||
|
||||
}
|
||||
|
||||
shared_ptr<X509> cert = stream->GetPeerCertificate();
|
||||
boost::shared_ptr<X509> cert = stream->GetPeerCertificate();
|
||||
|
||||
std::ofstream fpcert;
|
||||
fpcert.open(trustedfile.CStr());
|
||||
|
@ -172,7 +172,7 @@ int PkiUtility::GenTicket(const String& cn, const String& salt, std::ostream& ti
|
|||
int PkiUtility::RequestCertificate(const String& host, const String& port, const String& keyfile,
|
||||
const String& certfile, const String& cafile, const String& trustedfile, const String& ticket)
|
||||
{
|
||||
TcpSocket::Ptr client = make_shared<TcpSocket>();
|
||||
TcpSocket::Ptr client = new TcpSocket();
|
||||
|
||||
try {
|
||||
client->Connect(host, port);
|
||||
|
@ -184,7 +184,7 @@ int PkiUtility::RequestCertificate(const String& host, const String& port, const
|
|||
return 1;
|
||||
}
|
||||
|
||||
shared_ptr<SSL_CTX> sslContext;
|
||||
boost::shared_ptr<SSL_CTX> sslContext;
|
||||
|
||||
try {
|
||||
sslContext = MakeSSLContext(certfile, keyfile);
|
||||
|
@ -194,7 +194,7 @@ int PkiUtility::RequestCertificate(const String& host, const String& port, const
|
|||
return 1;
|
||||
}
|
||||
|
||||
TlsStream::Ptr stream = make_shared<TlsStream>(client, RoleClient, sslContext);
|
||||
TlsStream::Ptr stream = new TlsStream(client, RoleClient, sslContext);
|
||||
|
||||
try {
|
||||
stream->Handshake();
|
||||
|
@ -203,9 +203,9 @@ int PkiUtility::RequestCertificate(const String& host, const String& port, const
|
|||
return 1;
|
||||
}
|
||||
|
||||
shared_ptr<X509> peerCert = stream->GetPeerCertificate();
|
||||
boost::shared_ptr<X509> peerCert = stream->GetPeerCertificate();
|
||||
|
||||
shared_ptr<X509> trustedCert;
|
||||
boost::shared_ptr<X509> trustedCert;
|
||||
|
||||
try {
|
||||
trustedCert = GetX509Certificate(trustedfile);
|
||||
|
@ -220,7 +220,7 @@ int PkiUtility::RequestCertificate(const String& host, const String& port, const
|
|||
return 1;
|
||||
}
|
||||
|
||||
Dictionary::Ptr request = make_shared<Dictionary>();
|
||||
Dictionary::Ptr request = new Dictionary();
|
||||
|
||||
String msgid = Utility::NewUniqueID();
|
||||
|
||||
|
@ -228,7 +228,7 @@ int PkiUtility::RequestCertificate(const String& host, const String& port, const
|
|||
request->Set("id", msgid);
|
||||
request->Set("method", "pki::RequestCertificate");
|
||||
|
||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||
Dictionary::Ptr params = new Dictionary();
|
||||
params->Set("ticket", String(ticket));
|
||||
|
||||
request->Set("params", params);
|
||||
|
|
|
@ -45,13 +45,13 @@ RegisterRepositoryCLICommandHelper::RegisterRepositoryCLICommandHelper(const Str
|
|||
name.push_back("repository");
|
||||
name.push_back(ltype);
|
||||
name.push_back("add");
|
||||
CLICommand::Register(name, make_shared<RepositoryObjectCommand>(type, RepositoryCommandAdd));
|
||||
CLICommand::Register(name, new RepositoryObjectCommand(type, RepositoryCommandAdd));
|
||||
|
||||
name[2] = "remove";
|
||||
CLICommand::Register(name, make_shared<RepositoryObjectCommand>(type, RepositoryCommandRemove));
|
||||
CLICommand::Register(name, new RepositoryObjectCommand(type, RepositoryCommandRemove));
|
||||
|
||||
name[2] = "list";
|
||||
CLICommand::Register(name, make_shared<RepositoryObjectCommand>(type, RepositoryCommandList));
|
||||
CLICommand::Register(name, new RepositoryObjectCommand(type, RepositoryCommandList));
|
||||
}
|
||||
|
||||
RepositoryObjectCommand::RepositoryObjectCommand(const String& type, RepositoryCommandType command)
|
||||
|
@ -183,7 +183,7 @@ int RepositoryObjectCommand::Run(const boost::program_options::variables_map& vm
|
|||
String name = attrs->Get("name");
|
||||
|
||||
if (vm.count("import")) {
|
||||
Array::Ptr imports = make_shared<Array>();
|
||||
Array::Ptr imports = new Array();
|
||||
|
||||
BOOST_FOREACH(const String& import, vm["import"].as<std::vector<std::string> >()) {
|
||||
imports->Add(import);
|
||||
|
|
|
@ -46,7 +46,7 @@ using namespace icinga;
|
|||
|
||||
Dictionary::Ptr RepositoryUtility::GetArgumentAttributes(const std::vector<std::string>& arguments)
|
||||
{
|
||||
Dictionary::Ptr attrs = make_shared<Dictionary>();
|
||||
Dictionary::Ptr attrs = new Dictionary();
|
||||
|
||||
BOOST_FOREACH(const String& kv, arguments) {
|
||||
std::vector<String> tokens;
|
||||
|
@ -160,7 +160,7 @@ void RepositoryUtility::PrintObjects(std::ostream& fp, const String& type)
|
|||
|
||||
void RepositoryUtility::PrintChangeLog(std::ostream& fp)
|
||||
{
|
||||
Array::Ptr changelog = make_shared<Array>();
|
||||
Array::Ptr changelog = new Array();
|
||||
|
||||
GetChangeLog(boost::bind(RepositoryUtility::CollectChange, _1, changelog));
|
||||
|
||||
|
@ -204,7 +204,7 @@ bool RepositoryUtility::AddObject(const String& name, const String& type, const
|
|||
/* add a new changelog entry by timestamp */
|
||||
String path = GetRepositoryChangeLogPath() + "/" + Convert::ToString(Utility::GetTime()) + "-" + type + "-" + SHA256(name) + ".change";
|
||||
|
||||
Dictionary::Ptr change = make_shared<Dictionary>();
|
||||
Dictionary::Ptr change = new Dictionary();
|
||||
|
||||
change->Set("timestamp", Utility::GetTime());
|
||||
change->Set("name", name);
|
||||
|
@ -269,7 +269,7 @@ bool RepositoryUtility::RemoveObject(const String& name, const String& type, con
|
|||
/* add a new changelog entry by timestamp */
|
||||
String path = GetRepositoryChangeLogPath() + "/" + Convert::ToString(Utility::GetTime()) + "-" + type + "-" + SHA256(name) + ".change";
|
||||
|
||||
Dictionary::Ptr change = make_shared<Dictionary>();
|
||||
Dictionary::Ptr change = new Dictionary();
|
||||
|
||||
change->Set("timestamp", Utility::GetTime());
|
||||
change->Set("name", name);
|
||||
|
@ -299,7 +299,7 @@ bool RepositoryUtility::CheckChangeExists(const Dictionary::Ptr& change)
|
|||
{
|
||||
Dictionary::Ptr attrs = change->Get("attrs");
|
||||
|
||||
Array::Ptr changelog = make_shared<Array>();
|
||||
Array::Ptr changelog = new Array();
|
||||
|
||||
GetChangeLog(boost::bind(RepositoryUtility::CollectChange, _1, changelog));
|
||||
|
||||
|
@ -336,7 +336,7 @@ bool RepositoryUtility::ClearChangeLog(void)
|
|||
|
||||
bool RepositoryUtility::ChangeLogHasPendingChanges(void)
|
||||
{
|
||||
Array::Ptr changelog = make_shared<Array>();
|
||||
Array::Ptr changelog = new Array();
|
||||
GetChangeLog(boost::bind(RepositoryUtility::CollectChange, _1, changelog));
|
||||
|
||||
return changelog->GetLength() > 0;
|
||||
|
|
|
@ -36,7 +36,7 @@ Value VariableUtility::GetVariable(const String& name)
|
|||
std::fstream fp;
|
||||
fp.open(varsfile.CStr(), std::ios_base::in);
|
||||
|
||||
StdioStream::Ptr sfp = make_shared<StdioStream>(&fp, false);
|
||||
StdioStream::Ptr sfp = new StdioStream(&fp, false);
|
||||
|
||||
String message;
|
||||
|
||||
|
@ -58,7 +58,7 @@ void VariableUtility::PrintVariables(std::ostream& outfp)
|
|||
std::fstream fp;
|
||||
fp.open(varsfile.CStr(), std::ios_base::in);
|
||||
|
||||
StdioStream::Ptr sfp = make_shared<StdioStream>(&fp, false);
|
||||
StdioStream::Ptr sfp = new StdioStream(&fp, false);
|
||||
unsigned long variables_count = 0;
|
||||
|
||||
String message;
|
||||
|
|
|
@ -40,7 +40,7 @@ REGISTER_STATSFUNCTION(CheckResultReaderStats, &CheckResultReader::StatsFunc);
|
|||
|
||||
Value CheckResultReader::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr&)
|
||||
{
|
||||
Dictionary::Ptr nodes = make_shared<Dictionary>();
|
||||
Dictionary::Ptr nodes = new Dictionary();
|
||||
|
||||
BOOST_FOREACH(const CheckResultReader::Ptr& checkresultreader, DynamicType::GetObjectsByType<CheckResultReader>()) {
|
||||
nodes->Set(checkresultreader->GetName(), 1); //add more stats
|
||||
|
@ -56,7 +56,7 @@ Value CheckResultReader::StatsFunc(const Dictionary::Ptr& status, const Array::P
|
|||
*/
|
||||
void CheckResultReader::Start(void)
|
||||
{
|
||||
m_ReadTimer = make_shared<Timer>();
|
||||
m_ReadTimer = new Timer();
|
||||
m_ReadTimer->OnTimerExpired.connect(boost::bind(&CheckResultReader::ReadTimerHandler, this));
|
||||
m_ReadTimer->SetInterval(5);
|
||||
m_ReadTimer->Start();
|
||||
|
@ -134,7 +134,7 @@ void CheckResultReader::ProcessCheckResultFile(const String& path) const
|
|||
return;
|
||||
}
|
||||
|
||||
CheckResult::Ptr result = make_shared<CheckResult>();
|
||||
CheckResult::Ptr result = new CheckResult();
|
||||
std::pair<String, Value> co = PluginUtility::ParseCheckOutput(attrs["output"]);
|
||||
result->SetOutput(co.first);
|
||||
result->SetPerformanceData(PluginUtility::SplitPerfdata(co.second));
|
||||
|
|
|
@ -47,7 +47,7 @@ REGISTER_STATSFUNCTION(CompatLoggerStats, &CompatLogger::StatsFunc);
|
|||
|
||||
Value CompatLogger::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr&)
|
||||
{
|
||||
Dictionary::Ptr nodes = make_shared<Dictionary>();
|
||||
Dictionary::Ptr nodes = new Dictionary();
|
||||
|
||||
BOOST_FOREACH(const CompatLogger::Ptr& compat_logger, DynamicType::GetObjectsByType<CompatLogger>()) {
|
||||
nodes->Set(compat_logger->GetName(), 1); //add more stats
|
||||
|
@ -73,7 +73,7 @@ void CompatLogger::Start(void)
|
|||
Checkable::OnEventCommandExecuted.connect(bind(&CompatLogger::EventCommandHandler, this, _1));
|
||||
ExternalCommandProcessor::OnNewExternalCommand.connect(boost::bind(&CompatLogger::ExternalCommandHandler, this, _2, _3));
|
||||
|
||||
m_RotationTimer = make_shared<Timer>();
|
||||
m_RotationTimer = new Timer();
|
||||
m_RotationTimer->OnTimerExpired.connect(boost::bind(&CompatLogger::RotationTimerHandler, this));
|
||||
m_RotationTimer->Start();
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ REGISTER_STATSFUNCTION(ExternalCommandListenerStats, &ExternalCommandListener::S
|
|||
|
||||
Value ExternalCommandListener::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr&)
|
||||
{
|
||||
Dictionary::Ptr nodes = make_shared<Dictionary>();
|
||||
Dictionary::Ptr nodes = new Dictionary();
|
||||
|
||||
BOOST_FOREACH(const ExternalCommandListener::Ptr& externalcommandlistener, DynamicType::GetObjectsByType<ExternalCommandListener>()) {
|
||||
nodes->Set(externalcommandlistener->GetName(), 1); //add more stats
|
||||
|
|
|
@ -51,7 +51,7 @@ REGISTER_STATSFUNCTION(StatusDataWriterStats, &StatusDataWriter::StatsFunc);
|
|||
|
||||
Value StatusDataWriter::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr&)
|
||||
{
|
||||
Dictionary::Ptr nodes = make_shared<Dictionary>();
|
||||
Dictionary::Ptr nodes = new Dictionary();
|
||||
|
||||
BOOST_FOREACH(const StatusDataWriter::Ptr& statusdatawriter, DynamicType::GetObjectsByType<StatusDataWriter>()) {
|
||||
nodes->Set(statusdatawriter->GetName(), 1); //add more stats
|
||||
|
@ -75,7 +75,7 @@ void StatusDataWriter::Start(void)
|
|||
{
|
||||
DynamicObject::Start();
|
||||
|
||||
m_StatusTimer = make_shared<Timer>();
|
||||
m_StatusTimer = new Timer();
|
||||
m_StatusTimer->SetInterval(GetUpdateInterval());
|
||||
m_StatusTimer->OnTimerExpired.connect(boost::bind(&StatusDataWriter::StatusTimerHandler, this));
|
||||
m_StatusTimer->Start();
|
||||
|
|
|
@ -75,7 +75,7 @@ int ignore_newlines = 0;
|
|||
|
||||
static void MakeRBinaryOp(Value** result, Expression::OpCallback& op, Value *left, Value *right, DebugInfo& diLeft, DebugInfo& diRight)
|
||||
{
|
||||
*result = new Value(make_shared<Expression>(op, *left, *right, DebugInfoRange(diLeft, diRight)));
|
||||
*result = new Value(new Expression(op, *left, *right, DebugInfoRange(diLeft, diRight)));
|
||||
delete left;
|
||||
delete right;
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ static std::stack<Expression::Ptr> m_FTerm;
|
|||
|
||||
void ConfigCompiler::Compile(void)
|
||||
{
|
||||
m_ModuleScope = make_shared<Dictionary>();
|
||||
m_ModuleScope = new Dictionary();
|
||||
|
||||
m_Abstract = std::stack<bool>();
|
||||
m_RuleLists = std::stack<TypeRuleList::Ptr>();
|
||||
|
@ -343,7 +343,7 @@ type: T_TYPE identifier
|
|||
m_Type = ConfigType::GetByName(name);
|
||||
|
||||
if (!m_Type) {
|
||||
m_Type = make_shared<ConfigType>(name, DebugInfoRange(@1, @2));
|
||||
m_Type = new ConfigType(name, DebugInfoRange(@1, @2));
|
||||
m_Type->Register();
|
||||
}
|
||||
}
|
||||
|
@ -363,7 +363,7 @@ type: T_TYPE identifier
|
|||
|
||||
typerulelist: '{'
|
||||
{
|
||||
m_RuleLists.push(make_shared<TypeRuleList>());
|
||||
m_RuleLists.push(new TypeRuleList());
|
||||
}
|
||||
typerules
|
||||
'}'
|
||||
|
@ -447,7 +447,7 @@ object:
|
|||
{
|
||||
m_ObjectAssign.pop();
|
||||
|
||||
Array::Ptr args = make_shared<Array>();
|
||||
Array::Ptr args = new Array();
|
||||
|
||||
args->Add(m_Abstract.top());
|
||||
m_Abstract.pop();
|
||||
|
@ -468,17 +468,17 @@ object:
|
|||
|
||||
m_SeenAssign.pop();
|
||||
|
||||
Expression::Ptr rex = make_shared<Expression>(&Expression::OpLogicalNegate, m_Ignore.top(), DebugInfoRange(@2, @5));
|
||||
Expression::Ptr rex = new Expression(&Expression::OpLogicalNegate, m_Ignore.top(), DebugInfoRange(@2, @5));
|
||||
m_Ignore.pop();
|
||||
|
||||
Expression::Ptr filter = make_shared<Expression>(&Expression::OpLogicalAnd, m_Assign.top(), rex, DebugInfoRange(@2, @5));
|
||||
Expression::Ptr filter = new Expression(&Expression::OpLogicalAnd, m_Assign.top(), rex, DebugInfoRange(@2, @5));
|
||||
m_Assign.pop();
|
||||
|
||||
args->Add(filter);
|
||||
|
||||
args->Add(context->GetZone());
|
||||
|
||||
$$ = new Value(make_shared<Expression>(&Expression::OpObject, args, exprl, DebugInfoRange(@2, @5)));
|
||||
$$ = new Value(new Expression(&Expression::OpObject, args, exprl, DebugInfoRange(@2, @5)));
|
||||
}
|
||||
;
|
||||
|
||||
|
@ -602,13 +602,13 @@ lterm_items_inner: lterm
|
|||
|
||||
lterm: indexer combined_set_op rterm
|
||||
{
|
||||
$$ = new Value(make_shared<Expression>(&Expression::OpSet, MakeArray(Array::Ptr($1), $2), *$3, DebugInfoRange(@1, @3)));
|
||||
$$ = new Value(new Expression(&Expression::OpSet, MakeArray(Array::Ptr($1), $2), *$3, DebugInfoRange(@1, @3)));
|
||||
delete $3;
|
||||
}
|
||||
| T_IMPORT rterm
|
||||
{
|
||||
Expression::Ptr avar = make_shared<Expression>(&Expression::OpVariable, "type", DebugInfoRange(@1, @2));
|
||||
$$ = new Value(make_shared<Expression>(&Expression::OpImport, avar, *$2, DebugInfoRange(@1, @2)));
|
||||
Expression::Ptr avar = new Expression(&Expression::OpVariable, "type", DebugInfoRange(@1, @2));
|
||||
$$ = new Value(new Expression(&Expression::OpImport, avar, *$2, DebugInfoRange(@1, @2)));
|
||||
delete $2;
|
||||
}
|
||||
| T_ASSIGN T_WHERE rterm
|
||||
|
@ -618,7 +618,7 @@ lterm: indexer combined_set_op rterm
|
|||
|
||||
m_SeenAssign.top() = true;
|
||||
|
||||
m_Assign.top() = make_shared<Expression>(&Expression::OpLogicalOr, m_Assign.top(), *$3, DebugInfoRange(@1, @3));
|
||||
m_Assign.top() = new Expression(&Expression::OpLogicalOr, m_Assign.top(), *$3, DebugInfoRange(@1, @3));
|
||||
delete $3;
|
||||
|
||||
$$ = new Value(MakeLiteral());
|
||||
|
@ -628,7 +628,7 @@ lterm: indexer combined_set_op rterm
|
|||
if ((m_Apply.empty() || !m_Apply.top()) && (m_ObjectAssign.empty() || !m_ObjectAssign.top()))
|
||||
BOOST_THROW_EXCEPTION(ConfigError("'ignore' keyword not valid in this context."));
|
||||
|
||||
m_Ignore.top() = make_shared<Expression>(&Expression::OpLogicalOr, m_Ignore.top(), *$3, DebugInfoRange(@1, @3));
|
||||
m_Ignore.top() = new Expression(&Expression::OpLogicalOr, m_Ignore.top(), *$3, DebugInfoRange(@1, @3));
|
||||
delete $3;
|
||||
|
||||
$$ = new Value(MakeLiteral());
|
||||
|
@ -636,7 +636,7 @@ lterm: indexer combined_set_op rterm
|
|||
| T_RETURN rterm
|
||||
{
|
||||
Expression::Ptr aname = MakeLiteral("__result");
|
||||
$$ = new Value(make_shared<Expression>(&Expression::OpSet, MakeArray(MakeArray(MakeLiteral(aname)), OpSetLiteral), *$2, DebugInfoRange(@1, @2)));
|
||||
$$ = new Value(new Expression(&Expression::OpSet, MakeArray(MakeArray(MakeLiteral(aname)), OpSetLiteral), *$2, DebugInfoRange(@1, @2)));
|
||||
delete $2;
|
||||
|
||||
}
|
||||
|
@ -684,37 +684,37 @@ rterm_items_inner: rterm
|
|||
|
||||
rterm_array: '[' newlines rterm_items newlines ']'
|
||||
{
|
||||
$$ = new Value(make_shared<Expression>(&Expression::OpArray, Array::Ptr($3), DebugInfoRange(@1, @5)));
|
||||
$$ = new Value(new Expression(&Expression::OpArray, Array::Ptr($3), DebugInfoRange(@1, @5)));
|
||||
}
|
||||
| '[' newlines rterm_items ']'
|
||||
{
|
||||
$$ = new Value(make_shared<Expression>(&Expression::OpArray, Array::Ptr($3), DebugInfoRange(@1, @4)));
|
||||
$$ = new Value(new Expression(&Expression::OpArray, Array::Ptr($3), DebugInfoRange(@1, @4)));
|
||||
}
|
||||
| '[' rterm_items newlines ']'
|
||||
{
|
||||
$$ = new Value(make_shared<Expression>(&Expression::OpArray, Array::Ptr($2), DebugInfoRange(@1, @4)));
|
||||
$$ = new Value(new Expression(&Expression::OpArray, Array::Ptr($2), DebugInfoRange(@1, @4)));
|
||||
}
|
||||
| '[' rterm_items ']'
|
||||
{
|
||||
$$ = new Value(make_shared<Expression>(&Expression::OpArray, Array::Ptr($2), DebugInfoRange(@1, @3)));
|
||||
$$ = new Value(new Expression(&Expression::OpArray, Array::Ptr($2), DebugInfoRange(@1, @3)));
|
||||
}
|
||||
;
|
||||
|
||||
rterm_scope: '{' newlines lterm_items newlines '}'
|
||||
{
|
||||
$$ = new Value(make_shared<Expression>(&Expression::OpDict, Array::Ptr($3), DebugInfoRange(@1, @5)));
|
||||
$$ = new Value(new Expression(&Expression::OpDict, Array::Ptr($3), DebugInfoRange(@1, @5)));
|
||||
}
|
||||
| '{' newlines lterm_items '}'
|
||||
{
|
||||
$$ = new Value(make_shared<Expression>(&Expression::OpDict, Array::Ptr($3), DebugInfoRange(@1, @4)));
|
||||
$$ = new Value(new Expression(&Expression::OpDict, Array::Ptr($3), DebugInfoRange(@1, @4)));
|
||||
}
|
||||
| '{' lterm_items newlines '}'
|
||||
{
|
||||
$$ = new Value(make_shared<Expression>(&Expression::OpDict, Array::Ptr($2), DebugInfoRange(@1, @4)));
|
||||
$$ = new Value(new Expression(&Expression::OpDict, Array::Ptr($2), DebugInfoRange(@1, @4)));
|
||||
}
|
||||
| '{' lterm_items '}'
|
||||
{
|
||||
$$ = new Value(make_shared<Expression>(&Expression::OpDict, Array::Ptr($2), DebugInfoRange(@1, @3)));
|
||||
$$ = new Value(new Expression(&Expression::OpDict, Array::Ptr($2), DebugInfoRange(@1, @3)));
|
||||
}
|
||||
;
|
||||
|
||||
|
@ -733,33 +733,33 @@ rterm: T_STRING
|
|||
}
|
||||
| rterm '.' T_IDENTIFIER
|
||||
{
|
||||
$$ = new Value(make_shared<Expression>(&Expression::OpIndexer, *$1, MakeLiteral($3), DebugInfoRange(@1, @3)));
|
||||
$$ = new Value(new Expression(&Expression::OpIndexer, *$1, MakeLiteral($3), DebugInfoRange(@1, @3)));
|
||||
delete $1;
|
||||
free($3);
|
||||
}
|
||||
| rterm '(' rterm_items ')'
|
||||
{
|
||||
$$ = new Value(make_shared<Expression>(&Expression::OpFunctionCall, *$1, MakeLiteral(Array::Ptr($3)), DebugInfoRange(@1, @4)));
|
||||
$$ = new Value(new Expression(&Expression::OpFunctionCall, *$1, MakeLiteral(Array::Ptr($3)), DebugInfoRange(@1, @4)));
|
||||
delete $1;
|
||||
}
|
||||
| T_IDENTIFIER
|
||||
{
|
||||
$$ = new Value(make_shared<Expression>(&Expression::OpVariable, $1, @1));
|
||||
$$ = new Value(new Expression(&Expression::OpVariable, $1, @1));
|
||||
free($1);
|
||||
}
|
||||
| '!' rterm
|
||||
{
|
||||
$$ = new Value(make_shared<Expression>(&Expression::OpLogicalNegate, *$2, DebugInfoRange(@1, @2)));
|
||||
$$ = new Value(new Expression(&Expression::OpLogicalNegate, *$2, DebugInfoRange(@1, @2)));
|
||||
delete $2;
|
||||
}
|
||||
| '~' rterm
|
||||
{
|
||||
$$ = new Value(make_shared<Expression>(&Expression::OpNegate, *$2, DebugInfoRange(@1, @2)));
|
||||
$$ = new Value(new Expression(&Expression::OpNegate, *$2, DebugInfoRange(@1, @2)));
|
||||
delete $2;
|
||||
}
|
||||
| rterm '[' rterm ']'
|
||||
{
|
||||
$$ = new Value(make_shared<Expression>(&Expression::OpIndexer, *$1, *$3, DebugInfoRange(@1, @4)));
|
||||
$$ = new Value(new Expression(&Expression::OpIndexer, *$1, *$3, DebugInfoRange(@1, @4)));
|
||||
delete $1;
|
||||
delete $3;
|
||||
}
|
||||
|
@ -804,7 +804,7 @@ rterm: T_STRING
|
|||
delete $6;
|
||||
aexpr->MakeInline();
|
||||
|
||||
$$ = new Value(make_shared<Expression>(&Expression::OpFunction, MakeArray($2, aexpr), Array::Ptr($4), DebugInfoRange(@1, @6)));
|
||||
$$ = new Value(new Expression(&Expression::OpFunction, MakeArray($2, aexpr), Array::Ptr($4), DebugInfoRange(@1, @6)));
|
||||
free($2);
|
||||
}
|
||||
| T_FUNCTION '(' identifier_items ')' rterm_scope
|
||||
|
@ -813,7 +813,7 @@ rterm: T_STRING
|
|||
delete $5;
|
||||
aexpr->MakeInline();
|
||||
|
||||
$$ = new Value(make_shared<Expression>(&Expression::OpFunction, MakeArray(Empty, aexpr), Array::Ptr($3), DebugInfoRange(@1, @5)));
|
||||
$$ = new Value(new Expression(&Expression::OpFunction, MakeArray(Empty, aexpr), Array::Ptr($3), DebugInfoRange(@1, @5)));
|
||||
}
|
||||
| T_FOR '(' identifier T_FOLLOWS identifier T_IN rterm ')' rterm_scope
|
||||
{
|
||||
|
@ -823,7 +823,7 @@ rterm: T_STRING
|
|||
Expression::Ptr ascope = *$9;
|
||||
delete $9;
|
||||
|
||||
$$ = new Value(make_shared<Expression>(&Expression::OpFor, MakeArray($3, $5, aexpr), ascope, DebugInfoRange(@1, @9)));
|
||||
$$ = new Value(new Expression(&Expression::OpFor, MakeArray($3, $5, aexpr), ascope, DebugInfoRange(@1, @9)));
|
||||
free($3);
|
||||
free($5);
|
||||
}
|
||||
|
@ -835,7 +835,7 @@ rterm: T_STRING
|
|||
Expression::Ptr ascope = *$7;
|
||||
delete $7;
|
||||
|
||||
$$ = new Value(make_shared<Expression>(&Expression::OpFor, MakeArray($3, Empty, aexpr), ascope, DebugInfoRange(@1, @7)));
|
||||
$$ = new Value(new Expression(&Expression::OpFor, MakeArray($3, Empty, aexpr), ascope, DebugInfoRange(@1, @7)));
|
||||
free($3);
|
||||
}
|
||||
;
|
||||
|
@ -940,10 +940,10 @@ apply:
|
|||
|
||||
m_SeenAssign.pop();
|
||||
|
||||
Expression::Ptr rex = make_shared<Expression>(&Expression::OpLogicalNegate, m_Ignore.top(), DebugInfoRange(@2, @5));
|
||||
Expression::Ptr rex = new Expression(&Expression::OpLogicalNegate, m_Ignore.top(), DebugInfoRange(@2, @5));
|
||||
m_Ignore.pop();
|
||||
|
||||
Expression::Ptr filter = make_shared<Expression>(&Expression::OpLogicalAnd, m_Assign.top(), rex, DebugInfoRange(@2, @5));
|
||||
Expression::Ptr filter = new Expression(&Expression::OpLogicalAnd, m_Assign.top(), rex, DebugInfoRange(@2, @5));
|
||||
m_Assign.pop();
|
||||
|
||||
String fkvar = m_FKVar.top();
|
||||
|
@ -955,7 +955,7 @@ apply:
|
|||
Expression::Ptr fterm = m_FTerm.top();
|
||||
m_FTerm.pop();
|
||||
|
||||
Array::Ptr args = make_shared<Array>();
|
||||
Array::Ptr args = new Array();
|
||||
args->Add(type);
|
||||
args->Add(target);
|
||||
args->Add(aname);
|
||||
|
@ -964,7 +964,7 @@ apply:
|
|||
args->Add(fvvar);
|
||||
args->Add(fterm);
|
||||
|
||||
$$ = new Value(make_shared<Expression>(&Expression::OpApply, args, exprl, DebugInfoRange(@2, @5)));
|
||||
$$ = new Value(new Expression(&Expression::OpApply, args, exprl, DebugInfoRange(@2, @5)));
|
||||
}
|
||||
;
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ void ConfigCompilerContext::OpenObjectsFile(const String& filename)
|
|||
if (!*fp)
|
||||
BOOST_THROW_EXCEPTION(std::runtime_error("Could not open '" + tempFilename + "' file"));
|
||||
|
||||
m_ObjectsFP = make_shared<StdioStream>(fp, true);
|
||||
m_ObjectsFP = new StdioStream(fp, true);
|
||||
}
|
||||
|
||||
void ConfigCompilerContext::WriteObject(const Dictionary::Ptr& object)
|
||||
|
|
|
@ -150,7 +150,7 @@ DynamicObject::Ptr ConfigItem::Commit(bool discard)
|
|||
dobj->SetTypeName(m_Type);
|
||||
dobj->SetZone(m_Zone);
|
||||
|
||||
Dictionary::Ptr locals = make_shared<Dictionary>();
|
||||
Dictionary::Ptr locals = new Dictionary();
|
||||
locals->Set("__parent", m_Scope);
|
||||
m_Scope.reset();
|
||||
locals->Set("name", m_Name);
|
||||
|
@ -175,7 +175,7 @@ DynamicObject::Ptr ConfigItem::Commit(bool discard)
|
|||
|
||||
String name = m_Name;
|
||||
|
||||
shared_ptr<NameComposer> nc = dynamic_pointer_cast<NameComposer>(type);
|
||||
NameComposer *nc = dynamic_cast<NameComposer *>(type.get());
|
||||
|
||||
if (nc) {
|
||||
name = nc->MakeName(m_Name, dobj);
|
||||
|
@ -191,7 +191,7 @@ DynamicObject::Ptr ConfigItem::Commit(bool discard)
|
|||
|
||||
Dictionary::Ptr attrs = Serialize(dobj, FAConfig);
|
||||
|
||||
Dictionary::Ptr persistentItem = make_shared<Dictionary>();
|
||||
Dictionary::Ptr persistentItem = new Dictionary();
|
||||
|
||||
persistentItem->Set("type", GetType());
|
||||
persistentItem->Set("name", GetName());
|
||||
|
@ -230,18 +230,18 @@ DynamicObject::Ptr ConfigItem::Commit(bool discard)
|
|||
*/
|
||||
void ConfigItem::Register(void)
|
||||
{
|
||||
ConfigItem::Ptr self = GetSelf();
|
||||
Type::Ptr type = Type::GetByName(m_Type);
|
||||
|
||||
/* If this is a non-abstract object with a composite name
|
||||
* we register it in m_UnnamedItems instead of m_Items. */
|
||||
if (!m_Abstract && dynamic_pointer_cast<NameComposer>(Type::GetByName(m_Type))) {
|
||||
if (!m_Abstract && dynamic_cast<NameComposer *>(type.get())) {
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
m_UnnamedItems.push_back(self);
|
||||
m_UnnamedItems.push_back(this);
|
||||
} else {
|
||||
std::pair<String, String> key = std::make_pair(m_Type, m_Name);
|
||||
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
m_Items[key] = self;
|
||||
m_Items[key] = this;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
using namespace icinga;
|
||||
|
||||
ConfigItemBuilder::ConfigItemBuilder(void)
|
||||
: m_Abstract(false), m_Expressions(make_shared<Array>())
|
||||
: m_Abstract(false), m_Expressions(new Array())
|
||||
{
|
||||
m_DebugInfo.FirstLine = 0;
|
||||
m_DebugInfo.FirstColumn = 0;
|
||||
|
@ -34,7 +34,7 @@ ConfigItemBuilder::ConfigItemBuilder(void)
|
|||
}
|
||||
|
||||
ConfigItemBuilder::ConfigItemBuilder(const DebugInfo& debugInfo)
|
||||
: m_Abstract(false), m_Expressions(make_shared<Array>())
|
||||
: m_Abstract(false), m_Expressions(new Array())
|
||||
{
|
||||
m_DebugInfo = debugInfo;
|
||||
}
|
||||
|
@ -89,19 +89,19 @@ ConfigItem::Ptr ConfigItemBuilder::Compile(void)
|
|||
BOOST_THROW_EXCEPTION(std::invalid_argument(msgbuf.str()));
|
||||
}
|
||||
|
||||
Array::Ptr exprs = make_shared<Array>();
|
||||
Array::Ptr templateArray = make_shared<Array>();
|
||||
Array::Ptr exprs = new Array();
|
||||
Array::Ptr templateArray = new Array();
|
||||
templateArray->Add(m_Name);
|
||||
|
||||
exprs->Add(make_shared<Expression>(&Expression::OpSet,
|
||||
exprs->Add(new Expression(&Expression::OpSet,
|
||||
MakeArray(MakeArray(MakeLiteral("templates")), OpSetAdd),
|
||||
make_shared<Expression>(&Expression::OpLiteral, templateArray, m_DebugInfo),
|
||||
new Expression(&Expression::OpLiteral, templateArray, m_DebugInfo),
|
||||
m_DebugInfo));
|
||||
|
||||
exprs->Add(make_shared<Expression>(&Expression::OpDict, m_Expressions, true, m_DebugInfo));
|
||||
exprs->Add(new Expression(&Expression::OpDict, m_Expressions, true, m_DebugInfo));
|
||||
|
||||
Expression::Ptr exprl = make_shared<Expression>(&Expression::OpDict, exprs, true, m_DebugInfo);
|
||||
Expression::Ptr exprl = new Expression(&Expression::OpDict, exprs, true, m_DebugInfo);
|
||||
|
||||
return make_shared<ConfigItem>(m_Type, m_Name, m_Abstract, exprl,
|
||||
return new ConfigItem(m_Type, m_Name, m_Abstract, exprl,
|
||||
m_DebugInfo, m_Scope, m_Zone);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
using namespace icinga;
|
||||
|
||||
ConfigType::ConfigType(const String& name, const DebugInfo& debuginfo)
|
||||
: m_Name(name), m_RuleList(make_shared<TypeRuleList>()), m_DebugInfo(debuginfo)
|
||||
: m_Name(name), m_RuleList(new TypeRuleList()), m_DebugInfo(debuginfo)
|
||||
{ }
|
||||
|
||||
String ConfigType::GetName(void) const
|
||||
|
@ -85,7 +85,7 @@ void ConfigType::ValidateItem(const String& name, const Dictionary::Ptr& attrs,
|
|||
locations.push_back(location);
|
||||
|
||||
std::vector<TypeRuleList::Ptr> ruleLists;
|
||||
AddParentRules(ruleLists, GetSelf());
|
||||
AddParentRules(ruleLists, this);
|
||||
ruleLists.push_back(m_RuleList);
|
||||
|
||||
ValidateDictionary(attrs, ruleLists, locations, utils);
|
||||
|
@ -278,7 +278,7 @@ void ConfigType::ValidateArray(const Array::Ptr& array,
|
|||
|
||||
void ConfigType::Register(void)
|
||||
{
|
||||
ConfigTypeRegistry::GetInstance()->Register(GetName(), GetSelf());
|
||||
ConfigTypeRegistry::GetInstance()->Register(GetName(), this);
|
||||
}
|
||||
|
||||
ConfigType::Ptr ConfigType::GetByName(const String& name)
|
||||
|
|
|
@ -275,7 +275,7 @@ Value Expression::OpFunctionCall(const Expression *expr, const Object::Ptr& cont
|
|||
Value Expression::OpArray(const Expression *expr, const Object::Ptr& context, DebugHint *dhint)
|
||||
{
|
||||
Array::Ptr arr = expr->m_Operand1;
|
||||
Array::Ptr result = make_shared<Array>();
|
||||
Array::Ptr result = new Array();
|
||||
|
||||
if (arr) {
|
||||
for (Array::SizeType index = 0; index < arr->GetLength(); index++) {
|
||||
|
@ -291,7 +291,7 @@ Value Expression::OpDict(const Expression *expr, const Object::Ptr& context, Deb
|
|||
{
|
||||
Array::Ptr arr = expr->m_Operand1;
|
||||
bool in_place = expr->m_Operand2;
|
||||
Dictionary::Ptr result = make_shared<Dictionary>();
|
||||
Dictionary::Ptr result = new Dictionary();
|
||||
|
||||
result->Set("__parent", context);
|
||||
|
||||
|
@ -335,10 +335,10 @@ Value Expression::OpSet(const Expression *expr, const Object::Ptr& context, Debu
|
|||
} else {
|
||||
parent = object;
|
||||
|
||||
Expression::Ptr eparent = make_shared<Expression>(&Expression::OpLiteral, parent, expr->m_DebugInfo);
|
||||
Expression::Ptr eindex = make_shared<Expression>(&Expression::OpLiteral, tempindex, expr->m_DebugInfo);
|
||||
Expression::Ptr eparent = new Expression(&Expression::OpLiteral, parent, expr->m_DebugInfo);
|
||||
Expression::Ptr eindex = new Expression(&Expression::OpLiteral, tempindex, expr->m_DebugInfo);
|
||||
|
||||
Expression::Ptr eip = make_shared<Expression>(&Expression::OpIndexer, eparent, eindex, expr->m_DebugInfo);
|
||||
Expression::Ptr eip = new Expression(&Expression::OpIndexer, eparent, eindex, expr->m_DebugInfo);
|
||||
object = eip->Evaluate(context, dhint);
|
||||
}
|
||||
|
||||
|
@ -346,7 +346,7 @@ Value Expression::OpSet(const Expression *expr, const Object::Ptr& context, Debu
|
|||
sdhint = sdhint->GetChild(index);
|
||||
|
||||
if (i != indexer->GetLength() - 1 && object.IsEmpty()) {
|
||||
object = make_shared<Dictionary>();
|
||||
object = new Dictionary();
|
||||
|
||||
SetField(parent, tempindex, object);
|
||||
}
|
||||
|
@ -374,9 +374,9 @@ Value Expression::OpSet(const Expression *expr, const Object::Ptr& context, Debu
|
|||
VERIFY(!"Invalid opcode.");
|
||||
}
|
||||
|
||||
Expression::Ptr ecp = make_shared<Expression>(op,
|
||||
make_shared<Expression>(&Expression::OpLiteral, object, expr->m_DebugInfo),
|
||||
make_shared<Expression>(&Expression::OpLiteral, right, expr->m_DebugInfo),
|
||||
Expression::Ptr ecp = new Expression(op,
|
||||
new Expression(&Expression::OpLiteral, object, expr->m_DebugInfo),
|
||||
new Expression(&Expression::OpLiteral, right, expr->m_DebugInfo),
|
||||
expr->m_DebugInfo);
|
||||
|
||||
right = ecp->Evaluate(context, dhint);
|
||||
|
@ -441,7 +441,7 @@ Value Expression::FunctionWrapper(const std::vector<Value>& arguments, const Arr
|
|||
if (arguments.size() < funcargs->GetLength())
|
||||
BOOST_THROW_EXCEPTION(ConfigError("Too few arguments for function"));
|
||||
|
||||
Dictionary::Ptr context = make_shared<Dictionary>();
|
||||
Dictionary::Ptr context = new Dictionary();
|
||||
context->Set("__parent", scope);
|
||||
|
||||
for (std::vector<Value>::size_type i = 0; i < std::min(arguments.size(), funcargs->GetLength()); i++)
|
||||
|
@ -458,7 +458,7 @@ Value Expression::OpFunction(const Expression* expr, const Object::Ptr& context,
|
|||
String name = left->Get(0);
|
||||
|
||||
Array::Ptr funcargs = expr->m_Operand2;
|
||||
ScriptFunction::Ptr func = make_shared<ScriptFunction>(boost::bind(&Expression::FunctionWrapper, _1, funcargs, aexpr, context));
|
||||
ScriptFunction::Ptr func = new ScriptFunction(boost::bind(&Expression::FunctionWrapper, _1, funcargs, aexpr, context));
|
||||
|
||||
if (!name.IsEmpty())
|
||||
ScriptFunction::Register(name, func);
|
||||
|
@ -497,12 +497,14 @@ Value Expression::OpObject(const Expression* expr, const Object::Ptr& context, D
|
|||
|
||||
String name = aname->Evaluate(context, dhint);
|
||||
|
||||
ConfigItemBuilder::Ptr item = make_shared<ConfigItemBuilder>(expr->m_DebugInfo);
|
||||
ConfigItemBuilder::Ptr item = new ConfigItemBuilder(expr->m_DebugInfo);
|
||||
|
||||
String checkName = name;
|
||||
|
||||
if (!abstract) {
|
||||
shared_ptr<NameComposer> nc = dynamic_pointer_cast<NameComposer>(Type::GetByName(type));
|
||||
Type::Ptr ptype = Type::GetByName(type);
|
||||
|
||||
NameComposer *nc = dynamic_cast<NameComposer *>(ptype.get());
|
||||
|
||||
if (nc)
|
||||
checkName = nc->MakeName(name, Dictionary::Ptr());
|
||||
|
@ -557,7 +559,7 @@ Value Expression::OpFor(const Expression* expr, const Object::Ptr& context, Debu
|
|||
|
||||
ObjectLock olock(arr);
|
||||
BOOST_FOREACH(const Value& value, arr) {
|
||||
Dictionary::Ptr xcontext = make_shared<Dictionary>();
|
||||
Dictionary::Ptr xcontext = new Dictionary();
|
||||
xcontext->Set("__parent", context);
|
||||
xcontext->Set(kvar, value);
|
||||
|
||||
|
@ -571,7 +573,7 @@ Value Expression::OpFor(const Expression* expr, const Object::Ptr& context, Debu
|
|||
|
||||
ObjectLock olock(dict);
|
||||
BOOST_FOREACH(const Dictionary::Pair& kv, dict) {
|
||||
Dictionary::Ptr xcontext = make_shared<Dictionary>();
|
||||
Dictionary::Ptr xcontext = new Dictionary();
|
||||
xcontext->Set("__parent", context);
|
||||
xcontext->Set(kvar, kv.first);
|
||||
xcontext->Set(vvar, kv.second);
|
||||
|
@ -586,12 +588,12 @@ Value Expression::OpFor(const Expression* expr, const Object::Ptr& context, Debu
|
|||
|
||||
Dictionary::Ptr DebugHint::ToDictionary(void) const
|
||||
{
|
||||
Dictionary::Ptr result = make_shared<Dictionary>();
|
||||
Dictionary::Ptr result = new Dictionary();
|
||||
|
||||
Array::Ptr messages = make_shared<Array>();
|
||||
Array::Ptr messages = new Array();
|
||||
typedef std::pair<String, DebugInfo> MessageType;
|
||||
BOOST_FOREACH(const MessageType& message, Messages) {
|
||||
Array::Ptr amsg = make_shared<Array>();
|
||||
Array::Ptr amsg = new Array();
|
||||
amsg->Add(message.first);
|
||||
amsg->Add(message.second.Path);
|
||||
amsg->Add(message.second.FirstLine);
|
||||
|
@ -603,7 +605,7 @@ Dictionary::Ptr DebugHint::ToDictionary(void) const
|
|||
|
||||
result->Set("messages", messages);
|
||||
|
||||
Dictionary::Ptr properties = make_shared<Dictionary>();
|
||||
Dictionary::Ptr properties = new Dictionary();
|
||||
|
||||
typedef std::map<String, DebugHint>::value_type ChildType;
|
||||
BOOST_FOREACH(const ChildType& kv, Children) {
|
||||
|
@ -617,7 +619,7 @@ Dictionary::Ptr DebugHint::ToDictionary(void) const
|
|||
|
||||
Expression::Ptr icinga::MakeLiteral(const Value& lit)
|
||||
{
|
||||
return make_shared<Expression>(&Expression::OpLiteral, lit, DebugInfo());
|
||||
return new Expression(&Expression::OpLiteral, lit, DebugInfo());
|
||||
}
|
||||
|
||||
bool Expression::HasField(const Object::Ptr& context, const String& field)
|
||||
|
|
|
@ -38,7 +38,7 @@ CommandDbObject::CommandDbObject(const DbType::Ptr& type, const String& name1, c
|
|||
|
||||
Dictionary::Ptr CommandDbObject::GetConfigFields(void) const
|
||||
{
|
||||
Dictionary::Ptr fields = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields = new Dictionary();
|
||||
Command::Ptr command = static_pointer_cast<Command>(GetObject());
|
||||
|
||||
fields->Set("command_line", CompatUtility::GetCommandLine(command));
|
||||
|
|
|
@ -36,7 +36,7 @@ class CommandDbObject : public DbObject
|
|||
public:
|
||||
DECLARE_PTR_TYPEDEFS(CommandDbObject);
|
||||
|
||||
CommandDbObject(const shared_ptr<DbType>& type, const String& name1, const String& name2);
|
||||
CommandDbObject(const DbType::Ptr& type, const String& name1, const String& name2);
|
||||
|
||||
virtual Dictionary::Ptr GetConfigFields(void) const;
|
||||
virtual Dictionary::Ptr GetStatusFields(void) const;
|
||||
|
|
|
@ -67,7 +67,7 @@ void DbConnection::Resume(void)
|
|||
Log(LogInformation, "DbConnection")
|
||||
<< "Resuming IDO connection: " << GetName();
|
||||
|
||||
m_CleanUpTimer = make_shared<Timer>();
|
||||
m_CleanUpTimer = new Timer();
|
||||
m_CleanUpTimer->SetInterval(60);
|
||||
m_CleanUpTimer->OnTimerExpired.connect(boost::bind(&DbConnection::CleanUpHandler, this));
|
||||
m_CleanUpTimer->Start();
|
||||
|
@ -85,7 +85,7 @@ void DbConnection::Pause(void)
|
|||
|
||||
void DbConnection::StaticInitialize(void)
|
||||
{
|
||||
m_ProgramStatusTimer = make_shared<Timer>();
|
||||
m_ProgramStatusTimer = new Timer();
|
||||
m_ProgramStatusTimer->SetInterval(10);
|
||||
m_ProgramStatusTimer->OnTimerExpired.connect(boost::bind(&DbConnection::ProgramStatusHandler));
|
||||
m_ProgramStatusTimer->Start();
|
||||
|
@ -97,7 +97,7 @@ void DbConnection::InsertRuntimeVariable(const String& key, const Value& value)
|
|||
query.Table = "runtimevariables";
|
||||
query.Type = DbQueryInsert;
|
||||
query.Category = DbCatProgramStatus;
|
||||
query.Fields = make_shared<Dictionary>();
|
||||
query.Fields = new Dictionary();
|
||||
query.Fields->Set("instance_id", 0); /* DbConnection class fills in real ID */
|
||||
query.Fields->Set("varname", key);
|
||||
query.Fields->Set("varvalue", value);
|
||||
|
@ -110,7 +110,7 @@ void DbConnection::ProgramStatusHandler(void)
|
|||
query1.Table = "programstatus";
|
||||
query1.Type = DbQueryDelete;
|
||||
query1.Category = DbCatProgramStatus;
|
||||
query1.WhereCriteria = make_shared<Dictionary>();
|
||||
query1.WhereCriteria = new Dictionary();
|
||||
query1.WhereCriteria->Set("instance_id", 0); /* DbConnection class fills in real ID */
|
||||
DbObject::OnQuery(query1);
|
||||
|
||||
|
@ -120,7 +120,7 @@ void DbConnection::ProgramStatusHandler(void)
|
|||
query2.Type = DbQueryInsert;
|
||||
query2.Category = DbCatProgramStatus;
|
||||
|
||||
query2.Fields = make_shared<Dictionary>();
|
||||
query2.Fields = new Dictionary();
|
||||
query2.Fields->Set("instance_id", 0); /* DbConnection class fills in real ID */
|
||||
query2.Fields->Set("program_version", Application::GetVersion());
|
||||
query2.Fields->Set("status_update_time", DbValue::FromTimestamp(Utility::GetTime()));
|
||||
|
@ -144,7 +144,7 @@ void DbConnection::ProgramStatusHandler(void)
|
|||
query3.Table = "runtimevariables";
|
||||
query3.Type = DbQueryDelete;
|
||||
query3.Category = DbCatProgramStatus;
|
||||
query3.WhereCriteria = make_shared<Dictionary>();
|
||||
query3.WhereCriteria = new Dictionary();
|
||||
query3.WhereCriteria->Set("instance_id", 0); /* DbConnection class fills in real ID */
|
||||
DbObject::OnQuery(query3);
|
||||
|
||||
|
@ -167,7 +167,7 @@ void DbConnection::ProgramStatusHandler(void)
|
|||
Log(LogDebug, "DbConnection")
|
||||
<< "icinga application customvar key: '" << kv.first << "' value: '" << kv.second << "'";
|
||||
|
||||
Dictionary::Ptr fields4 = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields4 = new Dictionary();
|
||||
fields4->Set("varname", Convert::ToString(kv.first));
|
||||
fields4->Set("varvalue", Convert::ToString(kv.second));
|
||||
fields4->Set("config_type", 1);
|
||||
|
|
|
@ -30,7 +30,7 @@ abstract class DbConnection : DynamicObject
|
|||
};
|
||||
|
||||
[config] Dictionary::Ptr cleanup {
|
||||
default {{{ return make_shared<Dictionary>(); }}}
|
||||
default {{{ return new Dictionary(); }}}
|
||||
};
|
||||
|
||||
[config] int categories {
|
||||
|
|
|
@ -99,12 +99,12 @@ void DbEvents::NextCheckChangedHandler(const Checkable::Ptr& checkable, double n
|
|||
|
||||
query1.Type = DbQueryUpdate;
|
||||
|
||||
Dictionary::Ptr fields1 = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields1 = new Dictionary();
|
||||
fields1->Set("next_check", DbValue::FromTimestamp(nextCheck));
|
||||
|
||||
query1.Fields = fields1;
|
||||
|
||||
query1.WhereCriteria = make_shared<Dictionary>();
|
||||
query1.WhereCriteria = new Dictionary();
|
||||
if (service)
|
||||
query1.WhereCriteria->Set("service_object_id", service);
|
||||
else
|
||||
|
@ -129,13 +129,13 @@ void DbEvents::FlappingChangedHandler(const Checkable::Ptr& checkable, FlappingS
|
|||
|
||||
query1.Type = DbQueryUpdate;
|
||||
|
||||
Dictionary::Ptr fields1 = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields1 = new Dictionary();
|
||||
fields1->Set("is_flapping", CompatUtility::GetCheckableIsFlapping(checkable));
|
||||
fields1->Set("percent_state_change", CompatUtility::GetCheckablePercentStateChange(checkable));
|
||||
|
||||
query1.Fields = fields1;
|
||||
|
||||
query1.WhereCriteria = make_shared<Dictionary>();
|
||||
query1.WhereCriteria = new Dictionary();
|
||||
if (service)
|
||||
query1.WhereCriteria->Set("service_object_id", service);
|
||||
else
|
||||
|
@ -164,14 +164,14 @@ void DbEvents::LastNotificationChangedHandler(const Notification::Ptr& notificat
|
|||
|
||||
query1.Type = DbQueryUpdate;
|
||||
|
||||
Dictionary::Ptr fields1 = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields1 = new Dictionary();
|
||||
fields1->Set("last_notification", DbValue::FromTimestamp(now_bag.first));
|
||||
fields1->Set("next_notification", DbValue::FromTimestamp(time_bag.first));
|
||||
fields1->Set("current_notification_number", notification->GetNotificationNumber());
|
||||
|
||||
query1.Fields = fields1;
|
||||
|
||||
query1.WhereCriteria = make_shared<Dictionary>();
|
||||
query1.WhereCriteria = new Dictionary();
|
||||
if (service)
|
||||
query1.WhereCriteria->Set("service_object_id", service);
|
||||
else
|
||||
|
@ -222,7 +222,7 @@ void DbEvents::EnableChangedHandlerInternal(const Checkable::Ptr& checkable, boo
|
|||
|
||||
query1.Type = DbQueryUpdate;
|
||||
|
||||
Dictionary::Ptr fields1 = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields1 = new Dictionary();
|
||||
|
||||
if (type == EnableActiveChecks) {
|
||||
fields1->Set("active_checks_enabled", enabled ? 1 : 0);
|
||||
|
@ -238,7 +238,7 @@ void DbEvents::EnableChangedHandlerInternal(const Checkable::Ptr& checkable, boo
|
|||
|
||||
query1.Fields = fields1;
|
||||
|
||||
query1.WhereCriteria = make_shared<Dictionary>();
|
||||
query1.WhereCriteria = new Dictionary();
|
||||
if (service)
|
||||
query1.WhereCriteria->Set("service_object_id", service);
|
||||
else
|
||||
|
@ -294,7 +294,7 @@ void DbEvents::AddCommentByType(const DynamicObject::Ptr& object, const Comment:
|
|||
unsigned long entry_time = static_cast<long>(comment->GetEntryTime());
|
||||
unsigned long entry_time_usec = (comment->GetEntryTime() - entry_time) * 1000 * 1000;
|
||||
|
||||
Dictionary::Ptr fields1 = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields1 = new Dictionary();
|
||||
fields1->Set("entry_time", DbValue::FromTimestamp(entry_time));
|
||||
fields1->Set("entry_time_usec", entry_time_usec);
|
||||
fields1->Set("entry_type", comment->GetEntryType());
|
||||
|
@ -348,7 +348,7 @@ void DbEvents::RemoveComments(const Checkable::Ptr& checkable)
|
|||
query1.Table = "comments";
|
||||
query1.Type = DbQueryDelete;
|
||||
query1.Category = DbCatComment;
|
||||
query1.WhereCriteria = make_shared<Dictionary>();
|
||||
query1.WhereCriteria = new Dictionary();
|
||||
query1.WhereCriteria->Set("object_id", checkable);
|
||||
DbObject::OnQuery(query1);
|
||||
}
|
||||
|
@ -368,7 +368,7 @@ void DbEvents::RemoveComment(const Checkable::Ptr& checkable, const Comment::Ptr
|
|||
query1.Table = "comments";
|
||||
query1.Type = DbQueryDelete;
|
||||
query1.Category = DbCatComment;
|
||||
query1.WhereCriteria = make_shared<Dictionary>();
|
||||
query1.WhereCriteria = new Dictionary();
|
||||
query1.WhereCriteria->Set("object_id", checkable);
|
||||
query1.WhereCriteria->Set("internal_comment_id", comment->GetLegacyId());
|
||||
DbObject::OnQuery(query1);
|
||||
|
@ -384,12 +384,12 @@ void DbEvents::RemoveComment(const Checkable::Ptr& checkable, const Comment::Ptr
|
|||
query2.Type = DbQueryUpdate;
|
||||
query2.Category = DbCatComment;
|
||||
|
||||
Dictionary::Ptr fields2 = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields2 = new Dictionary();
|
||||
fields2->Set("deletion_time", DbValue::FromTimestamp(time_bag.first));
|
||||
fields2->Set("deletion_time_usec", time_bag.second);
|
||||
query2.Fields = fields2;
|
||||
|
||||
query2.WhereCriteria = make_shared<Dictionary>();
|
||||
query2.WhereCriteria = new Dictionary();
|
||||
query2.WhereCriteria->Set("internal_comment_id", comment->GetLegacyId());
|
||||
query2.WhereCriteria->Set("comment_time", DbValue::FromTimestamp(entry_time));
|
||||
query2.WhereCriteria->Set("instance_id", 0); /* DbConnection class fills in real ID */
|
||||
|
@ -438,7 +438,7 @@ void DbEvents::AddDowntimeInternal(const Checkable::Ptr& checkable, const Downti
|
|||
|
||||
void DbEvents::AddDowntimeByType(const Checkable::Ptr& checkable, const Downtime::Ptr& downtime, bool historical)
|
||||
{
|
||||
Dictionary::Ptr fields1 = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields1 = new Dictionary();
|
||||
fields1->Set("entry_time", DbValue::FromTimestamp(downtime->GetEntryTime()));
|
||||
fields1->Set("object_id", checkable);
|
||||
|
||||
|
@ -496,7 +496,7 @@ void DbEvents::RemoveDowntimes(const Checkable::Ptr& checkable)
|
|||
query1.Table = "scheduleddowntime";
|
||||
query1.Type = DbQueryDelete;
|
||||
query1.Category = DbCatDowntime;
|
||||
query1.WhereCriteria = make_shared<Dictionary>();
|
||||
query1.WhereCriteria = new Dictionary();
|
||||
query1.WhereCriteria->Set("object_id", checkable);
|
||||
DbObject::OnQuery(query1);
|
||||
}
|
||||
|
@ -516,7 +516,7 @@ void DbEvents::RemoveDowntime(const Checkable::Ptr& checkable, const Downtime::P
|
|||
query1.Table = "scheduleddowntime";
|
||||
query1.Type = DbQueryDelete;
|
||||
query1.Category = DbCatDowntime;
|
||||
query1.WhereCriteria = make_shared<Dictionary>();
|
||||
query1.WhereCriteria = new Dictionary();
|
||||
query1.WhereCriteria->Set("object_id", checkable);
|
||||
query1.WhereCriteria->Set("internal_downtime_id", downtime->GetLegacyId());
|
||||
DbObject::OnQuery(query1);
|
||||
|
@ -530,13 +530,13 @@ void DbEvents::RemoveDowntime(const Checkable::Ptr& checkable, const Downtime::P
|
|||
query3.Type = DbQueryUpdate;
|
||||
query3.Category = DbCatDowntime;
|
||||
|
||||
Dictionary::Ptr fields3 = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields3 = new Dictionary();
|
||||
fields3->Set("was_cancelled", downtime->GetWasCancelled() ? 1 : 0);
|
||||
fields3->Set("actual_end_time", DbValue::FromTimestamp(time_bag.first));
|
||||
fields3->Set("actual_end_time_usec", time_bag.second);
|
||||
query3.Fields = fields3;
|
||||
|
||||
query3.WhereCriteria = make_shared<Dictionary>();
|
||||
query3.WhereCriteria = new Dictionary();
|
||||
query3.WhereCriteria->Set("internal_downtime_id", downtime->GetLegacyId());
|
||||
query3.WhereCriteria->Set("entry_time", DbValue::FromTimestamp(downtime->GetEntryTime()));
|
||||
query3.WhereCriteria->Set("scheduled_start_time", DbValue::FromTimestamp(downtime->GetStartTime()));
|
||||
|
@ -565,7 +565,7 @@ void DbEvents::TriggerDowntime(const Checkable::Ptr& checkable, const Downtime::
|
|||
query1.Type = DbQueryUpdate;
|
||||
query1.Category = DbCatDowntime;
|
||||
|
||||
Dictionary::Ptr fields1 = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields1 = new Dictionary();
|
||||
fields1->Set("was_started", 1);
|
||||
fields1->Set("actual_start_time", DbValue::FromTimestamp(time_bag.first));
|
||||
fields1->Set("actual_start_time_usec", time_bag.second);
|
||||
|
@ -573,7 +573,7 @@ void DbEvents::TriggerDowntime(const Checkable::Ptr& checkable, const Downtime::
|
|||
fields1->Set("trigger_time", DbValue::FromTimestamp(downtime->GetTriggerTime()));
|
||||
fields1->Set("instance_id", 0); /* DbConnection class fills in real ID */
|
||||
|
||||
query1.WhereCriteria = make_shared<Dictionary>();
|
||||
query1.WhereCriteria = new Dictionary();
|
||||
query1.WhereCriteria->Set("object_id", checkable);
|
||||
query1.WhereCriteria->Set("internal_downtime_id", downtime->GetLegacyId());
|
||||
|
||||
|
@ -586,7 +586,7 @@ void DbEvents::TriggerDowntime(const Checkable::Ptr& checkable, const Downtime::
|
|||
query3.Type = DbQueryUpdate;
|
||||
query3.Category = DbCatDowntime;
|
||||
|
||||
Dictionary::Ptr fields3 = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields3 = new Dictionary();
|
||||
fields3->Set("was_started", 1);
|
||||
fields3->Set("is_in_effect", 1);
|
||||
fields3->Set("actual_start_time", DbValue::FromTimestamp(time_bag.first));
|
||||
|
@ -594,7 +594,7 @@ void DbEvents::TriggerDowntime(const Checkable::Ptr& checkable, const Downtime::
|
|||
fields3->Set("trigger_time", DbValue::FromTimestamp(downtime->GetTriggerTime()));
|
||||
query3.Fields = fields3;
|
||||
|
||||
query3.WhereCriteria = make_shared<Dictionary>();
|
||||
query3.WhereCriteria = new Dictionary();
|
||||
query3.WhereCriteria->Set("internal_downtime_id", downtime->GetLegacyId());
|
||||
query3.WhereCriteria->Set("entry_time", DbValue::FromTimestamp(downtime->GetEntryTime()));
|
||||
query3.WhereCriteria->Set("scheduled_start_time", DbValue::FromTimestamp(downtime->GetStartTime()));
|
||||
|
@ -616,12 +616,12 @@ void DbEvents::TriggerDowntime(const Checkable::Ptr& checkable, const Downtime::
|
|||
|
||||
query4.Type = DbQueryUpdate;
|
||||
|
||||
Dictionary::Ptr fields4 = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields4 = new Dictionary();
|
||||
fields4->Set("scheduled_downtime_depth", checkable->GetDowntimeDepth());
|
||||
|
||||
query4.Fields = fields4;
|
||||
|
||||
query4.WhereCriteria = make_shared<Dictionary>();
|
||||
query4.WhereCriteria = new Dictionary();
|
||||
if (service)
|
||||
query4.WhereCriteria->Set("service_object_id", service);
|
||||
else
|
||||
|
@ -653,7 +653,7 @@ void DbEvents::AddAcknowledgementHistory(const Checkable::Ptr& checkable, const
|
|||
Service::Ptr service;
|
||||
tie(host, service) = GetHostService(checkable);
|
||||
|
||||
Dictionary::Ptr fields1 = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields1 = new Dictionary();
|
||||
fields1->Set("entry_time", DbValue::FromTimestamp(time_bag.first));
|
||||
fields1->Set("entry_time_usec", time_bag.second);
|
||||
fields1->Set("acknowledgement_type", type);
|
||||
|
@ -706,12 +706,12 @@ void DbEvents::AddAcknowledgementInternal(const Checkable::Ptr& checkable, Ackno
|
|||
query1.Type = DbQueryUpdate;
|
||||
query1.Category = DbCatAcknowledgement;
|
||||
|
||||
Dictionary::Ptr fields1 = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields1 = new Dictionary();
|
||||
fields1->Set("acknowledgement_type", type);
|
||||
fields1->Set("problem_has_been_acknowledged", add ? 1 : 0);
|
||||
query1.Fields = fields1;
|
||||
|
||||
query1.WhereCriteria = make_shared<Dictionary>();
|
||||
query1.WhereCriteria = new Dictionary();
|
||||
if (service)
|
||||
query1.WhereCriteria->Set("service_object_id", service);
|
||||
else
|
||||
|
@ -744,7 +744,7 @@ void DbEvents::AddNotificationHistory(const Notification::Ptr& notification, con
|
|||
Service::Ptr service;
|
||||
tie(host, service) = GetHostService(checkable);
|
||||
|
||||
Dictionary::Ptr fields1 = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields1 = new Dictionary();
|
||||
fields1->Set("notification_type", 1); /* service */
|
||||
fields1->Set("notification_reason", CompatUtility::MapNotificationReasonType(type));
|
||||
fields1->Set("object_id", checkable);
|
||||
|
@ -782,7 +782,7 @@ void DbEvents::AddNotificationHistory(const Notification::Ptr& notification, con
|
|||
Log(LogDebug, "DbEvents")
|
||||
<< "add contact notification history for service '" << checkable->GetName() << "' and user '" << user->GetName() << "'.";
|
||||
|
||||
Dictionary::Ptr fields2 = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields2 = new Dictionary();
|
||||
fields2->Set("contact_object_id", user);
|
||||
fields2->Set("start_time", DbValue::FromTimestamp(time_bag.first));
|
||||
fields2->Set("start_time_usec", time_bag.second);
|
||||
|
@ -815,7 +815,7 @@ void DbEvents::AddStateChangeHistory(const Checkable::Ptr& checkable, const Chec
|
|||
Service::Ptr service;
|
||||
tie(host, service) = GetHostService(checkable);
|
||||
|
||||
Dictionary::Ptr fields1 = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields1 = new Dictionary();
|
||||
fields1->Set("state_time", DbValue::FromTimestamp(time_bag.first));
|
||||
fields1->Set("state_time_usec", time_bag.second);
|
||||
fields1->Set("object_id", checkable);
|
||||
|
@ -1133,7 +1133,7 @@ void DbEvents::AddLogHistory(const Checkable::Ptr& checkable, String buffer, Log
|
|||
query1.Type = DbQueryInsert;
|
||||
query1.Category = DbCatLog;
|
||||
|
||||
Dictionary::Ptr fields1 = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields1 = new Dictionary();
|
||||
fields1->Set("logentry_time", DbValue::FromTimestamp(time_bag.first));
|
||||
fields1->Set("entry_time", DbValue::FromTimestamp(time_bag.first));
|
||||
fields1->Set("entry_time_usec", time_bag.second);
|
||||
|
@ -1167,7 +1167,7 @@ void DbEvents::AddFlappingHistory(const Checkable::Ptr& checkable, FlappingState
|
|||
query1.Type = DbQueryInsert;
|
||||
query1.Category = DbCatFlapping;
|
||||
|
||||
Dictionary::Ptr fields1 = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields1 = new Dictionary();
|
||||
|
||||
fields1->Set("event_time", DbValue::FromTimestamp(time_bag.first));
|
||||
fields1->Set("event_time_usec", time_bag.second);
|
||||
|
@ -1232,7 +1232,7 @@ void DbEvents::AddServiceCheckHistory(const Checkable::Ptr& checkable, const Che
|
|||
query1.Type = DbQueryInsert;
|
||||
query1.Category = DbCatCheck;
|
||||
|
||||
Dictionary::Ptr fields1 = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields1 = new Dictionary();
|
||||
double execution_time = Service::CalculateExecutionTime(cr);
|
||||
|
||||
fields1->Set("check_type", CompatUtility::GetCheckableCheckType(checkable));
|
||||
|
@ -1294,7 +1294,7 @@ void DbEvents::AddEventHandlerHistory(const Checkable::Ptr& checkable)
|
|||
query1.Type = DbQueryInsert;
|
||||
query1.Category = DbCatEventHandler;
|
||||
|
||||
Dictionary::Ptr fields1 = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields1 = new Dictionary();
|
||||
|
||||
Host::Ptr host;
|
||||
Service::Ptr service;
|
||||
|
@ -1333,7 +1333,7 @@ void DbEvents::AddExternalCommandHistory(double time, const String& command, con
|
|||
query1.Type = DbQueryInsert;
|
||||
query1.Category = DbCatExternalCommand;
|
||||
|
||||
Dictionary::Ptr fields1 = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields1 = new Dictionary();
|
||||
|
||||
fields1->Set("entry_time", DbValue::FromTimestamp(static_cast<long>(time)));
|
||||
fields1->Set("command_type", CompatUtility::MapExternalCommandType(command));
|
||||
|
|
|
@ -40,7 +40,7 @@ boost::signals2::signal<void (const DbQuery&)> DbObject::OnQuery;
|
|||
|
||||
INITIALIZE_ONCE(&DbObject::StaticInitialize);
|
||||
|
||||
DbObject::DbObject(const shared_ptr<DbType>& type, const String& name1, const String& name2)
|
||||
DbObject::DbObject(const intrusive_ptr<DbType>& type, const String& name1, const String& name2)
|
||||
: m_Name1(name1), m_Name2(name2), m_Type(type), m_LastConfigUpdate(0), m_LastStatusUpdate(0)
|
||||
{ }
|
||||
|
||||
|
@ -95,9 +95,9 @@ void DbObject::SendConfigUpdate(void)
|
|||
query.Fields->Set(GetType()->GetIDColumn(), GetObject());
|
||||
query.Fields->Set("instance_id", 0); /* DbConnection class fills in real ID */
|
||||
query.Fields->Set("config_type", 1);
|
||||
query.WhereCriteria = make_shared<Dictionary>();
|
||||
query.WhereCriteria = new Dictionary();
|
||||
query.WhereCriteria->Set(GetType()->GetIDColumn(), GetObject());
|
||||
query.Object = GetSelf();
|
||||
query.Object = this;
|
||||
query.ConfigUpdate = true;
|
||||
OnQuery(query);
|
||||
|
||||
|
@ -139,9 +139,9 @@ void DbObject::SendStatusUpdate(void)
|
|||
query.Fields->Set("instance_id", 0); /* DbConnection class fills in real ID */
|
||||
|
||||
query.Fields->Set("status_update_time", DbValue::FromTimestamp(Utility::GetTime()));
|
||||
query.WhereCriteria = make_shared<Dictionary>();
|
||||
query.WhereCriteria = new Dictionary();
|
||||
query.WhereCriteria->Set(GetType()->GetIDColumn(), GetObject());
|
||||
query.Object = GetSelf();
|
||||
query.Object = this;
|
||||
query.StatusUpdate = true;
|
||||
OnQuery(query);
|
||||
|
||||
|
@ -186,7 +186,7 @@ void DbObject::SendVarsConfigUpdate(void)
|
|||
<< "object customvar key: '" << kv.first << "' value: '" << kv.second
|
||||
<< "' overridden: " << overridden;
|
||||
|
||||
Dictionary::Ptr fields = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields = new Dictionary();
|
||||
fields->Set("varname", kv.first);
|
||||
fields->Set("varvalue", value);
|
||||
fields->Set("is_json", is_json);
|
||||
|
@ -241,7 +241,7 @@ void DbObject::SendVarsStatusUpdate(void)
|
|||
<< "object customvar key: '" << kv.first << "' value: '" << kv.second
|
||||
<< "' overridden: " << overridden;
|
||||
|
||||
Dictionary::Ptr fields = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields = new Dictionary();
|
||||
fields->Set("varname", kv.first);
|
||||
fields->Set("varvalue", value);
|
||||
fields->Set("is_json", is_json);
|
||||
|
@ -256,10 +256,10 @@ void DbObject::SendVarsStatusUpdate(void)
|
|||
query.Category = DbCatState;
|
||||
query.Fields = fields;
|
||||
|
||||
query.WhereCriteria = make_shared<Dictionary>();
|
||||
query.WhereCriteria = new Dictionary();
|
||||
query.WhereCriteria->Set("object_id", obj);
|
||||
query.WhereCriteria->Set("varname", Convert::ToString(kv.first));
|
||||
query.Object = GetSelf();
|
||||
query.Object = this;
|
||||
|
||||
OnQuery(query);
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ public:
|
|||
|
||||
String GetName1(void) const;
|
||||
String GetName2(void) const;
|
||||
shared_ptr<DbType> GetType(void) const;
|
||||
intrusive_ptr<DbType> GetType(void) const;
|
||||
|
||||
virtual Dictionary::Ptr GetConfigFields(void) const = 0;
|
||||
virtual Dictionary::Ptr GetStatusFields(void) const = 0;
|
||||
|
@ -88,7 +88,7 @@ public:
|
|||
double GetLastStatusUpdate(void) const;
|
||||
|
||||
protected:
|
||||
DbObject(const shared_ptr<DbType>& type, const String& name1, const String& name2);
|
||||
DbObject(const intrusive_ptr<DbType>& type, const String& name1, const String& name2);
|
||||
|
||||
virtual bool IsStatusAttribute(const String& attribute) const;
|
||||
|
||||
|
@ -98,7 +98,7 @@ protected:
|
|||
private:
|
||||
String m_Name1;
|
||||
String m_Name2;
|
||||
shared_ptr<DbType> m_Type;
|
||||
intrusive_ptr<DbType> m_Type;
|
||||
DynamicObject::Ptr m_Object;
|
||||
double m_LastConfigUpdate;
|
||||
double m_LastStatusUpdate;
|
||||
|
|
|
@ -66,8 +66,8 @@ struct I2_DB_IDO_API DbQuery
|
|||
String IdColumn;
|
||||
Dictionary::Ptr Fields;
|
||||
Dictionary::Ptr WhereCriteria;
|
||||
shared_ptr<DbObject> Object;
|
||||
shared_ptr<CustomVarObject> NotificationObject;
|
||||
intrusive_ptr<DbObject> Object;
|
||||
intrusive_ptr<CustomVarObject> NotificationObject;
|
||||
bool ConfigUpdate;
|
||||
bool StatusUpdate;
|
||||
|
||||
|
@ -81,3 +81,5 @@ struct I2_DB_IDO_API DbQuery
|
|||
}
|
||||
|
||||
#endif /* DBQUERY_H */
|
||||
|
||||
#include "db_ido/dbobject.hpp"
|
||||
|
|
|
@ -92,7 +92,7 @@ DbObject::Ptr DbType::GetOrCreateObjectByName(const String& name1, const String&
|
|||
if (it != m_Objects.end())
|
||||
return it->second;
|
||||
|
||||
DbObject::Ptr dbobj = m_ObjectFactory(GetSelf(), name1, name2);
|
||||
DbObject::Ptr dbobj = m_ObjectFactory(this, name1, name2);
|
||||
m_Objects[std::make_pair(name1, name2)] = dbobj;
|
||||
|
||||
return dbobj;
|
||||
|
|
|
@ -41,9 +41,9 @@ class I2_DB_IDO_API DbType : public Object
|
|||
public:
|
||||
DECLARE_PTR_TYPEDEFS(DbType);
|
||||
|
||||
typedef boost::function<shared_ptr<DbObject> (const shared_ptr<DbType>&, const String&, const String&)> ObjectFactory;
|
||||
typedef boost::function<intrusive_ptr<DbObject> (const intrusive_ptr<DbType>&, const String&, const String&)> ObjectFactory;
|
||||
typedef std::map<String, DbType::Ptr> TypeMap;
|
||||
typedef std::map<std::pair<String, String>, shared_ptr<DbObject> > ObjectMap;
|
||||
typedef std::map<std::pair<String, String>, intrusive_ptr<DbObject> > ObjectMap;
|
||||
|
||||
DbType(const String& table, long tid, const String& idcolumn, const ObjectFactory& factory);
|
||||
|
||||
|
@ -57,7 +57,7 @@ public:
|
|||
static DbType::Ptr GetByName(const String& name);
|
||||
static DbType::Ptr GetByID(long tid);
|
||||
|
||||
shared_ptr<DbObject> GetOrCreateObjectByName(const String& name1, const String& name2);
|
||||
intrusive_ptr<DbObject> GetOrCreateObjectByName(const String& name1, const String& name2);
|
||||
|
||||
static std::set<DbType::Ptr> GetAllTypes(void);
|
||||
|
||||
|
@ -100,7 +100,7 @@ public:
|
|||
dbtype = DbType::GetByID(tid);
|
||||
|
||||
if (!dbtype)
|
||||
dbtype = make_shared<DbType>(table, tid, idcolumn, factory);
|
||||
dbtype = new DbType(table, tid, idcolumn, factory);
|
||||
|
||||
DbType::RegisterType(name, dbtype);
|
||||
}
|
||||
|
@ -112,9 +112,9 @@ public:
|
|||
* @ingroup ido
|
||||
*/
|
||||
template<typename T>
|
||||
shared_ptr<T> DbObjectFactory(const DbType::Ptr& type, const String& name1, const String& name2)
|
||||
intrusive_ptr<T> DbObjectFactory(const DbType::Ptr& type, const String& name1, const String& name2)
|
||||
{
|
||||
return make_shared<T>(type, name1, name2);
|
||||
return new T(type, name1, name2);
|
||||
}
|
||||
|
||||
#define REGISTER_DBTYPE(name, table, tid, idcolumn, type) \
|
||||
|
|
|
@ -30,12 +30,12 @@ Value DbValue::FromTimestamp(const Value& ts)
|
|||
if (ts.IsEmpty() || ts == 0)
|
||||
return Empty;
|
||||
|
||||
return make_shared<DbValue>(DbValueTimestamp, ts);
|
||||
return new DbValue(DbValueTimestamp, ts);
|
||||
}
|
||||
|
||||
Value DbValue::FromTimestampNow(void)
|
||||
{
|
||||
return make_shared<DbValue>(DbValueTimestampNow, Empty);
|
||||
return new DbValue(DbValueTimestampNow, Empty);
|
||||
}
|
||||
|
||||
Value DbValue::FromValue(const Value& value)
|
||||
|
@ -45,7 +45,7 @@ Value DbValue::FromValue(const Value& value)
|
|||
|
||||
Value DbValue::FromObjectInsertID(const Value& value)
|
||||
{
|
||||
return make_shared<DbValue>(DbValueObjectInsertID, value);
|
||||
return new DbValue(DbValueObjectInsertID, value);
|
||||
}
|
||||
|
||||
bool DbValue::IsTimestamp(const Value& value)
|
||||
|
|
|
@ -48,7 +48,7 @@ EndpointDbObject::EndpointDbObject(const DbType::Ptr& type, const String& name1,
|
|||
|
||||
Dictionary::Ptr EndpointDbObject::GetConfigFields(void) const
|
||||
{
|
||||
Dictionary::Ptr fields = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields = new Dictionary();
|
||||
Endpoint::Ptr endpoint = static_pointer_cast<Endpoint>(GetObject());
|
||||
|
||||
fields->Set("identity", endpoint->GetName());
|
||||
|
@ -59,7 +59,7 @@ Dictionary::Ptr EndpointDbObject::GetConfigFields(void) const
|
|||
|
||||
Dictionary::Ptr EndpointDbObject::GetStatusFields(void) const
|
||||
{
|
||||
Dictionary::Ptr fields = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields = new Dictionary();
|
||||
Endpoint::Ptr endpoint = static_pointer_cast<Endpoint>(GetObject());
|
||||
|
||||
Log(LogDebug, "EndpointDbObject")
|
||||
|
@ -83,12 +83,12 @@ void EndpointDbObject::UpdateConnectedStatus(const Endpoint::Ptr& endpoint)
|
|||
query1.Table = "endpointstatus";
|
||||
query1.Type = DbQueryUpdate;
|
||||
|
||||
Dictionary::Ptr fields1 = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields1 = new Dictionary();
|
||||
fields1->Set("is_connected", (connected ? 1 : 0));
|
||||
fields1->Set("status_update_time", DbValue::FromTimestamp(Utility::GetTime()));
|
||||
query1.Fields = fields1;
|
||||
|
||||
query1.WhereCriteria = make_shared<Dictionary>();
|
||||
query1.WhereCriteria = new Dictionary();
|
||||
query1.WhereCriteria->Set("endpoint_object_id", endpoint);
|
||||
query1.WhereCriteria->Set("instance_id", 0); /* DbConnection class fills in real ID */
|
||||
|
||||
|
@ -115,7 +115,7 @@ void EndpointDbObject::OnConfigUpdate(void)
|
|||
query1.Table = "endpointstatus";
|
||||
query1.Type = DbQueryInsert;
|
||||
|
||||
Dictionary::Ptr fields1 = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields1 = new Dictionary();
|
||||
fields1->Set("identity", endpoint->GetName());
|
||||
fields1->Set("node", IcingaApplication::GetInstance()->GetNodeName());
|
||||
fields1->Set("is_connected", EndpointIsConnected(endpoint));
|
||||
|
|
|
@ -37,7 +37,7 @@ class EndpointDbObject : public DbObject
|
|||
public:
|
||||
DECLARE_PTR_TYPEDEFS(EndpointDbObject);
|
||||
|
||||
EndpointDbObject(const shared_ptr<DbType>& type, const String& name1, const String& name2);
|
||||
EndpointDbObject(const intrusive_ptr<DbType>& type, const String& name1, const String& name2);
|
||||
|
||||
static void StaticInitialize(void);
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ HostDbObject::HostDbObject(const DbType::Ptr& type, const String& name1, const S
|
|||
|
||||
Dictionary::Ptr HostDbObject::GetConfigFields(void) const
|
||||
{
|
||||
Dictionary::Ptr fields = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields = new Dictionary();
|
||||
Host::Ptr host = static_pointer_cast<Host>(GetObject());
|
||||
|
||||
fields->Set("alias", CompatUtility::GetHostAlias(host));
|
||||
|
@ -110,7 +110,7 @@ Dictionary::Ptr HostDbObject::GetConfigFields(void) const
|
|||
|
||||
Dictionary::Ptr HostDbObject::GetStatusFields(void) const
|
||||
{
|
||||
Dictionary::Ptr fields = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields = new Dictionary();
|
||||
Host::Ptr host = static_pointer_cast<Host>(GetObject());
|
||||
|
||||
CheckResult::Ptr cr = host->GetLastCheckResult();
|
||||
|
@ -188,7 +188,7 @@ void HostDbObject::OnConfigUpdate(void)
|
|||
<< "host parents: " << parent->GetName();
|
||||
|
||||
/* parents: host_id, parent_host_object_id */
|
||||
Dictionary::Ptr fields1 = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields1 = new Dictionary();
|
||||
fields1->Set(GetType()->GetTable() + "_id", DbValue::FromObjectInsertID(GetObject()));
|
||||
fields1->Set("parent_host_object_id", parent);
|
||||
fields1->Set("instance_id", 0); /* DbConnection class fills in real ID */
|
||||
|
@ -219,7 +219,7 @@ void HostDbObject::OnConfigUpdate(void)
|
|||
Log(LogDebug, "HostDbObject")
|
||||
<< "parent host: " << parent->GetName();
|
||||
|
||||
Dictionary::Ptr fields2 = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields2 = new Dictionary();
|
||||
fields2->Set("host_object_id", parent);
|
||||
fields2->Set("dependent_host_object_id", host);
|
||||
fields2->Set("inherits_parent", 1);
|
||||
|
@ -243,7 +243,7 @@ void HostDbObject::OnConfigUpdate(void)
|
|||
Log(LogDebug, "HostDbObject")
|
||||
<< "host contacts: " << user->GetName();
|
||||
|
||||
Dictionary::Ptr fields_contact = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields_contact = new Dictionary();
|
||||
fields_contact->Set("host_id", DbValue::FromObjectInsertID(host));
|
||||
fields_contact->Set("contact_object_id", user);
|
||||
fields_contact->Set("instance_id", 0); /* DbConnection class fills in real ID */
|
||||
|
@ -263,7 +263,7 @@ void HostDbObject::OnConfigUpdate(void)
|
|||
Log(LogDebug, "HostDbObject")
|
||||
<< "host contactgroups: " << usergroup->GetName();
|
||||
|
||||
Dictionary::Ptr fields_contact = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields_contact = new Dictionary();
|
||||
fields_contact->Set("host_id", DbValue::FromObjectInsertID(host));
|
||||
fields_contact->Set("contactgroup_object_id", usergroup);
|
||||
fields_contact->Set("instance_id", 0); /* DbConnection class fills in real ID */
|
||||
|
|
|
@ -35,7 +35,7 @@ HostGroupDbObject::HostGroupDbObject(const DbType::Ptr& type, const String& name
|
|||
|
||||
Dictionary::Ptr HostGroupDbObject::GetConfigFields(void) const
|
||||
{
|
||||
Dictionary::Ptr fields = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields = new Dictionary();
|
||||
HostGroup::Ptr group = static_pointer_cast<HostGroup>(GetObject());
|
||||
|
||||
fields->Set("alias", group->GetDisplayName());
|
||||
|
@ -60,7 +60,7 @@ void HostGroupDbObject::OnConfigUpdate(void)
|
|||
query1.Table = DbType::GetByName("HostGroup")->GetTable() + "_members";
|
||||
query1.Type = DbQueryInsert;
|
||||
query1.Category = DbCatConfig;
|
||||
query1.Fields = make_shared<Dictionary>();
|
||||
query1.Fields = new Dictionary();
|
||||
query1.Fields->Set("instance_id", 0); /* DbConnection class fills in real ID */
|
||||
query1.Fields->Set("hostgroup_id", DbValue::FromObjectInsertID(group));
|
||||
query1.Fields->Set("host_object_id", host);
|
||||
|
|
|
@ -48,7 +48,7 @@ ServiceDbObject::ServiceDbObject(const DbType::Ptr& type, const String& name1, c
|
|||
|
||||
Dictionary::Ptr ServiceDbObject::GetConfigFields(void) const
|
||||
{
|
||||
Dictionary::Ptr fields = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields = new Dictionary();
|
||||
Service::Ptr service = static_pointer_cast<Service>(GetObject());
|
||||
Host::Ptr host = service->GetHost();
|
||||
|
||||
|
@ -106,7 +106,7 @@ Dictionary::Ptr ServiceDbObject::GetConfigFields(void) const
|
|||
|
||||
Dictionary::Ptr ServiceDbObject::GetStatusFields(void) const
|
||||
{
|
||||
Dictionary::Ptr fields = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields = new Dictionary();
|
||||
Service::Ptr service = static_pointer_cast<Service>(GetObject());
|
||||
CheckResult::Ptr cr = service->GetLastCheckResult();
|
||||
|
||||
|
@ -195,7 +195,7 @@ void ServiceDbObject::OnConfigUpdate(void)
|
|||
int state_filter = dep->GetStateFilter();
|
||||
|
||||
/* service dependencies */
|
||||
Dictionary::Ptr fields1 = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields1 = new Dictionary();
|
||||
fields1->Set("service_object_id", parent);
|
||||
fields1->Set("dependent_service_object_id", service);
|
||||
fields1->Set("inherits_parent", 1);
|
||||
|
@ -222,7 +222,7 @@ void ServiceDbObject::OnConfigUpdate(void)
|
|||
Log(LogDebug, "ServiceDbObject")
|
||||
<< "service contacts: " << user->GetName();
|
||||
|
||||
Dictionary::Ptr fields_contact = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields_contact = new Dictionary();
|
||||
fields_contact->Set("service_id", DbValue::FromObjectInsertID(service));
|
||||
fields_contact->Set("contact_object_id", user);
|
||||
fields_contact->Set("instance_id", 0); /* DbConnection class fills in real ID */
|
||||
|
@ -242,7 +242,7 @@ void ServiceDbObject::OnConfigUpdate(void)
|
|||
Log(LogDebug, "ServiceDbObject")
|
||||
<< "service contactgroups: " << usergroup->GetName();
|
||||
|
||||
Dictionary::Ptr fields_contact = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields_contact = new Dictionary();
|
||||
fields_contact->Set("service_id", DbValue::FromObjectInsertID(service));
|
||||
fields_contact->Set("contactgroup_object_id", usergroup);
|
||||
fields_contact->Set("instance_id", 0); /* DbConnection class fills in real ID */
|
||||
|
|
|
@ -34,7 +34,7 @@ ServiceGroupDbObject::ServiceGroupDbObject(const DbType::Ptr& type, const String
|
|||
|
||||
Dictionary::Ptr ServiceGroupDbObject::GetConfigFields(void) const
|
||||
{
|
||||
Dictionary::Ptr fields = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields = new Dictionary();
|
||||
ServiceGroup::Ptr group = static_pointer_cast<ServiceGroup>(GetObject());
|
||||
|
||||
fields->Set("alias", group->GetDisplayName());
|
||||
|
@ -59,7 +59,7 @@ void ServiceGroupDbObject::OnConfigUpdate(void)
|
|||
query1.Table = DbType::GetByName("ServiceGroup")->GetTable() + "_members";
|
||||
query1.Type = DbQueryInsert;
|
||||
query1.Category = DbCatConfig;
|
||||
query1.Fields = make_shared<Dictionary>();
|
||||
query1.Fields = new Dictionary();
|
||||
query1.Fields->Set("instance_id", 0); /* DbConnection class fills in real ID */
|
||||
query1.Fields->Set("servicegroup_id", DbValue::FromObjectInsertID(group));
|
||||
query1.Fields->Set("service_object_id", service);
|
||||
|
|
|
@ -37,7 +37,7 @@ TimePeriodDbObject::TimePeriodDbObject(const DbType::Ptr& type, const String& na
|
|||
|
||||
Dictionary::Ptr TimePeriodDbObject::GetConfigFields(void) const
|
||||
{
|
||||
Dictionary::Ptr fields = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields = new Dictionary();
|
||||
TimePeriod::Ptr tp = static_pointer_cast<TimePeriod>(GetObject());
|
||||
|
||||
fields->Set("alias", tp->GetDisplayName());
|
||||
|
@ -58,7 +58,7 @@ void TimePeriodDbObject::OnConfigUpdate(void)
|
|||
query_del1.Table = GetType()->GetTable() + "_timeranges";
|
||||
query_del1.Type = DbQueryDelete;
|
||||
query_del1.Category = DbCatConfig;
|
||||
query_del1.WhereCriteria = make_shared<Dictionary>();
|
||||
query_del1.WhereCriteria = new Dictionary();
|
||||
query_del1.WhereCriteria->Set("timeperiod_id", DbValue::FromObjectInsertID(tp));
|
||||
OnQuery(query_del1);
|
||||
|
||||
|
@ -77,7 +77,7 @@ void TimePeriodDbObject::OnConfigUpdate(void)
|
|||
|
||||
tm reference = Utility::LocalTime(refts);
|
||||
|
||||
Array::Ptr segments = make_shared<Array>();
|
||||
Array::Ptr segments = new Array();
|
||||
LegacyTimePeriod::ProcessTimeRanges(kv.second, &reference, segments);
|
||||
|
||||
ObjectLock olock(segments);
|
||||
|
@ -90,7 +90,7 @@ void TimePeriodDbObject::OnConfigUpdate(void)
|
|||
query.Table = GetType()->GetTable() + "_timeranges";
|
||||
query.Type = DbQueryInsert;
|
||||
query.Category = DbCatConfig;
|
||||
query.Fields = make_shared<Dictionary>();
|
||||
query.Fields = new Dictionary();
|
||||
query.Fields->Set("instance_id", 0); /* DbConnection class fills in real ID */
|
||||
query.Fields->Set("timeperiod_id", DbValue::FromObjectInsertID(tp));
|
||||
query.Fields->Set("day", wday);
|
||||
|
|
|
@ -37,7 +37,7 @@ UserDbObject::UserDbObject(const DbType::Ptr& type, const String& name1, const S
|
|||
|
||||
Dictionary::Ptr UserDbObject::GetConfigFields(void) const
|
||||
{
|
||||
Dictionary::Ptr fields = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields = new Dictionary();
|
||||
User::Ptr user = static_pointer_cast<User>(GetObject());
|
||||
|
||||
fields->Set("alias", user->GetDisplayName());
|
||||
|
@ -65,7 +65,7 @@ Dictionary::Ptr UserDbObject::GetConfigFields(void) const
|
|||
|
||||
Dictionary::Ptr UserDbObject::GetStatusFields(void) const
|
||||
{
|
||||
Dictionary::Ptr fields = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields = new Dictionary();
|
||||
User::Ptr user = static_pointer_cast<User>(GetObject());
|
||||
|
||||
fields->Set("host_notifications_enabled", user->GetEnableNotifications());
|
||||
|
@ -81,7 +81,7 @@ Dictionary::Ptr UserDbObject::GetStatusFields(void) const
|
|||
|
||||
void UserDbObject::OnConfigUpdate(void)
|
||||
{
|
||||
Dictionary::Ptr fields = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields = new Dictionary();
|
||||
User::Ptr user = static_pointer_cast<User>(GetObject());
|
||||
|
||||
/* contact addresses */
|
||||
|
|
|
@ -35,7 +35,7 @@ UserGroupDbObject::UserGroupDbObject(const DbType::Ptr& type, const String& name
|
|||
|
||||
Dictionary::Ptr UserGroupDbObject::GetConfigFields(void) const
|
||||
{
|
||||
Dictionary::Ptr fields = make_shared<Dictionary>();
|
||||
Dictionary::Ptr fields = new Dictionary();
|
||||
UserGroup::Ptr group = static_pointer_cast<UserGroup>(GetObject());
|
||||
|
||||
fields->Set("alias", group->GetDisplayName());
|
||||
|
@ -56,7 +56,7 @@ void UserGroupDbObject::OnConfigUpdate(void)
|
|||
query1.Table = DbType::GetByName("UserGroup")->GetTable() + "_members";
|
||||
query1.Type = DbQueryDelete;
|
||||
query1.Category = DbCatConfig;
|
||||
query1.WhereCriteria = make_shared<Dictionary>();
|
||||
query1.WhereCriteria = new Dictionary();
|
||||
query1.WhereCriteria->Set("instance_id", 0);
|
||||
query1.WhereCriteria->Set("contactgroup_id", DbValue::FromObjectInsertID(group));
|
||||
OnQuery(query1);
|
||||
|
@ -66,7 +66,7 @@ void UserGroupDbObject::OnConfigUpdate(void)
|
|||
query2.Table = DbType::GetByName("UserGroup")->GetTable() + "_members";
|
||||
query2.Type = DbQueryInsert;
|
||||
query2.Category = DbCatConfig;
|
||||
query2.Fields = make_shared<Dictionary>();
|
||||
query2.Fields = new Dictionary();
|
||||
query2.Fields->Set("instance_id", 0); /* DbConnection class fills in real ID */
|
||||
query2.Fields->Set("contactgroup_id", DbValue::FromObjectInsertID(group));
|
||||
query2.Fields->Set("contact_object_id", user);
|
||||
|
|
|
@ -41,19 +41,19 @@ REGISTER_STATSFUNCTION(IdoMysqlConnectionStats, &IdoMysqlConnection::StatsFunc);
|
|||
|
||||
Value IdoMysqlConnection::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata)
|
||||
{
|
||||
Dictionary::Ptr nodes = make_shared<Dictionary>();
|
||||
Dictionary::Ptr nodes = new Dictionary();
|
||||
|
||||
BOOST_FOREACH(const IdoMysqlConnection::Ptr& idomysqlconnection, DynamicType::GetObjectsByType<IdoMysqlConnection>()) {
|
||||
size_t items = idomysqlconnection->m_QueryQueue.GetLength();
|
||||
|
||||
Dictionary::Ptr stats = make_shared<Dictionary>();
|
||||
Dictionary::Ptr stats = new Dictionary();
|
||||
stats->Set("version", SCHEMA_VERSION);
|
||||
stats->Set("instance_name", idomysqlconnection->GetInstanceName());
|
||||
stats->Set("query_queue_items", items);
|
||||
|
||||
nodes->Set(idomysqlconnection->GetName(), stats);
|
||||
|
||||
perfdata->Add(make_shared<PerfdataValue>("idomysqlconnection_" + idomysqlconnection->GetName() + "_query_queue_items", items));
|
||||
perfdata->Add(new PerfdataValue("idomysqlconnection_" + idomysqlconnection->GetName() + "_query_queue_items", items));
|
||||
}
|
||||
|
||||
status->Set("idomysqlconnection", nodes);
|
||||
|
@ -69,12 +69,12 @@ void IdoMysqlConnection::Resume(void)
|
|||
|
||||
m_QueryQueue.SetExceptionCallback(boost::bind(&IdoMysqlConnection::ExceptionHandler, this, _1));
|
||||
|
||||
m_TxTimer = make_shared<Timer>();
|
||||
m_TxTimer = new Timer();
|
||||
m_TxTimer->SetInterval(1);
|
||||
m_TxTimer->OnTimerExpired.connect(boost::bind(&IdoMysqlConnection::TxTimerHandler, this));
|
||||
m_TxTimer->Start();
|
||||
|
||||
m_ReconnectTimer = make_shared<Timer>();
|
||||
m_ReconnectTimer = new Timer();
|
||||
m_ReconnectTimer->SetInterval(10);
|
||||
m_ReconnectTimer->OnTimerExpired.connect(boost::bind(&IdoMysqlConnection::ReconnectTimerHandler, this));
|
||||
m_ReconnectTimer->Start();
|
||||
|
@ -444,7 +444,7 @@ Dictionary::Ptr IdoMysqlConnection::FetchRow(const IdoMysqlResult& result)
|
|||
if (!lengths)
|
||||
return Dictionary::Ptr();
|
||||
|
||||
Dictionary::Ptr dict = make_shared<Dictionary>();
|
||||
Dictionary::Ptr dict = new Dictionary();
|
||||
|
||||
mysql_field_seek(result.get(), 0);
|
||||
for (field = mysql_fetch_field(result.get()), i = 0; field; field = mysql_fetch_field(result.get()), i++)
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
namespace icinga
|
||||
{
|
||||
|
||||
typedef shared_ptr<MYSQL_RES> IdoMysqlResult;
|
||||
typedef boost::shared_ptr<MYSQL_RES> IdoMysqlResult;
|
||||
|
||||
/**
|
||||
* An IDO MySQL database connection.
|
||||
|
|
|
@ -43,19 +43,19 @@ REGISTER_STATSFUNCTION(IdoPgsqlConnectionStats, &IdoPgsqlConnection::StatsFunc);
|
|||
|
||||
Value IdoPgsqlConnection::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata)
|
||||
{
|
||||
Dictionary::Ptr nodes = make_shared<Dictionary>();
|
||||
Dictionary::Ptr nodes = new Dictionary();
|
||||
|
||||
BOOST_FOREACH(const IdoPgsqlConnection::Ptr& idopgsqlconnection, DynamicType::GetObjectsByType<IdoPgsqlConnection>()) {
|
||||
size_t items = idopgsqlconnection->m_QueryQueue.GetLength();
|
||||
|
||||
Dictionary::Ptr stats = make_shared<Dictionary>();
|
||||
Dictionary::Ptr stats = new Dictionary();
|
||||
stats->Set("version", SCHEMA_VERSION);
|
||||
stats->Set("instance_name", idopgsqlconnection->GetInstanceName());
|
||||
stats->Set("query_queue_items", items);
|
||||
|
||||
nodes->Set(idopgsqlconnection->GetName(), stats);
|
||||
|
||||
perfdata->Add(make_shared<PerfdataValue>("idopgsqlconnection_" + idopgsqlconnection->GetName() + "_query_queue_items", items));
|
||||
perfdata->Add(new PerfdataValue("idopgsqlconnection_" + idopgsqlconnection->GetName() + "_query_queue_items", items));
|
||||
}
|
||||
|
||||
status->Set("idopgsqlconnection", nodes);
|
||||
|
@ -71,12 +71,12 @@ void IdoPgsqlConnection::Resume(void)
|
|||
|
||||
m_QueryQueue.SetExceptionCallback(boost::bind(&IdoPgsqlConnection::ExceptionHandler, this, _1));
|
||||
|
||||
m_TxTimer = make_shared<Timer>();
|
||||
m_TxTimer = new Timer();
|
||||
m_TxTimer->SetInterval(1);
|
||||
m_TxTimer->OnTimerExpired.connect(boost::bind(&IdoPgsqlConnection::TxTimerHandler, this));
|
||||
m_TxTimer->Start();
|
||||
|
||||
m_ReconnectTimer = make_shared<Timer>();
|
||||
m_ReconnectTimer = new Timer();
|
||||
m_ReconnectTimer->SetInterval(10);
|
||||
m_ReconnectTimer->OnTimerExpired.connect(boost::bind(&IdoPgsqlConnection::ReconnectTimerHandler, this));
|
||||
m_ReconnectTimer->Start();
|
||||
|
@ -443,7 +443,7 @@ Dictionary::Ptr IdoPgsqlConnection::FetchRow(const IdoPgsqlResult& result, int r
|
|||
|
||||
int columns = PQnfields(result.get());
|
||||
|
||||
Dictionary::Ptr dict = make_shared<Dictionary>();
|
||||
Dictionary::Ptr dict = new Dictionary();
|
||||
|
||||
for (int column = 0; column < columns; column++) {
|
||||
Value value;
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
namespace icinga
|
||||
{
|
||||
|
||||
typedef shared_ptr<PGresult> IdoPgsqlResult;
|
||||
typedef boost::shared_ptr<PGresult> IdoPgsqlResult;
|
||||
|
||||
/**
|
||||
* An IDO pgSQL database connection.
|
||||
|
|
|
@ -36,7 +36,7 @@ void Demo::Start(void)
|
|||
{
|
||||
DynamicObject::Start();
|
||||
|
||||
m_DemoTimer = make_shared<Timer>();
|
||||
m_DemoTimer = new Timer();
|
||||
m_DemoTimer->SetInterval(5);
|
||||
m_DemoTimer->OnTimerExpired.connect(boost::bind(&Demo::DemoTimerHandler, this));
|
||||
m_DemoTimer->Start();
|
||||
|
@ -47,7 +47,7 @@ void Demo::Start(void)
|
|||
*/
|
||||
void Demo::DemoTimerHandler(void)
|
||||
{
|
||||
Dictionary::Ptr message = make_shared<Dictionary>();
|
||||
Dictionary::Ptr message = new Dictionary();
|
||||
message->Set("method", "demo::HelloWorld");
|
||||
|
||||
ApiListener::Ptr listener = ApiListener::GetInstance();
|
||||
|
|
|
@ -93,7 +93,7 @@ void ApiEvents::StaticInitialize(void)
|
|||
Checkable::OnAcknowledgementSet.connect(&ApiEvents::AcknowledgementSetHandler);
|
||||
Checkable::OnAcknowledgementCleared.connect(&ApiEvents::AcknowledgementClearedHandler);
|
||||
|
||||
l_RepositoryTimer = make_shared<Timer>();
|
||||
l_RepositoryTimer = new Timer();
|
||||
l_RepositoryTimer->SetInterval(30);
|
||||
l_RepositoryTimer->OnTimerExpired.connect(boost::bind(&ApiEvents::RepositoryTimerHandler));
|
||||
l_RepositoryTimer->Start();
|
||||
|
@ -107,7 +107,7 @@ void ApiEvents::CheckResultHandler(const Checkable::Ptr& checkable, const CheckR
|
|||
if (!listener)
|
||||
return;
|
||||
|
||||
Dictionary::Ptr message = make_shared<Dictionary>();
|
||||
Dictionary::Ptr message = new Dictionary();
|
||||
message->Set("jsonrpc", "2.0");
|
||||
message->Set("method", "event::CheckResult");
|
||||
|
||||
|
@ -115,7 +115,7 @@ void ApiEvents::CheckResultHandler(const Checkable::Ptr& checkable, const CheckR
|
|||
Service::Ptr service;
|
||||
tie(host, service) = GetHostService(checkable);
|
||||
|
||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||
Dictionary::Ptr params = new Dictionary();
|
||||
params->Set("host", host->GetName());
|
||||
if (service)
|
||||
params->Set("service", service->GetShortName());
|
||||
|
@ -134,7 +134,7 @@ Value ApiEvents::CheckResultAPIHandler(const MessageOrigin& origin, const Dictio
|
|||
if (!params)
|
||||
return Empty;
|
||||
|
||||
CheckResult::Ptr cr = make_shared<CheckResult>();
|
||||
CheckResult::Ptr cr = new CheckResult();
|
||||
|
||||
Dictionary::Ptr vcr = params->Get("cr");
|
||||
Array::Ptr vperf = vcr->Get("performance_data");
|
||||
|
@ -142,7 +142,7 @@ Value ApiEvents::CheckResultAPIHandler(const MessageOrigin& origin, const Dictio
|
|||
|
||||
Deserialize(cr, params->Get("cr"), true);
|
||||
|
||||
Array::Ptr rperf = make_shared<Array>();
|
||||
Array::Ptr rperf = new Array();
|
||||
|
||||
if (vperf) {
|
||||
ObjectLock olock(vperf);
|
||||
|
@ -150,7 +150,7 @@ Value ApiEvents::CheckResultAPIHandler(const MessageOrigin& origin, const Dictio
|
|||
Value p;
|
||||
|
||||
if (vp.IsObjectType<Dictionary>()) {
|
||||
PerfdataValue::Ptr val = make_shared<PerfdataValue>();
|
||||
PerfdataValue::Ptr val = new PerfdataValue();
|
||||
Deserialize(val, vp, true);
|
||||
rperf->Add(val);
|
||||
} else
|
||||
|
@ -194,13 +194,13 @@ void ApiEvents::NextCheckChangedHandler(const Checkable::Ptr& checkable, double
|
|||
Service::Ptr service;
|
||||
tie(host, service) = GetHostService(checkable);
|
||||
|
||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||
Dictionary::Ptr params = new Dictionary();
|
||||
params->Set("host", host->GetName());
|
||||
if (service)
|
||||
params->Set("service", service->GetShortName());
|
||||
params->Set("next_check", nextCheck);
|
||||
|
||||
Dictionary::Ptr message = make_shared<Dictionary>();
|
||||
Dictionary::Ptr message = new Dictionary();
|
||||
message->Set("jsonrpc", "2.0");
|
||||
message->Set("method", "event::SetNextCheck");
|
||||
message->Set("params", params);
|
||||
|
@ -246,11 +246,11 @@ void ApiEvents::NextNotificationChangedHandler(const Notification::Ptr& notifica
|
|||
if (!listener)
|
||||
return;
|
||||
|
||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||
Dictionary::Ptr params = new Dictionary();
|
||||
params->Set("notification", notification->GetName());
|
||||
params->Set("next_notification", nextNotification);
|
||||
|
||||
Dictionary::Ptr message = make_shared<Dictionary>();
|
||||
Dictionary::Ptr message = new Dictionary();
|
||||
message->Set("jsonrpc", "2.0");
|
||||
message->Set("method", "event::SetNextNotification");
|
||||
message->Set("params", params);
|
||||
|
@ -290,13 +290,13 @@ void ApiEvents::ForceNextCheckChangedHandler(const Checkable::Ptr& checkable, bo
|
|||
Service::Ptr service;
|
||||
tie(host, service) = GetHostService(checkable);
|
||||
|
||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||
Dictionary::Ptr params = new Dictionary();
|
||||
params->Set("host", host->GetName());
|
||||
if (service)
|
||||
params->Set("service", service->GetShortName());
|
||||
params->Set("forced", forced);
|
||||
|
||||
Dictionary::Ptr message = make_shared<Dictionary>();
|
||||
Dictionary::Ptr message = new Dictionary();
|
||||
message->Set("jsonrpc", "2.0");
|
||||
message->Set("method", "event::SetForceNextCheck");
|
||||
message->Set("params", params);
|
||||
|
@ -346,13 +346,13 @@ void ApiEvents::ForceNextNotificationChangedHandler(const Checkable::Ptr& checka
|
|||
Service::Ptr service;
|
||||
tie(host, service) = GetHostService(checkable);
|
||||
|
||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||
Dictionary::Ptr params = new Dictionary();
|
||||
params->Set("host", host->GetName());
|
||||
if (service)
|
||||
params->Set("service", service->GetShortName());
|
||||
params->Set("forced", forced);
|
||||
|
||||
Dictionary::Ptr message = make_shared<Dictionary>();
|
||||
Dictionary::Ptr message = new Dictionary();
|
||||
message->Set("jsonrpc", "2.0");
|
||||
message->Set("method", "event::SetForceNextNotification");
|
||||
message->Set("params", params);
|
||||
|
@ -402,13 +402,13 @@ void ApiEvents::EnableActiveChecksChangedHandler(const Checkable::Ptr& checkable
|
|||
Service::Ptr service;
|
||||
tie(host, service) = GetHostService(checkable);
|
||||
|
||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||
Dictionary::Ptr params = new Dictionary();
|
||||
params->Set("host", host->GetName());
|
||||
if (service)
|
||||
params->Set("service", service->GetShortName());
|
||||
params->Set("enabled", enabled);
|
||||
|
||||
Dictionary::Ptr message = make_shared<Dictionary>();
|
||||
Dictionary::Ptr message = new Dictionary();
|
||||
message->Set("jsonrpc", "2.0");
|
||||
message->Set("method", "event::SetEnableActiveChecks");
|
||||
message->Set("params", params);
|
||||
|
@ -458,13 +458,13 @@ void ApiEvents::EnablePassiveChecksChangedHandler(const Checkable::Ptr& checkabl
|
|||
Service::Ptr service;
|
||||
tie(host, service) = GetHostService(checkable);
|
||||
|
||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||
Dictionary::Ptr params = new Dictionary();
|
||||
params->Set("host", host->GetName());
|
||||
if (service)
|
||||
params->Set("service", service->GetShortName());
|
||||
params->Set("enabled", enabled);
|
||||
|
||||
Dictionary::Ptr message = make_shared<Dictionary>();
|
||||
Dictionary::Ptr message = new Dictionary();
|
||||
message->Set("jsonrpc", "2.0");
|
||||
message->Set("method", "event::SetEnablePassiveChecks");
|
||||
message->Set("params", params);
|
||||
|
@ -514,13 +514,13 @@ void ApiEvents::EnableNotificationsChangedHandler(const Checkable::Ptr& checkabl
|
|||
Service::Ptr service;
|
||||
tie(host, service) = GetHostService(checkable);
|
||||
|
||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||
Dictionary::Ptr params = new Dictionary();
|
||||
params->Set("host", host->GetName());
|
||||
if (service)
|
||||
params->Set("service", service->GetShortName());
|
||||
params->Set("enabled", enabled);
|
||||
|
||||
Dictionary::Ptr message = make_shared<Dictionary>();
|
||||
Dictionary::Ptr message = new Dictionary();
|
||||
message->Set("jsonrpc", "2.0");
|
||||
message->Set("method", "event::SetEnableNotifications");
|
||||
message->Set("params", params);
|
||||
|
@ -570,13 +570,13 @@ void ApiEvents::EnableFlappingChangedHandler(const Checkable::Ptr& checkable, bo
|
|||
Service::Ptr service;
|
||||
tie(host, service) = GetHostService(checkable);
|
||||
|
||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||
Dictionary::Ptr params = new Dictionary();
|
||||
params->Set("host", host->GetName());
|
||||
if (service)
|
||||
params->Set("service", service->GetShortName());
|
||||
params->Set("enabled", enabled);
|
||||
|
||||
Dictionary::Ptr message = make_shared<Dictionary>();
|
||||
Dictionary::Ptr message = new Dictionary();
|
||||
message->Set("jsonrpc", "2.0");
|
||||
message->Set("method", "event::SetEnableFlapping");
|
||||
message->Set("params", params);
|
||||
|
@ -626,13 +626,13 @@ void ApiEvents::EnableEventHandlerChangedHandler(const Checkable::Ptr& checkable
|
|||
Service::Ptr service;
|
||||
tie(host, service) = GetHostService(checkable);
|
||||
|
||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||
Dictionary::Ptr params = new Dictionary();
|
||||
params->Set("host", host->GetName());
|
||||
if (service)
|
||||
params->Set("service", service->GetShortName());
|
||||
params->Set("enabled", enabled);
|
||||
|
||||
Dictionary::Ptr message = make_shared<Dictionary>();
|
||||
Dictionary::Ptr message = new Dictionary();
|
||||
message->Set("jsonrpc", "2.0");
|
||||
message->Set("method", "event::SetEnableEventHandler");
|
||||
message->Set("params", params);
|
||||
|
@ -682,13 +682,13 @@ void ApiEvents::EnablePerfdataChangedHandler(const Checkable::Ptr& checkable, bo
|
|||
Service::Ptr service;
|
||||
tie(host, service) = GetHostService(checkable);
|
||||
|
||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||
Dictionary::Ptr params = new Dictionary();
|
||||
params->Set("host", host->GetName());
|
||||
if (service)
|
||||
params->Set("service", service->GetShortName());
|
||||
params->Set("enabled", enabled);
|
||||
|
||||
Dictionary::Ptr message = make_shared<Dictionary>();
|
||||
Dictionary::Ptr message = new Dictionary();
|
||||
message->Set("jsonrpc", "2.0");
|
||||
message->Set("method", "event::SetEnablePerfdata");
|
||||
message->Set("params", params);
|
||||
|
@ -738,13 +738,13 @@ void ApiEvents::CheckIntervalChangedHandler(const Checkable::Ptr& checkable, dou
|
|||
Service::Ptr service;
|
||||
tie(host, service) = GetHostService(checkable);
|
||||
|
||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||
Dictionary::Ptr params = new Dictionary();
|
||||
params->Set("host", host->GetName());
|
||||
if (service)
|
||||
params->Set("service", service->GetShortName());
|
||||
params->Set("interval", interval);
|
||||
|
||||
Dictionary::Ptr message = make_shared<Dictionary>();
|
||||
Dictionary::Ptr message = new Dictionary();
|
||||
message->Set("jsonrpc", "2.0");
|
||||
message->Set("method", "event::SetCheckInterval");
|
||||
message->Set("params", params);
|
||||
|
@ -794,13 +794,13 @@ void ApiEvents::RetryIntervalChangedHandler(const Checkable::Ptr& checkable, dou
|
|||
Service::Ptr service;
|
||||
tie(host, service) = GetHostService(checkable);
|
||||
|
||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||
Dictionary::Ptr params = new Dictionary();
|
||||
params->Set("host", host->GetName());
|
||||
if (service)
|
||||
params->Set("service", service->GetShortName());
|
||||
params->Set("interval", interval);
|
||||
|
||||
Dictionary::Ptr message = make_shared<Dictionary>();
|
||||
Dictionary::Ptr message = new Dictionary();
|
||||
message->Set("jsonrpc", "2.0");
|
||||
message->Set("method", "event::SetRetryInterval");
|
||||
message->Set("params", params);
|
||||
|
@ -850,13 +850,13 @@ void ApiEvents::MaxCheckAttemptsChangedHandler(const Checkable::Ptr& checkable,
|
|||
Service::Ptr service;
|
||||
tie(host, service) = GetHostService(checkable);
|
||||
|
||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||
Dictionary::Ptr params = new Dictionary();
|
||||
params->Set("host", host->GetName());
|
||||
if (service)
|
||||
params->Set("service", service->GetShortName());
|
||||
params->Set("attempts", attempts);
|
||||
|
||||
Dictionary::Ptr message = make_shared<Dictionary>();
|
||||
Dictionary::Ptr message = new Dictionary();
|
||||
message->Set("jsonrpc", "2.0");
|
||||
message->Set("method", "event::SetMaxCheckAttempts");
|
||||
message->Set("params", params);
|
||||
|
@ -906,13 +906,13 @@ void ApiEvents::EventCommandChangedHandler(const Checkable::Ptr& checkable, cons
|
|||
Service::Ptr service;
|
||||
tie(host, service) = GetHostService(checkable);
|
||||
|
||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||
Dictionary::Ptr params = new Dictionary();
|
||||
params->Set("host", host->GetName());
|
||||
if (service)
|
||||
params->Set("service", service->GetShortName());
|
||||
params->Set("command", command->GetName());
|
||||
|
||||
Dictionary::Ptr message = make_shared<Dictionary>();
|
||||
Dictionary::Ptr message = new Dictionary();
|
||||
message->Set("jsonrpc", "2.0");
|
||||
message->Set("method", "event::SetEventCommand");
|
||||
message->Set("params", params);
|
||||
|
@ -967,13 +967,13 @@ void ApiEvents::CheckCommandChangedHandler(const Checkable::Ptr& checkable, cons
|
|||
Service::Ptr service;
|
||||
tie(host, service) = GetHostService(checkable);
|
||||
|
||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||
Dictionary::Ptr params = new Dictionary();
|
||||
params->Set("host", host->GetName());
|
||||
if (service)
|
||||
params->Set("service", service->GetShortName());
|
||||
params->Set("command", command->GetName());
|
||||
|
||||
Dictionary::Ptr message = make_shared<Dictionary>();
|
||||
Dictionary::Ptr message = new Dictionary();
|
||||
message->Set("jsonrpc", "2.0");
|
||||
message->Set("method", "event::SetCheckCommand");
|
||||
message->Set("params", params);
|
||||
|
@ -1028,13 +1028,13 @@ void ApiEvents::CheckPeriodChangedHandler(const Checkable::Ptr& checkable, const
|
|||
Service::Ptr service;
|
||||
tie(host, service) = GetHostService(checkable);
|
||||
|
||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||
Dictionary::Ptr params = new Dictionary();
|
||||
params->Set("host", host->GetName());
|
||||
if (service)
|
||||
params->Set("service", service->GetShortName());
|
||||
params->Set("timeperiod", timeperiod->GetName());
|
||||
|
||||
Dictionary::Ptr message = make_shared<Dictionary>();
|
||||
Dictionary::Ptr message = new Dictionary();
|
||||
message->Set("jsonrpc", "2.0");
|
||||
message->Set("method", "event::SetCheckPeriod");
|
||||
message->Set("params", params);
|
||||
|
@ -1085,11 +1085,11 @@ void ApiEvents::VarsChangedHandler(const CustomVarObject::Ptr& object, const Dic
|
|||
if (!listener)
|
||||
return;
|
||||
|
||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||
Dictionary::Ptr params = new Dictionary();
|
||||
params->Set("object", object->GetName());
|
||||
params->Set("vars", Serialize(vars));
|
||||
|
||||
Dictionary::Ptr message = make_shared<Dictionary>();
|
||||
Dictionary::Ptr message = new Dictionary();
|
||||
message->Set("jsonrpc", "2.0");
|
||||
message->Set("method", "event::SetVars");
|
||||
message->Set("params", params);
|
||||
|
@ -1151,13 +1151,13 @@ void ApiEvents::CommentAddedHandler(const Checkable::Ptr& checkable, const Comme
|
|||
Service::Ptr service;
|
||||
tie(host, service) = GetHostService(checkable);
|
||||
|
||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||
Dictionary::Ptr params = new Dictionary();
|
||||
params->Set("host", host->GetName());
|
||||
if (service)
|
||||
params->Set("service", service->GetShortName());
|
||||
params->Set("comment", Serialize(comment));
|
||||
|
||||
Dictionary::Ptr message = make_shared<Dictionary>();
|
||||
Dictionary::Ptr message = new Dictionary();
|
||||
message->Set("jsonrpc", "2.0");
|
||||
message->Set("method", "event::AddComment");
|
||||
message->Set("params", params);
|
||||
|
@ -1191,7 +1191,7 @@ Value ApiEvents::CommentAddedAPIHandler(const MessageOrigin& origin, const Dicti
|
|||
if (origin.FromZone && !origin.FromZone->CanAccessObject(checkable))
|
||||
return Empty;
|
||||
|
||||
Comment::Ptr comment = make_shared<Comment>();
|
||||
Comment::Ptr comment = new Comment();
|
||||
Deserialize(comment, params->Get("comment"), true);
|
||||
|
||||
checkable->AddComment(comment->GetEntryType(), comment->GetAuthor(),
|
||||
|
@ -1211,13 +1211,13 @@ void ApiEvents::CommentRemovedHandler(const Checkable::Ptr& checkable, const Com
|
|||
Service::Ptr service;
|
||||
tie(host, service) = GetHostService(checkable);
|
||||
|
||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||
Dictionary::Ptr params = new Dictionary();
|
||||
params->Set("host", host->GetName());
|
||||
if (service)
|
||||
params->Set("service", service->GetShortName());
|
||||
params->Set("id", comment->GetId());
|
||||
|
||||
Dictionary::Ptr message = make_shared<Dictionary>();
|
||||
Dictionary::Ptr message = new Dictionary();
|
||||
message->Set("jsonrpc", "2.0");
|
||||
message->Set("method", "event::RemoveComment");
|
||||
message->Set("params", params);
|
||||
|
@ -1267,13 +1267,13 @@ void ApiEvents::DowntimeAddedHandler(const Checkable::Ptr& checkable, const Down
|
|||
Service::Ptr service;
|
||||
tie(host, service) = GetHostService(checkable);
|
||||
|
||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||
Dictionary::Ptr params = new Dictionary();
|
||||
params->Set("host", host->GetName());
|
||||
if (service)
|
||||
params->Set("service", service->GetShortName());
|
||||
params->Set("downtime", Serialize(downtime));
|
||||
|
||||
Dictionary::Ptr message = make_shared<Dictionary>();
|
||||
Dictionary::Ptr message = new Dictionary();
|
||||
message->Set("jsonrpc", "2.0");
|
||||
message->Set("method", "event::AddDowntime");
|
||||
message->Set("params", params);
|
||||
|
@ -1307,7 +1307,7 @@ Value ApiEvents::DowntimeAddedAPIHandler(const MessageOrigin& origin, const Dict
|
|||
if (origin.FromZone && !origin.FromZone->CanAccessObject(checkable))
|
||||
return Empty;
|
||||
|
||||
Downtime::Ptr downtime = make_shared<Downtime>();
|
||||
Downtime::Ptr downtime = new Downtime();
|
||||
Deserialize(downtime, params->Get("downtime"), true);
|
||||
|
||||
checkable->AddDowntime(downtime->GetAuthor(), downtime->GetComment(),
|
||||
|
@ -1330,13 +1330,13 @@ void ApiEvents::DowntimeRemovedHandler(const Checkable::Ptr& checkable, const Do
|
|||
Service::Ptr service;
|
||||
tie(host, service) = GetHostService(checkable);
|
||||
|
||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||
Dictionary::Ptr params = new Dictionary();
|
||||
params->Set("host", host->GetName());
|
||||
if (service)
|
||||
params->Set("service", service->GetShortName());
|
||||
params->Set("id", downtime->GetId());
|
||||
|
||||
Dictionary::Ptr message = make_shared<Dictionary>();
|
||||
Dictionary::Ptr message = new Dictionary();
|
||||
message->Set("jsonrpc", "2.0");
|
||||
message->Set("method", "event::RemoveDowntime");
|
||||
message->Set("params", params);
|
||||
|
@ -1388,7 +1388,7 @@ void ApiEvents::AcknowledgementSetHandler(const Checkable::Ptr& checkable,
|
|||
Service::Ptr service;
|
||||
tie(host, service) = GetHostService(checkable);
|
||||
|
||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||
Dictionary::Ptr params = new Dictionary();
|
||||
params->Set("host", host->GetName());
|
||||
if (service)
|
||||
params->Set("service", service->GetShortName());
|
||||
|
@ -1397,7 +1397,7 @@ void ApiEvents::AcknowledgementSetHandler(const Checkable::Ptr& checkable,
|
|||
params->Set("acktype", type);
|
||||
params->Set("expiry", expiry);
|
||||
|
||||
Dictionary::Ptr message = make_shared<Dictionary>();
|
||||
Dictionary::Ptr message = new Dictionary();
|
||||
message->Set("jsonrpc", "2.0");
|
||||
message->Set("method", "event::SetAcknowledgement");
|
||||
message->Set("params", params);
|
||||
|
@ -1449,12 +1449,12 @@ void ApiEvents::AcknowledgementClearedHandler(const Checkable::Ptr& checkable, c
|
|||
Service::Ptr service;
|
||||
tie(host, service) = GetHostService(checkable);
|
||||
|
||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||
Dictionary::Ptr params = new Dictionary();
|
||||
params->Set("host", host->GetName());
|
||||
if (service)
|
||||
params->Set("service", service->GetShortName());
|
||||
|
||||
Dictionary::Ptr message = make_shared<Dictionary>();
|
||||
Dictionary::Ptr message = new Dictionary();
|
||||
message->Set("jsonrpc", "2.0");
|
||||
message->Set("method", "event::ClearAcknowledgement");
|
||||
message->Set("params", params);
|
||||
|
@ -1500,10 +1500,10 @@ void ApiEvents::RepositoryTimerHandler(void)
|
|||
if (!listener)
|
||||
return;
|
||||
|
||||
Dictionary::Ptr repository = make_shared<Dictionary>();
|
||||
Dictionary::Ptr repository = new Dictionary();
|
||||
|
||||
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
|
||||
Array::Ptr services = make_shared<Array>();
|
||||
Array::Ptr services = new Array();
|
||||
|
||||
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
|
||||
services->Add(service->GetShortName());
|
||||
|
@ -1521,7 +1521,7 @@ void ApiEvents::RepositoryTimerHandler(void)
|
|||
|
||||
Zone::Ptr my_zone = my_endpoint->GetZone();
|
||||
|
||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||
Dictionary::Ptr params = new Dictionary();
|
||||
params->Set("seen", Utility::GetTime());
|
||||
params->Set("endpoint", my_endpoint->GetName());
|
||||
|
||||
|
@ -1532,7 +1532,7 @@ void ApiEvents::RepositoryTimerHandler(void)
|
|||
params->Set("zone", my_zone->GetName());
|
||||
params->Set("repository", repository);
|
||||
|
||||
Dictionary::Ptr message = make_shared<Dictionary>();
|
||||
Dictionary::Ptr message = new Dictionary();
|
||||
message->Set("jsonrpc", "2.0");
|
||||
message->Set("method", "event::UpdateRepository");
|
||||
message->Set("params", params);
|
||||
|
@ -1577,7 +1577,7 @@ Value ApiEvents::UpdateRepositoryAPIHandler(const MessageOrigin& origin, const D
|
|||
if (!listener)
|
||||
return Empty;
|
||||
|
||||
Dictionary::Ptr message = make_shared<Dictionary>();
|
||||
Dictionary::Ptr message = new Dictionary();
|
||||
message->Set("jsonrpc", "2.0");
|
||||
message->Set("method", "event::UpdateRepository");
|
||||
message->Set("params", params);
|
||||
|
|
|
@ -66,7 +66,7 @@ void Checkable::SetCheckCommand(const CheckCommand::Ptr& command, const MessageO
|
|||
{
|
||||
SetOverrideCheckCommand(command->GetName());
|
||||
|
||||
OnCheckCommandChanged(GetSelf(), command, origin);
|
||||
OnCheckCommandChanged(this, command, origin);
|
||||
}
|
||||
|
||||
TimePeriod::Ptr Checkable::GetCheckPeriod(void) const
|
||||
|
@ -85,7 +85,7 @@ void Checkable::SetCheckPeriod(const TimePeriod::Ptr& tp, const MessageOrigin& o
|
|||
{
|
||||
SetOverrideCheckPeriod(tp->GetName());
|
||||
|
||||
OnCheckPeriodChanged(GetSelf(), tp, origin);
|
||||
OnCheckPeriodChanged(this, tp, origin);
|
||||
}
|
||||
|
||||
double Checkable::GetCheckInterval(void) const
|
||||
|
@ -100,7 +100,7 @@ void Checkable::SetCheckInterval(double interval, const MessageOrigin& origin)
|
|||
{
|
||||
SetOverrideCheckInterval(interval);
|
||||
|
||||
OnCheckIntervalChanged(GetSelf(), interval, origin);
|
||||
OnCheckIntervalChanged(this, interval, origin);
|
||||
}
|
||||
|
||||
double Checkable::GetRetryInterval(void) const
|
||||
|
@ -115,7 +115,7 @@ void Checkable::SetRetryInterval(double interval, const MessageOrigin& origin)
|
|||
{
|
||||
SetOverrideRetryInterval(interval);
|
||||
|
||||
OnRetryIntervalChanged(GetSelf(), interval, origin);
|
||||
OnRetryIntervalChanged(this, interval, origin);
|
||||
}
|
||||
|
||||
void Checkable::SetSchedulingOffset(long offset)
|
||||
|
@ -132,7 +132,7 @@ void Checkable::SetNextCheck(double nextCheck, const MessageOrigin& origin)
|
|||
{
|
||||
SetNextCheckRaw(nextCheck);
|
||||
|
||||
OnNextCheckChanged(GetSelf(), nextCheck, origin);
|
||||
OnNextCheckChanged(this, nextCheck, origin);
|
||||
}
|
||||
|
||||
double Checkable::GetNextCheck(void)
|
||||
|
@ -186,7 +186,7 @@ void Checkable::SetEnableActiveChecks(bool enabled, const MessageOrigin& origin)
|
|||
{
|
||||
SetOverrideEnableActiveChecks(enabled);
|
||||
|
||||
OnEnableActiveChecksChanged(GetSelf(), enabled, origin);
|
||||
OnEnableActiveChecksChanged(this, enabled, origin);
|
||||
}
|
||||
|
||||
bool Checkable::GetEnablePassiveChecks(void) const
|
||||
|
@ -201,7 +201,7 @@ void Checkable::SetEnablePassiveChecks(bool enabled, const MessageOrigin& origin
|
|||
{
|
||||
SetOverrideEnablePassiveChecks(enabled);
|
||||
|
||||
OnEnablePassiveChecksChanged(GetSelf(), enabled, origin);
|
||||
OnEnablePassiveChecksChanged(this, enabled, origin);
|
||||
}
|
||||
|
||||
bool Checkable::GetForceNextCheck(void) const
|
||||
|
@ -213,7 +213,7 @@ void Checkable::SetForceNextCheck(bool forced, const MessageOrigin& origin)
|
|||
{
|
||||
SetForceNextCheckRaw(forced);
|
||||
|
||||
OnForceNextCheckChanged(GetSelf(), forced, origin);
|
||||
OnForceNextCheckChanged(this, forced, origin);
|
||||
}
|
||||
|
||||
int Checkable::GetMaxCheckAttempts(void) const
|
||||
|
@ -228,7 +228,7 @@ void Checkable::SetMaxCheckAttempts(int attempts, const MessageOrigin& origin)
|
|||
{
|
||||
SetOverrideMaxCheckAttempts(attempts);
|
||||
|
||||
OnMaxCheckAttemptsChanged(GetSelf(), attempts, origin);
|
||||
OnMaxCheckAttemptsChanged(this, attempts, origin);
|
||||
}
|
||||
|
||||
void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrigin& origin)
|
||||
|
@ -368,7 +368,7 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
|
|||
|
||||
Host::Ptr host;
|
||||
Service::Ptr service;
|
||||
tie(host, service) = GetHostService(GetSelf());
|
||||
tie(host, service) = GetHostService(this);
|
||||
|
||||
CheckableType checkable_type = CheckableHost;
|
||||
if (service)
|
||||
|
@ -394,7 +394,7 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
|
|||
if (remove_acknowledgement_comments)
|
||||
RemoveCommentsByType(CommentAcknowledgement);
|
||||
|
||||
Dictionary::Ptr vars_after = make_shared<Dictionary>();
|
||||
Dictionary::Ptr vars_after = new Dictionary();
|
||||
vars_after->Set("state", new_state);
|
||||
vars_after->Set("state_type", GetStateType());
|
||||
vars_after->Set("attempt", GetCheckAttempt());
|
||||
|
@ -424,20 +424,20 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
|
|||
// << " threshold: " << GetFlappingThreshold()
|
||||
// << "% current: " + GetFlappingCurrent()) << "%.";
|
||||
|
||||
OnNewCheckResult(GetSelf(), cr, origin);
|
||||
OnNewCheckResult(this, cr, origin);
|
||||
|
||||
/* signal status updates to for example db_ido */
|
||||
OnStateChanged(GetSelf());
|
||||
OnStateChanged(this);
|
||||
|
||||
String old_state_str = (service ? Service::StateToString(old_state) : Host::StateToString(Host::CalculateState(old_state)));
|
||||
String new_state_str = (service ? Service::StateToString(new_state) : Host::StateToString(Host::CalculateState(new_state)));
|
||||
|
||||
if (hardChange) {
|
||||
OnStateChange(GetSelf(), cr, StateTypeHard, origin);
|
||||
OnStateChange(this, cr, StateTypeHard, origin);
|
||||
Log(LogNotice, "Checkable")
|
||||
<< "State Change: Checkable " << GetName() << " hard state change from " << old_state_str << " to " << new_state_str << " detected.";
|
||||
} else if (stateChange) {
|
||||
OnStateChange(GetSelf(), cr, StateTypeSoft, origin);
|
||||
OnStateChange(this, cr, StateTypeSoft, origin);
|
||||
Log(LogNotice, "Checkable")
|
||||
<< "State Change: Checkable " << GetName() << " soft state change from " << old_state_str << " to " << new_state_str << " detected.";
|
||||
}
|
||||
|
@ -446,22 +446,22 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
|
|||
ExecuteEventHandler();
|
||||
|
||||
if (send_downtime_notification)
|
||||
OnNotificationsRequested(GetSelf(), in_downtime ? NotificationDowntimeStart : NotificationDowntimeEnd, cr, "", "");
|
||||
OnNotificationsRequested(this, in_downtime ? NotificationDowntimeStart : NotificationDowntimeEnd, cr, "", "");
|
||||
|
||||
if (!was_flapping && is_flapping) {
|
||||
OnNotificationsRequested(GetSelf(), NotificationFlappingStart, cr, "", "");
|
||||
OnNotificationsRequested(this, NotificationFlappingStart, cr, "", "");
|
||||
|
||||
Log(LogNotice, "Checkable")
|
||||
<< "Flapping: Checkable " << GetName() << " started flapping (" << GetFlappingThreshold() << "% < " << GetFlappingCurrent() << "%).";
|
||||
OnFlappingChanged(GetSelf(), FlappingStarted);
|
||||
OnFlappingChanged(this, FlappingStarted);
|
||||
} else if (was_flapping && !is_flapping) {
|
||||
OnNotificationsRequested(GetSelf(), NotificationFlappingEnd, cr, "", "");
|
||||
OnNotificationsRequested(this, NotificationFlappingEnd, cr, "", "");
|
||||
|
||||
Log(LogNotice, "Checkable")
|
||||
<< "Flapping: Checkable " << GetName() << " stopped flapping (" << GetFlappingThreshold() << "% >= " << GetFlappingCurrent() << "%).";
|
||||
OnFlappingChanged(GetSelf(), FlappingStopped);
|
||||
OnFlappingChanged(this, FlappingStopped);
|
||||
} else if (send_notification)
|
||||
OnNotificationsRequested(GetSelf(), recovery ? NotificationRecovery : NotificationProblem, cr, "", "");
|
||||
OnNotificationsRequested(this, recovery ? NotificationRecovery : NotificationProblem, cr, "", "");
|
||||
}
|
||||
|
||||
bool Checkable::IsCheckPending(void) const
|
||||
|
@ -498,14 +498,12 @@ void Checkable::ExecuteCheck(void)
|
|||
double scheduled_start = GetNextCheck();
|
||||
double before_check = Utility::GetTime();
|
||||
|
||||
Checkable::Ptr self = GetSelf();
|
||||
|
||||
CheckResult::Ptr result = make_shared<CheckResult>();
|
||||
CheckResult::Ptr result = new CheckResult();
|
||||
|
||||
result->SetScheduleStart(scheduled_start);
|
||||
result->SetExecutionStart(before_check);
|
||||
|
||||
GetCheckCommand()->Execute(GetSelf(), result);
|
||||
GetCheckCommand()->Execute(this, result);
|
||||
}
|
||||
|
||||
void Checkable::UpdateStatistics(const CheckResult::Ptr& cr, CheckableType type)
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace icinga;
|
|||
static int l_NextCommentID = 1;
|
||||
static boost::mutex l_CommentMutex;
|
||||
static std::map<int, String> l_LegacyCommentsCache;
|
||||
static std::map<String, Checkable::WeakPtr> l_CommentsCache;
|
||||
static std::map<String, Checkable::Ptr> l_CommentsCache;
|
||||
static Timer::Ptr l_CommentsExpireTimer;
|
||||
|
||||
boost::signals2::signal<void (const Checkable::Ptr&, const Comment::Ptr&, const MessageOrigin&)> Checkable::OnCommentAdded;
|
||||
|
@ -53,7 +53,7 @@ String Checkable::AddComment(CommentType entryType, const String& author,
|
|||
else
|
||||
uid = id;
|
||||
|
||||
Comment::Ptr comment = make_shared<Comment>();
|
||||
Comment::Ptr comment = new Comment();
|
||||
comment->SetId(uid);;
|
||||
comment->SetEntryTime(Utility::GetTime());
|
||||
comment->SetEntryType(entryType);
|
||||
|
@ -75,10 +75,10 @@ String Checkable::AddComment(CommentType entryType, const String& author,
|
|||
{
|
||||
boost::mutex::scoped_lock lock(l_CommentMutex);
|
||||
l_LegacyCommentsCache[legacy_id] = uid;
|
||||
l_CommentsCache[uid] = GetSelf();
|
||||
l_CommentsCache[uid] = this;
|
||||
}
|
||||
|
||||
OnCommentAdded(GetSelf(), comment, origin);
|
||||
OnCommentAdded(this, comment, origin);
|
||||
|
||||
return uid;
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ Checkable::Ptr Checkable::GetOwnerByCommentID(const String& id)
|
|||
{
|
||||
boost::mutex::scoped_lock lock(l_CommentMutex);
|
||||
|
||||
return l_CommentsCache[id].lock();
|
||||
return l_CommentsCache[id];
|
||||
}
|
||||
|
||||
Comment::Ptr Checkable::GetCommentByID(const String& id)
|
||||
|
@ -184,7 +184,7 @@ void Checkable::AddCommentsToCache(void)
|
|||
l_NextCommentID = legacy_id + 1;
|
||||
|
||||
l_LegacyCommentsCache[legacy_id] = kv.first;
|
||||
l_CommentsCache[kv.first] = GetSelf();
|
||||
l_CommentsCache[kv.first] = this;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ using namespace icinga;
|
|||
static int l_NextDowntimeID = 1;
|
||||
static boost::mutex l_DowntimeMutex;
|
||||
static std::map<int, String> l_LegacyDowntimesCache;
|
||||
static std::map<String, Checkable::WeakPtr> l_DowntimesCache;
|
||||
static std::map<String, Checkable::Ptr> l_DowntimesCache;
|
||||
static Timer::Ptr l_DowntimesExpireTimer;
|
||||
|
||||
boost::signals2::signal<void (const Checkable::Ptr&, const Downtime::Ptr&, const MessageOrigin&)> Checkable::OnDowntimeAdded;
|
||||
|
@ -59,7 +59,7 @@ String Checkable::AddDowntime(const String& author, const String& comment,
|
|||
else
|
||||
uid = id;
|
||||
|
||||
Downtime::Ptr downtime = make_shared<Downtime>();
|
||||
Downtime::Ptr downtime = new Downtime();
|
||||
downtime->SetId(uid);
|
||||
downtime->SetEntryTime(Utility::GetTime());
|
||||
downtime->SetAuthor(author);
|
||||
|
@ -101,7 +101,7 @@ String Checkable::AddDowntime(const String& author, const String& comment,
|
|||
{
|
||||
boost::mutex::scoped_lock lock(l_DowntimeMutex);
|
||||
l_LegacyDowntimesCache[legacy_id] = uid;
|
||||
l_DowntimesCache[uid] = GetSelf();
|
||||
l_DowntimesCache[uid] = this;
|
||||
}
|
||||
|
||||
Log(LogNotice, "Checkable")
|
||||
|
@ -109,7 +109,7 @@ String Checkable::AddDowntime(const String& author, const String& comment,
|
|||
<< "' between '" << Utility::FormatDateTime("%Y-%m-%d %H:%M:%S", startTime)
|
||||
<< "' and '" << Utility::FormatDateTime("%Y-%m-%d %H:%M:%S", endTime) << "'.";
|
||||
|
||||
OnDowntimeAdded(GetSelf(), downtime, origin);
|
||||
OnDowntimeAdded(this, downtime, origin);
|
||||
|
||||
return uid;
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ String Checkable::GetDowntimeIDFromLegacyID(int id)
|
|||
Checkable::Ptr Checkable::GetOwnerByDowntimeID(const String& id)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_DowntimeMutex);
|
||||
return l_DowntimesCache[id].lock();
|
||||
return l_DowntimesCache[id];
|
||||
}
|
||||
|
||||
Downtime::Ptr Checkable::GetDowntimeByID(const String& id)
|
||||
|
@ -243,7 +243,7 @@ Downtime::Ptr Checkable::GetDowntimeByID(const String& id)
|
|||
|
||||
void Checkable::StartDowntimesExpiredTimer(void)
|
||||
{
|
||||
l_DowntimesExpireTimer = make_shared<Timer>();
|
||||
l_DowntimesExpireTimer = new Timer();
|
||||
l_DowntimesExpireTimer->SetInterval(60);
|
||||
l_DowntimesExpireTimer->OnTimerExpired.connect(boost::bind(&Checkable::DowntimesExpireTimerHandler));
|
||||
l_DowntimesExpireTimer->Start();
|
||||
|
@ -270,7 +270,7 @@ void Checkable::AddDowntimesToCache(void)
|
|||
l_NextDowntimeID = legacy_id + 1;
|
||||
|
||||
l_LegacyDowntimesCache[legacy_id] = kv.first;
|
||||
l_DowntimesCache[kv.first] = GetSelf();
|
||||
l_DowntimesCache[kv.first] = this;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ void Checkable::SetEnableEventHandler(bool enabled, const MessageOrigin& origin)
|
|||
{
|
||||
SetOverrideEnableEventHandler(enabled);
|
||||
|
||||
OnEnableEventHandlerChanged(GetSelf(), enabled, origin);
|
||||
OnEnableEventHandlerChanged(this, enabled, origin);
|
||||
}
|
||||
|
||||
EventCommand::Ptr Checkable::GetEventCommand(void) const
|
||||
|
@ -60,7 +60,7 @@ void Checkable::SetEventCommand(const EventCommand::Ptr& command, const MessageO
|
|||
{
|
||||
SetOverrideEventCommand(command->GetName());
|
||||
|
||||
OnEventCommandChanged(GetSelf(), command, origin);
|
||||
OnEventCommandChanged(this, command, origin);
|
||||
}
|
||||
|
||||
void Checkable::ExecuteEventHandler(void)
|
||||
|
@ -78,7 +78,7 @@ void Checkable::ExecuteEventHandler(void)
|
|||
Log(LogNotice, "Checkable")
|
||||
<< "Executing event handler '" << ec->GetName() << "' for service '" << GetName() << "'";
|
||||
|
||||
ec->Execute(GetSelf());
|
||||
ec->Execute(this);
|
||||
|
||||
OnEventCommandExecuted(GetSelf());
|
||||
OnEventCommandExecuted(this);
|
||||
}
|
||||
|
|
|
@ -46,8 +46,8 @@ void Checkable::SetEnableFlapping(bool enabled, const MessageOrigin& origin)
|
|||
{
|
||||
SetOverrideEnableFlapping(enabled);
|
||||
|
||||
OnFlappingChanged(GetSelf(), enabled ? FlappingEnabled : FlappingDisabled);
|
||||
OnEnableFlappingChanged(GetSelf(), enabled, origin);
|
||||
OnFlappingChanged(this, enabled ? FlappingEnabled : FlappingDisabled);
|
||||
OnEnableFlappingChanged(this, enabled, origin);
|
||||
}
|
||||
|
||||
void Checkable::UpdateFlappingStatus(bool stateChange)
|
||||
|
|
|
@ -109,7 +109,7 @@ void Checkable::SetEnableNotifications(bool enabled, const MessageOrigin& origin
|
|||
{
|
||||
SetOverrideEnableNotifications(enabled);
|
||||
|
||||
OnEnableNotificationsChanged(GetSelf(), enabled, origin);
|
||||
OnEnableNotificationsChanged(this, enabled, origin);
|
||||
}
|
||||
|
||||
bool Checkable::GetForceNextNotification(void) const
|
||||
|
@ -121,5 +121,5 @@ void Checkable::SetForceNextNotification(bool forced, const MessageOrigin& origi
|
|||
{
|
||||
SetForceNextNotificationRaw(forced);
|
||||
|
||||
OnForceNextNotificationChanged(GetSelf(), forced, origin);
|
||||
OnForceNextNotificationChanged(this, forced, origin);
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ void Checkable::AddGroup(const String& name)
|
|||
return;
|
||||
|
||||
if (!groups)
|
||||
groups = make_shared<Array>();
|
||||
groups = new Array();
|
||||
|
||||
groups->Add(name);
|
||||
}
|
||||
|
@ -127,9 +127,9 @@ void Checkable::AcknowledgeProblem(const String& author, const String& comment,
|
|||
SetAcknowledgementExpiry(expiry);
|
||||
}
|
||||
|
||||
OnNotificationsRequested(GetSelf(), NotificationAcknowledgement, GetLastCheckResult(), author, comment);
|
||||
OnNotificationsRequested(this, NotificationAcknowledgement, GetLastCheckResult(), author, comment);
|
||||
|
||||
OnAcknowledgementSet(GetSelf(), author, comment, type, expiry, origin);
|
||||
OnAcknowledgementSet(this, author, comment, type, expiry, origin);
|
||||
}
|
||||
|
||||
void Checkable::ClearAcknowledgement(const MessageOrigin& origin)
|
||||
|
@ -139,7 +139,7 @@ void Checkable::ClearAcknowledgement(const MessageOrigin& origin)
|
|||
SetAcknowledgementRaw(AcknowledgementNone);
|
||||
SetAcknowledgementExpiry(0);
|
||||
|
||||
OnAcknowledgementCleared(GetSelf(), origin);
|
||||
OnAcknowledgementCleared(this, origin);
|
||||
}
|
||||
|
||||
bool Checkable::GetEnablePerfdata(void) const
|
||||
|
@ -154,7 +154,7 @@ void Checkable::SetEnablePerfdata(bool enabled, const MessageOrigin& origin)
|
|||
{
|
||||
SetOverrideEnablePerfdata(enabled);
|
||||
|
||||
OnEnablePerfdataChanged(GetSelf(), enabled, origin);
|
||||
OnEnablePerfdataChanged(this, enabled, origin);
|
||||
}
|
||||
|
||||
int Checkable::GetModifiedAttributes(void) const
|
||||
|
@ -209,22 +209,22 @@ void Checkable::SetModifiedAttributes(int flags, const MessageOrigin& origin)
|
|||
{
|
||||
if ((flags & ModAttrNotificationsEnabled) == 0) {
|
||||
SetOverrideEnableNotifications(Empty);
|
||||
OnEnableNotificationsChanged(GetSelf(), GetEnableNotifications(), origin);
|
||||
OnEnableNotificationsChanged(this, GetEnableNotifications(), origin);
|
||||
}
|
||||
|
||||
if ((flags & ModAttrActiveChecksEnabled) == 0) {
|
||||
SetOverrideEnableActiveChecks(Empty);
|
||||
OnEnableActiveChecksChanged(GetSelf(), GetEnableActiveChecks(), origin);
|
||||
OnEnableActiveChecksChanged(this, GetEnableActiveChecks(), origin);
|
||||
}
|
||||
|
||||
if ((flags & ModAttrPassiveChecksEnabled) == 0) {
|
||||
SetOverrideEnablePassiveChecks(Empty);
|
||||
OnEnablePassiveChecksChanged(GetSelf(), GetEnablePassiveChecks(), origin);
|
||||
OnEnablePassiveChecksChanged(this, GetEnablePassiveChecks(), origin);
|
||||
}
|
||||
|
||||
if ((flags & ModAttrFlapDetectionEnabled) == 0) {
|
||||
SetOverrideEnableFlapping(Empty);
|
||||
OnEnableFlappingChanged(GetSelf(), GetEnableFlapping(), origin);
|
||||
OnEnableFlappingChanged(this, GetEnableFlapping(), origin);
|
||||
}
|
||||
|
||||
if ((flags & ModAttrEventHandlerEnabled) == 0)
|
||||
|
@ -232,7 +232,7 @@ void Checkable::SetModifiedAttributes(int flags, const MessageOrigin& origin)
|
|||
|
||||
if ((flags & ModAttrPerformanceDataEnabled) == 0) {
|
||||
SetOverrideEnablePerfdata(Empty);
|
||||
OnEnablePerfdataChanged(GetSelf(), GetEnablePerfdata(), origin);
|
||||
OnEnablePerfdataChanged(this, GetEnablePerfdata(), origin);
|
||||
}
|
||||
|
||||
if ((flags & ModAttrNormalCheckInterval) == 0)
|
||||
|
@ -255,6 +255,6 @@ void Checkable::SetModifiedAttributes(int flags, const MessageOrigin& origin)
|
|||
|
||||
if ((flags & ModAttrCustomVariable) == 0) {
|
||||
SetOverrideVars(Empty);
|
||||
OnVarsChanged(GetSelf(), GetVars(), origin);
|
||||
OnVarsChanged(this, GetVars(), origin);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ public:
|
|||
|
||||
//bool IsHostCheck(void) const;
|
||||
|
||||
bool IsReachable(DependencyType dt = DependencyState, shared_ptr<Dependency> *failedDependency = NULL, int rstack = 0) const;
|
||||
bool IsReachable(DependencyType dt = DependencyState, intrusive_ptr<Dependency> *failedDependency = NULL, int rstack = 0) const;
|
||||
|
||||
AcknowledgementType GetAcknowledgement(void);
|
||||
|
||||
|
@ -97,8 +97,8 @@ public:
|
|||
void ClearAcknowledgement(const MessageOrigin& origin = MessageOrigin());
|
||||
|
||||
/* Checks */
|
||||
shared_ptr<CheckCommand> GetCheckCommand(void) const;
|
||||
void SetCheckCommand(const shared_ptr<CheckCommand>& command, const MessageOrigin& origin = MessageOrigin());
|
||||
intrusive_ptr<CheckCommand> GetCheckCommand(void) const;
|
||||
void SetCheckCommand(const intrusive_ptr<CheckCommand>& command, const MessageOrigin& origin = MessageOrigin());
|
||||
|
||||
TimePeriod::Ptr GetCheckPeriod(void) const;
|
||||
void SetCheckPeriod(const TimePeriod::Ptr& tp, const MessageOrigin& origin = MessageOrigin());
|
||||
|
@ -158,8 +158,8 @@ public:
|
|||
static boost::signals2::signal<void (const Checkable::Ptr&, double, const MessageOrigin&)> OnCheckIntervalChanged;
|
||||
static boost::signals2::signal<void (const Checkable::Ptr&, double, const MessageOrigin&)> OnRetryIntervalChanged;
|
||||
static boost::signals2::signal<void (const Checkable::Ptr&, int, const MessageOrigin&)> OnMaxCheckAttemptsChanged;
|
||||
static boost::signals2::signal<void (const Checkable::Ptr&, const shared_ptr<EventCommand>&, const MessageOrigin&)> OnEventCommandChanged;
|
||||
static boost::signals2::signal<void (const Checkable::Ptr&, const shared_ptr<CheckCommand>&, const MessageOrigin&)> OnCheckCommandChanged;
|
||||
static boost::signals2::signal<void (const Checkable::Ptr&, const intrusive_ptr<EventCommand>&, const MessageOrigin&)> OnEventCommandChanged;
|
||||
static boost::signals2::signal<void (const Checkable::Ptr&, const intrusive_ptr<CheckCommand>&, const MessageOrigin&)> OnCheckCommandChanged;
|
||||
static boost::signals2::signal<void (const Checkable::Ptr&, const TimePeriod::Ptr&, const MessageOrigin&)> OnCheckPeriodChanged;
|
||||
|
||||
static boost::signals2::signal<void (const Checkable::Ptr&, const CheckResult::Ptr&, const MessageOrigin&)> OnNewCheckResult;
|
||||
|
@ -243,8 +243,8 @@ public:
|
|||
/* Event Handler */
|
||||
void ExecuteEventHandler(void);
|
||||
|
||||
shared_ptr<EventCommand> GetEventCommand(void) const;
|
||||
void SetEventCommand(const shared_ptr<EventCommand>& command, const MessageOrigin& origin = MessageOrigin());
|
||||
intrusive_ptr<EventCommand> GetEventCommand(void) const;
|
||||
void SetEventCommand(const intrusive_ptr<EventCommand>& command, const MessageOrigin& origin = MessageOrigin());
|
||||
|
||||
bool GetEnableEventHandler(void) const;
|
||||
void SetEnableEventHandler(bool enabled, const MessageOrigin& origin = MessageOrigin());
|
||||
|
@ -263,13 +263,13 @@ public:
|
|||
void SetEnablePerfdata(bool enabled, const MessageOrigin& origin = MessageOrigin());
|
||||
|
||||
/* Dependencies */
|
||||
void AddDependency(const shared_ptr<Dependency>& dep);
|
||||
void RemoveDependency(const shared_ptr<Dependency>& dep);
|
||||
std::set<shared_ptr<Dependency> > GetDependencies(void) const;
|
||||
void AddDependency(const intrusive_ptr<Dependency>& dep);
|
||||
void RemoveDependency(const intrusive_ptr<Dependency>& dep);
|
||||
std::set<intrusive_ptr<Dependency> > GetDependencies(void) const;
|
||||
|
||||
void AddReverseDependency(const shared_ptr<Dependency>& dep);
|
||||
void RemoveReverseDependency(const shared_ptr<Dependency>& dep);
|
||||
std::set<shared_ptr<Dependency> > GetReverseDependencies(void) const;
|
||||
void AddReverseDependency(const intrusive_ptr<Dependency>& dep);
|
||||
void RemoveReverseDependency(const intrusive_ptr<Dependency>& dep);
|
||||
std::set<intrusive_ptr<Dependency> > GetReverseDependencies(void) const;
|
||||
|
||||
protected:
|
||||
virtual void Start(void);
|
||||
|
@ -297,10 +297,12 @@ private:
|
|||
|
||||
/* Dependencies */
|
||||
mutable boost::mutex m_DependencyMutex;
|
||||
std::set<shared_ptr<Dependency> > m_Dependencies;
|
||||
std::set<shared_ptr<Dependency> > m_ReverseDependencies;
|
||||
std::set<intrusive_ptr<Dependency> > m_Dependencies;
|
||||
std::set<intrusive_ptr<Dependency> > m_ReverseDependencies;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* CHECKABLE_H */
|
||||
|
||||
#include "icinga/dependency.hpp"
|
||||
|
|
|
@ -41,7 +41,7 @@ enum AcknowledgementType
|
|||
abstract class Checkable : CustomVarObject
|
||||
{
|
||||
[config] Array::Ptr groups {
|
||||
default {{{ return make_shared<Array>(); }}}
|
||||
default {{{ return new Array(); }}}
|
||||
};
|
||||
[config, protected] String check_command (CheckCommandRaw);
|
||||
[config] int max_check_attempts (MaxCheckAttemptsRaw) {
|
||||
|
@ -125,10 +125,10 @@ abstract class Checkable : CustomVarObject
|
|||
};
|
||||
[state] double acknowledgement_expiry;
|
||||
[state] Dictionary::Ptr comments {
|
||||
default {{{ return make_shared<Dictionary>(); }}}
|
||||
default {{{ return new Dictionary(); }}}
|
||||
};
|
||||
[state] Dictionary::Ptr downtimes {
|
||||
default {{{ return make_shared<Dictionary>(); }}}
|
||||
default {{{ return new Dictionary(); }}}
|
||||
};
|
||||
[state] bool force_next_notification (ForceNextNotificationRaw);
|
||||
[state] int flapping_positive;
|
||||
|
|
|
@ -240,8 +240,8 @@ HostStatistics CIB::CalculateHostStats(void)
|
|||
*/
|
||||
std::pair<Dictionary::Ptr, Array::Ptr> CIB::GetFeatureStats(void)
|
||||
{
|
||||
Dictionary::Ptr status = make_shared<Dictionary>();
|
||||
Array::Ptr perfdata = make_shared<Array>();
|
||||
Dictionary::Ptr status = new Dictionary();
|
||||
Array::Ptr perfdata = new Array();
|
||||
|
||||
String name;
|
||||
Value ret;
|
||||
|
|
|
@ -40,7 +40,7 @@ void Command::SetModifiedAttributes(int flags, const MessageOrigin& origin)
|
|||
{
|
||||
if ((flags & ModAttrCustomVariable) == 0) {
|
||||
SetOverrideVars(Empty);
|
||||
OnVarsChanged(GetSelf(), GetVars(), origin);
|
||||
OnVarsChanged(this, GetVars(), origin);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ String CompatUtility::GetCheckableCommandArgs(const Checkable::Ptr& checkable)
|
|||
{
|
||||
CheckCommand::Ptr command = checkable->GetCheckCommand();
|
||||
|
||||
Dictionary::Ptr args = make_shared<Dictionary>();
|
||||
Dictionary::Ptr args = new Dictionary();
|
||||
|
||||
if (command) {
|
||||
Host::Ptr host;
|
||||
|
@ -387,7 +387,7 @@ Dictionary::Ptr CompatUtility::GetCustomAttributeConfig(const CustomVarObject::P
|
|||
{
|
||||
Dictionary::Ptr vars = object->GetVars();
|
||||
|
||||
Dictionary::Ptr varsvars = make_shared<Dictionary>();
|
||||
Dictionary::Ptr varsvars = new Dictionary();
|
||||
|
||||
if (!vars)
|
||||
return Dictionary::Ptr();
|
||||
|
@ -418,7 +418,7 @@ String CompatUtility::GetCustomAttributeConfig(const CustomVarObject::Ptr& objec
|
|||
|
||||
Array::Ptr CompatUtility::GetModifiedAttributesList(const CustomVarObject::Ptr& object)
|
||||
{
|
||||
Array::Ptr mod_attr_list = make_shared<Array>();
|
||||
Array::Ptr mod_attr_list = new Array();
|
||||
|
||||
if (object->GetType() != DynamicType::GetByName("Host") &&
|
||||
object->GetType() != DynamicType::GetByName("Service") &&
|
||||
|
|
|
@ -38,7 +38,7 @@ void CustomVarObject::SetVars(const Dictionary::Ptr& vars, const MessageOrigin&
|
|||
{
|
||||
SetOverrideVars(vars);
|
||||
|
||||
OnVarsChanged(GetSelf(), vars, origin);
|
||||
OnVarsChanged(this, vars, origin);
|
||||
}
|
||||
|
||||
int CustomVarObject::GetModifiedAttributes(void) const
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue