TUint32 CMTPDeviceDataProvider::AddEntryL( const TDesC& aPath, TUint32 aParentHandle, TUint32 aStorageId, CMTPObjectMetaData& aObjectInfo  )
    {
    OstTraceFunctionEntry0( CMTPDEVICEDATAPROVIDER_ADDENTRYL_ENTRY );
    
    TBool isFolder( EFalse );
    BaflUtils::IsFolder( Framework().Fs(), aPath, isFolder );
    
    __ASSERT_ALWAYS( isFolder, User::Leave( KErrArgument ));
    __ASSERT_ALWAYS( aParentHandle != KMTPHandleNone, User::Leave( KErrArgument ));
    __ASSERT_ALWAYS( Framework().StorageMgr().ValidStorageId( aStorageId ), User::Leave( KErrArgument ));

    OstTraceExt1(TRACE_NORMAL, CMTPDEVICEDATAPROVIDER_ADDENTRYL, "Add Entry for Path:%S", aPath);
    aObjectInfo.SetUint( CMTPObjectMetaData::EDataProviderId, Framework().DataProviderId() );
    aObjectInfo.SetUint( CMTPObjectMetaData::EFormatCode, EMTPFormatCodeAssociation );
    aObjectInfo.SetUint( CMTPObjectMetaData::EStorageId, aStorageId );
    aObjectInfo.SetDesCL( CMTPObjectMetaData::ESuid, aPath );
    aObjectInfo.SetUint( CMTPObjectMetaData::EFormatSubCode, EMTPAssociationTypeGenericFolder );
    aObjectInfo.SetUint( CMTPObjectMetaData::EParentHandle, aParentHandle );
    aObjectInfo.SetUint( CMTPObjectMetaData::ENonConsumable, EMTPConsumable );
    
    //For example 
    //C:\\Documents\\Sample\\Sample1\\
    //Then "Sample1" is inserted into folderObjects
    TUint length = aPath.Length()-1;//remove '\'
    TPtrC tailFolder( aPath.Ptr(), length );
    TInt pos = tailFolder.LocateReverse( KPathDelimiter ) + 1;
    tailFolder.Set( tailFolder.Right(length - pos));

    aObjectInfo.SetDesCL( CMTPObjectMetaData::EName, tailFolder );
    
    Framework().ObjectMgr().InsertObjectL( aObjectInfo );
    OstTraceFunctionExit0( CMTPDEVICEDATAPROVIDER_ADDENTRYL_EXIT );
    return aObjectInfo.Uint( CMTPObjectMetaData::EHandle );
    }
/**
Second phase constructor.
*/
void CMTPDeviceDataProvider::ConstructL()
    {
    OstTraceFunctionEntry0( CMTPDEVICEDATAPROVIDER_CONSTRUCTL_ENTRY );
    iDevDpSingletons.OpenL(Framework());
    iPtrDataStore = &(iDevDpSingletons.DeviceDataStore());
    iDpSingletons.OpenL(Framework());

    iExclusionMgr = CMTPDevDpExclusionMgr::NewL(Framework());
    iDpSingletons.SetExclusionMgrL(*iExclusionMgr);

    iStorageWatcher = CMTPStorageWatcher::NewL(Framework());

    const TUint KProcessLimit = iDevDpSingletons.ConfigMgr().UintValueL(CMTPDeviceDpConfigMgr::EEnumerationIterationLength);

 	TRAPD(err, LoadExtnPluginsL());
 //	__ASSERT_DEBUG((err == KErrNone), Panic(_L("Invalid resource file ")));
 	if(KErrNone != err)
		{
	    OstTrace0(TRACE_ERROR, CMTPDEVICEDATAPROVIDER_CONSTRUCTL, 
	            "\nTere is an issue in loading the plugin !!!!!\n");
		}

    iEnumerator = CMTPFSEnumerator::NewL(Framework(), iDpSingletons.ExclusionMgrL(), *this, KProcessLimit);
    iFrameWork.OpenL();

    OstTraceFunctionExit0( CMTPDEVICEDATAPROVIDER_CONSTRUCTL_EXIT );
    }
Example #3
0
void *Routine(void *arg) {
    Baton *baton(reinterpret_cast<Baton *>(arg));

    void *(*dlopen)(const char *, int);
    dlset(baton, dlopen, "dlopen");

    if (baton->dlsym(RTLD_DEFAULT, "JSEvaluateScript") == NULL)
        dlopen(Framework(JavaScriptCore), RTLD_GLOBAL | RTLD_LAZY);

    void *(*objc_getClass)(const char *);
    dlset(baton, objc_getClass, "objc_getClass");

    if (objc_getClass("WebUndefined") == NULL)
        dlopen(Framework(WebKit), RTLD_GLOBAL | RTLD_LAZY);

    void *handle(dlopen(baton->library, RTLD_LAZY | RTLD_LOCAL));
    if (handle == NULL) {
        baton->dlerror();
        return NULL;
    }

    void (*CYHandleServer)(pid_t);
    dlset(baton, CYHandleServer, "CYHandleServer", handle);

    CYHandleServer(baton->pid);

    return NULL;
}
void CWSStarHttpClient::BaseConstructL()
    {
    CSenInternalServiceConsumer::ConstructL();
    iPolicySession = CWSStarServiceSession::NewL(Framework());
    iPolicySession->AddConsumerL(*this);
    iPolicySession->SetEndPointL(iInitializer->Endpoint());
    iPolicySession->InitializeFromL(*iInitializer);
    ipTransport = Framework().Manager().CreateL(*iPolicySession, NULL);        
    TLSLOG_L(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,"CWSStarHttpClient::ConstructL");
    }
