-Get a GList of strings that represent the device capabilities as announced
+Get a GList of strings that represent the device capabilities as announced
in the device description file using the <dlna:X_DLNACAP> element.
+Get a GList of strings that represent the device class and version as
+announced in the device description file using the <dlna:X_DLNADOC>
+element.
+
a GList of newly allocated strings or
+NULL if the device description doesn't contain the <dlna:X_DLNADOC>
+element. [transfer full][element-type utf8]
+
Tuples of variable name, variable type, and variable value,
+terminated with NULL.
+
+
@@ -647,7 +668,7 @@ Sends out any pending notifications, and stops queuing of new ones.
A convenience function that attempts to connect all possible
"action-invoked" and "query-variable" signals to
appropriate callbacks for the service service. It uses service introspection
-and GModule's introspective features. It is very simillar to
+and GModule's introspective features. It is very simillar to
gtk_builder_connect_signals() except that it attempts to guess the names of
the signal handlers on its own.
@@ -657,19 +678,26 @@ functions for "query-variable" signals, except that "query_" should
be prepended to the variable name. For example, callback function for
-"GetSystemUpdateID" action should be either named as
+GetSystemUpdateID action should be either named as
"get_system_update_id_cb" or "on_get_system_update_id" and callback function
for the query of "SystemUpdateID" state variable should be named
-"query_system_update_id_cb" or "on_query_system_update_id".
+query_system_update_id_cb or
+on_query_system_update_id.
-Note that this function will not work correctly if GModule is not supported
-on the platform or introspection is not available for service service.
+
+
Note
This function will not work correctly if GModule is not supported
+on the platform or introspection is not available for service.
-WARNING: This function can not and therefore does not guarantee that the
+
+
+
+
+
Warning
This function can not and therefore does not guarantee that the
resulting signal connections will be correct as it depends heavily on a
-particular naming schemes described above.
+particular naming schemes described above.
+
diff --git a/doc/html/GUPnPServiceProxy.html b/doc/html/GUPnPServiceProxy.html
index 2342b64..9faf882 100644
--- a/doc/html/GUPnPServiceProxy.html
+++ b/doc/html/GUPnPServiceProxy.html
@@ -273,6 +273,13 @@ a UPnPError the error code will be the same in error
+
... :
+
tuples of in parameter name, in parameter type, and in parameter
+value, followed by NULL, and then tuples of out parameter name,
+out parameter type, and out parameter value location, terminated with NULL
+
tuples of out parameter name, out parameter type, and out parameter
+value location, terminated with NULL. The out parameter values should be
+freed after use
@@ -792,9 +811,6 @@ out-parameter names, types and place-holders for values. The returned list
in out_values must be freed using g_list_free and each element in it using
g_value_unset and g_slice_free.
-
+GUPnPWhiteList handles network filtering. It provides API to manage a list
+of entries that will be used to filter networks.
+The GUPnPWhiteList could be enabled or not. If it's enabled but the entries
+list is empty, it behaves as disabled.
+
+
+
+
Details
+
+
struct GUPnPWhiteList
+
struct GUPnPWhiteList;
+
+This struct contains private data only, and should be accessed using the
+functions below.
+
+It will check if the context is allowed or not. The white_list will check
+all its entries againt GUPnPContext interface, host ip and network fields
+information. This function doesn't take into account the white_list status
+(enabled or not).
+
+Remove all entries from GList that compose the white list.
+The list is now empty. Even if GUPnPWhiteList is enabled, it will have the
+same behavior as if it was disabled.
+
a GList of entries
+used to filter networks, interfaces,... or NULL.
+Do not modify or free the list nor its elements. [element-type utf8][transfer none]
+
diff --git a/doc/html/client-tutorial.html b/doc/html/client-tutorial.html
index 507c27f..395ddcd 100644
--- a/doc/html/client-tutorial.html
+++ b/doc/html/client-tutorial.html
@@ -24,7 +24,7 @@
Writing a UPnP Client
-Introduction
+Introduction
This chapter explains how to write an application which fetches the
external IP address from an UPnP-compliant modem. To do this a
@@ -41,7 +41,7 @@
-Finding Services
+Finding Services
First, we initialize GUPnP and create a control point targeting the
service type. Then we connect a signal handler so that we are notified
@@ -104,7 +104,7 @@ main (int argc, char **argv)
-Invoking Actions
+Invoking Actions
Now we have an application which searches for the service we specified and
calls service_proxy_available_cb for each one it
@@ -154,11 +154,11 @@ service_proxy_available_cb (GUPnPControlPoint *cp,
-Subscribing to state variable change notifications
+Subscribing to state variable change notifications
It is possible to get change notifications for the service state variables
that have attribute sendEvents="yes". We'll demonstrate
- this by modifying service_proxy_available_cb() and using
+ this by modifying service_proxy_available_cb and using
gupnp_service_proxy_add_notify() to setup a notification callback:
Using gupnp_service_proxy_send_action() and gupnp_service_proxy_add_notify ()
can become tedious, because of the requirement to specify the types and deal
diff --git a/doc/html/gupnp-Error-codes.html b/doc/html/gupnp-Error-codes.html
index 305f420..e03eb82 100644
--- a/doc/html/gupnp-Error-codes.html
+++ b/doc/html/gupnp-Error-codes.html
@@ -276,7 +276,7 @@ processing of XML data.
gupnp-binding-tool takes a SCPD file and generates convenience C functions
which call the actual GUPnP functions. The client-side bindings can be seen
@@ -49,7 +49,7 @@
Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free
Documentation License, Version 1.1 or any later
@@ -95,6 +95,9 @@
GUPnPContextManager â Manages GUPnPContext objects.
gupnp_xml_doc_new_from_path, gupnp_xml_doc_new_from_path ()
diff --git a/doc/html/server-tutorial.html b/doc/html/server-tutorial.html
index ead9dbe..f1ec040 100644
--- a/doc/html/server-tutorial.html
+++ b/doc/html/server-tutorial.html
@@ -24,7 +24,7 @@
Writing a UPnP Service
-Introduction
+Introduction
This chapter explains how to implement a UPnP service using GUPnP. For
this example we will create a virtual UPnP-enabled light bulb.
@@ -42,7 +42,7 @@
-Defining the Device
+Defining the Device
The first step is to write the device description
file. This is a short XML document which describes the device and what
@@ -118,7 +118,7 @@
-Defining Services
+Defining Services
Because we are using a standard service we can use the service description
from the specification. This is the SwitchPower1
@@ -211,7 +211,7 @@
-Implementing the Device
+Implementing the Device
Before starting to implement the device, some boilerplate code is needed
to initialise GUPnP. GLib types and threading needs to be initialised,
@@ -225,19 +225,15 @@
/* Create the GUPnP context with default host and port */
context = gupnp_context_new (NULL, NULL, 0, NULL);
- UPnP uses HTTP to provide the device and service description files, so
- next we tell GUPnP to publish them. This is done with
- gupnp_context_host_path() which takes a local filename to send when a
- certain server path is requested.
-
- Next the root device can be created.
+ Next the root device can be created. The name of the device description
+ file can be passed as an absolute file path or a relative path to the
+ second parameter of gupnp_root_device_new(). The service description
+ files referenced in the device description are expected to be at the path
+ given there as well.
GUPnPRootDevice *dev;
/* Create the root device object */
-dev = gupnp_root_device_new (context, "/BinaryLight1.xml");
+dev = gupnp_root_device_new (context, "BinaryLight1.xml", ".");
/* Activate the root device, so that it announces itself */
gupnp_root_device_set_available (dev, TRUE);
To implement a service we first fetch the #GUPnPService from the root
device using gupnp_device_info_get_service() (#GUPnPRootDevice is a
@@ -358,7 +354,7 @@ g_signal_connect (service, "query-variable::Status", G_CALLBACK (query_status_cb
-Generating Service-specific Wrappers
+Generating Service-specific Wrappers
Using service-specific wrappers can simplify the implementation of a service.
Wrappers can be generated with gupnp-binding-tool(1)
diff --git a/doc/server-tutorial.xml b/doc/server-tutorial.xml
index 06f1501..8f03295 100644
--- a/doc/server-tutorial.xml
+++ b/doc/server-tutorial.xml
@@ -135,19 +135,15 @@
/* Create the GUPnP context with default host and port */
context = gupnp_context_new (NULL, NULL, 0, NULL);
- UPnP uses HTTP to provide the device and service description files, so
- next we tell GUPnP to publish them. This is done with
- gupnp_context_host_path() which takes a local filename to send when a
- certain server path is requested.
-
-gupnp_context_host_path (context, "BinaryLight1.xml", "/BinaryLight1.xml");
-gupnp_context_host_path (context, "SwitchPower1.xml", "/SwitchPower1.xml");
-
- Next the root device can be created.
+ Next the root device can be created. The name of the device description
+ file can be passed as an absolute file path or a relative path to the
+ second parameter of gupnp_root_device_new(). The service description
+ files referenced in the device description are expected to be at the path
+ given there as well.
GUPnPRootDevice *dev;
/* Create the root device object */
-dev = gupnp_root_device_new (context, "/BinaryLight1.xml");
+dev = gupnp_root_device_new (context, "BinaryLight1.xml", ".");
/* Activate the root device, so that it announces itself */
gupnp_root_device_set_available (dev, TRUE);
diff --git a/doc/tmpl/gupnp-context-manager.sgml b/doc/tmpl/gupnp-context-manager.sgml
deleted file mode 100644
index d04fe2d..0000000
--- a/doc/tmpl/gupnp-context-manager.sgml
+++ /dev/null
@@ -1,110 +0,0 @@
-
-GUPnPContextManager
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-@gupnpcontextmanager: the object which received the signal.
-@arg1:
-
-
-
-
-
-
-@gupnpcontextmanager: the object which received the signal.
-@arg1:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-@main_context:
-@port:
-@Returns:
-
-
-
-
-
-
-
-@port:
-@Returns:
-
-
-
-
-
-
-
-@manager:
-
-
-
-
-
-
-
-@manager:
-@control_point:
-
-
-
-
-
-
-
-@manager:
-@root_device:
-
-
-
-
-
-
-
-@manager:
-@Returns:
-
-
diff --git a/doc/tmpl/gupnp-context.sgml b/doc/tmpl/gupnp-context.sgml
deleted file mode 100644
index 8c04c5b..0000000
--- a/doc/tmpl/gupnp-context.sgml
+++ /dev/null
@@ -1,170 +0,0 @@
-
-GUPnPContext
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-@main_context:
-@iface:
-@port:
-@error:
-@Returns:
-
-
-
-
-
-
-
-@context:
-@Returns:
-
-
-
-
-
-
-
-@context:
-@Returns:
-
-
-
-
-
-
-
-@context:
-@Returns:
-
-
-
-
-
-
-
-@context:
-@Returns:
-
-
-
-
-
-
-
-@context:
-@timeout:
-
-
-
-
-
-
-
-@context:
-@Returns:
-
-
-
-
-
-
-
-@context:
-@Returns:
-
-
-
-
-
-
-
-@context:
-@language:
-
-
-
-
-
-
-
-@context:
-@local_path:
-@server_path:
-
-
-
-
-
-
-
-@context:
-@local_path:
-@server_path:
-@user_agent:
-@Returns:
-
-
-
-
-
-
-
-@context:
-@server_path:
-
-
diff --git a/doc/tmpl/gupnp-control-point.sgml b/doc/tmpl/gupnp-control-point.sgml
deleted file mode 100644
index 6c86558..0000000
--- a/doc/tmpl/gupnp-control-point.sgml
+++ /dev/null
@@ -1,124 +0,0 @@
-
-GUPnPControlPoint
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-@gupnpcontrolpoint: the object which received the signal.
-@arg1:
-
-
-
-
-
-
-@gupnpcontrolpoint: the object which received the signal.
-@arg1:
-
-
-
-
-
-
-@gupnpcontrolpoint: the object which received the signal.
-@arg1:
-
-
-
-
-
-
-@gupnpcontrolpoint: the object which received the signal.
-@arg1:
-
-
-
-
-
-
-
-
-
-
-
-@context:
-@target:
-@Returns:
-
-
-
-
-
-
-
-@context:
-@factory:
-@target:
-@Returns:
-
-
-
-
-
-
-
-@control_point:
-@Returns:
-
-
-
-
-
-
-
-@control_point:
-@Returns:
-
-
-
-
-
-
-
-@control_point:
-@Returns:
-
-
-
-
-
-
-
-@control_point:
-@Returns:
-
-
diff --git a/doc/tmpl/gupnp-device-info.sgml b/doc/tmpl/gupnp-device-info.sgml
deleted file mode 100644
index a56eb24..0000000
--- a/doc/tmpl/gupnp-device-info.sgml
+++ /dev/null
@@ -1,307 +0,0 @@
-
-GUPnPDeviceInfo
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-@device_info:
-@Returns:
-
-
-
-
-
-
-
-@info:
-@Returns:
-
-
-
-
-
-
-
-@info:
-@Returns:
-
-
-
-
-
-
-
-@info:
-@Returns:
-
-
-
-
-
-
-
-@info:
-@Returns:
-
-
-
-
-
-
-
-@info:
-@Returns:
-
-
-
-
-
-
-
-@info:
-@Returns:
-
-
-
-
-
-
-
-@info:
-@Returns:
-
-
-
-
-
-
-
-@info:
-@Returns:
-
-
-
-
-
-
-
-@info:
-@Returns:
-
-
-
-
-
-
-
-@info:
-@Returns:
-
-
-
-
-
-
-
-@info:
-@Returns:
-
-
-
-
-
-
-
-@info:
-@Returns:
-
-
-
-
-
-
-
-@info:
-@Returns:
-
-
-
-
-
-
-
-@info:
-@Returns:
-
-
-
-
-
-
-
-@info:
-@Returns:
-
-
-
-
-
-
-
-@info:
-@requested_mime_type:
-@requested_depth:
-@requested_width:
-@requested_height:
-@prefer_bigger:
-@mime_type:
-@depth:
-@width:
-@height:
-@Returns:
-
-
-
-
-
-
-
-@info:
-@Returns:
-
-
-
-
-
-
-
-@info:
-@element:
-@Returns:
-
-
-
-
-
-
-
-@info:
-@Returns:
-
-
-
-
-
-
-
-@info:
-@Returns:
-
-
-
-
-
-
-
-@info:
-@type:
-@Returns:
-
-
-
-
-
-
-
-@info:
-@Returns:
-
-
-
-
-
-
-
-@info:
-@Returns:
-
-
-
-
-
-
-
-@info:
-@type:
-@Returns:
-
-
diff --git a/doc/tmpl/gupnp-device-proxy.sgml b/doc/tmpl/gupnp-device-proxy.sgml
deleted file mode 100644
index 6f3eb38..0000000
--- a/doc/tmpl/gupnp-device-proxy.sgml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-GUPnPDeviceProxy
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/doc/tmpl/gupnp-device.sgml b/doc/tmpl/gupnp-device.sgml
deleted file mode 100644
index 6ba340b..0000000
--- a/doc/tmpl/gupnp-device.sgml
+++ /dev/null
@@ -1,35 +0,0 @@
-
-GUPnPDevice
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/doc/tmpl/gupnp-error.sgml b/doc/tmpl/gupnp-error.sgml
deleted file mode 100644
index a79f7fa..0000000
--- a/doc/tmpl/gupnp-error.sgml
+++ /dev/null
@@ -1,94 +0,0 @@
-
-Error codes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-@GUPNP_SERVER_ERROR_INTERNAL_SERVER_ERROR:
-@GUPNP_SERVER_ERROR_NOT_FOUND:
-@GUPNP_SERVER_ERROR_NOT_IMPLEMENTED:
-@GUPNP_SERVER_ERROR_INVALID_RESPONSE:
-@GUPNP_SERVER_ERROR_INVALID_URL:
-@GUPNP_SERVER_ERROR_OTHER:
-
-
-
-
-
-
-
-
-
-
-
-
-
-@GUPNP_EVENTING_ERROR_SUBSCRIPTION_FAILED:
-@GUPNP_EVENTING_ERROR_SUBSCRIPTION_LOST:
-@GUPNP_EVENTING_ERROR_NOTIFY_FAILED:
-
-
-
-
-
-
-
-
-
-
-
-
-
-@GUPNP_CONTROL_ERROR_INVALID_ACTION:
-@GUPNP_CONTROL_ERROR_INVALID_ARGS:
-@GUPNP_CONTROL_ERROR_OUT_OF_SYNC:
-@GUPNP_CONTROL_ERROR_ACTION_FAILED:
-
-
-
-
-
-
-
-
-
-
-
-
-
-@GUPNP_XML_ERROR_PARSE:
-@GUPNP_XML_ERROR_NO_NODE:
-@GUPNP_XML_ERROR_EMPTY_NODE:
-@GUPNP_XML_ERROR_INVALID_ATTRIBUTE:
-@GUPNP_XML_ERROR_OTHER:
-
diff --git a/doc/tmpl/gupnp-resource-factory.sgml b/doc/tmpl/gupnp-resource-factory.sgml
deleted file mode 100644
index 8f141bb..0000000
--- a/doc/tmpl/gupnp-resource-factory.sgml
+++ /dev/null
@@ -1,88 +0,0 @@
-
-GUPnPResourceFactory
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-@void:
-@Returns:
-
-
-
-
-
-
-
-@void:
-@Returns:
-
-
-
-
-
-
-
-@factory:
-@upnp_type:
-@type:
-
-
-
-
-
-
-
-@factory:
-@upnp_type:
-@Returns:
-
-
-
-
-
-
-
-@factory:
-@upnp_type:
-@type:
-
-
-
-
-
-
-
-@factory:
-@upnp_type:
-@Returns:
-
-
diff --git a/doc/tmpl/gupnp-root-device.sgml b/doc/tmpl/gupnp-root-device.sgml
deleted file mode 100644
index 4e7894a..0000000
--- a/doc/tmpl/gupnp-root-device.sgml
+++ /dev/null
@@ -1,128 +0,0 @@
-
-GUPnPRootDevice
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-@context:
-@description_path:
-@description_dir:
-@Returns:
-
-
-
-
-
-
-
-@context:
-@factory:
-@description_doc:
-@description_path:
-@description_dir:
-@Returns:
-
-
-
-
-
-
-
-@root_device:
-@available:
-
-
-
-
-
-
-
-@root_device:
-@Returns:
-
-
-
-
-
-
-
-@root_device:
-@Returns:
-
-
-
-
-
-
-
-@root_device:
-@Returns:
-
-
-
-
-
-
-
-@root_device:
-@Returns:
-
-
-
-
-
-
-
-@root_device:
-@Returns:
-
-
diff --git a/doc/tmpl/gupnp-service-info.sgml b/doc/tmpl/gupnp-service-info.sgml
deleted file mode 100644
index 1f8db51..0000000
--- a/doc/tmpl/gupnp-service-info.sgml
+++ /dev/null
@@ -1,177 +0,0 @@
-
-GUPnPServiceInfo
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-@info:
-@introspection:
-@error:
-@user_data:
-
-
-
-
-
-
-
-@info:
-@Returns:
-
-
-
-
-
-
-
-@info:
-@Returns:
-
-
-
-
-
-
-
-@info:
-@Returns:
-
-
-
-
-
-
-
-@info:
-@Returns:
-
-
-
-
-
-
-
-@info:
-@Returns:
-
-
-
-
-
-
-
-@info:
-@Returns:
-
-
-
-
-
-
-
-@info:
-@Returns:
-
-
-
-
-
-
-
-@info:
-@Returns:
-
-
-
-
-
-
-
-@info:
-@Returns:
-
-
-
-
-
-
-
-@info:
-@error:
-@Returns:
-
-
-
-
-
-
-
-@info:
-@callback:
-@user_data:
-
-
diff --git a/doc/tmpl/gupnp-service-introspection.sgml b/doc/tmpl/gupnp-service-introspection.sgml
deleted file mode 100644
index b623e90..0000000
--- a/doc/tmpl/gupnp-service-introspection.sgml
+++ /dev/null
@@ -1,132 +0,0 @@
-
-GUPnPServiceIntrospection
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-@GUPNP_SERVICE_ACTION_ARG_DIRECTION_IN:
-@GUPNP_SERVICE_ACTION_ARG_DIRECTION_OUT:
-
-
-
-
-
-
-@name:
-@direction:
-@related_state_variable:
-@retval:
-
-
-
-
-
-
-@name:
-@arguments:
-
-
-
-
-
-
-@name:
-@send_events:
-@is_numeric:
-@type:
-@default_value:
-@minimum:
-@maximum:
-@step:
-@allowed_values:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-@introspection:
-@Returns:
-
-
-
-
-
-
-
-@introspection:
-@Returns:
-
-
-
-
-
-
-
-@introspection:
-@action_name:
-@Returns:
-
-
-
-
-
-
-
-@introspection:
-@Returns:
-
-
-
-
-
-
-
-@introspection:
-@Returns:
-
-
-
-
-
-
-
-@introspection:
-@variable_name:
-@Returns:
-
-
diff --git a/doc/tmpl/gupnp-service-proxy.sgml b/doc/tmpl/gupnp-service-proxy.sgml
deleted file mode 100644
index 97396bf..0000000
--- a/doc/tmpl/gupnp-service-proxy.sgml
+++ /dev/null
@@ -1,278 +0,0 @@
-
-GUPnPServiceProxy
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-@gupnpserviceproxy: the object which received the signal.
-@arg1:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-@proxy:
-@action:
-@user_data:
-
-
-
-
-
-
-
-@proxy:
-@variable:
-@value:
-@user_data:
-
-
-
-
-
-
-
-@proxy:
-@action:
-@error:
-@...:
-@Returns:
-
-
-
-
-
-
-
-@proxy:
-@action:
-@error:
-@var_args:
-@Returns:
-
-
-
-
-
-
-
-@proxy:
-@action:
-@error:
-@in_hash:
-@out_hash:
-@Returns:
-
-
-
-
-
-
-
-@proxy:
-@action:
-@error:
-@in_names:
-@in_values:
-@out_names:
-@out_types:
-@out_values:
-@Returns:
-
-
-
-
-
-
-
-@proxy:
-@action:
-@callback:
-@user_data:
-@...:
-@Returns:
-
-
-
-
-
-
-
-@proxy:
-@action:
-@callback:
-@user_data:
-@var_args:
-@Returns:
-
-
-
-
-
-
-
-@proxy:
-@action:
-@callback:
-@user_data:
-@hash:
-@Returns:
-
-
-
-
-
-
-
-@proxy:
-@action:
-@in_names:
-@in_values:
-@callback:
-@user_data:
-@Returns:
-
-
-
-
-
-
-
-@proxy:
-@action:
-@error:
-@...:
-@Returns:
-
-
-
-
-
-
-
-@proxy:
-@action:
-@error:
-@var_args:
-@Returns:
-
-
-
-
-
-
-
-@proxy:
-@action:
-@error:
-@hash:
-@Returns:
-
-
-
-
-
-
-
-@proxy:
-@action:
-@error:
-@out_names:
-@out_types:
-@out_values:
-@Returns:
-
-
-
-
-
-
-
-@proxy:
-@action:
-
-
-
-
-
-
-
-@proxy:
-@variable:
-@type:
-@callback:
-@user_data:
-@Returns:
-
-
-
-
-
-
-
-@proxy:
-@variable:
-@callback:
-@user_data:
-@Returns:
-
-
-
-
-
-
-
-@proxy:
-@subscribed:
-
-
-
-
-
-
-
-@proxy:
-@Returns:
-
-
diff --git a/doc/tmpl/gupnp-service.sgml b/doc/tmpl/gupnp-service.sgml
deleted file mode 100644
index a9a1afe..0000000
--- a/doc/tmpl/gupnp-service.sgml
+++ /dev/null
@@ -1,263 +0,0 @@
-
-GUPnPService
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-@gupnpservice: the object which received the signal.
-@arg1:
-
-
-
-
-
-
-@gupnpservice: the object which received the signal.
-@arg1:
-@arg2:
-
-
-
-
-
-
-@gupnpservice: the object which received the signal.
-@arg1:
-@arg2:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-@action:
-@Returns:
-
-
-
-
-
-
-
-@action:
-@Returns:
-
-
-
-
-
-
-
-@action:
-@...:
-
-
-
-
-
-
-
-@action:
-@var_args:
-
-
-
-
-
-
-
-@action:
-@argument:
-@value:
-
-
-
-
-
-
-
-@action:
-@argument:
-@type:
-@Returns:
-
-
-
-
-
-
-
-@action:
-@arg_names:
-@arg_types:
-@Returns:
-
-
-
-
-
-
-
-@action:
-@...:
-
-
-
-
-
-
-
-@action:
-@var_args:
-
-
-
-
-
-
-
-@action:
-@argument:
-@value:
-
-
-
-
-
-
-
-@action:
-@arg_names:
-@arg_values:
-
-
-
-
-
-
-
-@action:
-
-
-
-
-
-
-
-@action:
-@error_code:
-@error_description:
-
-
-
-
-
-
-
-@action:
-@Returns:
-
-
-
-
-
-
-
-@action:
-@Returns:
-
-
-
-
-
-
-
-@service:
-@...:
-
-
-
-
-
-
-
-@service:
-@var_args:
-
-
-
-
-
-
-
-@service:
-@variable:
-@value:
-
-
-
-
-
-
-
-@service:
-
-
-
-
-
-
-
-@service:
-
-
-
-
-
-
-
-@service:
-@user_data:
-@error:
-
-
diff --git a/doc/tmpl/gupnp-types.sgml b/doc/tmpl/gupnp-types.sgml
deleted file mode 100644
index 7117368..0000000
--- a/doc/tmpl/gupnp-types.sgml
+++ /dev/null
@@ -1,87 +0,0 @@
-
-Special UPnP types
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/doc/tmpl/gupnp-unused.sgml b/doc/tmpl/gupnp-unused.sgml
deleted file mode 100644
index e69de29..0000000
diff --git a/doc/tmpl/gupnp-xml-doc.sgml b/doc/tmpl/gupnp-xml-doc.sgml
deleted file mode 100644
index 6947f27..0000000
--- a/doc/tmpl/gupnp-xml-doc.sgml
+++ /dev/null
@@ -1,50 +0,0 @@
-
-GUPnPXMLDoc
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-@doc:
-
-
-
-
-
-
-@xml_doc:
-@Returns:
-
-
-
-
-
-
-
-@path:
-@error:
-@Returns:
-
-
diff --git a/examples/Makefile.in b/examples/Makefile.in
index 87550b9..a397ab9 100644
--- a/examples/Makefile.in
+++ b/examples/Makefile.in
@@ -159,8 +159,6 @@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@
GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@
GTKDOC_MKPDF = @GTKDOC_MKPDF@
GTKDOC_REBASE = @GTKDOC_REBASE@
-GTest_CFLAGS = @GTest_CFLAGS@
-GTest_LIBS = @GTest_LIBS@
HAVE_NETLINK = @HAVE_NETLINK@
HTML_DIR = @HTML_DIR@
INSTALL = @INSTALL@
diff --git a/gtk-doc.make b/gtk-doc.make
index 1f75dfd..9841de4 100644
--- a/gtk-doc.make
+++ b/gtk-doc.make
@@ -33,9 +33,9 @@ EXTRA_DIST = \
$(HTML_IMAGES) \
$(SETUP_FILES)
-DOC_STAMPS=setup-build.stamp scan-build.stamp tmpl-build.stamp sgml-build.stamp \
+DOC_STAMPS=setup-build.stamp scan-build.stamp sgml-build.stamp \
html-build.stamp pdf-build.stamp \
- tmpl.stamp sgml.stamp html.stamp pdf.stamp
+ sgml.stamp html.stamp pdf.stamp
SCANOBJ_FILES = \
$(DOC_MODULE).args \
@@ -84,12 +84,10 @@ setup-build.stamp:
cp -pu $(abs_srcdir)/$$file $(abs_builddir)/ || true; \
done; \
fi; \
- test -d $(abs_srcdir)/tmpl && \
- { cp -rp $(abs_srcdir)/tmpl $(abs_builddir)/; \
- chmod -R u+w $(abs_builddir)/tmpl; } \
fi
@touch setup-build.stamp
+
#### scan ####
scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB)
@@ -120,29 +118,10 @@ scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB)
$(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt: scan-build.stamp
@true
-#### templates ####
-
-tmpl-build.stamp: setup-build.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt
- @echo ' DOC Rebuilding template files'
- @gtkdoc-mktmpl --module=$(DOC_MODULE) $(MKTMPL_OPTIONS)
- @if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
- if test -w $(abs_srcdir) ; then \
- cp -rp $(abs_builddir)/tmpl $(abs_srcdir)/; \
- fi \
- fi
- @touch tmpl-build.stamp
-
-tmpl.stamp: tmpl-build.stamp
- @true
-
-$(srcdir)/tmpl/*.sgml:
- @true
-
#### xml ####
-sgml-build.stamp: tmpl.stamp $(DOC_MODULE)-sections.txt $(srcdir)/tmpl/*.sgml $(expand_content_files)
+sgml-build.stamp: setup-build.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt $(expand_content_files)
@echo ' DOC Building XML'
- @-chmod -R u+w $(srcdir)
@_source_dir='' ; \
for i in $(DOC_SOURCE_DIR) ; do \
_source_dir="$${_source_dir} --source-dir=$$i" ; \
@@ -219,7 +198,6 @@ distclean-local:
$(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
@if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
rm -f $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types; \
- rm -rf tmpl; \
fi
maintainer-clean-local: clean
@@ -267,9 +245,7 @@ dist-check-gtkdoc:
endif
dist-hook: dist-check-gtkdoc dist-hook-local
- @mkdir $(distdir)/tmpl
@mkdir $(distdir)/html
- @-cp ./tmpl/*.sgml $(distdir)/tmpl
@cp ./html/* $(distdir)/html
@-cp ./$(DOC_MODULE).pdf $(distdir)/
@-cp ./$(DOC_MODULE).types $(distdir)/
diff --git a/libgupnp/Makefile.am b/libgupnp/Makefile.am
index 2843d68..6d30acb 100644
--- a/libgupnp/Makefile.am
+++ b/libgupnp/Makefile.am
@@ -58,6 +58,7 @@ libgupnpinc_HEADERS = gupnp-context.h \
gupnp-service-proxy.h \
gupnp-service-introspection.h \
gupnp-xml-doc.h \
+ gupnp-white-list.h \
gupnp-types.h \
gupnp.h
@@ -76,6 +77,7 @@ introspection_sources = $(libgupnpinc_HEADERS) \
gupnp-service-proxy.c \
gupnp-service-introspection.c \
gupnp-xml-doc.c \
+ gupnp-white-list.c \
gupnp-types.c
diff --git a/libgupnp/Makefile.in b/libgupnp/Makefile.in
index 77c26ef..594ae20 100644
--- a/libgupnp/Makefile.in
+++ b/libgupnp/Makefile.in
@@ -118,13 +118,14 @@ am__libgupnp_1_0_la_SOURCES_DIST = gupnp-context.h \
gupnp-device-info.h gupnp-device-proxy.h gupnp-error.h \
gupnp-resource-factory.h gupnp-root-device.h gupnp-service.h \
gupnp-service-info.h gupnp-service-proxy.h \
- gupnp-service-introspection.h gupnp-xml-doc.h gupnp-types.h \
- gupnp.h gupnp-context.c gupnp-context-manager.c \
- gupnp-control-point.c gupnp-device.c gupnp-device-info.c \
- gupnp-device-proxy.c gupnp-error.c gupnp-resource-factory.c \
- gupnp-root-device.c gupnp-service.c gupnp-service-info.c \
- gupnp-service-proxy.c gupnp-service-introspection.c \
- gupnp-xml-doc.c gupnp-types.c http-headers.c http-headers.h \
+ gupnp-service-introspection.h gupnp-xml-doc.h \
+ gupnp-white-list.h gupnp-types.h gupnp.h gupnp-context.c \
+ gupnp-context-manager.c gupnp-control-point.c gupnp-device.c \
+ gupnp-device-info.c gupnp-device-proxy.c gupnp-error.c \
+ gupnp-resource-factory.c gupnp-root-device.c gupnp-service.c \
+ gupnp-service-info.c gupnp-service-proxy.c \
+ gupnp-service-introspection.c gupnp-xml-doc.c \
+ gupnp-white-list.c gupnp-types.c http-headers.c http-headers.h \
gupnp-context-private.h gupnp-unix-context-manager.c \
gupnp-unix-context-manager.h gupnp-network-manager.c \
gupnp-network-manager.h gupnp-connman-manager.c \
@@ -142,7 +143,8 @@ am__objects_2 = $(am__objects_1) gupnp-context.lo \
gupnp-device.lo gupnp-device-info.lo gupnp-device-proxy.lo \
gupnp-error.lo gupnp-resource-factory.lo gupnp-root-device.lo \
gupnp-service.lo gupnp-service-info.lo gupnp-service-proxy.lo \
- gupnp-service-introspection.lo gupnp-xml-doc.lo gupnp-types.lo
+ gupnp-service-introspection.lo gupnp-xml-doc.lo \
+ gupnp-white-list.lo gupnp-types.lo
@OS_WIN32_FALSE@@USE_NETWORK_MANAGER_TRUE@am__objects_3 = gupnp-network-manager.lo
@OS_WIN32_FALSE@@USE_CONNMAN_TRUE@@USE_NETWORK_MANAGER_FALSE@am__objects_4 = gupnp-connman-manager.lo
@HAVE_NETLINK_TRUE@am__objects_5 = gupnp-linux-context-manager.lo
@@ -240,8 +242,6 @@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@
GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@
GTKDOC_MKPDF = @GTKDOC_MKPDF@
GTKDOC_REBASE = @GTKDOC_REBASE@
-GTest_CFLAGS = @GTest_CFLAGS@
-GTest_LIBS = @GTest_LIBS@
HAVE_NETLINK = @HAVE_NETLINK@
HTML_DIR = @HTML_DIR@
INSTALL = @INSTALL@
@@ -388,6 +388,7 @@ libgupnpinc_HEADERS = gupnp-context.h \
gupnp-service-proxy.h \
gupnp-service-introspection.h \
gupnp-xml-doc.h \
+ gupnp-white-list.h \
gupnp-types.h \
gupnp.h
@@ -406,6 +407,7 @@ introspection_sources = $(libgupnpinc_HEADERS) \
gupnp-service-proxy.c \
gupnp-service-introspection.c \
gupnp-xml-doc.c \
+ gupnp-white-list.c \
gupnp-types.c
BUILT_SOURCES = gupnp-marshal.c gupnp-marshal.h
@@ -559,6 +561,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupnp-simple-context-manager.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupnp-types.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupnp-unix-context-manager.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupnp-white-list.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupnp-windows-context-manager.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupnp-xml-doc.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gvalue-util.Plo@am__quote@
diff --git a/libgupnp/gupnp-context-manager.c b/libgupnp/gupnp-context-manager.c
index 4bf3cee..21ce53b 100644
--- a/libgupnp/gupnp-context-manager.c
+++ b/libgupnp/gupnp-context-manager.c
@@ -1,9 +1,11 @@
/*
* Copyright (C) 2009 Nokia Corporation.
* Copyright (C) 2006, 2007, 2008 OpenedHand Ltd.
+ * Copyright (C) 2013 Intel Corporation.
*
* Author: Zeeshan Ali (Khattak)
* Jorn Baayen
+ * Ludovic Ferrandis
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -55,12 +57,16 @@ struct _GUPnPContextManagerPrivate {
GUPnPContextManager *impl;
GList *objects; /* control points and root devices */
+ GList *blacklisted; /* Blacklisted Context */
+
+ GUPnPWhiteList *white_list;
};
enum {
PROP_0,
PROP_MAIN_CONTEXT,
PROP_PORT,
+ PROP_WHITE_LIST
};
enum {
@@ -72,11 +78,40 @@ enum {
static guint signals[SIGNAL_LAST];
static void
+on_context_available (GUPnPContextManager *manager,
+ GUPnPContext *context,
+ G_GNUC_UNUSED gpointer *user_data)
+{
+ GUPnPWhiteList *white_list;
+
+ white_list = manager->priv->white_list;
+
+ /* Try to catch the notification, only if the white list
+ * is enabled, not empty and the context doesn't match */
+ if (!gupnp_white_list_is_empty (white_list) &&
+ gupnp_white_list_get_enabled (white_list) &&
+ !gupnp_white_list_check_context (white_list, context)) {
+ /* If the conext doesn't match, block the notification
+ * and disable the context */
+ g_signal_stop_emission_by_name (manager, "context-available");
+
+ /* Make sure we don't send anything on now blocked network */
+ g_object_set (context, "active", FALSE, NULL);
+
+ /* Save it in case we need to re-enable it */
+ manager->priv->blacklisted = g_list_prepend (
+ manager->priv->blacklisted,
+ g_object_ref (context));
+ }
+}
+
+static void
on_context_unavailable (GUPnPContextManager *manager,
GUPnPContext *context,
G_GNUC_UNUSED gpointer *user_data)
{
GList *l;
+ GList *black;
/* Make sure we don't send anything on now unavailable network */
g_object_set (context, "active", FALSE, NULL);
@@ -113,6 +148,119 @@ on_context_unavailable (GUPnPContextManager *manager,
l = l->next;
}
}
+
+ black = g_list_find (manager->priv->blacklisted, context);
+
+ if (black != NULL) {
+ g_signal_stop_emission_by_name (manager, "context-unavailable");
+
+ g_object_unref (black->data);
+ manager->priv->blacklisted =
+ g_list_delete_link (manager->priv->blacklisted, black);
+ }
+}
+
+static void
+gupnp_context_manager_filter_context (GUPnPWhiteList *white_list,
+ GUPnPContextManager *manager,
+ gboolean check)
+{
+ GList *next;
+ GList *obj;
+ GList *blk;
+ gboolean match;
+ GUPnPContext *context;
+ GSSDPResourceBrowser *browser;
+
+ obj = manager->priv->objects;
+ blk = manager->priv->blacklisted;
+
+ while (obj != NULL) {
+ if (!GUPNP_IS_CONTROL_POINT (obj->data))
+ continue;
+
+ /* If the white list is empty, treat it as disabled */
+ if (check) {
+ /* Filter out context */
+ context = gupnp_control_point_get_context (obj->data);
+ match = gupnp_white_list_check_context (white_list,
+ context);
+ } else {
+ /* Re-activate all context, if needed */
+ match = TRUE;
+ }
+
+ browser = GSSDP_RESOURCE_BROWSER (obj->data);
+ gssdp_resource_browser_set_active (browser, match);
+
+ if (match)
+ (void) gssdp_resource_browser_rescan (browser);
+
+ obj = obj->next;
+ }
+
+ while (blk != NULL) {
+ /* If the white list is empty, treat it as disabled */
+ if (check)
+ /* Filter out context */
+ match = gupnp_white_list_check_context (white_list,
+ blk->data);
+ else
+ /* Re-activate all context, if needed */
+ match = TRUE;
+
+ if (!match) {
+ blk = blk->next;
+ continue;
+ }
+
+ next = blk->next;
+ g_object_set (blk->data, "active", TRUE, NULL);
+
+ g_signal_emit_by_name (manager, "context-available", blk->data);
+
+ g_object_unref (blk->data);
+ manager->priv->blacklisted = g_list_delete_link (
+ manager->priv->blacklisted,
+ blk);
+ blk = next;
+ }
+}
+
+static void
+on_white_list_change_cb (GUPnPWhiteList *white_list,
+ GParamSpec *pspec,
+ gpointer user_data)
+{
+ GUPnPContextManager *manager = GUPNP_CONTEXT_MANAGER (user_data);
+ gboolean enabled;
+ gboolean is_empty;
+
+ enabled = gupnp_white_list_get_enabled (white_list);
+ is_empty = gupnp_white_list_is_empty (white_list);
+
+ if (enabled)
+ gupnp_context_manager_filter_context (white_list,
+ manager,
+ !is_empty);
+}
+
+static void
+on_white_list_enabled_cb (GUPnPWhiteList *white_list,
+ GParamSpec *pspec,
+ gpointer user_data)
+{
+ GUPnPContextManager *manager = GUPNP_CONTEXT_MANAGER (user_data);
+ gboolean enabled;
+ gboolean is_empty;
+
+ enabled = gupnp_white_list_get_enabled (white_list);
+ is_empty = gupnp_white_list_is_empty (white_list);
+
+ if (!is_empty)
+ gupnp_context_manager_filter_context (white_list,
+ manager,
+ enabled);
}
static void
@@ -122,6 +270,14 @@ gupnp_context_manager_init (GUPnPContextManager *manager)
G_TYPE_INSTANCE_GET_PRIVATE (manager,
GUPNP_TYPE_CONTEXT_MANAGER,
GUPnPContextManagerPrivate);
+
+ manager->priv->white_list = gupnp_white_list_new ();
+
+ g_signal_connect_after (manager->priv->white_list, "notify::entries",
+ G_CALLBACK (on_white_list_change_cb), manager);
+
+ g_signal_connect_after (manager->priv->white_list, "notify::enabled",
+ G_CALLBACK (on_white_list_enabled_cb), manager);
}
static void
@@ -174,6 +330,9 @@ gupnp_context_manager_get_property (GObject *object,
g_value_set_pointer (value,
g_main_context_get_thread_default ());
break;
+ case PROP_WHITE_LIST:
+ g_value_set_object (value, manager->priv->white_list);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -184,13 +343,29 @@ static void
gupnp_context_manager_dispose (GObject *object)
{
GUPnPContextManager *manager;
+ GUPnPWhiteList *wl;
GObjectClass *object_class;
manager = GUPNP_CONTEXT_MANAGER (object);
+ wl = manager->priv->white_list;
+
+ g_signal_handlers_disconnect_by_func (wl,
+ on_white_list_enabled_cb,
+ manager);
- g_list_foreach (manager->priv->objects, (GFunc) g_object_unref, NULL);
- g_list_free (manager->priv->objects);
+ g_signal_handlers_disconnect_by_func (wl,
+ on_white_list_change_cb,
+ NULL);
+
+ g_list_free_full (manager->priv->objects, g_object_unref);
manager->priv->objects = NULL;
+ g_list_free_full (manager->priv->blacklisted, g_object_unref);
+ manager->priv->blacklisted = NULL;
+
+ if (wl) {
+ g_object_unref (wl);
+ manager->priv->white_list = NULL;
+ }
/* Call super */
object_class = G_OBJECT_CLASS (gupnp_context_manager_parent_class);
@@ -250,7 +425,24 @@ gupnp_context_manager_class_init (GUPnPContextManagerClass *klass)
G_PARAM_STATIC_NICK |
G_PARAM_STATIC_BLURB));
- /**
+ /**
+ * GUPnPContextManager:white-list:
+ *
+ * The white list to use.
+ **/
+ g_object_class_install_property
+ (object_class,
+ PROP_WHITE_LIST,
+ g_param_spec_object ("white-list",
+ "White List",
+ "The white list to use",
+ GUPNP_TYPE_WHITE_LIST,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_NICK |
+ G_PARAM_STATIC_BLURB));
+
+ /**
* GUPnPContextManager::context-available:
* @context_manager: The #GUPnPContextManager that received the signal
* @context: The now available #GUPnPContext
@@ -259,15 +451,15 @@ gupnp_context_manager_class_init (GUPnPContextManagerClass *klass)
*
**/
signals[CONTEXT_AVAILABLE] =
- g_signal_new ("context-available",
- GUPNP_TYPE_CONTEXT_MANAGER,
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE,
- 1,
- GUPNP_TYPE_CONTEXT);
+ g_signal_new_class_handler ("context-available",
+ GUPNP_TYPE_CONTEXT_MANAGER,
+ G_SIGNAL_RUN_FIRST,
+ G_CALLBACK (on_context_available),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE,
+ 1,
+ GUPNP_TYPE_CONTEXT);
/**
* GUPnPContextManager::context-unavailable:
@@ -467,3 +659,20 @@ gupnp_context_manager_get_port (GUPnPContextManager *manager)
return manager->priv->port;
}
+
+/**
+ * gupnp_context_manager_get_white_list:
+ * @manager: A #GUPnPContextManager
+ *
+ * Get the #GUPnPWhiteList associated with @manager.
+ *
+ * Returns: (transfer none): The #GUPnPWhiteList asssociated with this
+ * context manager.
+ */
+GUPnPWhiteList *
+gupnp_context_manager_get_white_list (GUPnPContextManager *manager)
+{
+ g_return_val_if_fail (GUPNP_IS_CONTEXT_MANAGER (manager), NULL);
+
+ return manager->priv->white_list;
+}
diff --git a/libgupnp/gupnp-context-manager.h b/libgupnp/gupnp-context-manager.h
index 1e04b4c..6124ea9 100644
--- a/libgupnp/gupnp-context-manager.h
+++ b/libgupnp/gupnp-context-manager.h
@@ -26,6 +26,7 @@
#include
#include "gupnp.h"
+#include "gupnp-white-list.h"
G_BEGIN_DECLS
@@ -105,6 +106,10 @@ gupnp_context_manager_manage_root_device
guint
gupnp_context_manager_get_port (GUPnPContextManager *manager);
+
+GUPnPWhiteList *
+gupnp_context_manager_get_white_list (GUPnPContextManager *manager);
+
G_END_DECLS
#endif /* __GUPNP_CONTEXT_MANAGER_H__ */
diff --git a/libgupnp/gupnp-context.c b/libgupnp/gupnp-context.c
index d9a36b0..81c030c 100644
--- a/libgupnp/gupnp-context.c
+++ b/libgupnp/gupnp-context.c
@@ -30,7 +30,7 @@
* GUPnP classes. It automatically starts a web server on demand.
*
* For debugging, it is possible to see the messages being sent and received by
- * exporting %GUPNP_DEBUG.
+ * exporting GUPNP_DEBUG.
*/
#include
@@ -183,7 +183,7 @@ gupnp_context_initable_init (GInitable *initable,
NULL);
user_agent = g_strdup_printf ("%s GUPnP/" VERSION " DLNADOC/1.50",
- g_get_application_name ()? : "");
+ g_get_prgname ()? : "");
g_object_set (context->priv->session,
SOUP_SESSION_USER_AGENT,
user_agent,
@@ -684,7 +684,7 @@ host_path_data_set_language (HostPathData *data, const char *language)
/**
* gupnp_context_set_default_language:
* @context: A #GUPnPContext
- * @language A language tag as defined in RFC 2616 3.10
+ * @language: A language tag as defined in RFC 2616 3.10
*
* Set the default language for the Content-Length header to @language.
*
diff --git a/libgupnp/gupnp-device-info.c b/libgupnp/gupnp-device-info.c
index b18f3ec..9ef38fd 100644
--- a/libgupnp/gupnp-device-info.c
+++ b/libgupnp/gupnp-device-info.c
@@ -85,7 +85,7 @@ gupnp_device_info_set_property (GObject *object,
switch (property_id) {
case PROP_RESOURCE_FACTORY:
- info->priv->factory =
+ info->priv->factory =
GUPNP_RESOURCE_FACTORY (g_value_dup_object (value));
break;
case PROP_CONTEXT:
@@ -474,7 +474,7 @@ gupnp_device_info_get_device_type (GUPnPDeviceInfo *info)
* @info: A #GUPnPDeviceInfo
*
* Get the friendly name of the device.
- *
+ *
* Return value: A string, or %NULL. g_free() after use.
**/
char *
@@ -577,7 +577,7 @@ gupnp_device_info_get_model_number (GUPnPDeviceInfo *info)
* @info: A #GUPnPDeviceInfo
*
* Get a URL pointing to the device model's website.
- *
+ *
* Return value: A string, or %NULL. g_free() after use.
**/
char *
@@ -595,7 +595,7 @@ gupnp_device_info_get_model_url (GUPnPDeviceInfo *info)
* @info: A #GUPnPDeviceInfo
*
* Get the serial number of the device.
- *
+ *
* Return value: A string, or %NULL. g_free() after use.
**/
char *
@@ -630,7 +630,7 @@ gupnp_device_info_get_upc (GUPnPDeviceInfo *info)
*
* Get a URL pointing to the device's presentation page, for web-based
* administration.
- *
+ *
* Return value: A string, or %NULL. g_free() after use.
**/
char *
@@ -751,9 +751,12 @@ gupnp_device_info_get_icon_url (GUPnPDeviceInfo *info,
icon = icon_parse (info, element);
if (requested_mime_type) {
- mime_type_ok =
- !strcmp (requested_mime_type,
- (char *) icon->mime_type);
+ if (icon->mime_type)
+ mime_type_ok = !strcmp (
+ requested_mime_type,
+ (char *) icon->mime_type);
+ else
+ mime_type_ok = FALSE;
} else
mime_type_ok = TRUE;
@@ -869,7 +872,7 @@ gupnp_device_info_get_icon_url (GUPnPDeviceInfo *info,
return ret;
}
-/* Returns TRUE if @query matches against @base.
+/* Returns TRUE if @query matches against @base.
* - If @query does not specify a version, it matches any version specified
* in @base.
* - If @query specifies a version, it matches any version specified in @base
@@ -926,10 +929,43 @@ resource_type_match (const char *query,
}
/**
+ * gupnp_device_info_list_dlna_device_class_identifier:
+ * @info: A #GUPnPDeviceInfo
+ *
+ * Get a #GList of strings that represent the device class and version as
+ * announced in the device description file using the <dlna:X_DLNADOC>
+ * element.
+ * Returns: (transfer full) (element-type utf8): a #GList of newly allocated strings or
+ * %NULL if the device description doesn't contain the <dlna:X_DLNADOC>
+ * element.
+ **/
+GList *
+gupnp_device_info_list_dlna_device_class_identifier (GUPnPDeviceInfo *info)
+{
+ xmlNode *element;
+ GList *list = NULL;
+
+ g_return_val_if_fail (GUPNP_IS_DEVICE_INFO (info), NULL);
+
+ element = info->priv->element;
+
+ for (element = element->children; element; element = element->next) {
+ /* No early exit since the node explicitly may appear multiple
+ * times: 7.2.10.3 */
+ if (!strcmp ("X_DLNADOC", (char *) element->name))
+ list = g_list_prepend (list,
+ xmlNodeGetContent(element));
+ }
+
+ /* Return in order of appearance in document */
+ return g_list_reverse (list);
+}
+
+/**
* gupnp_device_info_list_dlna_capabilities:
* @info: A #GUPnPDeviceInfo
*
- * Get a #GList of strings that represent the device capabilities as announced
+ * Get a #GList of strings that represent the device capabilities as announced
* in the device description file using the <dlna:X_DLNACAP> element.
*
* Returns: (transfer full) (element-type utf8): a #GList of newly allocated strings or
@@ -1116,6 +1152,7 @@ gupnp_device_info_get_device (GUPnPDeviceInfo *info,
xmlNode *element;
g_return_val_if_fail (GUPNP_IS_DEVICE_INFO (info), NULL);
+ g_return_val_if_fail (type != NULL, NULL);
class = GUPNP_DEVICE_INFO_GET_CLASS (info);
@@ -1270,6 +1307,7 @@ gupnp_device_info_get_service (GUPnPDeviceInfo *info,
xmlNode *element;
g_return_val_if_fail (GUPNP_IS_DEVICE_INFO (info), NULL);
+ g_return_val_if_fail (type != NULL, NULL);
class = GUPNP_DEVICE_INFO_GET_CLASS (info);
diff --git a/libgupnp/gupnp-device-info.h b/libgupnp/gupnp-device-info.h
index 3a14238..0a65184 100644
--- a/libgupnp/gupnp-device-info.h
+++ b/libgupnp/gupnp-device-info.h
@@ -152,6 +152,9 @@ char *
gupnp_device_info_get_presentation_url (GUPnPDeviceInfo *info);
GList *
+gupnp_device_info_list_dlna_device_class_identifier (GUPnPDeviceInfo *info);
+
+GList *
gupnp_device_info_list_dlna_capabilities (GUPnPDeviceInfo *info);
char *
diff --git a/libgupnp/gupnp-error.h b/libgupnp/gupnp-error.h
index 90afcc7..a850857 100644
--- a/libgupnp/gupnp-error.h
+++ b/libgupnp/gupnp-error.h
@@ -104,6 +104,7 @@ gupnp_xml_error_quark (void) G_GNUC_CONST;
* @GUPNP_XML_ERROR_PARSE: Generic XML parsing error.
* @GUPNP_XML_ERROR_NO_NODE: A required XML node was not found.
* @GUPNP_XML_ERROR_EMPTY_NODE: An XML node is unexpectedly empty.
+ * @GUPNP_XML_ERROR_INVALID_ATTRIBUTE: An XML node has an unknown attribute.
* @GUPNP_XML_ERROR_OTHER: Unknown/unhandled XML related errors.
*
* #GError codes used for errors in the #GUPNP_XML_ERROR domain, during
diff --git a/libgupnp/gupnp-network-manager.c b/libgupnp/gupnp-network-manager.c
index 4ad6849..3b4e424 100644
--- a/libgupnp/gupnp-network-manager.c
+++ b/libgupnp/gupnp-network-manager.c
@@ -97,6 +97,8 @@ typedef enum
typedef struct
{
+ gint ref_count;
+
GUPnPNetworkManager *manager;
GUPnPContext *context;
@@ -126,15 +128,27 @@ nm_device_new (GUPnPNetworkManager *manager,
nm_device = g_slice_new0 (NMDevice);
- nm_device->manager = manager;
- nm_device->proxy = device_proxy;
+ g_atomic_int_set (&nm_device->ref_count, 1);
+ nm_device->manager = g_object_ref (manager);
+ nm_device->proxy = g_object_ref (device_proxy);
+
+ return nm_device;
+}
+
+static NMDevice *
+nm_device_ref (NMDevice *nm_device)
+{
+ g_atomic_int_inc (&nm_device->ref_count);
return nm_device;
}
static void
-nm_device_free (NMDevice *nm_device)
+nm_device_unref (NMDevice *nm_device)
{
+ if (!g_atomic_int_dec_and_test (&nm_device->ref_count))
+ return;
+
g_object_unref (nm_device->proxy);
if (nm_device->wifi_proxy != NULL)
g_object_unref (nm_device->wifi_proxy);
@@ -149,6 +163,8 @@ nm_device_free (NMDevice *nm_device)
g_object_unref (nm_device->context);
}
+ g_object_unref (nm_device->proxy);
+ g_object_unref (nm_device->manager);
g_slice_free (NMDevice, nm_device);
}
@@ -254,7 +270,8 @@ create_context_for_device (NMDevice *nm_device)
static void
ap_proxy_new_cb (GObject *source_object,
GAsyncResult *res,
- gpointer user_data) {
+ gpointer user_data)
+{
NMDevice *nm_device;
GError *error;
@@ -265,9 +282,13 @@ ap_proxy_new_cb (GObject *source_object,
if (G_UNLIKELY (error != NULL)) {
g_message ("Failed to create D-Bus proxy: %s", error->message);
g_error_free (error);
+ goto done;
}
create_context_for_device (nm_device);
+
+done:
+ nm_device_unref (nm_device);
}
static void
@@ -300,7 +321,7 @@ on_wifi_device_activated (NMDevice *nm_device)
AP_INTERFACE,
nm_device->manager->priv->cancellable,
ap_proxy_new_cb,
- nm_device);
+ nm_device_ref (nm_device));
}
g_variant_unref (value);
@@ -397,9 +418,13 @@ wifi_proxy_new_cb (GObject *source_object,
if (G_UNLIKELY (error != NULL)) {
g_message ("Failed to create D-Bus proxy: %s", error->message);
g_error_free (error);
+ goto done;
}
use_new_device (nm_device->manager, nm_device);
+
+done:
+ nm_device_unref (nm_device);
}
static void
@@ -421,21 +446,21 @@ device_proxy_new_cb (GObject *source_object,
g_message ("Failed to create D-Bus proxy: %s", error->message);
g_error_free (error);
- return;
+ goto done;
}
value = g_dbus_proxy_get_cached_property (device_proxy, "DeviceType");
if (G_UNLIKELY (value == NULL)) {
g_object_unref (device_proxy);
- return;
+ goto done;
}
if (G_UNLIKELY (!g_variant_is_of_type (value, G_VARIANT_TYPE_UINT32))) {
g_variant_unref (value);
g_object_unref (device_proxy);
- return;
+ goto done;
}
type = g_variant_get_uint32 (value);
@@ -455,9 +480,12 @@ device_proxy_new_cb (GObject *source_object,
WIFI_INTERFACE,
manager->priv->cancellable,
wifi_proxy_new_cb,
- nm_device);
+ nm_device_ref (nm_device));
} else
use_new_device (manager, nm_device);
+
+done:
+ g_object_unref (manager);
}
static int
@@ -499,7 +527,7 @@ on_manager_signal (GDBusProxy *proxy,
DEVICE_INTERFACE,
manager->priv->cancellable,
device_proxy_new_cb,
- manager);
+ g_object_ref (manager));
g_free (device_path);
} else if (g_strcmp0 (signal_name, "DeviceRemoved") == 0) {
GList *device_node;
@@ -526,7 +554,7 @@ on_manager_signal (GDBusProxy *proxy,
nm_device = (NMDevice *) device_node->data;
priv->nm_devices = g_list_remove (priv->nm_devices, nm_device);
- nm_device_free (nm_device);
+ nm_device_unref (nm_device);
g_free (device_path);
}
}
@@ -552,8 +580,7 @@ get_devices_cb (GObject *source_object,
error->message);
g_error_free (error);
-
- return;
+ goto done;
}
g_variant_get_child (ret, 0, "ao", &device_iter);
@@ -566,10 +593,13 @@ get_devices_cb (GObject *source_object,
DEVICE_INTERFACE,
manager->priv->cancellable,
device_proxy_new_cb,
- user_data);
+ g_object_ref (user_data));
g_variant_iter_free (device_iter);
g_variant_unref (ret);
+
+done:
+ g_object_unref (manager);
}
static void
@@ -583,8 +613,8 @@ schedule_loopback_context_creation (GUPnPNetworkManager *manager)
g_main_context_get_thread_default ());
g_source_set_callback (manager->priv->idle_context_creation_src,
create_loopback_context,
- manager,
- NULL);
+ g_object_ref (manager),
+ (GDestroyNotify) g_object_unref);
g_source_unref (manager->priv->idle_context_creation_src);
}
@@ -627,7 +657,7 @@ init_network_manager (GUPnPNetworkManager *manager)
-1,
priv->cancellable,
get_devices_cb,
- manager);
+ g_object_ref (manager));
}
static void
@@ -685,7 +715,8 @@ gupnp_network_manager_dispose (GObject *object)
}
if (priv->nm_devices != NULL) {
- g_list_foreach (priv->nm_devices, (GFunc) nm_device_free, NULL);
+ g_list_foreach (priv->nm_devices, (GFunc) nm_device_unref,
+ NULL);
g_list_free (priv->nm_devices);
priv->nm_devices = NULL;
}
diff --git a/libgupnp/gupnp-service-proxy.c b/libgupnp/gupnp-service-proxy.c
index 10ff4fb..6a06598 100644
--- a/libgupnp/gupnp-service-proxy.c
+++ b/libgupnp/gupnp-service-proxy.c
@@ -281,14 +281,14 @@ gupnp_service_proxy_dispose (GObject *object)
g_source_destroy (proxy->priv->notify_idle_src);
proxy->priv->notify_idle_src = NULL;
}
-
+
while (proxy->priv->pending_notifies) {
emit_notify_data_free (proxy->priv->pending_notifies->data);
proxy->priv->pending_notifies =
g_list_delete_link (proxy->priv->pending_notifies,
proxy->priv->pending_notifies);
}
-
+
/* Call super */
object_class = G_OBJECT_CLASS (gupnp_service_proxy_parent_class);
object_class->dispose (object);
@@ -371,7 +371,7 @@ gupnp_service_proxy_class_init (GUPnPServiceProxyClass *klass)
* @proxy: A #GUPnPServiceProxy
* @action: An action
* @error: The location where to store any error, or %NULL
- * @Varargs: tuples of in parameter name, in parameter type, and in parameter
+ * @...: tuples of in parameter name, in parameter type, and in parameter
* value, followed by %NULL, and then tuples of out parameter name,
* out parameter type, and out parameter value location, terminated with %NULL
*
@@ -575,17 +575,36 @@ gupnp_service_proxy_send_action_valist (GUPnPServiceProxy *proxy,
VAR_ARGS_TO_OUT_HASH_TABLE (var_args, out_hash);
local_error = NULL;
- result = gupnp_service_proxy_send_action_hash (proxy,
- action,
- &local_error,
- in_hash,
- out_hash);
+ handle = gupnp_service_proxy_begin_action_list (proxy,
+ action,
+ in_names,
+ in_values,
+ stop_main_loop,
+ main_loop);
+ if (!handle) {
+ g_main_loop_unref (main_loop);
+ result = FALSE;
+
+ goto out;
+ }
+
+ /* Loop till we get a reply (or time out) */
+ if (g_main_loop_is_running (main_loop))
+ g_main_loop_run (main_loop);
+
+ g_main_loop_unref (main_loop);
+
+ result = gupnp_service_proxy_end_action_hash (proxy,
+ handle,
+ &local_error,
+ out_hash);
if (local_error == NULL) {
OUT_HASH_TABLE_TO_VAR_ARGS (out_hash, var_args_copy);
} else {
g_propagate_error (error, local_error);
}
+out:
va_end (var_args_copy);
g_hash_table_unref (in_hash);
g_hash_table_unref (out_hash);
@@ -726,7 +745,7 @@ gupnp_service_proxy_send_action_list (GUPnPServiceProxy *proxy,
* @callback: (scope async): The callback to call when sending the action has succeeded
* or failed
* @user_data: User data for @callback
- * @Varargs: tuples of in parameter name, in parameter type, and in parameter
+ * @...: tuples of in parameter name, in parameter type, and in parameter
* value, terminated with %NULL
*
* Sends action @action with parameters @Varargs to the service exposed by
@@ -1112,7 +1131,7 @@ gupnp_service_proxy_begin_action_hash
* @proxy: A #GUPnPServiceProxy
* @action: A #GUPnPServiceProxyAction handle
* @error: The location where to store any error, or %NULL
- * @Varargs: tuples of out parameter name, out parameter type, and out parameter
+ * @...: tuples of out parameter name, out parameter type, and out parameter
* value location, terminated with %NULL. The out parameter values should be
* freed after use
*
@@ -1361,7 +1380,7 @@ gupnp_service_proxy_end_action_valist (GUPnPServiceProxy *proxy,
* in @out_values must be freed using #g_list_free and each element in it using
* #g_value_unset and #g_slice_free.
*
- * Return value : %TRUE on success.
+ * Returns: %TRUE on success.
**/
gboolean
gupnp_service_proxy_end_action_list (GUPnPServiceProxy *proxy,
@@ -1903,7 +1922,7 @@ server_handler (G_GNUC_UNUSED SoupServer *soup_server,
g_source_unref (proxy->priv->notify_idle_src);
}
-
+
/* Everything went OK */
soup_message_set_status (msg, SOUP_STATUS_OK);
}
diff --git a/libgupnp/gupnp-service.c b/libgupnp/gupnp-service.c
index 81e5607..459ed77 100644
--- a/libgupnp/gupnp-service.c
+++ b/libgupnp/gupnp-service.c
@@ -355,7 +355,7 @@ gupnp_service_action_get_locales (GUPnPServiceAction *action)
/**
* gupnp_service_action_get:
* @action: A #GUPnPServiceAction
- * @Varargs: tuples of argument name, argument type, and argument value
+ * @...: tuples of argument name, argument type, and argument value
* location, terminated with %NULL.
*
* Retrieves the specified action arguments.
@@ -543,7 +543,7 @@ gupnp_service_action_get_argument_count (GUPnPServiceAction *action)
/**
* gupnp_service_action_set:
* @action: A #GUPnPServiceAction
- * @Varargs: tuples of return value name, return value type, and
+ * @...: tuples of return value name, return value type, and
* actual return value, terminated with %NULL.
*
* Sets the specified action return values.
@@ -929,6 +929,14 @@ control_server_handler (SoupServer *server,
return;
}
+ /* DLNA 7.2.5.6: Always use HTTP 1.1 */
+ if (soup_message_get_http_version (msg) == SOUP_HTTP_1_0) {
+ soup_message_set_http_version (msg, SOUP_HTTP_1_1);
+ soup_message_headers_append (msg->response_headers,
+ "Connection",
+ "close");
+ }
+
context = gupnp_service_info_get_context (GUPNP_SERVICE_INFO (service));
/* Get action name */
@@ -1737,7 +1745,7 @@ gupnp_service_class_init (GUPnPServiceClass *klass)
/**
* gupnp_service_notify:
* @service: A #GUPnPService
- * @Varargs: Tuples of variable name, variable type, and variable value,
+ * @...: Tuples of variable name, variable type, and variable value,
* terminated with %NULL.
*
* Notifies listening clients that the properties listed in @Varargs
@@ -2191,7 +2199,7 @@ connect_names_to_signal_handlers (GUPnPService *service,
* A convenience function that attempts to connect all possible
* #GUPnPService::action-invoked and #GUPnPService::query-variable signals to
* appropriate callbacks for the service @service. It uses service introspection
- * and GModule's introspective features. It is very simillar to
+ * and #GModule's introspective features. It is very simillar to
* gtk_builder_connect_signals() except that it attempts to guess the names of
* the signal handlers on its own.
*
@@ -2200,17 +2208,18 @@ connect_names_to_signal_handlers (GUPnPService *service,
* off the action names and either prepend "on_" or append "_cb" to them. Same
* goes for #GUPnPService::query-variable signals, except that "query_" should
* be prepended to the variable name. For example, callback function for
- * "GetSystemUpdateID" action should be either named as
+ * GetSystemUpdateID action should be either named as
* "get_system_update_id_cb" or "on_get_system_update_id" and callback function
* for the query of "SystemUpdateID" state variable should be named
- * "query_system_update_id_cb" or "on_query_system_update_id".
+ * query_system_update_id_cb or
+ * on_query_system_update_id.
*
- * Note that this function will not work correctly if GModule is not supported
- * on the platform or introspection is not available for service @service.
+ * This function will not work correctly if #GModule is not supported
+ * on the platform or introspection is not available for @service.
*
- * WARNING: This function can not and therefore does not guarantee that the
+ * This function can not and therefore does not guarantee that the
* resulting signal connections will be correct as it depends heavily on a
- * particular naming schemes described above.
+ * particular naming schemes described above.
**/
void
gupnp_service_signals_autoconnect (GUPnPService *service,
diff --git a/libgupnp/gupnp-simple-context-manager.c b/libgupnp/gupnp-simple-context-manager.c
index 4648ed5..7efaf38 100644
--- a/libgupnp/gupnp-simple-context-manager.c
+++ b/libgupnp/gupnp-simple-context-manager.c
@@ -114,7 +114,7 @@ create_contexts (gpointer data)
while (ifaces) {
create_and_signal_context ((char *) ifaces->data, manager);
g_free (ifaces->data);
- ifaces = g_list_remove_link (ifaces, ifaces);
+ ifaces = g_list_delete_link (ifaces, ifaces);
}
return FALSE;
diff --git a/libgupnp/gupnp-white-list.c b/libgupnp/gupnp-white-list.c
new file mode 100644
index 0000000..599bd2e
--- /dev/null
+++ b/libgupnp/gupnp-white-list.c
@@ -0,0 +1,390 @@
+/*
+ * Copyright (C) 2013 Intel Corporation.
+ *
+ * Author: Ludovic Ferrandis
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/**
+ * SECTION:gupnp-white-list
+ * @short_description: Class for network filtering.
+ *
+ * #GUPnPWhiteList handles network filtering. It provides API to manage a list
+ * of entries that will be used to filter networks.
+ * The #GUPnPWhiteList could be enabled or not. If it's enabled but the entries
+ * list is empty, it behaves as disabled.
+ */
+
+#include
+
+#include "gupnp-white-list.h"
+
+G_DEFINE_TYPE (GUPnPWhiteList,
+ gupnp_white_list,
+ G_TYPE_OBJECT);
+
+struct _GUPnPWhiteListPrivate {
+ gboolean enabled;
+ GList *entries;
+};
+
+enum {
+ PROP_0,
+ PROP_ENABLED,
+ PROP_ENTRIES
+};
+
+enum {
+ ENTRY_CHANGE,
+ ENABLED,
+ SIGNAL_LAST
+};
+
+static void
+gupnp_white_list_init (GUPnPWhiteList *list)
+{
+ list->priv = G_TYPE_INSTANCE_GET_PRIVATE (list,
+ GUPNP_TYPE_WHITE_LIST,
+ GUPnPWhiteListPrivate);
+
+ list->priv->entries = NULL;
+}
+
+static void
+gupnp_white_list_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GUPnPWhiteList *list;
+
+ list = GUPNP_WHITE_LIST (object);
+
+ switch (property_id) {
+ case PROP_ENABLED:
+ list->priv->enabled = g_value_get_boolean (value);
+ break;
+ case PROP_ENTRIES:
+ list->priv->entries = g_value_get_pointer (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gupnp_white_list_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GUPnPWhiteList *list;
+
+ list = GUPNP_WHITE_LIST (object);
+
+ switch (property_id) {
+ case PROP_ENABLED:
+ g_value_set_boolean (value, list->priv->enabled);
+ break;
+ case PROP_ENTRIES:
+ g_value_set_pointer (value, list->priv->entries);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gupnp_white_list_class_finalize (GObject *object)
+{
+ GUPnPWhiteList *list;
+ GObjectClass *object_class;
+
+ list = GUPNP_WHITE_LIST (object);
+
+ g_list_free_full (list->priv->entries, g_free);
+ list->priv->entries = NULL;
+
+ /* Call super */
+ object_class = G_OBJECT_CLASS (gupnp_white_list_parent_class);
+ object_class->finalize (object);
+}
+
+static void
+gupnp_white_list_class_init (GUPnPWhiteListClass *klass)
+{
+ GObjectClass *object_class;
+
+ object_class = G_OBJECT_CLASS (klass);
+
+ object_class->set_property = gupnp_white_list_set_property;
+ object_class->get_property = gupnp_white_list_get_property;
+ object_class->finalize = gupnp_white_list_class_finalize;
+
+ g_type_class_add_private (klass, sizeof (GUPnPWhiteListPrivate));
+
+ /**
+ * GUPnPWhiteList:enabled:
+ *
+ * Whether this white list is active or not.
+ **/
+ g_object_class_install_property
+ (object_class,
+ PROP_ENABLED,
+ g_param_spec_boolean
+ ("enabled",
+ "Enabled",
+ "TRUE if the white list is active.",
+ FALSE,
+ G_PARAM_CONSTRUCT |
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
+
+ /**
+ * GUPnPWhiteList:entries:
+ *
+ * Whether this white list is active or not.
+ * Type: GList
+ * Transfer: none
+ **/
+ g_object_class_install_property
+ (object_class,
+ PROP_ENTRIES,
+ g_param_spec_pointer
+ ("entries",
+ "Entries",
+ "GList of strings that compose the white list.",
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
+}
+
+/**
+ * gupnp_white_list_new:
+ *
+ * Create a new #GUPnPWhiteList.
+ * The white list is disabled by default.
+ *
+ * Returns: (transfer full): A new #GUPnPWhiteList object.
+ **/
+GUPnPWhiteList *
+gupnp_white_list_new (void)
+{
+ return g_object_new (GUPNP_TYPE_WHITE_LIST, NULL);
+}
+
+/**
+ * gupnp_white_list_set_enabled:
+ * @white_list: A #GUPnPWhiteList
+ * @enable: %TRUE to enable @white_list, %FALSE otherwise
+ *
+ * Enable or disable the #GUPnPWhiteList to perform the network filtering.
+**/
+void
+gupnp_white_list_set_enabled (GUPnPWhiteList *white_list, gboolean enable)
+{
+ g_return_if_fail (GUPNP_IS_WHITE_LIST (white_list));
+
+ white_list->priv->enabled = enable;
+ g_object_notify (G_OBJECT (white_list), "enabled");
+}
+
+/**
+ * gupnp_white_list_get_enabled:
+ * @white_list: A #GUPnPWhiteList
+ *
+ * Return the status of the #GUPnPWhiteList
+ *
+ * Return value: %TRUE if @white_list is enabled, %FALSE otherwise.
+ **/
+gboolean
+gupnp_white_list_get_enabled (GUPnPWhiteList *white_list)
+{
+ g_return_val_if_fail (GUPNP_IS_WHITE_LIST (white_list), FALSE);
+
+ return white_list->priv->enabled;
+}
+
+/**
+ * gupnp_white_list_is_empty:
+ * @white_list: A #GUPnPWhiteList
+ *
+ * Return the state of the entries list of #GUPnPWhiteList
+ *
+ * Return value: %TRUE if @white_list is empty, %FALSE otherwise.
+ **/
+gboolean
+gupnp_white_list_is_empty (GUPnPWhiteList *white_list)
+{
+ g_return_val_if_fail (GUPNP_IS_WHITE_LIST (white_list), TRUE);
+
+ return (white_list->priv->entries == NULL);
+}
+
+/**
+ * gupnp_white_list_add_entry:
+ * @white_list: A #GUPnPWhiteList
+ * @entry: A value used to filter network
+ *
+ * Add @entry in the list of valid criteria used by @white_list to
+ * filter networks.
+ * if @entry already exists, it won't be added a second time.
+ *
+ * Return value: %TRUE if @entry is added, %FALSE otherwise.
+ **/
+gboolean
+gupnp_white_list_add_entry (GUPnPWhiteList *white_list, gchar* entry)
+{
+ GList *s_entry;
+ GUPnPWhiteListPrivate *priv;
+
+ g_return_val_if_fail (GUPNP_IS_WHITE_LIST (white_list), FALSE);
+ g_return_val_if_fail ((entry != NULL), FALSE);
+
+ priv = white_list->priv;
+
+ s_entry = g_list_find_custom (priv->entries, entry,
+ (GCompareFunc) g_ascii_strcasecmp);
+
+ if (s_entry == NULL) {
+ priv->entries = g_list_prepend (priv->entries,
+ g_strdup (entry));
+ g_object_notify (G_OBJECT (white_list), "entries");
+ }
+
+ return (s_entry == NULL);
+}
+
+/**
+ * gupnp_white_list_remove_entry:
+ * @white_list: A #GUPnPWhiteList
+ * @entry: A value to remove from the filter list.
+ *
+ * Remove @entry in the list of valid criteria used by @white_list to
+ * filter networks.
+ *
+ * Return value: %TRUE if @entry is removed, %FALSE otherwise.
+ **/
+gboolean
+gupnp_white_list_remove_entry (GUPnPWhiteList *white_list, gchar* entry)
+{
+ GList *s_entry;
+ GUPnPWhiteListPrivate *priv;
+
+ g_return_val_if_fail (GUPNP_IS_WHITE_LIST (white_list), FALSE);
+ g_return_val_if_fail ((entry != NULL), FALSE);
+
+ priv = white_list->priv;
+
+ s_entry = g_list_find_custom (priv->entries, entry,
+ (GCompareFunc) g_ascii_strcasecmp);
+
+ if (s_entry != NULL) {
+ priv->entries = g_list_remove_link (priv->entries, s_entry);
+ g_list_free_full (s_entry, g_free);
+ g_object_notify (G_OBJECT (white_list), "entries");
+ }
+
+ return (s_entry != NULL);
+}
+
+/**
+ * gupnp_white_list_get_entries:
+ * @white_list: A #GUPnPWhiteList
+ *
+ * Get the #GList of entries that compose the white list. Do not free
+ *
+ * Return value: (element-type utf8) (transfer none): a #GList of entries
+ * used to filter networks, interfaces,... or %NULL.
+ * Do not modify or free the list nor its elements.
+ **/
+GList *
+gupnp_white_list_get_entries (GUPnPWhiteList *white_list)
+{
+ g_return_val_if_fail (GUPNP_IS_WHITE_LIST (white_list), NULL);
+
+ return white_list->priv->entries;
+}
+
+/**
+ * gupnp_white_list_clear:
+ * @white_list: A #GUPnPWhiteList
+ *
+ * Remove all entries from #GList that compose the white list.
+ * The list is now empty. Even if #GUPnPWhiteList is enabled, it will have the
+ * same behavior as if it was disabled.
+**/
+void
+gupnp_white_list_clear (GUPnPWhiteList *white_list)
+{
+ GUPnPWhiteListPrivate *priv;
+
+ g_return_if_fail (GUPNP_IS_WHITE_LIST(white_list));
+
+ priv = white_list->priv;
+ g_list_free_full (priv->entries, g_free);
+ priv->entries = NULL;
+ g_object_notify (G_OBJECT (white_list), "entries");
+}
+
+/**
+ * gupnp_white_list_check_context:
+ * @white_list: A #GUPnPWhiteList
+ * @context: A #GUPnPContext to test.
+ *
+ * It will check if the @context is allowed or not. The @white_list will check
+ * all its entries againt #GUPnPContext interface, host ip and network fields
+ * information. This function doesn't take into account the @white_list status
+ * (enabled or not).
+ *
+ * Return value: %TRUE if @context is matching the @white_list criterias,
+ * %FALSE otherwise.
+ **/
+gboolean
+gupnp_white_list_check_context (GUPnPWhiteList *white_list,
+ GUPnPContext *context)
+{
+ GSSDPClient *client;
+ GList *l;
+ const char *interface;
+ const char *host_ip;
+ const char *network;
+ gboolean match = FALSE;
+
+ g_return_val_if_fail (GUPNP_IS_WHITE_LIST (white_list), FALSE);
+ g_return_val_if_fail (GUPNP_IS_CONTEXT (context), FALSE);
+
+ client = GSSDP_CLIENT (context);
+
+ interface = gssdp_client_get_interface (client);
+ host_ip = gssdp_client_get_host_ip (client);
+ network = gssdp_client_get_network (client);
+
+ l = white_list->priv->entries;
+
+ while (l && !match) {
+ match = (interface && !strcmp (l->data, interface)) ||
+ (host_ip && !strcmp (l->data, host_ip)) ||
+ (network && !strcmp (l->data, network));
+
+ l = l->next;
+ }
+
+ return match;
+}
diff --git a/libgupnp/gupnp-white-list.h b/libgupnp/gupnp-white-list.h
new file mode 100644
index 0000000..9b21b12
--- /dev/null
+++ b/libgupnp/gupnp-white-list.h
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2013 Intel Corporation.
+ *
+ * Author: Ludovic Ferrandis
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GUPNP_WHITE_LIST_H__
+#define __GUPNP_WHITE_LIST_H__
+
+#include
+#include "gupnp-context.h"
+
+G_BEGIN_DECLS
+
+GType
+gupnp_white_list_get_type (void) G_GNUC_CONST;
+
+#define GUPNP_TYPE_WHITE_LIST \
+ (gupnp_white_list_get_type ())
+#define GUPNP_WHITE_LIST(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ GUPNP_TYPE_WHITE_LIST, \
+ GUPnPWhiteList))
+#define GUPNP_WHITE_LIST_CLASS(obj) \
+ (G_TYPE_CHECK_CLASS_CAST ((obj), \
+ GUPNP_TYPE_WHITE_LIST, \
+ GUPnPWhiteListClass))
+#define GUPNP_IS_WHITE_LIST(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ GUPNP_TYPE_WHITE_LIST))
+#define GUPNP_IS_WHITE_LIST_CLASS(obj) \
+ (G_TYPE_CHECK_CLASS_TYPE ((obj), \
+ GUPNP_TYPE_WHITE_LIST))
+#define GUPNP_WHITE_LIST_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ GUPNP_TYPE_WHITE_LIST, \
+ GUPnPWhiteListClass))
+
+typedef struct _GUPnPWhiteListPrivate GUPnPWhiteListPrivate;
+typedef struct _GUPnPWhiteList GUPnPWhiteList;
+typedef struct _GUPnPWhiteListClass GUPnPWhiteListClass;
+
+/**
+ * GUPnPWhiteList:
+ *
+ * This struct contains private data only, and should be accessed using the
+ * functions below.
+ */
+struct _GUPnPWhiteList {
+ GObject parent;
+
+ GUPnPWhiteListPrivate *priv;
+};
+
+struct _GUPnPWhiteListClass {
+ GObjectClass parent_class;
+};
+
+GUPnPWhiteList *
+gupnp_white_list_new (void);
+
+void
+gupnp_white_list_set_enabled (GUPnPWhiteList *white_list,
+ gboolean enable);
+
+gboolean
+gupnp_white_list_get_enabled (GUPnPWhiteList *white_list);
+
+gboolean
+gupnp_white_list_is_empty (GUPnPWhiteList *white_list);
+
+gboolean
+gupnp_white_list_add_entry (GUPnPWhiteList *white_list,
+ gchar* entry);
+
+gboolean
+gupnp_white_list_remove_entry (GUPnPWhiteList *white_list,
+ gchar* entry);
+
+GList *
+gupnp_white_list_get_entries (GUPnPWhiteList *white_list);
+
+void
+gupnp_white_list_clear (GUPnPWhiteList *white_list);
+
+gboolean
+gupnp_white_list_check_context (GUPnPWhiteList *white_list,
+ GUPnPContext *context);
+
+G_END_DECLS
+
+#endif /* __GUPNP_WHITE_LIST_H__ */
diff --git a/libgupnp/gupnp-xml-doc.h b/libgupnp/gupnp-xml-doc.h
index bad0902..1162acd 100644
--- a/libgupnp/gupnp-xml-doc.h
+++ b/libgupnp/gupnp-xml-doc.h
@@ -28,6 +28,8 @@
#include
#include
+G_BEGIN_DECLS
+
GType
gupnp_xml_doc_get_type (void) G_GNUC_CONST;
@@ -55,6 +57,12 @@ gupnp_xml_doc_get_type (void) G_GNUC_CONST;
typedef struct _GUPnPXMLDoc GUPnPXMLDoc;
typedef struct _GUPnPXMLDocClass GUPnPXMLDocClass;
+/**
+ * GUPnPXMLDoc:
+ * @doc: Pointer to the document.
+ *
+ * Reference-counting wrapper for libxml's #xmlDoc
+ */
struct _GUPnPXMLDoc {
GObject parent;
/*< public >*/
@@ -72,4 +80,6 @@ GUPnPXMLDoc *
gupnp_xml_doc_new_from_path (const char *path,
GError **error);
+G_END_DECLS
+
#endif /* __GUPNP_XML_DOC_H__ */
diff --git a/libgupnp/gupnp.h b/libgupnp/gupnp.h
index 2d8d8bc..42ef2a8 100644
--- a/libgupnp/gupnp.h
+++ b/libgupnp/gupnp.h
@@ -32,5 +32,6 @@
#include "gupnp-service-info.h"
#include "gupnp-service-introspection.h"
#include "gupnp-service-proxy.h"
+#include "gupnp-white-list.h"
#include "gupnp-xml-doc.h"
#include "gupnp-types.h"
diff --git a/m4/libtool.m4 b/m4/libtool.m4
index 828104c..02b4bbe 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -1324,7 +1324,14 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
LD="${LD-ld} -m elf_i386_fbsd"
;;
x86_64-*linux*)
- LD="${LD-ld} -m elf_i386"
+ case `/usr/bin/file conftest.o` in
+ *x86-64*)
+ LD="${LD-ld} -m elf32_x86_64"
+ ;;
+ *)
+ LD="${LD-ld} -m elf_i386"
+ ;;
+ esac
;;
ppc64-*linux*|powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
@@ -1688,7 +1695,8 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
;;
*)
lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
- if test -n "$lt_cv_sys_max_cmd_len"; then
+ if test -n "$lt_cv_sys_max_cmd_len" && \
+ test undefined != "$lt_cv_sys_max_cmd_len"; then
lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
else
@@ -2512,17 +2520,6 @@ freebsd* | dragonfly*)
esac
;;
-gnu*)
- version_type=linux # correct to gnu/linux during the next big refactor
- need_lib_prefix=no
- need_version=no
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
- soname_spec='${libname}${release}${shared_ext}$major'
- shlibpath_var=LD_LIBRARY_PATH
- shlibpath_overrides_runpath=no
- hardcode_into_libs=yes
- ;;
-
haiku*)
version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
@@ -2639,7 +2636,7 @@ linux*oldld* | linux*aout* | linux*coff*)
;;
# This must be glibc/ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu)
+linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
@@ -3255,10 +3252,6 @@ freebsd* | dragonfly*)
fi
;;
-gnu*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
haiku*)
lt_cv_deplibs_check_method=pass_all
;;
@@ -3297,7 +3290,7 @@ irix5* | irix6* | nonstopux*)
;;
# This must be glibc/ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu)
+linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
lt_cv_deplibs_check_method=pass_all
;;
@@ -4049,7 +4042,7 @@ m4_if([$1], [CXX], [
;;
esac
;;
- linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
case $cc_basename in
KCC*)
# KAI C++ Compiler
@@ -4348,7 +4341,7 @@ m4_if([$1], [CXX], [
_LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
;;
- linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
case $cc_basename in
# old Intel for x86_64 which still supported -KPIC.
ecc*)
@@ -6241,9 +6234,6 @@ if test "$_lt_caught_CXX_error" != yes; then
_LT_TAGVAR(ld_shlibs, $1)=yes
;;
- gnu*)
- ;;
-
haiku*)
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
_LT_TAGVAR(link_all_deplibs, $1)=yes
@@ -6405,7 +6395,7 @@ if test "$_lt_caught_CXX_error" != yes; then
_LT_TAGVAR(inherit_rpath, $1)=yes
;;
- linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
case $cc_basename in
KCC*)
# Kuck and Associates, Inc. (KAI) C++ Compiler
diff --git a/packaging/GUPnP.changes b/packaging/GUPnP.changes
index cdc2fd0..11bc645 100644
--- a/packaging/GUPnP.changes
+++ b/packaging/GUPnP.changes
@@ -1,4 +1,19 @@
-* Tue Nov 13 19:04:20 CET 2012 - Mark Ryan
+* Wed Aug 21 2013 Regis Merlino
+- Update gupnp to 0.20.5 (fdeb6f9f)
+
+* Tue Jul 16 00:01:36 UTC 2013 - tracy.graydon@intel.com
+- Stripped old yaml cruft out of spec file
+
+* Tue Jun 11 2013 Regis Merlino
+- Update gupnp to 0.20.3 (161969f)
+
+* Thu Apr 04 2013 Regis Merlino
+- Fix browsing of WMP DMS running on Windows 7
+
+* Wed Mar 20 2013 Regis Merlino
+- Submit version 0.20.1 of GUPnP (4186015)
+
+* Tue Nov 27 10:22:57 CET 2012 - Mark Ryan
- Submit version 0.19.1 (24bd15c) of GUPnP
* Wed Sep 12 13:42:24 CEST 2012 - Mark Ryan
diff --git a/packaging/GUPnP.spec b/packaging/GUPnP.spec
index 19d131f..bde84c1 100644
--- a/packaging/GUPnP.spec
+++ b/packaging/GUPnP.spec
@@ -7,7 +7,7 @@
Name: gupnp
Summary: GUPnP is an framework for creating UPnP devices & control points
-Version: 0.20.3
+Version: 0.20.5
Release: 1
Group: System/Libraries
License: LGPLv2+
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 4c70f1a..8209270 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -5,7 +5,8 @@ AM_CFLAGS = $(LIBGUPNP_CFLAGS) $(GTHREAD_CFLAGS) -I$(top_srcdir)
noinst_PROGRAMS = test-browsing \
test-proxy \
test-server \
- test-introspection
+ test-introspection \
+ test-white-list
test_browsing_SOURCES = test-browsing.c
test_browsing_LDADD = $(top_builddir)/libgupnp/libgupnp-1.0.la \
@@ -28,6 +29,11 @@ test_server_LDADD = $(top_builddir)/libgupnp/libgupnp-1.0.la \
$(LIBGUPNP_LIBS)
test_server_LDFLAGS = -export-dynamic
+test_white_list_SOURCES = test-white-list.c
+test_white_list_LDADD = $(top_builddir)/libgupnp/libgupnp-1.0.la \
+ $(GTHREAD_LIBS) \
+ $(LIBGUPNP_LIBS)
+
CLEANFILES = $(BUILT_SOURCES)
DISTCLEANFILES = $(BUILT_SOURCES)
MAINTAINERCLEANFILES = Makefile.in $(BUILT_SOURCES)
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 6c815c6..9f8fcb1 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -53,7 +53,8 @@ build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
noinst_PROGRAMS = test-browsing$(EXEEXT) test-proxy$(EXEEXT) \
- test-server$(EXEEXT) test-introspection$(EXEEXT)
+ test-server$(EXEEXT) test-introspection$(EXEEXT) \
+ test-white-list$(EXEEXT)
subdir = tests
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -93,6 +94,11 @@ test_server_DEPENDENCIES = $(top_builddir)/libgupnp/libgupnp-1.0.la \
test_server_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(test_server_LDFLAGS) $(LDFLAGS) -o $@
+am_test_white_list_OBJECTS = test-white-list.$(OBJEXT)
+test_white_list_OBJECTS = $(am_test_white_list_OBJECTS)
+test_white_list_DEPENDENCIES = \
+ $(top_builddir)/libgupnp/libgupnp-1.0.la $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp
am__depfiles_maybe = depfiles
@@ -120,9 +126,11 @@ AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
SOURCES = $(test_browsing_SOURCES) $(test_introspection_SOURCES) \
- $(test_proxy_SOURCES) $(test_server_SOURCES)
+ $(test_proxy_SOURCES) $(test_server_SOURCES) \
+ $(test_white_list_SOURCES)
DIST_SOURCES = $(test_browsing_SOURCES) $(test_introspection_SOURCES) \
- $(test_proxy_SOURCES) $(test_server_SOURCES)
+ $(test_proxy_SOURCES) $(test_server_SOURCES) \
+ $(test_white_list_SOURCES)
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-dvi-recursive install-exec-recursive \
@@ -207,8 +215,6 @@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@
GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@
GTKDOC_MKPDF = @GTKDOC_MKPDF@
GTKDOC_REBASE = @GTKDOC_REBASE@
-GTest_CFLAGS = @GTest_CFLAGS@
-GTest_LIBS = @GTest_LIBS@
HAVE_NETLINK = @HAVE_NETLINK@
HTML_DIR = @HTML_DIR@
INSTALL = @INSTALL@
@@ -342,6 +348,11 @@ test_server_LDADD = $(top_builddir)/libgupnp/libgupnp-1.0.la \
$(LIBGUPNP_LIBS)
test_server_LDFLAGS = -export-dynamic
+test_white_list_SOURCES = test-white-list.c
+test_white_list_LDADD = $(top_builddir)/libgupnp/libgupnp-1.0.la \
+ $(GTHREAD_LIBS) \
+ $(LIBGUPNP_LIBS)
+
CLEANFILES = $(BUILT_SOURCES)
DISTCLEANFILES = $(BUILT_SOURCES)
MAINTAINERCLEANFILES = Makefile.in $(BUILT_SOURCES)
@@ -400,6 +411,9 @@ test-proxy$(EXEEXT): $(test_proxy_OBJECTS) $(test_proxy_DEPENDENCIES) $(EXTRA_te
test-server$(EXEEXT): $(test_server_OBJECTS) $(test_server_DEPENDENCIES) $(EXTRA_test_server_DEPENDENCIES)
@rm -f test-server$(EXEEXT)
$(AM_V_CCLD)$(test_server_LINK) $(test_server_OBJECTS) $(test_server_LDADD) $(LIBS)
+test-white-list$(EXEEXT): $(test_white_list_OBJECTS) $(test_white_list_DEPENDENCIES) $(EXTRA_test_white_list_DEPENDENCIES)
+ @rm -f test-white-list$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(test_white_list_OBJECTS) $(test_white_list_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -411,6 +425,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-introspection.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-proxy.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-server.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-white-list.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
diff --git a/tests/gtest/Makefile.am b/tests/gtest/Makefile.am
index 2578a93..2602a00 100644
--- a/tests/gtest/Makefile.am
+++ b/tests/gtest/Makefile.am
@@ -1,4 +1,3 @@
-if HAVE_GTEST
TESTS_ENVIRONMENT = G_SLICE=debug-blocks \
LD_LIBRARY_PATH=$(top_builddir)/libgupnp/.libs:$(LD_LIBRARY_PATH)
@@ -8,7 +7,6 @@ check_PROGRAMS = test-context test-bugs
test_context_SOURCES = test-context.c
test_bugs_SOURCES = test-bugs.c
-endif
LDADD = \
$(top_builddir)/libgupnp/libgupnp-1.0.la \
diff --git a/tests/gtest/Makefile.in b/tests/gtest/Makefile.in
index 78a4f3f..f527241 100644
--- a/tests/gtest/Makefile.in
+++ b/tests/gtest/Makefile.in
@@ -51,8 +51,7 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
-@HAVE_GTEST_TRUE@check_PROGRAMS = test-context$(EXEEXT) \
-@HAVE_GTEST_TRUE@ test-bugs$(EXEEXT)
+check_PROGRAMS = test-context$(EXEEXT) test-bugs$(EXEEXT)
subdir = tests/gtest
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -67,8 +66,7 @@ mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
-am__test_bugs_SOURCES_DIST = test-bugs.c
-@HAVE_GTEST_TRUE@am_test_bugs_OBJECTS = test-bugs.$(OBJEXT)
+am_test_bugs_OBJECTS = test-bugs.$(OBJEXT)
test_bugs_OBJECTS = $(am_test_bugs_OBJECTS)
test_bugs_LDADD = $(LDADD)
am__DEPENDENCIES_1 =
@@ -77,8 +75,7 @@ test_bugs_DEPENDENCIES = $(top_builddir)/libgupnp/libgupnp-1.0.la \
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
-am__test_context_SOURCES_DIST = test-context.c
-@HAVE_GTEST_TRUE@am_test_context_OBJECTS = test-context.$(OBJEXT)
+am_test_context_OBJECTS = test-context.$(OBJEXT)
test_context_OBJECTS = $(am_test_context_OBJECTS)
test_context_LDADD = $(LDADD)
test_context_DEPENDENCIES = $(top_builddir)/libgupnp/libgupnp-1.0.la \
@@ -110,8 +107,7 @@ AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
SOURCES = $(test_bugs_SOURCES) $(test_context_SOURCES)
-DIST_SOURCES = $(am__test_bugs_SOURCES_DIST) \
- $(am__test_context_SOURCES_DIST)
+DIST_SOURCES = $(test_bugs_SOURCES) $(test_context_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
@@ -160,8 +156,6 @@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@
GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@
GTKDOC_MKPDF = @GTKDOC_MKPDF@
GTKDOC_REBASE = @GTKDOC_REBASE@
-GTest_CFLAGS = @GTest_CFLAGS@
-GTest_LIBS = @GTest_LIBS@
HAVE_NETLINK = @HAVE_NETLINK@
HTML_DIR = @HTML_DIR@
INSTALL = @INSTALL@
@@ -272,12 +266,12 @@ target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-@HAVE_GTEST_TRUE@TESTS_ENVIRONMENT = G_SLICE=debug-blocks \
-@HAVE_GTEST_TRUE@ LD_LIBRARY_PATH=$(top_builddir)/libgupnp/.libs:$(LD_LIBRARY_PATH)
+TESTS_ENVIRONMENT = G_SLICE=debug-blocks \
+ LD_LIBRARY_PATH=$(top_builddir)/libgupnp/.libs:$(LD_LIBRARY_PATH)
-@HAVE_GTEST_TRUE@TESTS = $(check_PROGRAMS)
-@HAVE_GTEST_TRUE@test_context_SOURCES = test-context.c
-@HAVE_GTEST_TRUE@test_bugs_SOURCES = test-bugs.c
+TESTS = $(check_PROGRAMS)
+test_context_SOURCES = test-context.c
+test_bugs_SOURCES = test-bugs.c
LDADD = \
$(top_builddir)/libgupnp/libgupnp-1.0.la \
$(LIBGUPNP_LIBS)
diff --git a/tests/gtest/test-context.c b/tests/gtest/test-context.c
index edf41eb..bbcfd27 100644
--- a/tests/gtest/test-context.c
+++ b/tests/gtest/test-context.c
@@ -200,21 +200,6 @@ test_gupnp_context_http_ranged_requests (void)
g_object_unref (message);
- /* Try with inverted arguments */
- message = soup_message_new ("GET", uri);
- g_object_ref (message);
-
- soup_message_headers_set_range (message->request_headers, 499, 0);
- soup_session_queue_message (session,
- message,
- on_message_finished,
- loop);
-
- g_main_loop_run (loop);
- g_assert_cmpint (message->status_code, ==, SOUP_STATUS_REQUESTED_RANGE_NOT_SATISFIABLE);
-
- g_object_unref (message);
-
g_free (uri);
g_object_unref (context);
g_main_loop_unref (loop);
diff --git a/tests/test-white-list.c b/tests/test-white-list.c
new file mode 100644
index 0000000..465ac72
--- /dev/null
+++ b/tests/test-white-list.c
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2013 Intel Corporation.
+ *
+ * Author: Ludovic Ferrandis
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+GMainLoop *main_loop;
+
+static void
+interrupt_signal_handler (G_GNUC_UNUSED int signum)
+{
+ g_main_loop_quit (main_loop);
+}
+
+static void
+device_proxy_available_cb (G_GNUC_UNUSED GUPnPControlPoint *cp,
+ GUPnPDeviceProxy *proxy)
+{
+ const char *type, *location;
+
+ type = gupnp_device_info_get_device_type (GUPNP_DEVICE_INFO (proxy));
+ location = gupnp_device_info_get_location (GUPNP_DEVICE_INFO (proxy));
+
+ g_print ("Device available:\n");
+ g_print ("\ttype: %s\n", type);
+ g_print ("\tlocation: %s\n", location);
+}
+
+static void
+device_proxy_unavailable_cb (G_GNUC_UNUSED GUPnPControlPoint *cp,
+ GUPnPDeviceProxy *proxy)
+{
+ const char *type, *location;
+
+ type = gupnp_device_info_get_device_type (GUPNP_DEVICE_INFO (proxy));
+ location = gupnp_device_info_get_location (GUPNP_DEVICE_INFO (proxy));
+
+ g_print ("Device unavailable:\n");
+ g_print ("\ttype: %s\n", type);
+ g_print ("\tlocation: %s\n", location);
+}
+
+static void
+service_proxy_available_cb (G_GNUC_UNUSED GUPnPControlPoint *cp,
+ GUPnPServiceProxy *proxy)
+{
+ const char *type, *location;
+
+ type = gupnp_service_info_get_service_type (GUPNP_SERVICE_INFO (proxy));
+ location = gupnp_service_info_get_location (GUPNP_SERVICE_INFO (proxy));
+
+ g_print ("Service available:\n");
+ g_print ("\ttype: %s\n", type);
+ g_print ("\tlocation: %s\n", location);
+}
+
+static void
+service_proxy_unavailable_cb (G_GNUC_UNUSED GUPnPControlPoint *cp,
+ GUPnPServiceProxy *proxy)
+{
+ const char *type, *location;
+
+ type = gupnp_service_info_get_service_type (GUPNP_SERVICE_INFO (proxy));
+ location = gupnp_service_info_get_location (GUPNP_SERVICE_INFO (proxy));
+
+ g_print ("Service unavailable:\n");
+ g_print ("\ttype: %s\n", type);
+ g_print ("\tlocation: %s\n", location);
+}
+
+static void
+context_available_cb(GUPnPContextManager *context_manager,
+ GUPnPContext *context,
+ gpointer user_data)
+{
+ GUPnPControlPoint *cp;
+ GSSDPClient *client = GSSDP_CLIENT(context);
+
+ g_print ("Context Available:\n");
+ g_print ("\tServer ID: %s\n", gssdp_client_get_server_id (client));
+ g_print ("\tInterface: %s\n", gssdp_client_get_interface (client));
+ g_print ("\tHost IP : %s\n", gssdp_client_get_host_ip (client));
+ g_print ("\tNetwork : %s\n", gssdp_client_get_network (client));
+ g_print ("\tActive : %s\n", gssdp_client_get_active (client)? "TRUE" : "FALSE");
+
+
+ /* We're interested in everything */
+ cp = gupnp_control_point_new (context, "ssdp:all");
+
+ g_signal_connect (cp,
+ "device-proxy-available",
+ G_CALLBACK (device_proxy_available_cb),
+ NULL);
+ g_signal_connect (cp,
+ "device-proxy-unavailable",
+ G_CALLBACK (device_proxy_unavailable_cb),
+ NULL);
+ g_signal_connect (cp,
+ "service-proxy-available",
+ G_CALLBACK (service_proxy_available_cb),
+ NULL);
+ g_signal_connect (cp,
+ "service-proxy-unavailable",
+ G_CALLBACK (service_proxy_unavailable_cb),
+ NULL);
+
+ gssdp_resource_browser_set_active (GSSDP_RESOURCE_BROWSER (cp), TRUE);
+ gupnp_context_manager_manage_control_point(context_manager, cp);
+ g_object_unref(cp);
+}
+
+static void
+context_unavailable_cb(GUPnPContextManager *context_manager,
+ GUPnPContext *context,
+ gpointer user_data)
+{
+ GSSDPClient *client = GSSDP_CLIENT(context);
+
+ g_print ("Context Unavailable:\n");
+ g_print ("\tServer ID: %s\n", gssdp_client_get_server_id (client));
+ g_print ("\tInterface: %s\n", gssdp_client_get_interface (client));
+ g_print ("\tHost IP : %s\n", gssdp_client_get_host_ip (client));
+ g_print ("\tNetwork : %s\n", gssdp_client_get_network (client));
+ g_print ("\tActive : %s\n", gssdp_client_get_active (client)? "TRUE" : "FALSE");
+}
+
+static void
+print_wl_entry(gpointer data, gpointer user_data)
+{
+ g_print ("\t\t\tEntry: %s\n", (char *)data);
+}
+
+static void
+print_white_list_entries(GUPnPWhiteList *wl)
+{
+ GList *list;
+
+ g_print ("\t\tWhite List Entries:\n");
+ list = gupnp_white_list_get_entries(wl);
+ g_list_foreach (list, print_wl_entry, NULL);
+ g_print ("\n");
+}
+
+static gboolean
+change_white_list(gpointer user_data)
+{
+ GUPnPContextManager *context_manager = user_data;
+ GUPnPWhiteList *white_list;
+ static int tomato = 0;
+
+ g_print ("\nChange White List:\n");
+ g_print ("\t Action number %d:\n", tomato);
+
+ white_list = gupnp_context_manager_get_white_list(context_manager);
+
+ switch (tomato) {
+ case 0:
+ g_print ("\t Add Entry eth0\n\n");
+ gupnp_white_list_add_entry(white_list, "eth0");
+ print_white_list_entries (white_list);
+ break;
+ case 1:
+ g_print ("\t Enable WL\n\n");
+ gupnp_white_list_set_enabled (white_list, TRUE);
+ break;
+ case 2:
+ g_print ("\t Add Entry 127.0.0.1\n\n");
+ gupnp_white_list_add_entry(white_list, "127.0.0.1");
+ print_white_list_entries (white_list);
+ break;
+ case 3:
+ g_print ("\t Add Entry eth5\n\n");
+ gupnp_white_list_add_entry(white_list, "eth5");
+ print_white_list_entries (white_list);
+ break;
+ case 4:
+ g_print ("\t Remove Entry eth5\n\n");
+ gupnp_white_list_remove_entry(white_list, "eth5");
+ print_white_list_entries (white_list);
+ break;
+ case 5:
+ g_print ("\t Clear all entries\n\n");
+ gupnp_white_list_clear(white_list);
+ print_white_list_entries (white_list);
+ break;
+ case 6:
+ g_print ("\t Add Entry wlan2\n\n");
+ gupnp_white_list_add_entry(white_list, "wlan2");
+ print_white_list_entries(white_list);
+ break;
+ case 7:
+ g_print ("\t Disable WL\n\n");
+ gupnp_white_list_set_enabled (white_list, FALSE);
+ break;
+ case 8:
+ g_print ("\t Enable WL\n\n");
+ gupnp_white_list_set_enabled (white_list, TRUE);
+ break;
+ case 9:
+ g_print ("\t Connect to wlan0\n\n");
+ g_timeout_add_seconds (35, change_white_list, context_manager);
+ break;
+ case 10:
+ g_print ("\t Add Entry wlan0\n\n");
+ gupnp_white_list_add_entry(white_list, "wlan0");
+ print_white_list_entries (white_list);
+ break;
+ //~ case 11:
+ //~ g_print ("\t Enable WL\n");
+ //~ gupnp_white_list_enable(white_list, FALSE);
+ //~ break;
+ default:
+ break;
+ }
+
+ tomato++;
+
+ return (tomato < 11) && (tomato != 10);
+}
+
+int
+main (G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv)
+{
+ GUPnPContextManager *cm;
+ guint id;
+#ifndef G_OS_WIN32
+ struct sigaction sig_action;
+#endif /* G_OS_WIN32 */
+
+#if !GLIB_CHECK_VERSION(2,35,0)
+ g_type_init ();
+#endif
+ setlocale (LC_ALL, "");
+
+ cm = gupnp_context_manager_create(0);
+
+ g_signal_connect(cm,
+ "context-available",
+ G_CALLBACK(context_available_cb),
+ NULL);
+
+ g_signal_connect(cm,
+ "context-unavailable",
+ G_CALLBACK(context_unavailable_cb),
+ NULL);
+
+ main_loop = g_main_loop_new (NULL, FALSE);
+
+ id = g_timeout_add_seconds (5, change_white_list, cm);
+
+#ifndef G_OS_WIN32
+ /* Hook the handler for SIGTERM */
+ memset (&sig_action, 0, sizeof (sig_action));
+ sig_action.sa_handler = interrupt_signal_handler;
+ sigaction (SIGINT, &sig_action, NULL);
+#else
+ signal(SIGINT, interrupt_signal_handler);
+#endif /* G_OS_WIN32 */
+
+ g_main_loop_run (main_loop);
+ g_main_loop_unref (main_loop);
+
+ g_source_remove (id);
+
+ g_object_unref (cm);
+
+ return EXIT_SUCCESS;
+}
diff --git a/tools/Makefile.in b/tools/Makefile.in
index 21f19e5..8c1544e 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -148,8 +148,6 @@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@
GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@
GTKDOC_MKPDF = @GTKDOC_MKPDF@
GTKDOC_REBASE = @GTKDOC_REBASE@
-GTest_CFLAGS = @GTest_CFLAGS@
-GTest_LIBS = @GTest_LIBS@
HAVE_NETLINK = @HAVE_NETLINK@
HTML_DIR = @HTML_DIR@
INSTALL = @INSTALL@
diff --git a/tools/gupnp-binding-tool b/tools/gupnp-binding-tool
index 120fffb..463e5ec 100755
--- a/tools/gupnp-binding-tool
+++ b/tools/gupnp-binding-tool
@@ -173,94 +173,94 @@ def getVariables(var_elements, prefix):
def printClientSyncActionBinding(a):
indent = (2 + len (a.c_prefixed_name)) * " "
- print "static inline gboolean"
- print "%s (GUPnPServiceProxy *proxy," % a.c_prefixed_name
+ print("static inline gboolean")
+ print("%s (GUPnPServiceProxy *proxy," % a.c_prefixed_name)
for arg in a.in_args:
- print "%sconst %sin_%s," % (indent, arg.related_var.ctype, arg.c_name)
+ print("%sconst %sin_%s," % (indent, arg.related_var.ctype, arg.c_name))
for arg in a.out_args:
- print "%s%s*out_%s," % (indent, arg.related_var.ctype, arg.c_name)
+ print("%s%s*out_%s," % (indent, arg.related_var.ctype, arg.c_name))
- print "%sGError **error)" % indent
+ print("%sGError **error)" % indent)
- print "{"
+ print("{")
- print " return gupnp_service_proxy_send_action"
- print " (proxy, \"%s\", error," % a.name
+ print(" return gupnp_service_proxy_send_action")
+ print(" (proxy, \"%s\", error," % a.name)
for arg in a.in_args:
- print " \"%s\", %s, in_%s," % (arg.name, arg.related_var.gtype, arg.c_name)
- print " NULL,"
+ print(" \"%s\", %s, in_%s," % (arg.name, arg.related_var.gtype, arg.c_name))
+ print(" NULL,")
for arg in a.out_args:
- print " \"%s\", %s, out_%s," % (arg.name, arg.related_var.gtype, arg.c_name)
- print " NULL);"
+ print(" \"%s\", %s, out_%s," % (arg.name, arg.related_var.gtype, arg.c_name))
+ print(" NULL);")
- print "}\n"
+ print("}\n")
def printClientAsyncActionBinding(a):
# User-callback prototype
indent = (24 + len (a.c_prefixed_name)) * " "
- print "typedef void (*%s_reply) (GUPnPServiceProxy *proxy," % a.c_prefixed_name
+ print("typedef void (*%s_reply) (GUPnPServiceProxy *proxy," % a.c_prefixed_name)
for arg in a.out_args:
- print "%sconst %sout_%s," % (indent, arg.related_var.ctype, arg.c_name)
- print "%sGError *error," % indent
- print "%sgpointer userdata);" % indent
- print
+ print("%sconst %sout_%s," % (indent, arg.related_var.ctype, arg.c_name))
+ print("%sGError *error," % indent)
+ print("%sgpointer userdata);" % indent)
+ print("")
# Generated async callback handler, calls user-provided callback
indent = (30 + len (a.c_prefixed_name)) * " "
- print "static void _%s_async_callback (GUPnPServiceProxy *proxy," % a.c_prefixed_name
- print "%sGUPnPServiceProxyAction *action," % indent
- print "%sgpointer user_data)" % indent
- print "{"
- print " GUPnPAsyncData *cbdata;"
- print " GError *error = NULL;"
+ print("static void _%s_async_callback (GUPnPServiceProxy *proxy," % a.c_prefixed_name)
+ print("%sGUPnPServiceProxyAction *action," % indent)
+ print("%sgpointer user_data)" % indent)
+ print("{")
+ print(" GUPnPAsyncData *cbdata;")
+ print(" GError *error = NULL;")
for arg in a.out_args:
- print " %s%s;" % (arg.related_var.ctype, arg.c_name)
- print
- print " cbdata = (GUPnPAsyncData *) user_data;"
- print " gupnp_service_proxy_end_action"
- print " (proxy, action, &error,"
+ print(" %s%s;" % (arg.related_var.ctype, arg.c_name))
+ print("")
+ print(" cbdata = (GUPnPAsyncData *) user_data;")
+ print(" gupnp_service_proxy_end_action")
+ print(" (proxy, action, &error,")
for arg in a.out_args:
- print " \"%s\", %s, &%s," % (arg.name, arg.related_var.gtype, arg.c_name)
- print " NULL);"
- print " ((%s_reply)cbdata->cb)" % a.c_prefixed_name
- print " (proxy,"
+ print(" \"%s\", %s, &%s," % (arg.name, arg.related_var.gtype, arg.c_name))
+ print(" NULL);")
+ print(" ((%s_reply)cbdata->cb)" % a.c_prefixed_name)
+ print(" (proxy,")
for arg in a.out_args:
- print " %s," % arg.c_name
- print " error, cbdata->userdata);"
- print
- print " g_slice_free1 (sizeof (*cbdata), cbdata);"
- print "}"
- print
+ print(" %s," % arg.c_name)
+ print(" error, cbdata->userdata);")
+ print("")
+ print(" g_slice_free1 (sizeof (*cbdata), cbdata);")
+ print("}")
+ print("")
# Entry point
indent = (8 + len (a.c_prefixed_name)) * " "
- print "static inline GUPnPServiceProxyAction *"
- print "%s_async (GUPnPServiceProxy *proxy," % a.c_prefixed_name
+ print("static inline GUPnPServiceProxyAction *")
+ print("%s_async (GUPnPServiceProxy *proxy," % a.c_prefixed_name)
for arg in a.in_args:
- print "%sconst %sin_%s," % (indent, arg.related_var.ctype, arg.c_name)
- print "%s%s_reply callback," % (indent, a.c_prefixed_name)
- print "%sgpointer userdata)" % indent
- print "{"
- print " GUPnPServiceProxyAction* action;"
- print " GUPnPAsyncData *cbdata;"
- print
- print " cbdata = (GUPnPAsyncData *) g_slice_alloc (sizeof (*cbdata));"
- print " cbdata->cb = G_CALLBACK (callback);"
- print " cbdata->userdata = userdata;"
- print " action = gupnp_service_proxy_begin_action"
- print " (proxy, \"%s\"," % a.name
- print " _%s_async_callback, cbdata," % a.c_prefixed_name
+ print("%sconst %sin_%s," % (indent, arg.related_var.ctype, arg.c_name))
+ print("%s%s_reply callback," % (indent, a.c_prefixed_name))
+ print("%sgpointer userdata)" % indent)
+ print("{")
+ print(" GUPnPServiceProxyAction* action;")
+ print(" GUPnPAsyncData *cbdata;")
+ print("")
+ print(" cbdata = (GUPnPAsyncData *) g_slice_alloc (sizeof (*cbdata));")
+ print(" cbdata->cb = G_CALLBACK (callback);")
+ print(" cbdata->userdata = userdata;")
+ print(" action = gupnp_service_proxy_begin_action")
+ print(" (proxy, \"%s\"," % a.name)
+ print(" _%s_async_callback, cbdata," % a.c_prefixed_name)
for arg in a.in_args:
- print " \"%s\", %s, in_%s," % (arg.name, arg.related_var.gtype, arg.c_name)
- print " NULL);"
- print
- print " return action;"
- print "}"
+ print(" \"%s\", %s, in_%s," % (arg.name, arg.related_var.gtype, arg.c_name))
+ print(" NULL);")
+ print("")
+ print(" return action;")
+ print("}")
def printClientVariableNotifyBinding(v):
@@ -268,159 +268,159 @@ def printClientVariableNotifyBinding(v):
# callback prototype
indent = (22 + len (v.c_prefixed_name)) * " "
- print "typedef void"
- print "(*%s_changed_callback) (GUPnPServiceProxy *proxy," % v.c_prefixed_name
- print "%s%s%s," % (indent, ctype, v.c_name)
- print "%sgpointer userdata);" % indent
- print
+ print("typedef void")
+ print("(*%s_changed_callback) (GUPnPServiceProxy *proxy," % v.c_prefixed_name)
+ print("%s%s%s," % (indent, ctype, v.c_name))
+ print("%sgpointer userdata);" % indent)
+ print("")
# private callback
indent = (20 + len (v.c_prefixed_name)) * " "
- print "static void"
- print "_%s_changed_callback (GUPnPServiceProxy *proxy," % v.c_prefixed_name
- print "%sconst gchar *variable," % indent
- print "%sGValue *value," % indent
- print "%sgpointer userdata)" % indent
- print "{"
- print " GUPnPAsyncData *cbdata;"
- print " %s%s;" % (ctype, v.c_name)
- print
- print " cbdata = (GUPnPAsyncData *) userdata;"
- print " %s = %s (value);" % (v.c_name, v.get_function)
- print " ((%s_changed_callback)cbdata->cb)" % v.c_prefixed_name
- print " (proxy,"
- print " %s," % v.c_name
- print " cbdata->userdata);"
- print
- print " g_slice_free1 (sizeof (*cbdata), cbdata);"
- print "}"
- print
+ print("static void")
+ print("_%s_changed_callback (GUPnPServiceProxy *proxy," % v.c_prefixed_name)
+ print("%sconst gchar *variable," % indent)
+ print("%sGValue *value," % indent)
+ print("%sgpointer userdata)" % indent)
+ print("{")
+ print(" GUPnPAsyncData *cbdata;")
+ print(" %s%s;" % (ctype, v.c_name))
+ print("")
+ print(" cbdata = (GUPnPAsyncData *) userdata;")
+ print(" %s = %s (value);" % (v.c_name, v.get_function))
+ print(" ((%s_changed_callback)cbdata->cb)" % v.c_prefixed_name)
+ print(" (proxy,")
+ print(" %s," % v.c_name)
+ print(" cbdata->userdata);")
+ print("")
+ print(" g_slice_free1 (sizeof (*cbdata), cbdata);")
+ print("}")
+ print("")
# public notify_add function
indent = (13 + len (v.c_prefixed_name)) * " "
- print "static inline gboolean"
- print "%s_add_notify (GUPnPServiceProxy *proxy," % v.c_prefixed_name
- print "%s%s_changed_callback callback," % (indent, v.c_prefixed_name)
- print "%sgpointer userdata)" % indent
- print "{"
- print " GUPnPAsyncData *cbdata;"
- print
- print " cbdata = (GUPnPAsyncData *) g_slice_alloc (sizeof (*cbdata));"
- print " cbdata->cb = G_CALLBACK (callback);"
- print " cbdata->userdata = userdata;"
- print
- print " return gupnp_service_proxy_add_notify"
- print " (proxy,"
- print " \"%s\"," % v.name
- print " %s," % v.gtype
- print " _%s_changed_callback," % v.c_prefixed_name
- print " cbdata);"
- print "}"
+ print("static inline gboolean")
+ print("%s_add_notify (GUPnPServiceProxy *proxy," % v.c_prefixed_name)
+ print("%s%s_changed_callback callback," % (indent, v.c_prefixed_name))
+ print("%sgpointer userdata)" % indent)
+ print("{")
+ print(" GUPnPAsyncData *cbdata;")
+ print("")
+ print(" cbdata = (GUPnPAsyncData *) g_slice_alloc (sizeof (*cbdata));")
+ print(" cbdata->cb = G_CALLBACK (callback);")
+ print(" cbdata->userdata = userdata;")
+ print("")
+ print(" return gupnp_service_proxy_add_notify")
+ print(" (proxy,")
+ print(" \"%s\"," % v.name)
+ print(" %s," % v.gtype)
+ print(" _%s_changed_callback," % v.c_prefixed_name)
+ print(" cbdata);")
+ print("}")
def printServerVariableQueryBinding(v):
# User callback proto
indent = (28 + len (v.ctype)+ len (v.c_prefixed_name)) * " "
- print "typedef %s(*%s_query_callback) (GUPnPService *service," % (v.ctype, v.c_prefixed_name)
- print "%sgpointer userdata);" % indent
- print
+ print("typedef %s(*%s_query_callback) (GUPnPService *service," % (v.ctype, v.c_prefixed_name))
+ print("%sgpointer userdata);" % indent)
+ print("")
indent = (12 + len (v.c_prefixed_name)) * " "
- print "static void"
- print "_%s_query_cb (GUPnPService *service," % v.c_prefixed_name
- print "%sgchar *variable," % indent
- print "%sGValue *value," % indent
- print "%sgpointer userdata)" % indent
- print "{"
- print " GUPnPAsyncData *cbdata;"
- print " %s%s;" % (v.ctype, v.c_name)
- print
+ print("static void")
+ print("_%s_query_cb (GUPnPService *service," % v.c_prefixed_name)
+ print("%sgchar *variable," % indent)
+ print("%sGValue *value," % indent)
+ print("%sgpointer userdata)" % indent)
+ print("{")
+ print(" GUPnPAsyncData *cbdata;")
+ print(" %s%s;" % (v.ctype, v.c_name))
+ print("")
indent = (36 + len (v.c_name) + len (v.c_prefixed_name)) * " "
- print " cbdata = (GUPnPAsyncData *) userdata;"
- print " %s = ((%s_query_callback)cbdata->cb) (service," % (v.c_name, v.c_prefixed_name)
- print "%scbdata->userdata);" % indent
- print " g_value_init (value, %s);" % v.gtype
- print " %s (value, %s);" % (v.set_function, v.c_name)
- print "}"
- print
+ print(" cbdata = (GUPnPAsyncData *) userdata;")
+ print(" %s = ((%s_query_callback)cbdata->cb) (service," % (v.c_name, v.c_prefixed_name))
+ print("%scbdata->userdata);" % indent)
+ print(" g_value_init (value, %s);" % v.gtype)
+ print(" %s (value, %s);" % (v.set_function, v.c_name))
+ print("}")
+ print("")
indent = (16 + len (v.c_prefixed_name)) * " "
- print "gulong"
- print "%s_query_connect (GUPnPService *service," % v.c_prefixed_name
- print "%s%s_query_callback callback," % (indent, v.c_prefixed_name)
- print "%sgpointer userdata)" % indent
- print "{"
- print " GUPnPAsyncData *cbdata;"
- print
- print " cbdata = (GUPnPAsyncData *) g_slice_alloc (sizeof (*cbdata));"
- print " cbdata->cb = G_CALLBACK (callback);"
- print " cbdata->userdata = userdata;"
- print
- print " return g_signal_connect_data (service,"
- print " \"query-variable::%s\"," % v.name
- print " G_CALLBACK (_%s_query_cb)," % v.c_prefixed_name
- print " cbdata,"
- print " _free_cb_data,"
- print " (GConnectFlags) 0);"
- print "}"
- print
+ print("gulong")
+ print("%s_query_connect (GUPnPService *service," % v.c_prefixed_name)
+ print("%s%s_query_callback callback," % (indent, v.c_prefixed_name))
+ print("%sgpointer userdata)" % indent)
+ print("{")
+ print(" GUPnPAsyncData *cbdata;")
+ print("")
+ print(" cbdata = (GUPnPAsyncData *) g_slice_alloc (sizeof (*cbdata));")
+ print(" cbdata->cb = G_CALLBACK (callback);")
+ print(" cbdata->userdata = userdata;")
+ print("")
+ print(" return g_signal_connect_data (service,")
+ print(" \"query-variable::%s\"," % v.name)
+ print(" G_CALLBACK (_%s_query_cb)," % v.c_prefixed_name)
+ print(" cbdata,")
+ print(" _free_cb_data,")
+ print(" (GConnectFlags) 0);")
+ print("}")
+ print("")
def printServerActionBinding(a):
# getter and setter func for GUPnPServiceAction
indent = (13 + len (a.c_prefixed_name)) * " "
if len (a.in_args) > 0:
- print "static inline void"
- print "%s_action_get (GUPnPServiceAction *action," % (a.c_prefixed_name)
+ print("static inline void")
+ print("%s_action_get (GUPnPServiceAction *action," % (a.c_prefixed_name))
for arg in a.in_args[:-1]:
- print "%s%s*in_%s," % (indent, arg.related_var.ctype, arg.c_name)
- print "%s%s*in_%s)" % (indent, a.in_args[-1].related_var.ctype, a.in_args[-1].c_name)
- print "{"
- print " gupnp_service_action_get (action,"
+ print("%s%s*in_%s," % (indent, arg.related_var.ctype, arg.c_name))
+ print("%s%s*in_%s)" % (indent, a.in_args[-1].related_var.ctype, a.in_args[-1].c_name))
+ print("{")
+ print(" gupnp_service_action_get (action,")
for arg in a.in_args:
- print " \"%s\", %s, in_%s," % (arg.name, arg.related_var.gtype, arg.c_name)
- print " NULL);"
- print "}"
- print
+ print(" \"%s\", %s, in_%s," % (arg.name, arg.related_var.gtype, arg.c_name))
+ print(" NULL);")
+ print("}")
+ print("")
if len (a.out_args) > 0:
- print "static inline void"
- print "%s_action_set (GUPnPServiceAction *action," % (a.c_prefixed_name)
+ print("static inline void")
+ print("%s_action_set (GUPnPServiceAction *action," % (a.c_prefixed_name))
for arg in a.out_args[:-1]:
- print "%sconst %sout_%s," % (indent, arg.related_var.ctype, arg.c_name)
- print "%sconst %sout_%s)" % (indent, a.out_args[-1].related_var.ctype, a.out_args[-1].c_name)
- print "{"
- print " gupnp_service_action_set (action,"
+ print("%sconst %sout_%s," % (indent, arg.related_var.ctype, arg.c_name))
+ print("%sconst %sout_%s)" % (indent, a.out_args[-1].related_var.ctype, a.out_args[-1].c_name))
+ print("{")
+ print(" gupnp_service_action_set (action,")
for arg in a.out_args:
- print " \"%s\", %s, out_%s," % (arg.name, arg.related_var.gtype, arg.c_name)
- print " NULL);"
- print "}"
- print
+ print(" \"%s\", %s, out_%s," % (arg.name, arg.related_var.gtype, arg.c_name))
+ print(" NULL);")
+ print("}")
+ print("")
indent = (17 + len (a.c_prefixed_name)) * " "
- print "static inline gulong"
- print "%s_action_connect (GUPnPService *service," % a.c_prefixed_name
- print "%sGCallback callback," % indent
- print "%sgpointer userdata)" % indent
- print "{"
- print " return g_signal_connect (service,"
- print " \"action-invoked::%s\"," % a.name
- print " callback,"
- print " userdata);"
- print "}"
- print
+ print("static inline gulong")
+ print("%s_action_connect (GUPnPService *service," % a.c_prefixed_name)
+ print("%sGCallback callback," % indent)
+ print("%sgpointer userdata)" % indent)
+ print("{")
+ print(" return g_signal_connect (service,")
+ print(" \"action-invoked::%s\"," % a.name)
+ print(" callback,")
+ print(" userdata);")
+ print("}")
+ print("")
def PrintServerVariableNotifyBinding(v):
indent = (18 + len (v.c_prefixed_name)) * " "
- print "void"
- print "%s_variable_notify (GUPnPService *service," % v.c_prefixed_name
- print "%sconst %s%s)" % (indent ,v.ctype, v.c_name)
- print "{"
- print " gupnp_service_notify (service,"
- print " \"%s\", %s, %s," % (v.name, v.gtype, v.c_name)
- print " NULL);"
- print "}"
- print
+ print("void")
+ print("%s_variable_notify (GUPnPService *service," % v.c_prefixed_name)
+ print("%sconst %s%s)" % (indent ,v.ctype, v.c_name))
+ print("{")
+ print(" gupnp_service_notify (service,")
+ print(" \"%s\", %s, %s," % (v.name, v.gtype, v.c_name))
+ print(" NULL);")
+ print("}")
+ print("")
def parseSCPD(scpd, prefix):
"""
@@ -441,74 +441,74 @@ def parseSCPD(scpd, prefix):
def printClientBindings(binding_name, actions, variables):
define = "GUPNP_GENERATED_CLIENT_BINDING_%s" % binding_name
- print "/* Generated by gupnp-binding-tool */"
- print
- print "#include "
- print
- print "#ifndef %s" % define
- print "#define %s" % define
- print
- print "G_BEGIN_DECLS"
-
- print "\n#ifndef __GUPNPASYNCDATA_TYPE__"
- print "#define __GUPNPASYNCDATA_TYPE__"
- print "typedef struct {GCallback cb; gpointer userdata; } GUPnPAsyncData;"
- print "#endif"
+ print("/* Generated by gupnp-binding-tool */")
+ print("")
+ print("#include ")
+ print("")
+ print("#ifndef %s" % define)
+ print("#define %s" % define)
+ print("")
+ print("G_BEGIN_DECLS")
+
+ print("\n#ifndef __GUPNPASYNCDATA_TYPE__")
+ print("#define __GUPNPASYNCDATA_TYPE__")
+ print("typedef struct {GCallback cb; gpointer userdata; } GUPnPAsyncData;")
+ print("#endif")
for a in actions:
- print "\n/* action %s */\n" % a.name
+ print("\n/* action %s */\n" % a.name)
printClientSyncActionBinding(a)
printClientAsyncActionBinding(a)
for v in variables:
if (not v.dummy) and v.notified:
- print "\n/* state variable %s */\n" % v.name
+ print("\n/* state variable %s */\n" % v.name)
printClientVariableNotifyBinding(v)
- print
- print "G_END_DECLS"
- print
- print "#endif /* %s */" % define
+ print("")
+ print("G_END_DECLS")
+ print("")
+ print("#endif /* %s */" % define)
def printServerBindings(binding_name, actions, variables):
define = "GUPNP_GENERATED_CLIENT_BINDING_%s" % binding_name
- print "/* Generated by gupnp-binding-tool */"
- print
- print "#include "
- print
- print "#ifndef %s" % define
- print "#define %s" % define
- print
- print "G_BEGIN_DECLS"
-
- print "\n#ifndef __GUPNPASYNCDATA_TYPE__"
- print "#define __GUPNPASYNCDATA_TYPE__"
- print "typedef struct {GCallback cb; gpointer userdata; } GUPnPAsyncData;"
- print "#endif"
-
- print "static void"
- print "_free_cb_data (gpointer data, GClosure *closure)"
- print "{"
- print " GUPnPAsyncData *cbdata = (GUPnPAsyncData *) data;"
- print " g_slice_free1 (sizeof (*cbdata), cbdata);"
- print "}"
- print
+ print("/* Generated by gupnp-binding-tool */")
+ print("")
+ print("#include ")
+ print("")
+ print("#ifndef %s" % define)
+ print("#define %s" % define)
+ print("")
+ print("G_BEGIN_DECLS")
+
+ print("\n#ifndef __GUPNPASYNCDATA_TYPE__")
+ print("#define __GUPNPASYNCDATA_TYPE__")
+ print("typedef struct {GCallback cb; gpointer userdata; } GUPnPAsyncData;")
+ print("#endif")
+
+ print("static void")
+ print("_free_cb_data (gpointer data, GClosure *closure)")
+ print("{")
+ print(" GUPnPAsyncData *cbdata = (GUPnPAsyncData *) data;")
+ print(" g_slice_free1 (sizeof (*cbdata), cbdata);")
+ print("}")
+ print("")
for a in actions:
- print "\n/* action %s */\n" % a.name
+ print("\n/* action %s */\n" % a.name)
printServerActionBinding(a)
for v in variables:
if not v.dummy:
- print "\n/* state variable %s */\n" % v.name
+ print("\n/* state variable %s */\n" % v.name)
printServerVariableQueryBinding(v)
if v.notified:
PrintServerVariableNotifyBinding(v)
- print
- print "G_END_DECLS"
- print
- print "#endif /* %s */" % define
+ print("")
+ print("G_END_DECLS")
+ print("")
+ print("#endif /* %s */" % define)
def main ():
diff --git a/vala/GUPnP-1.0.metadata b/vala/GUPnP-1.0.metadata
index 50f14b1..a8ab94c 100644
--- a/vala/GUPnP-1.0.metadata
+++ b/vala/GUPnP-1.0.metadata
@@ -28,6 +28,8 @@ ServiceProxy
.end_action_list skip
.send_action_hash skip
.send_action_list skip
+WhiteList
+ .entries skip
ControlError skip
control_error_quark skip
EventingError skip
diff --git a/vala/Makefile.in b/vala/Makefile.in
index 771f25f..e3e24d1 100644
--- a/vala/Makefile.in
+++ b/vala/Makefile.in
@@ -147,8 +147,6 @@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@
GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@
GTKDOC_MKPDF = @GTKDOC_MKPDF@
GTKDOC_REBASE = @GTKDOC_REBASE@
-GTest_CFLAGS = @GTest_CFLAGS@
-GTest_LIBS = @GTest_LIBS@
HAVE_NETLINK = @HAVE_NETLINK@
HTML_DIR = @HTML_DIR@
INSTALL = @INSTALL@
--
2.7.4