|
1 /* |
|
2 * Copyright (c) 2003-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: IKEv2 Acquire definition |
|
15 * Class CIkev2Acquire is a IKEv2 specific data structure |
|
16 * containing information needed, when establishing a new |
|
17 * IPsec SA |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef __IKEV2ACQUIRE_H__ |
|
22 #define __IKEV2ACQUIRE_H__ |
|
23 |
|
24 #include <e32base.h> |
|
25 |
|
26 #include "ipsecsalifetime.h" |
|
27 |
|
28 class TPfkeyMessage; |
|
29 class TInetAddr; |
|
30 struct TIpsecSaSpec; |
|
31 class CIpsecSARekeyData; |
|
32 class TIkeV2TrafficSelector; |
|
33 |
|
34 // |
|
35 // |
|
36 // CIkev2Acquire |
|
37 // This class is used to handle PFKEY Acquire primitives received from |
|
38 // Ipsec plug-in. |
|
39 // |
|
40 |
|
41 NONSHARABLE_CLASS(CIkev2Acquire) : public CBase |
|
42 { |
|
43 public: |
|
44 static CIkev2Acquire* NewL(const TPfkeyMessage& aPfkeyMessage, TUint32 aId, |
|
45 const TInetAddr& aLocalAddr, TUint16 aDHGroup, TBool aImplicitSa, |
|
46 const TIpsecSaSpec* aSaSpec = 0, const CIpsecSARekeyData* aRekeyData = 0); |
|
47 static CIkev2Acquire* NewL(TUint32 aId, HBufC8* aSa, |
|
48 CArrayFix<TIkeV2TrafficSelector>* aTS_i, |
|
49 CArrayFix<TIkeV2TrafficSelector>* aTS_r ); |
|
50 static void Link(CIkev2Acquire* aAcquire, CIkev2Acquire** aAnchor); |
|
51 static CIkev2Acquire* Find(TUint32 aId, CIkev2Acquire** aAnchor, TBool aRemove=EFalse); |
|
52 static void PurgeQue(CIkev2Acquire** aAnchor); |
|
53 static TBool Responding(CIkev2Acquire** aAnchor); |
|
54 static CIkev2Acquire* GetNext(CIkev2Acquire** aAnchor, TBool aResponse); |
|
55 static void SetFirst(CIkev2Acquire* aAcquire, CIkev2Acquire** aAnchor); |
|
56 static CIkev2Acquire* PeekFirst(CIkev2Acquire** aAnchor); |
|
57 static CIkev2Acquire* RemoveFromQue(TUint32 aId, CIkev2Acquire** aAnchor); |
|
58 |
|
59 TUint32 Id(); |
|
60 TPtrC8 SPI_In(); |
|
61 TPtrC8 SPI_Out(); |
|
62 TPtrC8 SPI_ToBeRekeyed(); |
|
63 void SetSPI_In(const TDesC8& aSPI); |
|
64 void SetSPI_Out(const TDesC8& aSPI); |
|
65 void SetSPI_ToBeRekeyed(const TDesC8& aSPI); |
|
66 TUint16 DHGroup(); |
|
67 void DHGroup(TUint16 aDHGroup); |
|
68 TBool Transport(); |
|
69 void SetTransport(); |
|
70 TBool Response(); |
|
71 void SetResponse(); |
|
72 void SetHardLifetime(const TIpsecSALifetime& aHard ); |
|
73 TIpsecSALifetime* HardLifetime(); |
|
74 void SetSoftLifetime(const TIpsecSALifetime& aSoft ); |
|
75 TIpsecSALifetime* SoftLifetime(); |
|
76 TUint8 ReplayWindow(); |
|
77 void SetReplayWindow(TUint8 aReplayWindow); |
|
78 TUint32 Pid(); |
|
79 void SetPid(TUint32 aPfKeyPid); |
|
80 TUint32 Seq(); |
|
81 void SetSeq(TUint32 aPfKeySeq); |
|
82 void SetVirtualIp(); |
|
83 TBool ForVirtualIp(); |
|
84 TBool SrcSpecific(); |
|
85 void SetSrcSpecific(TBool aSrcSpecific); |
|
86 TUint8 IpsecProtocol(); |
|
87 void SetIpsecProtocol(TUint8 aProtocol); |
|
88 |
|
89 HBufC8* LocalId(); |
|
90 HBufC8* RemoteId(); |
|
91 HBufC8* SA()const; |
|
92 void AddIpsecSpiToSa(const TDesC8& aSpi); |
|
93 const CArrayFix<TIkeV2TrafficSelector>& TS_i(); |
|
94 const CArrayFix<TIkeV2TrafficSelector>& TS_r(); |
|
95 void ReplaceSA(HBufC8* aSA); |
|
96 void ReplaceTS_i(CArrayFix<TIkeV2TrafficSelector>* aTS); |
|
97 void ReplaceTS_r(CArrayFix<TIkeV2TrafficSelector>* aTS); |
|
98 void ReplaceLocalId(HBufC8* aId); |
|
99 void ReplaceRemoteId(HBufC8* aId); |
|
100 |
|
101 CIkev2Acquire(TInt aId); |
|
102 ~CIkev2Acquire(); |
|
103 |
|
104 private: |
|
105 void ConstructL(const TPfkeyMessage& aReq, const TInetAddr& aLocalAddr, TUint16 aDHGroup, TBool aImplicitSa, |
|
106 const TIpsecSaSpec* aSaSpec, const CIpsecSARekeyData* aRekeyData); |
|
107 |
|
108 private: |
|
109 TUint32 iId; // Unique sequence number for GETSPI |
|
110 TBuf8<4> iSPIIn; // Ipsec SPI value in (local SPI) |
|
111 TBuf8<4> iSPIOut; // Ipsec SPI value out (remote SPI) |
|
112 TBuf8<4> iSPIToBeRekeyed;// Ipsec SPI value of IPSec SA to be rekeyed |
|
113 TUint32 iDHGroup; // DH group for PFS |
|
114 TBool iTransport; // Transport Mode requested |
|
115 TBool iResponse; // Object is for Child SA response |
|
116 TBool iSrcSpecific; // Requested SA is "local address" specific |
|
117 TBool iForVirtualIp; // This Acquire is just for getting virtual IP |
|
118 TInt iReplayWindow; // Ipsec replay window value |
|
119 TInt iProtocol; // Ipsec protocol |
|
120 TUint32 iPfKeyPid; // Saved from PFKEY Acquire |
|
121 TUint32 iPfKeySeq; // Saved from PFKEY Acquire |
|
122 TIpsecSALifetime iHard; |
|
123 TIpsecSALifetime iSoft; |
|
124 HBufC8* iSA; // Ipsec SA payload built from Pfkey Acquire |
|
125 |
|
126 CArrayFix<TIkeV2TrafficSelector>* iTS_i; // Local Traffic selector info |
|
127 CArrayFix<TIkeV2TrafficSelector>* iTS_r; // Remote Traffic selector info |
|
128 HBufC8* iLocalId; // Local Id data, if any |
|
129 HBufC8* iRemoteId; // Remote Id data, if any |
|
130 CIkev2Acquire* iNext; // Next pending acquire |
|
131 }; |
|
132 |
|
133 #endif /* __IKEV2ACQUIRE_H__ */ |