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 CONFIGURATION_H 00022 #define CONFIGURATION_H 00023 00024 #include "generalconfiguration.h" 00025 #include "peerconfiguration.h" 00026 #include "mutex.h" 00027 #include "autovector.h" 00028 00029 00030 namespace openikev2 { 00031 00036 class Configuration : public Printable { 00037 00038 /****************************** ATTRIBUTES ******************************/ 00039 protected: 00040 static Configuration* instance; 00041 AutoVector<PeerConfiguration> peer_configuration; 00042 auto_ptr<PeerConfiguration> anonymous_configuration; 00043 auto_ptr<GeneralConfiguration> general_configuration; 00044 auto_ptr<Mutex> mutex_config; 00046 /****************************** METHODS ******************************/ 00047 protected: 00054 virtual PeerConfiguration* getPeerConfiguration( ID& peer_id, Enums::ROLE_ID role ); 00055 00059 Configuration(); 00060 00061 public: 00066 static Configuration& getInstance(); 00067 00071 static void deleteConfiguration(); 00072 00077 virtual void setGeneralConfiguration( auto_ptr<GeneralConfiguration> general_configuration ); 00078 00083 virtual void setAnonymousConfiguration( auto_ptr<PeerConfiguration> anonymous_configuration ); 00084 00089 virtual void addPeerConfiguration( auto_ptr<PeerConfiguration> peer_configuration ); 00090 00097 virtual void deletePeerConfiguration( ID& peer_id, Enums::ROLE_ID role ); 00098 00106 virtual auto_ptr<IpsecConfiguration> getIpsecConfiguration( ID& peer_id, Enums::ROLE_ID role ); 00107 00115 virtual auto_ptr<IkeConfiguration> getIkeConfiguration( ID& peer_id, Enums::ROLE_ID role ); 00116 00121 virtual auto_ptr<GeneralConfiguration> getGeneralConfiguration(); 00122 00123 virtual string toStringTab( uint8_t tabs ) const ; 00124 00125 virtual ~Configuration(); 00126 00127 }; 00128 00129 }; 00130 #endif
1.5.1