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