void CClearConfig::ClearL(RULogger& loggerSession)
{	
	loggerSession.Stop();//C.A. previously:loggerSession.StopOutputting();
	loggerSession.DeActivateInputPlugin();
	CArrayPtrFlat<HBufC8> *allplugins = new (ELeave)CArrayPtrFlat<HBufC8>(1);
	loggerSession.GetInstalledOutputPlugins(*allplugins);//C.A. previously:loggerSession.InstalledOutputPlugins(*allplugins);
	for(TInt i=0;i<(allplugins->Count());i++)
	if(allplugins->Count())
	{
		TBuf8<50> dataBuf;
		dataBuf.Copy(allplugins->At(i)->Des());
		loggerSession.RemovePluginConfigurations(dataBuf);
	}
	CArrayFixFlat<TUint8> *getfilter = new (ELeave)CArrayFixFlat<TUint8>(1);
	loggerSession.GetPrimaryFiltersEnabled(*getfilter);//C.A. previously:loggerSession.GetEnabledClassifications(*getfilter);
	TInt Result=loggerSession.SetPrimaryFiltersEnabled(*getfilter,EFalse);//C.A. previously:TInt Result=loggerSession.DisableClassifications(*getfilter);
	RArray<TUint32> get2filter;	
	loggerSession.GetSecondaryFiltersEnabled(get2filter);//C.A. previously:loggerSession.GetEnabledModuleUids(get2filter);
	loggerSession.SetSecondaryFiltersEnabled(get2filter,EFalse);//C.A. previously:loggerSession.DisableModuleUids(get2filter);
	//C.A. previously:loggerSession.EnableClassificationFiltering();
	loggerSession.SetSecondaryFilteringEnabled(ETrue);//C.A. previously:loggerSession.EnableModuleUidFiltering();
	loggerSession.SetBufferSize(1024);
	loggerSession.SetNotificationSize(512);
	loggerSession.SetBufferMode(1);//C.A. previously:loggerSession.SetBufferMode(EStraight);
}
// ---------------------------------------------------------
// CDownloadMgrSession::InitializeL
// ---------------------------------------------------------
//
void CDownloadMgrSession::InitializeL()
    {
    CLOG_ENTERFN( "CDownloadMgrSession::DownloadMgrAttachCountL" )
    iIsMaster = (TBool)CurrentMessage().Int2();

    TUid uid;
    TPckg<TUid> uidPckg( uid );

    Read( 0, uidPckg );

    CreateClientAppInstanceL( uidPckg().iUid );

    // Check how many download we have and return it to the client
    CLOG_WRITE_FORMAT( "CDownloadMgrSession::InitializeL iClientAppInstance %d", iClientAppInstance );
    CArrayPtrFlat<CHttpDownload>* currentDownloads = iClientAppInstance->DownloadsL();
	TPckg<TInt> countPckg( currentDownloads->Count() );
	TPckg<TInt> sessionId( iSessionId );

    Write( 1, CurrentMessage(), countPckg );
    Write( 3, CurrentMessage(), sessionId );

    CLOG_NAME_2( _L("Session_%x_%x"), uidPckg().iUid, iSessionId );

    currentDownloads->Reset();
    delete currentDownloads;
    }
void CX509CertExtension::ConstructL(const TDesC8& aBinaryData, TInt& aPos)
	{
	TASN1DecSequence encSeq;
	CArrayPtrFlat<TASN1DecGeneric>* seq = encSeq.DecodeDERLC(aBinaryData, aPos, 2, KMaxTInt);

	TASN1DecObjectIdentifier encOID;
	iId = encOID.DecodeDERL(*(seq->At(0)));
	//second is either critical flag, or the ext
	TASN1DecGeneric* second = seq->At(1);
	if (second->Tag() != EASN1Boolean)
		{
		iData = second->Encoding().AllocL();
		aPos += second->LengthDER();
		}
	else
		{
		TASN1DecBoolean encBool;
		iCritical = encBool.DecodeDERL(*second);
		if (seq->Count() != 3)
			{
			User::Leave(KErrArgument);
			}

		TASN1DecGeneric* third = seq->At(2);
		iData = third->Encoding().AllocL();
		}
	CleanupStack::PopAndDestroy();//seq
	}
