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 "../threadUtils.hpp"
39 typedef struct OptionConnectTo
45 typedef std::list<OptionConnectTo> ConnectToList;
50 Host(std::string addr, std::string port) : addr_(addr), port_(port) {}
51 Host(std::string addr_port) {
52 splitAndSetAddrPort(addr_port);
54 std::string toString() const
56 std::ostringstream oss;
57 oss << addr_ << ":" << port_;
65 void splitAndSetAddrPort(std::string addr_port);
68 typedef std::list<Host> HostList;
73 static Options& instance();
75 bool parse(int argc, char* argv[]);
79 std::string getProgname();
83 std::string getUsername();
84 std::string getChrootDir();
85 std::string getPidFile();
87 Host getControlInterface();
88 std::string getLocalAddr();
89 Options& setLocalAddr(std::string l);
90 std::string getLocalSyncAddr();
91 Options& setLocalSyncAddr(std::string l);
92 std::string getLocalSyncPort();
93 Options& setLocalSyncPort(std::string l);
94 u_int16_t getRtpStartPort();
95 Options& setRtpStartPort(u_int16_t l);
96 u_int16_t getRtpEndPort();
97 Options& setRtpEndPort(u_int16_t l);
98 ConnectToList getConnectTo();
103 Options(const Options &l);
104 void operator=(const Options &l);
107 static Options* inst;
108 static ::Mutex instMutex;
109 class instanceCleaner {
110 public: ~instanceCleaner() {
111 if(Options::inst != 0)
112 delete Options::inst;
115 friend class instanceCleaner;
119 std::string progname_;
123 std::string username_;
124 std::string chroot_dir_;
125 std::string pid_file_;
127 std::string local_sync_addr_;
128 std::string local_sync_port_;
129 std::string local_addr_;
130 u_int16_t rtp_start_port_;
131 u_int16_t rtp_end_port_;
132 ConnectToList connect_to_;
133 Host control_interface_;
136 extern Options& gOpt;