summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOthmar Gsenger <otti@anytun.org>2008-02-28 15:16:46 +0000
committerOthmar Gsenger <otti@anytun.org>2008-02-28 15:16:46 +0000
commitabef27c309c3e3bc607ab3fd44ef4479290911f7 (patch)
treee75fdbbb6a18b49fd116fcf8fd884bb2a060f3b9
parentmore edits on dokumentation.odt (diff)
added joobla template
-rw-r--r--homepage/citrus_ice.zipbin0 -> 65500 bytes
-rw-r--r--networkAddress.h11
-rw-r--r--routingTable.cpp12
-rw-r--r--routingTable.h1
-rw-r--r--syncRouteCommand.cpp8
-rw-r--r--syncRouteCommand.h16
6 files changed, 37 insertions, 11 deletions
diff --git a/homepage/citrus_ice.zip b/homepage/citrus_ice.zip
new file mode 100644
index 0000000..154e62f
--- /dev/null
+++ b/homepage/citrus_ice.zip
Binary files differ
diff --git a/networkAddress.h b/networkAddress.h
index 1192fb3..ccc0750 100644
--- a/networkAddress.h
+++ b/networkAddress.h
@@ -30,6 +30,8 @@
#ifndef _NETWORK_ADDRESS_H
#define _NETWORK_ADDRESS_H
+#include <boost/archive/text_oarchive.hpp>
+#include <boost/archive/text_iarchive.hpp>
#include "threadUtils.hpp"
#include "datatypes.h"
@@ -72,6 +74,15 @@ protected:
network_address_type_t network_address_type_;
private:
NetworkAddress operator=(const NetworkAddress &s);
+ friend class boost::serialization::access;
+ template<class Archive>
+ void serialize(Archive & ar, const unsigned int version)
+ {
+ ar & network_address_type_;
+ ar & ipv4_address_;
+ ar & ipv6_address_;
+ ar & ethernet_address_;
+ }
};
#endif
diff --git a/routingTable.cpp b/routingTable.cpp
index 10a6041..a2b5f56 100644
--- a/routingTable.cpp
+++ b/routingTable.cpp
@@ -91,6 +91,18 @@ u_int16_t RoutingTable::getRoute(const NetworkAddress & addr)
return 0;
}
+u_int16_t& RoutingTable::getOrNewRoutingTEUnlocked(const NetworkAddress & addr)
+{
+ RoutingMap::iterator it = routes_.find(addr);
+ if(it!=routes_.end())
+ return it->second;
+
+ routes_.insert(RoutingMap::value_type(addr, 0));
+ it = routes_.find(addr);
+ return it->second;
+}
+
+
void RoutingTable::clear()
{
Lock lock(mutex_);
diff --git a/routingTable.h b/routingTable.h
index f4f89c3..4466414 100644
--- a/routingTable.h
+++ b/routingTable.h
@@ -53,6 +53,7 @@ public:
bool empty();
void clear();
Mutex& getMutex();
+ u_int16_t& getOrNewRoutingTEUnlocked(const NetworkAddress & addr);
private:
static Mutex instMutex;
diff --git a/syncRouteCommand.cpp b/syncRouteCommand.cpp
index 7ba6a18..e1b354b 100644
--- a/syncRouteCommand.cpp
+++ b/syncRouteCommand.cpp
@@ -4,12 +4,12 @@ SyncRouteCommand::SyncRouteCommand()
{
}
-SyncRouteCommand::SyncRouteCommand( u_int16_t mux )
-:mux_(mux)
+SyncRouteCommand::SyncRouteCommand( const NetworkAddress & addr )
+:addr_(addr)
{
}
-u_int16_t SyncRouteCommand::getMux() const
+NetworkAddress SyncRouteCommand::getAddr() const
{
- return mux_;
+ return addr_;
}
diff --git a/syncRouteCommand.h b/syncRouteCommand.h
index 913673c..2e38eb4 100644
--- a/syncRouteCommand.h
+++ b/syncRouteCommand.h
@@ -4,25 +4,27 @@
#include <boost/archive/text_iarchive.hpp>
#include "threadUtils.hpp"
+#include "networkAddress.h"
+#include "routingTable.h"
class SyncRouteCommand
{
public:
- SyncRouteCommand(u_int16_t mux);
+ SyncRouteCommand(const NetworkAddress & );
SyncRouteCommand();
- u_int16_t getMux() const;
+ NetworkAddress getAddr() const;
private:
SyncRouteCommand(const SyncRouteCommand &);
- u_int16_t mux_;
+ NetworkAddress addr_;
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive & ar, const unsigned int version)
{
- //Lock lock(gRoutingTable.getMutex());
- ar & mux_;
- // ConnectionParam & conn = cl_.getOrNewConnectionUnlocked(mux_);
- // ar & conn;
+ Lock lock(gRoutingTable.getMutex());
+ ar & addr_;
+ u_int16_t & mux = gRoutingTable.getOrNewRoutingTEUnlocked(addr_);
+ ar & mux;
}
};