summaryrefslogtreecommitdiff
path: root/anyctr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'anyctr.cpp')
-rw-r--r--anyctr.cpp49
1 files changed, 15 insertions, 34 deletions
diff --git a/anyctr.cpp b/anyctr.cpp
index a2a0371..df699d1 100644
--- a/anyctr.cpp
+++ b/anyctr.cpp
@@ -31,27 +31,14 @@
#include <iostream>
#include <poll.h>
-#include <gcrypt.h>
-#include <cerrno> // for ENOMEM
-
#include "datatypes.h"
#include "log.h"
#include "buffer.h"
-#include "plainPacket.h"
-#include "encryptedPacket.h"
-#include "cipher.h"
#include "keyDerivation.h"
-#include "authAlgo.h"
-#include "authTag.h"
-#include "cipherFactory.h"
-#include "authAlgoFactory.h"
#include "keyDerivationFactory.h"
#include "signalController.h"
-#include "packetSource.h"
-#include "tunDevice.h"
-#include "options.h"
-#include "seqWindow.h"
+#include "anyctrOptions.h"
#include "connectionList.h"
#include "routingTable.h"
#include "networkAddress.h"
@@ -64,34 +51,29 @@
#include "syncClientSocket.h"
#include "syncCommand.h"
-#include "threadParam.h"
-
-#define MAX_PACKET_LENGTH 1600
-#define SESSION_KEYLEN_AUTH 20 // TODO: hardcoded size
-#define SESSION_KEYLEN_ENCR 16 // TODO: hardcoded size
-#define SESSION_KEYLEN_SALT 14 // TODO: hardcoded size
void createConnection(const std::string & remote_host, u_int16_t remote_port, ConnectionList & cl, u_int16_t seqSize, SyncQueue & queue, mux_t mux)
{
- SeqWindow * seq= new SeqWindow(seqSize);
- seq_nr_t seq_nr_=0;
- KeyDerivation * kd = KeyDerivationFactory::create(gOpt.getKdPrf());
- kd->init(gOpt.getKey(), gOpt.getSalt());
+ SeqWindow * seq = new SeqWindow(seqSize);
+ seq_nr_t seq_nr_ = 0;
+ KeyDerivation * kd = KeyDerivationFactory::create( gOpt.getKdPrf() );
+ kd->init( gOpt.getKey(), gOpt.getSalt() );
cLog.msg(Log::PRIO_NOTICE) << "added connection remote host " << remote_host << ":" << remote_port;
- ConnectionParam connparam ( (*kd), (*seq), seq_nr_, remote_host, remote_port);
- cl.addConnection(connparam,mux);
- NetworkAddress addr(ipv4,gOpt.getIfconfigParamRemoteNetmask().c_str());
- NetworkPrefix prefix(addr);
- gRoutingTable.addRoute(prefix,mux);
+ ConnectionParam connparam ( (*kd), (*seq), seq_nr_, remote_host, remote_port );
+ cl.addConnection( connparam, mux );
+ NetworkAddress addr( ipv4, gOpt.getIfconfigParamRemoteNetmask().c_str() );
+ NetworkPrefix prefix( addr );
+ gRoutingTable.addRoute( prefix, mux );
std::ostringstream sout;
- boost::archive::text_oarchive oa(sout);
- const SyncCommand scom(cl,mux);
- const SyncCommand scom2 (prefix);
+ boost::archive::text_oarchive oa( sout );
+ const SyncCommand scom( cl, mux );
+ const SyncCommand scom2( prefix );
+
oa << scom;
std::cout << std::setw(5) << std::setfill('0') << sout.str().size()<< ' ' << sout.str() << std::endl;
std::ostringstream sout2;
- boost::archive::text_oarchive oa2(sout2);
+ boost::archive::text_oarchive oa2( sout2 );
oa2 << scom2;
std::cout << std::setw(5) << std::setfill('0') << sout2.str().size()<< ' ' << sout2.str() << std::endl;
}
@@ -114,7 +96,6 @@ int main(int argc, char* argv[])
if(gOpt.getRemoteAddr() != "")
{
createConnection(gOpt.getRemoteAddr(),gOpt.getRemotePort(),cl,gOpt.getSeqWindowSize(), queue, gOpt.getMux());
-
}
return ret;