00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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 }
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 }
00083
00084 }
00085
00086 }
00087
00088 # include "routingsocket.hxx"
00089
00090 # endif // ! QOLYESTER_DAEMON_SYS_LINUX_ROUTINGSOCKET_HH
00091
00092 #endif // ! QOLYESTER_ENABLE_VIRTUAL