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 {
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 {
55 std::ostringstream oss;
56 oss << addr_ << ":" << port_;
64 void splitAndSetAddrPort(std::string addr_port);
67 typedef std::list<Host> HostList;
72 static Options& instance();
74 bool parse(int argc, char* argv[]);
78 std::string getProgname();
82 std::string getUsername();
83 std::string getChrootDir();
84 std::string getPidFile();
86 Host getControlInterface();
87 std::string getLocalAddr();
88 Options& setLocalAddr(std::string l);
89 std::string getLocalSyncAddr();
90 Options& setLocalSyncAddr(std::string l);
91 std::string getLocalSyncPort();
92 Options& setLocalSyncPort(std::string l);
93 uint16_t getRtpStartPort();
94 Options& setRtpStartPort(uint16_t l);
95 uint16_t getRtpEndPort();
96 Options& setRtpEndPort(uint16_t l);
97 ConnectToList getConnectTo();
102 Options(const Options& l);
103 void operator=(const Options& l);
106 static Options* inst;
107 static ::Mutex instMutex;
108 class instanceCleaner
112 if(Options::inst != 0) {
113 delete Options::inst;
117 friend class instanceCleaner;
121 std::string progname_;
125 std::string username_;
126 std::string chroot_dir_;
127 std::string pid_file_;
129 std::string local_sync_addr_;
130 std::string local_sync_port_;
131 std::string local_addr_;
132 uint16_t rtp_start_port_;
133 uint16_t rtp_end_port_;
134 ConnectToList connect_to_;
135 Host control_interface_;
138 extern Options& gOpt;