openikev2::ThreadControllerImpl Class Reference

This abstract class represents a ThreadController concrete implementation. More...

#include <threadcontrollerimpl.h>

List of all members.

Public Member Functions

virtual void initialize (uint16_t num_command_executers)
 Initializes the ThreadController creating the indicated number of IkeSaExecuters.
virtual void startThread (Runnable &runnable)=0
 Starts the execution of a Runneble object.
virtual auto_ptr< ConditiongetCondition ()=0
 Gets a new Condition object.
virtual auto_ptr< MutexgetMutex ()=0
 Gets a new Mutex object.
virtual auto_ptr< SemaphoregetSemaphore (uint32_t initial_value)=0
 Creates a new implementation dependent Semaphore object.
virtual void incHalfOpenCounter ()
 Increments the half-opened IKE SAs counter.
virtual void decHalfOpenCounter ()
 Decrements the half-opened IKE SAs counter.
virtual bool useCookies ()
 Indicates the the cookie mechanism must be used with the current number of half-opened IKE_SA.
virtual IkeSaControllergetWaitingIkeSaController ()
 Gets the next IkeSaController from the waiting queue.
virtual void addWaitingIkeSaController (IkeSaController &ike_sa_controller)
 Adds an IkeSaController to the waiting queue.
virtual uint64_t nextSpi ()=0
 Gets the next SPI value.
virtual void addIkeSaController (auto_ptr< IkeSaController > ike_sa_controller)
 Adds an IkeSaController to the collection.
virtual void requestChildSa (IpAddress &src_addr, IpAddress &dst_addr, auto_ptr< ChildSa > child_sa)
 Request the creation of an CHILD_SA.
virtual void requestChildSa (IpAddress &src_addr, IpAddress &dst_addr, Enums::PROTOCOL_ID ipsec_protocol, Enums::IPSEC_MODE mode, auto_ptr< Payload_TSi > payload_ts_i, auto_ptr< Payload_TSr > payload_ts_r, uint32_t request_id)
virtual void deleteIkeSaController (IkeSaController &ike_sa_controller)
 Removes the IkeSaController from the collection and deletes it.
virtual bool pushCommandBySpi (uint64_t spi, auto_ptr< Command > command, bool priority)
 Push a Command into an IkeSaController by SPI value.
virtual bool pushCommandByAddress (const IpAddress &addr, const IpAddress &peer_addr, auto_ptr< Command > command, bool priority)
 Push a Command into an IkeSaController by address.
virtual void closeAllSas ()
 Deletes all the IKE_SAs and CHILD_SAs sending deletion INFORMATIONAL exchanges.
virtual void exit ()
 Sets the exit flag.
virtual bool isExiting ()
 Gets the exit flag value.

Protected Attributes

map< uint64_t, IkeSaController * > ike_sa_collection
 Active IKE_SA collection.
auto_ptr< Mutexmutex_ike_sa_collection
 Mutex to control active IKE_SAs collection accesses.
deque< IkeSaController * > waiting_ike_sa_controller
 IKE_SA_Controllers waiting for a free IkeSaExecuter.
auto_ptr< Conditioncondition_ike_sa_executer
 Condition to synchronize the IkeSaExecuters.
bool exiting
 Mark if the we want to exit.
uint32_t half_open_counter
 Half open IKE SA counter.
auto_ptr< Mutexmutex_half_open_counter
 Mutex to control half-open counter accesses.


Detailed Description

This abstract class represents a ThreadController concrete implementation.

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


Member Function Documentation

void openikev2::ThreadControllerImpl::initialize ( uint16_t  num_command_executers  )  [virtual]

Initializes the ThreadController creating the indicated number of IkeSaExecuters.

Parameters:
num_command_executers 

virtual void openikev2::ThreadControllerImpl::startThread ( Runnable runnable  )  [pure virtual]

Starts the execution of a Runneble object.

Parameters:
runnable Runnable object.

virtual auto_ptr<Condition> openikev2::ThreadControllerImpl::getCondition (  )  [pure virtual]

Gets a new Condition object.

Returns:
A new Condition object.

virtual auto_ptr<Mutex> openikev2::ThreadControllerImpl::getMutex (  )  [pure virtual]

Gets a new Mutex object.

Returns:
A new Mutex object.

virtual auto_ptr<Semaphore> openikev2::ThreadControllerImpl::getSemaphore ( uint32_t  initial_value  )  [pure virtual]

Creates a new implementation dependent Semaphore object.

Returns:
A new Semaphore object.

bool openikev2::ThreadControllerImpl::useCookies (  )  [virtual]

Indicates the the cookie mechanism must be used with the current number of half-opened IKE_SA.

Returns:
TRUE if cookie mechanism must be used. FALSE otherwise

IkeSaController & openikev2::ThreadControllerImpl::getWaitingIkeSaController (  )  [virtual]

Gets the next IkeSaController from the waiting queue.

Returns:
An IkeSaController waiting for a free IkeSaExecuter

void openikev2::ThreadControllerImpl::addWaitingIkeSaController ( IkeSaController ike_sa_controller  )  [virtual]

Adds an IkeSaController to the waiting queue.

Parameters:
ike_sa_controller An IkeSaController waiting for a free IkeSaExecuter

virtual uint64_t openikev2::ThreadControllerImpl::nextSpi (  )  [pure virtual]

Gets the next SPI value.

Returns:
SPI value

void openikev2::ThreadControllerImpl::addIkeSaController ( auto_ptr< IkeSaController ike_sa_controller  )  [virtual]

Adds an IkeSaController to the collection.

Parameters:
controller IkeSaController to be added

void openikev2::ThreadControllerImpl::requestChildSa ( IpAddress src_addr,
IpAddress dst_addr,
auto_ptr< ChildSa child_sa 
) [virtual]

Request the creation of an CHILD_SA.

If exists a suittable IKE_SA, then uses it. Otherwise, a new IKE_SA will be created.

Parameters:
src_addr Source address for the IKE_SA
dst_addr Destination address for the IKE_SA
child_sa CHILD_SA to be created

void openikev2::ThreadControllerImpl::deleteIkeSaController ( IkeSaController ike_sa_controller  )  [virtual]

Removes the IkeSaController from the collection and deletes it.

Parameters:
controller IkeSaController to be deleted

bool openikev2::ThreadControllerImpl::pushCommandBySpi ( uint64_t  spi,
auto_ptr< Command command,
bool  priority 
) [virtual]

Push a Command into an IkeSaController by SPI value.

Parameters:
spi IkeSaController SPI value
command The Command to be pushed
priority The priority. TRUE if it must be inserted in the front and FALSE if it must be inserted in the back
Returns:
TRUE if the IKE_SA with the indicated SPI exists. FALSE otherwise

bool openikev2::ThreadControllerImpl::pushCommandByAddress ( const IpAddress addr,
const IpAddress peer_addr,
auto_ptr< Command command,
bool  priority 
) [virtual]

Push a Command into an IkeSaController by address.

Parameters:
addr Source address of the IKE_SA
peer_addr Destination address of the IKE_SA
command The Command to be pushed
priority The priority. TRUE if it must be inserted in the front and FALSE if it must be inserted in the back
Returns:
TRUE if the IKE_SA with the indicated SPI exists. FALSE otherwise

void openikev2::ThreadControllerImpl::exit (  )  [virtual]

Sets the exit flag.

When this flag is set, if all the SAs become closed, a new CLOSE_ALL_SAS event is sent

bool openikev2::ThreadControllerImpl::isExiting (  )  [virtual]

Gets the exit flag value.

Returns:
The exit flag value


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