// -----------------------------------------------------------------------------
// CPosLmDbManEventHandler::HandleRequestForEventL
//
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CPosLmDbManEventHandler::HandleRequestForEventL(
    const RMessagePtr2& aMessage)
    {
    // check that descriptor parameters are OK so that server
    // won't panic when trying to write.
    TPckgBuf<TPosLmDatabaseEvent> event;
    TPckgBuf<TInt> length;
    TInt eventMaxLength = aMessage.GetDesMaxLength(KPosLmServerDbManEventArg);
    TInt lengthMaxLength = aMessage.GetDesMaxLength(KPosLmServerUriLengthArg);
    if (eventMaxLength  != event.Length() ||
        lengthMaxLength != length.Length())
        {
        PanicClient(aMessage, EPosUnableToReadOrWriteDataToClient);
        return;
        }

    if (iEventQueue.Count() > 0)
        {
        // Send the first event in the queue to the client.
        WriteEventAndComplete(aMessage);
        }
    else
         {
        // No events in queue. Put the message on hold.
        if (!iHoldingMessage.IsNull())
            {
            PanicClient(aMessage,
                EPosEventNotifierAlreadyHasOutstandingRequest);
            }
        else
            {
            iHoldingMessage = aMessage;
            }
        }
    }
MSsmSwpPolicy::TResponse CRFStatusSwPPolicy ::TransitionAllowed(const TSsmSwp& aSwp, const RMessagePtr2& aMessage)
	{
	MSsmSwpPolicy::TResponse isTransitionAllowed = ENotAllowed;   
	TBool hasCapability = aMessage.HasCapability(ECapabilityWriteDeviceData, ECapabilityPowerMgmt,
	                    __PLATSEC_DIAGNOSTIC_STRING( "Platsec violation, RF status SwP transition" ));
	
	if(hasCapability)
        {        
        if (IsSsmGracefulOffline())
            {
            //RF ON/OFF is implemented as a substate in Normal instead of SwP for graceful offline notification.
            //Hence the SwP RF OFF/RF ON is restricted for the request which has SSM SID. Only BtSap SwP transition is 
            //allowed to any client with appropriate capability.
            if (aMessage.SecureId() == KSsmSecureId || aSwp.Value() == ESsmBtSap )
                {
                //Allow SwP change only if request has SsmSecureId or the SwP request for BtSap
                isTransitionAllowed = EAllowed;
                }
            }
        else
            {
            isTransitionAllowed = EAllowed;
            }
        }	
	return isTransitionAllowed;
	}
Example #3
0
void PanicClient(TInt aPanic, const RMessagePtr2& aMessage)
	{
	if(aMessage.Handle() != 0)
		{
		aMessage.Panic(KCommServerName(), aPanic);
		}
	}
Example #4
0
void CMyLEDPhoneNotifierSubject::UpdateL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage)
	{
	RDebug::Print(_L("Plugin: LED Phone notifier updated (asynch. call) \n"));
	UpdateL(aBuffer);
	TRAPD(err,aMessage.WriteL(aReplySlot,KUpdatePhoneLEDResponseAsync));
	__ASSERT_ALWAYS(!err,User::Panic(_L("WriteL(aReplySlot,KUpdatePhoneLEDResponseAsync)"),err));
	aMessage.Complete(EEikNotExtRequestCompleted);
	}
Example #5
0
void CMyAgendaNotifierSubject::StartL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage)
	{
	RDebug::Print(_L("Plugin: Agenda notifier started (asynch.)\n"));
	TRAPD(err,aMessage.WriteL(aReplySlot,KStartAgendaDialogResponse));
	__ASSERT_ALWAYS(!err,User::Panic(_L("WriteL(aReplySlot,KStartAgendaDialogResponse)"),err));
	StartL(aBuffer);
	aMessage.Complete(EEikNotExtRequestCompleted);
	}
// ---------------------------------------------------------
// ---------------------------------------------------------
//
void LmServerGlobal::Complete(
    const RMessagePtr2& aMessagePtr,
    TInt aReason)
    {
    if (!aMessagePtr.IsNull())
        {
        aMessagePtr.Complete(aReason);
        }
    }
