From 1b0a482742d5b18a95fc9db6e7a151da616e8cf4 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Wed, 3 Oct 2012 01:25:44 +0200 Subject: [PATCH] CompatIDO: implement first draft of {en,dis}able objects supported in ido2db 1.8 refs #3157 --- components/compatido/compatidocomponent.cpp | 69 +++++++++++++++++++++ components/compatido/compatidocomponent.h | 5 ++ 2 files changed, 74 insertions(+) diff --git a/components/compatido/compatidocomponent.cpp b/components/compatido/compatidocomponent.cpp index 6a663c8c8..d61490ec2 100644 --- a/components/compatido/compatidocomponent.cpp +++ b/components/compatido/compatidocomponent.cpp @@ -243,6 +243,71 @@ void CompatIdoComponent::EndConfigDump(void) m_IdoSocket->SendMessage(message.str()); } +/** + * enables host config object in ido + */ +void CompatIdoComponent::EnableHostObject(const Host::Ptr& host) +{ + stringstream message; + message << "\n" + << 500 << ":" << "\n" /* enableobject */ + << 4 << "=" << std::setprecision(17) << Utility::GetTime() << "\n" /* timestamp */ + << 53 << "=" << host->GetName() << "\n" /* host */ + << 999 << "\n\n"; /* enddata */ + + m_IdoSocket->SendMessage(message.str()); +} + +/** + * enables service config object in ido + */ +void CompatIdoComponent::EnableServiceObject(const Service::Ptr& service) +{ + stringstream message; + message << "\n" + << 500 << ":" << "\n" /* enableobject */ + << 4 << "=" << std::setprecision(17) << Utility::GetTime() << "\n" /* timestamp */ + << 53 << "=" << service->GetHost()->GetName() << "\n" /* host */ + << 114 << "=" << service->GetAlias() << "\n" /* service */ + << 999 << "\n\n"; /* enddata */ + + m_IdoSocket->SendMessage(message.str()); +} + +/** + * disables host config object in ido + */ +void CompatIdoComponent::DisableHostObject(const Host::Ptr& host) +{ + stringstream message; + message << "\n" + << 501 << ":" << "\n" /* disableobject */ + << 4 << "=" << std::setprecision(17) << Utility::GetTime() << "\n" /* timestamp */ + << 53 << "=" << host->GetName() << "\n" /* host */ + << 999 << "\n\n"; /* enddata */ + + m_IdoSocket->SendMessage(message.str()); +} + +/** + * disables service config object in ido + */ +void CompatIdoComponent::DisableServiceObject(const Service::Ptr& service) +{ + stringstream message; + message << "\n" + << 501 << ":" << "\n" /* disableobject */ + << 4 << "=" << std::setprecision(17) << Utility::GetTime() << "\n" /* timestamp */ + << 53 << "=" << service->GetHost()->GetName() << "\n" /* host */ + << 114 << "=" << service->GetAlias() << "\n" /* service */ + << 999 << "\n\n"; /* enddata */ + + m_IdoSocket->SendMessage(message.str()); +} + + + + /** * dump host config to ido * @@ -629,6 +694,8 @@ void CompatIdoComponent::DumpConfigObjects(void) } DumpHostObject(host); + //FIXME remove me, debug only XXX + //DisableHostObject(host); } pair > hgt; @@ -673,6 +740,8 @@ void CompatIdoComponent::DumpConfigObjects(void) } DumpServiceObject(service); + //FIXME remove me, debug only XXX + //DisableServiceObject(service); } pair > sgt; diff --git a/components/compatido/compatidocomponent.h b/components/compatido/compatidocomponent.h index 1f319b442..4a3fd3345 100644 --- a/components/compatido/compatidocomponent.h +++ b/components/compatido/compatidocomponent.h @@ -53,6 +53,11 @@ private: void StartConfigDump(void); void EndConfigDump(void); + void EnableHostObject(const Host::Ptr& host); + void EnableServiceObject(const Service::Ptr& service); + void DisableHostObject(const Host::Ptr& host); + void DisableServiceObject(const Service::Ptr& service); + void DumpConfigObjects(void); void DumpHostObject(const Host::Ptr& host); void DumpServiceObject(const Service::Ptr& service); -- 2.50.1