1 /* GDBus - GLib D-Bus Library
3 * Copyright (C) 2008-2010 Red Hat, Inc.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General
16 * Public License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18 * Boston, MA 02111-1307, USA.
20 * Author: David Zeuthen <davidz@redhat.com>
37 #include "gdbusaddress.h"
38 #include "gdbusutils.h"
39 #include "gdbusconnection.h"
40 #include "gdbusserver.h"
41 #include "gioenumtypes.h"
42 #include "gdbusprivate.h"
43 #include "gdbusauthobserver.h"
44 #include "gio-marshal.h"
45 #include "ginitable.h"
46 #include "gsocketservice.h"
47 #include "gthreadedsocketservice.h"
48 #include "gresolver.h"
49 #include "ginetaddress.h"
50 #include "ginetsocketaddress.h"
51 #include "ginputstream.h"
52 #include "giostream.h"
55 #include "gunixsocketaddress.h"
62 * @short_description: Helper for accepting connections
65 * #GDBusServer is a helper for listening to and accepting D-Bus
68 * <example id="gdbus-peer-to-peer"><title>D-Bus peer-to-peer example</title><programlisting><xi:include xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" href="../../../../gio/tests/gdbus-example-peer.c"><xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting></example>
74 * The #GDBusServer structure contains only private data and
75 * should only be accessed using the provided API.
82 GObject parent_instance;
84 GDBusServerFlags flags;
91 gchar *client_address;
93 GSocketListener *listener;
94 gboolean is_using_listener;
95 gulong run_signal_handler_id;
97 /* The result of g_main_context_get_thread_default() when the object
98 * was created (the GObject _init() function) - this is used for delivery
99 * of the :new-connection GObject signal.
101 GMainContext *main_context_at_construction;
105 GDBusAuthObserver *authentication_observer;
108 typedef struct _GDBusServerClass GDBusServerClass;
112 * @new_connection: Signal class handler for the #GDBusServer::new-connection signal.
114 * Class structure for #GDBusServer.
118 struct _GDBusServerClass
121 GObjectClass parent_class;
125 gboolean (*new_connection) (GDBusServer *server,
126 GDBusConnection *connection);
137 PROP_AUTHENTICATION_OBSERVER,
142 NEW_CONNECTION_SIGNAL,
146 guint _signals[LAST_SIGNAL] = {0};
148 static void initable_iface_init (GInitableIface *initable_iface);
150 G_DEFINE_TYPE_WITH_CODE (GDBusServer, g_dbus_server, G_TYPE_OBJECT,
151 G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, initable_iface_init)
155 g_dbus_server_finalize (GObject *object)
157 GDBusServer *server = G_DBUS_SERVER (object);
159 if (server->authentication_observer != NULL)
160 g_object_unref (server->authentication_observer);
162 if (server->run_signal_handler_id > 0)
163 g_signal_handler_disconnect (server->listener, server->run_signal_handler_id);
165 if (server->listener != NULL)
166 g_object_unref (server->listener);
168 g_free (server->address);
169 g_free (server->guid);
170 g_free (server->client_address);
171 if (server->nonce != NULL)
173 memset (server->nonce, '\0', 16);
174 g_free (server->nonce);
176 /* we could unlink the nonce file but I don't
177 * think it's really worth the effort/risk
179 g_free (server->nonce_file);
181 if (server->main_context_at_construction != NULL)
182 g_main_context_unref (server->main_context_at_construction);
184 G_OBJECT_CLASS (g_dbus_server_parent_class)->finalize (object);
188 g_dbus_server_get_property (GObject *object,
193 GDBusServer *server = G_DBUS_SERVER (object);
198 g_value_set_flags (value, server->flags);
202 g_value_set_string (value, server->guid);
206 g_value_set_string (value, server->address);
209 case PROP_CLIENT_ADDRESS:
210 g_value_set_string (value, server->client_address);
214 g_value_set_boolean (value, server->active);
217 case PROP_AUTHENTICATION_OBSERVER:
218 g_value_set_object (value, server->authentication_observer);
222 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
228 g_dbus_server_set_property (GObject *object,
233 GDBusServer *server = G_DBUS_SERVER (object);
238 server->flags = g_value_get_flags (value);
242 server->guid = g_value_dup_string (value);
246 server->address = g_value_dup_string (value);
249 case PROP_AUTHENTICATION_OBSERVER:
250 server->authentication_observer = g_value_dup_object (value);
254 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
260 g_dbus_server_class_init (GDBusServerClass *klass)
262 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
264 gobject_class->finalize = g_dbus_server_finalize;
265 gobject_class->set_property = g_dbus_server_set_property;
266 gobject_class->get_property = g_dbus_server_get_property;
271 * Flags from the #GDBusServerFlags enumeration.
275 g_object_class_install_property (gobject_class,
277 g_param_spec_flags ("flags",
279 P_("Flags for the server"),
280 G_TYPE_DBUS_SERVER_FLAGS,
281 G_DBUS_SERVER_FLAGS_NONE,
284 G_PARAM_CONSTRUCT_ONLY |
285 G_PARAM_STATIC_NAME |
286 G_PARAM_STATIC_BLURB |
287 G_PARAM_STATIC_NICK));
292 * The guid of the server.
296 g_object_class_install_property (gobject_class,
298 g_param_spec_string ("guid",
300 P_("The guid of the server"),
304 G_PARAM_CONSTRUCT_ONLY |
305 G_PARAM_STATIC_NAME |
306 G_PARAM_STATIC_BLURB |
307 G_PARAM_STATIC_NICK));
310 * GDBusServer:address:
312 * The D-Bus address to listen on.
316 g_object_class_install_property (gobject_class,
318 g_param_spec_string ("address",
320 P_("The address to listen on"),
324 G_PARAM_CONSTRUCT_ONLY |
325 G_PARAM_STATIC_NAME |
326 G_PARAM_STATIC_BLURB |
327 G_PARAM_STATIC_NICK));
330 * GDBusServer:client-address:
332 * The D-Bus address that clients can use.
336 g_object_class_install_property (gobject_class,
338 g_param_spec_string ("client-address",
339 P_("Client Address"),
340 P_("The address clients can use"),
343 G_PARAM_STATIC_NAME |
344 G_PARAM_STATIC_BLURB |
345 G_PARAM_STATIC_NICK));
348 * GDBusServer:active:
350 * Whether the server is currently active.
354 g_object_class_install_property (gobject_class,
356 g_param_spec_boolean ("active",
358 P_("Whether the server is currently active"),
361 G_PARAM_STATIC_NAME |
362 G_PARAM_STATIC_BLURB |
363 G_PARAM_STATIC_NICK));
366 * GDBusServer:authentication-observer:
368 * A #GDBusAuthObserver object to assist in the authentication process or %NULL.
372 g_object_class_install_property (gobject_class,
373 PROP_AUTHENTICATION_OBSERVER,
374 g_param_spec_object ("authentication-observer",
375 P_("Authentication Observer"),
376 P_("Object used to assist in the authentication process"),
377 G_TYPE_DBUS_AUTH_OBSERVER,
380 G_PARAM_CONSTRUCT_ONLY |
381 G_PARAM_STATIC_NAME |
382 G_PARAM_STATIC_BLURB |
383 G_PARAM_STATIC_NICK));
386 * GDBusServer::new-connection:
387 * @server: The #GDBusServer emitting the signal.
388 * @connection: A #GDBusConnection for the new connection.
390 * Emitted when a new authenticated connection has been made. Use
391 * g_dbus_connection_get_peer_credentials() to figure out what
392 * identity (if any), was authenticated.
394 * If you want to accept the connection, take a reference to the
395 * @connection object and return %TRUE. When you are done with the
396 * connection call g_dbus_connection_close() and give up your
397 * reference. Note that the other peer may disconnect at any time -
398 * a typical thing to do when accepting a connection is to listen to
399 * the #GDBusConnection::closed signal.
401 * If #GDBusServer:flags contains %G_DBUS_SERVER_FLAGS_RUN_IN_THREAD
402 * then the signal is emitted in a new thread dedicated to the
403 * connection. Otherwise the signal is emitted in the <link
404 * linkend="g-main-context-push-thread-default">thread-default main
405 * loop</link> of the thread that @server was constructed in.
407 * You are guaranteed that signal handlers for this signal runs
408 * before incoming messages on @connection are processed. This means
409 * that it's suitable to call g_dbus_connection_register_object() or
410 * similar from the signal handler.
412 * Returns: %TRUE to claim @connection, %FALSE to let other handlers
417 _signals[NEW_CONNECTION_SIGNAL] = g_signal_new ("new-connection",
420 G_STRUCT_OFFSET (GDBusServerClass, new_connection),
421 g_signal_accumulator_true_handled,
422 NULL, /* accu_data */
423 _gio_marshal_BOOLEAN__OBJECT,
426 G_TYPE_DBUS_CONNECTION);
430 g_dbus_server_init (GDBusServer *server)
432 server->main_context_at_construction = g_main_context_get_thread_default ();
433 if (server->main_context_at_construction != NULL)
434 g_main_context_ref (server->main_context_at_construction);
438 on_run (GSocketService *service,
439 GSocketConnection *socket_connection,
440 GObject *source_object,
444 * g_dbus_server_new_sync:
445 * @address: A D-Bus address.
446 * @flags: Flags from the #GDBusServerFlags enumeration.
447 * @guid: A D-Bus GUID.
448 * @observer: A #GDBusAuthObserver or %NULL.
449 * @cancellable: A #GCancellable or %NULL.
450 * @error: Return location for server or %NULL.
452 * Creates a new D-Bus server that listens on the first address in
453 * @address that works.
455 * Once constructed, you can use g_dbus_server_get_client_address() to
456 * get a D-Bus address string that clients can use to connect.
458 * Connect to the #GDBusServer::new-connection signal to handle
459 * incoming connections.
461 * The returned #GDBusServer isn't active - you have to start it with
462 * g_dbus_server_start().
464 * See <xref linkend="gdbus-peer-to-peer"/> for how #GDBusServer can
467 * This is a synchronous failable constructor. See
468 * g_dbus_server_new() for the asynchronous version.
470 * Returns: A #GDBusServer or %NULL if @error is set. Free with
476 g_dbus_server_new_sync (const gchar *address,
477 GDBusServerFlags flags,
479 GDBusAuthObserver *observer,
480 GCancellable *cancellable,
485 g_return_val_if_fail (address != NULL, NULL);
486 g_return_val_if_fail (g_dbus_is_guid (guid), NULL);
487 g_return_val_if_fail (error == NULL || *error == NULL, NULL);
489 server = g_initable_new (G_TYPE_DBUS_SERVER,
495 "authentication-observer", observer,
502 * g_dbus_server_get_client_address:
503 * @server: A #GDBusServer.
505 * Gets a D-Bus address string that can be used by clients to connect
508 * Returns: A D-Bus address string. Do not free, the string is owned
514 g_dbus_server_get_client_address (GDBusServer *server)
516 g_return_val_if_fail (G_IS_DBUS_SERVER (server), NULL);
517 return server->client_address;
521 * g_dbus_server_get_guid:
522 * @server: A #GDBusServer.
524 * Gets the GUID for @server.
526 * Returns: A D-Bus GUID. Do not free this string, it is owned by @server.
531 g_dbus_server_get_guid (GDBusServer *server)
533 g_return_val_if_fail (G_IS_DBUS_SERVER (server), NULL);
538 * g_dbus_server_get_flags:
539 * @server: A #GDBusServer.
541 * Gets the flags for @server.
543 * Returns: A set of flags from the #GDBusServerFlags enumeration.
548 g_dbus_server_get_flags (GDBusServer *server)
550 g_return_val_if_fail (G_IS_DBUS_SERVER (server), G_DBUS_SERVER_FLAGS_NONE);
551 return server->flags;
555 * g_dbus_server_is_active:
556 * @server: A #GDBusServer.
558 * Gets whether @server is active.
560 * Returns: %TRUE if server is active, %FALSE otherwise.
565 g_dbus_server_is_active (GDBusServer *server)
567 g_return_val_if_fail (G_IS_DBUS_SERVER (server), G_DBUS_SERVER_FLAGS_NONE);
568 return server->active;
572 * g_dbus_server_start:
573 * @server: A #GDBusServer.
580 g_dbus_server_start (GDBusServer *server)
582 g_return_if_fail (G_IS_DBUS_SERVER (server));
585 /* Right now we don't have any transport not using the listener... */
586 g_assert (server->is_using_listener);
587 g_socket_service_start (G_SOCKET_SERVICE (server->listener));
588 server->active = TRUE;
589 g_object_notify (G_OBJECT (server), "active");
593 * g_dbus_server_stop:
594 * @server: A #GDBusServer.
601 g_dbus_server_stop (GDBusServer *server)
603 g_return_if_fail (G_IS_DBUS_SERVER (server));
606 /* Right now we don't have any transport not using the listener... */
607 g_assert (server->is_using_listener);
608 g_assert (server->run_signal_handler_id > 0);
609 g_signal_handler_disconnect (server->listener, server->run_signal_handler_id);
610 server->run_signal_handler_id = 0;
611 g_socket_service_stop (G_SOCKET_SERVICE (server->listener));
612 server->active = FALSE;
613 g_object_notify (G_OBJECT (server), "active");
616 /* ---------------------------------------------------------------------------------------------------- */
624 ret = g_random_int_range (0, 60);
634 /* note that address_entry has already been validated => exactly one of path, tmpdir or abstract keys are set */
636 try_unix (GDBusServer *server,
637 const gchar *address_entry,
638 GHashTable *key_value_pairs,
644 const gchar *abstract;
645 GSocketAddress *address;
650 path = g_hash_table_lookup (key_value_pairs, "path");
651 tmpdir = g_hash_table_lookup (key_value_pairs, "tmpdir");
652 abstract = g_hash_table_lookup (key_value_pairs, "abstract");
656 address = g_unix_socket_address_new (path);
658 else if (tmpdir != NULL)
665 s = g_string_new (tmpdir);
666 g_string_append (s, "/dbus-");
667 for (n = 0; n < 8; n++)
668 g_string_append_c (s, random_ascii ());
670 /* prefer abstract namespace if available */
671 if (g_unix_socket_address_abstract_names_supported ())
672 address = g_unix_socket_address_new_with_type (s->str,
674 G_UNIX_SOCKET_ADDRESS_ABSTRACT);
676 address = g_unix_socket_address_new (s->str);
677 g_string_free (s, TRUE);
680 if (!g_socket_listener_add_address (server->listener,
682 G_SOCKET_TYPE_STREAM,
683 G_SOCKET_PROTOCOL_DEFAULT,
684 NULL, /* source_object */
685 NULL, /* effective_address */
688 if (local_error->domain == G_IO_ERROR && local_error->code == G_IO_ERROR_ADDRESS_IN_USE)
690 g_error_free (local_error);
693 g_propagate_error (error, local_error);
699 else if (abstract != NULL)
701 if (!g_unix_socket_address_abstract_names_supported ())
703 g_set_error_literal (error,
705 G_IO_ERROR_NOT_SUPPORTED,
706 _("Abstract name space not supported"));
709 address = g_unix_socket_address_new_with_type (abstract,
711 G_UNIX_SOCKET_ADDRESS_ABSTRACT);
715 g_assert_not_reached ();
718 if (!g_socket_listener_add_address (server->listener,
720 G_SOCKET_TYPE_STREAM,
721 G_SOCKET_PROTOCOL_DEFAULT,
722 NULL, /* source_object */
723 NULL, /* effective_address */
733 /* Fill out client_address if the connection attempt worked */
736 server->is_using_listener = TRUE;
738 switch (g_unix_socket_address_get_address_type (G_UNIX_SOCKET_ADDRESS (address)))
740 case G_UNIX_SOCKET_ADDRESS_ABSTRACT:
741 server->client_address = g_strdup_printf ("unix:abstract=%s",
742 g_unix_socket_address_get_path (G_UNIX_SOCKET_ADDRESS (address)));
745 case G_UNIX_SOCKET_ADDRESS_PATH:
746 server->client_address = g_strdup_printf ("unix:path=%s",
747 g_unix_socket_address_get_path (G_UNIX_SOCKET_ADDRESS (address)));
751 g_assert_not_reached ();
755 g_object_unref (address);
761 /* ---------------------------------------------------------------------------------------------------- */
763 /* note that address_entry has already been validated =>
764 * both host and port (guranteed to be a number in [0, 65535]) are set (family is optional)
767 try_tcp (GDBusServer *server,
768 const gchar *address_entry,
769 GHashTable *key_value_pairs,
778 GList *resolved_addresses;
783 resolved_addresses = NULL;
785 host = g_hash_table_lookup (key_value_pairs, "host");
786 port = g_hash_table_lookup (key_value_pairs, "port");
787 /* family = g_hash_table_lookup (key_value_pairs, "family"); */
788 if (g_hash_table_lookup (key_value_pairs, "noncefile") != NULL)
790 g_set_error_literal (error,
792 G_IO_ERROR_INVALID_ARGUMENT,
793 _("Cannot specify nonce file when creating a server"));
801 port_num = strtol (port, NULL, 10);
803 resolver = g_resolver_get_default ();
804 resolved_addresses = g_resolver_lookup_by_name (resolver,
808 if (resolved_addresses == NULL)
811 /* TODO: handle family */
812 for (l = resolved_addresses; l != NULL; l = l->next)
814 GInetAddress *address = G_INET_ADDRESS (l->data);
815 GSocketAddress *socket_address;
816 GSocketAddress *effective_address;
818 socket_address = g_inet_socket_address_new (address, port_num);
819 if (!g_socket_listener_add_address (server->listener,
821 G_SOCKET_TYPE_STREAM,
822 G_SOCKET_PROTOCOL_TCP,
823 NULL, /* GObject *source_object */
827 g_object_unref (socket_address);
831 /* make sure we allocate the same port number for other listeners */
832 port_num = g_inet_socket_address_get_port (G_INET_SOCKET_ADDRESS (effective_address));
834 g_object_unref (effective_address);
835 g_object_unref (socket_address);
843 gsize bytes_remaining;
845 server->nonce = g_new0 (guchar, 16);
846 for (n = 0; n < 16; n++)
847 server->nonce[n] = g_random_int_range (0, 256);
848 fd = g_file_open_tmp ("gdbus-nonce-file-XXXXXX",
853 g_socket_listener_close (server->listener);
858 bytes_remaining = 16;
859 while (bytes_remaining > 0)
862 ret = write (fd, server->nonce + bytes_written, bytes_remaining);
869 g_io_error_from_errno (errno),
870 _("Error writing nonce file at `%s': %s"),
875 bytes_written += ret;
876 bytes_remaining -= ret;
879 server->client_address = g_strdup_printf ("nonce-tcp:host=%s,port=%d,noncefile=%s",
886 server->client_address = g_strdup_printf ("tcp:host=%s,port=%d", host, port_num);
888 server->is_using_listener = TRUE;
892 g_list_foreach (resolved_addresses, (GFunc) g_object_unref, NULL);
893 g_list_free (resolved_addresses);
894 g_object_unref (resolver);
898 /* ---------------------------------------------------------------------------------------------------- */
903 GDBusConnection *connection;
907 emit_idle_data_free (EmitIdleData *data)
909 g_object_unref (data->server);
910 g_object_unref (data->connection);
915 emit_new_connection_in_idle (gpointer user_data)
917 EmitIdleData *data = user_data;
921 g_signal_emit (data->server,
922 _signals[NEW_CONNECTION_SIGNAL],
928 g_dbus_connection_start_message_processing (data->connection);
929 g_object_unref (data->connection);
934 /* Called in new thread */
936 on_run (GSocketService *service,
937 GSocketConnection *socket_connection,
938 GObject *source_object,
941 GDBusServer *server = G_DBUS_SERVER (user_data);
942 GDBusConnection *connection;
943 GDBusConnectionFlags connection_flags;
945 if (server->nonce != NULL)
950 if (!g_input_stream_read_all (g_io_stream_get_input_stream (G_IO_STREAM (socket_connection)),
954 NULL, /* GCancellable */
958 if (bytes_read != 16)
961 if (memcmp (buf, server->nonce, 16) != 0)
966 G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER |
967 G_DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING;
968 if (server->flags & G_DBUS_SERVER_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS)
969 connection_flags |= G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS;
971 connection = g_dbus_connection_new_sync (G_IO_STREAM (socket_connection),
974 server->authentication_observer,
975 NULL, /* GCancellable */
977 if (connection == NULL)
980 if (server->flags & G_DBUS_SERVER_FLAGS_RUN_IN_THREAD)
985 g_signal_emit (server,
986 _signals[NEW_CONNECTION_SIGNAL],
991 g_dbus_connection_start_message_processing (connection);
992 g_object_unref (connection);
996 GSource *idle_source;
999 data = g_new0 (EmitIdleData, 1);
1000 data->server = g_object_ref (server);
1001 data->connection = g_object_ref (connection);
1003 idle_source = g_idle_source_new ();
1004 g_source_set_priority (idle_source, G_PRIORITY_DEFAULT);
1005 g_source_set_callback (idle_source,
1006 emit_new_connection_in_idle,
1008 (GDestroyNotify) emit_idle_data_free);
1009 g_source_attach (idle_source, server->main_context_at_construction);
1010 g_source_unref (idle_source);
1018 initable_init (GInitable *initable,
1019 GCancellable *cancellable,
1022 GDBusServer *server = G_DBUS_SERVER (initable);
1032 if (!g_dbus_is_guid (server->guid))
1034 g_set_error (&last_error,
1036 G_IO_ERROR_INVALID_ARGUMENT,
1037 _("The string `%s' is not a valid D-Bus GUID"),
1042 server->listener = G_SOCKET_LISTENER (g_threaded_socket_service_new (-1));
1044 addr_array = g_strsplit (server->address, ";", 0);
1046 for (n = 0; addr_array != NULL && addr_array[n] != NULL; n++)
1048 const gchar *address_entry = addr_array[n];
1049 GHashTable *key_value_pairs;
1050 gchar *transport_name;
1054 if (g_dbus_is_supported_address (address_entry,
1056 _g_dbus_address_parse_entry (address_entry,
1066 else if (g_strcmp0 (transport_name, "unix") == 0)
1067 ret = try_unix (server, address_entry, key_value_pairs, &this_error);
1069 else if (g_strcmp0 (transport_name, "tcp") == 0)
1070 ret = try_tcp (server, address_entry, key_value_pairs, FALSE, &this_error);
1071 else if (g_strcmp0 (transport_name, "nonce-tcp") == 0)
1072 ret = try_tcp (server, address_entry, key_value_pairs, TRUE, &this_error);
1074 g_set_error (&this_error,
1076 G_IO_ERROR_INVALID_ARGUMENT,
1077 _("Cannot listen on unsupported transport `%s'"),
1080 g_free (transport_name);
1081 if (key_value_pairs != NULL)
1082 g_hash_table_unref (key_value_pairs);
1086 g_assert (this_error == NULL);
1091 if (this_error != NULL)
1093 if (last_error != NULL)
1094 g_error_free (last_error);
1095 last_error = this_error;
1101 g_strfreev (addr_array);
1105 if (last_error != NULL)
1106 g_error_free (last_error);
1108 /* Right now we don't have any transport not using the listener... */
1109 g_assert (server->is_using_listener);
1110 server->run_signal_handler_id = g_signal_connect (G_SOCKET_SERVICE (server->listener),
1112 G_CALLBACK (on_run),
1117 g_assert (last_error != NULL);
1118 g_propagate_error (error, last_error);
1125 initable_iface_init (GInitableIface *initable_iface)
1127 initable_iface->init = initable_init;
1130 /* ---------------------------------------------------------------------------------------------------- */