Example #7
0
void CMyLEDPhoneNotifierSubject::StartL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage)
	{
	RDebug::Print(_L("Plugin: Phone notifier started \n"));
	TPtrC8 boolDes(_L8("LED Channel: PhoneAsynch"));
	TRAPD(err,aMessage.WriteL(aReplySlot,boolDes));
	__ASSERT_ALWAYS(!err,User::Panic(_L("WriteL(aReplySlot,boolDes)"),err));
	StartL(aBuffer);
	aMessage.Complete(EEikNotExtRequestCompleted); //don't have to complete straight away
	}
Example #8
0
TInt TDriveInterface::XProxyDriveWrapper::Write(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag)
{
    EnterCriticalSection();
    TInt nRes = iLocalDrive->Write(aPos, aLength, aSrc, aMessage.Handle(), anOffset, aFlag);
    LeaveCriticalSection();
    return nRes;
}
// -----------------------------------------------------------------------------
// CPosLmEventHandler::HandleRequestForEventL
//
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CPosLmEventHandler::HandleRequestForEventL(
    const RMessagePtr2& aMessage)
    {
    TPckgBuf<TPosLmEvent> event;
    TInt desMaxLength = aMessage.GetDesMaxLength(KPosLmServerEventArg);
    if (desMaxLength != event.Length())
        {
        PanicClient(aMessage, EPosUnableToReadOrWriteDataToClient);
        return;
        }

    if (iEventQueue.Count() > 0)
        {
        // Send the first event in the queue to the client.
        WriteEventAndComplete(aMessage, iEventQueue[0]);
        iEventQueue.Remove(0);
        }
    else
        {
        // No events in queue. Put the message on hold.
        if (!iHoldingMessage.IsNull())
            {
            PanicClient(aMessage,
                EPosEventNotifierAlreadyHasOutstandingRequest);
            }
        else
            {
            iHoldingMessage = aMessage;
            }
        }
    }
Example #10
0
void CMyLEDAgendaNotifierSubject::UpdateL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage)
	{
	RDebug::Print(_L("Plugin: LED Agenda notifier updated (asynch. call) \n"));
	UpdateL(aBuffer);
	TRAPD(err,aMessage.WriteL(aReplySlot,KUpdateAgendaLEDResponseAsync));
	__ASSERT_ALWAYS(!err,User::Panic(_L("WriteL(aReplySlot,KUpdateAgendaLEDResponseAsync)"),err));
	}
// RMessagePtr2::Panic() also completes the message. This is:
// (a) important for efficient cleanup within the kernel
// (b) a problem if the message is completed a second time
void PanicClient(const RMessagePtr2& aMessage,TTerminalControlPanic aPanic)
{
    RDEBUG("TerminalControlServer.cpp PanicClient");

    _LIT(KPanic,"TerminalControlServer");
    aMessage.Panic(KPanic,aPanic);
}
TInt CIPSecDialogNotifier::EnterImportPwdL( const TDesC8& aBuffer, TInt aReturnValue, const RMessagePtr2& aMessage )
	{
	TIPSecDialogOutput newImportPwd; 
	newImportPwd.iOutBuf.Copy(KTestPassword);
	TPckgBuf<TIPSecDialogOutput> buf(newImportPwd);
	aMessage.WriteL( aReturnValue, buf );
	(void)aBuffer;
	return KErrNone;
	}
void PanicClient(const RMessagePtr2& aMessage,TTestUtilPanic aPanic)
//
// RMessagePtr2::Panic() also completes the message. This is:
// (a) important for efficient cleanup within the kernel
// (b) a problem if the message is completed a second time
//
	{
	_LIT(KPanic,"TestUtilServer");
	aMessage.Panic(KPanic,aPanic);
	}