TUint32 CMTPDeviceDataProvider::GetStorageIdL( const TDesC& aPath )
    {
    OstTraceFunctionEntry0( CMTPDEVICEDATAPROVIDER_GETSTORAGEIDL_ENTRY );

    TChar driveLetter = aPath[0];
    TInt drive;
    LEAVEIFERROR( Framework().Fs().CharToDrive( driveLetter, drive ),
            OstTraceExt1( TRACE_ERROR, CMTPDEVICEDATAPROVIDER_GETSTORAGEIDL, "can't convert driver letter %c to drive!", driveLetter));

    OstTraceFunctionExit0( CMTPDEVICEDATAPROVIDER_GETSTORAGEIDL_EXIT );
    
    return Framework().StorageMgr().FrameworkStorageId( static_cast<TDriveNumber>( drive ));
    }
// -----------------------------------------------------------------------------
// CMediaMtpDataProvider::LocateRequestProcessorL
// Find or create a request processor that can process the request
// -----------------------------------------------------------------------------
//
TInt CMediaMtpDataProvider::LocateRequestProcessorL( const TMTPTypeRequest& aRequest,
    MMTPConnection& aConnection )
    {
    TInt index = KErrNotFound;
    TInt count = iActiveProcessors.Count();
    for ( TInt i = 0; i < count; i++ )
        {
        if ( iActiveProcessors[i]->Match( aRequest, aConnection ) )
            {
            index = i;
            break;
            }
        }
    if ( index == KErrNotFound )
        {
        MMmRequestProcessor* processor =
            MediaMtpDataProviderProcessor::CreateL( Framework(),
                aRequest,
                aConnection,
                *this );

        CleanupReleasePushL( *processor );
        iActiveProcessors.AppendL( processor );
        CleanupStack::Pop( processor );
        index = count;
        }

    return index;
    }
void CMTPDeviceDataProvider::StartStorageEnumerationL()
    {
    OstTraceFunctionEntry0( CMTPDEVICEDATAPROVIDER_STARTSTORAGEENUMERATIONL_ENTRY );
    iStorageWatcher->EnumerateStoragesL();
    Framework().StorageEnumerationCompleteL();
    OstTraceFunctionExit0( CMTPDEVICEDATAPROVIDER_STARTSTORAGEENUMERATIONL_EXIT );
    }
void CMTPDeviceDataProvider::OnDeviceFolderChangedL( TMTPEventCode aEventCode, CMTPObjectMetaData& aObjectInfo )
    {
    OstTraceFunctionEntry0( CMTPDEVICEDATAPROVIDER_ONDEVICEFOLDERCHANGEDL_ENTRY );
    
    iEvent.Reset();
    
    switch( aEventCode )
        {
    case EMTPEventCodeObjectAdded:
        {
        OstTrace0(TRACE_NORMAL, CMTPDEVICEDATAPROVIDER_ONDEVICEFOLDERCHANGEDL, "Send event for object add");
        iEvent.SetUint16( TMTPTypeEvent::EEventCode, EMTPEventCodeObjectAdded );
        iEvent.SetUint32( TMTPTypeEvent::EEventSessionID, KMTPSessionAll );
        iEvent.SetUint32( TMTPTypeEvent::EEventTransactionID, KMTPTransactionIdNone );
        TUint32 handle = aObjectInfo.Uint( CMTPObjectMetaData::EHandle );
        iEvent.SetUint32( TMTPTypeEvent::EEventParameter1, handle );
        }
        break;
    default:
        break;
        }
    
    Framework().SendEventL(iEvent);
    
    OstTraceFunctionExit0( CMTPDEVICEDATAPROVIDER_ONDEVICEFOLDERCHANGEDL_EXIT );
    }
// -----------------------------------------------------------------------------
// CMediaMtpDataProvider::ConstructL
// Second-phase construction
// -----------------------------------------------------------------------------
//
void CMediaMtpDataProvider::ConstructL()
    {
    PRINT( _L( "MM MTP => CMediaMtpDataProvider::ConstructL" ) );

    iMediaEnumerator = CMediaMtpDataProviderEnumerator::NewL( Framework(), *this );

    CMmMtpDpAccessSingleton::CreateL( Framework() );

    GetSupportedFormatL();
    GetSupportedPropL();
    GetAllSupportedPropL();

    iPropSettingUtility = CMediaMtpDataProviderPropertySettingUtility::NewL();
    iDescriptionUtility = CMediaMtpDataProviderDescriptionUtility::NewL();

    PRINT( _L( "MM MTP <= CMediaMtpDataProvider::ConstructL" ) );
    }
