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-2008 Othmar Gsenger, Erwin Nindl,
15 * Christian Pointner <satp@wirdorange.org>
17 * This file is part of Anytun.
19 * Anytun is free software: you can redistribute it and/or modify
20 * it under the terms of the GNU General Public License version 3 as
21 * published by the Free Software Foundation.
23 * Anytun is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
28 * You should have received a copy of the GNU General Public License
29 * along with anytun. If not, see <http://www.gnu.org/licenses/>.
35 #include "datatypes.h"
37 #include "threadUtils.hpp"
49 u_int16_t prefix_length
;
52 typedef std::list
<OptionRoute
> RouteList
;
55 typedef std::list
<OptionConnectTo
> ConnectToList
;
60 static Options
& instance();
62 bool parse(int argc
, char* argv
[]);
66 std::string
getProgname();
67 Options
& setProgname(std::string p
);
69 Options
& setDaemonize(bool d
);
71 Options
& setChroot(bool b
);
72 std::string
getUsername();
73 Options
& setUsername(std::string u
);
74 std::string
getChrootDir();
75 Options
& setChrootDir(std::string c
);
76 std::string
getPidFile();
77 Options
& setPidFile(std::string p
);
78 sender_id_t
getSenderId();
79 Options
& setSenderId(sender_id_t s
);
80 std::string
getLocalAddr();
81 Options
& setLocalAddr(std::string l
);
82 std::string
getLocalSyncAddr();
83 Options
& setLocalSyncAddr(std::string l
);
84 std::string
getRemoteSyncAddr();
85 Options
& setRemoteSyncAddr(std::string l
);
86 std::string
getRemoteSyncPort();
87 Options
& setRemoteSyncPort(std::string l
);
88 std::string
getLocalPort();
89 Options
& setLocalPort(std::string l
);
90 std::string
getRemoteAddr();
91 Options
& setRemoteAddr(std::string r
);
92 std::string
getLocalSyncPort();
93 Options
& setLocalSyncPort(std::string l
);
94 std::string
getRemotePort();
95 Options
& setRemotePort(std::string r
);
96 Options
& setRemoteAddrPort(std::string addr
, std::string port
);
97 std::string
getDevName();
98 Options
& setDevName(std::string d
);
99 std::string
getDevType();
100 Options
& setDevType(std::string d
);
101 std::string
getIfconfigParamLocal();
102 Options
& setIfconfigParamLocal(std::string i
);
103 std::string
getIfconfigParamRemoteNetmask();
104 Options
& setIfconfigParamRemoteNetmask(std::string i
);
105 std::string
getPostUpScript();
106 Options
& setPostUpScript(std::string p
);
107 window_size_t
getSeqWindowSize();
108 Options
& setSeqWindowSize(window_size_t s
);
109 std::string
getCipher();
110 Options
& setCipher(std::string c
);
111 std::string
getKdPrf();
112 Options
& setKdPrf(std::string k
);
113 std::string
getAuthAlgo();
114 Options
& setAuthAlgo(std::string a
);
115 ConnectToList
getConnectTo();
116 Options
& setMux(mux_t m
);
118 Options
& setKey(std::string k
);
120 Options
& setSalt(std::string s
);
122 RouteList
getRoutes();
128 Options(const Options
&l
);
129 void operator=(const Options
&l
);
131 static Options
* inst
;
132 static ::Mutex instMutex
;
133 class instanceCleaner
{
134 public: ~instanceCleaner() {
135 if(Options::inst
!= 0)
136 delete Options::inst
;
139 friend class instanceCleaner
;
141 static bool splitAndAddHostPort(std::string hostPort
, ConnectToList
& list
);
145 ConnectToList connect_to_
;
146 std::string progname_
;
149 std::string username_
;
150 std::string chroot_dir_
;
151 std::string pid_file_
;
152 sender_id_t sender_id_
;
153 std::string local_addr_
;
154 std::string local_sync_addr_
;
155 std::string local_port_
;
156 std::string local_sync_port_
;
157 std::string remote_sync_addr_
;
158 std::string remote_sync_port_
;
159 std::string remote_addr_
;
160 std::string remote_port_
;
161 std::string dev_name_
;
162 std::string dev_type_
;
163 std::string ifconfig_param_local_
;
164 std::string ifconfig_param_remote_netmask_
;
165 std::string post_up_script_
;
166 window_size_t seq_window_size_
;
169 std::string auth_algo_
;
176 extern Options
& gOpt
;