|
1 /* |
|
2 * Copyright (c) 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: Class that represents traffic selectors in IKEv2 |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef IKEV2TRAFFICSELECTOR_H_ |
|
20 #define IKEV2TRAFFICSELECTOR_H_ |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <in_sock.h> |
|
24 |
|
25 class TIkeV2TrafficSelector |
|
26 { |
|
27 public: |
|
28 |
|
29 /** |
|
30 * Parses the traffic selector from IKEv2 datagrams |
|
31 * TrafficSelector payloads TrafficSelector |
|
32 * |
|
33 * If the traffic selector can not be parsed, the method leaves with |
|
34 * KErrArgument. |
|
35 */ |
|
36 static TIkeV2TrafficSelector* NewL(const TDesC8& aIkeV2TrafficSector); |
|
37 |
|
38 TIkeV2TrafficSelector(TInetAddr aStartingAddress, TInetAddr aEndingAddress, TUint8 aProtocolId); |
|
39 TIkeV2TrafficSelector(const TIkeV2TrafficSelector& aTrafficSelector); |
|
40 |
|
41 TInetAddr StartingAddress() const; |
|
42 TInetAddr EndingAddress() const; |
|
43 TInetAddr Mask() const; |
|
44 |
|
45 TUint8 ProtocolId() const; |
|
46 |
|
47 /** |
|
48 * Possible values are: |
|
49 * TS_IPV4_ADDR_RANGE and TS_IPV6_ADDR_RANGE |
|
50 */ |
|
51 TUint8 Type() const; |
|
52 HBufC8* IdFromTsL() const; |
|
53 |
|
54 bool operator>(const TIkeV2TrafficSelector& aOtherSelector) const; |
|
55 bool operator<(const TIkeV2TrafficSelector& aOtherSelector) const; |
|
56 bool operator!=(const TIkeV2TrafficSelector& aOtherSelector) const; |
|
57 bool operator==(const TIkeV2TrafficSelector& aOtherSelector) const; |
|
58 bool operator>=(const TIkeV2TrafficSelector& aOtherSelector) const; |
|
59 bool operator<=(const TIkeV2TrafficSelector& aOtherSelector) const; |
|
60 |
|
61 private: |
|
62 |
|
63 TInetAddr CalcuateMask() const; |
|
64 |
|
65 TInetAddr iStartingAddress; //start address and port |
|
66 TInetAddr iEndingAddress; //end address and port |
|
67 |
|
68 TInetAddr iMask; //Calculated from iStartingAddress and iEndingAddress |
|
69 TUint8 iProtocolId; |
|
70 }; |
|
71 |
|
72 |
|
73 #endif /* IKEV2TRAFFICSELECTOR_H_ */ |