// -----------------------------------------------------------------------------
// CHttpConnHandler::Connected
// ?implementation_description
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CHttpConnHandler::Connected()
    {
    if( iNewConnection )
        {
        iNewConnection = EFalse;

        if( iStatus.Int() == KErrNone )
            {
            if( !iIapId )
                {
                UpdateIapId();
                }

            TRAP_IGNORE( SetConnectionInfoL() );
            }
        }

    __ASSERT_DEBUG( iClientApp, DMPanic( KErrCorrupt ) );
    CArrayPtrFlat<CHttpDownload>* downloads = 
                                iClientApp->Downloads();
    for( TInt i = 0; i < downloads->Count(); ++i )
        {
        if( (*downloads)[i]->ConnHandler() == this )
            {
            iShutDown->Cancel();
            (*downloads)[i]->Connected();
            }
        }
    }
// -----------------------------------------------------------------------------
// CHttpDownloadManagerServerEngine::ConstructL
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CHttpDownloadManagerServerEngine::ConstructL()
    {
    CLOG_NAME( _L("Engine") );
    LOGGER_ENTERFN( "ConstructL()" );

    User::LeaveIfError( iRfs.Connect() );
	User::LeaveIfError(iRfs.ShareProtected());

    iDocHandler = CDocumentHandler::NewL();
    
    iFeatProgressiveDownload = FeatureManager::FeatureSupported( KFeatureIdBrowserProgressiveDownload );
    
    iProperty = new (ELeave) RProperty;
    CLOG_ATTACH( iProperty, this );
    iProperty->Attach( KPSUidUikon,KUikMMCInserted );
    
    iMMCNotifier = new (ELeave) CMMCNotifier( iProperty );
    CLOG_ATTACH( iMMCNotifier, this );
    iMMCNotifier->StartObserving( this );

    QueryMMCUniqueId();

    QueryDriveListL();

    iClientApps = new (ELeave) CArrayPtrFlat<CHttpClientApp>(2);

    // make directory for the server
    // No problem if it already exists
    TInt error = iRfs.MkDirAll( KDmDefaultDir );
    if( error != KErrNone && error != KErrAlreadyExists )
        // leave if makedir failed in some way
        // don't leave if already exists
        {
        CLOG_WRITE8_1( "MkDirAll: %d", error );
        User::Leave( error );
        }

    LoadClientsL();
    
    // This code generates a unique id for the next download
    // client will create. It is always the the highest unique
    // id of all downloads + 1.
    iNextDownloadId = 1;

    for( TInt apps = 0; apps < iClientApps->Count(); ++apps )
        {
        CArrayPtrFlat<CHttpDownload>* allDownloads = (*iClientApps)[apps]->Downloads();

        for( TInt i = 0; i < allDownloads->Count(); ++i )
            {
            if( iNextDownloadId <= (*allDownloads)[i]->Id() )
                {
                iNextDownloadId = (*allDownloads)[i]->Id() + 1;
                }
            }
        }
    
    error = iSocketServ.Connect();
    User::LeaveIfError(error);
    }
