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

linux/routingsocket.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 
00019 #include "config.hh"
00020 
00021 #ifndef QOLYESTER_ENABLE_VIRTUAL
00022 
00023 # ifndef QOLYESTER_DAEMON_SYS_LINUX_ROUTINGSOCKET_HH
00024 #  define QOLYESTER_DAEMON_SYS_LINUX_ROUTINGSOCKET_HH 1
00025 
00026 #  include "net/ipaddress.hh"
00027 #  include "sys/linux/interfacedesc.hh"
00028 #  include "sys/linux/netlink.hh"
00029 
00030 namespace olsr {
00031 
00032   namespace sys {
00033 
00034     class RealInterfaceInfo;
00035 
00036 #  ifdef DEBUG
00037 
00038     namespace netlink {
00039 
00040       class RoutingTableVisitor : public DefaultVisitor {
00041         typedef RoutingTableVisitor                     This;
00042       public:
00043         RoutingTableVisitor(std::ostream& os);
00044         virtual ~RoutingTableVisitor();
00045 
00046         virtual void visit(const NLError& e);
00047         virtual void visit(const NLNewRoute& e);
00048         virtual void visit(const NLRouteAttrDestination& e);
00049         virtual void visit(const NLRouteAttrGateway& e);
00050         virtual void visit(const NLRouteAttrOutInterface& e);
00051       private:
00052         std::ostream&   os_;
00053         address_t       dst_;
00054         address_t       via_;
00055         unsigned        index_;
00056       };
00057 
00058     } // namespace netlink
00059 
00060 #  endif // !DEBUG
00061 
00062     namespace internal {
00063 
00064       class RoutingSocket {
00065       public:
00066         void    print_kernel_routes();
00067         void    remove_old_routes();
00068         void    add_local_route(const address_t& d, unsigned p,
00069                                 const sys::RealInterfaceInfo& i);
00070         void    add_remote_route(const address_t& d, unsigned p,
00071                                  const address_t& n);
00072         void    remove_local_route(const address_t& d, unsigned p,
00073                                    const sys::RealInterfaceInfo& i);
00074         void    remove_remote_route(const address_t& d, unsigned p,
00075                                     const address_t& n);
00076         void    add_addr(unsigned i, const InterfaceAddress& a);
00077         void    del_addr(unsigned i, const InterfaceAddress& a);
00078       private:
00079         netlink::NLSocket       _s;
00080       };
00081 
00082     } // namespace internal
00083 
00084   } // namespace sys
00085 
00086 } // namespace olsr
00087 
00088 #  include "routingsocket.hxx"
00089 
00090 # endif // ! QOLYESTER_DAEMON_SYS_LINUX_ROUTINGSOCKET_HH
00091 
00092 #endif // ! QOLYESTER_ENABLE_VIRTUAL

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