os/persistentdata/persistentstorage/centralrepository/cenrepsrv/clientrequest.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
//system includes
sl@0
    17
#include <e32std.h>
sl@0
    18
#include <u32std.h>
sl@0
    19
sl@0
    20
sl@0
    21
//class signature
sl@0
    22
#include "clientrequest.h"
sl@0
    23
sl@0
    24
#ifndef CENTRAL_REPOSITORY_SERVER_TESTING
sl@0
    25
sl@0
    26
///////////////////////////////////////////////////////////////////////////////
sl@0
    27
// TClientRequest
sl@0
    28
///////////////////////////////////////////////////////////////////////////////
sl@0
    29
TClientRequest::TClientRequest(const RMessage2& aMessage)
sl@0
    30
: iMessage(aMessage)
sl@0
    31
	{
sl@0
    32
	}
sl@0
    33
sl@0
    34
TInt TClientRequest::Function() const
sl@0
    35
	{
sl@0
    36
	return iMessage.Function();
sl@0
    37
	}
sl@0
    38
sl@0
    39
void TClientRequest::Complete(TInt aReason) const
sl@0
    40
	{
sl@0
    41
	iMessage.Complete(aReason);
sl@0
    42
	}
sl@0
    43
sl@0
    44
void TClientRequest::Panic(const TDesC& aCategory, TInt aReason) const
sl@0
    45
	{
sl@0
    46
	iMessage.Panic(aCategory, aReason);
sl@0
    47
	}
sl@0
    48
sl@0
    49
TInt TClientRequest::Int0() const
sl@0
    50
	{
sl@0
    51
	return iMessage.Int0();
sl@0
    52
	}
sl@0
    53
sl@0
    54
TInt TClientRequest::Int1() const
sl@0
    55
	{
sl@0
    56
	return iMessage.Int1();
sl@0
    57
	}
sl@0
    58
sl@0
    59
TInt TClientRequest::Int2() const
sl@0
    60
	{
sl@0
    61
	return iMessage.Int2();
sl@0
    62
	}
sl@0
    63
sl@0
    64
TInt TClientRequest::Int3() const
sl@0
    65
	{
sl@0
    66
	return iMessage.Int3();
sl@0
    67
	}
sl@0
    68
sl@0
    69
TInt TClientRequest::GetDesLengthL(TInt aParam) const
sl@0
    70
	{
sl@0
    71
	return iMessage.GetDesLengthL(aParam);
sl@0
    72
	}
sl@0
    73
sl@0
    74
TInt TClientRequest::GetDesMaxLength(TInt aParam) const
sl@0
    75
	{
sl@0
    76
	return iMessage.GetDesMaxLength(aParam);
sl@0
    77
	}
sl@0
    78
sl@0
    79
void TClientRequest::ReadL(TInt aParam, TDes8& aDes, TInt aOffset) const
sl@0
    80
	{
sl@0
    81
	iMessage.ReadL(aParam, aDes, aOffset);
sl@0
    82
	}
sl@0
    83
sl@0
    84
void TClientRequest::ReadL(TInt aParam, TDes& aDes, TInt aOffset) const
sl@0
    85
	{
sl@0
    86
	iMessage.ReadL(aParam, aDes, aOffset);
sl@0
    87
	}
sl@0
    88
	
sl@0
    89
void TClientRequest::Read(TInt aParam, TDes8& aDes, TInt aOffset) const
sl@0
    90
	{
sl@0
    91
	iMessage.Read(aParam, aDes, aOffset);
sl@0
    92
	}
sl@0
    93
sl@0
    94
void TClientRequest::Read(TInt aParam, TDes& aDes, TInt aOffset) const
sl@0
    95
	{
sl@0
    96
	iMessage.Read(aParam, aDes, aOffset);
sl@0
    97
	}
sl@0
    98
sl@0
    99
TInt TClientRequest::Write(TInt aParam, const TDesC8& aDes, TInt aOffset) const
sl@0
   100
	{
sl@0
   101
	return iMessage.Write(aParam, aDes, aOffset);
sl@0
   102
	}
sl@0
   103
sl@0
   104
void TClientRequest::WriteL(TInt aParam, const TDesC8& aDes) const
sl@0
   105
	{
sl@0
   106
	iMessage.WriteL(aParam, aDes); 
sl@0
   107
	}
sl@0
   108
sl@0
   109
void TClientRequest::WriteL(TInt aParam, const TDesC& aDes, TInt aOffset) const
sl@0
   110
	{
sl@0
   111
	iMessage.WriteL(aParam, aDes, aOffset);
sl@0
   112
	}
sl@0
   113
	
sl@0
   114
TBool TClientRequest::CheckPolicy(const TSecurityPolicy& aSecurityPolicy,const char *aDiagnostic) const
sl@0
   115
	{
sl@0
   116
	return (aSecurityPolicy.CheckPolicy(iMessage,aDiagnostic));	
sl@0
   117
	}
sl@0
   118
	
sl@0
   119
///////////////////////////////////////////////////////////////////////////////
sl@0
   120
///////////////////////////////////////////////////////////////////////////////
sl@0
   121
#else //IF _UNIT_TESTING_
sl@0
   122
sl@0
   123
TClientRequest::TClientRequest()
sl@0
   124
: iFunction(KMinTInt), iCapability(0U), iCompletion(KRequestPending),
sl@0
   125