// -----------------------------------------------------------------------------
// CHttpDownloadManagerServerEngine::AllDownloadsSizeInDriveL
// ?implementation_description
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
TInt CHttpDownloadManagerServerEngine::AllDownloadsSizeInDriveL(const CHttpDownload *aDownload, TInt aDriveId) const
    {
    LOGGER_ENTERFN( "AllDownloadsSizeInDriveL" );

    TInt allDownloadsSize( 0 );
    TInt numClientApps = iClientApps->Count();
    for( TInt apps = 0; apps < numClientApps; ++apps )
        {
        CArrayPtrFlat<CHttpDownload>* dlArray = (*iClientApps)[apps]->Downloads();
        TInt numDownloads = dlArray->Count();
        for( TInt dl = 0; dl < numDownloads; ++dl )
            {
            if( ( aDownload != (*dlArray)[dl]) && (*dlArray)[dl]->State() != EHttpDlMultipleMOCompleted 
                  && aDriveId == (*dlArray)[dl]->GetDestinationDriveID())
                {
                TInt32 totalSize(0);
                TInt32 downloadedSize(0);
                
                (*dlArray)[dl]->GetIntAttributeL(EDlAttrMultipleMOLength, totalSize);
                (*dlArray)[dl]->GetIntAttributeL(EDlAttrMultipleMODownloadedSize, downloadedSize);

                //Do not conside the downloads with unknown size
                if(KDefaultContentLength != totalSize)
                	allDownloadsSize += (totalSize - downloadedSize);
                }
            }
        }
    
    return allDownloadsSize;
    }
// -----------------------------------------------------------------------------
// CPIMEventPropertyConverter::ConvertExceptionDatesL
// Inserts exceptiondates to a parser.
// -----------------------------------------------------------------------------
//
void CPIMEventPropertyConverter::ConvertExceptionDatesL(const CArrayFix<
        TPIMDate>& aDates, CParserVCalEntity& aParser)
{
    JELOG2(EPim);
    TInt exDateCount = aDates.Count();
    if (exDateCount > 0)
    {
        CArrayPtrFlat<TVersitDateTime>* versitExDates =
            new(ELeave) CArrayPtrFlat<TVersitDateTime> (exDateCount);
        CleanupStack::PushL(versitExDates);
        CleanupResetAndDestroyPushL(*versitExDates);
        for (TInt i = 0; i < exDateCount; i++)
        {
            TVersitDateTime
            * versitDateTime =
                new(ELeave) TVersitDateTime(aDates.At(i).DateTime(), TVersitDateTime::EIsUTC);
            CleanupDeletePushL(versitDateTime);
            versitExDates->AppendL(versitDateTime);
            CleanupStack::Pop(versitDateTime); // versitDateTime
        }
        CParserPropertyValue* propertyValue =
            new(ELeave) CParserPropertyValueMultiDateTime(versitExDates);
        CleanupStack::Pop(2); // versitExDates is now owned by propertyValue
        AddPropertyToParserL(propertyValue, KVersitTokenEXDATE(), aParser);
        // Needed cleanup stack items are popped out in the AddPropretyToParserL
    }
}
EXPORT_C void CX509Certificate::InternalizeL(RReadStream& aStream)
	{
	if (iIssuerName != NULL) //just to check cert is uninitialised
		{
		User::Leave(KErrArgument);
		}
	iKeyFactory = new(ELeave) TX509KeyFactory;
	
	TInt len = aStream.ReadInt32L(); //Read the length of the streamed encoding
	HBufC8* temp= HBufC8::NewLC(len);	
	TPtr8 ptr=temp->Des();
	aStream.ReadL(ptr,len);
	iEncoding=temp->AllocL();
	CleanupStack::PopAndDestroy(); // temp

	TASN1DecSequence encSeq;
	TInt pos = 0;
	CArrayPtrFlat<TASN1DecGeneric>* seq = encSeq.DecodeDERLC(*iEncoding, pos, 3, 3);	
	TASN1DecGeneric* encSigAlg = seq->At(1);
	iSigningAlgorithm = CX509SigningAlgorithmIdentifier::NewL(encSigAlg->Encoding());
	TASN1DecBitString encBS;
	iSignature = encBS.ExtractOctetStringL(*(seq->At(2)));
	CleanupStack::PopAndDestroy();//seq	

	CSHA1* hash = CSHA1::NewL();
	CleanupStack::PushL(hash);
	iFingerprint = hash->Final(Encoding()).AllocL();
	CleanupStack::PopAndDestroy();//hash

	ConstructCertL();
	}
