Update to version 2.33.1
[profile/ivi/glib2.git] / docs / reference / gio / html / GDBusAuthObserver.html
index 1a3cac3..7779c98 100644 (file)
@@ -50,6 +50,9 @@
                                                         (<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="GIOStream.html" title="GIOStream"><span class="type">GIOStream</span></a> *stream</code></em>,
                                                          <em class="parameter"><code><a class="link" href="GCredentials.html" title="GCredentials"><span class="type">GCredentials</span></a> *credentials</code></em>);
+<a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GDBusAuthObserver.html#g-dbus-auth-observer-allow-mechanism" title="g_dbus_auth_observer_allow_mechanism ()">g_dbus_auth_observer_allow_mechanism</a>
+                                                        (<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>const <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *mechanism</code></em>);
 </pre>
 </div>
 <div class="refsect1">
@@ -62,6 +65,7 @@
 <div class="refsect1">
 <a name="GDBusAuthObserver.signals"></a><h2>Signals</h2>
 <pre class="synopsis">
+  "<a class="link" href="GDBusAuthObserver.html#GDBusAuthObserver-allow-mechanism" title='The "allow-mechanism" signal'>allow-mechanism</a>"                                : <a href="./../gobject/gobject/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS"><code class="literal">Run Last</code></a>
   "<a class="link" href="GDBusAuthObserver.html#GDBusAuthObserver-authorize-authenticated-peer" title='The "authorize-authenticated-peer" signal'>authorize-authenticated-peer</a>"                   : <a href="./../gobject/gobject/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS"><code class="literal">Run Last</code></a>
 </pre>
 </div>
@@ -81,55 +85,28 @@ signal handler like the following:
 </p>
 <div class="example">
 <a name="auth-observer"></a><p class="title"><b>Example 7. Controlling Authentication</b></p>
-<div class="example-contents">
-  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
-    <tbody>
-      <tr>
-        <td class="listing_lines" align="right"><pre>1
-2
-3
-4
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20</pre></td>
-        <td class="listing_code"><pre class="programlisting"><span class="keyword">static</span><span class="normal"> <a href="./../glib/glib/glib-Basic-Types.html#gboolean">gboolean</a></span>
-<span class="function">on_authorize_authenticated_peer</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GDBusAuthObserver</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">observer</span><span class="symbol">,</span>
-<span class="normal">                                 </span><span class="usertype">GIOStream</span><span class="normal">         </span><span class="symbol">*</span><span class="normal">stream</span><span class="symbol">,</span>
-<span class="normal">                                 </span><span class="usertype">GCredentials</span><span class="normal">      </span><span class="symbol">*</span><span class="normal">credentials</span><span class="symbol">,</span>
-<span class="normal">                                 </span><span class="usertype">gpointer</span><span class="normal">           user_data</span><span class="symbol">)</span>
-<span class="cbracket">{</span>
-<span class="normal">  </span><span class="usertype">gboolean</span><span class="normal"> authorized</span><span class="symbol">;</span>
-
-<span class="normal">  authorized </span><span class="symbol">=</span><span class="normal"> <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS">FALSE</a></span><span class="symbol">;</span>
-<span class="normal">  </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">credentials </span><span class="symbol">!=</span><span class="normal"> <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">)</span>
-<span class="normal">    </span><span class="cbracket">{</span>
-<span class="normal">      </span><span class="usertype">GCredentials</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">own_credentials</span><span class="symbol">;</span>
-<span class="normal">      own_credentials </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GCredentials.html#g-credentials-new">g_credentials_new</a></span><span class="normal"> </span><span class="symbol">();</span>
-<span class="normal">      </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="GCredentials.html#g-credentials-is-same-user">g_credentials_is_same_user</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">credentials</span><span class="symbol">,</span><span class="normal"> own_credentials</span><span class="symbol">,</span><span class="normal"> <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">))</span>
-<span class="normal">        authorized </span><span class="symbol">=</span><span class="normal"> <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS">TRUE</a></span><span class="symbol">;</span>
-<span class="normal">      </span><span class="function"><a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">own_credentials</span><span class="symbol">);</span>
-<span class="normal">    </span><span class="cbracket">}</span>
+<div class="example-contents"><pre class="programlisting">
+static gboolean
+on_authorize_authenticated_peer (GDBusAuthObserver *observer,
+                                 GIOStream         *stream,
+                                 GCredentials      *credentials,
+                                 gpointer           user_data)
+{
+  gboolean authorized;
 
-<span class="normal">  </span><span class="keyword">return</span><span class="normal"> authorized</span><span class="symbol">;</span>
-<span class="cbracket">}</span></pre></td>
-      </tr>
-    </tbody>
-  </table>
-</div>
+  authorized = FALSE;
+  if (credentials != NULL)
+    {
+      GCredentials *own_credentials;
+      own_credentials = g_credentials_new ();
+      if (g_credentials_is_same_user (credentials, own_credentials, NULL))
+        authorized = TRUE;
+      g_object_unref (own_credentials);
+    }
 
