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 anytun.org <satp@wirdorange.org>
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License version 2
18 * as published by the Free Software Foundation.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program (see the file COPYING included with this
27 * distribution); if not, write to the Free Software Foundation, Inc.,
28 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
38 Options
* Options::inst
= NULL
;
39 Mutex
Options::instMutex
;
40 Options
& gOpt
= Options::instance();
42 Options
& Options::instance()
45 static instanceCleaner c
;
54 progname_
= "anyrtpproxy";
61 #define PARSE_BOOL_PARAM(SHORT, LONG, VALUE) \
62 else if(str == SHORT || str == LONG) \
65 #define PARSE_INVERSE_BOOL_PARAM(SHORT, LONG, VALUE) \
66 else if(str == SHORT || str == LONG) \
69 #define PARSE_SCALAR_PARAM(SHORT, LONG, VALUE) \
70 else if(str == SHORT || str == LONG) \
72 if(argc < 1 || argv[i+1][0] == '-') \
74 std::stringstream tmp; \
81 #define PARSE_SCALAR_PARAM2(SHORT, LONG, VALUE1, VALUE2) \
82 else if(str == SHORT || str == LONG) \
85 argv[i+1][0] == '-' || argv[i+2][0] == '-') \
87 std::stringstream tmp; \
88 tmp << argv[i+1] << " " << argv[i+2]; \
95 #define PARSE_HEXSTRING_PARAM(SHORT, LONG, VALUE) \
96 else if(str == SHORT || str == LONG) \
98 if(argc < 1 || argv[i+1][0] == '-') \
100 VALUE = Buffer(std::string(argv[i+1])); \
105 #define PARSE_CSLIST_PARAM(SHORT, LONG, LIST) \
106 else if(str == SHORT || str == LONG) \
108 if(argc < 1 || argv[i+1][0] == '-') \
110 std::stringstream tmp(argv[i+1]); \
113 std::string tmp_line; \
114 getline(tmp,tmp_line,','); \
115 LIST.push(tmp_line); \
121 bool Options::parse(int argc
, char* argv
[])
127 for(int i
=1; argc
> 0; ++i
)
129 std::string
str(argv
[i
]);
132 if(str
== "-h" || str
== "--help")
140 void Options::printUsage()
142 std::cout
<< "USAGE:" << std::endl
;
143 std::cout
<< "anyrtpproxy [-h|--help] prints this..." << std::endl
;
144 // std::cout << " [-K|--key] <master key> master key to use for encryption" << std::endl;
147 void Options::printOptions()
150 std::cout
<< "Options:" << std::endl
;
153 std::string
Options::getProgname()
160 Options
& Options::setProgname(std::string p
)