summaryrefslogtreecommitdiff
path: root/routingTable.h
diff options
context:
space:
mode:
authorOthmar Gsenger <otti@anytun.org>2008-02-27 20:44:12 +0000
committerOthmar Gsenger <otti@anytun.org>2008-02-27 20:44:12 +0000
commit9c3bb1aed4b9e8922bc33f4133f9936c992ef93d (patch)
treead1bb38523bd7a50e6e5394365880750edef986b /routingTable.h
parentadded network prefix (diff)
added routing table support
Diffstat (limited to 'routingTable.h')
-rw-r--r--routingTable.h23
1 files changed, 17 insertions, 6 deletions
diff --git a/routingTable.h b/routingTable.h
index 9a4ffae..b406b65 100644
--- a/routingTable.h
+++ b/routingTable.h
@@ -36,27 +36,38 @@
#include "threadUtils.hpp"
#include "datatypes.h"
-#include "routingTableEntry.h"
+//#include "routingTableEntry.h"
#include "networkAddress.h"
-typedef std::map<u_int16_t, RoutingTableEntry> RoutingMap;
+#include "networkPrefix.h"
+typedef std::map<NetworkPrefix,u_int16_t> RoutingMap;
class RoutingTable
{
public:
+ static RoutingTable& instance();
RoutingTable();
~RoutingTable();
- void addRoute(const RoutingTableEntry &route);
- const RoutingMap::iterator getRoute();
- const RoutingMap::iterator getEnd();
+ void addRoute(const NetworkPrefix & ,u_int16_t);
+ u_int16_t getRoute(const NetworkAddress &);
bool empty();
void clear();
Mutex& getMutex();
private:
- RoutingTable(const RoutingTable &s);
+ static Mutex instMutex;
+ static RoutingTable* inst;
+ class instanceCleaner {
+ public: ~instanceCleaner() {
+ if(RoutingTable::inst != 0)
+ delete RoutingTable::inst;
+ }
+ };
+ RoutingTable(const RoutingTable &s);
void operator=(const RoutingTable &s);
RoutingMap routes_;
Mutex mutex_;
};
+extern RoutingTable& gRoutingTable;
+
#endif