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-2009 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/>.
36 #include "../threadUtils.hpp"
40 typedef struct OptionConnectTo
46 typedef std::list<OptionConnectTo> ConnectToList;
51 Host(std::string addr, std::string port) : addr_(addr), port_(port) {}
52 Host(std::string addr_port) {
53 splitAndSetAddrPort(addr_port);
55 std::string toString() const
57 std::ostringstream oss;
58 oss << addr_ << ":" << port_;
66 void splitAndSetAddrPort(std::string addr_port);
69 typedef std::list<Host> HostList;
74 static Options& instance();
76 bool parse(int argc, char* argv[]);
80 std::string getProgname();
84 std::string getUsername();
85 std::string getChrootDir();
86 std::string getPidFile();
88 Host getControlInterface();
89 std::string getLocalAddr();
90 Options& setLocalAddr(std::string l);
91 std::string getLocalSyncAddr();
92 Options& setLocalSyncAddr(std::string l);
93 std::string getLocalSyncPort();
94 Options& setLocalSyncPort(std::string l);
95 u_int16_t getRtpStartPort();
96 Options& setRtpStartPort(u_int16_t l);
97 u_int16_t getRtpEndPort();
98 Options& setRtpEndPort(u_int16_t l);
99 ConnectToList getConnectTo();
104 Options(const Options &l);
105 void operator=(const Options &l);
108 static Options* inst;
109 static ::Mutex instMutex;
110 class instanceCleaner {
111 public: ~instanceCleaner() {
112 if(Options::inst != 0)
113 delete Options::inst;
116 friend class instanceCleaner;
120 std::string progname_;
124 std::string username_;
125 std::string chroot_dir_;
126 std::string pid_file_;
128 std::string local_sync_addr_;
129 std::string local_sync_port_;
130 std::string local_addr_;
131 u_int16_t rtp_start_port_;
132 u_int16_t rtp_end_port_;
133 ConnectToList connect_to_;
134 Host control_interface_;
137 extern Options& gOpt;