Example #10
0
void CMTPDeviceDataProvider::OnDevicePropertyChangedL (TMTPDevicePropertyCode& aPropCode)
	{
	iEvent.Reset();
	iEvent.SetUint16(TMTPTypeEvent::EEventCode, EMTPEventCodeDevicePropChanged );
	iEvent.SetUint32(TMTPTypeEvent::EEventSessionID, KMTPSessionAll);
	iEvent.SetUint32(TMTPTypeEvent::EEventTransactionID, KMTPTransactionIdNone);
	iEvent.SetUint32(TMTPTypeEvent::EEventParameter1, aPropCode);
	Framework().SendEventL(iEvent);
	}
// -----------------------------------------------------------------------------
// CMediaMtpDataProvider::NotifyEnumerationCompleteL
// enumeration completed
// -----------------------------------------------------------------------------
//
void CMediaMtpDataProvider::NotifyEnumerationCompleteL( TUint32 /*aStorageId*/,
    TInt /*aError*/ )
    {
    Framework().ObjectEnumerationCompleteL( iPendingEnumerations[KActiveEnumeration] );
    iPendingEnumerations.Remove( KActiveEnumeration );
    if ( iPendingEnumerations.Count() )
        {
        iMediaEnumerator->StartL( iPendingEnumerations[KActiveEnumeration] );
        }
    }
Example #12
0
Framework FrameworkFactory::NewFramework(
  const FrameworkConfiguration& configuration,
  std::ostream* logger)
{
  std::unique_ptr<CoreBundleContext> ctx(
    new CoreBundleContext(configuration, logger));
  auto fwCtx = ctx.get();
  std::shared_ptr<CoreBundleContext> holder(
    std::make_shared<CoreBundleContextHolder>(std::move(ctx)), fwCtx);
  holder->SetThis(holder);
  return Framework(holder->systemBundle);
}
//---------------------------------------------------------------------------
// Obtain Transport using a factory from Core Manager
//---------------------------------------------------------------------------
//
MSenTransport& CWSStarHttpClient::TransportL()
    {
    if(!ipTransport)
        {
        // Core is capable of working as transport factory, too.
        // The returned transport instancies may or may not be
        // ECOM plugins:
        TLSLOG_L(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,"CWSStarHttpClient::Instantiating new transport");
        ipTransport = Framework().Manager().CreateL(*iPolicySession, iPolicySession); 
        }
    return *ipTransport;
    }
// -----------------------------------------------------------------------------
// CMediaMtpDataProvider::RenameObjectL
// Process the changed folder
// -----------------------------------------------------------------------------
//
void CMediaMtpDataProvider::RenameObjectL( const TMTPNotificationParamsHandle& aObject )
    {
    PRINT2( _L( "MM MTP => CMediaMtpDataProvider::RenameObjectL folder handle=0x%x, modified name=%S" ), aObject.iHandleId, &(aObject.iFileName) );

    if ( !iRenameObject )
        {
        iRenameObject = CRenameObject::NewL( Framework(), GetWrapperL() );
        }

    iRenameObject->StartL( aObject.iHandleId, aObject.iFileName );

    PRINT( _L( "MM MTP <= CMediaMtpDataProvider::RenameObjectL" ) );
    }
// ---------------------------------------------------------------------------
// CMediaMtpDataProvider::GetDefaultStorageIdL
//
// ---------------------------------------------------------------------------
//
TUint32 CMediaMtpDataProvider::GetDefaultStorageIdL() const
    {
    TInt driveNum = -1;
    TInt err = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultMassStorage, driveNum );
    PRINT2( _L( "MM MTP <> GetDefaultDrive, driveNum = %d, err = %d" ), driveNum, err );

    TDriveInfo driveInfo;
    User::LeaveIfError( Framework().Fs().Drive( driveInfo, driveNum ) );
    PRINT3( _L( "driveInfo.iType = 0x%x, driveInfo.iDriveAtt = 0x%x, driveInfo.iMediaAtt = 0x%x" ),
        driveInfo.iType, driveInfo.iDriveAtt, driveInfo.iMediaAtt );
    if( driveInfo.iType == EMediaNotPresent || driveInfo.iType == EMediaUnknown )
        {
        err = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRemovableMassStorage, driveNum );
        User::LeaveIfError( Framework().Fs().Drive( driveInfo, driveNum ) );
        if( driveInfo.iType == EMediaNotPresent || driveInfo.iType == EMediaUnknown )
            {
            err = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultPhoneMemory, driveNum );
            PRINT( _L( "MM MTP <> Memory card doesn't exist, set PhoneMemory to default" ) );
            }
        }

    return Framework().StorageMgr().FrameworkStorageId( TDriveNumber( driveNum ) );
    }
