|
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: Encapsulates credentials needed with ICE-checks. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef C_CNATFWCREDENTIAL_H |
|
21 #define C_CNATFWCREDENTIAL_H |
|
22 |
|
23 #include <e32base.h> |
|
24 |
|
25 /** |
|
26 * Encapsulates credentials needed with ICE connectivity checks. |
|
27 * |
|
28 * Credential is composed of a username and associated password that present |
|
29 * a shared secret between local and remote agent. Username is composed of |
|
30 * concatenated username fragments of agents A and B. |
|
31 * |
|
32 * Connectivity check from A to B utilizes username BFRAG:AFRAG and password |
|
33 * BPASS. Connectivity check from B to A utilizes AFRAG:BFRAG and password |
|
34 * APASS. |
|
35 * |
|
36 * @lib natconfw.lib |
|
37 * @since S60 v3.2 |
|
38 */ |
|
39 class CNATFWCredentials : public CBase |
|
40 { |
|
41 |
|
42 public: |
|
43 |
|
44 /** Defines utilization direction of the credentials. */ |
|
45 enum TUtilizationDirection |
|
46 { |
|
47 /** Credential is used for validation of incoming connectivity |
|
48 check.*/ |
|
49 EInbound, |
|
50 |
|
51 /** Credential is used for outgoing connectivity check forming. */ |
|
52 EOutbound |
|
53 }; |
|
54 |
|
55 /** |
|
56 * Two-phased constructor. |
|
57 */ |
|
58 IMPORT_C static CNATFWCredentials* NewL(); |
|
59 |
|
60 /** |
|
61 * Two-phased constructor. |
|
62 */ |
|
63 IMPORT_C static CNATFWCredentials* NewLC(); |
|
64 |
|
65 /** |
|
66 * Two-phased copy constructor. |
|
67 * @param aCredentials The credentials to copy |
|
68 */ |
|
69 IMPORT_C static CNATFWCredentials* NewL( |
|
70 const CNATFWCredentials& aCredentials ); |
|
71 |
|
72 /** |
|
73 * Two-phased copy constructor. |
|
74 * @param aCredentials The credentials to copy |
|
75 */ |
|
76 IMPORT_C static CNATFWCredentials* NewLC( |
|
77 const CNATFWCredentials& aCredentials ); |
|
78 |
|
79 /** |
|
80 * Destructor. |
|
81 */ |
|
82 virtual ~CNATFWCredentials(); |
|
83 |
|
84 /** |
|
85 * Sets stream collection identifier. |
|
86 * |
|
87 * @since S60 v3.2 |
|
88 * @param aStreamCollectionId Stream collection identifier |
|
89 */ |
|
90 IMPORT_C void SetStreamCollectionId( TUint aStreamCollectionId ); |
|
91 |
|
92 /** |
|
93 * Returns stream collection identifier. |
|
94 * |
|
95 * @since S60 v3.2 |
|
96 * @return Stream collection identifier |
|
97 */ |
|
98 IMPORT_C TUint StreamCollectionId() const; |
|
99 |
|
100 /** |
|
101 * Sets stream identifier. |
|
102 * |
|
103 * @since S60 v3.2 |
|
104 * @param aStreamId Stream identifier |
|
105 */ |
|
106 IMPORT_C void SetStreamId( TUint aStreamId ); |
|
107 |
|
108 /** |
|
109 * Returns stream identifier. |
|
110 * |
|
111 * @since S60 v3.2 |
|
112 * @return Stream identifier |
|
113 */ |
|
114 IMPORT_C TUint StreamId() const; |
|
115 |
|
116 /** |
|
117 * Returns utilization direction of these credentials. |
|
118 * |
|
119 * @since S60 v3.2 |
|
120 * @return Utilization direction |
|
121 */ |
|
122 IMPORT_C TUtilizationDirection Direction() const; |
|
123 |
|
124 /** |
|
125 * Sets utilization direction of these credentials. |
|
126 * |
|
127 * @since S60 v3.2 |
|
128 * @param aDirection Utilization direction |
|
129 */ |
|
130 IMPORT_C void SetDirection( TUtilizationDirection aDirection ); |
|
131 |
|
132 /** |
|
133 * Sets username. |
|
134 * |
|
135 * @since S60 v3.2 |
|
136 * @param aUsername The username |
|
137 */ |
|
138 IMPORT_C void SetUsernameL( const TDesC8& aUsername ); |
|
139 |
|
140 /** |
|
141 * Gets username. |
|
142 * |
|
143 * @since S60 v3.2 |
|
144 * @return Username |
|
145 */ |
|
146 IMPORT_C const TDesC8& Username() const; |
|
147 |
|
148 /** |
|
149 * Sets password to be utilized. |
|
150 * |
|
151 * @since S60 v3.2 |
|
152 * @param aPassword The password |
|
153 */ |
|
154 IMPORT_C void SetPasswordL( const TDesC8& aPassword ); |
|
155 |
|
156 /** |
|
157 * Returns password. |
|
158 * |
|
159 * @since S60 v3.2 |
|
160 * @return Password |
|
161 */ |
|
162 IMPORT_C const TDesC8& Password() const; |
|
163 |
|
164 /** |
|
165 * Implements TIdentityRelation. |
|
166 * |
|
167 * @since S60 v3.2 |
|
168 * @param aCredential1 First credentials to compare |
|
169 * @param aCredential2 Second credentials to compare |
|
170 */ |
|
171 IMPORT_C static TBool Compare( |
|
172 const CNATFWCredentials& aCredential1, |
|
173 const CNATFWCredentials& aCredential2 ); |
|
174 |
|
175 /** |
|
176 * Makes a copy of credentials. |
|
177 * |
|
178 * @since S60 v3.2 |
|
179 * @param aCredentials The credentials to copy |
|
180 */ |
|
181 IMPORT_C void CopyL( const CNATFWCredentials& aCredentials ); |
|
182 |
|
183 IMPORT_C TBool operator==(const CNATFWCredentials& aCandidate) const; |
|
184 |
|
185 IMPORT_C TBool operator!=(const CNATFWCredentials& aCandidate) const; |
|
186 |
|
187 private: |
|
188 |
|
189 CNATFWCredentials(); |
|
190 |
|
191 void ConstructL(); |
|
192 |
|
193 void ConstructL( const CNATFWCredentials& aCredentials ); |
|
194 |
|
195 private: // data |
|
196 |
|
197 /** |
|
198 * Stream collection identifier |
|
199 */ |
|
200 TUint iStreamCollectionId; |
|
201 |
|
202 /** |
|
203 * Stream identifier |
|
204 */ |
|
205 TUint iStreamId; |
|
206 |
|
207 /** |
|
208 * Utilization direction of the credentials |
|
209 */ |
|
210 TUtilizationDirection iDirection; |
|
211 |
|
212 /** |
|
213 * Username |
|
214 * Own. |
|
215 */ |
|
216 RBuf8 iUsername; |
|
217 |
|
218 /** |
|
219 * Password |
|
220 * Own. |
|
221 */ |
|
222 RBuf8 iPassword; |
|
223 |
|
224 }; |
|
225 |
|
226 #endif // C_CNATFWCREDENTIAL_H |