[gssdp] client: Fix missing network mask
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gssdp] client: Fix missing network mask
- Date: Mon, 19 Nov 2018 22:53:20 +0000 (UTC)
commit 284810cdda875b2a6e9b8047329c55193f692c37
Author: Jens Georg <mail jensge org>
Date: Mon Nov 19 23:47:26 2018 +0100
client: Fix missing network mask
Make it possible to set a mask on construction. If not passed, run
get_host_ip for filling it
libgssdp/gssdp-client.c | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
---
diff --git a/libgssdp/gssdp-client.c b/libgssdp/gssdp-client.c
index c494a5c..a06c974 100644
--- a/libgssdp/gssdp-client.c
+++ b/libgssdp/gssdp-client.c
@@ -121,6 +121,7 @@ enum {
PROP_IFACE,
PROP_NETWORK,
PROP_HOST_IP,
+ PROP_HOST_MASK,
PROP_ACTIVE,
PROP_SOCKET_TTL,
PROP_MSEARCH_PORT,
@@ -347,6 +348,9 @@ gssdp_client_set_property (GObject *object,
}
break;
}
+ case PROP_HOST_MASK:
+ priv->device.host_mask = g_value_dup_object (value);
+ break;
case PROP_ACTIVE:
priv->active = g_value_get_boolean (value);
break;
@@ -488,6 +492,23 @@ gssdp_client_class_init (GSSDPClientClass *klass)
G_PARAM_STATIC_NICK |
G_PARAM_STATIC_BLURB));
+ /**
+ * GSSDPClient:host-mask:
+ *
+ * The network mask of the assoicated network interface.
+ **/
+ g_object_class_install_property
+ (object_class,
+ PROP_HOST_MASK,
+ g_param_spec_object ("host-mask",
+ "Host network mask",
+ "The IP netmask of the associated"
+ "network interface",
+ G_TYPE_INET_ADDRESS_MASK,
+ G_PARAM_WRITABLE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS));
+
/**
* GSSDPClient:active:
*
@@ -1514,7 +1535,8 @@ init_network_info (GSSDPClient *client, GError **error)
* interface.
*/
if (priv->device.iface_name == NULL ||
- priv->device.host_addr == NULL)
+ priv->device.host_addr == NULL ||
+ priv->device.host_mask == NULL)
gssdp_net_get_host_ip (&(priv->device));
else {
/* Ugly. Ideally, get_host_ip needs to be run everytime, but
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]