// -----------------------------------------------------------------------------
// CCMSAuthenticatedData::DecodeAttributesL
// Decodes an array of attributes
// -----------------------------------------------------------------------------
CArrayPtrFlat< CCMSAttribute >* CCMSAuthenticatedData::DecodeAttributesL(
    TASN1DecGeneric* aAttributesDec ) // generic decoder for the sequence
    {
    TASN1DecSequence sequenceDecoder;
    CArrayPtr< TASN1DecGeneric >* attributes =
        sequenceDecoder.DecodeDERLC( *aAttributesDec );
    TInt attributeCount = attributes->Count();
    if( attributeCount <  1 )
        {
        User::Leave( KErrArgument );
        }
    CArrayPtrFlat< CCMSAttribute >* retVal =
        new( ELeave ) CArrayPtrFlat< CCMSAttribute >( attributeCount );
    CleanupStack::PushL( retVal );
    for( TInt i = 0; i < attributeCount; i++ )
        {
        CCMSAttribute* attribute = CCMSAttribute::NewLC();
        attribute->DecodeL( attributes->At( i )->Encoding() );
        retVal->AppendL( attribute );
        // attribute is left in cleanup stack, as retVal has not been pushed
        // with ResetAndDestroyPushL
        }
    CleanupStack::Pop( attributeCount ); // all attributes
    CleanupStack::Pop( retVal );
    CleanupStack::PopAndDestroy( attributes );
    return retVal;
    }
void CWapDgrmTestStep::_Parse2L(CArrayPtrFlat<CSmsMessage>& aSmsArray,
						CWapReassemblyStore* aWapStore)
/**
 *  This method tests mainly CWapDatagram::DecodeConcatenatedMessagesL
 */
{
    TInt Count = aSmsArray.Count();

    // In reverse order
    // Note ! You can test additional features by changing value of
    // i or a global variable (insertSms). For example:
    // incrementing i by 1: a duplicate test
    // decrementing i by 1: not all datagrams are pushed to the store
    // ncreasing insertSms causes datagrams to be appended to the reserve array
    // Remember to set flush the reserve array on a later phase
    // by setting iIsFlushReserveArray true


    for (TInt i=Count-1;i>=iInsertSms;i--)
    {
        CWapDatagram* Wap=CWapDatagram::NewL(*(aSmsArray.At(i)));
        if (!Wap->IsComplete())
        {
            TInt Index = 0;
            TBool IsComplete = EFalse;
            IsComplete = aWapStore->AddMessageL(Index,*Wap);
            if (IsComplete)
            {
                aWapStore->GetDatagramL(Index,*Wap);
				aWapStore->BeginTransactionLC();
                aWapStore->DeleteEntryL(Index);
				aWapStore->CommitTransactionL();
                _Print(*Wap);
            }
        }
        else
            _Print(*Wap);

        delete Wap;
    }

	// append rest of the datagrams to the ReserveArray
	if (iInsertSms>0 && Count>1)
	{
		// reserve order here too
        for (TInt i=iInsertSms-1;i>=0;i--)
        {
            CWapDatagram* Wap=CWapDatagram::NewL(*(aSmsArray.At(i)));
            iReserveArray->AppendL(Wap);
        }
	}

    if (iIsFlushReserveArray)
    {
        _FlushReserveArrayL(aWapStore);
        iInsertSms = 0;
        iIsFlushReserveArray = EFalse;
    }
}
void CleanupArray(TAny* aArray)
{
    CArrayPtrFlat<MEikSrvNotifierBase2>* subjects =
        static_cast<CArrayPtrFlat<MEikSrvNotifierBase2>*>(aArray);

    subjects->ResetAndDestroy();
    delete subjects;
}
// -----------------------------------------------------------------------------
// CSIPSettListSIPProfSetTypeListItem::ResetAndDestroy
// For deleting array in case of leave
// -----------------------------------------------------------------------------
//
void CSIPSettListSIPProfSetTypeListItem::ResetAndDestroy( TAny* aPointerArray )
    {
    __GSLOGSTRING("CSIPSettListSIPProfSetTypeListItem::ResetAndDestroy" )
    CArrayPtrFlat<CAknEnumeratedText>* array =
        static_cast<CArrayPtrFlat<CAknEnumeratedText>*>( aPointerArray );
    array->ResetAndDestroy();
    delete array;
    }