// -----------------------------------------------------------------------------
// CAccFwUiNoteNotifier::StartL()
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CAccFwUiNoteNotifierStub::StartL(
    const TDesC8& /*aBuffer*/, 
    TInt /*aReplySlot*/, 
    const RMessagePtr2& aMessage)
    {    
    API_TRACE_( "[AccFW: ACCFWUINOTIFIER] CAccFwUiNoteNotifier::StartL() - enter" );
    
    aMessage.Complete( KErrNone );
    
    API_TRACE_( "[AccFW: ACCFWUINOTIFIER] CAccFwUiNoteNotifier::StartL() - return" );
    }
// ---------------------------------------------------------
// ---------------------------------------------------------
//
TInt LmServerGlobal::Write(
    const RMessagePtr2& aMessagePtr,
    TInt aParam,
    const TDesC16& aDes,
    TInt aOffset)
    {
    TInt ret = aMessagePtr.Write(aParam, aDes, aOffset);
    if (ret != KErrNone)
        {
        PanicClient(aMessagePtr, EPosUnableToReadOrWriteDataToClient);
        }
    return ret;
    }
void CIPSecDialogNotifier::StartL( const TDesC8& aBuffer, TInt aReturnValue, const RMessagePtr2& aMessage )
	{
    __ASSERT_DEBUG( aBuffer.Length() >= 4, _L( "Buffer is empty" ) );
    TPckgBuf<TVpnDialogInfo> operationBuf;

    aMessage.ReadL( 1, operationBuf );
    TVpnDialogInfo& dialogInput = operationBuf();
 
	TInt aDialog = dialogInput.NoteDialogId();

	TInt operation = dialogInput.DialogId();    
    // This records whether the dialog was cancelled or not
    TInt dialogStatus = KErrNone;
    switch ( operation )
    {
	case TPkiDialog::EEnterPwd:
	    dialogStatus = EnterPwdL( aBuffer, aReturnValue, aMessage );
     	break;
	case TPkiDialog::EChangePwd:
		dialogStatus = ChangePwdL( aBuffer, aReturnValue, aMessage );
		break;
	case TPkiDialog::EDefinePwd:
		dialogStatus = DefinePwdL( aBuffer, aReturnValue, aMessage );
		break;
	case TPkiDialog::EEnterImportPwd:
		dialogStatus = EnterImportPwdL( aBuffer, aReturnValue, aMessage );
		break;
	case TNoteDialog::EInfo:
	case TNoteDialog::EWarning:
	case TNoteDialog::EError:
		ShowNoteDlgL(aDialog);
		break;
		//Fall through			
		default:
	__ASSERT_DEBUG( EFalse, _L( "Illegal IPSEC UI operation type" ) );
    }

    aMessage.Complete( dialogStatus );
	}
void CPbapAuthNotifier::StartL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage)
	{
	iReplySlot = aReplySlot;
	iMessage = RMessage2(aMessage);
	iNeedToCompleteMessage = ETrue;

	TRAPD(err, iEngine->StartPasswordEntryL(aBuffer));
	if (err)
		{
		aMessage.Complete(err);
		iNeedToCompleteMessage = EFalse;
		User::Leave(err);
		}
	}
// ---------------------------------------------------------------------------
// CSecuiDialogNotifier::StartL()
// ---------------------------------------------------------------------------
//
void CSecuiDialogNotifier::StartL( const TDesC8& aBuffer, TInt aReplySlot,
        const RMessagePtr2& aMessage )
    {
    TRACE( "CSecuiDialogNotifier::StartL, begin" );

    TRAPD( err, DoStartL( aBuffer, aReplySlot, aMessage ) );
    TRACE( "CSecuiDialogNotifier::StartL, DoStartL err=%d", err );
    if( err )
        {
        if( iSecuiDialogs && !iIsSecuiDialogsDeleted )
            {
            TRACE( "CSecuiDialogNotifier::StartL, deleting iSecuiDialogs" );
            delete iSecuiDialogs;
            iSecuiDialogs = NULL;
            }
        if( !aMessage.IsNull() )
            {
            TRACE( "CSecuiDialogNotifier::StartL, completing message" );
            aMessage.Complete( err );
            }
        }

    TRACE( "CSecuiDialogNotifier::StartL, end" );
    }
