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 methods 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-2014 Markus Grüneis, 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 as published by
21 * the Free Software Foundation, either version 3 of the License, or
24 * Anytun is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 * GNU General Public License for more details.
29 * You should have received a copy of the GNU General Public License
30 * along with Anytun. If not, see <http://www.gnu.org/licenses/>.
32 * In addition, as a special exception, the copyright holders give
33 * permission to link the code of portions of this program with the
34 * OpenSSL library under certain conditions as described in each
35 * individual source file, and distribute linked combinations
37 * You must obey the GNU General Public License in all respects
38 * for all of the code used other than OpenSSL. If you modify
39 * file(s) with this exception, you may extend this exception to your
40 * version of the file(s), but you are not obligated to do so. If you
41 * do not wish to do so, delete this exception statement from your
42 * version. If you delete this exception statement from all source
43 * files in the program, then also delete it here.
49 #include "../threadUtils.hpp"
53 typedef struct OptionConnectTo {
58 typedef std::list<OptionConnectTo> ConnectToList;
63 Host(std::string addr, std::string port) : addr_(addr), port_(port) {}
64 Host(std::string addr_port) {
65 splitAndSetAddrPort(addr_port);
67 std::string toString() const {
68 std::ostringstream oss;
69 oss << addr_ << ":" << port_;
77 void splitAndSetAddrPort(std::string addr_port);
80 typedef std::list<Host> HostList;
85 static Options& instance();
87 bool parse(int argc, char* argv[]);
91 std::string getProgname();
95 std::string getUsername();
96 std::string getChrootDir();
97 std::string getPidFile();
99 Host getControlInterface();
100 std::string getLocalAddr();
101 Options& setLocalAddr(std::string l);
102 std::string getLocalSyncAddr();
103 Options& setLocalSyncAddr(std::string l);
104 std::string getLocalSyncPort();
105 Options& setLocalSyncPort(std::string l);
106 uint16_t getRtpStartPort();
107 Options& setRtpStartPort(uint16_t l);
108 uint16_t getRtpEndPort();
109 Options& setRtpEndPort(uint16_t l);
110 ConnectToList getConnectTo();
115 Options(const Options& l);
116 void operator=(const Options& l);
119 static Options* inst;
120 static ::Mutex instMutex;
121 class instanceCleaner
125 if(Options::inst != 0) {
126 delete Options::inst;
130 friend class instanceCleaner;
134 std::string progname_;
138 std::string username_;
139 std::string chroot_dir_;
140 std::string pid_file_;
142 std::string local_sync_addr_;
143 std::string local_sync_port_;
144 std::string local_addr_;
145 uint16_t rtp_start_port_;
146 uint16_t rtp_end_port_;
147 ConnectToList connect_to_;
148 Host control_interface_;
151 extern Options& gOpt;