![]() |
Parse() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Public Function |
Declared in: DNSQuery.h |
int Parse( const char* pBuffer, int iNumber);
Parse a buffer
try { //Our backup buffer for iterations const char* pBackupBuffer; pBackupBuffer=pBuffer; //Start to iterate the data for (int iCount=0;iCount<iNumber;++iCount) { //Try to parse the name std::string sParsedName; //The parsed length unsigned short usLength; //Parse it sParsedName=CDNSParser::ParseName(pBuffer, pBuffer, usLength); //Check the length if (!usLength) { //Report it ReportError("Parse","Received zero length!"); //Exit return NULL; } //Add it to our header DnsQuestionHeader aData; //Set the string name aData.sName=sParsedName; //Increase backup length pBackupBuffer+=usLength; //Get the rest of the data memcpy(&aData.usType, pBackupBuffer, DnsQuestionCopyHeader); //Reverse the two filds aData.usClass=htons(aData.usClass); aData.usType=htons(aData.usType); //Add it to the question vector m_aQueries.push_back(aData); //Increase the buffer pBackupBuffer+=DnsQuestionCopyHeader; } //Done return pBackupBuffer-pBuffer; } ERROR_HANDLER_RETURN("Parse",0)
![]() |
Site content copyright © 2003 Komodia LTD.. See the About page for additional notices. This page last updated: 24 Feb 2003. |