Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef KERNELROUTE_H
00028 #define KERNELROUTE_H
00029
00030 #include <linux/route.h>
00031
00032 #include "Route.h"
00033
00034 class KernelRoute
00035 {
00036 public:
00037 KernelRoute(const char * interface);
00038 ~KernelRoute();
00039
00040 void add(const Address& dest, const Address& gw);
00041 void remove(const Address& dest, const Address& gw);
00042 void removeDestination(const Address& destination);
00043
00044 Address destination(const Address& gateway) const;
00045 Route * routes() const;
00046 int count() const {return _routes.size();}
00047
00048 void clear();
00049 private:
00050 std::list<Route>::iterator find(const Address& destination);
00051 std::list<Route>::iterator find(const Address& destination, const Address& gateway);
00052 bool add(const Route& rt);
00053 bool remove(const Route& rt);
00054 rtentry * createEntry(const Route& rt);
00055
00056 const char * _interface;
00057 int _fd;
00058 std::list<Route> _routes;
00059 };
00060
00061 #endif // KERNELROUTE_H