threadcontroller.h

00001 /***************************************************************************
00002 *   Copyright (C) 2005 by                                                 *
00003 *   Pedro J. Fernandez Ruiz    pedroj.fernandez@dif.um.es                 *
00004 *   Alejandro Perez Mendez     alejandro_perez@dif.um.es                  *
00005 *                                                                         *
00006 *   This library is free software; you can redistribute it and/or         *
00007 *   modify it under the terms of the GNU Lesser General Public            *
00008 *   License as published by the Free Software Foundation; either          *
00009 *   version 2.1 of the License, or (at your option) any later version.    *
00010 *                                                                         *
00011 *   This library is distributed in the hope that it will be useful,       *
00012 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00014 *   Lesser General Public License for more details.                       *
00015 *                                                                         *
00016 *   You should have received a copy of the GNU Lesser General Public      *
00017 *   License along with this library; if not, write to the Free Software   *
00018 *   Foundation, Inc., 51 Franklin St, Fifth Floor,                        *
00019 *   Boston, MA  02110-1301  USA                                           *
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

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