![]() |
ParseSOA() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Private Function |
Declared in: DNSAnswer.h |
DNSSOARecord * ParseSOA( unsigned short usSOASize, const char* pBuffer, const char* pOriginalBuffer);
Parse the SOA
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)
![]() |
Site content copyright © 2003 Komodia LTD.. See the About page for additional notices. This page last updated: 24 Feb 2003. |