// -----------------------------------------------------------------------------
// CMediaMtpDataProvider::ObjectAddedL
// Process the added object
// -----------------------------------------------------------------------------
//
void CMediaMtpDataProvider::ObjectAddedL( TUint32 aObjectHandle )
    {
    PRINT1( _L( "MM MTP => CMediaMtpDataProvider::ObjectAddedL aHandle=0x%x" ), aObjectHandle );

    CMTPObjectMetaData* object(CMTPObjectMetaData::NewLC());
    Framework().ObjectMgr().ObjectL( aObjectHandle, *object );

    //Since the object's processor is not route to media dp, its format code should be reset
    TUint formatCode = MmMtpDpUtility::FormatFromFilename( object->DesC( CMTPObjectMetaData::ESuid ) );
    object->SetUint( CMTPObjectMetaData::EFormatCode, formatCode );
    GetWrapperL().AddObjectL( *object );
    PRINT2( _L( "MM MTP => CMediaMtpDataProvider::ObjectAddedL formatCode=0x%x Suid=%S" ), formatCode, &(object->DesC( CMTPObjectMetaData::ESuid ) ) );
    CleanupStack::PopAndDestroy( object );
    PRINT( _L( "MM MTP <= CMediaMtpDataProvider::ObjectAddedL" ) );
    }
Example #17
0
void CMTPDeviceDataProvider::NotifyEnumerationCompleteL(TUint32 aStorageId, TInt /*aError*/)
	{
    OstTraceFunctionEntry0( CMTPDEVICEDATAPROVIDER_NOTIFYENUMERATIONCOMPLETEL_ENTRY );
    __ASSERT_DEBUG((aStorageId == iPendingEnumerations[KMTPDeviceDpActiveEnumeration]), User::Invariant());
    if (iPendingEnumerations.Count() > 0)
        {
        iPendingEnumerations.Remove(KMTPDeviceDpActiveEnumeration);
        }
	switch(iEnumeratingState)
		{
	case EEnumeratingDeviceDataStore:
	case EEnumeratingFolders:
	    iEnumeratingState = EEnumerationComplete;
	    Framework().ObjectEnumerationCompleteL(aStorageId);
		//iEnumerator->StartL(iPendingEnumerations[KMTPDeviceDpActiveEnumeration]);
		break;
	case EEnumerationComplete:
	default:
		__DEBUG_ONLY(User::Invariant());
		break;
		}
	OstTraceFunctionExit0( CMTPDEVICEDATAPROVIDER_NOTIFYENUMERATIONCOMPLETEL_EXIT );
	}
Example #18
0
/**
Find or create a request processor that can process the request
@param aRequest    The request to be processed
@param aConnection The connection from which the request comes
@return the index of the found/created request processor
*/
TInt CMTPDeviceDataProvider::LocateRequestProcessorL(const TMTPTypeRequest& aRequest, MMTPConnection& aConnection)
    {
    OstTraceFunctionEntry0( CMTPDEVICEDATAPROVIDER_LOCATEREQUESTPROCESSORL_TMTPTYPEREQUEST_ENTRY );
    TInt index = KErrNotFound;
    TInt count = iActiveProcessors.Count();
    for(TInt i = 0; i < count; i++)
        {
        if(iActiveProcessors[i]->Match(aRequest, aConnection))
            {
            index = i;
            break;
            }
        }
    if(index == KErrNotFound)
        {
        MMTPRequestProcessor* processor = MTPDeviceDpProcessor::CreateL(Framework(), aRequest, aConnection);
        __ASSERT_DEBUG(processor, Panic(EMTPDevDpNoMatchingProcessor));
        CleanupReleasePushL(*processor);
        iActiveProcessors.AppendL(processor);
        TUint16 operationCode(aRequest.Uint16(TMTPTypeRequest::ERequestOperationCode));

       if (operationCode >= EMTPOpCodeGetDevicePropDesc && operationCode <=EMTPOpCodeResetDevicePropValue)
		{
		TUint propCode = aRequest.Uint32(TMTPTypeRequest::ERequestParameter1);
		TInt foundplugin = FindExtnPlugin (propCode);
		if(foundplugin!= KErrNotFound)
			{
			iDevDpSingletons.DeviceDataStore().SetExtnDevicePropDp(iExtnPluginMapArray[foundplugin]->ExtPlugin());
			}
		}
	        CleanupStack::Pop();
	        index = count;
        }
    OstTraceFunctionExit0( CMTPDEVICEDATAPROVIDER_LOCATEREQUESTPROCESSORL_TMTPTYPEREQUEST_EXIT );
    return index;
    }