EXPORT_C CArrayPtr<MNotifierBase2>* NotifierArray()
	{
	CArrayPtrFlat<MNotifierBase2>* subjects = new (ELeave) CArrayPtrFlat<MNotifierBase2>( 2 );
	CIPSecDialogNotifier* notifier = new (ELeave) CIPSecDialogNotifier();
    CleanupStack::PushL( notifier );
    subjects->AppendL( notifier );
    CleanupStack::Pop( notifier );
    return subjects;
	}
Exemple #14
0
void CX509SubjectPublicKeyInfo::ConstructL(const TDesC8& aBinaryData, TInt& aPos)
	{
	TASN1DecSequence encSeq;
	CArrayPtrFlat<TASN1DecGeneric>* seq = encSeq.DecodeDERLC(aBinaryData, aPos, 2, KMaxTInt);
	iAlgId = CX509AlgorithmIdentifier::NewL(seq->At(0)->Encoding());
	TASN1DecBitString encBS;
	iEncodedKeyData = encBS.ExtractOctetStringL(*(seq->At(1)));
	CleanupStack::PopAndDestroy();//seq
	}
Exemple #15
0
//***************************************************************************************//
//extra accessors
EXPORT_C const TPtrC8 CX509Certificate::SignedDataL() const
	{
	TASN1DecSequence encSeq;
	TInt pos = 0;
	CArrayPtrFlat<TASN1DecGeneric>* seq = encSeq.DecodeDERLC(*iEncoding, pos, 3, 3);
	TASN1DecGeneric* gen = seq->At(0);
	TPtrC8 res = gen->Encoding();
	CleanupStack::PopAndDestroy();
	return res;
	}
Exemple #16
0
// Entry point for Notifiers
EXPORT_C CArrayPtr<MEikSrvNotifierBase2>* NotifierArray()
	{
	//The notifierArray function CAN leave, despite no trailing L
	CArrayPtrFlat<MEikSrvNotifierBase2>* subjects = new (ELeave) CArrayPtrFlat<MEikSrvNotifierBase2>( 1 );
	CleanupStack::PushL(subjects);
	CCTSecurityDialogNotifier* notifier = CCTSecurityDialogNotifier::NewL();
	CleanupStack::PushL( notifier );
	subjects->AppendL( notifier );
	CleanupStack::Pop( 2,subjects);	//notifier, subjects
	return subjects;
	}
Exemple #17
0
void CX509ValidityPeriod::ConstructL(const TDesC8& aBinaryData, TInt& aPos)
	{
	TASN1DecSequence encSeq;
	CArrayPtrFlat<TASN1DecGeneric>* seq = encSeq.DecodeDERLC(aBinaryData, aPos);
	if (seq->Count() != 2)
		{
		User::Leave(KErrArgument);
		}
	TASN1DecX509Time decTime;
	iStart = decTime.DecodeDERL(*(seq->At(0)));
	iFinish = decTime.DecodeDERL(*(seq->At(1)));
	CleanupStack::PopAndDestroy();//seq + contents
	}
// -----------------------------------------------------------------------------
// CHttpConnHandler::ConnectionError
// ?implementation_description
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CHttpConnHandler::ConnectionError( TInt aError )
    {
    __ASSERT_DEBUG( iClientApp, DMPanic( KErrCorrupt ) );
    CArrayPtrFlat<CHttpDownload>* downloads = 
                                iClientApp->Downloads();

    for( TInt i = 0; i < downloads->Count(); ++i )
        {
        if( (*downloads)[i]->ConnHandler() == this )
            {
            (*downloads)[i]->ConnectionFailed( aError );
            }
        }
    }
