diff -r 000000000000 -r 33413c0669b9 vpnengine/ikev2lib/inc/ikev2trafficselector.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vpnengine/ikev2lib/inc/ikev2trafficselector.h Thu Dec 17 09:14:51 2009 +0200 @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class that represents traffic selectors in IKEv2 +* +*/ + + +#ifndef IKEV2TRAFFICSELECTOR_H_ +#define IKEV2TRAFFICSELECTOR_H_ + +#include +#include + +class TIkeV2TrafficSelector + { +public: + + /** + * Parses the traffic selector from IKEv2 datagrams + * TrafficSelector payloads TrafficSelector + * + * If the traffic selector can not be parsed, the method leaves with + * KErrArgument. + */ + static TIkeV2TrafficSelector* NewL(const TDesC8& aIkeV2TrafficSector); + + TIkeV2TrafficSelector(TInetAddr aStartingAddress, TInetAddr aEndingAddress, TUint8 aProtocolId); + TIkeV2TrafficSelector(const TIkeV2TrafficSelector& aTrafficSelector); + + TInetAddr StartingAddress() const; + TInetAddr EndingAddress() const; + TInetAddr Mask() const; + + TUint8 ProtocolId() const; + + /** + * Possible values are: + * TS_IPV4_ADDR_RANGE and TS_IPV6_ADDR_RANGE + */ + TUint8 Type() const; + HBufC8* IdFromTsL() const; + + bool operator>(const TIkeV2TrafficSelector& aOtherSelector) const; + bool operator<(const TIkeV2TrafficSelector& aOtherSelector) const; + bool operator!=(const TIkeV2TrafficSelector& aOtherSelector) const; + bool operator==(const TIkeV2TrafficSelector& aOtherSelector) const; + bool operator>=(const TIkeV2TrafficSelector& aOtherSelector) const; + bool operator<=(const TIkeV2TrafficSelector& aOtherSelector) const; + +private: + + TInetAddr CalcuateMask() const; + + TInetAddr iStartingAddress; //start address and port + TInetAddr iEndingAddress; //end address and port + + TInetAddr iMask; //Calculated from iStartingAddress and iEndingAddress + TUint8 iProtocolId; + }; + + +#endif /* IKEV2TRAFFICSELECTOR_H_ */