networkcontrollerimpl.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 NETWORKCONTROLLERIMPL_H
00022 #define NETWORKCONTROLLERIMPL_H
00023 
00024 #ifdef HAVE_CONFIG_H
00025 #include "config.h"
00026 #endif
00027 
00028 #include <map>
00029 
00030 #include "runnable.h"
00031 #include "ipaddress.h"
00032 #include "udpsocket.h"
00033 #include "payload_conf.h"
00034 #include "childsa.h"
00035 #include "ikesacontroller.h"
00036 #include "eapclientcontroller.h"
00037 #include "eapservercontroller.h"
00038 #include "message.h"
00039 #include "notifycontroller.h"
00040 
00041 using namespace std;
00042 
00043 namespace openikev2 {
00044 
00049     class NetworkControllerImpl : public Runnable {
00050 
00051             /****************************** ATRIBUTES ******************************/
00052         protected:
00053             map<uint16_t, NotifyController*> notify_controllers;    
00054             auto_ptr<UdpSocket> udp_socket;                         
00056             /****************************** METHODS ******************************/
00057         protected:
00061             virtual auto_ptr<Message> receive( );
00062 
00067             void send_INVALID_IKE_SPI( Message& received_message );
00068 
00074             void send_COOKIE( Message& received_message, auto_ptr<Payload_NOTIFY> cookie_notify );
00075 
00076         public:
00080             virtual void initialize();
00081 
00088             virtual auto_ptr<IpAddress> getIpAddress( uint16_t port ) = 0;
00089 
00096             virtual auto_ptr<IpAddress> getIpAddress( string address, uint16_t port ) = 0;
00097 
00105             virtual auto_ptr<IpAddress> getIpAddress( uint16_t family, auto_ptr<ByteArray> data, uint16_t port ) = 0;
00106 
00112             virtual auto_ptr<UdpSocket> getUdpSocket( uint16_t port ) = 0;
00113 
00119             virtual auto_ptr<EapClientController> getEapClientController( Payload_EAP::EAP_TYPE eap_type ) = 0;
00120 
00126             virtual auto_ptr<EapServerController> getEapServerController(const ID&  initiator_id) = 0;
00127 
00134             virtual auto_ptr<Payload_CONF> processConfigurationRequest( IkeSaController& ike_sa_controller, ChildSa& child_sa, Payload_CONF& configuration_request ) = 0;
00135 
00141             virtual auto_ptr<Payload_CONF> createConfigurationRequest( IkeSaController& ike_sa_controller ) = 0;
00142 
00149             virtual void processConfigurationResponse( IkeSaController& ike_sa_controller, ChildSa& child_sa, Payload_CONF& configuration_response ) = 0;
00150 
00155             virtual void unsetConfiguration( IkeSaController& ike_sa_controller ) = 0;
00156 
00163             virtual void addNotifyRequests( Message& message, IkeSaController& ike_sa_controller, ChildSa* child_sa );
00164 
00170             virtual NotifyController* getNotifyController( uint16_t type );
00171 
00177             virtual void registerNotifyController( uint16_t type, auto_ptr<NotifyController> notify_controller );
00178 
00184             virtual void sendMessage( Message &message, Cipher* cipher );
00185 
00190             virtual void addSrcAddress( auto_ptr<IpAddress> new_src_address );
00191 
00196             virtual void removeSrcAddress( const IpAddress& src_address );
00197             
00198             virtual void run();
00199 
00200             virtual ~NetworkControllerImpl();
00201     };
00202 }
00203 
00204 #endif

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