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 sch {
00046 
00047     class PacketSender;
00048 
00049   }
00050 
00051   namespace net {
00052 
00059 
00060     class VirtualInterface : public utl::MultiStampable<1, address_t> {
00061       typedef VirtualInterface                  This;
00062       typedef utl::MultiStampable<1, address_t> Super;
00063       typedef std::set<sch::IOEvent*>           events_t;
00067       explicit inline VirtualInterface();
00068     public:
00069 
00074       inline VirtualInterface(const sys::VirtualInterfaceInfo& info);
00075 //       ///
00076 //       /// This constructor is only here for compatibility
00077 //       /// @arg info the system-dependant interface's informations
00078 //       ///
00079 //       VirtualInterface(const sys::VirtualInterfaceInfo& info, const address_t&);
00084       inline VirtualInterface(const This& other);
00085 
00089       inline ~VirtualInterface();
00090 
00095       const address_t&          addr() const { return addr_; }
00096 
00101       inline unsigned           mtu() const;
00102 
00106       unsigned                  prefix() const { return prefix_; }
00107 
00108       inline sch::IOEvent::p_t  recv_p() const;
00109 
00110       inline sch::IOEvent::p_t  send_p() const;
00111 
00116       inline void       insert_event(sch::IOEvent* e);
00121       inline void       erase_event(sch::IOEvent* e);
00122 
00123       inline void       destroy_all_events();
00124 
00130       const sys::VirtualInterfaceInfo&  info() const { return info_; }
00131 
00136       inline pkt::Packet        receive() const;
00141       inline void               send(const pkt::Packet& p) const;
00142 
00143       inline void               shipout(const pkt::Packet& p);
00144 
00145       unsigned                  queue_size() const { return queue_size_; }
00146 
00152       inline bool               operator<(const This& rhs) const;
00153 
00159       static inline This&       make_key(const address_t& a);
00160 
00161       void                      configure() {}
00162       void                      unconfigure() {}
00163     private:
00164       const sys::VirtualInterfaceInfo   info_;  
00165       const address_t           addr_;          
00166       unsigned                  prefix_;        
00167       events_t                  events_;        
00168       sch::PacketSender*        sender_;
00169       unsigned                  queue_size_;
00170 
00171       static This               dummy_for_find_; 
00172     };
00173 
00174   } // namespace net
00175 
00176 } // namespace olsr
00177 
00178 #  include "virtualinterface.hxx"
00179 
00180 # endif // ! QOLYESTER_DAEMON_NET_VIRTUALINTERFACE_HH
00181 
00182 #endif // QOLYESTER_ENABLE_VIRTUAL

Generated on Mon Sep 4 00:02:17 2006 for Qolyester daemon by  doxygen 1.4.6