|
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 TBool TClientRequest::IsNull() const |
|
35 { |
|
36 return iMessage.IsNull(); |
|
37 } |
|
38 |
|
39 TInt TClientRequest::Function() const |
|
40 { |
|
41 return iMessage.Function(); |
|
42 } |
|
43 |
|
44 void TClientRequest::Complete(TInt aReason) const |
|
45 { |
|
46 iMessage.Complete(aReason); |
|
47 } |
|
48 |
|
49 void TClientRequest::Panic(const TDesC& aCategory, TInt aReason) const |
|
50 { |
|
51 iMessage.Panic(aCategory, aReason); |
|
52 } |
|
53 |
|
54 TInt TClientRequest::Int0() const |
|
55 { |
|
56 return iMessage.Int0(); |
|
57 } |
|
58 |
|
59 TInt TClientRequest::Int1() const |
|
60 { |
|
61 return iMessage.Int1(); |
|
62 } |
|
63 |
|
64 TInt TClientRequest::Int2() const |
|
65 { |
|
66 return iMessage.Int2(); |
|
67 } |
|
68 |
|
69 TInt TClientRequest::Int3() const |
|
70 { |
|
71 return iMessage.Int3(); |
|
72 } |
|
73 |
|
74 TInt TClientRequest::GetDesLengthL(TInt aParam) const |
|
75 { |
|
76 return iMessage.GetDesLengthL(aParam); |
|
77 } |
|
78 |
|
79 TInt TClientRequest::GetDesMaxLength(TInt aParam) const |
|
80 { |
|
81 return iMessage.GetDesMaxLength(aParam); |
|
82 } |
|
83 |
|
84 void TClientRequest::ReadL(TInt aParam, TDes8& aDes, TInt aOffset) const |
|
85 { |
|
86 iMessage.ReadL(aParam, aDes, aOffset); |
|
87 } |
|
88 |
|
89 void TClientRequest::ReadL(TInt aParam, TDes& aDes, TInt aOffset) const |
|
90 { |
|
91 iMessage.ReadL(aParam, aDes, aOffset); |
|
92 } |
|
93 |
|
94 void TClientRequest::Read(TInt aParam, TDes8& aDes, TInt aOffset) const |
|
95 { |
|
96 iMessage.Read(aParam, aDes, aOffset); |
|
97 } |
|
98 |
|
99 void TClientRequest::Read(TInt aParam, TDes& aDes, TInt aOffset) const |
|
100 { |
|
101 iMessage.Read(aParam, aDes, aOffset); |
|
102 } |
|
103 |
|
104 TInt TClientRequest::Write(TInt aParam, const TDesC8& aDes, TInt aOffset) const |
|
105 { |
|
106 return iMessage.Write(aParam, aDes, aOffset); |
|
107 } |
|
108 |
|
109 void TClientRequest::WriteL(TInt aParam, const TDesC8& aDes) const |
|
110 { |
|
111 iMessage.WriteL(aParam, aDes); |
|
112 } |
|
113 |
|
114 void TClientRequest::WriteL(TInt aParam, const TDesC& aDes, TInt aOffset) const |
|
115 { |
|
116 iMessage.WriteL(aParam, aDes, aOffset); |
|
117 } |
|
118 |
|
119 TBool TClientRequest::CheckPolicy(const TSecurityPolicy& aSecurityPolicy,const char *aDiagnostic) const |
|
120 { |
|
121 return (aSecurityPolicy.CheckPolicy(iMessage,aDiagnostic)); |
|
122 } |
|
123 |
|
124 // |
|
125 // |
|
126 #else //IF _UNIT_TESTING_ |
|
127 |
|
128 TClientRequest::TClientRequest() |
|
129 : iFunction(KMinTInt), iCapability(0U), iCompletion(KRequestPending), |
|
130 iStatusActive(EFalse), iIdentity(KNullUid) |
|
131 { |
|
132 Mem::FillZ(&iParams, sizeof(TInt) * KMaxMessageArguments); |
|
133 } |
|
134 |
|
135 TBool TClientRequest::IsNull() const |
|
136 { |
|
137 return iFunction == KMinTInt; |
|
138 } |
|
139 |
|
140 TInt TClientRequest::Function() const |
|
141 { |
|
142 return iFunction; |
|
143 } |
|
144 |
|
145 TUid TClientRequest::Identity() const |
|
146 { |
|
147 return iIdentity; |
|
148 } |
|
149 |
|
150 void TClientRequest::Complete(TInt aReason) const |
|
151 { |
|
152 iCompletion = aReason; |
|
153 if(iStatusActive) |
|
154 { |
|
155 TRequestStatus* stat = iStatus; |
|
156 User::RequestComplete(stat, aReason); |
|
157 } |
|
158 } |
|
159 |
|
160 void TClientRequest::Panic(const TDesC& aCategory, TInt aReason) const |
|
161 { |
|
162 User::Panic(aCategory, aReason); |
|
163 } |
|
164 |
|
165 TInt TClientRequest::Int0() const |
|
166 { |
|
167 return iParams[0]; |
|
168 } |
|
169 |
|
170 TInt TClientRequest::Int1() const |
|
171 { |
|
172 return iParams[1]; |
|
173 } |
|
174 |
|
175 TInt TClientRequest::Int2() const |
|
176 { |
|
177 return iParams[2]; |
|
178 } |
|
179 |
|
180 TInt TClientRequest::Int3() const |
|
181 { |
|
182 return iParams[3]; |
|
183 } |
|
184 |
|
185 TInt TClientRequest::GetDesLengthL(TInt aParam) const |
|
186 { |
|
187 const TDesC8* desPtr = (const TDesC8*)iParams[aParam]; |
|
188 return desPtr->Length(); |
|
189 } |
|
190 |
|
191 TInt TClientRequest::GetDesMaxLength(TInt aParam) const |
|
192 { |
|
193 const TDes8* desPtr = (const TDes8*)iParams[aParam]; |
|
194 return desPtr->MaxLength(); |
|
195 } |
|
196 |
|
197 void TClientRequest::ReadL(TInt aParam, TDes8& aDes, TInt aOffset) const |
|
198 { |
|
199 const TDesC8* desPtr = (const TDesC8*)iParams[aParam]; |
|
200 aDes.Copy(desPtr->Mid(aOffset)); |
|
201 } |
|
202 |
|
203 void TClientRequest::ReadL(TInt aParam, TDes& aDes, TInt aOffset) const |
|
204 { |
|
205 const TDesC* desPtr = (const TDesC*)iParams[aParam]; |
|
206 aDes.Copy(desPtr->Mid(aOffset)); |
|
207 } |
|
208 |
|
209 void TClientRequest::Read(TInt aParam, TDes8& aDes, TInt aOffset) const |
|
210 { |
|
211 const TDesC8* desPtr = (const TDesC8*)iParams[aParam]; |
|
212 aDes.Copy(desPtr->Mid(aOffset)); |
|
213 } |
|
214 |
|
215 void TClientRequest::Read(TInt aParam, TDes& aDes, TInt aOffset) const |
|
216 { |
|
217 const TDesC* desPtr = (const TDesC*)iParams[aParam]; |
|
218 aDes.Copy(desPtr->Mid(aOffset)); |
|
219 } |
|
220 |
|
221 TInt TClientRequest::Write(TInt aParam, const TDesC8& aDes, TInt aOffset) const |
|
222 { |
|
223 TDes8* desPtr = (TDes8*)iParams[aParam]; |
|
224 desPtr->Copy(aDes.Mid(aOffset)); |
|
225 return KErrNone; |
|
226 } |
|
227 |
|
228 void TClientRequest::WriteL(TInt aParam, const TDesC8& aDes) const |
|
229 { |
|
230 User::LeaveIfError(Write(aParam, aDes)); |
|
231 } |
|
232 |
|
233 void TClientRequest::WriteL(TInt aParam, const TDesC& aDes, TInt aOffset) const |
|
234 { |
|
235 TDes* desPtr = (TDes*)iParams[aParam]; |
|
236 desPtr->Copy(aDes.Mid(aOffset)); |
|
237 } |
|
238 |
|
239 TBool TClientRequest::CheckPolicy(const TSecurityPolicy& /*aSecurityPolicy*/,const char * /*aDiagnostic*/) const |
|
240 { |
|
241 return iPolicyCheck; |
|
242 } |
|
243 |
|
244 #endif //CENTRAL_REPOSITORY_SERVER_TESTING |