interfacedesc.hh

Go to the documentation of this file.
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 
00025 
00026 #include "config.hh"
00027 
00028 #ifdef QOLYESTER_ENABLE_VIRTUAL
00029 
00030 # ifndef QOLYESTER_DAEMON_SYS_VIRTUAL_INTERFACEDESC_HH
00031 #  define QOLYESTER_DAEMON_SYS_VIRTUAL_INTERFACEDESC_HH 1
00032 
00033 #  include <set>
00034 
00035 #  include "net/ipaddress.hh"
00036 
00037 namespace olsr {
00038 
00039   namespace sys {
00040 
00041     namespace internal {
00042 
00043 
00048      class InterfaceAddress {
00049         typedef InterfaceAddress        This;
00050         InterfaceAddress();
00051       public:
00052         InterfaceAddress(unsigned p,
00053                          unsigned char s,
00054                          const address_t& a,
00055                          const address_t& b);
00056 
00057         unsigned                prefix()    const { return _prefix;    }
00058         unsigned char           scope()     const { return _scope;     }
00059         const address_t&        address()   const { return _address;   }
00060         const address_t&        broadcast() const { return _broadcast; }
00061 
00062         bool                    operator<(const This& rhs) const;
00063 
00064         static This             make_key(const address_t& a);
00065       private:
00066         unsigned                _prefix;
00067         unsigned char           _scope;
00068         const address_t         _address;
00069         const address_t         _broadcast;
00070 
00071         static This     _dummy_for_find;
00072       };
00073 
00074       class InterfaceInfo {
00075         typedef InterfaceInfo           This;
00076         typedef InterfaceAddress        addr_t;
00077       public:
00078         typedef std::set<addr_t>        addrs_t;
00079 
00080         InterfaceInfo(const std::string& name);
00081 
00082         const std::string&      name()  const { return _name; }
00083         unsigned                index() const { return _index; }
00084         unsigned                mtu()   const { return _mtu;   }
00085         const addrs_t&          addrs() const { return _addrs; }
00086 
00087         bool            operator<(const This& rhs) const;
00088 
00089 
00090       private:
00091         std::string     _name;
00092         unsigned        _index;
00093         unsigned        _mtu;
00094         addrs_t         _addrs;
00095       };
00096 
00097     } // namespace internal
00098 
00099   } // namespace sys
00100 
00101 } // namespace olsr
00102 
00103 #  include "interfacedesc.hxx"
00104 
00105 # endif // ! QOLYESTER_DAEMON_SYS_VIRTUAL_INTERFACEDESC_HH
00106 
00107 #endif // QOLYESTER_ENABLE_VIRTUAL

Generated on Mon Sep 10 17:02:12 2007 for Qolyester daemon by  doxygen 1.5.1