|
1 /* |
|
2 * Copyright (c) 2008-2009 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 * Name : CSIPSecDigestCacheEntry.h |
|
16 * Part of : SIPSec |
|
17 * Version : SIP/6.0 |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 /** |
|
25 @internalComponent |
|
26 */ |
|
27 |
|
28 #ifndef __SIPSEC_DIGESTCACHEENTRY_H__ |
|
29 #define __SIPSEC_DIGESTCACHEENTRY_H__ |
|
30 |
|
31 // INCLUDES |
|
32 #include <e32base.h> |
|
33 #include "CSIPSecDigest.h" |
|
34 |
|
35 // FORWARD DECLARATIONS |
|
36 class CUri8; |
|
37 class MSIPSecUser; |
|
38 class TSIPSecPluginCtxInfo; |
|
39 class TSIPSecPluginCtxRequest; |
|
40 class TSIPSecPluginCtxVerify; |
|
41 class TSIPSecPluginContext; |
|
42 class CSIPSecUserRecord; |
|
43 |
|
44 |
|
45 // CLASS DECLARATION |
|
46 /** |
|
47 * @brief Class represents cache entry |
|
48 * |
|
49 * @class CSIPSecDigestCacheEntry CSIPSecDigestCacheEntry.h |
|
50 * "CSIPSecDigestCacheEntry.h" |
|
51 * |
|
52 * This class is an abstract base class for credentials |
|
53 * It provides functions to assing user credentials and SIP user. |
|
54 * It also contains logic to determine, if it should be included in outgoing |
|
55 * SIP request |
|
56 */ |
|
57 class CSIPSecDigestCacheEntry : public CBase |
|
58 { |
|
59 public: // Destructor |
|
60 |
|
61 /** |
|
62 * Destructor |
|
63 */ |
|
64 virtual ~CSIPSecDigestCacheEntry(); |
|
65 |
|
66 public: // New pure virtual functions |
|
67 |
|
68 /** |
|
69 * Updates entry when a SIP request is passed to SIPSec. |
|
70 * @param aContext Request context |
|
71 */ |
|
72 virtual void UpdateL( TSIPSecPluginCtxRequest& aContext ) = 0; |
|
73 |
|
74 /** |
|
75 * Updates entry when client sets credentials. |
|
76 * @param aUserCredentials User record |
|
77 */ |
|
78 virtual void UpdateL( CSIPSecUserRecord& aUserCredentials ) = 0; |
|
79 |
|
80 /** |
|
81 * Handles authentication info |
|
82 * @param aAuthenticationInfo authentication info context |
|
83 */ |
|
84 virtual void HandleL( TSIPSecPluginCtxInfo& aAuthenticationInfo ) = 0; |
|
85 |
|
86 /** |
|
87 * Handles security verify |
|
88 * @param aSecurityVerifyCtx Security verify context |
|
89 */ |
|
90 virtual void HandleL( TSIPSecPluginCtxVerify& aSecurityVerifyCtx ) = 0; |
|
91 |
|
92 /** |
|
93 * Returns type of challenge |
|
94 * @return Type of challenge |
|
95 */ |
|
96 virtual CSIPSecDigest::TChallengeType Type() const = 0; |
|
97 |
|
98 /** |
|
99 * Returns type of challenge, taking in account the context. |
|
100 * @param aContext context |
|
101 * @return Type of challenge |
|
102 */ |
|
103 virtual CSIPSecDigest::TChallengeType |
|
104 Type( const TSIPSecPluginContext& aContext ) const = 0; |
|
105 |
|
106 public: // New functions |
|
107 |
|
108 /** |
|
109 * Returns user data |
|
110 * @return User data |
|
111 */ |
|
112 CSIPSecUserRecord& UserData(); |
|
113 |
|
114 /** |
|
115 * Sets user data |
|
116 * @param aUserData User data |
|
117 */ |
|
118 void SetUserData( CSIPSecUserRecord& aUserData ); |
|
119 |
|
120 /** |
|
121 * Checks, if this entry holds asked user data |
|
122 * @param aUserData User data |
|
123 */ |
|
124 TBool HoldsUserData( const CSIPSecUserRecord& aUserData ) const; |
|
125 |
|
126 /** |
|
127 * Checks if this should be included to outgoing request contained in |
|
128 * context. |
|
129 * @param aContext Context |
|
130 * @return ETrue if entry should be included in the SIP request, |
|
131 * EFalse otherwise |
|
132 */ |
|
133 TBool Match( TSIPSecPluginContext& aContext ) const; |
|
134 |
|
135 /** |
|
136 * Checks if the specified SIPSec user is same as in this instance. |
|
137 * @param aUser SIPSec user |
|
138 * @param aAlsoTrustedUser If ETrue and aUser does not match the SIPSec user |
|
139 * of this instance, then aUser's trusted user is compared to the SIPSec |
|
140 * user of this CSIPSecDigestCacheEntry. |
|
141 * @param RegistrationId Registration id |
|
142 * @return ETrue SIPSec user is same |
|
143 * EFalse Otherwise |
|
144 */ |
|
145 TBool IsUsedByUser( const MSIPSecUser& aUser, |
|
146 TBool aAlsoTrustedUser, |
|
147 TRegistrationId aRegistrationId ) const; |
|
148 |
|
149 /** |
|
150 * Compares the SIPSec user to a cached SIPSec user. |
|
151 * @param aUser SIPSec user |
|
152 * @param aCachedUser Cached SIPSec user |
|
153 * @param aAlsoTrustedUser If ETrue and aUser does not match the SIPSec user |
|
154 * of this instance, then aUser's trusted user is compared to the SIPSec |
|
155 * user of this CSIPSecDigestCacheEntry. |
|
156 * @param RegistrationId Registration id |
|
157 * @return ETrue If the SIPSec user match |
|
158 * EFalse Otherwise, or if either aUser or aCachedUser is NULL |
|
159 */ |
|
160 static TBool CompareUsers( const MSIPSecUser& aUser, |
|
161 const MSIPSecUser& aCachedUser, |
|
162 TBool aAlsoTrustedUser, |
|
163 TRegistrationId aRegistrationId ); |
|
164 |
|
165 /** |
|
166 * Get the SIPSec user |
|
167 * @return MSIPSecUser& SIPSec user |
|
168 */ |
|
169 const MSIPSecUser& SIPSecUser() const; |
|
170 |
|
171 public: // Data |
|
172 |
|
173 static const TInt iSIPSecOffset; |
|
174 |
|
175 TSglQueLink iLink; |
|
176 |
|
177 protected: // Constructors |
|
178 |
|
179 /** |
|
180 * Constructor |
|
181 * @param aUser SIPSec user |
|
182 */ |
|
183 CSIPSecDigestCacheEntry( const MSIPSecUser& aUser ); |
|
184 |
|
185 /** |
|
186 * Second phase constructor |
|
187 * @param aType Challenge type |
|
188 * @param aRemoteTarget Remote target |
|
189 */ |
|
190 void ConstructL( CSIPSecDigest::TChallengeType aType, |
|
191 const CUri8& aRemoteTarget ); |
|
192 |
|
193 protected: // Data |
|
194 |
|
195 // User credentials, not owned. |
|
196 CSIPSecUserRecord* iUserCredentials; |
|
197 |
|
198 // SIPSec user |
|
199 const MSIPSecUser& iUser; |
|
200 |
|
201 private: // Data |
|
202 |
|
203 // Remote target, owned. |
|
204 CUri8* iRemoteTarget; |
|
205 }; |
|
206 |
|
207 #endif //__SIPSEC_DIGESTCACHEENTRY_H__ |
|
208 |
|
209 // End of File |