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 "config.hh" 00020 00021 #ifndef QOLYESTER_ENABLE_VIRTUAL 00022 00023 # ifndef QOLYESTER_DAEMON_SYS_REALINTERFACEINFO_HH 00024 # define QOLYESTER_DAEMON_SYS_REALINTERFACEINFO_HH 1 00025 00026 # include <string> 00027 # include <set> 00028 # include "net/ipaddress.hh" 00029 # include "linux/interfacedesc.hh" 00030 # include "linux/interfaceconfig.hh" 00031 00032 namespace olsr { 00033 00034 namespace sys { 00035 00036 class RealInterfaceInfo { 00037 typedef RealInterfaceInfo This; 00038 typedef internal::InterfaceAddress addr_t; 00039 typedef std::set<addr_t> addrs_t; 00040 00041 public: 00042 typedef sys::internal::InterfaceConfig config_t; 00043 00044 inline RealInterfaceInfo(); 00045 explicit inline RealInterfaceInfo(const std::string& name); 00046 00047 inline This& operator=(const This& other); 00048 00049 const std::string& name() const { return _name; } 00050 unsigned mtu() const { return _mtu; } 00051 unsigned index() const { return _index; } 00052 00053 inline const address_t& get_addr() const; 00054 inline const address_t& get_addr(const address_t&) const; 00055 inline const address_t get_bcast(const address_t&) const; 00056 inline unsigned get_prefix(const address_t&) const; 00057 00058 inline void add_addr(const address_t&, unsigned); 00059 inline void del_addr(const address_t&); 00060 private: 00061 const std::string _name; 00062 unsigned _mtu; 00063 unsigned _index; 00064 addrs_t _addrs; 00065 }; 00066 00067 } // namespace sys 00068 00069 } // namespace olsr 00070 00071 # include "realinterfaceinfo.hxx" 00072 00073 # endif // ! QOLYESTER_DAEMON_SYS_REALINTERFACEINFO_HH 00074 00075 #endif // ! QOLYESTER_ENABLE_VIRTUAL