Class KomodiaDNS::CDNSAnswers::
GetAIPAnswers()
Base ClassesData ItemsConstructorsDestructorsFunctionsCustom CodeGo to hierarchy chart    Prev page: GetAIPAnswerNext page: GetAnswer    Show member index
Public Function Declared in:
DNSAnswers.h

'Declaration' icon -- Shortcut to top of page. Declaration

CDNSAnswers::IPAnswersVector GetAIPAnswers() const;

'Description' icon -- Shortcut to top of page. Description

Get all the A/IP answers

'Function Body' icon -- Shortcut to top of page. Function Body

//Empty vector
static IPAnswersVector aEmptyVector;

try
{
    //Our vector
    IPAnswersVector aVector;

    //Do we have an answer ?
    if (!m_aDNSHeader.usANCount ||
        m_aAnswers.empty())
        return aVector;

    //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::A)
        {
            //Get the data
            std::string sData;
            sData=rAnswer.GetData();

            //Convert it to long
            aVector.push_back(atol(sData.c_str()));
        }
        else if (rAnswer.GetResourceType()==CDNSQuery::MX &&
                 m_aDNSHeader.usARCount)
        {
            //Look for the additional resources
            int iPos;
            iPos=m_aDNSHeader.usANCount+
                 m_aDNSHeader.usNSCount;

            //Our data
            std::string sData;
            sData=rAnswer.GetData();

            //Loop them
            for (int iCount=0;
                 iCount<m_aDNSHeader.usARCount;
                 iCount++)
            {
                //Get the answer
                const CDNSAnswer& rARAnswer=m_aAnswers[iCount+iPos];

                //Is it an A record? (may have more then one A record per type)
                if (rARAnswer.GetResourceType()==CDNSQuery::A &&
                    rARAnswer.GetName()==sData)
                    //This is us
                    aVector.push_back(atol(rARAnswer.GetData().c_str()));
            }
        }
    }

    //Done
    return aVector;
}
ERROR_HANDLER_RETURN("GetAIPAnswers",aEmptyVector)

'See Also' icon -- Shortcut to top of page. See Also

Class Overview Class Overview  |  Public base class CErrorHandler  |  Hierarchy Chart Hierarchy Chart


Get Surveyor!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.