[gnio] Add accessors for family, type and protocol.
- From: Alexander Larsson <alexl src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnio] Add accessors for family, type and protocol.
- Date: Fri, 8 May 2009 07:54:40 -0400 (EDT)
commit e3726540e5490cc8ee95c3426266608fdef70195
Author: Alexander Larsson <alexl redhat com>
Date: Fri May 8 13:52:04 2009 +0200
Add accessors for family, type and protocol.
---
gio/gsocket.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
gio/gsocket.h | 3 +++
2 files changed, 58 insertions(+), 0 deletions(-)
diff --git a/gio/gsocket.c b/gio/gsocket.c
index 460f69b..d15a4a8 100644
--- a/gio/gsocket.c
+++ b/gio/gsocket.c
@@ -1114,6 +1114,61 @@ g_socket_set_listen_backlog (GSocket *socket,
}
/**
+ * g_socket_get_family:
+ * @socket: a #GSocket.
+ *
+ * Gets the socket family of the socket.
+ *
+ * Returns: a #GSocketFamily
+ *
+ * Since: 2.22
+ **/
+GSocketFamily
+g_socket_get_family (GSocket *socket)
+{
+ g_return_val_if_fail (G_IS_SOCKET (socket), G_SOCKET_FAMILY_INVALID);
+
+ return socket->priv->family;
+}
+
+/**
+ * g_socket_get_socket_type:
+ * @socket: a #GSocket.
+ *
+ * Gets the socket type of the socket.
+ *
+ * Returns: a #GSocketType
+ *
+ * Since: 2.22
+ **/
+GSocketType
+g_socket_get_socket_type (GSocket *socket)
+{
+ g_return_val_if_fail (G_IS_SOCKET (socket), G_SOCKET_TYPE_INVALID);
+
+ return socket->priv->type;
+}
+
+/**
+ * g_socket_get_socket_type:
+ * @socket: a #GSocket.
+ *
+ * Gets the socket protocol type name the socket was created with.
+ * This can be %NULL if the socket was created with a NULL protocol.
+ *
+ * Returns: a string, do not free
+ *
+ * Since: 2.22
+ **/
+const char *
+g_socket_get_socket_protocol (GSocket *socket)
+{
+ g_return_val_if_fail (G_IS_SOCKET (socket), NULL);
+
+ return socket->priv->protocol;
+}
+
+/**
* g_socket_get_fd:
* @socket: a #GSocket.
*
diff --git a/gio/gsocket.h b/gio/gsocket.h
index eec93c1..26b270e 100644
--- a/gio/gsocket.h
+++ b/gio/gsocket.h
@@ -151,6 +151,9 @@ GSocket * g_socket_new (GSocketFamily
GSocket * g_socket_new_from_fd (gint fd,
GError **error);
int g_socket_get_fd (GSocket *socket);
+GSocketFamily g_socket_get_family (GSocket *socket);
+GSocketType g_socket_get_socket_type (GSocket *socket);
+const char * g_socket_get_socket_protocol (GSocket *socket);
GSocketAddress * g_socket_get_local_address (GSocket *socket,
GError **error);
GSocketAddress * g_socket_get_remote_address (GSocket *socket,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]