[gnio] Add get_local/remote_address to GSocketConnection



commit 8c64ba6a3605746441e56635bd178ec98d639d71
Author: Alexander Larsson <alexl redhat com>
Date:   Fri May 15 12:43:55 2009 +0200

    Add get_local/remote_address to GSocketConnection
---
 gio/gsocketconnection.c |   36 ++++++++++++++++++++++++++++++++++++
 gio/gsocketconnection.h |    5 ++++-
 2 files changed, 40 insertions(+), 1 deletions(-)

diff --git a/gio/gsocketconnection.c b/gio/gsocketconnection.c
index df9eb0d..9e7ea5d 100644
--- a/gio/gsocketconnection.c
+++ b/gio/gsocketconnection.c
@@ -118,6 +118,42 @@ g_socket_connection_get_socket (GSocketConnection *connection)
   return connection->priv->socket;
 }
 
+/**
+ * g_socket_connection_get_local_address:
+ * @connection: a #GSocketConnection.
+ * @error: #GError for error reporting, or %NULL to ignore.
+ *
+ * Try to get the local address of a socket connection.
+ *
+ * Returns: a #GSocketAddress or %NULL on error.
+ *
+ * Since: 2.22
+ **/
+GSocketAddress *
+g_socket_connection_get_local_address (GSocketConnection  *connection,
+				       GError  **error)
+{
+  return g_socket_get_local_address (connection->priv->socket, error);
+}
+
+/**
+ * g_socket_connection_get_remote_address:
+ * @connection: a #GSocketConnection.
+ * @error: #GError for error reporting, or %NULL to ignore.
+ *
+ * Try to get the remove address of a socket connection.
+ *
+ * Returns: a #GSocketAddress or %NULL on error.
+ *
+ * Since: 2.22
+ **/
+GSocketAddress *
+g_socket_connection_get_remote_address (GSocketConnection  *connection,
+					GError  **error)
+{
+  return g_socket_get_remote_address (connection->priv->socket, error);
+}
+
 static void
 g_socket_connection_get_property (GObject *object, guint prop_id,
                                   GValue *value, GParamSpec *pspec)
diff --git a/gio/gsocketconnection.h b/gio/gsocketconnection.h
index a3c3809..4dc0fd5 100644
--- a/gio/gsocketconnection.h
+++ b/gio/gsocketconnection.h
@@ -73,7 +73,10 @@ struct _GSocketConnection
 GType              g_socket_connection_get_type                  (void);
 
 GSocket           *g_socket_connection_get_socket                (GSocketConnection *connection);
-
+GSocketAddress    *g_socket_connection_get_local_address         (GSocketConnection *connection,
+								  GError                 **error);
+GSocketAddress    *g_socket_connection_get_remote_address        (GSocketConnection *connection,
+								  GError                 **error);
 void               g_socket_connection_factory_register_type     (GType          g_type,
 								  GSocketFamily  family,
 								  GSocketType    type,



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