Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

virtualinterface.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 
00026 
00027 #include "config.hh"
00028 
00029 #ifdef QOLYESTER_ENABLE_VIRTUAL
00030 
00031 # include "sys/virtualinterfaceinfo.hh"
00032 # include "pkt/packet.hh"
00033 
00034 # ifndef QOLYESTER_DAEMON_NET_VIRTUALINTERFACE_HH
00035 #  define QOLYESTER_DAEMON_NET_VIRTUALINTERFACE_HH 1
00036 
00037 #  include <set>
00038 #  include "utl/stampable.hh"
00039 #  include "sch/scheduler.hh"
00040 #  include "sys/unixsocket.hh"
00041 #  include "net/ipaddress.hh"
00042 
00043 namespace olsr {
00044 
00045   namespace net {
00046 
00053 
00054     class VirtualInterface : public utl::MultiStampable<1, address_t> {
00055       typedef VirtualInterface                  This;
00056       typedef utl::MultiStampable<1, address_t> Super;
00057       typedef std::set<sch::IOEvent*>           events_t;
00061       explicit VirtualInterface();
00062     public:
00063 
00068       VirtualInterface(const sys::VirtualInterfaceInfo& info);
00069 //       ///
00070 //       /// This constructor is only here for compatibility
00071 //       /// @arg info the system-dependant interface's informations
00072 //       ///
00073 //       VirtualInterface(const sys::VirtualInterfaceInfo& info, const address_t&);
00078       VirtualInterface(const This& other);
00079 
00083       ~VirtualInterface();
00084 
00089       const address_t&          addr() const { return addr_; }
00090 
00095       unsigned                  mtu() const;
00096 
00100       unsigned                  prefix() const { return prefix_; }
00101 
00102       sch::IOEvent::p_t         recv_p() const;
00103 
00104       sch::IOEvent::p_t         send_p() const;
00105 
00110       void              insert_event(sch::IOEvent* e);
00115       void              erase_event(sch::IOEvent* e);
00116 
00117       void              destroy_all_events();
00118 
00124       const sys::VirtualInterfaceInfo&  info() const { return info_; }
00125 
00130       pkt::Packet               receive() const;
00135       void                      send(const pkt::Packet& p) const;
00136 
00142       bool                      operator<(const This& rhs) const;
00143 
00149       static This&              make_key(const address_t& a);
00150 
00151       void                      configure() {}
00152       void                      unconfigure() {}
00153     private:
00154       const sys::VirtualInterfaceInfo   info_;  
00155       const address_t           addr_;          
00156       unsigned                  prefix_;        
00157       events_t                  events_;        
00158 
00159       static This               dummy_for_find_; 
00160     };
00161 
00162   } // namespace net
00163 
00164 } // namespace olsr
00165 
00166 #  ifndef QOLYESTER_DONTINCLUDE_HXX
00167 #   include "virtualinterface.hxx"
00168 #  endif
00169 
00170 # endif // ! QOLYESTER_DAEMON_NET_VIRTUALINTERFACE_HH
00171 
00172 #endif // QOLYESTER_ENABLE_VIRTUAL

Generated on Thu Jul 28 21:21:48 2005 for Qolyester daemon by  doxygen 1.4.1