diff options
author | Jens Georg <mail@jensge.org> | 2013-10-20 12:53:05 +0200 |
---|---|---|
committer | Jens Georg <mail@jensge.org> | 2013-10-20 12:59:31 +0200 |
commit | 95e430fc63396c4e73f01a7b9bce9c1a4f3ccb81 (patch) | |
tree | 36e2086d57dbb95d1a0a3b0ca75432b47a235518 /src | |
parent | f9e0333da773d0afbec2f8e7b412f57d2830ef8c (diff) | |
download | gupnp-tools-95e430fc63396c4e73f01a7b9bce9c1a4f3ccb81.tar.gz |
av-cp: Add --interface option
--interface allows a dedicated interface to use to be set. --interface can be
used multiple times to specify a list of network interfaces.
Diffstat (limited to 'src')
-rw-r--r-- | src/av-cp/main.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/av-cp/main.c b/src/av-cp/main.c index 07d24dc..73449ad 100644 --- a/src/av-cp/main.c +++ b/src/av-cp/main.c @@ -1,7 +1,9 @@ /* * Copyright (C) 2007 Zeeshan Ali (Khattak) <zeeshanak@gnome.org> + * Copyright (C) 2013 Jens Georg <mail@jensge.org> * * Authors: Zeeshan Ali (Khattak) <zeeshanak@gnome.org> + * Jens Georg <mail@jensge.org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -38,10 +40,12 @@ #define MEDIA_SERVER "urn:schemas-upnp-org:device:MediaServer:1" static int upnp_port = 0; +static char **interfaces = NULL; static GOptionEntry entries[] = { { "port", 'p', 0, G_OPTION_ARG_INT, &upnp_port, N_("Network PORT to use for UPnP"), "PORT" }, + { "interface", 'i', 0, G_OPTION_ARG_STRING_ARRAY, &interfaces, N_("Network interfaces to use for UPnP communication"), "INTERFACE" }, { NULL } }; @@ -137,6 +141,8 @@ on_context_available (GUPnPContextManager *context_manager, static gboolean init_upnp (int port) { + GUPnPWhiteList *white_list; + #if !GLIB_CHECK_VERSION(2, 35, 0) g_type_init (); #endif @@ -144,6 +150,13 @@ init_upnp (int port) context_manager = gupnp_context_manager_create (port); g_assert (context_manager != NULL); + if (interfaces != NULL) { + white_list = gupnp_context_manager_get_white_list + (context_manager); + gupnp_white_list_add_entryv (white_list, interfaces); + gupnp_white_list_set_enabled (white_list, TRUE); + } + g_signal_connect (context_manager, "context-available", G_CALLBACK (on_context_available), |