summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormethodus <methodus@web.de>2012-12-27 18:19:31 +0100
committermethodus <methodus@web.de>2012-12-27 18:19:31 +0100
commita5eab8042453dbbf5cd24fa2c2b4c605a18eede8 (patch)
treec084a19e2e5a059294b5069389b2179308ef42c6
parent3031c7d7b83c50c69dcab6d55a41eae65d5cf20a (diff)
downloadvdr-plugin-upnp-a5eab8042453dbbf5cd24fa2c2b4c605a18eede8.tar.gz
vdr-plugin-upnp-a5eab8042453dbbf5cd24fa2c2b4c605a18eede8.tar.bz2
Added command line options for IP address, interace and port.
-rw-r--r--upnp.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/upnp.cpp b/upnp.cpp
index 9784969..06e23d2 100644
--- a/upnp.cpp
+++ b/upnp.cpp
@@ -34,13 +34,24 @@ const char *cPluginUpnp::CommandLineHelp(void)
" \n"
" -d <DB directory> --db-dir=<DB directory> Specifies the directory\n"
" where the the database\n"
- " file shall be located.\n");
+ " file shall be located.\n"
+ " -a <IP address> --address=<IP address> Binds the server to the\n"
+ " specific IP address.\n"
+ " -i <Interface> --interface=<Interface> Binds the server to the\n"
+ " specific network\n"
+ " interface.\n"
+ " -p <Port> --port=<Port> Sets the port where the\n"
+ " UPnP server shall listen\n"
+ " on.");
}
bool cPluginUpnp::ProcessArgs(int argc, char *argv[])
{
static struct option long_options[] = {
{"db-dir", required_argument, NULL, 'd'},
+ {"port", required_argument, NULL, 'p'},
+ {"address", required_argument, NULL, 'a'},
+ {"interface",required_argument, NULL, 'i'},
{0, 0, 0, 0}
};
@@ -48,11 +59,22 @@ bool cPluginUpnp::ProcessArgs(int argc, char *argv[])
upnp::cConfig config = mMediaServer->GetConfiguration();
int c = 0; int index = -1;
- while((c = getopt_long(argc, argv, "d:",long_options, &index)) != -1){
+ while((c = getopt_long(argc, argv, "d:p:a:i:",long_options, &index)) != -1){
switch(c){
case 'd':
if(!cMenuSetupUPnP::SetupParse("databaseDir", optarg, config)) return false;
break;
+ case 'p':
+ if(!cMenuSetupUPnP::SetupParse("port", optarg, config)) return false;
+ break;
+ case 'a':
+ if(!cMenuSetupUPnP::SetupParse("address", optarg, config) ||
+ !cMenuSetupUPnP::SetupParse("bindToAddress", "1", config)) return false;
+ break;
+ case 'i':
+ if(!cMenuSetupUPnP::SetupParse("interface", optarg, config) ||
+ !cMenuSetupUPnP::SetupParse("bindToAddress", "0", config)) return false;
+ break;
default:
return false;
}