CompatIDO: implement first draft of {en,dis}able objects supported in ido2db 1.8 refs #3157

This commit is contained in:
Michael Friedrich 2012-10-03 01:25:44 +02:00
parent 3c36a3c0fb
commit 1b0a482742
2 changed files with 74 additions and 0 deletions

View File

@ -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<String, vector<String > > hgt;
@ -673,6 +740,8 @@ void CompatIdoComponent::DumpConfigObjects(void)
}
DumpServiceObject(service);
//FIXME remove me, debug only XXX
//DisableServiceObject(service);
}
pair<String, vector<Service::Ptr> > sgt;

View File

@ -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);