diff options
-rw-r--r-- | anyrtpproxy/options.cpp | 34 | ||||
-rw-r--r-- | anyrtpproxy/options.h | 4 |
2 files changed, 30 insertions, 8 deletions
diff --git a/anyrtpproxy/options.cpp b/anyrtpproxy/options.cpp index ecd7556..b955e8b 100644 --- a/anyrtpproxy/options.cpp +++ b/anyrtpproxy/options.cpp @@ -60,6 +60,8 @@ Options::Options() : control_interface_("0.0.0.0", 22222) local_sync_port_ = 2023; rtp_start_port_ = 34000; rtp_end_port_ = 35000; + no_nat_once_ = false; + nat_ = false; } Options::~Options() @@ -152,6 +154,8 @@ bool Options::parse(int argc, char* argv[]) if(str == "-h" || str == "--help") return false; PARSE_BOOL_PARAM("-t","--chroot", chroot_) + PARSE_BOOL_PARAM("-n","--nat", nat_) + PARSE_BOOL_PARAM("-o","--no-nat-once", no_nat_once_) PARSE_SCALAR_PARAM("-u","--user", username_) PARSE_SCALAR_PARAM("-c","--chroot-dir", chroot_dir_) PARSE_INVERSE_BOOL_PARAM("-d","--nodaemonize", daemonize_) @@ -172,14 +176,16 @@ bool Options::sanityCheck() void Options::printUsage() { - std::cout << "USAGE:" << std::endl; - std::cout << "anyrtpproxy [-h|--help] prints this..." << std::endl; - std::cout << " [-t|--chroot] chroot and drop priviledges" << std::endl; - std::cout << " [-u|--username] <username> in case of chroot run as this user" << std::endl; - std::cout << " [-c|--chroot-dir] <directory> directory to make a chroot to" << std::endl; - std::cout << " [-d|--nodaemonize] don't run in background" << std::endl; - std::cout << " [-s|--control] <addr[:port]> the address/port to listen on for control commands" << std::endl; - std::cout << " [-p|--port-range] <start port> <end port> port range used to relay rtp connections" << std::endl; + std::cout << "USAGE: anyrtpproxy" << std::endl; + std::cout << " [-h|--help] prints this..." << std::endl; + std::cout << " [-t|--chroot] chroot and drop priviledges" << std::endl; + std::cout << " [-u|--username] <username> in case of chroot run as this user" << std::endl; + std::cout << " [-c|--chroot-dir] <directory> directory to make a chroot to" << std::endl; + std::cout << " [-d|--nodaemonize] don't run in background" << std::endl; + std::cout << " [-s|--control] <addr[:port]> the address/port to listen on for control commands" << std::endl; + std::cout << " [-p|--port-range] <start> <end> port range used to relay rtp connections" << std::endl; + std::cout << " [-n|--nat] enable permantent automatic nat detection(use only with anytun)" << std::endl; + std::cout << " [-o|--no-nat-once] disable automatic nat detection for new connections" << std::endl; } void Options::printOptions() @@ -205,6 +211,18 @@ bool Options::getChroot() return chroot_; } +bool Options::getNat() +{ + Lock lock(mutex); + return nat_; +} + +bool Options::getNoNatOnce() +{ + Lock lock(mutex); + return no_nat_once_; +} + std::string Options::getUsername() { Lock lock(mutex); diff --git a/anyrtpproxy/options.h b/anyrtpproxy/options.h index 55f3264..b6ac957 100644 --- a/anyrtpproxy/options.h +++ b/anyrtpproxy/options.h @@ -77,6 +77,8 @@ public: std::string getProgname(); bool getChroot(); + bool getNat(); + bool getNoNatOnce(); std::string getUsername(); std::string getChrootDir(); bool getDaemonize(); @@ -110,6 +112,8 @@ private: std::string progname_; bool chroot_; + bool nat_; + bool no_nat_once_; std::string username_; std::string chroot_dir_; bool daemonize_; |