From dccdd15402b2b7e0e8453c715fc451b3e3510272 Mon Sep 17 00:00:00 2001 From: Othmar Gsenger Date: Sun, 4 Nov 2007 17:46:23 +0000 Subject: added Address Class and Connection List --- Makefile | 1 + connParam.h | 43 -------------------------------------- connectionList.h | 4 +++- connectionParam.h | 43 ++++++++++++++++++++++++++++++++++++++ networkAddress.cpp | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++ networkAddress.h | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 166 insertions(+), 44 deletions(-) delete mode 100644 connParam.h create mode 100644 connectionParam.h create mode 100644 networkAddress.cpp create mode 100644 networkAddress.h diff --git a/Makefile b/Makefile index 4dbad5e..7cf27b2 100644 --- a/Makefile +++ b/Makefile @@ -38,6 +38,7 @@ OBJS = anytun.o \ authAlgo.o \ keyDerivation.o \ connectionList.o \ + networkAddress.o \ PracticalSocket.o \ signalController.o \ log.o \ diff --git a/connParam.h b/connParam.h deleted file mode 100644 index e5fa255..0000000 --- a/connParam.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * anytun - * - * The secure anycast tunneling protocol (satp) defines a protocol used - * for communication between any combination of unicast and anycast - * tunnel endpoints. It has less protocol overhead than IPSec in Tunnel - * mode and allows tunneling of every ETHER TYPE protocol (e.g. - * ethernet, ip, arp ...). satp directly includes cryptography and - * message authentication based on the methodes used by SRTP. It is - * intended to deliver a generic, scaleable and secure solution for - * tunneling and relaying of packets of any protocol. - * - * - * Copyright (C) 2007 anytun.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program (see the file COPYING included with this - * distribution); if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _CONNPARAM_H_ -#define _CONNPARAM_H_ - -struct connParam -{ - Options& opt; - KeyDerivation& kd; - Cypher& c; - AuthAlgo& a; - SeqWindow& seq; -}; - -#endif diff --git a/connectionList.h b/connectionList.h index 926a9ba..45dcd7d 100644 --- a/connectionList.h +++ b/connectionList.h @@ -36,6 +36,7 @@ #include "threadUtils.hpp" #include "datatypes.h" +#include "connectionParam.h" class ConnectionList { @@ -48,7 +49,8 @@ public: private: ConnectionList(const ConnectionList &s); void operator=(const ConnectionList &s); - + typedef std::map ConnectionMap; + ConnectionMap connections_; Mutex mutex_; }; diff --git a/connectionParam.h b/connectionParam.h new file mode 100644 index 0000000..3cd8275 --- /dev/null +++ b/connectionParam.h @@ -0,0 +1,43 @@ +/* + * anytun + * + * The secure anycast tunneling protocol (satp) defines a protocol used + * for communication between any combination of unicast and anycast + * tunnel endpoints. It has less protocol overhead than IPSec in Tunnel + * mode and allows tunneling of every ETHER TYPE protocol (e.g. + * ethernet, ip, arp ...). satp directly includes cryptography and + * message authentication based on the methodes used by SRTP. It is + * intended to deliver a generic, scaleable and secure solution for + * tunneling and relaying of packets of any protocol. + * + * + * Copyright (C) 2007 anytun.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program (see the file COPYING included with this + * distribution); if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _CONNECTIONPARAM_H_ +#define _CONNECTIONPARAM_H_ + +struct connection_param_t +{ + Options& opt; + KeyDerivation& kd; + Cypher& c; + AuthAlgo& a; + SeqWindow& seq; +}; + +#endif diff --git a/networkAddress.cpp b/networkAddress.cpp new file mode 100644 index 0000000..b6e4528 --- /dev/null +++ b/networkAddress.cpp @@ -0,0 +1,59 @@ +/* + * anytun + * + * The secure anycast tunneling protocol (satp) defines a protocol used + * for communication between any combination of unicast and anycast + * tunnel endpoints. It has less protocol overhead than IPSec in Tunnel + * mode and allows tunneling of every ETHER TYPE protocol (e.g. + * ethernet, ip, arp ...). satp directly includes cryptography and + * message authentication based on the methodes used by SRTP. It is + * intended to deliver a generic, scaleable and secure solution for + * tunneling and relaying of packets of any protocol. + * + * + * Copyright (C) 2007 anytun.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program (see the file COPYING included with this + * distribution); if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "threadUtils.hpp" +#include "datatypes.h" + +#include "networkAddress.h" + +NetworkAddress::NetworkAddress():address_length_(0) +{ +} + +NetworkAddress::~NetworkAddress() +{ +} + +void NetworkAddress::setNetworkAddress(const network_address_type_t type, const char * address ) +{ +} + +void NetworkAddress::getNetworkAddress(const char *) +{ +} + +network_address_type_t NetworkAddress::getNetworkAddressType() +{ +} + +bool NetworkAddress::operator<(const NetworkAddress &right) const +{ +} + diff --git a/networkAddress.h b/networkAddress.h new file mode 100644 index 0000000..59430e5 --- /dev/null +++ b/networkAddress.h @@ -0,0 +1,60 @@ +/* + * anytun + * + * The secure anycast tunneling protocol (satp) defines a protocol used + * for communication between any combination of unicast and anycast + * tunnel endpoints. It has less protocol overhead than IPSec in Tunnel + * mode and allows tunneling of every ETHER TYPE protocol (e.g. + * ethernet, ip, arp ...). satp directly includes cryptography and + * message authentication based on the methodes used by SRTP. It is + * intended to deliver a generic, scaleable and secure solution for + * tunneling and relaying of packets of any protocol. + * + * + * Copyright (C) 2007 anytun.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program (see the file COPYING included with this + * distribution); if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NETWORK_ADDRESS_H +#define _NETWORK_ADDRESS_H + +#include "threadUtils.hpp" +#include "datatypes.h" + +enum network_address_type_t +{ + ipv4, + ipv6, + ethernet +}; + +class NetworkAddress +{ +public: + NetworkAddress(); + ~NetworkAddress(); + void setNetworkAddress(const network_address_type_t type, const char * address ); + void getNetworkAddress(const char *); + network_address_type_t getNetworkAddressType(); + +private: + bool operator<(const NetworkAddress &s) const; + Mutex mutex_; + uint8_t address_length_; + network_address_type_t network_address_type_; +}; + +#endif -- cgit v1.2.3