From e706bdc57f6f74f712709d0375e1524af6602f13 Mon Sep 17 00:00:00 2001 From: Othmar Gsenger Date: Wed, 12 Dec 2007 15:19:27 +0000 Subject: added syncConnector Thread --- options.cpp | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) (limited to 'options.cpp') diff --git a/options.cpp b/options.cpp index bb19576..4bdefd0 100644 --- a/options.cpp +++ b/options.cpp @@ -78,6 +78,8 @@ Options::Options() local_addr_ = ""; local_port_ = 4444; local_sync_port_ = 0; + remote_sync_port_ = 0; + remote_sync_addr_ = ""; remote_addr_ = ""; remote_port_ = 4444; dev_name_ = "tap"; @@ -107,6 +109,8 @@ bool Options::parse(int argc, char* argv[]) PARSE_SCALAR_PARAM("-i","--interface", local_addr_) PARSE_SCALAR_PARAM("-p","--port", local_port_) PARSE_SCALAR_PARAM("-S","--sync-port", local_sync_port_) + PARSE_SCALAR_PARAM("-R","--remote-sync-host", remote_sync_addr_) + PARSE_SCALAR_PARAM("-O","--remote-sync-port", remote_sync_port_) PARSE_SCALAR_PARAM("-r","--remote-host", remote_addr_) PARSE_SCALAR_PARAM("-o","--remote-port", remote_port_) PARSE_SCALAR_PARAM("-d","--dev", dev_name_) @@ -130,10 +134,12 @@ void Options::printUsage() std::cout << " [-i|--interface] local interface to bind to" << std::endl; std::cout << " [-p|--port] local anycast port to bind to" << std::endl; std::cout << " [-S|--sync-port] local unicast/sync port to bind to" << std::endl; - std::cout << " [-r|--remote-host] remote host" << std::endl; + std::cout << " [-R|--remote-sync-host] remote unicast/sync host" << std::endl; + std::cout << " [-O|--remote-sync-port] remote unicast/sync port to bind to" << std::endl; + std::cout << " [-r|--remote-host] remote host" << std::endl; std::cout << " [-o|--remote-port] remote port" << std::endl; std::cout << " [-d|--dev] device name" << std::endl; - std::cout << " [-t|--type] device type" << std::endl; + std::cout << " [-t|--type] device type" << std::endl; std::cout << " [-n|--ifconfig] the local address for the tun/tap device" << std::endl << " the remote address(tun) or netmask(tap)" << std::endl; std::cout << " [-w|--window-size] seqence number window size" << std::endl; @@ -149,6 +155,8 @@ void Options::printOptions() std::cout << "local_addr='" << local_addr_ << "'" << std::endl; std::cout << "local_port='" << local_port_ << "'" << std::endl; std::cout << "local_sync_port='" << local_sync_port_ << "'" << std::endl; + std::cout << "remote_sync_port='" << remote_sync_port_ << "'" << std::endl; + std::cout << "remote_sync_addr='" << remote_sync_addr_ << "'" << std::endl; std::cout << "remote_addr='" << remote_addr_ << "'" << std::endl; std::cout << "remote_port='" << remote_port_ << "'" << std::endl; std::cout << "dev_name='" << dev_name_ << "'" << std::endl; @@ -232,6 +240,30 @@ Options& Options::setLocalSyncPort(u_int16_t l) return *this; } +u_int16_t Options::getRemoteSyncPort() +{ + return remote_sync_port_; +} + +Options& Options::setRemoteSyncPort(u_int16_t l) +{ + remote_sync_port_ = l; + return *this; +} + +std::string Options::getRemoteSyncAddr() +{ + Lock lock(mutex); + return remote_sync_addr_; +} + +Options& Options::setRemoteSyncAddr(std::string r) +{ + Lock lock(mutex); + remote_sync_addr_ = r; + return *this; +} + std::string Options::getRemoteAddr() { Lock lock(mutex); -- cgit v1.2.3