![]() |
GetParsedDomainLength() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Private Function |
Declared in: DNSParser.h |
static unsigned short GetParsedDomainLength( const char *pBuffer, const char* pOriginalBuffer);
Get the size of the string
try { //Get the length of the parsed domain const unsigned char* pBackupBuffer=(const unsigned char*)pBuffer; //Counter unsigned short usCounter; usCounter=0; while (*pBackupBuffer && usCounter<256) { if (pOriginalBuffer) { //Damn shortcuts unsigned short usShort; usShort=*((unsigned short*)pBackupBuffer); //Convert it usShort=htons(usShort); //Check for shortcuts if (usShort & 0xc000) { //Remove the traling bits usShort=usShort & 0x3fff; //Check the size if (usShort>MAX_REPLY) { //Report it ReportStaticError(CDNSParser_Class,"GetParsedDomainLength","Size too big!"); //Exit return 0; } //Get length of the domain unsigned short usLength; usLength=GetParsedDomainLength(pOriginalBuffer+usShort, pOriginalBuffer); //Check for errors if (!usLength) { //Report it ReportStaticError(CDNSParser_Class,"GetParsedDomainLength","Received zero length!"); //Exit return 0; } else { //We are done usCounter+=usLength; //And exit return usCounter+1; } } } //Regular usCounter+=*pBackupBuffer+1; pBackupBuffer+=*pBackupBuffer+1; } //Check for errors if (usCounter>256) { //Report it ReportStaticError(CDNSParser_Class,"GetParsedDomainLength","Recieved length too high!"); //Exit return 0; } else return usCounter+1; } ERROR_HANDLER_STATIC_RETURN(CDNSParser_Class,"GetParsedDomainLength",0)
![]() |
Site content copyright © 2003 Komodia LTD.. See the About page for additional notices. This page last updated: 24 Feb 2003. |