1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>GUnixConnection</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
7 <link rel="home" href="index.html" title="GIO Reference Manual">
8 <link rel="up" href="highlevel-socket.html" title="High-level network functionallity">
9 <link rel="prev" href="GSocketConnection.html" title="GSocketConnection">
10 <link rel="next" href="GTcpConnection.html" title="GTcpConnection">
11 <meta name="generator" content="GTK-Doc V1.18 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
14 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
17 <td><a accesskey="p" href="GSocketConnection.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
18 <td><a accesskey="u" href="highlevel-socket.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
19 <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
20 <th width="100%" align="center">GIO Reference Manual</th>
21 <td><a accesskey="n" href="GTcpConnection.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
23 <tr><td colspan="5" class="shortcuts">
24 <a href="#GUnixConnection.synopsis" class="shortcut">Top</a>
26 <a href="#GUnixConnection.description" class="shortcut">Description</a>
28 <a href="#GUnixConnection.object-hierarchy" class="shortcut">Object Hierarchy</a>
31 <div class="refentry">
32 <a name="GUnixConnection"></a><div class="titlepage"></div>
33 <div class="refnamediv"><table width="100%"><tr>
35 <h2><span class="refentrytitle"><a name="GUnixConnection.top_of_page"></a>GUnixConnection</span></h2>
36 <p>GUnixConnection — A UNIX domain GSocketConnection</p>
38 <td valign="top" align="right"></td>
40 <div class="refsynopsisdiv">
41 <a name="GUnixConnection.synopsis"></a><h2>Synopsis</h2>
42 <pre class="synopsis">
43 #include <gio/gunixconnection.h>
45 <a class="link" href="GUnixConnection.html#GUnixConnection-struct" title="GUnixConnection">GUnixConnection</a>;
46 <a href="./../glib/glib/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a> <a class="link" href="GUnixConnection.html#g-unix-connection-receive-fd" title="g_unix_connection_receive_fd ()">g_unix_connection_receive_fd</a> (<em class="parameter"><code><a class="link" href="GUnixConnection.html" title="GUnixConnection"><span class="type">GUnixConnection</span></a> *connection</code></em>,
47 <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
48 <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
49 <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="GUnixConnection.html#g-unix-connection-send-fd" title="g_unix_connection_send_fd ()">g_unix_connection_send_fd</a> (<em class="parameter"><code><a class="link" href="GUnixConnection.html" title="GUnixConnection"><span class="type">GUnixConnection</span></a> *connection</code></em>,
50 <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> fd</code></em>,
51 <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
52 <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
53 <a class="link" href="GCredentials.html" title="GCredentials"><span class="returnvalue">GCredentials</span></a> * <a class="link" href="GUnixConnection.html#g-unix-connection-receive-credentials" title="g_unix_connection_receive_credentials ()">g_unix_connection_receive_credentials</a>
54 (<em class="parameter"><code><a class="link" href="GUnixConnection.html" title="GUnixConnection"><span class="type">GUnixConnection</span></a> *connection</code></em>,
55 <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
56 <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
57 <span class="returnvalue">void</span> <a class="link" href="GUnixConnection.html#g-unix-connection-receive-credentials-async" title="g_unix_connection_receive_credentials_async ()">g_unix_connection_receive_credentials_async</a>
58 (<em class="parameter"><code><a class="link" href="GUnixConnection.html" title="GUnixConnection"><span class="type">GUnixConnection</span></a> *connection</code></em>,
59 <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
60 <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
61 <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);
62 <a class="link" href="GCredentials.html" title="GCredentials"><span class="returnvalue">GCredentials</span></a> * <a class="link" href="GUnixConnection.html#g-unix-connection-receive-credentials-finish" title="g_unix_connection_receive_credentials_finish ()">g_unix_connection_receive_credentials_finish</a>
63 (<em class="parameter"><code><a class="link" href="GUnixConnection.html" title="GUnixConnection"><span class="type">GUnixConnection</span></a> *connection</code></em>,
64 <em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *result</code></em>,
65 <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
66 <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="GUnixConnection.html#g-unix-connection-send-credentials" title="g_unix_connection_send_credentials ()">g_unix_connection_send_credentials</a> (<em class="parameter"><code><a class="link" href="GUnixConnection.html" title="GUnixConnection"><span class="type">GUnixConnection</span></a> *connection</code></em>,
67 <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
68 <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
69 <span class="returnvalue">void</span> <a class="link" href="GUnixConnection.html#g-unix-connection-send-credentials-async" title="g_unix_connection_send_credentials_async ()">g_unix_connection_send_credentials_async</a>
70 (<em class="parameter"><code><a class="link" href="GUnixConnection.html" title="GUnixConnection"><span class="type">GUnixConnection</span></a> *connection</code></em>,
71 <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
72 <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
73 <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);
74 <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="GUnixConnection.html#g-unix-connection-send-credentials-finish" title="g_unix_connection_send_credentials_finish ()">g_unix_connection_send_credentials_finish</a>
75 (<em class="parameter"><code><a class="link" href="GUnixConnection.html" title="GUnixConnection"><span class="type">GUnixConnection</span></a> *connection</code></em>,
76 <em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *result</code></em>,
77 <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
80 <div class="refsect1">
81 <a name="GUnixConnection.object-hierarchy"></a><h2>Object Hierarchy</h2>
82 <pre class="synopsis">
83 <a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#GObject">GObject</a>
84 +----<a class="link" href="GIOStream.html" title="GIOStream">GIOStream</a>
85 +----<a class="link" href="GSocketConnection.html" title="GSocketConnection">GSocketConnection</a>
89 <div class="refsect1">
90 <a name="GUnixConnection.description"></a><h2>Description</h2>
92 This is the subclass of <a class="link" href="GSocketConnection.html" title="GSocketConnection"><span class="type">GSocketConnection</span></a> that is created
93 for UNIX domain sockets.
96 It contains functions to do some of the UNIX socket specific
97 functionality like passing file descriptors.
100 Note that <code class="filename"><gio/gunixconnection.h></code> belongs to
101 the UNIX-specific GIO interfaces, thus you have to use the
102 <code class="filename">gio-unix-2.0.pc</code> pkg-config file when using it.
105 <div class="refsect1">
106 <a name="GUnixConnection.details"></a><h2>Details</h2>
107 <div class="refsect2">
108 <a name="GUnixConnection-struct"></a><h3>GUnixConnection</h3>
109 <pre class="programlisting">typedef struct _GUnixConnection GUnixConnection;</pre>
112 <div class="refsect2">
113 <a name="g-unix-connection-receive-fd"></a><h3>g_unix_connection_receive_fd ()</h3>
114 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a> g_unix_connection_receive_fd (<em class="parameter"><code><a class="link" href="GUnixConnection.html" title="GUnixConnection"><span class="type">GUnixConnection</span></a> *connection</code></em>,
115 <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
116 <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
118 Receives a file descriptor from the sending end of the connection.
119 The sending end has to call <a class="link" href="GUnixConnection.html#g-unix-connection-send-fd" title="g_unix_connection_send_fd ()"><code class="function">g_unix_connection_send_fd()</code></a> for this
123 As well as reading the fd this also reads a single byte from the
124 stream, as this is required for fd passing to work on some
127 <div class="variablelist"><table border="0">
128 <col align="left" valign="top">
131 <td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
132 <td>a <a class="link" href="GUnixConnection.html" title="GUnixConnection"><span class="type">GUnixConnection</span></a>
136 <td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
137 <td>optional <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> object, <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
141 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
143 <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> for error reporting, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
147 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
148 <td>a file descriptor on success, -1 on error.</td>
152 <p class="since">Since 2.22</p>
155 <div class="refsect2">
156 <a name="g-unix-connection-send-fd"></a><h3>g_unix_connection_send_fd ()</h3>
157 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> g_unix_connection_send_fd (<em class="parameter"><code><a class="link" href="GUnixConnection.html" title="GUnixConnection"><span class="type">GUnixConnection</span></a> *connection</code></em>,
158 <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> fd</code></em>,
159 <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
160 <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
162 Passes a file descriptor to the receiving side of the
163 connection. The receiving end has to call <a class="link" href="GUnixConnection.html#g-unix-connection-receive-fd" title="g_unix_connection_receive_fd ()"><code class="function">g_unix_connection_receive_fd()</code></a>
164 to accept the file descriptor.
167 As well as sending the fd this also writes a single byte to the
168 stream, as this is required for fd passing to work on some
171 <div class="variablelist"><table border="0">
172 <col align="left" valign="top">
175 <td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
176 <td>a <a class="link" href="GUnixConnection.html" title="GUnixConnection"><span class="type">GUnixConnection</span></a>
180 <td><p><span class="term"><em class="parameter"><code>fd</code></em> :</span></p></td>
181 <td>a file descriptor</td>
184 <td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
185 <td>optional <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> object, <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
189 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
191 <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> for error reporting, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
195 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
196 <td>a <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> on success, <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on error.</td>
200 <p class="since">Since 2.22</p>
203 <div class="refsect2">
204 <a name="g-unix-connection-receive-credentials"></a><h3>g_unix_connection_receive_credentials ()</h3>
205 <pre class="programlisting"><a class="link" href="GCredentials.html" title="GCredentials"><span class="returnvalue">GCredentials</span></a> * g_unix_connection_receive_credentials
206 (<em class="parameter"><code><a class="link" href="GUnixConnection.html" title="GUnixConnection"><span class="type">GUnixConnection</span></a> *connection</code></em>,
207 <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
208 <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
210 Receives credentials from the sending end of the connection. The
211 sending end has to call <a class="link" href="GUnixConnection.html#g-unix-connection-send-credentials" title="g_unix_connection_send_credentials ()"><code class="function">g_unix_connection_send_credentials()</code></a> (or
212 similar) for this to work.
215 As well as reading the credentials this also reads (and discards) a
216 single byte from the stream, as this is required for credentials
217 passing to work on some implementations.
220 Other ways to exchange credentials with a foreign peer includes the
221 <a class="link" href="GUnixCredentialsMessage.html" title="GUnixCredentialsMessage"><span class="type">GUnixCredentialsMessage</span></a> type and <a class="link" href="GSocket.html#g-socket-get-credentials" title="g_socket_get_credentials ()"><code class="function">g_socket_get_credentials()</code></a> function.
223 <div class="variablelist"><table border="0">
224 <col align="left" valign="top">
227 <td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
228 <td>A <a class="link" href="GUnixConnection.html" title="GUnixConnection"><span class="type">GUnixConnection</span></a>.</td>
231 <td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
232 <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>
236 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
237 <td>Return location for error or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td>
240 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
241 <td>Received credentials on success (free with
242 <a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#g-object-unref"><code class="function">g_object_unref()</code></a>), <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. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
247 <p class="since">Since 2.26</p>
250 <div class="refsect2">
251 <a name="g-unix-connection-receive-credentials-async"></a><h3>g_unix_connection_receive_credentials_async ()</h3>
252 <pre class="programlisting"><span class="returnvalue">void</span> g_unix_connection_receive_credentials_async
253 (<em class="parameter"><code><a class="link" href="GUnixConnection.html" title="GUnixConnection"><span class="type">GUnixConnection</span></a> *connection</code></em>,
254 <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
255 <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
256 <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
258 Asynchronously receive credentials.
261 For more details, see <a class="link" href="GUnixConnection.html#g-unix-connection-receive-credentials" title="g_unix_connection_receive_credentials ()"><code class="function">g_unix_connection_receive_credentials()</code></a> which is
262 the synchronous version of this call.
265 When the operation is finished, <em class="parameter"><code>callback</code></em> will be called. You can then call
266 <a class="link" href="GUnixConnection.html#g-unix-connection-receive-credentials-finish" title="g_unix_connection_receive_credentials_finish ()"><code class="function">g_unix_connection_receive_credentials_finish()</code></a> to get the result of the operation.
268 <div class="variablelist"><table border="0">
269 <col align="left" valign="top">
272 <td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
273 <td>A <a class="link" href="GUnixConnection.html" title="GUnixConnection"><span class="type">GUnixConnection</span></a>.</td>
276 <td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
277 <td>optional <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> object, <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
281 <td><p><span class="term"><em class="parameter"><code>callback</code></em> :</span></p></td>
282 <td>a <a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> to call when the request is satisfied. <span class="annotation">[<acronym title="The callback is valid until first called."><span class="acronym">scope async</span></acronym>]</span>
286 <td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
287 <td>the data to pass to callback function. <span class="annotation">[<acronym title="This parameter is a 'user_data', for callbacks; many bindings can pass NULL here."><span class="acronym">closure</span></acronym>]</span>
292 <p class="since">Since 2.32</p>
295 <div class="refsect2">
296 <a name="g-unix-connection-receive-credentials-finish"></a><h3>g_unix_connection_receive_credentials_finish ()</h3>
297 <pre class="programlisting"><a class="link" href="GCredentials.html" title="GCredentials"><span class="returnvalue">GCredentials</span></a> * g_unix_connection_receive_credentials_finish
298 (<em class="parameter"><code><a class="link" href="GUnixConnection.html" title="GUnixConnection"><span class="type">GUnixConnection</span></a> *connection</code></em>,
299 <em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *result</code></em>,
300 <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
302 Finishes an asynchronous receive credentials operation started with
303 <a class="link" href="GUnixConnection.html#g-unix-connection-receive-credentials-async" title="g_unix_connection_receive_credentials_async ()"><code class="function">g_unix_connection_receive_credentials_async()</code></a>.
305 <div class="variablelist"><table border="0">
306 <col align="left" valign="top">
309 <td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
310 <td>A <a class="link" href="GUnixConnection.html" title="GUnixConnection"><span class="type">GUnixConnection</span></a>.</td>
313 <td><p><span class="term"><em class="parameter"><code>result</code></em> :</span></p></td>
314 <td>a <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a>.</td>
317 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
318 <td>a <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
322 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
323 <td>a <a class="link" href="GCredentials.html" title="GCredentials"><span class="type">GCredentials</span></a>, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on error.
324 Free the returned object with <a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#g-object-unref"><code class="function">g_object_unref()</code></a>. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
329 <p class="since">Since 2.32</p>
332 <div class="refsect2">
333 <a name="g-unix-connection-send-credentials"></a><h3>g_unix_connection_send_credentials ()</h3>
334 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> g_unix_connection_send_credentials (<em class="parameter"><code><a class="link" href="GUnixConnection.html" title="GUnixConnection"><span class="type">GUnixConnection</span></a> *connection</code></em>,
335 <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
336 <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
338 Passes the credentials of the current user the receiving side
339 of the connection. The receiving end has to call
340 <a class="link" href="GUnixConnection.html#g-unix-connection-receive-credentials" title="g_unix_connection_receive_credentials ()"><code class="function">g_unix_connection_receive_credentials()</code></a> (or similar) to accept the
344 As well as sending the credentials this also writes a single NUL
345 byte to the stream, as this is required for credentials passing to
346 work on some implementations.
349 Other ways to exchange credentials with a foreign peer includes the
350 <a class="link" href="GUnixCredentialsMessage.html" title="GUnixCredentialsMessage"><span class="type">GUnixCredentialsMessage</span></a> type and <a class="link" href="GSocket.html#g-socket-get-credentials" title="g_socket_get_credentials ()"><code class="function">g_socket_get_credentials()</code></a> function.
352 <div class="variablelist"><table border="0">
353 <col align="left" valign="top">
356 <td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
357 <td>A <a class="link" href="GUnixConnection.html" title="GUnixConnection"><span class="type">GUnixConnection</span></a>.</td>
360 <td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
361 <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>
365 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
366 <td>Return location for error or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td>
369 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
371 <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> on success, <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if <em class="parameter"><code>error</code></em> is set.</td>
375 <p class="since">Since 2.26</p>
378 <div class="refsect2">
379 <a name="g-unix-connection-send-credentials-async"></a><h3>g_unix_connection_send_credentials_async ()</h3>
380 <pre class="programlisting"><span class="returnvalue">void</span> g_unix_connection_send_credentials_async
381 (<em class="parameter"><code><a class="link" href="GUnixConnection.html" title="GUnixConnection"><span class="type">GUnixConnection</span></a> *connection</code></em>,
382 <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
383 <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
384 <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
386 Asynchronously send credentials.
389 For more details, see <a class="link" href="GUnixConnection.html#g-unix-connection-send-credentials" title="g_unix_connection_send_credentials ()"><code class="function">g_unix_connection_send_credentials()</code></a> which is
390 the synchronous version of this call.
393 When the operation is finished, <em class="parameter"><code>callback</code></em> will be called. You can then call
394 <a class="link" href="GUnixConnection.html#g-unix-connection-send-credentials-finish" title="g_unix_connection_send_credentials_finish ()"><code class="function">g_unix_connection_send_credentials_finish()</code></a> to get the result of the operation.
396 <div class="variablelist"><table border="0">
397 <col align="left" valign="top">
400 <td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
401 <td>A <a class="link" href="GUnixConnection.html" title="GUnixConnection"><span class="type">GUnixConnection</span></a>.</td>
404 <td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
405 <td>optional <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> object, <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
409 <td><p><span class="term"><em class="parameter"><code>callback</code></em> :</span></p></td>
410 <td>a <a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> to call when the request is satisfied. <span class="annotation">[<acronym title="The callback is valid until first called."><span class="acronym">scope async</span></acronym>]</span>
414 <td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
415 <td>the data to pass to callback function. <span class="annotation">[<acronym title="This parameter is a 'user_data', for callbacks; many bindings can pass NULL here."><span class="acronym">closure</span></acronym>]</span>
420 <p class="since">Since 2.32</p>
423 <div class="refsect2">
424 <a name="g-unix-connection-send-credentials-finish"></a><h3>g_unix_connection_send_credentials_finish ()</h3>
425 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> g_unix_connection_send_credentials_finish
426 (<em class="parameter"><code><a class="link" href="GUnixConnection.html" title="GUnixConnection"><span class="type">GUnixConnection</span></a> *connection</code></em>,
427 <em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *result</code></em>,
428 <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
430 Finishes an asynchronous send credentials operation started with
431 <a class="link" href="GUnixConnection.html#g-unix-connection-send-credentials-async" title="g_unix_connection_send_credentials_async ()"><code class="function">g_unix_connection_send_credentials_async()</code></a>.
433 <div class="variablelist"><table border="0">
434 <col align="left" valign="top">
437 <td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
438 <td>A <a class="link" href="GUnixConnection.html" title="GUnixConnection"><span class="type">GUnixConnection</span></a>.</td>
441 <td><p><span class="term"><em class="parameter"><code>result</code></em> :</span></p></td>
442 <td>a <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a>.</td>
445 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
446 <td>a <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
450 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
452 <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the operation was successful, otherwise <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>.</td>
456 <p class="since">Since 2.32</p>
459 <div class="refsect1">
460 <a name="GUnixConnection.see-also"></a><h2>See Also</h2>
461 <a class="link" href="GSocketConnection.html" title="GSocketConnection"><span class="type">GSocketConnection</span></a>.
466 Generated by GTK-Doc V1.18</div>