openikev2::TrafficSelector Class Reference

This class represents a Traffic selector. More...

#include <trafficselector.h>

Inheritance diagram for openikev2::TrafficSelector:

Inheritance graph
[legend]
List of all members.

Public Types

enum  TS_TYPE { TS_IPV4_ADDR_RANGE = 7, TS_IPV6_ADDR_RANGE = 8 }
 Traffic selector types. More...

Public Member Functions

 TrafficSelector (TS_TYPE ts_type, auto_ptr< ByteArray > start_addr, auto_ptr< ByteArray > end_addr, uint16_t start_port, uint16_t end_port, uint8_t ip_protocol_id)
 Creates a new Traffic Selector (for all the IP protocols).
 TrafficSelector (TS_TYPE ts_type, auto_ptr< ByteArray > start_addr, auto_ptr< ByteArray > end_addr, uint8_t start_icmp_type, uint8_t start_icmp_code, uint8_t end_icmp_type, uint8_t end_icmp_code, uint8_t ip_protocol_id)
 Creates a new Traffic Selector (for ICMP/ICMPv6 protocols).
 TrafficSelector (IpAddress &address, uint8_t prefixlen, uint16_t port, uint8_t ip_protocol_id)
 Creates a new Traffic Selector, based on an IP subnet.
 TrafficSelector (IpAddress &address, uint8_t prefixlen, uint8_t icmp_type, uint8_t icmp_code, uint8_t ip_protocol_id)
 Creates a new Traffic Selector, based on an IP subnet (for ICMP/ICMPv6 protocols).
 TrafficSelector (const TrafficSelector &other)
 Creates a new TrafficSelector cloning another one.
 TrafficSelector (ByteBuffer &byte_buffer)
 Creates a new TrafficSelector based on its binary representation.
virtual bool operator>= (const TrafficSelector &other) const
 Indicates if this TrafficSelector contains (is a superset) of other one.
virtual bool operator<= (const TrafficSelector &other) const
 Indicates if this TrafficSelector is contained (is a subset) of other one.
virtual bool operator== (const TrafficSelector &other) const
 Compares this TrafficSelector with another one.
virtual uint16_t getStartPort () const
 Gets the start port attribute value.
virtual uint16_t getEndPort () const
 Gets the end port attribute value.
virtual uint8_t getStartIcmpType () const
 Gets the start ICMP type value.
virtual uint8_t getStartIcmpCode () const
 Gets the start ICMP code value.
virtual uint8_t getEndIcmpType () const
 Gets the end ICMP type value.
virtual uint8_t getEndIcmpCode () const
 Gets the end ICMP code value.
virtual auto_ptr< TrafficSelectorclone () const
 Clones a TrafficSelector.
virtual void getBinaryRepresentation (ByteBuffer &byte_buffer) const
virtual string toStringTab (uint8_t tabs) const
 Construct a textual representation of the object, preceded of a num of tabs of size TAB_SIZE.

Static Public Member Functions

static string TS_TYPE_STR (TS_TYPE ts_type)
 Translate from TS_type IDs to strings.
static auto_ptr< TrafficSelectorintersection (const TrafficSelector &ts1, const TrafficSelector &ts2)
 Returns the result of intersec this TrafficSelector with other.

Public Attributes

TS_TYPE ts_type
 Traffic selector type.
auto_ptr< ByteArraystart_addr
 Smallest address included in this TS.
auto_ptr< ByteArrayend_addr
 Largest address included in this TS.
uint16_t start_port
 Smallest port number allowed by this TS.
uint16_t end_port
 Largest port number allowed by this TS.
