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"
40 typedef struct OptionConnectTo
46 typedef std::list
<OptionConnectTo
> ConnectToList
;
51 static Options
& instance();
53 bool parse(int argc
, char* argv
[]);
57 std::string
getProgname();
58 Options
& setProgname(std::string p
);
60 Options
& setDaemonize(bool d
);
62 Options
& setChroot(bool b
);
63 std::string
getUsername();
64 Options
& setUsername(std::string u
);
65 std::string
getChrootDir();
66 Options
& setChrootDir(std::string c
);
67 std::string
getPidFile();
68 Options
& setPidFile(std::string p
);
69 sender_id_t
getSenderId();
70 Options
& setSenderId(sender_id_t s
);
71 std::string
getLocalAddr();
72 Options
& setLocalAddr(std::string l
);
73 std::string
getLocalSyncAddr();
74 Options
& setLocalSyncAddr(std::string l
);
75 std::string
getRemoteSyncAddr();
76 Options
& setRemoteSyncAddr(std::string l
);
77 u_int16_t
getRemoteSyncPort();
78 Options
& setRemoteSyncPort(u_int16_t l
);
79 u_int16_t
getLocalPort();
80 Options
& setLocalPort(u_int16_t l
);
81 std::string
getRemoteAddr();
82 Options
& setRemoteAddr(std::string r
);
83 u_int16_t
getLocalSyncPort();
84 Options
& setLocalSyncPort(u_int16_t l
);
85 u_int16_t
getRemotePort();
86 Options
& setRemotePort(u_int16_t r
);
87 Options
& setRemoteAddrPort(std::string addr
, u_int16_t port
);
88 std::string
getDevName();
89 Options
& setDevName(std::string d
);
90 std::string
getDevType();
91 Options
& setDevType(std::string d
);
92 std::string
getIfconfigParamLocal();
93 Options
& setIfconfigParamLocal(std::string i
);
94 std::string
getIfconfigParamRemoteNetmask();
95 Options
& setIfconfigParamRemoteNetmask(std::string i
);
96 std::string
getPostUpScript();
97 Options
& setPostUpScript(std::string p
);
98 window_size_t
getSeqWindowSize();
99 Options
& setSeqWindowSize(window_size_t s
);
100 std::string
getCipher();
101 Options
& setCipher(std::string c
);
102 std::string
getKdPrf();
103 Options
& setKdPrf(std::string k
);
104 std::string
getAuthAlgo();
105 Options
& setAuthAlgo(std::string a
);
106 ConnectToList
getConnectTo();
107 Options
& setMux(u_int16_t m
);
109 Options
& setKey(std::string k
);
111 Options
& setSalt(std::string s
);
117 Options(const Options
&l
);
118 void operator=(const Options
&l
);
120 static Options
* inst
;
121 static ::Mutex instMutex
;
122 class instanceCleaner
{
123 public: ~instanceCleaner() {
124 if(Options::inst
!= 0)
125 delete Options::inst
;
128 friend class instanceCleaner
;
132 ConnectToList connect_to_
;
133 std::string progname_
;
136 std::string username_
;
137 std::string chroot_dir_
;
138 std::string pid_file_
;
139 sender_id_t sender_id_
;
140 std::string local_addr_
;
141 std::string local_sync_addr_
;
142 u_int16_t local_port_
;
143 u_int16_t local_sync_port_
;
144 std::string remote_sync_addr_
;
145 u_int16_t remote_sync_port_
;
146 std::string remote_addr_
;
147 u_int16_t remote_port_
;
148 std::string dev_name_
;
149 std::string dev_type_
;
150 std::string ifconfig_param_local_
;
151 std::string ifconfig_param_remote_netmask_
;
152 std::string post_up_script_
;
153 window_size_t seq_window_size_
;
156 std::string auth_algo_
;
162 extern Options
& gOpt
;