void TSendSearchResponse::DoL ( ) { if ( !iContext.Node ( ).RootDevicePublished ( ) ) { return; } TUpnpMessage::TUPnPSearchRequest& reqMsg = message_cast< TUpnpMessage::TUPnPSearchRequest > ( iContext.iMessage ); RMemCell* mBuf = reqMsg.iSsdpInfo.iSearchTarget.First ( ); TPtr8 stPtr ( mBuf->Ptr( ), mBuf->Length( ), mBuf->Length( ) ); CUPnPPublishInfoElement* publishInfo = iContext.Node ( ).PublishInfo ( ); if ( stPtr.CompareF ( publishInfo->SearchTarget ( ) ) == 0 ) { // Search Response for upnp:rootdevice::uuid:device-UUID SendSearchResponseL ( publishInfo->SearchTarget ( ), iContext.Node ( ).RootDeviceUsn ( ), publishInfo->CacheControl ( ) ); } else if ( stPtr.CompareF ( publishInfo->Uuid ( ) ) == 0 ) { // Search Response for uuid:device-UUID SendSearchResponseL ( publishInfo->Uuid ( ), publishInfo->Uuid ( ), publishInfo->CacheControl ( ) ); } else { // Search Response for uuid:device-UUID::urn:domain-name-device:deviceType:v SendSearchResponseL ( stPtr, publishInfo->Usn ( ), publishInfo->CacheControl ( ) ); } reqMsg.iSsdpInfo.iSearchTarget.Free ( ); }
void CIniFileParser::DoParseIniFileL(TDesC& aIniFile) /* * * The force flush state is only updated if it is not already set to something other * than ENoValue. If force flush option is not found in ini file, force flush is set * to off. */ { TInt fileLength; TInt ret = KErrNone; RFile iniFile; // Open file User::LeaveIfError(iniFile.Open(iFs, aIniFile, EFileShareAny)); CleanupClosePushL(iniFile); // as we have been able to open the file, set the media to default. // If the ini file is parsed correctly, this then gets overwritten. // Otherwise the caller should pass thru a mesg to get the default enabled. if (iLoggingMediaString.Length() == 0) { iLoggingMediaString = KDefaultMedia; } User::LeaveIfError(iniFile.Size(fileLength)); HBufC8* iniContents = HBufC8::NewLC(fileLength); TPtr8 hbufPtr = iniContents->Des(); User::LeaveIfError(iniFile.Read(hbufPtr)); TLex8 lex(*iniContents); //OK, file is open and ready for parsing. Make a tempory array and if there is a //problem in the ini file leave settings as they were, leave, and //the error will get picked up. delete iIniSettings; iIniSettings = NULL; CIniLoggingPairs* iniSettings = CIniLoggingPairs::NewL(); CleanupStack::PushL(iniSettings); TNameTag tempTag; TNameTag tempTag2; TChar tempChar; FOREVER { ret = GetNextTokenAndCheck(lex,hbufPtr); if (ret != KErrNone) { break; } if (hbufPtr.Find(KCommentKeyword)!=KErrNotFound) //found a Comment { tempChar = lex.Get(); while (!lex.Eos() && TUint(tempChar) != KCarriageReturn && TUint(tempChar) != KLineFeed) { tempChar = lex.Get(); } } else if (hbufPtr.CompareF(KMediaKeyword)==0) //MediaSetting { User::LeaveIfError(GetNextTokenAndCheck(lex,hbufPtr)); if (hbufPtr.Length()>KMaxMediaStringLength) { User::Leave(KErrGeneral); } iLoggingMediaString = hbufPtr; } else if (hbufPtr.CompareF(KLogKeyword)==0) //LOG { User::LeaveIfError(GetNextTokenAndCheck(lex,hbufPtr)); if (hbufPtr.Length()>KMaxTagLength) { tempTag = hbufPtr.Left(KMaxTagLength); } else { tempTag = hbufPtr; } User::LeaveIfError(GetNextTokenAndCheck(lex,hbufPtr)); if (hbufPtr.Length()>KMaxTagLength) { tempTag2 = hbufPtr.Left(KMaxTagLength); } else { tempTag2 = hbufPtr; } iniSettings->AddSettingL(tempTag, tempTag2); } else if (hbufPtr.CompareF(KForceFlushKeyword)==0) //ForceFlush { if (iForceFlushState == ENoValue) { iForceFlushState = EFlushOn; } } else if (hbufPtr.CompareF(KLogPathKeyword) == 0) //LogPath { User::LeaveIfError(GetNextTokenAndCheck(lex,hbufPtr)); if (hbufPtr.Length()>KMaxName) { User::Leave(KErrOverflow); } iLoggingPathString.Copy(hbufPtr); } else if (hbufPtr.CompareF(KWin32DbgPortKeyword)==0) //Win32DebugPort { iWin32DebugEnabled = ETrue; } else User::Leave(KErrBadName); if (lex.Eos()) { break; } } iIniSettings = iniSettings; CleanupStack::Pop(iniSettings); CleanupStack::PopAndDestroy(); //iniContents CleanupStack::PopAndDestroy(); //iniFile if (iForceFlushState == ENoValue) { iForceFlushState = EFlushOff; } }