uint8_t ip_protocol_id
 IP protocol ID (e.g.

Protected Member Functions

void construct (TS_TYPE ts_type, auto_ptr< ByteArray > start_addr, auto_ptr< ByteArray > end_addr, uint16_t start_port, uint16_t end_port, uint8_t ip_protocol_id)
 Set up the Traffic Selector attributes, setting its parameters.
void construct (IpAddress &address, uint8_t prefixlen, uint16_t port, uint8_t ip_protocol_id)
 Set up the Traffic Selector, based on an IP subnet.

Static Protected Member Functions

static uint16_t getExpectedAddressSize (TS_TYPE ts_type)
 Gets the expected address size for the TS type.

Detailed Description

This class represents a Traffic selector.

Author:
Alejandro Perez Mendez, Pedro J. Fernandez Ruiz <alejandro_perez@dif.um.es, pedroj.fernandez@dif.um.es>


Member Enumeration Documentation

enum openikev2::TrafficSelector::TS_TYPE

Traffic selector types.

Enumerator:
TS_IPV4_ADDR_RANGE  IPv4 address range type.
TS_IPV6_ADDR_RANGE  IPv6 address range type.


Constructor & Destructor Documentation

openikev2::TrafficSelector::TrafficSelector ( TS_TYPE  ts_type,
auto_ptr< ByteArray start_addr,
auto_ptr< ByteArray end_addr,
uint16_t  start_port,
uint16_t  end_port,
uint8_t  ip_protocol_id 
)

Creates a new Traffic Selector (for all the IP protocols).

Parameters:
ts_type TrafficSelector type
start_addr Starting address.
end_addr Ending address.
start_port Starting port number.
end_port Ending port number.
ip_protocol_id IP protocol ID.

openikev2::TrafficSelector::TrafficSelector ( TS_TYPE  ts_type,
auto_ptr< ByteArray start_addr,
auto_ptr< ByteArray end_addr,
uint8_t  start_icmp_type,
uint8_t  start_icmp_code,
uint8_t  end_icmp_type,
uint8_t  end_icmp_code,
uint8_t  ip_protocol_id 
)

Creates a new Traffic Selector (for ICMP/ICMPv6 protocols).

Parameters:
ts_type TrafficSelector type
start_addr Starting address.
end_addr Ending address.
start_icmp_type Starting ICMP type
start_icmp_code Starting ICMP code
end_icmp_type Ending ICMP type
end_icmp_code Ending ICMP code
ip_protocol_id IP protocol ID (only ICMP or ICMPv6) allowed

openikev2::TrafficSelector::TrafficSelector ( IpAddress address,
uint8_t  prefixlen,
uint16_t  port,
uint8_t  ip_protocol_id 
)

Creates a new Traffic Selector, based on an IP subnet.

Parameters:
address IP network address
prefixlen Prefix length
port Port to generate the port range. If port=0, the range will be 0-65535, Otherwise the port range will be exactly the indicated port
ip_protocol_id IP protocol ID

openikev2::TrafficSelector::TrafficSelector ( IpAddress address,
uint8_t  prefixlen,
uint8_t  icmp_type,
uint8_t  icmp_code,
uint8_t  ip_protocol_id 
)

Creates a new Traffic Selector, based on an IP subnet (for ICMP/ICMPv6 protocols).

Parameters:
address IP network address
prefixlen Prefix length
icmp_type ICMP type to generate the type/code range.
icmp_code ICMP code to generate the type/code range. If type/code = 0/0 then the range will be 0/0 - 0XFFF/0xFFFF. Otherwise, the range will be type/code - type/code.
ip_protocol_id IP protocol ID (only ICMP protocols)

openikev2::TrafficSelector::TrafficSelector ( const TrafficSelector other  ) 

Creates a new TrafficSelector cloning another one.

Parameters:
other Other TrafficSelector to be cloned.

openikev2::TrafficSelector::TrafficSelector ( ByteBuffer byte_buffer  ) 

Creates a new TrafficSelector based on its binary representation.

Parameters:
byte_buffer Buffer with its read pointer at the "TS type" field


Member Function Documentation

uint16_t openikev2::TrafficSelector::getExpectedAddressSize ( TS_TYPE  ts_type  )  [static, protected]

Gets the expected address size for the TS type.

Parameters:
ts_type TS TYPE
Returns:
The expected size of the address

void openikev2::TrafficSelector::construct ( TS_TYPE  ts_type,
auto_ptr< ByteArray start_addr,
auto_ptr< ByteArray end_addr,
uint16_t  start_port,
uint16_t  end_port,
uint8_t  ip_protocol_id 
) [protected]

Set up the Traffic Selector attributes, setting its parameters.

This is the full featured construct method

Parameters:
ts_type TrafficSelector type
start_addr Starting address.
end_addr Ending address.
start_port Starting port number.
end_port Ending port number.
ip_protocol_id IP protocol ID.

void openikev2::TrafficSelector::construct ( IpAddress address,
uint8_t  prefixlen,
uint16_t  port,
uint8_t  ip_protocol_id 
) [protected]

Set up the Traffic Selector, based on an IP subnet.

Parameters:
address IP subnet address
prefixlen Prefix length
port Port to generate the port range. If port=0, the range will be 0-65535, Otherwise the port range will be port-port.
ip_protocol_id IP protocol ID

string openikev2::TrafficSelector::TS_TYPE_STR ( TS_TYPE  ts_type  )  [static]

Translate from TS_type IDs to strings.

Parameters:
ts_type TS_type IDs
Returns:
String with the TS_type ID

auto_ptr< TrafficSelector > openikev2::TrafficSelector::intersection ( const TrafficSelector ts1,
const TrafficSelector ts2 
) [static]

Returns the result of intersec this TrafficSelector with other.

Parameters:
other Other TrafficSelector.
Returns:
Intersection of the two TrafficSelector.

bool openikev2::TrafficSelector::operator>= ( const TrafficSelector other  )  const [virtual]

Indicates if this TrafficSelector contains (is a superset) of other one.

Parameters:
other Other TrafficSelector.
Returns:
TRUE if this one contains other one. FALSE otherwise.

bool openikev2::TrafficSelector::operator<= ( const TrafficSelector other  )  const [virtual]

Indicates if this TrafficSelector is contained (is a subset) of other one.

Parameters:
other Other TrafficSelector.
Returns:
TRUE if this one is contained in the other one. FALSE otherwise.

bool openikev2::TrafficSelector::operator== ( const TrafficSelector other  )  const [virtual]

Compares this TrafficSelector with another one.

Parameters:
other Other TrafficSelector.
Returns:
TRUE if both are equals. FALSE otherwise.

uint16_t openikev2::TrafficSelector::getStartPort (  )  const [virtual]

Gets the start port attribute value.

Returns:
The start port value

uint16_t openikev2::TrafficSelector::getEndPort (  )  const [virtual]

Gets the end port attribute value.

Returns:
The end port value

uint8_t openikev2::TrafficSelector::getStartIcmpType (  )  const [virtual]

Gets the start ICMP type value.

Returns:
The start ICMP type value

uint8_t openikev2::TrafficSelector::getStartIcmpCode (  )  const [virtual]

Gets the start ICMP code value.

Returns:
The start ICMP code value

uint8_t openikev2::TrafficSelector::getEndIcmpType (  )  const [virtual]

Gets the end ICMP type value.

Returns:
The end ICMP type value

uint8_t openikev2::TrafficSelector::getEndIcmpCode (  )  const [virtual]

Gets the end ICMP code value.

Returns:
The end ICMP code value

auto_ptr< TrafficSelector > openikev2::TrafficSelector::clone (  )  const [virtual]

Clones a TrafficSelector.

Returns:
A clone of this TrafficSelector

string openikev2::TrafficSelector::toStringTab ( uint8_t  tabs  )  const [virtual]

Construct a textual representation of the object, preceded of a num of tabs of size TAB_SIZE.

Parameters:
tabs Num of tabs preceding the textual representation.
Returns:
Textual tabulated represetation of the object.

Implements openikev2::Printable.


Member Data Documentation

uint8_t openikev2::TrafficSelector::ip_protocol_id

IP protocol ID (e.g.

UDP/TCP/ICMP)


Generated on Fri Jul 27 11:04:57 2007 for libopenikev2 by  doxygen 1.5.1