|
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: IKEv1 SA |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_IKEV1SA_H |
|
20 #define C_IKEV1SA_H |
|
21 |
|
22 #include "ikev1SAdata.h" |
|
23 #include "ikev1keepalive.h" |
|
24 |
|
25 #define SECOND 1000000 // One second is 1000000 us. (1 us. per tick) |
|
26 #define ISAKMP_DELETE_TIME 2*SECOND //Expiration time for a ISAKMP SA after it's erased |
|
27 |
|
28 class CIkev1PluginSession; |
|
29 class CIkev1NokiaNattKeepAlive; |
|
30 class MIkeDebug; |
|
31 |
|
32 //List of the IPSEC SAs negotiated by the ISAKMP SA |
|
33 NONSHARABLE_CLASS(CIpsecSPIList) : public CArrayPtrFlat<TIpsecSPI> |
|
34 { |
|
35 public: |
|
36 CIpsecSPIList(TInt aGranularity); |
|
37 ~CIpsecSPIList(); |
|
38 }; |
|
39 |
|
40 NONSHARABLE_CLASS(CIkev1SA) : public CTimer, public MDpdHeartBeatEventHandler |
|
41 { |
|
42 public: |
|
43 static CIkev1SA* NewL( CIkev1PluginSession& aPluginSession, |
|
44 TIkev1SAData& aIkev1SAdata, |
|
45 CSARekeyInfo* aSaRekey, |
|
46 MIkeDebug& aDebug ); |
|
47 ~CIkev1SA(); |
|
48 |
|
49 void UpdateSAL( TBool aExpired, |
|
50 TIkev1SAData* aIkev1SAdata ); |
|
51 void ExpireSA(); |
|
52 void AddIpsecSPIL( TIpsecSPI& aIpsecSpi ); |
|
53 TBool FindIpsecSPI( TUint32 aSPI, |
|
54 TBool aInbound ); |
|
55 TBool DeleteIpsecSPI( TUint32 aSPI, |
|
56 TBool aInbound ); |
|
57 /** |
|
58 * Deletes IPsec SAs and sends delete payload to the GW. |
|
59 */ |
|
60 void DeleteIpsecSAs(); |
|
61 /** |
|
62 * Deletes IPsec SAs without sending delete payload to the GW. |
|
63 * Used when connection is lost. |
|
64 */ |
|
65 void DeleteIpsecSAsForced(); |
|
66 void SetExpired(); |
|
67 inline TBool IsExpired() {return iExpired;} |
|
68 void EventHandlerL(); |
|
69 |
|
70 inline void SetDeactivating( TBool aDeactivating ) { iDeactivating = aDeactivating; } |
|
71 inline TBool IsDeactivating() { return iDeactivating; } |
|
72 |
|
73 void CancelRekey(); |
|
74 |
|
75 protected: |
|
76 // |
|
77 // CActive methods |
|
78 // |
|
79 void DoCancel(); |
|
80 void RunL(); |
|
81 TInt RunError(TInt aError); |
|
82 |
|
83 private: |
|
84 CIkev1SA( CIkev1PluginSession& aPluginSession, |
|
85 MIkeDebug& aDebug ); |
|
86 void ConstructL( TIkev1SAData& aIkev1SAdata, |
|
87 CSARekeyInfo* aSaRekey ); |
|
88 |
|
89 void StartTimer(); |
|
90 |
|
91 public: |
|
92 TIkev1SAData iHdr; // Common negotiation info |
|
93 CIpsecSPIList* iSPIList; //Contains a SPIs List to know the direction when a delete received |
|
94 |
|
95 private: |
|
96 CIkev1PluginSession& iPluginSession; |
|
97 |
|
98 TUint32 iRemainingTime; //Timer remaining |
|
99 TUint32 iRemainingKB; //KB life remaining |
|
100 TUint32 iCurrentBytes; //Bytes life currently added |
|
101 |
|
102 TUint32 iLeftOverTime; //Time remaining after rekey started |
|
103 TBool iRekeyed; //Rekeyed SA |
|
104 |
|
105 CIkeV1KeepAlive* iIkeKeepAlive; // Pointer to common IKE keepalive object |
|
106 |
|
107 TBool iExpired; //The ISAKMP SA may be expired but waiting possible delete IPSEC SA msgs that arrive after |
|
108 |
|
109 CIkev1NokiaNattKeepAlive *iNokiaNatt; // Pointer to Nokia NAT-T keepalive object |
|
110 |
|
111 TBool iDeactivating; |
|
112 |
|
113 MIkeDebug& iDebug; |
|
114 }; |
|
115 |
|
116 #endif // C_IKEV1SA_H |