summaryrefslogtreecommitdiff
path: root/src/routingTable.cpp
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2009-02-22 07:20:56 +0000
committerChristian Pointner <equinox@anytun.org>2009-02-22 07:20:56 +0000
commitb7013f1be9a5f09ecae4b37f0986352abfcd0dc1 (patch)
treef890c7677d27953afaf05215a9c91a86b23897bd /src/routingTable.cpp
parentfixed signalController on unix (diff)
replaced regular throws with AnytunError::thowErr
Diffstat (limited to 'src/routingTable.cpp')
-rw-r--r--src/routingTable.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/routingTable.cpp b/src/routingTable.cpp
index d1a21e9..f20983b 100644
--- a/src/routingTable.cpp
+++ b/src/routingTable.cpp
@@ -31,6 +31,7 @@
#include "networkPrefix.h"
#include "threadUtils.hpp"
#include "datatypes.h"
+#include "anytunError.hpp"
#include "routingTable.h"
#include "routingTree.hpp"
@@ -83,7 +84,7 @@ void RoutingTable::updateRouteTreeUnlocked(const NetworkPrefix & pref)
length=48;
RoutingTree::walk(bytes, node, length, mux);
} else {
- throw std::runtime_error("illegal protocoll type");
+ AnytunError::throwErr() << "illegal protocol type";
}
//root_[type].print(0);
}
@@ -109,7 +110,7 @@ void RoutingTable::addRoute(const NetworkPrefix & pref, u_int16_t mux)
} else if (type==ethernet) {
return; // TODO: add support for ethernet
} else {
- throw std::runtime_error("illegal protocoll type");
+ AnytunError::throwErr() << "illegal protocol type";
}
}
@@ -121,13 +122,13 @@ void RoutingTable::delRoute(const NetworkPrefix & pref )
routes_[pref.getNetworkAddressType()].erase(routes_[pref.getNetworkAddressType()].find(pref));
}
-u_int16_t RoutingTable::getRoute(const NetworkAddress & addr)
+u_int16_t RoutingTable::getRoute(const NetworkAddress & addr)
{
Lock lock(mutex_);
network_address_type_t type=addr.getNetworkAddressType();
if (routes_[type].empty())
- throw std::runtime_error("no route");
+ AnytunError::throwErr() << "no route";
if (type==ipv4)
{
@@ -142,8 +143,9 @@ u_int16_t RoutingTable::getRoute(const NetworkAddress & addr)
ethernet_bytes_type bytes(addr.to_bytes_ethernet());
return RoutingTree::find(bytes, root_[type]);
} else {
- throw std::runtime_error("illegal protocoll type");
+ AnytunError::throwErr() << "illegal protocol type";
}
+ return 0;
}
u_int16_t* RoutingTable::getOrNewRoutingTEUnlocked(const NetworkPrefix & addr)