![]() |
GetAnswers() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
| Public Function |
Declared in: DNSAnswers.h |
DeclarationCDNSAnswers::StringAnswersVector GetAnswers() const;
DescriptionGet all the answers
Function Body
//Empty vector
static StringAnswersVector aEmptyVector;
try
{
//Our vector
StringAnswersVector aVector;
//Do we have an answer ?
if (!m_aDNSHeader.usANCount ||
m_aAnswers.empty())
return aEmptyVector;
//Iterate the answers
for (int iCount=0;
iCount<m_aDNSHeader.usANCount;
++iCount)
{
//Get the answer
const CDNSAnswer& rAnswer=m_aAnswers[iCount];
//Check what type is it ?
if (rAnswer.GetResourceType()==CDNSQuery::PTR ||
rAnswer.GetResourceType()==CDNSQuery::MX)
{
//Get the data
std::string sData;
sData=rAnswer.GetData();
//Add it
aVector.push_back(sData);
}
else if (rAnswer.GetResourceType()==CDNSQuery::A)
{
//Get the data
std::string sData;
sData=rAnswer.GetData();
//Convert to DWORD
DWORD dwIP;
dwIP=atof(sData.c_str());
//Convert to string
//Add it
aVector.push_back(CSpoofBase::LongToStdString(dwIP));
}
}
//Done
return aVector;
}
ERROR_HANDLER_RETURN("GetAnswers",aEmptyVector)
See Also
This web site was generated
using Surveyor V4.50.811.1. Click
here
for more information. |
Site content copyright © 2003 Komodia LTD.. See the About page for additional notices. This page last updated: 24 Feb 2003. |