EXPORT_C void CMemSpyEngineOutputSink::OutputBinaryDataL( const TDesC& aFormat, const TUint8* aBufferAddress, const TUint8* aDisplayStartAddress, TInt aLength ) { _LIT(KAddresPostfix, ": "); _LIT(KDoubleSpace, " "); _LIT(KSingleSpace, " "); const TInt maxLen = aLength; TInt len = aLength; const TUint8* pDataAddr = aBufferAddress; TBuf<81> out; TBuf<20> ascii; TInt offset = 0; const TUint8* a = pDataAddr; const TUint8* displayAddress = aDisplayStartAddress; // while(len>0) { out.Zero(); ascii.Zero(); out.AppendNumFixedWidth((TUint) displayAddress, EHex, 8); out.Append(KAddresPostfix); TUint b; for (b=0; b<16; b++) { TUint8 c = ' '; if ((pDataAddr + offset + b) < pDataAddr + maxLen) { c = *(pDataAddr + offset + b); out.AppendNumFixedWidth(c, EHex, 2); } else { out.Append(KDoubleSpace); } out.Append( KSingleSpace ); if (c<=0x20 || c == 0x27 || c>=0x7f || c=='%') c=0x2e; ascii.Append(TChar(c)); } out.Append(ascii); out.ZeroTerminate(); FormatBuffer().Format( aFormat, &out ); OutputLineL( FormatBuffer() ); displayAddress += 16; a += 16; offset += 16; len -= 16; } }
// --------------------------------------------------------- // CPosTp4723::StartL // // (other items were commented in a header). // --------------------------------------------------------- // void CT_LbsClientPosTp4723::StartL() { ConnectL(); SetupProxyPSYsL(); TPositionModuleId modId = iUidSatInfoPsy; CRepository* repos = CRepository::NewL( KCRUidDefaultProxyConfiguration ); TBuf<40> idBuf; idBuf.AppendNumFixedWidth( modId.iUid, EHex, 8); TInt error = repos->Set(KDefaultProxyLastWorkingGpsPsy, idBuf); delete repos; User::LeaveIfError(error); TInt err = OpenPositioner(); _LIT(KOpenErr, "Error when opening positioner, %d"); AssertTrueL(err == KErrNone, KOpenErr, err); _LIT(KServiceName, "TP4723"); iPositioner.SetRequestor(CRequestor::ERequestorService, CRequestor::EFormatApplication, KServiceName); TPositionSatelliteInfo posInfo; // Request value should be 4722, even for TP4723... TInt request = 4722; // Default PSY won't pre-load Multi PSY since it is Internal VerifyPsyUnloadedL(iUidMultiPsy); // Default PSY should pre-load SetInfo PSY since it is External and supports GPS VerifyPsyLoadedL(iUidSatInfoPsy); // // Request 1 // RequestL(posInfo, request, KEspectedErrorCodePSY1); VerifyPositionFromL(posInfo, iUidSatInfoPsy); VerifyRequestTimeLessThanL(1200000); VerifyPsyLoadedL(iUidSatInfoPsy); VerifyPositionL(posInfo, 40, 50, 60); }
void CSmtpAuthCramMd5MechanismHelper::GetNextClientMessageL(TDes8& aNextMessage) { iNextClientMessage.Zero(); if(iInProgress) { HBufC8* authbuffer = HBufC8::NewMaxLC(KImMailMaxBufferSize);//? TPtr8 authbufferptr = authbuffer->Des(); HBufC8* authbuffer2 = HBufC8::NewMaxLC(KImMailMaxBufferSize);//? TPtr8 authbufferptr2 = authbuffer2->Des(); HBufC8* authbuffer3 = HBufC8::NewMaxLC(KImMailMaxBufferSize);//? TPtr8 authbufferptr3 = authbuffer3->Des(); authbufferptr = iLastServerMessage; authbufferptr.Delete(0,4); //remove 334 from the begining of server response iEncoder.Decode(authbufferptr,authbufferptr2); //timestamp info now in authbufferptr2 authbufferptr.Zero(); authbufferptr3.Zero(); authbufferptr = iSettings.Password(); authbufferptr3 = FormSharedSecret(authbufferptr); authbufferptr.Zero(); authbufferptr = authbufferptr3; //now authbufferptr and authbufferptr3 contain the shared secret null padded to 64 bytes. TInt i=0; for (i=0; i<KMd5BlockLength; i++) { authbufferptr[i] ^= 0x36; //ipad authbufferptr3[i] ^= 0x5c; //opad } authbufferptr.Append(authbufferptr2); iMd5Hash->Reset(); ; authbufferptr2 = iMd5Hash->Hash(authbufferptr); authbufferptr3.Append(authbufferptr2); authbufferptr.Zero(); iMd5Hash->Reset(); authbufferptr = iMd5Hash->Hash(authbufferptr3); // MD5 algorithm ALWAYS returns 16 bytes of data - which will be converted into // 32 characters; each byte represented by a 2 character hex representation, // eg 255="ff" TBuf<32> hexHash; for (i=0;i<16;i++) { hexHash.AppendNumFixedWidth(authbufferptr[i],EHex,2); } authbufferptr3.Zero(); authbufferptr3.Append(iSettings.LoginName()); authbufferptr3.Append(_L8(" ")); authbufferptr3.Append(hexHash); iEncoder.Encode(authbufferptr3, iNextClientMessage); iNextClientMessage.Append(KSmtpCrLf); CleanupStack::PopAndDestroy(3); // authbufferptr3 ,authbufferptr2, authbufferptr aNextMessage = iNextClientMessage; } else { iNextClientMessage.Append(KSmtpAuthCommand); iNextClientMessage.Append(KCramMD5Mechanism); iNextClientMessage.Append(KSmtpCrLf); iInProgress=ETrue; aNextMessage = iNextClientMessage; } }