00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef THREADCONTROLLER_H
00022 #define THREADCONTROLLER_H
00023
00024 #include "threadcontrollerimpl.h"
00025
00026 namespace openikev2 {
00027
00032 class ThreadController {
00033 protected:
00034 static auto_ptr<ThreadControllerImpl> implementation;
00035 public:
00036
00041 static void setImplementation( auto_ptr<ThreadControllerImpl> implementation, uint16_t num_command_executers );
00042
00047 static void startThread( Runnable& runnable );
00048
00053 static auto_ptr<Condition> getCondition();
00054
00059 static auto_ptr<Mutex> getMutex();
00060
00065 static auto_ptr<Semaphore> getSemaphore( uint32_t initial_value );
00066
00070 static void incHalfOpenCounter();
00071
00075 static void decHalfOpenCounter();
00076
00081 static bool useCookies();
00082
00087 static IkeSaController& getWaitingIkeSaController();
00088
00093 static void addWaitingIkeSaController( IkeSaController& ike_sa_controller );
00094
00099 static uint64_t nextSpi();
00100
00105 static void addIkeSaController( auto_ptr<IkeSaController> ike_sa_controller );
00106
00114 static void requestChildSa( IpAddress& src_addr, IpAddress& dst_addr, auto_ptr<ChildSa> child_sa );
00115
00116 static 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 );
00117
00122 static void deleteIkeSaController( IkeSaController& ike_sa_controller );
00123
00131 static bool pushCommandBySpi( uint64_t spi, auto_ptr<Command> command, bool priority );
00132
00141 static bool pushCommandByAddress( const IpAddress& addr, const IpAddress& peer_addr, auto_ptr<Command> command, bool priority );
00142
00146 static void closeAllSas();
00147
00151 static void exit();
00152
00157 static bool isExiting();
00158 };
00159 };
00160 #endif