From 9c3bb1aed4b9e8922bc33f4133f9936c992ef93d Mon Sep 17 00:00:00 2001 From: Othmar Gsenger Date: Wed, 27 Feb 2008 20:44:12 +0000 Subject: added routing table support --- routingTable.cpp | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'routingTable.cpp') 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() -- cgit v1.2.3