summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErwin Nindl <nine@wirdorange.org>2008-02-28 22:38:35 +0000
committerErwin Nindl <nine@wirdorange.org>2008-02-28 22:38:35 +0000
commit55a2a78cdd98e86a779c3714de89e0481df3562b (patch)
treeed7a9bbf9d1c5580a542cf8bfa623e1a345c4fae
parentanother test (diff)
modified makefile for anyctr
options cleanup
-rw-r--r--Makefile32
-rw-r--r--anyctr.cpp49
2 files changed, 45 insertions, 36 deletions
diff --git a/Makefile b/Makefile
index e45a271..4fa58a8 100644
--- a/Makefile
+++ b/Makefile
@@ -86,6 +86,31 @@ ANYMUXOBJS = muxSocket.o \
log.o \
$(SOCKETDEPS)
+ANYCTROBJS = log.o \
+ buffer.o \
+ keyDerivation.o \
+ mpi.o \
+ keyDerivationFactory.o \
+ networkAddress.o \
+ networkPrefix.o \
+ signalController.o \
+ connectionList.o \
+ connectionParam.o \
+ anyctrOptions.o \
+ router.o \
+ routingTable.o \
+ routingTableEntry.o \
+ seqWindow.o \
+ syncSocket.o \
+ syncSocketHandler.o \
+ syncClientSocket.o \
+ syncQueue.o \
+ syncBuffer.o \
+ syncCommand.o \
+ syncRouteCommand.o \
+ syncConnectionCommand.o \
+ $(SOCKETDEPS)
+
EXECUTABLE = anytun anyctr anymux anytun-showtables
all: $(EXECUTABLE) libAnysync.a
@@ -96,8 +121,8 @@ anytun: $(OBJS) anytun.o
anytun-showtables: $(OBJS) anytun-showtables.o
$(LD) $(OBJS) anytun-showtables.o -o $@ $(LDFLAGS)
-anyctr: $(OBJS) anyctr.o
- $(LD) $(OBJS) anyctr.o -o $@ $(LDFLAGS)
+anyctr: $(ANYCTROBJS) anyctr.o
+ $(LD) $(ANYCTROBJS) anyctr.o -o $@ $(LDFLAGS)
anymux: $(ANYMUXOBJS) anymux.o
$(LD) $(ANYMUXOBJS) anymux.o -o $@ $(LDFLAGS)
@@ -129,6 +154,9 @@ muxSocket.o: muxSocket.cpp muxSocket.h
anymuxOptions.o: anymuxOptions.cpp anymuxOptions.h
$(C++) $(CCFLAGS) $< -c
+anyctrOptions.o: anyctrOptions.cpp anyctrOptions.h
+ $(C++) $(CCFLAGS) $< -c
+
authAlgo.o: authAlgo.cpp authAlgo.h buffer.h
$(C++) $(CCFLAGS) $< -c
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;