diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2018-08-20 21:12:06 -0400 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2018-08-20 21:12:06 -0400 |
commit | 63e87c2d0c9d263f14c77b68f85c67d46ece82a9 (patch) | |
tree | 6260365cbf7d24f37d27669e8538227fcb72e243 /gtk+-mingw/share/gtk-doc/html/gio/GDBusServer.html | |
parent | a4460f6d9453bbd7e584937686449cef3e19f052 (diff) |
Diffstat (limited to 'gtk+-mingw/share/gtk-doc/html/gio/GDBusServer.html')
-rw-r--r-- | gtk+-mingw/share/gtk-doc/html/gio/GDBusServer.html | 797 |
1 files changed, 0 insertions, 797 deletions
diff --git a/gtk+-mingw/share/gtk-doc/html/gio/GDBusServer.html b/gtk+-mingw/share/gtk-doc/html/gio/GDBusServer.html deleted file mode 100644 index e6644b7..0000000 --- a/gtk+-mingw/share/gtk-doc/html/gio/GDBusServer.html +++ /dev/null @@ -1,797 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> -<html> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> -<title>GDBusServer</title> -<meta name="generator" content="DocBook XSL Stylesheets V1.76.1"> -<link rel="home" href="index.html" title="GIO Reference Manual"> -<link rel="up" href="gdbus-lowlevel.html" title="Lowlevel D-Bus Support"> -<link rel="prev" href="GDBusMethodInvocation.html" title="GDBusMethodInvocation"> -<link rel="next" href="GDBusAuthObserver.html" title="GDBusAuthObserver"> -<meta name="generator" content="GTK-Doc V1.18 (XML mode)"> -<link rel="stylesheet" href="style.css" type="text/css"> -</head> -<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> -<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"> -<tr valign="middle"> -<td><a accesskey="p" href="GDBusMethodInvocation.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td> -<td><a accesskey="u" href="gdbus-lowlevel.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td> -<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td> -<th width="100%" align="center">GIO Reference Manual</th> -<td><a accesskey="n" href="GDBusAuthObserver.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td> -</tr> -<tr><td colspan="5" class="shortcuts"> -<a href="#GDBusServer.synopsis" class="shortcut">Top</a> - | - <a href="#GDBusServer.description" class="shortcut">Description</a> - | - <a href="#GDBusServer.object-hierarchy" class="shortcut">Object Hierarchy</a> - | - <a href="#GDBusServer.implemented-interfaces" class="shortcut">Implemented Interfaces</a> - | - <a href="#GDBusServer.properties" class="shortcut">Properties</a> - | - <a href="#GDBusServer.signals" class="shortcut">Signals</a> -</td></tr> -</table> -<div class="refentry"> -<a name="GDBusServer"></a><div class="titlepage"></div> -<div class="refnamediv"><table width="100%"><tr> -<td valign="top"> -<h2><span class="refentrytitle"><a name="GDBusServer.top_of_page"></a>GDBusServer</span></h2> -<p>GDBusServer — Helper for accepting connections</p> -</td> -<td valign="top" align="right"></td> -</tr></table></div> -<div class="refsynopsisdiv"> -<a name="GDBusServer.synopsis"></a><h2>Synopsis</h2> -<a name="GDBusServerFlags"></a><pre class="synopsis"> -#include <gio/gio.h> - - <a class="link" href="GDBusServer.html#GDBusServer-struct" title="GDBusServer">GDBusServer</a>; -enum <a class="link" href="GDBusServer.html#GDBusServerFlags-enum" title="enum GDBusServerFlags">GDBusServerFlags</a>; -<a class="link" href="GDBusServer.html" title="GDBusServer"><span class="returnvalue">GDBusServer</span></a> * <a class="link" href="GDBusServer.html#g-dbus-server-new-sync" title="g_dbus_server_new_sync ()">g_dbus_server_new_sync</a> (<em class="parameter"><code>const <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *address</code></em>, - <em class="parameter"><code><a class="link" href="GDBusServer.html#GDBusServerFlags"><span class="type">GDBusServerFlags</span></a> flags</code></em>, - <em class="parameter"><code>const <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *guid</code></em>, - <em class="parameter"><code><a class="link" href="GDBusAuthObserver.html" title="GDBusAuthObserver"><span class="type">GDBusAuthObserver</span></a> *observer</code></em>, - <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>, - <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>); -<span class="returnvalue">void</span> <a class="link" href="GDBusServer.html#g-dbus-server-start" title="g_dbus_server_start ()">g_dbus_server_start</a> (<em class="parameter"><code><a class="link" href="GDBusServer.html" title="GDBusServer"><span class="type">GDBusServer</span></a> *server</code></em>); -<span class="returnvalue">void</span> <a class="link" href="GDBusServer.html#g-dbus-server-stop" title="g_dbus_server_stop ()">g_dbus_server_stop</a> (<em class="parameter"><code><a class="link" href="GDBusServer.html" title="GDBusServer"><span class="type">GDBusServer</span></a> *server</code></em>); -<a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="GDBusServer.html#g-dbus-server-is-active" title="g_dbus_server_is_active ()">g_dbus_server_is_active</a> (<em class="parameter"><code><a class="link" href="GDBusServer.html" title="GDBusServer"><span class="type">GDBusServer</span></a> *server</code></em>); -const <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> * <a class="link" href="GDBusServer.html#g-dbus-server-get-guid" title="g_dbus_server_get_guid ()">g_dbus_server_get_guid</a> (<em class="parameter"><code><a class="link" href="GDBusServer.html" title="GDBusServer"><span class="type">GDBusServer</span></a> *server</code></em>); -<a class="link" href="GDBusServer.html#GDBusServerFlags"><span class="returnvalue">GDBusServerFlags</span></a> <a class="link" href="GDBusServer.html#g-dbus-server-get-flags" title="g_dbus_server_get_flags ()">g_dbus_server_get_flags</a> (<em class="parameter"><code><a class="link" href="GDBusServer.html" title="GDBusServer"><span class="type">GDBusServer</span></a> *server</code></em>); -const <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> * <a class="link" href="GDBusServer.html#g-dbus-server-get-client-address" title="g_dbus_server_get_client_address ()">g_dbus_server_get_client_address</a> (<em class="parameter"><code><a class="link" href="GDBusServer.html" title="GDBusServer"><span class="type">GDBusServer</span></a> *server</code></em>); -</pre> -</div> -<div class="refsect1"> -<a name="GDBusServer.object-hierarchy"></a><h2>Object Hierarchy</h2> -<pre class="synopsis"> - <a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#GObject">GObject</a> - +----GDBusServer -</pre> -<pre class="synopsis"> - GFlags - +----GDBusServerFlags -</pre> -</div> -<div class="refsect1"> -<a name="GDBusServer.implemented-interfaces"></a><h2>Implemented Interfaces</h2> -<p> -GDBusServer implements - <a class="link" href="GInitable.html" title="GInitable">GInitable</a>.</p> -</div> -<div class="refsect1"> -<a name="GDBusServer.properties"></a><h2>Properties</h2> -<pre class="synopsis"> - "<a class="link" href="GDBusServer.html#GDBusServer--active" title='The "active" property'>active</a>" <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> : Read - "<a class="link" href="GDBusServer.html#GDBusServer--address" title='The "address" property'>address</a>" <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a>* : Read / Write / Construct Only - "<a class="link" href="GDBusServer.html#GDBusServer--authentication-observer" title='The "authentication-observer" property'>authentication-observer</a>" <a class="link" href="GDBusAuthObserver.html" title="GDBusAuthObserver"><span class="type">GDBusAuthObserver</span></a>* : Read / Write / Construct Only - "<a class="link" href="GDBusServer.html#GDBusServer--client-address" title='The "client-address" property'>client-address</a>" <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a>* : Read - "<a class="link" href="GDBusServer.html#GDBusServer--flags" title='The "flags" property'>flags</a>" <a class="link" href="GDBusServer.html#GDBusServerFlags"><span class="type">GDBusServerFlags</span></a> : Read / Write / Construct Only - "<a class="link" href="GDBusServer.html#GDBusServer--guid" title='The "guid" property'>guid</a>" <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a>* : Read / Write / Construct Only -</pre> -</div> -<div class="refsect1"> -<a name="GDBusServer.signals"></a><h2>Signals</h2> -<pre class="synopsis"> - "<a class="link" href="GDBusServer.html#GDBusServer-new-connection" title='The "new-connection" signal'>new-connection</a>" : <a href="./../gobject/gobject/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS"><code class="literal">Run Last</code></a> -</pre> -</div> -<div class="refsect1"> -<a name="GDBusServer.description"></a><h2>Description</h2> -<p> -<a class="link" href="GDBusServer.html" title="GDBusServer"><span class="type">GDBusServer</span></a> is a helper for listening to and accepting D-Bus -connections. This can be used to create a new D-Bus server, allowing two -peers to use the D-Bus protocol for their own specialized communication. -A server instance provided in this way will not perform message routing or -implement the org.freedesktop.DBus interface. -</p> -<p> -To just export an object on a well-known name on a message bus, such as the -session or system bus, you should instead use <a class="link" href="gio-Owning-Bus-Names.html#g-bus-own-name" title="g_bus_own_name ()"><code class="function">g_bus_own_name()</code></a>. -</p> -<p> -</p> -<div class="example"> -<a name="gdbus-peer-to-peer"></a><p class="title"><b>Example 6. D-Bus peer-to-peer example</b></p> -<div class="example-contents"><pre class="programlisting">/* - -Usage examples (modulo addresses / credentials). - -UNIX domain socket transport: - - Server: - $ ./gdbus-example-peer --server --address unix:abstract=myaddr - Server is listening at: unix:abstract=myaddr - Client connected. - Peer credentials: GCredentials:unix-user=500,unix-group=500,unix-process=13378 - Negotiated capabilities: unix-fd-passing=1 - Client said: Hey, it's 1273093080 already! - - Client: - $ ./gdbus-example-peer --address unix:abstract=myaddr - Connected. - Negotiated capabilities: unix-fd-passing=1 - Server said: You said 'Hey, it's 1273093080 already!'. KTHXBYE! - -Nonce-secured TCP transport on the same host: - - Server: - $ ./gdbus-example-peer --server --address nonce-tcp: - Server is listening at: nonce-tcp:host=localhost,port=43077,noncefile=/tmp/gdbus-nonce-file-X1ZNCV - Client connected. - Peer credentials: (no credentials received) - Negotiated capabilities: unix-fd-passing=0 - Client said: Hey, it's 1273093206 already! - - Client: - $ ./gdbus-example-peer -address nonce-tcp:host=localhost,port=43077,noncefile=/tmp/gdbus-nonce-file-X1ZNCV - Connected. - Negotiated capabilities: unix-fd-passing=0 - Server said: You said 'Hey, it's 1273093206 already!'. KTHXBYE! - -TCP transport on two different hosts with a shared home directory: - - Server: - host1 $ ./gdbus-example-peer --server --address tcp:host=0.0.0.0 - Server is listening at: tcp:host=0.0.0.0,port=46314 - Client connected. - Peer credentials: (no credentials received) - Negotiated capabilities: unix-fd-passing=0 - Client said: Hey, it's 1273093337 already! - - Client: - host2 $ ./gdbus-example-peer -a tcp:host=host1,port=46314 - Connected. - Negotiated capabilities: unix-fd-passing=0 - Server said: You said 'Hey, it's 1273093337 already!'. KTHXBYE! - -TCP transport on two different hosts without authentication: - - Server: - host1 $ ./gdbus-example-peer --server --address tcp:host=0.0.0.0 --allow-anonymous - Server is listening at: tcp:host=0.0.0.0,port=59556 - Client connected. - Peer credentials: (no credentials received) - Negotiated capabilities: unix-fd-passing=0 - Client said: Hey, it's 1273093652 already! - - Client: - host2 $ ./gdbus-example-peer -a tcp:host=host1,port=59556 - Connected. - Negotiated capabilities: unix-fd-passing=0 - Server said: You said 'Hey, it's 1273093652 already!'. KTHXBYE! - - */ - -#include <gio/gio.h> -#include <stdlib.h> - -/* ---------------------------------------------------------------------------------------------------- */ - -static GDBusNodeInfo *introspection_data = NULL; - -/* Introspection data for the service we are exporting */ -static const gchar introspection_xml[] = - "<node>" - " <interface name='org.gtk.GDBus.TestPeerInterface'>" - " <method name='HelloWorld'>" - " <arg type='s' name='greeting' direction='in'/>" - " <arg type='s' name='response' direction='out'/>" - " </method>" - " </interface>" - "</node>"; - -/* ---------------------------------------------------------------------------------------------------- */ - -static void -handle_method_call (GDBusConnection *connection, - const gchar *sender, - const gchar *object_path, - const gchar *interface_name, - const gchar *method_name, - GVariant *parameters, - GDBusMethodInvocation *invocation, - gpointer user_data) -{ - if (g_strcmp0 (method_name, "HelloWorld") == 0) - { - const gchar *greeting; - gchar *response; - - g_variant_get (parameters, "(&s)", &greeting); - response = g_strdup_printf ("You said '%s'. KTHXBYE!", greeting); - g_dbus_method_invocation_return_value (invocation, - g_variant_new ("(s)", response)); - g_free (response); - g_print ("Client said: %s\n", greeting); - } -} - -static const GDBusInterfaceVTable interface_vtable = -{ - handle_method_call, - NULL, - NULL, -}; - -/* ---------------------------------------------------------------------------------------------------- */ - -static gboolean -on_new_connection (GDBusServer *server, - GDBusConnection *connection, - gpointer user_data) -{ - guint registration_id; - GCredentials *credentials; - gchar *s; - - credentials = g_dbus_connection_get_peer_credentials (connection); - if (credentials == NULL) - s = g_strdup ("(no credentials received)"); - else - s = g_credentials_to_string (credentials); - - - g_print ("Client connected.\n" - "Peer credentials: %s\n" - "Negotiated capabilities: unix-fd-passing=%d\n", - s, - g_dbus_connection_get_capabilities (connection) & G_DBUS_CAPABILITY_FLAGS_UNIX_FD_PASSING); - - g_object_ref (connection); - registration_id = g_dbus_connection_register_object (connection, - "/org/gtk/GDBus/TestObject", - introspection_data->interfaces[0], - &interface_vtable, - NULL, /* user_data */ - NULL, /* user_data_free_func */ - NULL); /* GError** */ - g_assert (registration_id > 0); - - return TRUE; -} - -/* ---------------------------------------------------------------------------------------------------- */ - -int -main (int argc, char *argv[]) -{ - gint ret; - gboolean opt_server; - gchar *opt_address; - GOptionContext *opt_context; - gboolean opt_allow_anonymous; - GError *error; - GOptionEntry opt_entries[] = - { - { "server", 's', 0, G_OPTION_ARG_NONE, &opt_server, "Start a server instead of a client", NULL }, - { "address", 'a', 0, G_OPTION_ARG_STRING, &opt_address, "D-Bus address to use", NULL }, - { "allow-anonymous", 'n', 0, G_OPTION_ARG_NONE, &opt_allow_anonymous, "Allow anonymous authentication", NULL }, - { NULL} - }; - - ret = 1; - - g_type_init (); - - opt_address = NULL; - opt_server = FALSE; - opt_allow_anonymous = FALSE; - - opt_context = g_option_context_new ("peer-to-peer example"); - error = NULL; - g_option_context_add_main_entries (opt_context, opt_entries, NULL); - if (!g_option_context_parse (opt_context, &argc, &argv, &error)) - { - g_printerr ("Error parsing options: %s\n", error->message); - g_error_free (error); - goto out; - } - if (opt_address == NULL) - { - g_printerr ("Incorrect usage, try --help.\n"); - goto out; - } - if (!opt_server && opt_allow_anonymous) - { - g_printerr ("The --allow-anonymous option only makes sense when used with --server.\n"); - goto out; - } - - /* We are lazy here - we don't want to manually provide - * the introspection data structures - so we just build - * them from XML. - */ - introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL); - g_assert (introspection_data != NULL); - - if (opt_server) - { - GDBusServer *server; - gchar *guid; - GMainLoop *loop; - GDBusServerFlags server_flags; - - guid = g_dbus_generate_guid (); - - server_flags = G_DBUS_SERVER_FLAGS_NONE; - if (opt_allow_anonymous) - server_flags |= G_DBUS_SERVER_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS; - - error = NULL; - server = g_dbus_server_new_sync (opt_address, - server_flags, - guid, - NULL, /* GDBusAuthObserver */ - NULL, /* GCancellable */ - &error); - g_dbus_server_start (server); - g_free (guid); - - if (server == NULL) - { - g_printerr ("Error creating server at address %s: %s\n", opt_address, error->message); - g_error_free (error); - goto out; - } - g_print ("Server is listening at: %s\n", g_dbus_server_get_client_address (server)); - g_signal_connect (server, - "new-connection", - G_CALLBACK (on_new_connection), - NULL); - - loop = g_main_loop_new (NULL, FALSE); - g_main_loop_run (loop); - - g_object_unref (server); - g_main_loop_unref (loop); - } - else - { - GDBusConnection *connection; - const gchar *greeting_response; - GVariant *value; - gchar *greeting; - - error = NULL; - connection = g_dbus_connection_new_for_address_sync (opt_address, - G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT, - NULL, /* GDBusAuthObserver */ - NULL, /* GCancellable */ - &error); - if (connection == NULL) - { - g_printerr ("Error connecting to D-Bus address %s: %s\n", opt_address, error->message); - g_error_free (error); - goto out; - } - - g_print ("Connected.\n" - "Negotiated capabilities: unix-fd-passing=%d\n", - g_dbus_connection_get_capabilities (connection) & G_DBUS_CAPABILITY_FLAGS_UNIX_FD_PASSING); - - greeting = g_strdup_printf ("Hey, it's %" G_GUINT64_FORMAT " already!", (guint64) time (NULL)); - value = g_dbus_connection_call_sync (connection, - NULL, /* bus_name */ - "/org/gtk/GDBus/TestObject", - "org.gtk.GDBus.TestPeerInterface", - "HelloWorld", - g_variant_new ("(s)", greeting), - G_VARIANT_TYPE ("(s)"), - G_DBUS_CALL_FLAGS_NONE, - -1, - NULL, - &error); - if (value == NULL) - { - g_printerr ("Error invoking HelloWorld(): %s\n", error->message); - g_error_free (error); - goto out; - } - g_variant_get (value, "(&s)", &greeting_response); - g_print ("Server said: %s\n", greeting_response); - g_variant_unref (value); - - g_object_unref (connection); - } - g_dbus_node_info_unref (introspection_data); - - ret = 0; - - out: - return ret; -} -</pre></div> -</div> -<p><br class="example-break"> -</p> -</div> -<div class="refsect1"> -<a name="GDBusServer.details"></a><h2>Details</h2> -<div class="refsect2"> -<a name="GDBusServer-struct"></a><h3>GDBusServer</h3> -<pre class="programlisting">typedef struct _GDBusServer GDBusServer;</pre> -<p> -The <a class="link" href="GDBusServer.html" title="GDBusServer"><span class="type">GDBusServer</span></a> structure contains only private data and -should only be accessed using the provided API. -</p> -<p class="since">Since 2.26</p> -</div> -<hr> -<div class="refsect2"> -<a name="GDBusServerFlags-enum"></a><h3>enum GDBusServerFlags</h3> -<pre class="programlisting">typedef enum { - G_DBUS_SERVER_FLAGS_NONE = 0, - G_DBUS_SERVER_FLAGS_RUN_IN_THREAD = (1<<0), - G_DBUS_SERVER_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS = (1<<1) -} GDBusServerFlags; -</pre> -<p> -Flags used when creating a <a class="link" href="GDBusServer.html" title="GDBusServer"><span class="type">GDBusServer</span></a>. -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td><p><a name="G-DBUS-SERVER-FLAGS-NONE:CAPS"></a><span class="term"><code class="literal">G_DBUS_SERVER_FLAGS_NONE</code></span></p></td> -<td>No flags set. -</td> -</tr> -<tr> -<td><p><a name="G-DBUS-SERVER-FLAGS-RUN-IN-THREAD:CAPS"></a><span class="term"><code class="literal">G_DBUS_SERVER_FLAGS_RUN_IN_THREAD</code></span></p></td> -<td>All <a class="link" href="GDBusServer.html#GDBusServer-new-connection" title='The "new-connection" signal'><span class="type">"new-connection"</span></a> -signals will run in separated dedicated threads (see signal for -details). -</td> -</tr> -<tr> -<td><p><a name="G-DBUS-SERVER-FLAGS-AUTHENTICATION-ALLOW-ANONYMOUS:CAPS"></a><span class="term"><code class="literal">G_DBUS_SERVER_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS</code></span></p></td> -<td>Allow the anonymous -authentication method. -</td> -</tr> -</tbody> -</table></div> -<p class="since">Since 2.26</p> -</div> -<hr> -<div class="refsect2"> -<a name="g-dbus-server-new-sync"></a><h3>g_dbus_server_new_sync ()</h3> -<pre class="programlisting"><a class="link" href="GDBusServer.html" title="GDBusServer"><span class="returnvalue">GDBusServer</span></a> * g_dbus_server_new_sync (<em class="parameter"><code>const <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *address</code></em>, - <em class="parameter"><code><a class="link" href="GDBusServer.html#GDBusServerFlags"><span class="type">GDBusServerFlags</span></a> flags</code></em>, - <em class="parameter"><code>const <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *guid</code></em>, - <em class="parameter"><code><a class="link" href="GDBusAuthObserver.html" title="GDBusAuthObserver"><span class="type">GDBusAuthObserver</span></a> *observer</code></em>, - <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>, - <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre> -<p> -Creates a new D-Bus server that listens on the first address in -<em class="parameter"><code>address</code></em> that works. -</p> -<p> -Once constructed, you can use <a class="link" href="GDBusServer.html#g-dbus-server-get-client-address" title="g_dbus_server_get_client_address ()"><code class="function">g_dbus_server_get_client_address()</code></a> to -get a D-Bus address string that clients can use to connect. -</p> -<p> -Connect to the <a class="link" href="GDBusServer.html#GDBusServer-new-connection" title='The "new-connection" signal'><span class="type">"new-connection"</span></a> signal to handle -incoming connections. -</p> -<p> -The returned <a class="link" href="GDBusServer.html" title="GDBusServer"><span class="type">GDBusServer</span></a> isn't active - you have to start it with -<a class="link" href="GDBusServer.html#g-dbus-server-start" title="g_dbus_server_start ()"><code class="function">g_dbus_server_start()</code></a>. -</p> -<p> -See <a class="xref" href="GDBusServer.html#gdbus-peer-to-peer" title="Example 6. D-Bus peer-to-peer example">Example 6, “D-Bus peer-to-peer example”</a> for how <a class="link" href="GDBusServer.html" title="GDBusServer"><span class="type">GDBusServer</span></a> can -be used. -</p> -<p> -This is a synchronous failable constructor. See -<code class="function">g_dbus_server_new()</code> for the asynchronous version. -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td><p><span class="term"><em class="parameter"><code>address</code></em> :</span></p></td> -<td>A D-Bus address.</td> -</tr> -<tr> -<td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td> -<td>Flags from the <a class="link" href="GDBusServer.html#GDBusServerFlags"><span class="type">GDBusServerFlags</span></a> enumeration.</td> -</tr> -<tr> -<td><p><span class="term"><em class="parameter"><code>guid</code></em> :</span></p></td> -<td>A D-Bus GUID.</td> -</tr> -<tr> -<td><p><span class="term"><em class="parameter"><code>observer</code></em> :</span></p></td> -<td>A <a class="link" href="GDBusAuthObserver.html" title="GDBusAuthObserver"><span class="type">GDBusAuthObserver</span></a> or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span> -</td> -</tr> -<tr> -<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td> -<td>A <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span> -</td> -</tr> -<tr> -<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td> -<td>Return location for server or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td> -</tr> -<tr> -<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> -<td>A <a class="link" href="GDBusServer.html" title="GDBusServer"><span class="type">GDBusServer</span></a> or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if <em class="parameter"><code>error</code></em> is set. Free with -<a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#g-object-unref"><code class="function">g_object_unref()</code></a>.</td> -</tr> -</tbody> -</table></div> -<p class="since">Since 2.26</p> -</div> -<hr> -<div class="refsect2"> -<a name="g-dbus-server-start"></a><h3>g_dbus_server_start ()</h3> -<pre class="programlisting"><span class="returnvalue">void</span> g_dbus_server_start (<em class="parameter"><code><a class="link" href="GDBusServer.html" title="GDBusServer"><span class="type">GDBusServer</span></a> *server</code></em>);</pre> -<p> -Starts <em class="parameter"><code>server</code></em>. -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody><tr> -<td><p><span class="term"><em class="parameter"><code>server</code></em> :</span></p></td> -<td>A <a class="link" href="GDBusServer.html" title="GDBusServer"><span class="type">GDBusServer</span></a>.</td> -</tr></tbody> -</table></div> -<p class="since">Since 2.26</p> -</div> -<hr> -<div class="refsect2"> -<a name="g-dbus-server-stop"></a><h3>g_dbus_server_stop ()</h3> -<pre class="programlisting"><span class="returnvalue">void</span> g_dbus_server_stop (<em class="parameter"><code><a class="link" href="GDBusServer.html" title="GDBusServer"><span class="type">GDBusServer</span></a> *server</code></em>);</pre> -<p> -Stops <em class="parameter"><code>server</code></em>. -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody><tr> -<td><p><span class="term"><em class="parameter"><code>server</code></em> :</span></p></td> -<td>A <a class="link" href="GDBusServer.html" title="GDBusServer"><span class="type">GDBusServer</span></a>.</td> -</tr></tbody> -</table></div> -<p class="since">Since 2.26</p> -</div> -<hr> -<div class="refsect2"> -<a name="g-dbus-server-is-active"></a><h3>g_dbus_server_is_active ()</h3> -<pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> g_dbus_server_is_active (<em class="parameter"><code><a class="link" href="GDBusServer.html" title="GDBusServer"><span class="type">GDBusServer</span></a> *server</code></em>);</pre> -<p> -Gets whether <em class="parameter"><code>server</code></em> is active. -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td><p><span class="term"><em class="parameter"><code>server</code></em> :</span></p></td> -<td>A <a class="link" href="GDBusServer.html" title="GDBusServer"><span class="type">GDBusServer</span></a>.</td> -</tr> -<tr> -<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> -<td> -<a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if server is active, <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise.</td> -</tr> -</tbody> -</table></div> -<p class="since">Since 2.26</p> -</div> -<hr> -<div class="refsect2"> -<a name="g-dbus-server-get-guid"></a><h3>g_dbus_server_get_guid ()</h3> -<pre class="programlisting">const <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> * g_dbus_server_get_guid (<em class="parameter"><code><a class="link" href="GDBusServer.html" title="GDBusServer"><span class="type">GDBusServer</span></a> *server</code></em>);</pre> -<p> -Gets the GUID for <em class="parameter"><code>server</code></em>. -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td><p><span class="term"><em class="parameter"><code>server</code></em> :</span></p></td> -<td>A <a class="link" href="GDBusServer.html" title="GDBusServer"><span class="type">GDBusServer</span></a>.</td> -</tr> -<tr> -<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> -<td>A D-Bus GUID. Do not free this string, it is owned by <em class="parameter"><code>server</code></em>.</td> -</tr> -</tbody> -</table></div> -<p class="since">Since 2.26</p> -</div> -<hr> -<div class="refsect2"> -<a name="g-dbus-server-get-flags"></a><h3>g_dbus_server_get_flags ()</h3> -<pre class="programlisting"><a class="link" href="GDBusServer.html#GDBusServerFlags"><span class="returnvalue">GDBusServerFlags</span></a> g_dbus_server_get_flags (<em class="parameter"><code><a class="link" href="GDBusServer.html" title="GDBusServer"><span class="type">GDBusServer</span></a> *server</code></em>);</pre> -<p> -Gets the flags for <em class="parameter"><code>server</code></em>. -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td><p><span class="term"><em class="parameter"><code>server</code></em> :</span></p></td> -<td>A <a class="link" href="GDBusServer.html" title="GDBusServer"><span class="type">GDBusServer</span></a>.</td> -</tr> -<tr> -<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> -<td>A set of flags from the <a class="link" href="GDBusServer.html#GDBusServerFlags"><span class="type">GDBusServerFlags</span></a> enumeration.</td> -</tr> -</tbody> -</table></div> -<p class="since">Since 2.26</p> -</div> -<hr> -<div class="refsect2"> -<a name="g-dbus-server-get-client-address"></a><h3>g_dbus_server_get_client_address ()</h3> -<pre class="programlisting">const <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> * g_dbus_server_get_client_address (<em class="parameter"><code><a class="link" href="GDBusServer.html" title="GDBusServer"><span class="type">GDBusServer</span></a> *server</code></em>);</pre> -<p> -Gets a D-Bus address string that can be used by clients to connect -to <em class="parameter"><code>server</code></em>. -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td><p><span class="term"><em class="parameter"><code>server</code></em> :</span></p></td> -<td>A <a class="link" href="GDBusServer.html" title="GDBusServer"><span class="type">GDBusServer</span></a>.</td> -</tr> -<tr> -<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> -<td>A D-Bus address string. Do not free, the string is owned -by <em class="parameter"><code>server</code></em>.</td> -</tr> -</tbody> -</table></div> -<p class="since">Since 2.26</p> -</div> -</div> -<div class="refsect1"> -<a name="GDBusServer.property-details"></a><h2>Property Details</h2> -<div class="refsect2"> -<a name="GDBusServer--active"></a><h3>The <code class="literal">"active"</code> property</h3> -<pre class="programlisting"> "active" <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> : Read</pre> -<p> -Whether the server is currently active. -</p> -<p>Default value: FALSE</p> -<p class="since">Since 2.26</p> -</div> -<hr> -<div class="refsect2"> -<a name="GDBusServer--address"></a><h3>The <code class="literal">"address"</code> property</h3> -<pre class="programlisting"> "address" <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a>* : Read / Write / Construct Only</pre> -<p> -The D-Bus address to listen on. -</p> -<p>Default value: NULL</p> -<p class="since">Since 2.26</p> -</div> -<hr> -<div class="refsect2"> -<a name="GDBusServer--authentication-observer"></a><h3>The <code class="literal">"authentication-observer"</code> property</h3> -<pre class="programlisting"> "authentication-observer" <a class="link" href="GDBusAuthObserver.html" title="GDBusAuthObserver"><span class="type">GDBusAuthObserver</span></a>* : Read / Write / Construct Only</pre> -<p> -A <a class="link" href="GDBusAuthObserver.html" title="GDBusAuthObserver"><span class="type">GDBusAuthObserver</span></a> object to assist in the authentication process or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. -</p> -<p class="since">Since 2.26</p> -</div> -<hr> -<div class="refsect2"> -<a name="GDBusServer--client-address"></a><h3>The <code class="literal">"client-address"</code> property</h3> -<pre class="programlisting"> "client-address" <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a>* : Read</pre> -<p> -The D-Bus address that clients can use. -</p> -<p>Default value: NULL</p> -<p class="since">Since 2.26</p> -</div> -<hr> -<div class="refsect2"> -<a name="GDBusServer--flags"></a><h3>The <code class="literal">"flags"</code> property</h3> -<pre class="programlisting"> "flags" <a class="link" href="GDBusServer.html#GDBusServerFlags"><span class="type">GDBusServerFlags</span></a> : Read / Write / Construct Only</pre> -<p> -Flags from the <a class="link" href="GDBusServer.html#GDBusServerFlags"><span class="type">GDBusServerFlags</span></a> enumeration. -</p> -<p class="since">Since 2.26</p> -</div> -<hr> -<div class="refsect2"> -<a name="GDBusServer--guid"></a><h3>The <code class="literal">"guid"</code> property</h3> -<pre class="programlisting"> "guid" <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a>* : Read / Write / Construct Only</pre> -<p> -The guid of the server. -</p> -<p>Default value: NULL</p> -<p class="since">Since 2.26</p> -</div> -</div> -<div class="refsect1"> -<a name="GDBusServer.signal-details"></a><h2>Signal Details</h2> -<div class="refsect2"> -<a name="GDBusServer-new-connection"></a><h3>The <code class="literal">"new-connection"</code> signal</h3> -<pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> user_function (<a class="link" href="GDBusServer.html" title="GDBusServer"><span class="type">GDBusServer</span></a> *server, - <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection, - <a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data) : <a href="./../gobject/gobject/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS"><code class="literal">Run Last</code></a></pre> -<p> -Emitted when a new authenticated connection has been made. Use -<a class="link" href="GDBusConnection.html#g-dbus-connection-get-peer-credentials" title="g_dbus_connection_get_peer_credentials ()"><code class="function">g_dbus_connection_get_peer_credentials()</code></a> to figure out what -identity (if any), was authenticated. -</p> -<p> -If you want to accept the connection, take a reference to the -<em class="parameter"><code>connection</code></em> object and return <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>. When you are done with the -connection call <a class="link" href="GDBusConnection.html#g-dbus-connection-close" title="g_dbus_connection_close ()"><code class="function">g_dbus_connection_close()</code></a> and give up your -reference. Note that the other peer may disconnect at any time - -a typical thing to do when accepting a connection is to listen to -the <a class="link" href="GDBusConnection.html#GDBusConnection-closed" title='The "closed" signal'><span class="type">"closed"</span></a> signal. -</p> -<p> -If <a class="link" href="GDBusServer.html#GDBusServer--flags" title='The "flags" property'><span class="type">"flags"</span></a> contains <a class="link" href="GDBusServer.html#G-DBUS-SERVER-FLAGS-RUN-IN-THREAD:CAPS"><code class="literal">G_DBUS_SERVER_FLAGS_RUN_IN_THREAD</code></a> -then the signal is emitted in a new thread dedicated to the -connection. Otherwise the signal is emitted in the <GTKDOCLINK HREF="g-main-context-push-thread-default">thread-default main -loop</GTKDOCLINK> of the thread that <em class="parameter"><code>server</code></em> was constructed in. -</p> -<p> -You are guaranteed that signal handlers for this signal runs -before incoming messages on <em class="parameter"><code>connection</code></em> are processed. This means -that it's suitable to call <a class="link" href="GDBusConnection.html#g-dbus-connection-register-object" title="g_dbus_connection_register_object ()"><code class="function">g_dbus_connection_register_object()</code></a> or -similar from the signal handler. -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td><p><span class="term"><em class="parameter"><code>server</code></em> :</span></p></td> -<td>The <a class="link" href="GDBusServer.html" title="GDBusServer"><span class="type">GDBusServer</span></a> emitting the signal.</td> -</tr> -<tr> -<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td> -<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> for the new connection.</td> -</tr> -<tr> -<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td> -<td>user data set when the signal handler was connected.</td> -</tr> -<tr> -<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> -<td> -<a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> to claim <em class="parameter"><code>connection</code></em>, <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> to let other handlers -run.</td> -</tr> -</tbody> -</table></div> -<p class="since">Since 2.26</p> -</div> -</div> -</div> -<div class="footer"> -<hr> - Generated by GTK-Doc V1.18</div> -</body> -</html>
\ No newline at end of file |