4 * The secure anycast tunneling protocol (satp) defines a protocol used
5 * for communication between any combination of unicast and anycast
6 * tunnel endpoints. It has less protocol overhead than IPSec in Tunnel
7 * mode and allows tunneling of every ETHER TYPE protocol (e.g.
8 * ethernet, ip, arp ...). satp directly includes cryptography and
9 * message authentication based on the methodes used by SRTP. It is
10 * intended to deliver a generic, scaleable and secure solution for
11 * tunneling and relaying of packets of any protocol.
14 * Copyright (C) 2007 anytun.org <satp@wirdorange.org>
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License version 2
18 * as published by the Free Software Foundation.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program (see the file COPYING included with this
27 * distribution); if not, write to the Free Software Foundation, Inc.,
28 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31 #include "datatypes.h"
35 #include "keyDerivation.h"
37 #include "seqWindow.h"
38 #include "connectionList.h"
39 #include "routingTable.h"
40 #include "networkAddress.h"
41 #include "syncCommand.h"
47 #include <boost/archive/text_oarchive.hpp>
48 #include <boost/archive/text_iarchive.hpp>
51 void output(ConnectionList
&cl
)
55 ConnectionMap::iterator it
= cl
.getBeginUnlocked();
56 mux_t mux
= it
->first
;
57 std::cout
<< "Connection: Mux-ID: " << mux
<< std::endl
;
58 ConnectionParam
&conn( it
->second
);
59 std::cout
<< "Connection: Keyderivation-Type: " << conn
.kd_
.printType() << std::endl
;
62 else if( !gRoutingTable
.empty() )
64 RoutingMap::iterator it
= gRoutingTable
.getBeginUnlocked();
65 NetworkPrefix
pref( it
->first
);
66 std::cout
<< "Route: " << pref
.toString() << "/" << pref
.getNetworkPrefixLength() << " -> ";
67 mux_t mux
= it
->second
;
68 std::cout
<< mux
<< std::endl
;
69 gRoutingTable
.clear();
71 std::cout
<< std::endl
;
74 int main(int argc
, char* argv
[])
77 if(!gOpt
.parse(argc
, argv
))
84 std::stringstream iss_
;
85 int32_t missing_chars
=-1;
86 int32_t buffer_size_
=0;
87 while( std::cin
.good() )
95 if(missing_chars
==-1 && buffer_size_
>5)
97 char * buffer
= new char [6+1];
99 std::stringstream tmp
;
105 else if( missing_chars
>0 && missing_chars
<=buffer_size_
)
107 char * buffer
= new char [missing_chars
+1];
108 iss_
.read(buffer
,missing_chars
);
109 std::stringstream tmp
;
110 tmp
.write(buffer
,missing_chars
);
111 boost::archive::text_iarchive
ia(tmp
);
112 SyncCommand
scom(cl
);
114 buffer_size_
-=missing_chars
;