![]() |
ParseName() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Public Function |
Declared in: DNSParser.h |
static std::string ParseName( const char* pBuffer, const char* pOriginalBuffer, unsigned short& rLength);
Parse a DNS name
try { //Set the length to zero rLength=0; //Damn shortcuts unsigned short usShort; usShort=*((unsigned short*)pBuffer); //Convert it usShort=htons(usShort); //Check for shortcuts if (usShort & 0xc000) { //Remove the traling bits usShort=usShort & 0x3fff; //Get length of the domain unsigned short usLength; usLength=GetParsedDomainLength(pOriginalBuffer+usShort, pOriginalBuffer); //Check for errors if (!usLength) { //Report it ReportStaticError(CDNSParser_Class,"ParseName","Received zero length!"); //Exit return ""; } else { //Set the length to parsed rLength=2; //Returned the parsed name return ConvertParsedName(pOriginalBuffer+usShort, pOriginalBuffer); } } else { //Regular name //Get length of the domain unsigned short usLength; usLength=GetParsedDomainLength(pBuffer, pOriginalBuffer); //Check for errors if (!usLength) { //Report it ReportStaticError(CDNSParser_Class,"ParseName","Received zero length!"); //Exit return ""; } else { //Set the length rLength=usLength; //Returned the parsed data return ConvertParsedName(pBuffer, pOriginalBuffer); } } } ERROR_HANDLER_STATIC_RETURN(CDNSParser_Class,"ParseName","")
![]() |
Site content copyright © 2003 Komodia LTD.. See the About page for additional notices. This page last updated: 24 Feb 2003. |