|
1 /* |
|
2 * Copyright (c) 2006-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 : CSipSecAgreeContext.h |
|
16 * Part of : SIPSec |
|
17 * Version : SIP/5.0 |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 /** |
|
25 @internalComponent |
|
26 */ |
|
27 |
|
28 |
|
29 #ifndef CSIPSECAGREECONTEXT_H |
|
30 #define CSIPSECAGREECONTEXT_H |
|
31 |
|
32 #include <e32base.h> |
|
33 |
|
34 #include "MIpSecAgreeContextParams.h" |
|
35 #include "CState.h" |
|
36 |
|
37 class CSipSecAgreeRecord; |
|
38 class MSIPSecUser; |
|
39 class CSIPRequest; |
|
40 class CSIPResponse; |
|
41 class CSIPMessage; |
|
42 class TInetAddr; |
|
43 class MSIPSecSecurityMechanismObserver; |
|
44 class CSIPSecurityServerHeader; |
|
45 class CSIPSecurityClientHeader; |
|
46 class MIpSecMechanismParams; |
|
47 class CState; |
|
48 class CIpSecPolicyHandler; |
|
49 |
|
50 #ifdef CPPUNIT_TEST |
|
51 class CActiveObjController1; |
|
52 #endif |
|
53 |
|
54 /** |
|
55 * @brief Container of array of sec-agree records |
|
56 */ |
|
57 class CSipSecAgreeContext : |
|
58 public CBase, |
|
59 public MIpSecAgreeContextParams |
|
60 { |
|
61 public: // Constructors and destructor |
|
62 |
|
63 static CSipSecAgreeContext* NewL( |
|
64 MIpSecMechanismParams& aParams, |
|
65 TSIPTransportParams& aTransportParams, |
|
66 CSIPResponse& aResponse, |
|
67 CSIPRequest& aRequest, |
|
68 TInetAddr& aRemoteAddress, |
|
69 MSIPSecUser* aUser, |
|
70 MSIPSecSecurityMechanismObserver& aObserver, |
|
71 RPointerArray<CState>& aStates ); |
|
72 |
|
73 static CSipSecAgreeContext* NewLC( |
|
74 MIpSecMechanismParams& aParams, |
|
75 TSIPTransportParams& aTransportParams, |
|
76 CSIPResponse& aResponse, |
|
77 CSIPRequest& aRequest, |
|
78 TInetAddr& aRemoteAddress, |
|
79 MSIPSecUser* aUser, |
|
80 MSIPSecSecurityMechanismObserver& aObserver, |
|
81 RPointerArray<CState>& aStates ); |
|
82 |
|
83 /** |
|
84 * Destructor |
|
85 */ |
|
86 ~CSipSecAgreeContext(); |
|
87 |
|
88 public: // From MIpSecAgreeContextParams |
|
89 |
|
90 MIpSecMechanismParams& MechParams(); |
|
91 |
|
92 TInetAddr LocalAddress(); |
|
93 TInetAddr RemoteAddress(); |
|
94 RIpsecPolicyServ& PolicyServer(); |
|
95 TBool HasOnlyOneRecord() const; |
|
96 TBool HasRecordInState( CState::TSecAgreeRecordState aState ); |
|
97 |
|
98 void SaDeleted( CSipSecAgreeRecord* aRecord ); |
|
99 void SaCleared( CSipSecAgreeRecord* aRecord ); |
|
100 |
|
101 void SAReady( TBool aSuccess ); |
|
102 |
|
103 TBool HasLongerLifetimeSA( TUint aTimeToCompareInMillisecs, |
|
104 TUint& aLongerLifetimeInMillisecs ); |
|
105 |
|
106 public: // Functions |
|
107 |
|
108 TBool HasSecUser( const MSIPSecUser* aSecUser ) const; |
|
109 |
|
110 TBool HasNextHop( const TInetAddr& aNextHop ) const; |
|
111 |
|
112 void ApplyRulesL( TSIPTransportParams& aTransportParams, |
|
113 CSIPRequest& aRequest, |
|
114 const TDesC8& aOutboundProxy, |
|
115 MSIPSecUser* aUser ); |
|
116 |
|
117 void ApplyRulesL( CSIPResponse& aResponse, |
|
118 CSIPRequest& aRequest, |
|
119 MSIPSecSecurityMechanismObserver& aObserver ); |
|
120 |
|
121 void ApplyRulesL( RPointerArray<CSIPSecurityVerifyHeader>& aSecurityVerify ); |
|
122 |
|
123 TBool SetAuthKeyL( const TDesC8& aAuthKey ); |
|
124 |
|
125 void AuthKeyFailedL(); |
|
126 |
|
127 void ClearL(); |
|
128 |
|
129 void CancelPendingOps( const MSIPSecSecurityMechanismObserver* aObserver ); |
|
130 |
|
131 void SADBAddMsgReceived( TUint aMsgSeq, TInt aError ); |
|
132 |
|
133 void RemovalCompleted( TUint32 aTransportId ); |
|
134 |
|
135 private: |
|
136 |
|
137 /* |
|
138 * Constructor |
|
139 */ |
|
140 CSipSecAgreeContext( MIpSecMechanismParams& aParams, |
|
141 MSIPSecSecurityMechanismObserver& aObserver, |
|
142 RPointerArray<CState>& aStates ); |
|
143 |
|
144 void ConstructL( TSIPTransportParams& aTransportParams, |
|
145 CSIPResponse& aResponse, |
|
146 CSIPRequest& aRequest, |
|
147 TInetAddr& aRemoteAddress, |
|
148 MSIPSecUser* aUser ); |
|
149 |
|
150 void CreateNewSecAgreeRecordIfNeededL(); |
|
151 |
|
152 void DeleteRecord( CSipSecAgreeRecord* aRecord ); |
|
153 |
|
154 /** |
|
155 * Returns the next non-obsolete record, starting from position indicated by |
|
156 * aPos. |
|
157 * @param aPos IN: position in array where the search in started |
|
158 * OUT: position in array where the search will be continued |
|
159 * @return CSipSecAgreeRecord* Found record, or NULL if not found. Ownership |
|
160 * is not transferred. |
|
161 */ |
|
162 CSipSecAgreeRecord* NextRecord( TInt& aPos ) const; |
|
163 |
|
164 private: // Data |
|
165 |
|
166 // Array of SecAgee records |
|
167 RPointerArray<CSipSecAgreeRecord> iSecAgreeRecords; |
|
168 |
|
169 TInetAddr iLocalAddress; |
|
170 TInetAddr iRemoteAddress; |
|
171 MIpSecMechanismParams& iParams; |
|
172 MSIPSecUser* iSecUser; |
|
173 MSIPSecSecurityMechanismObserver* iObserver; |
|
174 |
|
175 // All states of the record |
|
176 RPointerArray<CState>& iStates; |
|
177 |
|
178 // Indicates if the ClearL has been called and Sec-Agree records are |
|
179 // begin cleared. |
|
180 TBool iClearOrdered; |
|
181 |
|
182 |
|
183 #ifdef CPPUNIT_TEST |
|
184 friend class CActiveObjController1; |
|
185 public: |
|
186 CActiveObjController1* iObjCtr; |
|
187 #endif |
|
188 |
|
189 }; |
|
190 |
|
191 #endif // CSIPSECAGREECONTEXT_H |
|
192 |
|
193 |
|
194 // End of File |