+  return authorized;
+}
+</pre></div>
 </div>
 <p><br class="example-break">
 </p>
@@ -184,7 +161,8 @@ Emits the <a class="link" href="GDBusAuthObserver.html#GDBusAuthObserver-authori
 </tr>
 <tr>
 <td><p><span class="term"><em class="parameter"><code>credentials</code></em> :</span></p></td>
-<td>Credentials received from the peer or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td>
+<td>Credentials received from the peer 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"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
@@ -195,10 +173,72 @@ Emits the <a class="link" href="GDBusAuthObserver.html#GDBusAuthObserver-authori
 </table></div>
 <p class="since">Since 2.26</p>
 </div>
+<hr>
+<div class="refsect2">
+<a name="g-dbus-auth-observer-allow-mechanism"></a><h3>g_dbus_auth_observer_allow_mechanism ()</h3>
+<pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_dbus_auth_observer_allow_mechanism
+                                                        (<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>const <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *mechanism</code></em>);</pre>
+<p>
+Emits the <a class="link" href="GDBusAuthObserver.html#GDBusAuthObserver-allow-mechanism" title='The "allow-mechanism" signal'><span class="type">"allow-mechanism"</span></a> signal on <em class="parameter"><code>observer</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>observer</code></em> :</span></p></td>
+<td>A <a class="link" href="GDBusAuthObserver.html" title="GDBusAuthObserver"><span class="type">GDBusAuthObserver</span></a>.</td>
+</tr>
+<tr>
+<td><p><span class="term"><em class="parameter"><code>mechanism</code></em> :</span></p></td>
+<td>The name of the mechanism, e.g. <code class="literal">DBUS_COOKIE_SHA1</code>.</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 <em class="parameter"><code>mechanism</code></em> can be used to authenticate the other peer, <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if not.</td>
+</tr>
+</tbody>
+</table></div>
+<p class="since">Since 2.34</p>
+</div>
 </div>
 <div class="refsect1">
 <a name="GDBusAuthObserver.signal-details"></a><h2>Signal Details</h2>
 <div class="refsect2">
+<a name="GDBusAuthObserver-allow-mechanism"></a><h3>The <code class="literal">"allow-mechanism"</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="GDBusAuthObserver.html" title="GDBusAuthObserver"><span class="type">GDBusAuthObserver</span></a> *observer,
+                                                        <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a>             *mechanism,
+                                                        <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 to check if <em class="parameter"><code>mechanism</code></em> is allowed to be used.
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td><p><span class="term"><em class="parameter"><code>observer</code></em> :</span></p></td>
+<td>The <a class="link" href="GDBusAuthObserver.html" title="GDBusAuthObserver"><span class="type">GDBusAuthObserver</span></a> emitting the signal.</td>
+</tr>
+<tr>
+<td><p><span class="term"><em class="parameter"><code>mechanism</code></em> :</span></p></td>
+<td>The name of the mechanism, e.g. <code class="literal">DBUS_COOKIE_SHA1</code>.</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> if <em class="parameter"><code>mechanism</code></em> can be used to authenticate the other peer, <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if not.</td>
+</tr>
+</tbody>
+</table></div>
+<p class="since">Since 2.34</p>
+</div>
+<hr>
+<div class="refsect2">
 <a name="GDBusAuthObserver-authorize-authenticated-peer"></a><h3>The <code class="literal">"authorize-authenticated-peer"</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="GDBusAuthObserver.html" title="GDBusAuthObserver"><span class="type">GDBusAuthObserver</span></a> *observer,
                                                         <a class="link" href="GIOStream.html" title="GIOStream"><span class="type">GIOStream</span></a>         *stream,
@@ -221,7 +261,8 @@ is authorized.
 </tr>
 <tr>
 <td><p><span class="term"><em class="parameter"><code>credentials</code></em> :</span></p></td>
-<td>Credentials received from the peer or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td>
+<td>Credentials received from the peer 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>user_data</code></em> :</span></p></td>