summaryrefslogtreecommitdiff
path: root/options.cpp
diff options
context:
space:
mode:
authorOthmar Gsenger <otti@anytun.org>2007-12-23 18:15:44 +0000
committerOthmar Gsenger <otti@anytun.org>2007-12-23 18:15:44 +0000
commit547d50940fb66aae0a9d702913f3b02096a3304e (patch)
treea5a659e31967b82c218f33367a8f531494dc04e0 /options.cpp
parentparser now understands lists (diff)
mesh syncing works now
Diffstat (limited to 'options.cpp')
-rw-r--r--options.cpp37
1 files changed, 22 insertions, 15 deletions
diff --git a/options.cpp b/options.cpp
index bc72f91..0bf39db 100644
--- a/options.cpp
+++ b/options.cpp
@@ -76,11 +76,13 @@
{ \
if(argc < 1 || argv[i+1][0] == '-') \
return false; \
- std::stringstream tmp; \
- tmp << argv[i+1]; \
- std::string tmp_line; \
- getline(tmp,tmp_line,','); \
- LIST.push(tmp_line); \
+ std::stringstream tmp(argv[i+1]); \
+ while (tmp.good()) \
+ { \
+ std::string tmp_line; \
+ getline(tmp,tmp_line,','); \
+ LIST.push(tmp_line); \
+ } \
argc--; \
i++; \
}
@@ -140,13 +142,13 @@ bool Options::parse(int argc, char* argv[])
while(!host_port_queue.empty())
{
std::stringstream tmp_stream(host_port_queue.front());
- std::string host;
- u_int16_t port;
- getline(tmp_stream,host,':');
+ OptionConnectTo oct;
+ getline(tmp_stream,oct.host,':');
if(!tmp_stream.good())
return false;
- tmp_stream >> port;
+ tmp_stream >> oct.port;
host_port_queue.pop();
+ connect_to_.push_back(oct);
}
return true;
}
@@ -158,10 +160,10 @@ 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 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-sync-host] <hostname|ip> remote unicast/sync host" << std::endl;
- std::cout << " [-O|--remote-sync-port] <port> remote unicast/sync port to bind to" << std::endl;
+ std::cout << " [-p|--port] <port> local anycast(data) port to bind to" << std::endl;
+ std::cout << " [-S|--sync-port] <port> local unicast(sync) port to bind to" << std::endl;
+ std::cout << " [-M|--sync-hosts] <hostname|ip>:<port>[,<hostname|ip>:<port>[...]]"<< std::endl;
+ std::cout << " remote hosts to sync with" << 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;
@@ -181,8 +183,6 @@ 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;
@@ -200,6 +200,7 @@ std::string Options::getProgname()
return progname_;
}
+
Options& Options::setProgname(std::string p)
{
Lock lock(mutex);
@@ -207,6 +208,12 @@ Options& Options::setProgname(std::string p)
return *this;
}
+ConnectToList Options::getConnectTo()
+{
+ Lock lock(mutex);
+ return connect_to_;
+}
+
sender_id_t Options::getSenderId()
{
return sender_id_;