|
1 /* |
|
2 * Copyright (c) 2005-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 : CIpSecSadbHandler.h |
|
16 * Part of : SIPSec |
|
17 * Version : SIP/4.0 |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 /** |
|
25 @internalComponent |
|
26 */ |
|
27 |
|
28 #ifndef CIPSECSADBHANDLER_H |
|
29 #define CIPSECSADBHANDLER_H |
|
30 |
|
31 #include "MSipSecSaDbSendReceiveObserver.h" |
|
32 |
|
33 class RSADB; |
|
34 class MIpSecMechanismParams; |
|
35 class MSipSecSadbObserver; |
|
36 class TSipSecSaParams; |
|
37 class CSIPSecurityClientHeader; |
|
38 class CSIPSecurityHeaderBase; |
|
39 class CSipSecSaDbMsgSender; |
|
40 class TInetAddr; |
|
41 |
|
42 |
|
43 // Sadb message hanling |
|
44 class CIpSecSadbHandler : |
|
45 public CBase, |
|
46 public MSipSecSaDbSendReceiveObserver |
|
47 { |
|
48 public: |
|
49 |
|
50 enum TSadbHandlerState |
|
51 { |
|
52 EAvailable, |
|
53 EAddingInbound1, |
|
54 EAddingInbound2, |
|
55 EAddingOutbound1, |
|
56 EAddingOutbound2, |
|
57 EDeletingInbound1, |
|
58 EDeletingInbound2, |
|
59 EDeletingOutbound1, |
|
60 EDeletingOutbound2 |
|
61 }; |
|
62 |
|
63 static CIpSecSadbHandler* NewL( MSipSecSadbObserver& aObserver, |
|
64 RSADB& aSADB ); |
|
65 |
|
66 ~CIpSecSadbHandler(); |
|
67 |
|
68 private: |
|
69 |
|
70 CIpSecSadbHandler( MSipSecSadbObserver& aObserver ); |
|
71 |
|
72 void ConstructL( RSADB& aSADB ); |
|
73 |
|
74 public: // Public methods |
|
75 |
|
76 void AddSasL( MIpSecMechanismParams& aParams, |
|
77 TInetAddr aLocalAddress, |
|
78 TInetAddr aRemoteAddress, |
|
79 TSipSecSaParams& aSaParams ); |
|
80 |
|
81 void DeleteSasL( MIpSecMechanismParams& aParams, |
|
82 TInetAddr aLocalAddress, |
|
83 TInetAddr aRemoteAddress, |
|
84 TSipSecSaParams& aSaParams ); |
|
85 |
|
86 void SetSaParamsL( TSipSecSaParams& aParams, |
|
87 CSIPSecurityHeaderBase& aCliHeader, |
|
88 CSIPSecurityHeaderBase& aSrvHeader, |
|
89 const TDesC8& aAuthKey ); |
|
90 |
|
91 void CancelAddSaOps(); |
|
92 |
|
93 void SADBAddMsgReceived( TUint aMsgSeq, TInt aError ); |
|
94 |
|
95 |
|
96 public: // Functions from MSipSecSaDbSendReceiveObserver |
|
97 |
|
98 void MessageSentL( TInt aStatus, |
|
99 TInt aMsgType ); |
|
100 |
|
101 void MessageReceived( TInt aStatus ); |
|
102 |
|
103 |
|
104 private: // Private methods |
|
105 |
|
106 void IssueRequestL( MIpSecMechanismParams& aParams, |
|
107 TInetAddr& aLocalAddress, |
|
108 TInetAddr& aRemoteAddress, |
|
109 TSipSecSaParams& aSaParams ); |
|
110 |
|
111 TBool IsAvailable(); |
|
112 |
|
113 void Reset(); |
|
114 |
|
115 void AddCompletedL( TInt aError ); |
|
116 |
|
117 void DeleteCompletedL(); |
|
118 |
|
119 void AddSaL( TInetAddr& aSourceAddress, |
|
120 TInetAddr& aDestinationAddress, |
|
121 TUint aSpi ); |
|
122 |
|
123 void DeleteSaL( TInetAddr& aSourceAddress, |
|
124 TInetAddr& aDestinationAddress, |
|
125 TUint aSpi ); |
|
126 |
|
127 void SAsAddedL( TBool aSuccess ); |
|
128 |
|
129 TUint32 ConvertToBigEndian( TUint32 aNum ); |
|
130 |
|
131 private: // Data |
|
132 |
|
133 // Not owned |
|
134 MSipSecSadbObserver& iObserver; |
|
135 |
|
136 TSadbHandlerState iState; |
|
137 |
|
138 RArray<TUint> iOngoingAdds; |
|
139 |
|
140 CSipSecSaDbMsgSender* iSaDbMsgSender; |
|
141 |
|
142 // Not owned |
|
143 MIpSecMechanismParams* iParams; |
|
144 |
|
145 // Not owned |
|
146 TSipSecSaParams* iSaParams; |
|
147 |
|
148 TInetAddr iLocalAddress; |
|
149 TInetAddr iRemoteAddress; |
|
150 |
|
151 |
|
152 #ifdef CPPUNIT_TEST |
|
153 friend class CSipSecAgreeRecord; |
|
154 friend class CSipIpSecTest; |
|
155 #endif |
|
156 |
|
157 }; |
|
158 |
|
159 #endif // CIPSECSADBHANDLER_H |
|
160 |
|
161 |
|
162 // End of File |