realinterface.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 
00028 
00029 #include "config.hh"
00030 
00031 #ifndef QOLYESTER_ENABLE_VIRTUAL
00032 
00033 // This include is out of protection to resolve dependency cycles.
00034 # include "sys/realinterfaceinfo.hh"
00035 # include "pkt/packet.hh"
00036 
00037 # ifndef QOLYESTER_DAEMON_NET_REALINTERFACE_HH
00038 #  define QOLYESTER_DAEMON_NET_REALINTERFACE_HH 1
00039 
00040 #  include <set>
00041 
00042 #  include "net/ipaddress.hh"
00043 #  include "sch/scheduler.hh"
00044 #  include "sys/socket.hh"
00045 #  include "utl/stampable.hh"
00046 
00047 namespace olsr {
00048 
00049   namespace sch {
00050 
00051     class PacketSender;
00052 
00053   }
00054 
00055   namespace net {
00056 
00061     class RealInterface : public utl::MultiStampable<1, address_t> {
00062       typedef RealInterface                     This;
00063       typedef utl::MultiStampable<1, address_t> Super;
00064       typedef std::set<sch::IOEvent*>           events_t;
00071       explicit RealInterface();
00072     public:
00073 
00078       inline RealInterface(const sys::RealInterfaceInfo& info);
00079 
00080       inline RealInterface(const sys::RealInterfaceInfo& info,
00081                            const address_t& addr);
00082 
00086       inline RealInterface(const This& other);
00087 
00091       inline ~RealInterface();
00092 
00097       const address_t&          addr() const { return addr_; }
00098 
00103       inline unsigned           mtu() const;
00104 
00105       unsigned                  prefix() const { return prefix_; }
00106 
00107       inline sch::IOEvent::p_t  recv_p() const;
00108 
00109       inline sch::IOEvent::p_t  send_p() const;
00110 
00111       inline void               insert_event(sch::IOEvent* e);
00112       inline void               erase_event(sch::IOEvent* e);
00113 
00114       inline void               destroy_all_events();
00115 
00120       const sys::RealInterfaceInfo&     info() const { return info_; }
00121 
00126       inline pkt::Packet        receive() const;
00127 
00132       inline void               send(const pkt::Packet& p) const;
00133 
00134       inline void               shipout(const pkt::Packet& p);
00135 
00136       unsigned                  queue_size() const { return queue_size_; }
00137 
00142       inline bool               operator<(const This& rhs) const;
00143 
00149       static inline This&       make_key(const address_t& a);
00150 
00151       inline void               configure();
00152       inline void               unconfigure();
00153     private:
00154 
00155       const sys::RealInterfaceInfo      info_; 
00156       const address_t           addr_; 
00157       unsigned                  prefix_;
00158 #  ifdef QOLYESTER_TWO_SOCKETS
00159       sys::Socket               insock_; 
00160       sys::Socket               outsock_; 
00161 #  else // !QOLYESTER_TWO_SOCKETS
00162       sys::Socket               sock_; 
00163 #  endif
00164 
00165       events_t                  events_;
00166       sch::PacketSender*        sender_;
00167       unsigned*                 usecount_;
00168       sys::RealInterfaceInfo::config_t* config_;
00169       unsigned                  queue_size_;
00170 
00171       static This               dummy_for_find_; 
00172     };
00173 
00174   } // namespace net
00175 
00176 } // namespace olsr
00177 
00178 #  include "realinterface.hxx"
00179 
00180 # endif // ! QOLYESTER_DAEMON_NET_REALINTERFACE_HH
00181 
00182 #endif // ! QOLYESTER_ENABLE_VIRTUAL

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