summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--options.cpp30
-rw-r--r--options.h6
2 files changed, 35 insertions, 1 deletions
diff --git a/options.cpp b/options.cpp
index b28100b..bb19576 100644
--- a/options.cpp
+++ b/options.cpp
@@ -77,6 +77,7 @@ Options::Options()
sender_id_ = 0;
local_addr_ = "";
local_port_ = 4444;
+ local_sync_port_ = 0;
remote_addr_ = "";
remote_port_ = 4444;
dev_name_ = "tap";
@@ -105,6 +106,7 @@ bool Options::parse(int argc, char* argv[])
PARSE_SCALAR_PARAM("-s","--sender-id", sender_id_)
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-host", remote_addr_)
PARSE_SCALAR_PARAM("-o","--remote-port", remote_port_)
PARSE_SCALAR_PARAM("-d","--dev", dev_name_)
@@ -126,7 +128,8 @@ void Options::printUsage()
// std::cout << " [-f|--config] <file> the config file" << std::endl;
std::cout << " [-s|--sender-id ] <sender id> the sender id to use" << std::endl;
std::cout << " [-i|--interface] <interface> local interface to bind to" << std::endl;
- std::cout << " [-p|--port] <port> local port to bind to" << std::endl;
+ std::cout << " [-p|--port] <port> local anycast port to bind to" << std::endl;
+ std::cout << " [-S|--sync-port] <port> local unicast/sync port to bind to" << std::endl;
std::cout << " [-r|--remote-host] <hostname/ip> remote host" << std::endl;
std::cout << " [-o|--remote-port] <port> remote port" << std::endl;
std::cout << " [-d|--dev] <name> device name" << std::endl;
@@ -145,6 +148,7 @@ void Options::printOptions()
std::cout << "sender_id='" << sender_id_ << "'" << std::endl;
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_addr='" << remote_addr_ << "'" << std::endl;
std::cout << "remote_port='" << remote_port_ << "'" << std::endl;
std::cout << "dev_name='" << dev_name_ << "'" << std::endl;
@@ -193,6 +197,19 @@ Options& Options::setLocalAddr(std::string l)
return *this;
}
+std::string Options::getLocalSyncAddr()
+{
+ Lock lock(mutex);
+ return local_sync_addr_;
+}
+
+Options& Options::setLocalSyncAddr(std::string l)
+{
+ Lock lock(mutex);
+ local_sync_addr_ = l;
+ return *this;
+}
+
u_int16_t Options::getLocalPort()
{
return local_port_;
@@ -204,6 +221,17 @@ Options& Options::setLocalPort(u_int16_t l)
return *this;
}
+u_int16_t Options::getLocalSyncPort()
+{
+ return local_sync_port_;
+}
+
+Options& Options::setLocalSyncPort(u_int16_t l)
+{
+ local_sync_port_ = l;
+ return *this;
+}
+
std::string Options::getRemoteAddr()
{
Lock lock(mutex);
diff --git a/options.h b/options.h
index fe4b243..08c299a 100644
--- a/options.h
+++ b/options.h
@@ -48,10 +48,14 @@ public:
Options& setSenderId(sender_id_t s);
std::string getLocalAddr();
Options& setLocalAddr(std::string l);
+ std::string getLocalSyncAddr();
+ Options& setLocalSyncAddr(std::string l);
u_int16_t getLocalPort();
Options& setLocalPort(u_int16_t l);
std::string getRemoteAddr();
Options& setRemoteAddr(std::string r);
+ u_int16_t getLocalSyncPort();
+ Options& setLocalSyncPort(u_int16_t l);
u_int16_t getRemotePort();
Options& setRemotePort(u_int16_t r);
Options& setRemoteAddrPort(std::string addr, u_int16_t port);
@@ -76,7 +80,9 @@ private:
std::string progname_;
sender_id_t sender_id_;
std::string local_addr_;
+ std::string local_sync_addr_;
u_int16_t local_port_;
+ u_int16_t local_sync_port_;
std::string remote_addr_;
u_int16_t remote_port_;
std::string dev_name_;