[gupnp-tools] av-cp: Add --interface option



commit 95e430fc63396c4e73f01a7b9bce9c1a4f3ccb81
Author: Jens Georg <mail jensge org>
Date:   Sun Oct 20 12:53:05 2013 +0200

    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.

 configure.ac     |    2 +-
 src/av-cp/main.c |   13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index f0beac8..8edf923 100644
--- a/configure.ac
+++ b/configure.ac
@@ -25,7 +25,7 @@ LT_INIT([])
 
 GLIB_REQUIRED=2.24
 GSSDP_REQUIRED=0.13.3
-GUPNP_REQUIRED=0.18.0
+GUPNP_REQUIRED=0.20.8
 SOUP_REQUIRED=2.4
 GUPNP_AV_REQUIRED=0.5.5
 GTK_REQUIRED=3.0.0
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),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]