Example #19
0
void CMTPDeviceDataProvider::Supported(TMTPSupportCategory aCategory, RArray<TUint>& aArray) const
    {
    OstTraceFunctionEntry0( CMTPDEVICEDATAPROVIDER_SUPPORTED_ENTRY );
    TInt mode = Framework().Mode();
    switch (aCategory)
        {
    case EAssociationTypes:
        aArray.Append(EMTPAssociationTypeGenericFolder);        
        break;

    case EDeviceProperties:
        {
        TInt count = sizeof(KMTPDeviceDpSupportedProperties) / sizeof(TUint16);
        for(TInt i = 0; i < count; i++)
            {
            if(( (EModePTP == mode) ||(EModePictBridge == mode) )
				&& ( 0x4000 == (KMTPDeviceDpSupportedProperties[i] & 0xE000)))
            	{
            	//in ptp mode support only ptp properties
            	aArray.Append(KMTPDeviceDpSupportedProperties[i]);
            	}
            else
            	{
            	aArray.Append(KMTPDeviceDpSupportedProperties[i]);
            	}
            }
           
        TInt noOfEtxnPlugins = iExtnPluginMapArray.Count();
        for(TInt i=0; i < noOfEtxnPlugins; i++)
	        {
	        iExtnPluginMapArray[i]->ExtPlugin()->Supported(aCategory, *iExtnPluginMapArray[i]->SupportedOpCodes(), (TMTPOperationalMode)mode );// or pass the incoming array
	        TInt count =iExtnPluginMapArray[i]->SupportedOpCodes()->Count();
       												  														//bcoz it needs to b updated
	        for (TInt r=0; r <count; r++ )
	        	{
	        	aArray.Append((*iExtnPluginMapArray[i]->SupportedOpCodes())[r]);
	        	}
	       }

       TRAP_IGNORE(iPtrDataStore->SetSupportedDevicePropertiesL(aArray));
       }
        break;

    case EEvents:
        {
        TInt count = sizeof(KMTPDeviceDpSupportedEvents) / sizeof(TUint16);
        for(TInt i = 0; i < count; i++)
            {
            TUint16 event = KMTPDeviceDpSupportedEvents[i];
            switch(mode)
                {
            case EModePTP:
            case EModePictBridge:
                // In the initial implementation all device DP events pass this test, but this
                // catches any others added in the future that fall outside this range.
                if(event <= EMTPEventCodePTPEnd)
                    {
                    aArray.Append(event);
                    }
                break;

            case EModeMTP:
                // In the initial implementation all device DP events pass this test, but this
                // catches any others added in the future that fall outside this range.
                if(event <= EMTPEventCodeMTPEnd)
                    {
                    aArray.Append(event);
                    }
                break;

            default:
            	// No other valid modes are defined
                break;
                }
            }
        }
        break;

    case EObjectCaptureFormats:
    case EObjectPlaybackFormats:
  		// Only supports association objects
        aArray.Append(EMTPFormatCodeAssociation);
        break;


    case EOperations:
        {
        TInt count = sizeof(KMTPDeviceDpSupportedOperations) / sizeof(TUint16);
        for(TInt i = 0; i < count; i++)
            {
            aArray.Append(KMTPDeviceDpSupportedOperations[i]);
            }
        }
        break;

    case EStorageSystemTypes:
        aArray.Append(CMTPStorageMetaData::ESystemTypeDefaultFileSystem);
        break;

    case EObjectProperties:
        {
        TInt count(sizeof(KMTPDeviceDpSupportedObjectProperties) / sizeof(KMTPDeviceDpSupportedObjectProperties[0]));
        for (TInt i(0); (i < count); i++)
            {
            aArray.Append(KMTPDeviceDpSupportedObjectProperties[i]);
            }
        }
        break;

    default:
        // Unrecognised category, leave aArray unmodified.
        break;
        }
    OstTraceFunctionExit0( CMTPDEVICEDATAPROVIDER_SUPPORTED_EXIT );
    }
// -----------------------------------------------------------------------------
// CMediaMtpDataProvider::StartStorageEnumerationL
// Start Storage enumeration
// -----------------------------------------------------------------------------
//
void CMediaMtpDataProvider::StartStorageEnumerationL()
    {
    Framework().StorageEnumerationCompleteL();
    }
Example #21
0
/**
 *This method will return the reference to MMTPDataProviderFramework from CMTPDataProviderPlugin
 */
MMTPDataProviderFramework& CMTPDeviceDataProvider::DataProviderFramework ()
	{
	return Framework();
	}