iStatusActive(EFalse), iIdentity(KNullUid)
sl@0
   126
	{
sl@0
   127
	Mem::FillZ(&iParams, sizeof(TInt) * KMaxMessageArguments);
sl@0
   128
	}
sl@0
   129
sl@0
   130
TInt TClientRequest::Function() const
sl@0
   131
	{
sl@0
   132
	return iFunction;
sl@0
   133
	}
sl@0
   134
sl@0
   135
void TClientRequest::Complete(TInt aReason) const
sl@0
   136
	{
sl@0
   137
	iCompletion = aReason;
sl@0
   138
	if(iStatusActive)
sl@0
   139
		{
sl@0
   140
		TRequestStatus* stat = iStatus;
sl@0
   141
		User::RequestComplete(stat, aReason);
sl@0
   142
		}
sl@0
   143
	}
sl@0
   144
sl@0
   145
void TClientRequest::Panic(const TDesC& aCategory, TInt aReason) const
sl@0
   146
	{
sl@0
   147
	User::Panic(aCategory, aReason);
sl@0
   148
	}
sl@0
   149
sl@0
   150
TInt TClientRequest::Int0() const
sl@0
   151
	{
sl@0
   152
	return iParams[0];
sl@0
   153
	}
sl@0
   154
sl@0
   155
TInt TClientRequest::Int1() const
sl@0
   156
	{
sl@0
   157
	return iParams[1];
sl@0
   158
	}
sl@0
   159
sl@0
   160
TInt TClientRequest::Int2() const
sl@0
   161
	{
sl@0
   162
	return iParams[2];
sl@0
   163
	}
sl@0
   164
sl@0
   165
TInt TClientRequest::Int3() const
sl@0
   166
	{
sl@0
   167
	return iParams[3];
sl@0
   168
	}
sl@0
   169
sl@0
   170
TInt TClientRequest::GetDesLengthL(TInt aParam) const
sl@0
   171
	{
sl@0
   172
	const TDesC8* desPtr = (const TDesC8*)iParams[aParam];
sl@0
   173
	return desPtr->Length();
sl@0
   174
	}
sl@0
   175
sl@0
   176
TInt TClientRequest::GetDesMaxLength(TInt aParam) const
sl@0
   177
	{
sl@0
   178
	const TDes8* desPtr = (const TDes8*)iParams[aParam];
sl@0
   179
	return desPtr->MaxLength();
sl@0
   180
	}
sl@0
   181
sl@0
   182
void TClientRequest::ReadL(TInt aParam, TDes8& aDes, TInt aOffset) const
sl@0
   183
	{
sl@0
   184
	const TDesC8* desPtr = (const TDesC8*)iParams[aParam];
sl@0
   185
	aDes.Copy(desPtr->Mid(aOffset));
sl@0
   186
	}
sl@0
   187
sl@0
   188
void TClientRequest::ReadL(TInt aParam, TDes& aDes, TInt aOffset) const
sl@0
   189
	{
sl@0
   190
	const TDesC* desPtr = (const TDesC*)iParams[aParam];
sl@0
   191
	aDes.Copy(desPtr->Mid(aOffset));
sl@0
   192
	}
sl@0
   193
	
sl@0
   194
void TClientRequest::Read(TInt aParam, TDes8& aDes, TInt aOffset) const
sl@0
   195
	{
sl@0
   196
	const TDesC8* desPtr = (const TDesC8*)iParams[aParam];
sl@0
   197
	aDes.Copy(desPtr->Mid(aOffset));
sl@0
   198
	}
sl@0
   199
sl@0
   200
void TClientRequest::Read(TInt aParam, TDes& aDes, TInt aOffset) const
sl@0
   201
	{
sl@0
   202
	const TDesC* desPtr = (const TDesC*)iParams[aParam];
sl@0
   203
	aDes.Copy(desPtr->Mid(aOffset));
sl@0
   204
	}	
sl@0
   205
sl@0
   206
TInt TClientRequest::Write(TInt aParam, const TDesC8& aDes, TInt aOffset) const
sl@0
   207
	{
sl@0
   208
	TDes8* desPtr = (TDes8*)iParams[aParam];
sl@0
   209
	desPtr->Copy(aDes.Mid(aOffset));
sl@0
   210
	return KErrNone;
sl@0
   211
	}
sl@0
   212
sl@0
   213
void TClientRequest::WriteL(TInt aParam, const TDesC8& aDes) const
sl@0
   214
	{
sl@0
   215
	User::LeaveIfError(Write(aParam, aDes));
sl@0
   216
	}
sl@0
   217
sl@0
   218
void TClientRequest::WriteL(TInt aParam, const TDesC& aDes, TInt aOffset) const
sl@0
   219
	{
sl@0
   220
	TDes* desPtr = (TDes*)iParams[aParam];
sl@0
   221
	desPtr->Copy(aDes.Mid(aOffset));
sl@0
   222
	}
sl@0
   223
	
sl@0
   224
TBool TClientRequest::CheckPolicy(const TSecurityPolicy& /*aSecurityPolicy*/,const char * /*aDiagnostic*/) const
sl@0
   225
	{
sl@0
   226
	return iPolicyCheck;	
sl@0
   227
	}
sl@0
   228
sl@0
   229
#endif //CENTRAL_REPOSITORY_SERVER_TESTING