110 lines
2.1 KiB
C++

//----------------------------------------------------------------------------
//
// Copyright (C) Intel Corporation, 2006 - 2007.
//
// File: DataStructures.cpp
//
// Contents: General DataStructures
//
// Notes:
//----------------------------------------------------------------------------
#include "DataStructures.h"
#include <ace/INET_Addr.h>
#include <sstream>
#define MAX_ADDRESS_LEN 300 // to be precise should probably be 262
string ServerData::getAddressStr() const {
stringstream str;
str << _hostname << ":" << _port;
return str.str();
}
//-----------------------------------------
// Deletes MC subscribers list
//-----------------------------------------
MCList::~MCList()
{
clearList();
}
void MCList::clearList()
{
MCList::iterator mc_data_iterator;
try
{
for(mc_data_iterator = MCList::begin();
mc_data_iterator != MCList::end();
mc_data_iterator++)
{
delete (*mc_data_iterator);
}
clear();
}
catch(...)
{
ACE_DEBUG((MY_DEBUG
ACE_TEXT("~MCList::clearList: got exception\n")));
}
}
//-----------------------------------------
// Deletes AuthServerHash
//-----------------------------------------
AuthServerHash::~AuthServerHash()
{
AuthServerHash::iterator auth_data_iterator;
try
{
for(auth_data_iterator = AuthServerHash::begin();
auth_data_iterator != AuthServerHash::end();
auth_data_iterator++)
{
delete (*auth_data_iterator).second;
}
AuthServerHash::clear();
}
catch(...)
{
ACE_DEBUG((MY_DEBUG
ACE_TEXT("~AuthServerHash: got exception\n")));
}
}
void AuthServerHash::clearHash()
{
AuthServerHash::iterator auth_data_iterator;
try
{
for(auth_data_iterator = AuthServerHash::begin();
auth_data_iterator != AuthServerHash::end();
auth_data_iterator++)
{
delete (*auth_data_iterator).second;
}
clear();
}
catch(...)
{
ACE_DEBUG((MY_DEBUG
ACE_TEXT("AuthServerHash::clearHash: got exception\n")));
}
}
STATUS ServerData::validateINETdata() const
{
ACE_INET_Addr address;
if (address.set(_port, _hostname.c_str()) != STATUS_SUCCESS)
{
return STATUS_FAILURE;
}
return STATUS_SUCCESS;
}