|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #include "natfwcredentials.h" |
|
22 #include "natfwclientlogs.h" |
|
23 |
|
24 // ======== MEMBER FUNCTIONS ======== |
|
25 |
|
26 // --------------------------------------------------------------------------- |
|
27 // CNATFWCredentials::CNATFWCredentials |
|
28 // --------------------------------------------------------------------------- |
|
29 // |
|
30 CNATFWCredentials::CNATFWCredentials() |
|
31 { |
|
32 __NATFWCLIENT("CNATFWCredentials::CNATFWCredentials" ) |
|
33 } |
|
34 |
|
35 |
|
36 // --------------------------------------------------------------------------- |
|
37 // CNATFWCredentials::ConstructL |
|
38 // --------------------------------------------------------------------------- |
|
39 // |
|
40 void CNATFWCredentials::ConstructL( ) |
|
41 { |
|
42 __NATFWCLIENT("CNATFWCredentials::ConstructL" ) |
|
43 |
|
44 iUsername.Assign( KNullDesC8().AllocL() ); |
|
45 iPassword.Assign( KNullDesC8().AllocL() ); |
|
46 } |
|
47 |
|
48 |
|
49 // --------------------------------------------------------------------------- |
|
50 // CNATFWCredentials::ConstructL |
|
51 // --------------------------------------------------------------------------- |
|
52 // |
|
53 void CNATFWCredentials::ConstructL( |
|
54 const CNATFWCredentials& aCredentials) |
|
55 { |
|
56 __NATFWCLIENT("CNATFWCredentials::ConstructL (copy)" ) |
|
57 |
|
58 iDirection = aCredentials.Direction(); |
|
59 iStreamCollectionId = aCredentials.StreamCollectionId(); |
|
60 iStreamId = aCredentials.StreamId(); |
|
61 |
|
62 iUsername.Assign( aCredentials.Username().AllocL() ); |
|
63 iPassword.Assign( aCredentials.Password().AllocL() ); |
|
64 } |
|
65 |
|
66 |
|
67 // --------------------------------------------------------------------------- |
|
68 // CNATFWCredentials::NewL |
|
69 // --------------------------------------------------------------------------- |
|
70 // |
|
71 EXPORT_C CNATFWCredentials* CNATFWCredentials::NewL() |
|
72 { |
|
73 __NATFWCLIENT("CNATFWCredentials::NewL") |
|
74 |
|
75 CNATFWCredentials* self = CNATFWCredentials::NewLC(); |
|
76 CleanupStack::Pop( self ); |
|
77 return self; |
|
78 } |
|
79 |
|
80 |
|
81 // --------------------------------------------------------------------------- |
|
82 // CNATFWCredentials::NewL |
|
83 // --------------------------------------------------------------------------- |
|
84 // |
|
85 EXPORT_C CNATFWCredentials* CNATFWCredentials::NewL( |
|
86 const CNATFWCredentials& aCredentials ) |
|
87 { |
|
88 __NATFWCLIENT("CNATFWCredentials::NewL (copy)") |
|
89 |
|
90 CNATFWCredentials* self = CNATFWCredentials::NewLC( aCredentials ); |
|
91 CleanupStack::Pop( self ); |
|
92 return self; |
|
93 } |
|
94 |
|
95 // --------------------------------------------------------------------------- |
|
96 // CNATFWCredentials::NewLC |
|
97 // --------------------------------------------------------------------------- |
|
98 // |
|
99 EXPORT_C CNATFWCredentials* CNATFWCredentials::NewLC( |
|
100 const CNATFWCredentials& aCredentials ) |
|
101 { |
|
102 __NATFWCLIENT("CNATFWCredentials::NewLC (copy)") |
|
103 |
|
104 CNATFWCredentials* self = new( ELeave ) CNATFWCredentials(); |
|
105 CleanupStack::PushL( self ); |
|
106 self->ConstructL( aCredentials ); |
|
107 return self; |
|
108 } |
|
109 |
|
110 |
|
111 // --------------------------------------------------------------------------- |
|
112 // CNATFWCredentials::NewLC |
|
113 // --------------------------------------------------------------------------- |
|
114 // |
|
115 EXPORT_C CNATFWCredentials* CNATFWCredentials::NewLC() |
|
116 { |
|
117 __NATFWCLIENT("CNATFWCredentials::NewLC") |
|
118 |
|
119 CNATFWCredentials* self = new( ELeave ) CNATFWCredentials(); |
|
120 CleanupStack::PushL( self ); |
|
121 self->ConstructL(); |
|
122 return self; |
|
123 } |
|
124 |
|
125 |
|
126 // --------------------------------------------------------------------------- |
|
127 // CNATFWCredentials::~CNATFWCredentials |
|
128 // --------------------------------------------------------------------------- |
|
129 // |
|
130 CNATFWCredentials::~CNATFWCredentials() |
|
131 { |
|
132 __NATFWCLIENT("CNATFWCredentials::~CNATFWCredentials") |
|
133 |
|
134 iUsername.Close(); |
|
135 iPassword.Close(); |
|
136 } |
|
137 |
|
138 |
|
139 // --------------------------------------------------------------------------- |
|
140 // CNATFWCredentials::SetStreamCollectionId |
|
141 // --------------------------------------------------------------------------- |
|
142 // |
|
143 EXPORT_C void CNATFWCredentials::SetStreamCollectionId( |
|
144 TUint aStreamCollectionId ) |
|
145 { |
|
146 __NATFWCLIENT_INT1( |
|
147 "CNATFWCredentials::SetStreamCollectionId", aStreamCollectionId ) |
|
148 |
|
149 iStreamCollectionId = aStreamCollectionId; |
|
150 } |
|
151 |
|
152 |
|
153 // --------------------------------------------------------------------------- |
|
154 // CNATFWCredentials::StreamCollectionId |
|
155 // --------------------------------------------------------------------------- |
|
156 // |
|
157 EXPORT_C TUint CNATFWCredentials::StreamCollectionId() const |
|
158 { |
|
159 __NATFWCLIENT_INT1( |
|
160 "CNATFWCredentials::StreamCollectionId", iStreamCollectionId ) |
|
161 |
|
162 return iStreamCollectionId; |
|
163 } |
|
164 |
|
165 |
|
166 // --------------------------------------------------------------------------- |
|
167 // CNATFWCredentials::SetStreamId |
|
168 // --------------------------------------------------------------------------- |
|
169 // |
|
170 EXPORT_C void CNATFWCredentials::SetStreamId( TUint aStreamId ) |
|
171 { |
|
172 __NATFWCLIENT_INT1( "CNATFWCredentials::SetStreamId", aStreamId ) |
|
173 |
|
174 iStreamId = aStreamId; |
|
175 } |
|
176 |
|
177 |
|
178 // --------------------------------------------------------------------------- |
|
179 // CNATFWCredentials::StreamId |
|
180 // --------------------------------------------------------------------------- |
|
181 // |
|
182 EXPORT_C TUint CNATFWCredentials::StreamId() const |
|
183 { |
|
184 __NATFWCLIENT_INT1( "CNATFWCredentials::StreamId", iStreamId ) |
|
185 |
|
186 return iStreamId; |
|
187 } |
|
188 |
|
189 |
|
190 // --------------------------------------------------------------------------- |
|
191 // CNATFWCredentials::SetDirection |
|
192 // --------------------------------------------------------------------------- |
|
193 // |
|
194 EXPORT_C void CNATFWCredentials::SetDirection( |
|
195 TUtilizationDirection aDirection ) |
|
196 { |
|
197 __NATFWCLIENT_INT1("CNATFWCredentials::SetDirection", aDirection ) |
|
198 |
|
199 iDirection = aDirection; |
|
200 } |
|
201 |
|
202 |
|
203 // --------------------------------------------------------------------------- |
|
204 // CNATFWCredentials::Direction |
|
205 // --------------------------------------------------------------------------- |
|
206 // |
|
207 EXPORT_C CNATFWCredentials::TUtilizationDirection |
|
208 CNATFWCredentials::Direction() const |
|
209 { |
|
210 __NATFWCLIENT_INT1("CNATFWCredentials::Direction", iDirection ) |
|
211 |
|
212 return iDirection; |
|
213 } |
|
214 |
|
215 |
|
216 // --------------------------------------------------------------------------- |
|
217 // CNATFWCredentials::SetUsernameL |
|
218 // --------------------------------------------------------------------------- |
|
219 // |
|
220 EXPORT_C void CNATFWCredentials::SetUsernameL( const TDesC8& aUsername ) |
|
221 { |
|
222 __NATFWCLIENT_STR8("CNATFWCredentials::SetUsernameL", aUsername ) |
|
223 |
|
224 iUsername.Close(); |
|
225 iUsername.Assign( aUsername.AllocL() ); |
|
226 } |
|
227 |
|
228 |
|
229 // --------------------------------------------------------------------------- |
|
230 // CNATFWCredentials::Username |
|
231 // --------------------------------------------------------------------------- |
|
232 // |
|
233 EXPORT_C const TDesC8& CNATFWCredentials::Username() const |
|
234 { |
|
235 __NATFWCLIENT_STR8("CNATFWCredentials::Username", iUsername ) |
|
236 |
|
237 return iUsername; |
|
238 } |
|
239 |
|
240 |
|
241 // --------------------------------------------------------------------------- |
|
242 // CNATFWCredentials::SetPasswordL |
|
243 // --------------------------------------------------------------------------- |
|
244 // |
|
245 EXPORT_C void CNATFWCredentials::SetPasswordL( const TDesC8& aPassword ) |
|
246 { |
|
247 __NATFWCLIENT_STR8("CNATFWCredentials::SetPasswordL", aPassword ) |
|
248 |
|
249 iPassword.Close(); |
|
250 iPassword.Assign( aPassword.AllocL() ); |
|
251 } |
|
252 |
|
253 |
|
254 // --------------------------------------------------------------------------- |
|
255 // CNATFWCredentials::Password |
|
256 // --------------------------------------------------------------------------- |
|
257 // |
|
258 EXPORT_C const TDesC8& CNATFWCredentials::Password() const |
|
259 { |
|
260 __NATFWCLIENT_STR8("CNATFWCredentials::Password", iPassword ) |
|
261 |
|
262 return iPassword; |
|
263 } |
|
264 |
|
265 |
|
266 // --------------------------------------------------------------------------- |
|
267 // CNATFWCredentials::Compare |
|
268 // Implements TIdentityRelation. |
|
269 // --------------------------------------------------------------------------- |
|
270 // |
|
271 EXPORT_C TBool CNATFWCredentials::Compare( |
|
272 const CNATFWCredentials& aCredential1, |
|
273 const CNATFWCredentials& aCredential2 ) |
|
274 { |
|
275 return ( aCredential1 == aCredential2 ); |
|
276 } |
|
277 |
|
278 |
|
279 // --------------------------------------------------------------------------- |
|
280 // CNATFWCredentials::CopyL |
|
281 // --------------------------------------------------------------------------- |
|
282 // |
|
283 EXPORT_C void CNATFWCredentials::CopyL( |
|
284 const CNATFWCredentials& aCredentials) |
|
285 { |
|
286 __NATFWCLIENT("CNATFWCredentials::CopyL" ) |
|
287 |
|
288 iDirection = aCredentials.Direction(); |
|
289 iStreamCollectionId = aCredentials.StreamCollectionId(); |
|
290 |
|
291 iPassword.Close(); |
|
292 iPassword.Assign( aCredentials.Password().AllocL() ); |
|
293 |
|
294 iUsername.Close(); |
|
295 iUsername.Assign( aCredentials.Username().AllocL() ); |
|
296 } |
|
297 |
|
298 |
|
299 // --------------------------------------------------------------------------- |
|
300 // CNATFWCredentials::operator== |
|
301 // --------------------------------------------------------------------------- |
|
302 // |
|
303 EXPORT_C TBool CNATFWCredentials::operator==( |
|
304 const CNATFWCredentials& aCredentials ) const |
|
305 { |
|
306 return ( |
|
307 iStreamCollectionId == aCredentials.StreamCollectionId() |
|
308 && iStreamId == aCredentials.StreamId() |
|
309 && iDirection == aCredentials.Direction() |
|
310 && iUsername == aCredentials.Username() |
|
311 && iPassword == aCredentials.Password() ); |
|
312 } |
|
313 |
|
314 |
|
315 // --------------------------------------------------------------------------- |
|
316 // CNATFWCredentials::operator!= |
|
317 // --------------------------------------------------------------------------- |
|
318 // |
|
319 EXPORT_C TBool CNATFWCredentials::operator!=( |
|
320 const CNATFWCredentials& aCredentials ) const |
|
321 { |
|
322 return !( |
|
323 iStreamCollectionId == aCredentials.StreamCollectionId() |
|
324 && iStreamId == aCredentials.StreamId() |
|
325 && iDirection == aCredentials.Direction() |
|
326 && iUsername == aCredentials.Username() |
|
327 && iPassword == aCredentials.Password() ); |
|
328 } |