// -----------------------------------------------------------------------------
// CHttpConnHandler::DoCancel
// ?implementation_description
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CHttpConnHandler::DoCancel()
    {
    LOGGER_ENTERFN( "DoCancel" );

    CArrayPtrFlat<CHttpDownload>* downloads = 
                                iClientApp->Downloads();
    for( TInt i = 0; i < downloads->Count(); ++i )
        {
        if( (*downloads)[i]->ConnHandler() == this )
            {
            (*downloads)[i]->ConnectionFailed( KErrCancel );
            }
        }
    }
/**
* If the certificate has decoded the members from TeletexString then the return value 
* may be incorrect because TeletexString type is not fully supported by this library.
* Instead the decode methods perform a direct conversion from 8 to 16bits by adding 
* null characters in the second byte of each character. This will work as expected 
* for cases where the string contains ASCII data.
*/
EXPORT_C CArrayPtrFlat<CX509Certificate>* CX509CertChain::DecodeCertsL(const TDesC8& aBinaryData)
	{
	CArrayPtrFlat<CX509Certificate>* temp = new(ELeave) CArrayPtrFlat<CX509Certificate> (1);
	TCleanupItem cleanupCerts(CleanupCertArray, temp);
	CleanupStack::PushL(cleanupCerts);
	TInt pos = 0;//start at the start
	while (pos < aBinaryData.Length())
		{
		CX509Certificate* cert = CX509Certificate::NewLC(aBinaryData, pos);
		temp->AppendL(cert);
		CleanupStack::Pop();
		}
	CleanupStack::Pop();//temp
	return temp;
	}
Exemple #21
0
void CX509Certificate::DecodeExtsL(const TDesC8& aBinaryData, TBool& aHasElementAlready)
	{
	TASN1DecSequence encSeq;
	TInt pos = 0;
	CArrayPtrFlat<TASN1DecGeneric>* seq = encSeq.DecodeDERLC(aBinaryData, pos);
	TInt count = seq->Count();
	for (TInt i = 0; i < count; i++)
		{
		TASN1DecGeneric* gen = seq->At(i);
		CX509CertExtension* ext = CX509CertExtension::NewLC(gen->Encoding());
		iExtensions->AppendL(ext);
		CleanupStack::Pop();//ext
		}
	CleanupStack::PopAndDestroy();//
	aHasElementAlready = ETrue;
	}
// -----------------------------------------------------------------------------
// CHttpConnHandler::ConnectionStageChanged
// ?implementation_description
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CHttpConnHandler::ConnectionStageChanged( TInt aStage )
    {
    CLOG_WRITE8_1( "Stage: %d", aStage );

    iConnStage = aStage;

    if( iConnStage == KConnectionUninitialised || 
        iConnStage == KDataTransferTemporarilyBlocked
        )
        {
        __ASSERT_DEBUG( iClientApp, DMPanic( KErrCorrupt ) );
        CArrayPtrFlat<CHttpDownload>* downloads = 
                                    iClientApp->Downloads();
        for( TInt i = 0; i < downloads->Count(); ++i )
            {
            if( (*downloads)[i]->ConnHandler() == this )
                {
                if( iConnStage == KConnectionUninitialised )
                    {
                    // from now on this name is invalid -> forget it!
                    delete iConnName; iConnName = NULL;

                    (*downloads)[i]->Disconnected();
                    }
                else
                    {
                    (*downloads)[i]->Suspended();
                    }
                }
            }

        if( iConnStage == KConnectionUninitialised )
            {
            ShutDown();
            }
        if ( iConnStage == KDataTransferTemporarilyBlocked )
            {
            iShutDown->Start( KShutDownTimer );
            }     
        }
    else if( iConnStage == KLinkLayerOpen )
        // connection open
        {
        Connected();
        }
    }
