summaryrefslogtreecommitdiff
path: root/anytun-showtables.cpp
diff options
context:
space:
mode:
authorErwin Nindl <nine@wirdorange.org>2008-02-29 14:55:19 +0000
committerErwin Nindl <nine@wirdorange.org>2008-02-29 14:55:19 +0000
commit78a957fa7026f75b50943c0b56d4ffde881f3e13 (patch)
treecf5f2b8e838ba776dbf6d58ec8871edbf96b6446 /anytun-showtables.cpp
parentfixed routing table getornew (diff)
pretty anytun-showtables.cpp
Diffstat (limited to 'anytun-showtables.cpp')
-rw-r--r--anytun-showtables.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/anytun-showtables.cpp b/anytun-showtables.cpp
index 8e5929f..a3fb505 100644
--- a/anytun-showtables.cpp
+++ b/anytun-showtables.cpp
@@ -48,23 +48,25 @@
#include <boost/archive/text_iarchive.hpp>
-void output(ConnectionList & cl)
+void output(ConnectionList &cl)
{
if( !cl.empty() )
{
ConnectionMap::iterator it = cl.getBeginUnlocked();
mux_t mux = it->first;
- std::cout << "Mux-ID: " << mux << std::endl;
+ std::cout << "Connection: Mux-ID: " << mux << std::endl;
ConnectionParam &conn( it->second );
- std::cout << "Keyderivation-Type: " << conn.kd_.printType() << std::endl;
+ std::cout << "Connection: Keyderivation-Type: " << conn.kd_.printType() << std::endl;
+ cl.clear();
}
else if( !gRoutingTable.empty() )
{
RoutingMap::iterator it = gRoutingTable.getBeginUnlocked();
NetworkPrefix pref( it->first );
- std::cout << "Network-Prefix: " << pref.getNetworkPrefixLength() << std::endl;
+ std::cout << "Route: " << pref.toString() << "/" << pref.getNetworkPrefixLength() << " -> ";
mux_t mux = it->second;
- std::cout << "Mux-ID: " << mux << std::endl;
+ std::cout << mux << std::endl;
+ gRoutingTable.clear();
}
std::cout << std::endl;
}
@@ -82,7 +84,7 @@ int main(int argc, char* argv[])
std::stringstream iss_;
int32_t missing_chars=-1;
int32_t buffer_size_=0;
- while(std::cin.good())
+ while( std::cin.good() )
{
char c;
std::cin.get(c);
@@ -100,7 +102,7 @@ int main(int argc, char* argv[])
delete[] buffer;
buffer_size_-=6;
}
- else if(missing_chars>0 && missing_chars<=buffer_size_)
+ else if( missing_chars>0 && missing_chars<=buffer_size_ )
{
char * buffer = new char [missing_chars+1];
iss_.read(buffer,missing_chars);