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

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 net {
00050 
00055     class RealInterface : public utl::MultiStampable<1, address_t> {
00056       typedef RealInterface                     This;
00057       typedef utl::MultiStampable<1, address_t> Super;
00058       typedef std::set<sch::IOEvent*>           events_t;
00065       explicit RealInterface();
00066     public:
00067 
00072       RealInterface(const sys::RealInterfaceInfo& info);
00073 
00074       RealInterface(const sys::RealInterfaceInfo& info, const address_t& addr);
00075 
00079       RealInterface(const This& other);
00080 
00084       ~RealInterface();
00085 
00090       const address_t&          addr() const { return addr_; }
00091 
00096       unsigned                  mtu() const;
00097 
00098       unsigned                  prefix() const { return prefix_; }
00099 
00100       sch::IOEvent::p_t         recv_p() const;
00101 
00102       sch::IOEvent::p_t         send_p() const;
00103 
00104       void                      insert_event(sch::IOEvent* e);
00105       void                      erase_event(sch::IOEvent* e);
00106 
00107       void                      destroy_all_events();
00108 
00113       const sys::RealInterfaceInfo&     info() const { return info_; }
00114 
00119       pkt::Packet               receive() const;
00120 
00125       void                      send(const pkt::Packet& p) const;
00126 
00131       bool                      operator<(const This& rhs) const;
00132 
00138       static This&              make_key(const address_t& a);
00139 
00140       inline void               configure();
00141       inline void               unconfigure();
00142     private:
00143 
00144       const sys::RealInterfaceInfo      info_; 
00145       const address_t           addr_; 
00146       unsigned                  prefix_;
00147 #  ifdef QOLYESTER_TWO_SOCKETS
00148       sys::Socket               insock_; 
00149       sys::Socket               outsock_; 
00150 #  else // !QOLYESTER_TWO_SOCKETS
00151       sys::Socket               sock_; 
00152 #  endif
00153 
00154       events_t                  events_;
00155       unsigned*                 usecount_;
00156       sys::RealInterfaceInfo::config_t* config_;
00157 
00158       static This               dummy_for_find_; 
00159     };
00160 
00161   } // namespace net
00162 
00163 } // namespace olsr
00164 
00165 #  ifndef QOLYESTER_DONTINCLUDE_HXX
00166 #   include "realinterface.hxx"
00167 #  endif
00168 
00169 # endif // ! QOLYESTER_DAEMON_NET_REALINTERFACE_HH
00170 
00171 #endif // ! QOLYESTER_ENABLE_VIRTUAL

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