// -----------------------------------------------------------------------------
// CHttpConnHandler::ShutDown
//
// Connection notification is not canceled here, because need to know
// when the connection is really closed. Forget the connection name, set by
// the client app only if the connection is really closed.
// -----------------------------------------------------------------------------
//
void CHttpConnHandler::ShutDown( TBool aFromDestructor )
    {
    CLOG_WRITE( "ShutDown" );
    CLOG_WRITE8_1( "dest: %d", aFromDestructor );

    iNewConnection = EFalse;

    if( iShutDown )
        {
        iShutDown->Cancel();
        }

    if( iConnNotif )
        {
        iConnNotif->Cancel();
        }
    
    Cancel();
    CLOG_WRITE( "Canceled" );
    iConnStage = KConnectionUninitialised;

	CLOG_WRITE( "Closing connection" );
    iConnection.Close();
    CLOG_WRITE( "Conn closed" );

    // Pause the downloads  
    CArrayPtrFlat<CHttpDownload>* downloads = 
                                iClientApp->Downloads();
    for( TInt i = 0; i < downloads->Count(); ++i )
        {
        if( (*downloads)[i]->ConnHandler() == this )
            {
            TRAP_IGNORE( (*downloads)[i]->PauseL( ETrue ) );
            }
        }
    if( !iClientInst && !aFromDestructor )
        // Client instance already exited and all download disconnected ->
        // no need for this connhandler anymore.
        // the next client will create a new connhandler and assigned downloads
        // will use that one.
        {
        CLOG_WRITE( "Destroy me" );
        // DO NOT USE 'this' after this call!!!
        iClientApp->DestroyConnHandler( this );
        }
    }
// -----------------------------------------------------------------------------
// CHttpDownloadManagerServerEngine::FindDownload
// ?implementation_description
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
CHttpDownload* 
    CHttpDownloadManagerServerEngine::FindDownload( TInt32 aDownloadId )
    {
    for( TInt apps = 0; apps < iClientApps->Count(); ++apps )
        {
        CArrayPtrFlat<CHttpDownload>* allDownloads = (*iClientApps)[apps]->Downloads();

        for( TInt i = 0; i < allDownloads->Count(); ++i )
            {
            if( (*allDownloads)[i]->Id() == aDownloadId )
                {
                return (*allDownloads)[i];
                }
            }
        }

    return NULL;        
    }
// -----------------------------------------------------------------------------
// CHttpConnHandler::Referencies
// ?implementation_description
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
TInt CHttpConnHandler::Referencies()
    {
    TInt refs( 0 );

    __ASSERT_DEBUG( iClientApp, DMPanic( KErrCorrupt ) );
    CArrayPtrFlat<CHttpDownload>* downloads = 
                                iClientApp->Downloads();

    for( TInt i = 0; i < downloads->Count(); ++i )
        {
        if( (*downloads)[i]->ConnHandler() == this )
            {
            ++refs;
            }
        }

    return refs;
    }
Exemple #26
0
/**
 Sets the animation frames to the player.
*/
void RBitmapAnim::SetFrameArrayL(const CArrayPtrFlat<CBitmapFrameData>& aFrameArray)
	{
	const TInt count = aFrameArray.Count();

	if (count > 0)
		{
		User::LeaveIfError(CommandReply(EBitmapAnimCommandResetFrameArray));
		CBitmapFrameData* frameData;
		User::LeaveIfError(CommandReply(EBitmapAnimCommandClearDataFrames));

		TInt index = 0;

		for (index = 0; index < count; index++)
			{
			frameData = aFrameArray.At(index);
			SetFrameL(*frameData, EBitmapAnimCommandSetDataFrame);
			}
		}
	}
CArrayPtr<MEikSrvNotifierBase2>* NotifierArray()
{
    CArrayPtrFlat<MEikSrvNotifierBase2>* notifiers = new CArrayPtrFlat<MEikSrvNotifierBase2>(1);
    if (notifiers)
    {
        TRAPD(err, CreateNotifiersL(*notifiers));
        if (err)
        {
            TInt count = notifiers->Count();
            while (count--)
            {
                (*notifiers)[count]->Release();
            }
            delete notifiers;
            notifiers = NULL;
        }
    }
    return notifiers;
}
LOCAL_C CArrayPtr<MEikSrvNotifierBase2>* NotifierArray()
	{
	CArrayPtrFlat<MEikSrvNotifierBase2>* notifiers =
        new CArrayPtrFlat<MEikSrvNotifierBase2>(1);
        if (notifiers)
        {
          TRAPD(err, CreateNotifiersL(notifiers));
          if (err)
          { // release any notifiers we have created
		          TInt count = notifiers->Count();
              while (--count >= 0)
                {
                (*notifiers)[count]->Release();
                }
              delete notifiers;
              notifiers = NULL;
          }
        }
	return notifiers;
	}
