diff options
author | Othmar Gsenger <otti@anytun.org> | 2008-02-27 20:44:12 +0000 |
---|---|---|
committer | Othmar Gsenger <otti@anytun.org> | 2008-02-27 20:44:12 +0000 |
commit | 9c3bb1aed4b9e8922bc33f4133f9936c992ef93d (patch) | |
tree | ad1bb38523bd7a50e6e5394365880750edef986b /routingTable.cpp | |
parent | added network prefix (diff) |
added routing table support
Diffstat (limited to 'routingTable.cpp')
-rw-r--r-- | routingTable.cpp | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/routingTable.cpp b/routingTable.cpp index 24ac106..a6e0917 100644 --- a/routingTable.cpp +++ b/routingTable.cpp @@ -33,6 +33,21 @@ #include "routingTable.h" +RoutingTable* RoutingTable::inst = NULL; +Mutex RoutingTable::instMutex; +RoutingTable& gRoutingTable = RoutingTable::instance(); + + +RoutingTable& RoutingTable::instance() +{ + Lock lock(instMutex); + static instanceCleaner c; + if(!inst) + inst = new RoutingTable(); + + return *inst; +} + RoutingTable::RoutingTable() { } @@ -41,7 +56,7 @@ RoutingTable::~RoutingTable() { } -void RoutingTable::addRoute(const RoutingTableEntry &route ) +void RoutingTable::addRoute(const NetworkPrefix & ,u_int16_t ) { Lock lock(mutex_); @@ -53,16 +68,11 @@ void RoutingTable::addRoute(const RoutingTableEntry &route ) // } } -const RoutingMap::iterator RoutingTable::getEnd() -{ - return routes_.end(); -} - -const RoutingMap::iterator RoutingTable::getRoute() +u_int16_t RoutingTable::getRoute(const NetworkAddress &) { Lock lock(mutex_); RoutingMap::iterator it = routes_.begin(); - return it; + return 0; } void RoutingTable::clear() |