sl@0: // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: //system includes sl@0: #include sl@0: #include sl@0: sl@0: sl@0: //class signature sl@0: #include "clientrequest.h" sl@0: sl@0: #ifndef CENTRAL_REPOSITORY_SERVER_TESTING sl@0: sl@0: /////////////////////////////////////////////////////////////////////////////// sl@0: // TClientRequest sl@0: /////////////////////////////////////////////////////////////////////////////// sl@0: TClientRequest::TClientRequest(const RMessage2& aMessage) sl@0: : iMessage(aMessage) sl@0: { sl@0: } sl@0: sl@0: TInt TClientRequest::Function() const sl@0: { sl@0: return iMessage.Function(); sl@0: } sl@0: sl@0: void TClientRequest::Complete(TInt aReason) const sl@0: { sl@0: iMessage.Complete(aReason); sl@0: } sl@0: sl@0: void TClientRequest::Panic(const TDesC& aCategory, TInt aReason) const sl@0: { sl@0: iMessage.Panic(aCategory, aReason); sl@0: } sl@0: sl@0: TInt TClientRequest::Int0() const sl@0: { sl@0: return iMessage.Int0(); sl@0: } sl@0: sl@0: TInt TClientRequest::Int1() const sl@0: { sl@0: return iMessage.Int1(); sl@0: } sl@0: sl@0: TInt TClientRequest::Int2() const sl@0: { sl@0: return iMessage.Int2(); sl@0: } sl@0: sl@0: TInt TClientRequest::Int3() const sl@0: { sl@0: return iMessage.Int3(); sl@0: } sl@0: sl@0: TInt TClientRequest::GetDesLengthL(TInt aParam) const sl@0: { sl@0: return iMessage.GetDesLengthL(aParam); sl@0: } sl@0: sl@0: TInt TClientRequest::GetDesMaxLength(TInt aParam) const sl@0: { sl@0: return iMessage.GetDesMaxLength(aParam); sl@0: } sl@0: sl@0: void TClientRequest::ReadL(TInt aParam, TDes8& aDes, TInt aOffset) const sl@0: { sl@0: iMessage.ReadL(aParam, aDes, aOffset); sl@0: } sl@0: sl@0: void TClientRequest::ReadL(TInt aParam, TDes& aDes, TInt aOffset) const sl@0: { sl@0: iMessage.ReadL(aParam, aDes, aOffset); sl@0: } sl@0: sl@0: void TClientRequest::Read(TInt aParam, TDes8& aDes, TInt aOffset) const sl@0: { sl@0: iMessage.Read(aParam, aDes, aOffset); sl@0: } sl@0: sl@0: void TClientRequest::Read(TInt aParam, TDes& aDes, TInt aOffset) const sl@0: { sl@0: iMessage.Read(aParam, aDes, aOffset); sl@0: } sl@0: sl@0: TInt TClientRequest::Write(TInt aParam, const TDesC8& aDes, TInt aOffset) const sl@0: { sl@0: return iMessage.Write(aParam, aDes, aOffset); sl@0: } sl@0: sl@0: void TClientRequest::WriteL(TInt aParam, const TDesC8& aDes) const sl@0: { sl@0: iMessage.WriteL(aParam, aDes); sl@0: } sl@0: sl@0: void TClientRequest::WriteL(TInt aParam, const TDesC& aDes, TInt aOffset) const sl@0: { sl@0: iMessage.WriteL(aParam, aDes, aOffset); sl@0: } sl@0: sl@0: TBool TClientRequest::CheckPolicy(const TSecurityPolicy& aSecurityPolicy,const char *aDiagnostic) const sl@0: { sl@0: return (aSecurityPolicy.CheckPolicy(iMessage,aDiagnostic)); sl@0: } sl@0: sl@0: /////////////////////////////////////////////////////////////////////////////// sl@0: /////////////////////////////////////////////////////////////////////////////// sl@0: #else //IF _UNIT_TESTING_ sl@0: sl@0: TClientRequest::TClientRequest() sl@0: : iFunction(KMinTInt), iCapability(0U), iCompletion(KRequestPending), sl@0: iStatusActive(EFalse), iIdentity(KNullUid) sl@0: { sl@0: Mem::FillZ(&iParams, sizeof(TInt) * KMaxMessageArguments); sl@0: } sl@0: sl@0: TInt TClientRequest::Function() const sl@0: { sl@0: return iFunction; sl@0: } sl@0: sl@0: void TClientRequest::Complete(TInt aReason) const sl@0: { sl@0: iCompletion = aReason; sl@0: if(iStatusActive) sl@0: { sl@0: TRequestStatus* stat = iStatus; sl@0: User::RequestComplete(stat, aReason); sl@0: } sl@0: } sl@0: sl@0: void TClientRequest::Panic(const TDesC& aCategory, TInt aReason) const sl@0: { sl@0: User::Panic(aCategory, aReason); sl@0: } sl@0: sl@0: TInt TClientRequest::Int0() const sl@0: { sl@0: return iParams[0]; sl@0: } sl@0: sl@0: TInt TClientRequest::Int1() const sl@0: { sl@0: return iParams[1]; sl@0: } sl@0: sl@0: TInt TClientRequest::Int2() const sl@0: { sl@0: return iParams[2]; sl@0: } sl@0: sl@0: TInt TClientRequest::Int3() const sl@0: { sl@0: return iParams[3]; sl@0: } sl@0: sl@0: TInt TClientRequest::GetDesLengthL(TInt aParam) const sl@0: { sl@0: const TDesC8* desPtr = (const TDesC8*)iParams[aParam]; sl@0: return desPtr->Length(); sl@0: } sl@0: sl@0: TInt TClientRequest::GetDesMaxLength(TInt aParam) const sl@0: { sl@0: const TDes8* desPtr = (const TDes8*)iParams[aParam]; sl@0: return desPtr->MaxLength(); sl@0: } sl@0: sl@0: void TClientRequest::ReadL(TInt aParam, TDes8& aDes, TInt aOffset) const sl@0: { sl@0: const TDesC8* desPtr = (const TDesC8*)iParams[aParam]; sl@0: aDes.Copy(desPtr->Mid(aOffset)); sl@0: } sl@0: sl@0: void TClientRequest::ReadL(TInt aParam, TDes& aDes, TInt aOffset) const sl@0: { sl@0: const TDesC* desPtr = (const TDesC*)iParams[aParam]; sl@0: aDes.Copy(desPtr->Mid(aOffset)); sl@0: } sl@0: sl@0: void TClientRequest::Read(TInt aParam, TDes8& aDes, TInt aOffset) const sl@0: { sl@0: const TDesC8* desPtr = (const TDesC8*)iParams[aParam]; sl@0: aDes.Copy(desPtr->Mid(aOffset)); sl@0: } sl@0: sl@0: void TClientRequest::Read(TInt aParam, TDes& aDes, TInt aOffset) const sl@0: { sl@0: const TDesC* desPtr = (const TDesC*)iParams[aParam]; sl@0: aDes.Copy(desPtr->Mid(aOffset)); sl@0: } sl@0: sl@0: TInt TClientRequest::Write(TInt aParam, const TDesC8& aDes, TInt aOffset) const sl@0: { sl@0: TDes8* desPtr = (TDes8*)iParams[aParam]; sl@0: desPtr->Copy(aDes.Mid(aOffset)); sl@0: return KErrNone; sl@0: } sl@0: sl@0: void TClientRequest::WriteL(TInt aParam, const TDesC8& aDes) const sl@0: { sl@0: User::LeaveIfError(Write(aParam, aDes)); sl@0: } sl@0: sl@0: void TClientRequest::WriteL(TInt aParam, const TDesC& aDes, TInt aOffset) const sl@0: { sl@0: TDes* desPtr = (TDes*)iParams[aParam]; sl@0: desPtr->Copy(aDes.Mid(aOffset)); sl@0: } sl@0: sl@0: TBool TClientRequest::CheckPolicy(const TSecurityPolicy& /*aSecurityPolicy*/,const char * /*aDiagnostic*/) const sl@0: { sl@0: return iPolicyCheck; sl@0: } sl@0: sl@0: #endif //CENTRAL_REPOSITORY_SERVER_TESTING