|
1 /* |
|
2 * Copyright (c) 2005-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 "cstuncredentials.h" |
|
22 #include "stunturnclientlogs.h" |
|
23 |
|
24 |
|
25 // ======== MEMBER FUNCTIONS ======== |
|
26 |
|
27 // --------------------------------------------------------------------------- |
|
28 // CSTUNCredentials::NewL |
|
29 // --------------------------------------------------------------------------- |
|
30 // |
|
31 CSTUNCredentials* CSTUNCredentials::NewL( const TDesC8& aUsername, |
|
32 const TDesC8& aPassword ) |
|
33 { |
|
34 CSTUNCredentials* self = new ( ELeave ) CSTUNCredentials(); |
|
35 CleanupStack::PushL( self ); |
|
36 self->ConstructL( aUsername, aPassword ); |
|
37 CleanupStack::Pop( self ); |
|
38 return self; |
|
39 } |
|
40 |
|
41 // --------------------------------------------------------------------------- |
|
42 // CSTUNCredentials::CSTUNCredentials |
|
43 // --------------------------------------------------------------------------- |
|
44 // |
|
45 CSTUNCredentials::CSTUNCredentials() |
|
46 { |
|
47 } |
|
48 |
|
49 // --------------------------------------------------------------------------- |
|
50 // CSTUNCredentials::CSTUNCredentials |
|
51 // --------------------------------------------------------------------------- |
|
52 // |
|
53 CSTUNCredentials::CSTUNCredentials( const CSTUNCredentials& /*aCredentials*/ ) : |
|
54 CBase() |
|
55 { |
|
56 } |
|
57 |
|
58 // --------------------------------------------------------------------------- |
|
59 // CSTUNCredentials::ConstructL |
|
60 // --------------------------------------------------------------------------- |
|
61 // |
|
62 void CSTUNCredentials::ConstructL( const TDesC8& aUsername, |
|
63 const TDesC8& aPassword ) |
|
64 { |
|
65 __STUNTURNCLIENT( "CSTUNCredentials::ConstructL" ) |
|
66 |
|
67 if ( aUsername.Length() > 0 && aPassword.Length() > 0 ) |
|
68 { |
|
69 iUsername = aUsername.AllocL(); |
|
70 iPassword = aPassword.AllocL(); |
|
71 |
|
72 __STUNTURNCLIENT_STR8( "username: ", *iUsername ) |
|
73 __STUNTURNCLIENT_STR8( "password: ", *iPassword ) |
|
74 } |
|
75 |
|
76 __STUNTURNCLIENT( "CSTUNCredentials::ConstructL End" ) |
|
77 } |
|
78 |
|
79 |
|
80 // --------------------------------------------------------------------------- |
|
81 // CSTUNCredentials::~CSTUNCredentials |
|
82 // --------------------------------------------------------------------------- |
|
83 // |
|
84 CSTUNCredentials::~CSTUNCredentials() |
|
85 { |
|
86 delete iUsername; |
|
87 delete iPassword; |
|
88 } |
|
89 |
|
90 // ----------------------------------------------------------------------------- |
|
91 // CSTUNCredentials::Username |
|
92 // ----------------------------------------------------------------------------- |
|
93 // |
|
94 const TDesC8& CSTUNCredentials::Username() const |
|
95 { |
|
96 return *iUsername; |
|
97 } |
|
98 |
|
99 // ----------------------------------------------------------------------------- |
|
100 // CSTUNCredentials::Password |
|
101 // ----------------------------------------------------------------------------- |
|
102 // |
|
103 const TDesC8& CSTUNCredentials::Password() const |
|
104 { |
|
105 return *iPassword; |
|
106 } |
|
107 |
|
108 // ----------------------------------------------------------------------------- |
|
109 // CSTUNCredentials::Compare |
|
110 // ----------------------------------------------------------------------------- |
|
111 // |
|
112 TBool CSTUNCredentials::Compare( const TDesC8& aUsername, |
|
113 const TDesC8& aPassword ) const |
|
114 { |
|
115 return aUsername.Compare( Username() ) == 0 && |
|
116 aPassword.Compare( Password() ) == 0; |
|
117 } |