00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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
00052 protected:
00053 map<uint16_t, NotifyController*> notify_controllers;
00054 auto_ptr<UdpSocket> udp_socket;
00056
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