// ---------------------------------------------------------------------------
// ?description
// ---------------------------------------------------------------------------
//
CArrayPtr<MEikSrvNotifierBase2>* CreateNotifierArrayL()
    {
    CArrayPtrFlat<MEikSrvNotifierBase2>* notifiers = 
        new( ELeave ) CArrayPtrFlat<MEikSrvNotifierBase2>( KBTNotifWrapperArraySize );
    CleanupStack::PushL( notifiers );
    // Create all the notifiers:
    // Connection authorization notifier
    CreateAndAppendNotifierLC( *notifiers, KBTManAuthNotifierUid, KBTAuthChannel );
    // Old and new PIN notifiers
    CreateAndAppendNotifierLC( *notifiers, KBTManPinNotifierUid, KBTAuthChannel );
    CreateAndAppendNotifierLC( *notifiers, KBTPinCodeEntryNotifierUid, KBTAuthChannel );
    // Secure simple pairing notifiers
    CreateAndAppendNotifierLC( *notifiers, KBTNumericComparisonNotifierUid, KBTAuthChannel );
    CreateAndAppendNotifierLC( *notifiers, KBTPasskeyDisplayNotifierUid, KBTAuthChannel );
    
    // todo: add
    // KBTUserConfirmationNotifierUid for incoming JW dedicated bonding.
    
    CreateAndAppendNotifierLC( *notifiers, KDeviceSelectionNotifierUid, KBTDiscoveryChannel );
    
    CreateAndAppendNotifierLC( *notifiers, KBTGenericInfoNotifierUid, KBTInfoChannel );

    CreateAndAppendNotifierLC( *notifiers, KPowerModeSettingNotifierUid, KBTPowerModeChannel );
    /*
     * todo:
     * Other notifiers to be migrated:
     * 
     * existing stack notifiers:
     * CreateAndAppendNotifierL( aArray, KPbapAuthNotifierUid, KBTObexPINChannel );
     * 
     * S60-defined platform:
     * CreateAndAppendNotifierL( aArray, KBTObexPasskeyQueryNotifierUid, KBTObexPINChannel );
     * CreateAndAppendNotifierL( aArray, KBTGenericQueryNotifierUid, KBTQueryChannel );
     * 
     * new (PAN-related):
     * CreateAndAppendNotifierL( aArray, KBTPanDeviceSelectionNotifierUid, KBTDiscoveryChannel );
     * CreateAndAppendNotifierL( aArray, KBTPanNapUplinkAuthorisationNotifierUid, KBTAuthChannel );
     */
    CleanupStack::Pop( notifiers->Count() + 1, notifiers );  // Each notifier + notifier array itself
    return notifiers;
    }
//------------------------------------------------------------------------
//CHttpDownloadManagerServerEngine::MMCModeChanged
//------------------------------------------------------------------------
void CHttpDownloadManagerServerEngine::MMCModeChanged( TBool aMmcPresent )
    {
    for( TInt apps = 0; apps < iClientApps->Count(); ++apps )
        {
        CArrayPtrFlat<CHttpDownload>* allDownloads = (*iClientApps)[apps]->Downloads();

        for( TInt i = 0; i < allDownloads->Count(); ++i )
            {
            QueryMMCUniqueId();
            
            if( aMmcPresent )
                {
                (*allDownloads)[i]->MediaInserted( iMMCUniqueID );
                }
            else
                {
                (*allDownloads)[i]->MediaRemoved( iMMCUniqueID );
                }
            }
        }
    }