![]() |
User Manual, Developers Guide and API Documentation |
![]() |
00001 /******************************************************************************* 00002 * This file is part of openWNS (open Wireless Network Simulator) 00003 * _____________________________________________________________________________ 00004 * 00005 * Copyright (C) 2004-2007 00006 * Chair of Communication Networks (ComNets) 00007 * Kopernikusstr. 5, D-52074 Aachen, Germany 00008 * phone: ++49-241-80-27910, 00009 * fax: ++49-241-80-22242 00010 * email: info@openwns.org 00011 * www: http://www.openwns.org 00012 * _____________________________________________________________________________ 00013 * 00014 * openWNS is free software; you can redistribute it and/or modify it under the 00015 * terms of the GNU Lesser General Public License version 2 as published by the 00016 * Free Software Foundation; 00017 * 00018 * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY 00019 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 00020 * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00021 * details. 00022 * 00023 * You should have received a copy of the GNU Lesser General Public License 00024 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00025 * 00026 ******************************************************************************/ 00027 00028 #ifndef IP_VIRTUALDNS_HPP 00029 #define IP_VIRTUALDNS_HPP 00030 00031 #include <WNS/service/nl/Address.hpp> 00032 #include <WNS/service/dll/DataTransmission.hpp> 00033 #include <WNS/node/component/Component.hpp> 00034 #include <WNS/container/Registry.hpp> 00035 #include <WNS/ldk/fun/Main.hpp> 00036 #include <WNS/ldk/Layer.hpp> 00037 #include <WNS/logger/Logger.hpp> 00038 #include <WNS/Singleton.hpp> 00039 00040 namespace ip { 00041 00047 class VirtualDNS: 00048 virtual public wns::ldk::Layer, 00049 public wns::node::component::Component 00050 { 00051 public: 00052 typedef wns::service::nl::FQDN DomainName; 00053 typedef wns::service::nl::Address NLAddress; 00054 typedef wns::container::Registry<DomainName, NLAddress> DNSContainer; 00055 00062 VirtualDNS( 00063 wns::node::Interface* _node, 00064 const wns::pyconfig::View& _pyco); 00065 00069 virtual ~VirtualDNS(); 00070 00071 virtual void 00072 doStartup(); 00073 00074 NLAddress 00075 request(DomainName name); 00076 00077 void 00078 bind(DomainName name, NLAddress ip); 00079 00080 void 00081 unbind(DomainName name); 00082 00087 virtual void 00088 onNodeCreated(); 00089 00093 virtual void 00094 onWorldCreated(); 00095 00096 virtual void 00097 onShutdown(); 00098 00099 private: 00100 00104 wns::logger::Logger log; 00105 00106 std::string dnsZone; 00107 00108 DNSContainer dnsLookup; 00109 }; 00110 00111 class VirtualDNSService { 00112 00113 public: 00114 VirtualDNSService(); 00115 00116 void 00117 addSubnet(std::string subnetIdentifier, 00118 VirtualDNS* server); 00119 00120 VirtualDNS* 00121 getZoneManager(std::string subnetIdentifier); 00122 00123 private: 00124 wns::logger::Logger log; 00125 00126 wns::container::Registry<std::string, VirtualDNS*> servers; 00127 }; 00128 00129 typedef wns::SingletonHolder<VirtualDNSService> TheDNSService; 00130 00131 } // ip 00132 #endif //_IP_VIRTUALDNS_HPP 00133 00134
1.5.5