TInt CIdWsfAuthenticationServiceClient::ParseResponseL(TDesC8& aMessage,
                                                       HBufC8*& aParsedMessage)
    {
    TInt retVal(KErrNone); 

    HBufC8* pNextMessage = NULL;

    CSenSecurityMechanism* pAuthenticator = NULL;
    CIdWsfSaslMessage* pSaslResponse =
                            CIdWsfSaslMessage::NewL(Framework().Manager());
    CleanupStack::PushL(pSaslResponse);

    pSaslResponse->SetReader(*Framework().Manager().XMLReader());
    pSaslResponse->BuildFrom(aMessage);

    if(pSaslResponse->IsOk())
        {
        iCState = EHasSession;
        TransactionCompleted();
        iSession = iDsSession;  // The "stateObject" in Java is
                                // a "iSession" in here
        delete iAuthenticator;
        iAuthenticator = NULL;
        }


    if(iCState == EAuthServiceClient)
        {
        // expect a SASLResponse and look for the Status,
        // if "continue" instantiate a SASLMechanism
        // and let it deal with the message
        TLSLOG(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel ,(_L("Parse Response - EAuthServiceClient")));

        TPtrC8 mechName = pSaslResponse->Mechanism();

        if(pSaslResponse->IsContinue())
            {
            pAuthenticator = Framework().Manager().MechanismNamedL(mechName);
            if(pAuthenticator)
                {
                // mechanism ECOM plugin found...

                pAuthenticator->SetTransforms(pSaslResponse->Transforms());
                
                if (ipAccount->Password() == KNullDesC8)
                    {
                    TLSLOG(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel ,(_L("Password will be asked from user.")));
                    iAttempts++;
                    }
                
                // This may invoke username/password UI prompt
                pAuthenticator->SetIdentity(ipAccount, &Framework().Manager());

                //if (pAuthenticator->IsPasswordFromUser() &&
                //  pAuthenticator->MaxAttempts()>0)
                if (pAuthenticator->MaxAttempts()>0)
                    {
                    //iAttempts++;
                    iMaxAttempts = pAuthenticator->MaxAttempts();
                    }
                delete iAuthenticator;
                iAuthenticator = NULL;
                iAuthenticator = pAuthenticator;
                iCState = ESaslMechanism;
                }
            else
                {
                retVal = KErrNotFound;
                }
            }
        if(pSaslResponse->IsAbort())
            {
            // if response is "abort" that means there is no matching
            // SASLMechanism and we should quite the whole process
            TransactionCompleted();
            pNextMessage = NULL;
            }
        }

    if(iCState == ESaslMechanism)
        {
        TLSLOG(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel ,(_L("Parse Response - ESaslMechanism")));
        pAuthenticator = iAuthenticator;

        if (pSaslResponse->IsAbort())
            {
            TLSLOG(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel ,(_L("SASL Response: Abort")));
            TLSLOG_FORMAT((KSenCoreServiceManagerLogChannelBase   , KNormalLogLevel  ,_L("      Attempts : %d, Max Attempts : %d"),
                                iAttempts, iMaxAttempts));
            // we could retry if allowed, otherwise quit the process
            if (iAttempts < iMaxAttempts)
                {
                pAuthenticator->ClearPasswordL();
                iAttempts++;    // even if we cannot get a new password
                                // we count this as an attempt!

                TLSLOG(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel ,(_L("ESaslMechanism - Create a new init request")));

                CIdWsfSaslMessage* pInitMessage =
                    CIdWsfSaslMessage::NewL(Framework().Manager(),
                                            KSaslXmlns,
                                            KSaslRequestName,
                                            KSaslRequestQName);
                CleanupStack::PushL(pInitMessage); // push pInitMessage
                pInitMessage->ConstructInitRequestFromL(iAuthenticator->Name(),
                                                        *ipAccount);
                pNextMessage = pInitMessage->AsXmlL();
                CleanupStack::PopAndDestroy(); // pInitMessage
                CleanupStack::PushL(pNextMessage);
                }
            else
                {
                TransactionCompleted();
                }
            }
        else if (pSaslResponse->IsContinue())
            {
            TLSLOG(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel ,(_L("SASL Response: Continue")));
            TPtrC8 mechanism = pSaslResponse->Mechanism();
            TPtrC8 authName = pAuthenticator->Name();
            TLSLOG_FORMAT((KSenCoreServiceManagerLogChannelBase   , KMinLogLevel  ,
                _L8(" Mechanism : %S, Authenticator Name : %S"), &mechanism,
                                                                 &authName
                ));

            if(mechanism != authName)
                {
                TLSLOG(KSenCoreServiceManagerLogChannelBase  , KNormalLogLevel ,(
                _L("pSaslResponse->Mechanism() != pAuthenticator->Name()")));
                //switch to another mechanism
                pAuthenticator = Framework().Manager().MechanismNamedL(
                                                pSaslResponse->Mechanism());
                if(pAuthenticator)
                    {
                    TLSLOG(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel ,(_L("Delete iAuthenticator")));
                    delete iAuthenticator; // free memory

                    // no need to delete after initialize from is in use,
                    // because iAuthenticator == pAuthenticator !!
                    iAuthenticator = pAuthenticator;
                    }
                else
                    {
                    retVal = KErrNotFound;
                    }
                }
            if(pAuthenticator)
                {
                TLSLOG_L(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel ,
                "ESaslMechanism - Handle response and create a new request");
                CIdWsfSaslMessage* pSaslRequest =
                    CIdWsfSaslMessage::NewL(Framework().Manager(),
                                            KSaslXmlns,
                                            KSaslRequestName,
                                            KSaslRequestQName);

                CleanupStack::PushL(pSaslRequest); // pSaslRequest

                retVal = pAuthenticator->HandleResponseL(*pSaslResponse,
                                                            *pSaslRequest);
                pNextMessage = pSaslRequest->AsXmlL();
                CleanupStack::PopAndDestroy();  // pSaslRequest
                CleanupStack::PushL(pNextMessage);
                }
            else
                {
                retVal = KErrNotFound;
                }
            } // end IsContinue()
        }

    if(iCState == EHasSession)
        {
        TLSLOG(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel ,(_L("Parse Response - EHasSession")));
        // expect a DSQueryResponse with the ResourceOffering for the DS
        retVal = CIdWsfDiscoveryServiceClient::ProcessResponseL(pSaslResponse);

        if (iService)
            {
            iDsSession->SetClientServerIntervalL(
                                            iService->ClientServerInterval());// codescannerwarnings
            }

        if ( iService && iDsSession && iDsSession->IsReadyL())
            {
            TPtrC8 providerId = iService->ProviderId();
            iDsSession->SetTrustAnchorL(providerId);
            iCState = ENotInitialized;  // check if iSession should
                                        // be deleted here!?
            }
        }

    if(pNextMessage)
        {
        CleanupStack::Pop(); // pNextMessage
        }

    CleanupStack::PopAndDestroy(); // pSaslResponse
    aParsedMessage = pNextMessage;  // assign data pointer

    return retVal;
    }
