00001 // Copyright (C) 2003, 2004, 2005 Laboratoire de Recherche en Informatique 00002 00003 // This file is part of Qolyester. 00004 00005 // Qolyester is free software; you can redistribute it and/or 00006 // modify it under the terms of the GNU General Public License 00007 // as published by the Free Software Foundation; either version 2 00008 // of the License, or (at your option) any later version. 00009 00010 // Qolyester is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 00015 // You should have received a copy of the GNU General Public License 00016 // along with this program; if not, write to the Free Software 00017 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00018 00019 # include "net/interface.hh" 00020 00021 #ifndef QOLYESTER_DAEMON_SET_INTERFACES_HH 00022 # define QOLYESTER_DAEMON_SET_INTERFACES_HH 1 00023 00024 # include <set> 00025 # include "utl/set.hh" 00026 # include "net/ipaddress.hh" 00027 00028 namespace olsr { 00029 00030 namespace set { 00031 00032 class InterfaceSet { 00033 typedef InterfaceSet This; 00034 typedef std::set<iface_t> iset_t; 00035 typedef utl::MSIndex<iset_t, 0, address_t> idx_iset_t; 00036 public: 00037 typedef idx_iset_t mid_iset_t; 00038 typedef iset_t::const_iterator const_iterator; 00039 typedef const_iterator iterator; 00040 00041 mid_iset_t& mid_iset() { return _mid_iset; } 00042 00043 inline InterfaceSet(); 00044 00045 inline iterator begin() const; 00046 inline iterator end() const; 00047 inline iterator find(const address_t& iaddr) const; 00048 inline bool empty() const; 00049 inline size_t size() const; 00050 00051 unsigned min_mtu() const { return _min_mtu; } 00052 00053 inline const iface_t& operator[](const address_t& iaddr) const; 00054 00055 inline std::pair<iterator, bool> insert(const iset_t::value_type& x); 00056 inline void erase(iterator pos); 00057 00058 inline void send_messages(); 00059 private: 00060 iset_t _iset; 00061 mid_iset_t _mid_iset; 00062 unsigned _min_mtu; 00063 }; 00064 00065 } // namespace set 00066 00067 typedef set::InterfaceSet ifaceset_t; 00068 00069 } // namespace olsr 00070 00071 # include "interfaces.hxx" 00072 00073 #endif // ! QOLYESTER_DAEMON_SET_INTERFACES_HH