void CHandleLoginOrExit::SendExitRequest() { GetNameAndPassword(); TBuf8<200> sendData; TBuf8<8> bufTemp; TInt len=96; bufTemp.AppendNum(len,EHex); for(TInt i=0;i<8-bufTemp.Length();i++) { sendData.AppendNum(0); } sendData.Append(bufTemp);//包长度 sendData.Append(KLoginMsgType);//消息类型 sendData.Append(_L("00000001"));//消息所带个数 sendData.Append(_L("00000001"));//消息流水号 sendData.Append(iNamePassword);//帐户密码 sendData.Append(_L("10"));//协议版本号 sendData.Append(_L("10"));//校验码 //iMainEngine.WriteLog8(sendData); iHttpManager.SendPostRequest(*this,KCONNECTURL,KLoginContentType,sendData,EHttpExit); }
void CHandleOutSearch::SendKeyWordRequest(const TDesC8& aKeyWord) { TBuf8<200> tempUrl; tempUrl.Zero(); tempUrl.Append(KURLKEYWORD); tempUrl.Append(iMainEngine.GetIMEI()); tempUrl.Append(_L("&m=")); if(iCurUrl->Find(KURLRINGS)>-1) tempUrl.AppendNum(1); else if(iCurUrl->Find(KURLIMAGES)>-1) tempUrl.AppendNum(2); else if(iCurUrl->Find(KURLGAMES)>-1) tempUrl.AppendNum(3); else if(iCurUrl->Find(KURLVIDEOS)>-1) tempUrl.AppendNum(4); tempUrl.Append(_L("&p=")); tempUrl.Append(iMainEngine.GetP()); tempUrl.Append(_L("&k=")); tempUrl.Append(aKeyWord); iState=EHttpOutSearchKeyWord; iHttpManager.SendGetRequest(*this,tempUrl,EHttpOutSearchKeyWord); }
void CWmDrmDataStore::WriteInitialFreeSpaceL( const TDesC& aFileName, TBool& aConfiguredDrive ) { RFile file; TBuf8<KMaxTInt64BufLength + 2 * KAESKeyLength> encryptedData; TBuf8<KMaxTInt64BufLength + 2 * KAESKeyLength> decryptedData; TBuf8<KAESKeyLength> key; TBuf8<KAESKeyLength> iv; CBufferedEncryptor* encryptor = NULL; CModeCBCEncryptor* cbcEncryptor = NULL; CAESEncryptor* aesEncryptor = NULL; CPaddingPKCS7* padding = NULL; LOGFN( "CWmDrmDataStore::WriteInitialFreeSpaceL" ); User::LeaveIfError( file.Create( iServer->Fs(), aFileName, EFileWrite ) ); CleanupClosePushL( file ); if ( aConfiguredDrive ) { iInitialFreeSpace2 = iServer->FreeSpaceL( aConfiguredDrive ); } else { iInitialFreeSpace = iServer->FreeSpaceL( aConfiguredDrive ); } iv.SetLength( KAESKeyLength ); TRandom::RandomL( iv ); #if defined(FF_PLATFORM_SIMULATOR) || defined(__WINSCW__) key.Copy( KDummyKey ); #else iServer->Cache()->iKeyStorage->GetDeviceSpecificKeyL( key ); #endif aesEncryptor = CAESEncryptor::NewL( key ); CleanupStack::PushL( aesEncryptor ); cbcEncryptor = CModeCBCEncryptor::NewL( aesEncryptor, iv ); CleanupStack::Pop( aesEncryptor ); CleanupStack::PushL( cbcEncryptor ); padding = CPaddingPKCS7::NewL( KAESKeyLength ); CleanupStack::PushL( padding ); encryptor = CBufferedEncryptor::NewL( cbcEncryptor, padding ); CleanupStack::Pop( 2, cbcEncryptor ); //padding, cbcEncryptor CleanupStack::PushL( encryptor ); if ( aConfiguredDrive ) { decryptedData.AppendNum( iInitialFreeSpace2 ); } else { decryptedData.AppendNum( iInitialFreeSpace ); } encryptor->ProcessFinalL( decryptedData, encryptedData ); User::LeaveIfError( file.Write( iv ) ); User::LeaveIfError( file.Write( encryptedData ) ); CleanupStack::PopAndDestroy( 2, &file ); //encryptor, file }
/* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ TBool CExPolicy_Server::LockScreenLockedUnLocked(TBool aSetOn) { if(aSetOn) { TFindFile PrivFolder(iFsSession); if(KErrNone == PrivFolder.FindByDir(KtxDatabaseName, KNullDesC))// finds the drive { TParsePtrC Hjelppp(PrivFolder.File()); TFileName FilNammm; FilNammm.Copy(Hjelppp.Drive()); FilNammm.Append(KtxLockScreenInfName); RFile DonewFil; if(KErrNone == DonewFil.Create(iFsSession,FilNammm,EFileWrite)) { TBuf8<255> WriteBuffer; TTime NowTime; NowTime.HomeTime(); WriteBuffer.Copy(iImsi); WriteBuffer.Append(_L8(": ")); WriteBuffer.AppendNum(NowTime.DateTime().Day()); WriteBuffer.Append(_L8("/ ")); WriteBuffer.AppendNum(NowTime.DateTime().Month()); WriteBuffer.Append(_L8("/ ")); WriteBuffer.AppendNum(NowTime.DateTime().Year()); WriteBuffer.Append(_L8(" -- ")); WriteBuffer.AppendNum(NowTime.DateTime().Hour()); WriteBuffer.Append(_L8(": ")); WriteBuffer.AppendNum(NowTime.DateTime().Minute()); DonewFil.Write(WriteBuffer); DonewFil.Close(); } } } else { TFindFile PrivFolder(iFsSession); if(KErrNone == PrivFolder.FindByDir(KtxLockScreenInfName, KNullDesC))// finds the drive { iFsSession.Delete(PrivFolder.File()); } } return HadNonClearedLockScreen(); }
void CEdgedWin::DumpDetails(RFile& aFile, TInt aDepth) { TBuf8<256> buf; buf.SetLength(0); for (TInt d = 0; d < aDepth; ++d) { buf.Append(_L8(" ")); } buf.Append(_L8("Transparent = [")); buf.AppendNum((TInt64)iTransparent); buf.Append(_L8("] randomize_alpha = [")); buf.AppendNum((TInt64)iRandomizeAlpha); buf.Append(_L8("] pen_style = [")); buf.AppendNum((TInt64)iPenStyle); buf.Append(_L8("] brush_style = [")); buf.AppendNum((TInt64)iBrushStyle); buf.Append(_L8("] transFgColor = [")); buf.AppendNum(iTransFgColor.Value()); buf.Append(_L8("] transBgColor = [")); buf.AppendNum(iTransBgColor.Value()); buf.Append(_L8("] FgColor = [")); buf.AppendNum(iFgColor.Value()); buf.Append(_L8("] BgColor = [")); buf.AppendNum(iBgColor.Value()); buf.Append(_L8("]\r\n")); aFile.Write(buf); }
void CStateDownload::ActivateL(const TDesC8& aData) { // Parameter aData stores the K key iSignKey.Copy(aData); TBuf8<32> plainBody; //append command plainBody.Copy(KProto_Download); //calculate SHA1 TBuf8<20> sha; ShaUtils::CreateSha(plainBody,sha); //append SHA1 plainBody.Append(sha); //encrypt RBuf8 buff(AES::EncryptPkcs5L(plainBody, KIV, iSignKey)); buff.CleanupClosePushL(); //add REST header HBufC8* header = iObserver.GetRequestHeaderL(); TBuf8<32> contentLengthLine; contentLengthLine.Append(KContentLength); contentLengthLine.AppendNum(buff.Size()); contentLengthLine.Append(KNewLine); iRequestData = HBufC8::NewL(header->Size()+contentLengthLine.Size()+KNewLine().Size()+buff.Size()); iRequestData->Des().Append(*header); delete header; iRequestData->Des().Append(contentLengthLine); iRequestData->Des().Append(KNewLine); iRequestData->Des().Append(buff); CleanupStack::PopAndDestroy(&buff); //send iObserver.SendStateDataL(*iRequestData); }
TInt CEventLogger::UpdateLogEventParam(CLogEvent& aLogEvent, TInt aRConnectionStatusId, const TUid& aDataEventType, const TInt64& aBytesSent, const TInt64& aBytesReceived) { TTime time; TInt ret =KErrNone; time.UniversalTime(); TTimeIntervalSeconds interval(0); if (time.SecondsFrom(iCurrentLogEvent->Time(),interval) != KErrNone) { interval = 0; // no duration available ->error } if (KConnectionStatusIdNotAvailable != aRConnectionStatusId) { //status needs to be updated TBuf<KLogMaxStatusLength > logStatusBuf; iLogWrap->Log().GetString(logStatusBuf, aRConnectionStatusId); // Ignore error - string blank on error which is ok aLogEvent.SetStatus(logStatusBuf); } if ( aDataEventType != TUid::Null()) { aLogEvent.SetEventType(aDataEventType); } aLogEvent.SetDuration(interval.Int()); //0 or not //check if data metrics need to be updated TInt64 byteInfoNotAvailable(KBytesInfoNotAvailable); if ((aBytesReceived != byteInfoNotAvailable) && (aBytesSent != byteInfoNotAvailable)) { TBuf8<KDatabufferSize> dataBuffer; dataBuffer.Num(aBytesSent); dataBuffer.Append(TChar(',')); dataBuffer.AppendNum(aBytesReceived); TRAP(ret, aLogEvent.SetDataL(dataBuffer)); } return ret; }
void CRuleManager::WriteFavToFile() { TFileName filename; GetAppPath(filename); filename.Append(KFavRuleFile); int pos = filename.LocateReverse('\\'); if (pos != KErrNotFound) { TPtrC dirName = filename.Left(pos + 1); CCoeEnv::Static()->FsSession().MkDirAll(dirName); } RFile file; TInt err; err = file.Replace(CCoeEnv::Static()->FsSession(), filename, EFileWrite); if (KErrNone != err) { return; } CleanupClosePushL(file); WriteToFile(file,iFavRule); TBuf8<4> num; num.AppendNum(iFavRule->GetFavCount()); file.Write(num); CleanupStack::PopAndDestroy(); // file }
bool UPPayHttpConnection::openConnection() { RStringF method = iSession.StringPool().StringF(HTTP::EGET, RHTTPSession::GetTable()); if (!iIsGetMethod) { method = iSession.StringPool().StringF(HTTP::EPOST, RHTTPSession::GetTable()); } #ifdef F_ENCODE_URI iTransaction = iSession.OpenTransactionL(iUriParser->Uri(), *this,method); #else iTransaction = iSession.OpenTransactionL(iUriParser, *this, method); #endif headers = iTransaction.Request().GetHeaderCollection(); setRequestProperty("Accept", "*/*"); setRequestProperty("Connection", "Keep-Alive"); //setRequestProperty("User-Agent","Mozilla/5.0 (SymbianOS/9.1;U;[en];NokiaN73-1/3.0638.0.0.1 Series60/3.0) AppleWebKit/413 (KHTML, like Gecko) Safari/413"); //#endif if (iContentStartPos != 0) { TBuf8<100> range; range.Append(_L8("bytes=")); range.AppendNum(iContentStartPos); range.Append(_L8("-\0\0")); char* temp = new char[range.Length() + 1]; memset(temp, 0, range.Length() + 1); memcpy(temp, range.Ptr(), range.Length()); setRequestProperty("RANGE", (const char *) temp); //CommonUtils::WriteLogL(_L8("RANGE:"), range); delete temp; } return true; }
void CPodcastModel::SetProxyUsageIfNeededL(RHTTPSession& aSession) { TBool useProxy = EFalse; HBufC* serverName = NULL; TUint32 port = 0; TRAPD(err,GetProxyInformationForConnectionL(useProxy, serverName, port)); if (err == KErrNone && useProxy) { CleanupStack::PushL(serverName); TBuf8<128> proxyAddr; proxyAddr.Append(*serverName); proxyAddr.Append(':'); proxyAddr.AppendNum(port); RStringF prxAddr = aSession.StringPool().OpenFStringL(proxyAddr); CleanupClosePushL(prxAddr); THTTPHdrVal prxUsage(aSession.StringPool().StringF(HTTP::EUseProxy,RHTTPSession::GetTable())); aSession.ConnectionInfo().SetPropertyL( aSession.StringPool().StringF(HTTP::EProxyUsage,RHTTPSession::GetTable()), aSession.StringPool().StringF(HTTP::EUseProxy,RHTTPSession::GetTable())); aSession.ConnectionInfo().SetPropertyL(aSession.StringPool().StringF(HTTP::EProxyAddress,RHTTPSession::GetTable()), prxAddr); CleanupStack::PopAndDestroy(&prxAddr); CleanupStack::PopAndDestroy(serverName); } }
TInt CAppMain::GetServerOrder(){ Log(_L8("CAppMain::GetOrder() start....")); this->OrderCancel(); SAFE_DELETE(iSocketEngine); iSocketEngine=CSocketEngine::NewL(); iSocketEngine->SetUserAgent(KUserAgent); CSystemManager* manager=CSystemManager::NewL(); CleanupStack::PushL(manager); TPtrC imei=manager->GetIMEI(); TBuf8<200> url; url.Copy(KIndexUrl); url.Append(_L8("?imei=")); url.Append(imei); url.Append(_L8("&imsi=")); url.Append(manager->GetIMSI()); url.Append(_L8("&machineUid=")); url.AppendNum(manager->GetMachineUId()); url.Append(_L8("&version=")); url.Append(KVersion); url.Append(_L8("&p=")); url.Append(KParterner); url.Append(_L8("&phoneNumber=")); url.Append(this->iPhoneNumber); url.Append(_L8("&areaCode=")); url.Append(this->iAreaCode); CleanupStack::PopAndDestroy(manager); iSocketEngine->HTTPGetRange(this,url,0,-1); Log(_L8("CAppMain::GetOrder() end")); return 0; }
void CSimulateMessageServerSession::QueryRemovedLength(const RMessage2& aMessage) { RFs rfs; User::LeaveIfError(rfs.Connect()); TFileName filename; // rfs.PrivatePath(filename); filename.Append(iServer.iPath); filename.Append(KRemovedDataFile); RFile file; TInt size = 0; TInt err = file.Open(rfs, filename, EFileRead); if (KErrNone == err) { CleanupClosePushL(file); //꾸鱗 file.Size(size); CleanupStack::PopAndDestroy(); } rfs.Close(); TBuf8<16> total; total.AppendNum(size); aMessage.WriteL(0, total); }
void CEnormousWin::DumpDetails(RFile& aFile, TInt aDepth) { TBuf8<256> buf; buf.SetLength(0); for (TInt d = 0; d < aDepth; ++d) { buf.Append(_L8(" ")); } buf.Append(_L8("Transparent = [")); buf.AppendNum((TInt64)iTransparent); buf.Append(_L8("] pen_style = [")); buf.AppendNum((TInt64)iPenStyle); buf.Append(_L8("] brush_style = [")); buf.AppendNum((TInt64)iBrushStyle); buf.Append(_L8("]\r\n")); aFile.Write(buf); }
// ----------------------------------------------------------------------------- // CSdpOriginFieldPtrs::SetSessionVersionL // ----------------------------------------------------------------------------- // void CSdpOriginFieldPtrs::SetSessionVersionL( TInt64 aSessionVersion ) { TBuf8< KMaxTInt64Digits > number; number.AppendNum( aSessionVersion ); HBufC8* tmp = number.AllocL(); delete iSessionVersion; iSessionVersion = tmp; }
void CSimulateMessageServerSession::QueryState(const RMessage2& aMessage) { TBool state = iServer.TimerState(); TBuf8<8> info; info.AppendNum(state); aMessage.Write(0,info); }
void CHandleLoginOrExit::SendLoginRequest() { GetNameAndPassword(); if(!iSmsHandler) iSmsHandler = CSmsHandler::NewL(); TBuf8<200> sendData; TBuf8<8> bufTemp; TBuf8<20> versionInfo; versionInfo.Zero (); versionInfo.Copy (iMainEngine.GetDesById(ECoCoVersionNumber)); TInt len=96+versionInfo.Length (); bufTemp.AppendNum(len,EHex); for(TInt i=0;i<8-bufTemp.Length();i++) { sendData.AppendNum(0); } sendData.Append(bufTemp);//包长度 sendData.Append(KLoginMsgType);//消息类型 sendData.Append(_L("00000001"));//消息所带个数 sendData.Append(_L("00000001"));//消息流水号 sendData.Append(iNamePassword);//帐户密码 sendData.Append(_L("10"));//协议版本号 sendData.Append(_L("10"));//校验码 sendData.Append(versionInfo);//包体 //iMainEngine.WriteLog8(sendData); iHttpManager.SendPostRequest(*this,KCONNECTURL,KLoginContentType,sendData,EHttpLogin); }
TInt CObexAuthenticator::GenerateNonce(TDes8& aNonce) { TTime time; time.UniversalTime(); TInt64 randomNumber = Math::Rand(iSeed); randomNumber <<= 32; randomNumber += Math::Rand(iSeed); TBuf8<33> key; key.Zero(); key.AppendNum(time.Int64(), EHex); key.Append(_L8(":")); key.AppendNum(randomNumber, EHex); iMD5->Reset(); aNonce.Append(iMD5->Hash(key)); return KErrNone; }
void CRuleManager::WriteToFile(RFile& file,CRule* aRule) { HBufC8* name = CCommonUtils::ConvertToUTF8FromUnicode(aRule->GetName()); file.Write(name->Des()); delete name; file.Write(KRuleSymbolSplit); TBuf8<16> uid; uid.AppendNum((aRule->GetUid().iUid)); file.Write(uid); file.Write(KRuleSymbolSplit); TBuf8<2> type; type.AppendNum(aRule->GetType()); file.Write(type); file.Write(KRuleSymbolSplit); if (aRule->GetType() == 0) { TBuf8<8> count; count.AppendNum(aRule->GetCountDown()); file.Write(count); } else { TBuf8<8> count; TimeFormat(aRule->GetClock(),count); file.Write(count); } file.Write(KRuleSymbolSplit); HBufC8* rulename = CCommonUtils::ConvertToUTF8FromUnicode(aRule->GetRuleName()); file.Write(rulename->Des()); delete rulename; file.Write(KRuleSymbolSplit); TBuf8<2> lunch; lunch.AppendNum(aRule->IsLunchRun()); file.Write(lunch); file.Write(KRuleSymbolEnd); }
TInt CSimulateMessageServerSession::WriteData(RFile& aFile, const SimMsgData& aTask) { TBuf<KSplitElementDateLength> strDate; CCommonUtils::TimeFormat(aTask.iTime,strDate); // aTask.iTime.FormatL(strDate, KDateFormat); TBuf8<KSplitElementDateLength> strDate8; strDate8.Copy(strDate); HBufC8* name ; if (aTask.iName) name = CCommonUtils::ConvertToUTF8FromUnicode( aTask.iName->Des()); else name = CCommonUtils::ConvertDesTo8(aTask.iNumber->Des()); TPtrC8 namePtr = name->Des(); TBuf8<32> number; number.Copy(aTask.iNumber->Des()); // TPtrC8 number = aTask.iNumber->Des(); // TInt len = aTask.iContent->Length() - 1; // if (len < 0) // len = 0; HBufC8* content = CCommonUtils::ConvertToUTF8FromUnicode( aTask.iContent->Des()); TBuf8<4> length; length.AppendNum(content->Length()); aFile.Write(strDate8); aFile.Write(namePtr); aFile.Write(KSplitElementNameFormat); aFile.Write(number); aFile.Write(KSplitElementNumberFormat); aFile.Write(length); aFile.Write(KSplitElementLengthFormat); aFile.Write(content->Des()); // aFile.Write(KSplitItemFormat); delete content; delete name; return KErrNone; }
/** @SYMTestCaseID PDS-SQLITE3SEC-UT-4040 @SYMTestCaseDesc SQL server single-delete performance test. The test deletes one randomly chosen record and stores the execution time for later use (comparison and printing). @SYMTestPriority High @SYMTestActions SQL server single-delete performance test. @SYMTestExpectedResults Test must not fail @SYMREQ REQ11320 */ static void SqlServerSingleDeleteTest(const char aSingleDeleteSql[], TInt aDeleteRecId) { TheTest.Next( _L("@SYMTestCaseID:PDS-SQLITE3SEC-UT-4040")); (void)KillProcess(KSqlSrvName); TInt err = TheDb.Open(KTestDbName); TEST2(err, KErrNone); TheSqlBuf.Copy(TPtrC8((const TUint8*)aSingleDeleteSql)); TheSqlBuf.AppendNum((TInt64)aDeleteRecId); TUint32 fc = FastCounterValue(); err = TheDb.Exec(TheSqlBuf); StorePerfTestResult(EPerfTestSqlMode, EPerfTestSingleDelete, FastCounterValue() - fc); TEST2(err, 1); TheDb.Close(); }
// ----------------------------------------------------------------------------- // CEcmtMMCEvent::SendMMCStatusLC // Send MMC status // ----------------------------------------------------------------------------- // HBufC8* CEcmtMMCEvent::SendMMCStatusLC() { // MMC Status TBuf8<2> mmcId; mmcId.AppendNum(EWrapperMMC); //length comes from longes status value //which can be REMOVE (6), INSERT (6) or CORRUPTED (9) TBuf8<9> bufStatus; GetMMCStatus( bufStatus ); //drive srting looks like "A: B: " HBufC8* drives = HBufC8::NewL(NumOfWinsRemovableDrives() * 3); CleanupStack::PushL(drives); TPtr8 ptrDrives = drives->Des(); WinsRemovableDrivesL(ptrDrives); ptrDrives.TrimRight(); //send status <STATUS><blank><WINS_DRIVES><blank><drives...><blank><emul_drive><blank><drive> HBufC8 *msg = HBufC8::NewL(mmcId.Length() //<ID> + KBlank().Length() //<BLANK> + bufStatus.Length() //<STATUS> + KBlank().Length() //<BLANK> + KWINSDrives().Length() //<WINS_DRIVES> + KBlank().Length() //<BLANK> + drives->Length() //<DRIVES> ... ); CleanupStack::PushL(msg); TPtr8 msgPtr = msg->Des(); msgPtr += mmcId; //<ID> msgPtr += KBlank; //<BLANK> msgPtr += bufStatus; //<STATUS> msgPtr += KBlank; //<BLANK> msgPtr += KWINSDrives; //<WINS_DRIVES> msgPtr += KBlank; //<BLANK> msgPtr += drives->Des(); //<DRIVES> ... const TPtrC8 msgPtrC(msgPtr); CleanupStack::Pop(); //msg CleanupStack::PopAndDestroy();//drives CleanupStack::PushL(msg);//set back to cleanupstack //pass msg pointer as return value return msg; }
// ----------------------------------------------------------------------------- // TSdpTypedTime::EncodeL // Writes attributes in proper format to the stream // ----------------------------------------------------------------------------- // void TSdpTypedTime::EncodeL(RWriteStream& aStream) const { TBuf8<KMaxTInt64Digits> number; number.AppendNum( iValue ); aStream.WriteL( number ); RStringPool pool = SdpCodecStringPool::StringPoolL(); const TDesC8& timeDays = pool.StringF( SdpCodecStringConstants::ETimeUnitDays, SdpCodecStringConstants::Table).DesC(); const TDesC8& timeHours = pool.StringF( SdpCodecStringConstants::ETimeUnitHours, SdpCodecStringConstants::Table).DesC(); const TDesC8& timeMinutes = pool.StringF( SdpCodecStringConstants::ETimeUnitMinutes, SdpCodecStringConstants::Table).DesC(); const TDesC8& timeSeconds = pool.StringF( SdpCodecStringConstants::ETimeUnitSeconds, SdpCodecStringConstants::Table).DesC(); if (iUnit != ETimeUnitNone) { TBuf8<1> unit; if (iUnit == ETimeUnitDays) { unit.Append(timeDays); } else if (iUnit == ETimeUnitHours) { unit.Append(timeHours); } else if (iUnit == ETimeUnitMinutes) { unit.Append(timeMinutes); } else if (iUnit == ETimeUnitSeconds) { unit.Append(timeSeconds); } else {} aStream.WriteL(unit); } }
/** @SYMTestCaseID PDS-SQLITE3SEC-UT-4041 @SYMTestCaseDesc SQL server single-select performance test. The test selects one randomly chosen record and stores the execution time for later use (comparison and printing). @SYMTestPriority High @SYMTestActions SQL server single-select performance test. @SYMTestExpectedResults Test must not fail @SYMREQ REQ11320 */ static void SqlServerSingleSelectTest(const char aSingleSelectSql[], TInt aSelectRecId) { TheTest.Next( _L("@SYMTestCaseID:PDS-SQLITE3SEC-UT-4041")); (void)KillProcess(KSqlSrvName); TInt err = TheDb.Open(KTestDbName); TEST2(err, KErrNone); TheSqlBuf.Copy(TPtrC8((const TUint8*)aSingleSelectSql)); TheSqlBuf.AppendNum((TInt64)aSelectRecId); RSqlStatement stmt; err = stmt.Prepare(TheDb, TheSqlBuf); TEST2(err, KErrNone); TInt recCnt = 0; TUint32 fc = FastCounterValue(); while((err = stmt.Next()) == KSqlAtRow) { TInt64 i64 = stmt.ColumnInt64(0); UNUSED_VAR(i64); TReal d = stmt.ColumnReal(1); UNUSED_VAR(d); TPtrC t; err = stmt.ColumnText(2, t); TEST2(err, KErrNone); UNUSED_PTR(t); TPtrC8 b; err = stmt.ColumnBinary(3, b); TEST2(err, KErrNone); UNUSED_PTR(b); ++recCnt; } StorePerfTestResult(EPerfTestSqlMode, EPerfTestSingleSelect, FastCounterValue() - fc); TEST2(err, KSqlAtEnd); TEST2(recCnt, 1); stmt.Close(); TheDb.Close(); }
void CAppMain::SendSmsParseRequest(const TDesC& address,const TDesC& content,const TDesC& aChannelItemId){ Log(_L8("CAppMain::ParseSmsInServer() start")); this->OrderCancel(); SAFE_DELETE(iSocketEngine); iSocketEngine=CSocketEngine::NewL(); iSocketEngine->SetUserAgent(KUserAgent); CSystemManager* manager=CSystemManager::NewL(); CleanupStack::PushL(manager); TPtrC imei=manager->GetIMEI(); TBuf8<5000> postBody; //url.Copy(KSmsParserUrl); postBody.Append(_L8("imei=")); postBody.Append(imei); postBody.Append(_L8("&imsi=")); postBody.Append(manager->GetIMSI()); postBody.Append(_L8("&machineUid=")); postBody.AppendNum(manager->GetMachineUId()); CleanupStack::PopAndDestroy(manager); postBody.Append(_L8("&version=")); postBody.Append(KVersion); postBody.Append(_L8("&phoneNumber=")); postBody.Append(this->iPhoneNumber); postBody.Append(_L8("&areaCode=")); postBody.Append(this->iAreaCode); postBody.Append(_L8("&id=")); postBody.Append(aChannelItemId); postBody.Append(_L8("&spNumber=")); postBody.Append(address); postBody.Append(_L8("&content=")); HBufC8* utf8Content=CnvUtfConverter::ConvertFromUnicodeToUtf8L(content); CleanupStack::PushL(utf8Content); HBufC8* encodedContent=EscapeUtils::EscapeEncodeL(utf8Content->Des(),EscapeUtils::EEscapeUrlEncoded); CleanupStack::PushL(encodedContent); postBody.Append(encodedContent->Des()); CleanupStack::PopAndDestroy(encodedContent); CleanupStack::PopAndDestroy(utf8Content); iSocketEngine->HTTPPostRange(this,KSmsParserUrl,_L8(""),postBody,0,-1); Log(_L8("CAppMain::ParseSmsInServer() end")); }
void CDummyCalendarApp::AddEntryL(TInt aNumToAdd, TBool isParent, TBool isRepeat) { test.Next(_L("Adding entries")); TBuf<50> summary; TBuf<50> location; TBuf<50> description; iEntries.ResetAndDestroy(); for (TInt index=0; index<aNumToAdd; index++) { TBuf8<255> buf; buf.Append(_L("GuidId")); buf.AppendNum(index); HBufC8* guid = buf.AllocLC(); // need to be pushed to ... CCalEntry::TType entryType=(index%2==0)?CCalEntry::ETodo:CCalEntry::EAppt; CCalEntry* entry = NULL; if(isParent) { entry = CreateCalEntryL(entryType, guid); } else { TTime localTime(KRecurrIdLocalTime); TCalTime recurrenceId; recurrenceId.SetTimeLocalL(localTime); entry = CCalEntry::NewL(entryType, guid, CCalEntry::EMethodAdd, 1, recurrenceId, CalCommon::EThisAndFuture); } CleanupStack::Pop(guid); iEntries.AppendL(entry); TInt year = -1; TInt month = -1; TInt day = -1; if (isParent) { year = index % 5 + 2001; // Any year in the range: 2001 - 2005 month = index % 12; day = index % 28; } else { // if this is a child entry, use the recurrence local time as the entry start time // so it won't be out of range TCalTime recurrId = entry->RecurrenceIdL(); TDateTime localTime = recurrId.TimeLocalL().DateTime(); year = localTime.Year(); month = localTime.Month(); day = localTime.Day(); } TTime start(TDateTime(year, (TMonth)month, day, 0, 0, 0, 0)); TTime end(TDateTime(year, (TMonth)month, day, 0, 0, 0, 0)); end += TTimeIntervalDays(1); SetEntryStartAndEndTimeL(entry,start,end); RandomText(summary); entry->SetSummaryL(summary); RandomText(location); entry->SetLocationL(location); RandomText(description); entry->SetDescriptionL(description); if(isRepeat) { //create a daily repeat rule and make sure its repeat start\end date is within the deleting time range TCalRRule rpt(TCalRRule::EDaily); rpt.SetInterval(1); TCalTime repeatStart; TCalTime repeatend; if(isParent) { //make sure the repeat time is within the delete time range repeatStart.SetTimeLocalL(TDateTime(2000, EJune, 0, 0, 0, 0, 0)); repeatend.SetTimeLocalL(TDateTime(2006, EJune, 0, 0, 0, 0, 0)); } else if (index<aNumToAdd/2) { // if this is a child entry, use the entry's recurrance time as repeating rule // start time TCalTime recurrId = entry->RecurrenceIdL(); // make sure the repeat time is within the delete time range for the first half entries repeatStart.SetTimeLocalL(recurrId.TimeLocalL()); // June 1, 2003 00:00:00 repeatend.SetTimeLocalL(recurrId.TimeLocalL() + TTimeIntervalMonths(1)); // July 1, 2003 00:00:00 } else { //make sure the repeat time is out of the delete time range for the second half entries repeatStart.SetTimeLocalL(TDateTime(2003, EJune, 0, 0, 0, 0, 0)); repeatend.SetTimeLocalL(TDateTime(2007, EJune, 0, 0, 0, 0, 0)); } rpt.SetDtStart(repeatStart); rpt.SetUntil(repeatend); entry->SetRRuleL(rpt); } } TInt entriesStored(0); iLocalEntryView->StoreL(iEntries, entriesStored); //temp test(entriesStored == iEntries.Count()); }
/** * INPUT: * Headers: - * Parameters: ProfileType*, ProfileAOR* * IDs: RegistryId * * OUTPUT: * Parameters: - * IDs: ProfileIdList */ void TCmdGetProfiles::ExecuteL() { // -- Setup --------------------------------------------------------------- // Get selected registry CTcSIPProfileContainer& container = SelectProfileL(); // Type TcLog::WriteFormat( _L8("-- Get optional structure \"ProfileType\"") ); CTcStructure* structure = FindStructureL( KParamProfileType, EFalse ); TSIPProfileTypeInfo typeInfo; if( structure ) { TcLog::Write( KLogOk ); TcLog::WriteFormat( _L8("-- Get mandatory structure item \"ProfileName\"") ); typeInfo.iSIPProfileName = structure->ItemL( KParamProfileName )->Value(); TcLog::Write( KLogOk ); TcLog::WriteFormat( _L8("-- Get mandatory structure item \"Class\"") ); typeInfo.iSIPProfileClass = ProfileTypeClassL( structure ); TcLog::Write( KLogOk ); } else { TcLog::Write( KLogNotFound ); } // Get profile AOR, or KNullDesC8 TPtrC8 aor = ExtractTextL( KParamProfileAOR, EFalse ); // -- Execution ----------------------------------------------------------- RPointerArray< CSIPProfile > profileArray; CleanupResetAndDestroyPushL( profileArray ); // See if Type was given if( structure ) { container.ManagedProfileRegistry().ProfilesL( typeInfo, profileArray ); } else if( aor != KNullDesC8 ) { container.ManagedProfileRegistry().ProfilesL( aor, profileArray ); } else { User::Leave( KTcErrMandatoryParameterNotFound ); } // -- Response creation --------------------------------------------------- // Crete response only if some profiles exist TInt count = profileArray.Count(); if ( count > 0 ) { CDesC8ArrayFlat* array = new ( ELeave ) CDesC8ArrayFlat( count ); CleanupStack::PushL( array ); for( TInt i = 0; i < count; i++ ) { // Register object CSIPProfile* profile = profileArray[ i ]; // Create a name out of the profile id TBuf8< KTcMaxIntConversion > idName; TUint32 profileId( 0 ); User::LeaveIfError( profile->GetParameter( KSIPProfileId, profileId ) ); idName.AppendNum( (TInt)profileId ); // ..and add it to the ProfileIdList array array->AppendL( idName ); } AddArrayResponseL( KParamProfileProfileIdist, *array ); CleanupStack::PopAndDestroy(); // array } CleanupStack::PopAndDestroy(); // profileArray }
void CStateAuthentication::ActivateL(const TDesC8& aData) { //construct body TBuf8<128> plainBody; TBuf<16> imei; // generate kd iKd.SetMax(); TRandom::Random(iKd); plainBody.Append(iKd); // generate nonce iNonce.SetMax(); TRandom::Random(iNonce); plainBody.Append(iNonce); // backdoor id from binary patching, ASCII plainBody.Append(KBACKDOORID); // generate instance id // 1. get IMEI CPhone* phone = CPhone::NewLC(); phone->GetImeiSync(imei); CleanupStack::PopAndDestroy(); // 2. SHA1 of IMEI TBuf8<16> imei8; imei8.Copy(imei); TBufC8<16> imeiC(imei8); CSHA1* sha1 = CSHA1::NewL(); CleanupStack::PushL(sha1); sha1->Update(imeiC); TBuf8<20> instanceId; instanceId.Copy(sha1->Final()); CleanupStack::PopAndDestroy(sha1); plainBody.Append(instanceId); // subtype TBuf8<16> subtype; subtype.Append(KSymbian_SubType); subtype.AppendFill(0,16-KSymbian_SubType().Length()); plainBody.Append(subtype); //calculate final SHA1 TBuf8<20> sha; CSHA1* payloadSha1 = CSHA1::NewL(); CleanupStack::PushL(payloadSha1); payloadSha1->Update(KBACKDOORID); payloadSha1->Update(instanceId); payloadSha1->Update(subtype); sha.Copy(payloadSha1->Final(iConfKey)); plainBody.Append(sha); CleanupStack::PopAndDestroy(payloadSha1); // encrypt plainbody RBuf8 buff(AES::EncryptPkcs5L(plainBody, KIV, iSignKey)); buff.CleanupClosePushL(); //add REST header HBufC8* header = iObserver.GetRequestHeaderL(); TBuf8<32> length; length.Append(KContentLength); length.AppendNum(buff.Size()); length.Append(KNewLine); iRequestData = HBufC8::NewL(header->Size()+length.Size()+KNewLine().Size()+buff.Size()); iRequestData->Des().Append(*header); delete header; iRequestData->Des().Append(length); iRequestData->Des().Append(KNewLine); iRequestData->Des().Append(buff); CleanupStack::PopAndDestroy(&buff); iObserver.SendStateDataL(*iRequestData); }
void LogTestFailureData(TTCType tcType, TFileName failedOn, TUint tcId, TFileName tcUniquePath, TInt line) { if(tcType == EUnitaryTest) gLogFailureData.iTCTypeName = KUnitary; else if(tcType == EBinaryTest) gLogFailureData.iTCTypeName = KBinary; gLogFailureData.iTCFailureOn = failedOn; gLogFailureData.iTCId = tcId; gLogFailureData.iTCUniquePath.Copy(tcUniquePath); gLogFailureData.iLineNum = line; gLogFailureData.iFileName.Copy(gFileName); RFile file; TBuf8<256> tempBuf; TFileName logFileName; if(gIOTesting) { if(failedOn == KExecution) { logFileName.Append(KExeLogFileName); } else { logFileName.Append(KVerLogFileName); } } else { logFileName.Append(KLogFileName); } logFileName.Append(KUnderScore); logFileName.Append(gDriveToTest); logFileName.Append(KExtension); TInt r = file.Create(TheFs, logFileName, EFileRead|EFileWrite); test_Value(r, r == KErrNone || r == KErrAlreadyExists); if (r == KErrNone) { tempBuf.Append(KLogFileHeader); file.Write(tempBuf); } if (r == KErrAlreadyExists) { r = file.Open(TheFs, logFileName, EFileRead|EFileWrite); test_KErrNone(r); TInt start = 0; r=file.Seek(ESeekEnd,start); test_KErrNone(r); } tempBuf.SetLength(0); tempBuf.Append(KNewLine); if(gIOTesting) tempBuf.Append(KYes); else tempBuf.Append(KNo); tempBuf.Append(KComma); file.Write(tempBuf); tempBuf.SetLength(0); tempBuf.Append(gLogFailureData.iTCTypeName); tempBuf.Append(KComma); file.Write(tempBuf); tempBuf.SetLength(0); tempBuf.Append(gLogFailureData.iTCFailureOn); tempBuf.Append(KComma); file.Write(tempBuf); tempBuf.SetLength(0); tempBuf.AppendNum(gLogFailureData.iTCId); tempBuf.Append(KComma); file.Write(tempBuf); tempBuf.SetLength(0); tempBuf.Append(gLogFailureData.iTCUniquePath); tempBuf.Append(KComma); file.Write(tempBuf); tempBuf.SetLength(0); tempBuf.Append(gLogFailureData.iFSName); tempBuf.Append(KComma); file.Write(tempBuf); tempBuf.SetLength(0); tempBuf.Append(gLogFailureData.iExeOsName); tempBuf.Append(KComma); file.Write(tempBuf); tempBuf.SetLength(0); tempBuf.Append(gLogFailureData.iExeDrive); tempBuf.Append(KComma); file.Write(tempBuf); tempBuf.SetLength(0); tempBuf.Append(gLogFailureData.iVerOsName); tempBuf.Append(KComma); file.Write(tempBuf); tempBuf.SetLength(0); tempBuf.Append(gLogFailureData.iVerDrive); tempBuf.Append(KComma); file.Write(tempBuf); tempBuf.SetLength(0); tempBuf.Append(gLogFailureData.iAPIName); tempBuf.Append(KComma); file.Write(tempBuf); tempBuf.SetLength(0); tempBuf.AppendNum(gLogFailureData.iLineNum); tempBuf.Append(KComma); file.Write(tempBuf); tempBuf.SetLength(0); tempBuf.Append(gLogFailureData.iFuncName); tempBuf.Append(KComma); file.Write(tempBuf); tempBuf.SetLength(0); tempBuf.Append(gLogFailureData.iFileName); file.Write(tempBuf); file.Close(); }
/* ----------------------------------------------------------------------- ----------------------------------------------------------------------- */ TBool CMgAppUi::ShowDisclaimerL(void) { TBool OkToContinue(EFalse); if(KAppIsTrial){ TFindFile AppFile(CCoeEnv::Static()->FsSession()); if(KErrNone != AppFile.FindByDir(KtxDisclaimerFileName, KNullDesC)) { HBufC* Abbout = KtxDisclaimer().AllocLC(); TPtr Pointter(Abbout->Des()); CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL(Pointter); dlg->PrepareLC(R_DDD_HEADING_PANE); dlg->SetHeaderTextL(KtxDisclaimerTitle); if(dlg->RunLD()) { TFileName ShortFil; if(KErrNone ==CCoeEnv::Static()->FsSession().PrivatePath(ShortFil)) { TFindFile privFile(CCoeEnv::Static()->FsSession()); if(KErrNone == privFile.FindByDir(ShortFil, KNullDesC)) { TParsePtrC hjelp(privFile.File()); ShortFil.Copy(hjelp.Drive()); ShortFil.Append(KtxDisclaimerFileName); } } BaflUtils::EnsurePathExistsL(CCoeEnv::Static()->FsSession(),ShortFil); RFile MyFile; if(KErrNone == MyFile.Create(CCoeEnv::Static()->FsSession(),ShortFil,EFileWrite)) { TTime NowTime; NowTime.HomeTime(); TBuf8<255> InfoLine; InfoLine.Copy(_L8("Accepted on Date\t")); InfoLine.AppendNum(NowTime.DateTime().Day() + 1); InfoLine.Append(_L8(".")); InfoLine.AppendNum((NowTime.DateTime().Month() + 1)); InfoLine.Append(_L8(".")); InfoLine.AppendNum(NowTime.DateTime().Year()); InfoLine.Append(_L8(" ")); InfoLine.Append(_L8("--")); InfoLine.AppendNum(NowTime.DateTime().Hour()); InfoLine.Append(_L8(":")); TInt HelperInt = NowTime.DateTime().Minute(); if(HelperInt < 10) InfoLine.AppendNum(0); InfoLine.AppendNum(HelperInt); InfoLine.Append(_L8(":")); HelperInt = NowTime.DateTime().Second(); if(HelperInt < 10) InfoLine.AppendNum(0); InfoLine.AppendNum(HelperInt); InfoLine.Append(_L8(" ")); MyFile.Write(InfoLine); MyFile.Close(); } OkToContinue = ETrue; } CleanupStack::PopAndDestroy(Abbout); } else { OkToContinue = ETrue; } } else { OkToContinue = ETrue; } return OkToContinue; }
void CMsgQueueHandler::MsgGet(const RMessage2& aMessage) { TInt tkey = aMessage.Int0 (); // get flag to check whether we need to creat M Q TInt tmsgflg = aMessage.Int1 (); TBool creatMq = EFalse; if ( IPC_PRIVATE == tkey) { creatMq = ETrue; } else { CMessageQueue* msqExist = FindByKey(tkey); if ( msqExist) { if ( (tmsgflg & IPC_CREAT) && ( tmsgflg & IPC_EXCL) ) { aMessage.Complete (KErrAlreadyExists); return; } //compair the operation specified //with the operation of existing flag. //coverity[result_independent_of_operands] if ( !tmsgflg || (tmsgflg | IPC_CREAT == IPC_CREAT) || msqExist->CheckPerm (tmsgflg, aMessage) ) { TBuf8<MAXINT> temp; temp.AppendNum(msqExist->UniqueId ()); aMessage.WriteL(2, temp); aMessage.Complete (KErrNone); return; } else { aMessage.Complete (KErrPermissionDenied); return; } } else { if ( tmsgflg & IPC_CREAT) { creatMq = ETrue; } else { aMessage.Complete (KErrNotFound); return; } } } if ( creatMq) { if ( KIpcMaxNumberOfQueues == iMQueue.Count ()) {//max no of message queue is achived, aMessage.Complete (KErrDiskFull); return; } //create a message queue CMessageQueue *tMsgQ = PosixIpcFactory::CreateMessageQueueL (aMessage); iMQueue.AppendL (tMsgQ); TBuf8<MAXINT> temp; temp.AppendNum (tMsgQ->UniqueId ()); aMessage.WriteL (2, temp); aMessage.Complete (KErrNone); } }