summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--buffer.cpp10
-rw-r--r--buffer.h11
-rw-r--r--connectionParam.cpp12
-rw-r--r--connectionParam.h10
-rw-r--r--keyDerivation.h9
5 files changed, 43 insertions, 9 deletions
diff --git a/buffer.cpp b/buffer.cpp
index 4bcb9b8..a21ebb3 100644
--- a/buffer.cpp
+++ b/buffer.cpp
@@ -32,7 +32,8 @@
#include <string>
#include <cstdio>
#include <iostream>
-
+#include <boost/archive/text_oarchive.hpp>
+#include <boost/archive/text_iarchive.hpp>
#include "datatypes.h"
#include "buffer.h"
@@ -247,3 +248,10 @@ Buffer Buffer::rightByteShift(u_int32_t width) const
return res;
}
+template<class Archive>
+void Buffer::serialize(Archive & ar, const unsigned int version)
+{
+ ar & length_;
+ ar & buf_;
+}
+
diff --git a/buffer.h b/buffer.h
index 37bbc29..85f539b 100644
--- a/buffer.h
+++ b/buffer.h
@@ -36,6 +36,12 @@
class TunDevice;
class UDPPacketSource;
+namespace boost {
+ namespace serialization {
+ class access;
+ }
+}
+
class Buffer
{
public:
@@ -70,7 +76,10 @@ protected:
u_int8_t *buf_;
u_int32_t length_;
-
+private:
+ friend class boost::serialization::access;
+ template<class Archive>
+ void serialize(Archive & ar, const unsigned int version);
};
#endif
diff --git a/connectionParam.cpp b/connectionParam.cpp
index d7dd3a4..4c1175a 100644
--- a/connectionParam.cpp
+++ b/connectionParam.cpp
@@ -29,7 +29,19 @@
*/
#include "connectionParam.h"
+#include <boost/archive/text_oarchive.hpp>
+#include <boost/archive/text_iarchive.hpp>
ConnectionParam::ConnectionParam(KeyDerivation& kd, SeqWindow& seq, std::string remote_host, u_int16_t remote_port) : kd_(kd),seq_(seq),remote_host_(remote_host), remote_port_(remote_port)
{
}
+
+template<class Archive>
+void ConnectionParam::serialize(Archive & ar, const unsigned int version)
+{
+ ar & kd_;
+ ar & seq_;
+ ar & remote_host_;
+ ar & remote_port_;
+}
+
diff --git a/connectionParam.h b/connectionParam.h
index 0129a03..c786db9 100644
--- a/connectionParam.h
+++ b/connectionParam.h
@@ -37,6 +37,12 @@
#include "authAlgo.h"
#include "seqWindow.h"
+namespace boost {
+ namespace serialization {
+ class access;
+ }
+}
+
class ConnectionParam
{
public:
@@ -45,6 +51,10 @@ public:
SeqWindow& seq_;
std::string remote_host_;
u_int16_t remote_port_;
+private:
+ friend class boost::serialization::access;
+ template<class Archive>
+ void serialize(Archive & ar, const unsigned int version);
};
#endif
diff --git a/keyDerivation.h b/keyDerivation.h
index a1a2987..a9939a3 100644
--- a/keyDerivation.h
+++ b/keyDerivation.h
@@ -33,8 +33,7 @@
#include "datatypes.h"
#include "buffer.h"
-//#include <boost/archive/text_oarchive.hpp>
-//#include <boost/archive/text_iarchive.hpp>
+
extern "C" {
@@ -60,11 +59,7 @@ public:
void clear();
private:
template<class Archive>
- void serialize(Archive & ar, const unsigned int version)
- {
- ar & ld_kdr_;
- ar & salt_;
- }
+ void serialize(Archive & ar, const unsigned int version);
protected:
int8_t ld_kdr_; // ld(key_derivation_rate)