routingsocket.hh

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

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