Exemple #1
0
std::string GraphData::getNodeData( const uint32_t & ip )
{
	std::vector< std::string > names = getDNSInfo( ip );
	BandwidthStats bandwidth;
	std::stringstream connections;
	bandwidth.outgoing = getOutgoingBandwidth( ip, connections );
	bandwidth.incomming = getIncommingBandwidth( ip, connections );
	bandwidth.total = bandwidth.incomming + bandwidth.outgoing;
	std::stringstream packet;
	packet << "<Information>" << std::endl;
   packet << "<IP>" << inet_ntoa( *((struct in_addr*)&ip) ) << "</IP>" << std::endl;
   std::vector< std::string >::iterator itr;
   for( itr = names.begin(); itr != names.end(); ++itr )
   {
      packet << "<DNS>" << *itr << "</DNS>" << std::endl;
   }

   packet << "<Bandwidth>" << std::endl;
   packet << "<Total>" << bandwidth.total << "</Total>" << std::endl;
   packet << "<Incomming>" << bandwidth.incomming << "</Incomming>" << std::endl;
   packet << "<Outgoing>" << bandwidth.outgoing << "</Outgoing>" << std::endl;
   packet << "</Bandwidth>" << std::endl;

   packet << "<Connections>" << std::endl;
   packet << connections.str();
   packet << "</Connections>" << std::endl;
   packet << "</Information>" << std::endl;

	return packet.str();
}
Exemple #2
0
//------------------------------------------------------------------------------
// FUNCTION:   DNSService
//
// REMARKS:    Constructor for DNSService Class
//------------------------------------------------------------------------------
DNSService::DNSService(void)
{
#ifdef DNSPROVIDER_DEBUG
    cout << "DNSService::DNSService()" << endl;
#endif

    if(!getDNSInfo())
        throw CIMObjectNotFoundException("DNSService "
                  "can't create PG_DNSService instance");
}