TInt CIdWsfAuthenticationServiceClient::ValidateL(
                                    CIdWsfServiceSession &aSession,
                                    const TDesC8& /*authnContext*/,
                                    MSenRemoteServiceConsumer& aRemoteConsumer)
    {
    CSLOG_L(aRemoteConsumer.ConnectionId(), KMinLogLevel ,"CIdWsfAuthenticationServiceClient::ValidateL(..)");
    // keep this as first line
    iServedConsumer = &aRemoteConsumer;

    if(!ipAccount)
        {
        return KErrSenNoEndpoint; 
        }

    TInt retVal(KErrNone);          // for returning error codes
    iCState = EAuthServiceClient;   // set state
    iDsSession = &aSession;         // save session
    CSLOG_L(aRemoteConsumer.ConnectionId(), KMinLogLevel ,"- starting transaction.");
    StartTransaction();

    TPtrC8 mechanismNames =
                        Framework().Manager().SenSecurityMechanismNames8L();

    CIdWsfSaslMessage* pInitMessage =
        CIdWsfSaslMessage::NewL(Framework().Manager(),
                                KSaslXmlns,
                                KSaslRequestName,
                                KSaslRequestQName);
    CleanupStack::PushL(pInitMessage); // push pInitMessage

    CSLOG_L(aRemoteConsumer.ConnectionId(), KMinLogLevel ,"- constructing initial request.");
    pInitMessage->ConstructInitRequestFromL(mechanismNames, *ipAccount);

    HBufC8* pInitRequest8 = pInitMessage->AsXmlL();
    CleanupStack::PushL(pInitRequest8); // push pInitRequest

    if(iService)
        {
        HBufC8* pResponse8 = NULL;

        HBufC8* pNextMessage = NULL;

#ifdef _SENDEBUG
        TPtr8 initRequest = pInitRequest8->Des();
//wslog        FILELOGALL(_L("SenCoreServiceManager"), _L("AS_init_req.xml"), initRequest);
#endif // _SENDEBUG

        retVal = iService->SubmitL(*pInitRequest8, KNullDesC8, *this, pResponse8);
        aRemoteConsumer.SetDataTrafficDetails(iAuthDetails); 
        CleanupStack::PushL(pResponse8); // pResponse8

        if(retVal == KErrNone && pResponse8)
            {
#ifdef _SENDEBUG
            TPtr8 initResponse = pResponse8->Des();
//wslog            FILELOGALL(_L("SenCoreServiceManager"), _L("AS_init_rsp.xml"), initResponse);
#endif // _SENDEBUG
            retVal = ParseResponseL(*pResponse8, pNextMessage);
            }
#ifdef _SENDEBUG
        else
            {
            CSLOG_L(aRemoteConsumer.ConnectionId(), KMinLogLevel ,"CIdWsfAuthenticationServiceClient::ValidateL:");
            CSLOG_FORMAT((aRemoteConsumer.ConnectionId(), KMinLogLevel , _L8("- SubmitL failed: %d"), retVal));
            }
#endif // _SENDEBUG

        CleanupStack::PopAndDestroy(1); // pResponse8

        while ( pNextMessage )
            {
#ifdef _SENDEBUG
            TPtr8 authRequest = pNextMessage->Des();
//wslog            FILELOGALL(_L("SenCoreServiceManager"), _L("AS_req.xml"), authRequest);
#endif // _SENDEBUG
            CleanupStack::PushL(pNextMessage); // pNextMessage
            retVal = iService->SubmitL(*pNextMessage, KNullDesC8, *this, pResponse8); 
            aRemoteConsumer.SetDataTrafficDetails(iAuthDetails); 	
            CleanupStack::PopAndDestroy(); // pNextMessage
            pNextMessage = NULL;

            if (retVal == KErrNone && pResponse8)
                {
                CleanupStack::PushL(pResponse8); // pResponse8
#ifdef _SENDEBUG
                TPtr8 authResponse = pResponse8->Des();
//wslog                FILELOGALL(_L("WsLog"), _L("AS_rsp.xml"), authResponse);
#endif // _SENDEBUG
                retVal = ParseResponseL(*pResponse8, pNextMessage);
                CleanupStack::PopAndDestroy(); // pResponse8
                }
            }
        }
    CleanupStack::PopAndDestroy(2); // pInitRequest8, pInitMessage
    
    if ((retVal == KErrNone) && iDsSession->IsReadyL())
        {
         CSLOG_L(aRemoteConsumer.ConnectionId(), KMinLogLevel ,"- starting transaction.");
        TLSLOG_L(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel ,"- setting validator for DS session.");

        iDsSession->SetValidator(this);
        }

    return retVal;
    }
