Class KomodiaDNS::CDNSAnswer::
ParseSOA()
Base ClassesData ItemsConstructorsDestructorsFunctionsCustom CodeGo to hierarchy chart    Prev page: ParseBufferNext page: SetAnswerType    Show member index
Private Function Declared in:
DNSAnswer.h

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

DNSSOARecord * ParseSOA(
    unsigned short usSOASize,
    const char* pBuffer,
    const char* pOriginalBuffer);

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

Parse the SOA

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

try
{
    //Backup buffer
    const char* pBackupBuffer=pBuffer;

    //The record
    DNSSOARecord* pRecord;
    pRecord=new DNSSOARecord;

    //Protect it
    std::auto_ptr<DNSSOARecord> pProtection(pRecord);

    //Start parsing the names
    unsigned short usLength;
    pRecord->sPrimaryNameServer=CDNSParser::ParseName(pBuffer,
                                                      pOriginalBuffer,
                                                      usLength);
    //Check the size
    if (!usLength)
    {
        //Report it
        ReportError("ParseSOA","Failed to parse primary name server!");

        //Exit
        return NULL;
    }

    //Increase our position
    pBuffer+=usLength;

    //Try to parse
    pRecord->sAuthorativeMailbox=CDNSParser::ParseName(pBuffer,
                                                       pOriginalBuffer,
                                                       usLength);

    //Check the size
    if (!usLength)
    {
        //Report it
        ReportError("ParseSOA","Failed to parse authorative mailbox!");

        //Exit
        return NULL;
    }

    //Set backup buffer
    pBackupBuffer+=usSOASize-DNSSOARecordCopySize;

    //Copy rest of the data
    memcpy(&pRecord->ulVersionNumber,
           pBackupBuffer,
           DNSSOARecordCopySize);

    //Reverse the header
    pRecord->ulVersionNumber=htonl(pRecord->ulVersionNumber);
    pRecord->ulRefreshInterval=htonl(pRecord->ulRefreshInterval);
    pRecord->ulRetryInterval=htonl(pRecord->ulRetryInterval);
    pRecord->ulExpirationLimit=htonl(pRecord->ulExpirationLimit);
    pRecord->ulMinimumTTL=htonl(pRecord->ulMinimumTTL);

    //Release the protection
    pProtection.release();

    //Done
    return pRecord;
}
ERROR_HANDLER_RETURN("ParseSOA",NULL)

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