[gssdp] client: Add new accessors
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gssdp] client: Add new accessors
- Date: Thu, 1 Nov 2018 11:35:52 +0000 (UTC)
commit e32a3324feedacbb5a3a8356a82ab5041eec2059
Author: Jens Georg <mail jensge org>
Date: Thu Nov 1 08:57:33 2018 +0100
client: Add new accessors
libgssdp/gssdp-client.c | 39 +++++++++++++++++++++++++++++++++++++++
libgssdp/gssdp-client.h | 10 ++++++++++
2 files changed, 49 insertions(+)
---
diff --git a/libgssdp/gssdp-client.c b/libgssdp/gssdp-client.c
index 5b28ebc..da58a30 100644
--- a/libgssdp/gssdp-client.c
+++ b/libgssdp/gssdp-client.c
@@ -925,6 +925,45 @@ gssdp_client_clear_headers (GSSDPClient *client)
(GDestroyNotify) header_field_free);
}
+/**
+ * gssdp_client_get_address:
+ * @client: A #GSSDPClient
+ *
+ * Returns: (transfer full): The #GInetAddress this client works on
+ **/
+GInetAddress *
+gssdp_client_get_address (GSSDPClient *client)
+{
+ g_return_val_if_fail (GSSDP_IS_CLIENT (client), NULL);
+ GSSDPClientPrivate *priv = gssdp_client_get_instance_private (client);
+
+ return g_object_ref (priv->device.host_addr);
+}
+
+/**
+ * gssdp_client_get_index:
+ * @client: A #GSSDPClient
+ *
+ * Returns: The interface index of this client
+ **/
+guint
+gssdp_client_get_index (GSSDPClient *client)
+{
+ g_return_val_if_fail (GSSDP_IS_CLIENT (client), 0);
+ GSSDPClientPrivate *priv = gssdp_client_get_instance_private (client);
+
+ return priv->device.index;
+}
+
+GSocketFamily
+gssdp_client_get_family (GSSDPClient *client)
+{
+ g_return_val_if_fail (GSSDP_IS_CLIENT (client), G_SOCKET_FAMILY_INVALID);
+ GSSDPClientPrivate *priv = gssdp_client_get_instance_private (client);
+
+ return g_inet_address_get_family (priv->device.host_addr);
+}
+
/**
* _gssdp_client_send_message:
* @client: A #GSSDPClient
diff --git a/libgssdp/gssdp-client.h b/libgssdp/gssdp-client.h
index c460a20..e4da9af 100644
--- a/libgssdp/gssdp-client.h
+++ b/libgssdp/gssdp-client.h
@@ -23,6 +23,7 @@
#define GSSDP_CLIENT_H
#include <glib-object.h>
+#include <gio/gio.h>
G_BEGIN_DECLS
@@ -75,6 +76,15 @@ gssdp_client_get_network (GSSDPClient *client);
gboolean
gssdp_client_get_active (GSSDPClient *client);
+GInetAddress *
+gssdp_client_get_address (GSSDPClient *client);
+
+guint
+gssdp_client_get_index (GSSDPClient *client);
+
+GSocketFamily
+gssdp_client_get_family (GSSDPClient *client);
+
void
gssdp_client_append_header (GSSDPClient *client,
const char *name,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]