Class KomodiaDNS::CDNSAnswers::
Parse()
Base ClassesData ItemsConstructorsDestructorsFunctionsCustom CodeGo to hierarchy chart    Prev page: operator =Next page: ParseAnswers    Show member index
Public Function Declared in:
DNSAnswers.h

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

int Parse(
    const char *pBuffer,
    int iLength);

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

Parse the answers

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

try
{
    //Delete previous data
    UnInitialize();

    if (iLength<=DnsHeaderHeaderLength)
    {
        //Report it
        ReportError("Parse","Buffer size too small!");

        //Exit
        return 0;
    }

    //Start parsing the dude
    const char* pBackupBuffer=pBuffer;

    //Let's start with the answer
    memcpy(&m_aDNSHeader,
           pBackupBuffer,
           DnsHeaderHeaderLength);

    //Reverse the header
    ReverseHeader();

    //Increase the buffer
    pBackupBuffer+=DnsHeaderHeaderLength;

    //OK now we can continue
    m_pDNSQuery=new CDNSQuery;

    //Get the number of data the query parsed !
    unsigned short usParseLength;

    //Parse it
    usParseLength=m_pDNSQuery->Parse(pBackupBuffer,
                                     m_aDNSHeader.usQDCount);

    //Check for errors
    if (!usParseLength)
    {
        //Report it
        ReportError("Parse","Received zero length!");

        //Exit
        return 0;
    }

    //Increase the buffer
    pBackupBuffer+=usParseLength;

    //Parse the rest of the headers
    return ParseAnswers(pBackupBuffer,
                        pBuffer);
}
ERROR_HANDLER_RETURN("Parse",0)

'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.