Example #24
0
void WindowCreator::start( void* windowHandle ){
	Framework().start( windowHandle );
}
Example #25
0
Framework Framework::instance(){
	return Framework();
}
Example #26
0
void CMTPDeviceDataProvider::AddFolderRecursiveL( const TMTPNotificationParamsFolderChange& aFolder )
    {
    OstTraceFunctionEntry0( CMTPDEVICEDATAPROVIDER_ADDFOLDERRECURSIVEL_ENTRY );
    
    TPtrC folderRight( aFolder.iFolderChanged );
    OstTraceExt1(TRACE_NORMAL, CMTPDEVICEDATAPROVIDER_ADDFOLDERRECURSIVEL, 
            "Folder Addition - DriveAndFullPath:%S", folderRight);
    
    if ( !BaflUtils::FolderExists( Framework().Fs(), folderRight ))
    	{
        OstTrace0(TRACE_NORMAL, DUP1_CMTPDEVICEDATAPROVIDER_ADDFOLDERRECURSIVEL, 
                "Folder not exist in file system");
    	User::Leave( KErrArgument );
    	}
    
    TUint32 parentHandle( KMTPHandleNoParent );
    TUint32 handle( KMTPHandleNoParent );
    TInt pos( KErrNotFound );
    TInt lengthOfRight( folderRight.Length());
    TFileName folderLeft;
    
    // get root path of storage
    TInt driveNumber;
    User::LeaveIfError(Framework().Fs().CharToDrive(folderRight[0], driveNumber));
    RBuf rootDirPath;
    rootDirPath.CreateL(KMaxFileName);
    rootDirPath.CleanupClosePushL();
    iDevDpSingletons.ConfigMgr().GetRootDirPathL(driveNumber, rootDirPath);
    rootDirPath.Insert(0, folderRight.Mid(0, 2));// get drive:
    
    /*
    Go through from beginning.
    when this while end, folderLeft keeps the top
    layer folder which has no handle
    */
    do 
        {
        pos = folderRight.Locate( KPathDelimiter );
        if ( KErrNotFound == pos )
            {
            break;
            }
        folderLeft.Append( folderRight.Left( pos + 1 ));
        lengthOfRight = folderRight.Length()-pos -1;
        folderRight.Set( folderRight.Right( lengthOfRight ));
        
        if ( rootDirPath.FindF(folderLeft) != KErrNotFound)
        	{
        	//first time, root folder
        	//continue
        	continue;
        	}
        parentHandle = handle;
        handle = Framework().ObjectMgr().HandleL( folderLeft );
        }
    while( KMTPHandleNone != handle );
    CleanupStack::PopAndDestroy(&rootDirPath);

    if ( KMTPHandleNone == handle )
        {
        OstTrace0(TRACE_NORMAL, DUP2_CMTPDEVICEDATAPROVIDER_ADDFOLDERRECURSIVEL, 
                "need to add entry into mtp database");
        
        CMTPObjectMetaData* folderObject = CMTPObjectMetaData::NewL();
        TUint32 storageId = GetStorageIdL( folderLeft );
        
        while( 1 )
            {
            parentHandle = AddEntryL( folderLeft, parentHandle, storageId, *folderObject );
            OnDeviceFolderChangedL( EMTPEventCodeObjectAdded, *folderObject );

            pos = folderRight.Locate( KPathDelimiter );
            lengthOfRight = folderRight.Length()-pos -1;
            if ( KErrNotFound == pos )
            	{
            	break;
            	}
            folderLeft.Append( folderRight.Left( pos + 1  ));
            folderRight.Set( folderRight.Right( lengthOfRight ));
            }
            
        delete folderObject;
        }
    
    OstTraceFunctionExit0( CMTPDEVICEDATAPROVIDER_ADDFOLDERRECURSIVEL_EXIT );
    }