[Telepathy-commits] [telepathy-salut/master] add salut_tube_stream_get_supported_socket_types

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Fri Feb 6 03:14:58 PST 2009


---
 src/tube-stream.c |   43 +++++++++++++++++++++++++++++++++++++++++++
 src/tube-stream.h |    2 ++
 2 files changed, 45 insertions(+), 0 deletions(-)

diff --git a/src/tube-stream.c b/src/tube-stream.c
index 1c3ea6e..b384f6e 100644
--- a/src/tube-stream.c
+++ b/src/tube-stream.c
@@ -2416,6 +2416,49 @@ salut_tube_stream_get_interfaces (TpSvcChannel *iface,
     }
 }
 
+static void
+destroy_socket_control_list (gpointer data)
+{
+  GArray *tab = data;
+  g_array_free (tab, TRUE);
+}
+
+GHashTable *
+salut_tube_stream_get_supported_socket_types (void)
+{
+  GHashTable *ret;
+  GArray *unix_tab, *ipv4_tab, *ipv6_tab;
+  TpSocketAccessControl access_control;
+
+  ret = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL,
+      destroy_socket_control_list);
+
+  /* Socket_Address_Type_Unix */
+  unix_tab = g_array_sized_new (FALSE, FALSE, sizeof (TpSocketAccessControl),
+      1);
+  access_control = TP_SOCKET_ACCESS_CONTROL_LOCALHOST;
+  g_array_append_val (unix_tab, access_control);
+  g_hash_table_insert (ret, GUINT_TO_POINTER (TP_SOCKET_ADDRESS_TYPE_UNIX),
+      unix_tab);
+
+  /* Socket_Address_Type_IPv4 */
+  ipv4_tab = g_array_sized_new (FALSE, FALSE, sizeof (TpSocketAccessControl),
+      1);
+  access_control = TP_SOCKET_ACCESS_CONTROL_LOCALHOST;
+  g_array_append_val (ipv4_tab, access_control);
+  g_hash_table_insert (ret, GUINT_TO_POINTER (TP_SOCKET_ADDRESS_TYPE_IPV4),
+      ipv4_tab);
+
+  /* Socket_Address_Type_IPv6 */
+  ipv6_tab = g_array_sized_new (FALSE, FALSE, sizeof (TpSocketAccessControl),
+      1);
+  access_control = TP_SOCKET_ACCESS_CONTROL_LOCALHOST;
+  g_array_append_val (ipv6_tab, access_control);
+  g_hash_table_insert (ret, GUINT_TO_POINTER (TP_SOCKET_ADDRESS_TYPE_IPV6),
+      ipv6_tab);
+
+  return ret;
+}
 
 static void
 tube_iface_init (gpointer g_iface,
diff --git a/src/tube-stream.h b/src/tube-stream.h
index 23267dc..2243ca0 100644
--- a/src/tube-stream.h
+++ b/src/tube-stream.h
@@ -75,6 +75,8 @@ gboolean salut_tube_stream_check_params (TpSocketAddressType address_type,
     const GValue *address, TpSocketAccessControl access_control,
     const GValue *access_control_param, GError **error);
 
+GHashTable * salut_tube_stream_get_supported_socket_types (void);
+
 G_END_DECLS
 
 #endif /* #ifndef __SALUT_TUBE_STREAM_H__ */
-- 
1.5.6.5




More information about the telepathy-commits mailing list