void CAknGlobalListQuerySubject::StartL(const TDesC8& aBuffer, TInt /*aReplySlot*/, 
    const RMessagePtr2& aMessage)
    {
    if (iPending)
        {
        aMessage.Complete(KErrInUse);
        return;
        }

    RDesReadStream readStream(aBuffer);
    if (aBuffer.Length() < KCharsInTInt || readStream.ReadInt32L() != KAKNNOTIFIERSIGNATURE)
        {
        User::Leave(KErrArgument);
        }

    iMessage = aMessage;
    iSelectFirst = readStream.ReadInt16L();
    TInt count = readStream.ReadInt16L();

    // Create array
    delete iArray;
    iArray = 0;
    iArray = new (ELeave) CDesCArrayFlat(KArrayGranularity);
    
    TBuf<KListQueryItemLength> arrayItem;

    for (TInt ii = 0; ii < count; ii++)
        {
        readStream >> arrayItem;
        iArray->AppendL(arrayItem);
        }
        
    TInt headingLength = readStream.ReadInt16L();
    delete iHeading;
    iHeading = 0;
    
    if (headingLength != KErrNotFound)
        {
        iHeading = HBufC::NewL(headingLength);
        TPtr ptr = iHeading->Des();
        readStream >> ptr;
        }
/** 
Determines if an incoming startup state transition request should be accepted or rejected.
Clients calling this API should posess 'ECapabilityPowerMgmt', else the API will return ENotAllowed.

@param aRequest Contains information about the new request
@param aCurrent Contains NULL or the first accepted but not yet completed transition request
@param aQueued Contains NULL or a second accepted but not yet started transition request
@param aMessage Message sent by SSM server, used to check if the client has 'ECapabilityPowerMgmt'

@return one of the TResponse value
@see MSsmStatePolicy::TransitionAllowed
@see MSsmStatePolicy::TResponse
*/
MSsmStatePolicy::TResponse CGsaStatePolicyStartup::TransitionAllowed(const TSsmStateTransition& aRequest, TSsmStateTransition const* aCurrent, 
																TSsmStateTransition const* aQueued, const RMessagePtr2& aMessage)
	{
	TResponse response = ENotAllowed;
	if (!aMessage.HasCapability(ECapabilityPowerMgmt))
		{
		DEBUGPRINT1(_L ("Startup Policy : Capability Check Failed."));
		return response;
		}

	//Check if the requested transition is supported from current state
	if(TransitionSupported(aRequest.State()))
		{
		if((NULL == aCurrent) && (NULL == aQueued))
			{
			// SsmServer is idle
			response = EDefinitelyAllowed;
			}
		else if((aRequest.State().MainState() == ESsmFail) || (aRequest.State().MainState() == ESsmShutdown))
			{
			// Going into failed state or shutdown state will override anything currently ongoing or queued
			response = EReplaceCurrentClearQueue;
			}
		}

#ifdef _DEBUG
	TSsmStateName name = aRequest.State().Name();
	if(ENotAllowed == response)
		{
		DEBUGPRINT3(_L("Startup Policy : Transition (Requested State: %S) is not allowed (Response: %d)."), &name, response);
		}
	else
		{
		DEBUGPRINT3(_L("Startup Policy : Transition (Requested State %S) is allowed (Response %d)."), &name, response);		
		}
#endif
	return response;
	}
void CAknKeyLockNotifierSubject::StartL(const TDesC8& aBuffer, TInt /*aReplySlot*/, const RMessagePtr2& aMessage)
    {
    SAknNotifierPackage<SAknKeyLockNotifierParams>* params
        = ( SAknNotifierPackage<SAknKeyLockNotifierParams>*)aBuffer.Ptr();

    if ( aBuffer.Length() < 0 || (TUint)aBuffer.Length() < sizeof(SAknNotifierPackage<SAknKeyLockNotifierParams>)
        || params->iSignature != KAKNNOTIFIERSIGNATURE )
        {
        User::Leave( KErrArgument );
        }

    switch (params->iParamData.iReason)
        {
        case ELockEnabled:
            DoEnableKeyLock();
            break;
        case ELockDisabled:
            DoDisableKeyLock();
            break;
        case EAllowNotifications:
            DoAllowNotifications();
            break;
        case EStopNotifications:
            DoStopNotifications();
            break;
        case EOfferKeylock:
            DoOfferKeyLock();
            break;
        case ECancelAllNotifications:
            DoCancelAllNotificatons();
            break;
        case EEnableAutoLockEmulation:
            NotifyStatusChange(EShowSoftNotifications);
            LockKeys(ETrue);
            break;
        case EDisableWithoutNote:
            UnlockKeys();
            break;
        case EEnableWithoutNote:
            if (!IsKeyLockEnabled())
                {
                iKeyLockControl->EnableKeylock(EFalse);
                }
            break;
        case ECommandFSWToHideApplication:
            {
            TInt uid(0);
            TBool disable(EFalse);
            RDesReadStream readStream(aBuffer);
            readStream.ReadInt32L(); // signature
            readStream.ReadInt32L(); // op
            uid = readStream.ReadInt32L(); // uid
            disable = readStream.ReadInt32L(); // enable / disable
            STATIC_CAST(CEikServAppUi*,CEikonEnv::Static()->AppUi())->HideApplicationFromFswL(uid,disable);
            }
            break;
        default:
            break;
        };

    aMessage.Complete(KErrNone);
    }
/**
Panic the client.
*/
void PanicClient(const RMessagePtr2& aMessage, TMockSYPanic aPanic)
	{
	_LIT(KPanic,"MockSY");
	aMessage.Panic(KPanic,aPanic);
	}
static void PanicClient(const RMessagePtr2& aMessage, 
						Swi::Test::TConsoleServerPanic aPanic)
	{
	aMessage.Panic(Swi::Test::KConsoleServerName, aPanic);
	}
void CIconSizeNotifier::UpdateL(const TDesC8& /*aBuffer*/, TInt /*aReplySlot*/, const RMessagePtr2& aMessage)
{
    aMessage.Complete(KErrNotSupported);
}
void CIconSizeNotifier::StartL(const TDesC8& /*aBuffer*/, TInt aReplySlot, const RMessagePtr2& aMessage)
{
    TPckgBuf<TIconSizes> res(IconSizeUtils::GetIconSizes());
    aMessage.WriteL(aReplySlot, res);
    aMessage.Complete(KErrNone);
}
static void PanicClient(const RMessagePtr2& aMessage, 
						TIntegrityServicesServerPanic aPanic)
	{
	aMessage.Panic(KIntegrityServicesServerName, aPanic);
	}
/**
RMessage::Panic() also completes the message.
*/
void PanicClient(const RMessagePtr2& aMessage, TEglContentPanic aPanic)
	{
	aMessage.Panic(KEglContentServerName, aPanic);
	}
// RMessagePtr2::Panic() also completes the message. This is:
// (a) important for efficient cleanup within the kernel
// (b) a problem if the message is completed a second time
void PanicClient(const RMessagePtr2& aMessage, TCentRepToolServerPanic aPanic)
	{
	RDEBUG("CentRepTool PanicClient");
	aMessage.Panic( IniConstants::KCentRepToolPanic,aPanic);
	}
Example #29
0
void PanicAppServerClient(const RMessagePtr2& aMessage,TInt aPanic)
	{
	_LIT(KPanic,"ApaAppServer");
	aMessage.Panic(KPanic,aPanic);
	}
/**
Start the notifier with data aBuffer. aMessage should be completed when the notifier is deactivated.

May be called multiple times if more than one client starts the notifier. The notifier is immediately 
responsible for completing aMessage.
*/
void CClass0SmsTxtNotifier::StartL(const TDesC8& aBuffer, TInt /*aReplySlot*/, const RMessagePtr2& aMessage)
	{
	// extract the notifier request parameters
	CreateFile(aBuffer);
	aMessage.Complete(KErrNone);
	}