Current File : //usr/share/doc/dbus/api/dbus-bus_8c_source.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>D-Bus: dbus-bus.c Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />



</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">D-Bus
   &#160;<span id="projectnumber">1.8.20</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="headertitle">
<div class="title">dbus-bus.c</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* -*- mode: C; c-file-style: &quot;gnu&quot;; indent-tabs-mode: nil; -*- */</span>
<a name="l00002"></a>00002 <span class="comment">/* dbus-bus.c  Convenience functions for communicating with the bus.</span>
<a name="l00003"></a>00003 <span class="comment"> *</span>
<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2003  CodeFactory AB</span>
<a name="l00005"></a>00005 <span class="comment"> * Copyright (C) 2003  Red Hat, Inc.</span>
<a name="l00006"></a>00006 <span class="comment"> *</span>
<a name="l00007"></a>00007 <span class="comment"> * Licensed under the Academic Free License version 2.1</span>
<a name="l00008"></a>00008 <span class="comment"> * </span>
<a name="l00009"></a>00009 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
<a name="l00010"></a>00010 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
<a name="l00011"></a>00011 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
<a name="l00012"></a>00012 <span class="comment"> * (at your option) any later version.</span>
<a name="l00013"></a>00013 <span class="comment"> *</span>
<a name="l00014"></a>00014 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
<a name="l00015"></a>00015 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00016"></a>00016 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
<a name="l00017"></a>00017 <span class="comment"> * GNU General Public License for more details.</span>
<a name="l00018"></a>00018 <span class="comment"> * </span>
<a name="l00019"></a>00019 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
<a name="l00020"></a>00020 <span class="comment"> * along with this program; if not, write to the Free Software</span>
<a name="l00021"></a>00021 <span class="comment"> * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA</span>
<a name="l00022"></a>00022 <span class="comment"> *</span>
<a name="l00023"></a>00023 <span class="comment"> */</span>
<a name="l00024"></a>00024 
<a name="l00025"></a>00025 <span class="preprocessor">#include &lt;config.h&gt;</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include &quot;dbus-bus.h&quot;</span>
<a name="l00027"></a>00027 <span class="preprocessor">#include &quot;dbus-protocol.h&quot;</span>
<a name="l00028"></a>00028 <span class="preprocessor">#include &quot;dbus-internals.h&quot;</span>
<a name="l00029"></a>00029 <span class="preprocessor">#include &quot;dbus-message.h&quot;</span>
<a name="l00030"></a>00030 <span class="preprocessor">#include &quot;dbus-marshal-validate.h&quot;</span>
<a name="l00031"></a>00031 <span class="preprocessor">#include &quot;dbus-misc.h&quot;</span>
<a name="l00032"></a>00032 <span class="preprocessor">#include &quot;dbus-threads-internal.h&quot;</span>
<a name="l00033"></a>00033 <span class="preprocessor">#include &quot;dbus-connection-internal.h&quot;</span>
<a name="l00034"></a>00034 <span class="preprocessor">#include &quot;dbus-string.h&quot;</span>
<a name="l00035"></a>00035 
<a name="l00077"></a><a class="code" href="structBusData.html">00077</a> <span class="keyword">typedef</span> <span class="keyword">struct</span>
<a name="l00078"></a>00078 {
<a name="l00079"></a><a class="code" href="structBusData.html#a3c78791306fb4810779fe498a1067f46">00079</a>   <a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *<a class="code" href="structBusData.html#a3c78791306fb4810779fe498a1067f46" title="Connection we&#39;re associated with.">connection</a>; 
<a name="l00080"></a><a class="code" href="structBusData.html#aaba673d2a99c4ca76fada7384942dfc9">00080</a>   <span class="keywordtype">char</span> *<a class="code" href="structBusData.html#aaba673d2a99c4ca76fada7384942dfc9" title="Unique name of this connection.">unique_name</a>; 
<a name="l00082"></a><a class="code" href="structBusData.html#a0efe71943560d7c5f9eba63618852db2">00082</a>   <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> is_well_known : 1; 
<a name="l00083"></a>00083 } <a class="code" href="structBusData.html" title="Block of message-bus-related data we attach to each DBusConnection used with these convenience functi...">BusData</a>;
<a name="l00084"></a>00084 
<a name="l00087"></a>00087 <span class="keyword">static</span> <a class="code" href="group__DBusTypes.html#gab18afa60e9b17b6e322735bda3d863d8" title="A 32-bit signed integer on all platforms.">dbus_int32_t</a> bus_data_slot = -1;
<a name="l00088"></a>00088 
<a name="l00090"></a><a class="code" href="group__DBusBusInternals.html#ga2ae7ac6acf3f48e31fb3809cd038b598">00090</a> <span class="preprocessor">#define N_BUS_TYPES 3</span>
<a name="l00091"></a>00091 <span class="preprocessor"></span>
<a name="l00092"></a>00092 <span class="keyword">static</span> <a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *bus_connections[<a class="code" href="group__DBusBusInternals.html#ga2ae7ac6acf3f48e31fb3809cd038b598" title="Number of bus types.">N_BUS_TYPES</a>];
<a name="l00093"></a>00093 <span class="keyword">static</span> <span class="keywordtype">char</span> *bus_connection_addresses[<a class="code" href="group__DBusBusInternals.html#ga2ae7ac6acf3f48e31fb3809cd038b598" title="Number of bus types.">N_BUS_TYPES</a>] = { <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>, <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>, NULL };
<a name="l00094"></a>00094 
<a name="l00095"></a>00095 <span class="keyword">static</span> <a class="code" href="group__DBusShared.html#ga980320deb96476bee7555edcdebc3528" title="Well-known bus types.">DBusBusType</a> activation_bus_type = <a class="code" href="group__DBusShared.html#gga980320deb96476bee7555edcdebc3528a564d3ef2f14a3955e764614b95162ad5" title="The bus that started us, if any.">DBUS_BUS_STARTER</a>;
<a name="l00096"></a>00096 
<a name="l00097"></a>00097 <span class="keyword">static</span> <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> initialized = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00098"></a>00098 
<a name="l00099"></a>00099 <span class="keyword">static</span> <span class="keywordtype">void</span>
<a name="l00100"></a>00100 addresses_shutdown_func (<span class="keywordtype">void</span> *data)
<a name="l00101"></a>00101 {
<a name="l00102"></a>00102   <span class="keywordtype">int</span> i;
<a name="l00103"></a>00103 
<a name="l00104"></a>00104   i = 0;
<a name="l00105"></a>00105   <span class="keywordflow">while</span> (i &lt; <a class="code" href="group__DBusBusInternals.html#ga2ae7ac6acf3f48e31fb3809cd038b598" title="Number of bus types.">N_BUS_TYPES</a>)
<a name="l00106"></a>00106     {
<a name="l00107"></a>00107       <span class="keywordflow">if</span> (bus_connections[i] != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00108"></a>00108         <a class="code" href="group__DBusInternalsUtils.html#ga63f2f8a068454b781f214ba596e313b4" title="Prints a &quot;critical&quot; warning to stderr when an assertion fails; differs from _dbus_warn primarily in t...">_dbus_warn_check_failed</a> (<span class="stringliteral">&quot;dbus_shutdown() called but connections were still live. This probably means the application did not drop all its references to bus connections.\n&quot;</span>);
<a name="l00109"></a>00109       
<a name="l00110"></a>00110       <a class="code" href="group__DBusMemory.html#ga34e666b19b015035a9a31e53da84b39a" title="Frees a block of memory previously allocated by dbus_malloc() or dbus_malloc0().">dbus_free</a> (bus_connection_addresses[i]);
<a name="l00111"></a>00111       bus_connection_addresses[i] = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00112"></a>00112       ++i;
<a name="l00113"></a>00113     }
<a name="l00114"></a>00114 
<a name="l00115"></a>00115   activation_bus_type = <a class="code" href="group__DBusShared.html#gga980320deb96476bee7555edcdebc3528a564d3ef2f14a3955e764614b95162ad5" title="The bus that started us, if any.">DBUS_BUS_STARTER</a>;
<a name="l00116"></a>00116 
<a name="l00117"></a>00117   initialized = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00118"></a>00118 }
<a name="l00119"></a>00119 
<a name="l00120"></a>00120 <span class="keyword">static</span> <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l00121"></a>00121 get_from_env (<span class="keywordtype">char</span>           **connection_p,
<a name="l00122"></a>00122               <span class="keyword">const</span> <span class="keywordtype">char</span>      *env_var)
<a name="l00123"></a>00123 {
<a name="l00124"></a>00124   <span class="keyword">const</span> <span class="keywordtype">char</span> *s;
<a name="l00125"></a>00125   
<a name="l00126"></a>00126   _dbus_assert (*connection_p == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l00127"></a>00127   
<a name="l00128"></a>00128   s = <a class="code" href="group__DBusSysdeps.html#gab846071a4de54cb7e518654f9375313a" title="Wrapper for getenv().">_dbus_getenv</a> (env_var);
<a name="l00129"></a>00129   <span class="keywordflow">if</span> (s == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a> || *s == <span class="charliteral">&#39;\0&#39;</span>)
<a name="l00130"></a>00130     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>; <span class="comment">/* successfully didn&#39;t use the env var */</span>
<a name="l00131"></a>00131   <span class="keywordflow">else</span>
<a name="l00132"></a>00132     {
<a name="l00133"></a>00133       *connection_p = <a class="code" href="group__DBusInternalsUtils.html#ga9d00d77f6595b9d7ac1baf59d44bf58c" title="Duplicates a string.">_dbus_strdup</a> (s);
<a name="l00134"></a>00134       <span class="keywordflow">return</span> *connection_p != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00135"></a>00135     }
<a name="l00136"></a>00136 }
<a name="l00137"></a>00137 
<a name="l00138"></a>00138 <span class="keyword">static</span> <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l00139"></a>00139 init_session_address (<span class="keywordtype">void</span>)
<a name="l00140"></a>00140 {
<a name="l00141"></a>00141   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> retval;
<a name="l00142"></a>00142  
<a name="l00143"></a>00143   retval = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00144"></a>00144 
<a name="l00145"></a>00145   <span class="comment">/* First, look in the environment.  This is the normal case on </span>
<a name="l00146"></a>00146 <span class="comment">   * freedesktop.org/Unix systems. */</span>
<a name="l00147"></a>00147   get_from_env (&amp;bus_connection_addresses[<a class="code" href="group__DBusShared.html#gga980320deb96476bee7555edcdebc3528a2eadb765c0d3c0d374d832bd37d387b7" title="The login session bus.">DBUS_BUS_SESSION</a>],
<a name="l00148"></a>00148                      <span class="stringliteral">&quot;DBUS_SESSION_BUS_ADDRESS&quot;</span>);
<a name="l00149"></a>00149   <span class="keywordflow">if</span> (bus_connection_addresses[<a class="code" href="group__DBusShared.html#gga980320deb96476bee7555edcdebc3528a2eadb765c0d3c0d374d832bd37d387b7" title="The login session bus.">DBUS_BUS_SESSION</a>] == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00150"></a>00150     {
<a name="l00151"></a>00151       <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> supported;
<a name="l00152"></a>00152       <a class="code" href="structDBusString.html">DBusString</a> addr;
<a name="l00153"></a>00153       <a class="code" href="structDBusError.html" title="Object representing an exception.">DBusError</a> error = <a class="code" href="group__DBusErrorInternals.html#ga961cc70e3891282a65205c4c8418d88e" title="Expands to a suitable initializer for a DBusError on the stack.">DBUS_ERROR_INIT</a>;
<a name="l00154"></a>00154 
<a name="l00155"></a>00155       <span class="keywordflow">if</span> (!<a class="code" href="group__DBusString.html#ga348252317f7bb8ac43529972945830ae" title="Initializes a string.">_dbus_string_init</a> (&amp;addr))
<a name="l00156"></a>00156         <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00157"></a>00157 
<a name="l00158"></a>00158       supported = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00159"></a>00159       <span class="comment">/* So it&#39;s not in the environment - let&#39;s try a platform-specific method.</span>
<a name="l00160"></a>00160 <span class="comment">       * On MacOS, this involves asking launchd.  On Windows (not specified yet)</span>
<a name="l00161"></a>00161 <span class="comment">       * we might do a COM lookup.</span>
<a name="l00162"></a>00162 <span class="comment">       * Ignore errors - if we failed, fall back to autolaunch. */</span>
<a name="l00163"></a>00163       retval = <a class="code" href="group__DBusSysdeps.html#gade479f90c1083346d74bc21af178d856" title="Determines the address of the session bus by querying a platform-specific method.">_dbus_lookup_session_address</a> (&amp;supported, &amp;addr, &amp;error);
<a name="l00164"></a>00164       <span class="keywordflow">if</span> (supported &amp;&amp; retval)
<a name="l00165"></a>00165         {
<a name="l00166"></a>00166           retval =<a class="code" href="group__DBusString.html#ga556cc30c3ab032dbc63e217119f0d1f5" title="Like _dbus_string_get_data(), but removes the gotten data from the original string.">_dbus_string_steal_data</a> (&amp;addr, &amp;bus_connection_addresses[<a class="code" href="group__DBusShared.html#gga980320deb96476bee7555edcdebc3528a2eadb765c0d3c0d374d832bd37d387b7" title="The login session bus.">DBUS_BUS_SESSION</a>]);
<a name="l00167"></a>00167         }
<a name="l00168"></a>00168       <span class="keywordflow">else</span> <span class="keywordflow">if</span> (supported &amp;&amp; !retval)
<a name="l00169"></a>00169         {
<a name="l00170"></a>00170           <span class="keywordflow">if</span> (<a class="code" href="group__DBusErrors.html#gab0ed62e9fc2685897eb2d41467c89405" title="Checks whether an error occurred (the error is set).">dbus_error_is_set</a>(&amp;error))
<a name="l00171"></a>00171             <a class="code" href="group__DBusInternalsUtils.html#gabea2c16d6d3fe7c4eb5b9496fc877f84" title="Prints a warning message to stderr.">_dbus_warn</a> (<span class="stringliteral">&quot;Dynamic session lookup supported but failed: %s\n&quot;</span>, error.<a class="code" href="structDBusError.html#afb559175326de5b6b340e26204e92d72" title="public error message field">message</a>);
<a name="l00172"></a>00172           <span class="keywordflow">else</span>
<a name="l00173"></a>00173             <a class="code" href="group__DBusInternalsUtils.html#gabea2c16d6d3fe7c4eb5b9496fc877f84" title="Prints a warning message to stderr.">_dbus_warn</a> (<span class="stringliteral">&quot;Dynamic session lookup supported but failed silently\n&quot;</span>);
<a name="l00174"></a>00174         }
<a name="l00175"></a>00175       <a class="code" href="group__DBusString.html#ga781ca91acda49a834dce7d0ed0eef212" title="Frees a string created by _dbus_string_init().">_dbus_string_free</a> (&amp;addr);
<a name="l00176"></a>00176     }
<a name="l00177"></a>00177   <span class="keywordflow">else</span>
<a name="l00178"></a>00178     retval = <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l00179"></a>00179 
<a name="l00180"></a>00180   <span class="keywordflow">if</span> (!retval)
<a name="l00181"></a>00181     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00182"></a>00182 
<a name="l00183"></a>00183   <span class="comment">/* We have a hard-coded (but compile-time-configurable) fallback address for</span>
<a name="l00184"></a>00184 <span class="comment">   * the session bus. */</span>
<a name="l00185"></a>00185   <span class="keywordflow">if</span> (bus_connection_addresses[<a class="code" href="group__DBusShared.html#gga980320deb96476bee7555edcdebc3528a2eadb765c0d3c0d374d832bd37d387b7" title="The login session bus.">DBUS_BUS_SESSION</a>] == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00186"></a>00186     bus_connection_addresses[<a class="code" href="group__DBusShared.html#gga980320deb96476bee7555edcdebc3528a2eadb765c0d3c0d374d832bd37d387b7" title="The login session bus.">DBUS_BUS_SESSION</a>] =
<a name="l00187"></a>00187       <a class="code" href="group__DBusInternalsUtils.html#ga9d00d77f6595b9d7ac1baf59d44bf58c" title="Duplicates a string.">_dbus_strdup</a> (DBUS_SESSION_BUS_CONNECT_ADDRESS);
<a name="l00188"></a>00188 
<a name="l00189"></a>00189   <span class="keywordflow">if</span> (bus_connection_addresses[<a class="code" href="group__DBusShared.html#gga980320deb96476bee7555edcdebc3528a2eadb765c0d3c0d374d832bd37d387b7" title="The login session bus.">DBUS_BUS_SESSION</a>] == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00190"></a>00190     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00191"></a>00191 
<a name="l00192"></a>00192   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l00193"></a>00193 }
<a name="l00194"></a>00194 
<a name="l00195"></a>00195 <span class="keyword">static</span> <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l00196"></a>00196 init_connections_unlocked (<span class="keywordtype">void</span>)
<a name="l00197"></a>00197 {
<a name="l00198"></a>00198   <span class="keywordflow">if</span> (!initialized)
<a name="l00199"></a>00199     {
<a name="l00200"></a>00200       <span class="keyword">const</span> <span class="keywordtype">char</span> *s;
<a name="l00201"></a>00201       <span class="keywordtype">int</span> i;
<a name="l00202"></a>00202 
<a name="l00203"></a>00203       i = 0;
<a name="l00204"></a>00204       <span class="keywordflow">while</span> (i &lt; <a class="code" href="group__DBusBusInternals.html#ga2ae7ac6acf3f48e31fb3809cd038b598" title="Number of bus types.">N_BUS_TYPES</a>)
<a name="l00205"></a>00205         {
<a name="l00206"></a>00206           bus_connections[i] = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00207"></a>00207           ++i;
<a name="l00208"></a>00208         }
<a name="l00209"></a>00209 
<a name="l00210"></a>00210       <span class="comment">/* Don&#39;t init these twice, we may run this code twice if</span>
<a name="l00211"></a>00211 <span class="comment">       * init_connections_unlocked() fails midway through.</span>
<a name="l00212"></a>00212 <span class="comment">       * In practice, each block below should contain only one</span>
<a name="l00213"></a>00213 <span class="comment">       * &quot;return FALSE&quot; or running through twice may not</span>
<a name="l00214"></a>00214 <span class="comment">       * work right.</span>
<a name="l00215"></a>00215 <span class="comment">       */</span>
<a name="l00216"></a>00216       
<a name="l00217"></a>00217        <span class="keywordflow">if</span> (bus_connection_addresses[<a class="code" href="group__DBusShared.html#gga980320deb96476bee7555edcdebc3528ab1ecb5521dfc0efed3ef2847a8c20666" title="The systemwide bus.">DBUS_BUS_SYSTEM</a>] == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00218"></a>00218          {
<a name="l00219"></a>00219            _dbus_verbose (<span class="stringliteral">&quot;Filling in system bus address...\n&quot;</span>);
<a name="l00220"></a>00220            
<a name="l00221"></a>00221            <span class="keywordflow">if</span> (!get_from_env (&amp;bus_connection_addresses[<a class="code" href="group__DBusShared.html#gga980320deb96476bee7555edcdebc3528ab1ecb5521dfc0efed3ef2847a8c20666" title="The systemwide bus.">DBUS_BUS_SYSTEM</a>],
<a name="l00222"></a>00222                               <span class="stringliteral">&quot;DBUS_SYSTEM_BUS_ADDRESS&quot;</span>))
<a name="l00223"></a>00223              <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00224"></a>00224          }
<a name="l00225"></a>00225 
<a name="l00226"></a>00226                   
<a name="l00227"></a>00227        <span class="keywordflow">if</span> (bus_connection_addresses[<a class="code" href="group__DBusShared.html#gga980320deb96476bee7555edcdebc3528ab1ecb5521dfc0efed3ef2847a8c20666" title="The systemwide bus.">DBUS_BUS_SYSTEM</a>] == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00228"></a>00228          {
<a name="l00229"></a>00229            <span class="comment">/* Use default system bus address if none set in environment */</span>
<a name="l00230"></a>00230            bus_connection_addresses[<a class="code" href="group__DBusShared.html#gga980320deb96476bee7555edcdebc3528ab1ecb5521dfc0efed3ef2847a8c20666" title="The systemwide bus.">DBUS_BUS_SYSTEM</a>] =
<a name="l00231"></a>00231              <a class="code" href="group__DBusInternalsUtils.html#ga9d00d77f6595b9d7ac1baf59d44bf58c" title="Duplicates a string.">_dbus_strdup</a> (DBUS_SYSTEM_BUS_DEFAULT_ADDRESS);
<a name="l00232"></a>00232 
<a name="l00233"></a>00233            <span class="keywordflow">if</span> (bus_connection_addresses[<a class="code" href="group__DBusShared.html#gga980320deb96476bee7555edcdebc3528ab1ecb5521dfc0efed3ef2847a8c20666" title="The systemwide bus.">DBUS_BUS_SYSTEM</a>] == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00234"></a>00234              <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00235"></a>00235            
<a name="l00236"></a>00236            _dbus_verbose (<span class="stringliteral">&quot;  used default system bus \&quot;%s\&quot;\n&quot;</span>,
<a name="l00237"></a>00237                           bus_connection_addresses[<a class="code" href="group__DBusShared.html#gga980320deb96476bee7555edcdebc3528ab1ecb5521dfc0efed3ef2847a8c20666" title="The systemwide bus.">DBUS_BUS_SYSTEM</a>]);
<a name="l00238"></a>00238          }
<a name="l00239"></a>00239        <span class="keywordflow">else</span>
<a name="l00240"></a>00240          _dbus_verbose (<span class="stringliteral">&quot;  used env var system bus \&quot;%s\&quot;\n&quot;</span>,
<a name="l00241"></a>00241                         bus_connection_addresses[<a class="code" href="group__DBusShared.html#gga980320deb96476bee7555edcdebc3528ab1ecb5521dfc0efed3ef2847a8c20666" title="The systemwide bus.">DBUS_BUS_SYSTEM</a>]);
<a name="l00242"></a>00242           
<a name="l00243"></a>00243       <span class="keywordflow">if</span> (bus_connection_addresses[<a class="code" href="group__DBusShared.html#gga980320deb96476bee7555edcdebc3528a2eadb765c0d3c0d374d832bd37d387b7" title="The login session bus.">DBUS_BUS_SESSION</a>] == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00244"></a>00244         {
<a name="l00245"></a>00245           _dbus_verbose (<span class="stringliteral">&quot;Filling in session bus address...\n&quot;</span>);
<a name="l00246"></a>00246           
<a name="l00247"></a>00247           <span class="keywordflow">if</span> (!init_session_address ())
<a name="l00248"></a>00248             <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00249"></a>00249 
<a name="l00250"></a>00250           _dbus_verbose (<span class="stringliteral">&quot;  \&quot;%s\&quot;\n&quot;</span>, bus_connection_addresses[<a class="code" href="group__DBusShared.html#gga980320deb96476bee7555edcdebc3528a2eadb765c0d3c0d374d832bd37d387b7" title="The login session bus.">DBUS_BUS_SESSION</a>] ?
<a name="l00251"></a>00251                          bus_connection_addresses[<a class="code" href="group__DBusShared.html#gga980320deb96476bee7555edcdebc3528a2eadb765c0d3c0d374d832bd37d387b7" title="The login session bus.">DBUS_BUS_SESSION</a>] : <span class="stringliteral">&quot;none set&quot;</span>);
<a name="l00252"></a>00252         }
<a name="l00253"></a>00253 
<a name="l00254"></a>00254       <span class="keywordflow">if</span> (bus_connection_addresses[<a class="code" href="group__DBusShared.html#gga980320deb96476bee7555edcdebc3528a564d3ef2f14a3955e764614b95162ad5" title="The bus that started us, if any.">DBUS_BUS_STARTER</a>] == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00255"></a>00255         {
<a name="l00256"></a>00256           _dbus_verbose (<span class="stringliteral">&quot;Filling in activation bus address...\n&quot;</span>);
<a name="l00257"></a>00257           
<a name="l00258"></a>00258           <span class="keywordflow">if</span> (!get_from_env (&amp;bus_connection_addresses[<a class="code" href="group__DBusShared.html#gga980320deb96476bee7555edcdebc3528a564d3ef2f14a3955e764614b95162ad5" title="The bus that started us, if any.">DBUS_BUS_STARTER</a>],
<a name="l00259"></a>00259                              <span class="stringliteral">&quot;DBUS_STARTER_ADDRESS&quot;</span>))
<a name="l00260"></a>00260             <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00261"></a>00261           
<a name="l00262"></a>00262           _dbus_verbose (<span class="stringliteral">&quot;  \&quot;%s\&quot;\n&quot;</span>, bus_connection_addresses[DBUS_BUS_STARTER] ?
<a name="l00263"></a>00263                          bus_connection_addresses[DBUS_BUS_STARTER] : <span class="stringliteral">&quot;none set&quot;</span>);
<a name="l00264"></a>00264         }
<a name="l00265"></a>00265 
<a name="l00266"></a>00266 
<a name="l00267"></a>00267       <span class="keywordflow">if</span> (bus_connection_addresses[<a class="code" href="group__DBusShared.html#gga980320deb96476bee7555edcdebc3528a564d3ef2f14a3955e764614b95162ad5" title="The bus that started us, if any.">DBUS_BUS_STARTER</a>] != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00268"></a>00268         {
<a name="l00269"></a>00269           s = <a class="code" href="group__DBusSysdeps.html#gab846071a4de54cb7e518654f9375313a" title="Wrapper for getenv().">_dbus_getenv</a> (<span class="stringliteral">&quot;DBUS_STARTER_BUS_TYPE&quot;</span>);
<a name="l00270"></a>00270               
<a name="l00271"></a>00271           <span class="keywordflow">if</span> (s != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00272"></a>00272             {
<a name="l00273"></a>00273               _dbus_verbose (<span class="stringliteral">&quot;Bus activation type was set to \&quot;%s\&quot;\n&quot;</span>, s);
<a name="l00274"></a>00274                   
<a name="l00275"></a>00275               <span class="keywordflow">if</span> (strcmp (s, <span class="stringliteral">&quot;system&quot;</span>) == 0)
<a name="l00276"></a>00276                 activation_bus_type = <a class="code" href="group__DBusShared.html#gga980320deb96476bee7555edcdebc3528ab1ecb5521dfc0efed3ef2847a8c20666" title="The systemwide bus.">DBUS_BUS_SYSTEM</a>;
<a name="l00277"></a>00277               <span class="keywordflow">else</span> <span class="keywordflow">if</span> (strcmp (s, <span class="stringliteral">&quot;session&quot;</span>) == 0)
<a name="l00278"></a>00278                 activation_bus_type = <a class="code" href="group__DBusShared.html#gga980320deb96476bee7555edcdebc3528a2eadb765c0d3c0d374d832bd37d387b7" title="The login session bus.">DBUS_BUS_SESSION</a>;
<a name="l00279"></a>00279             }
<a name="l00280"></a>00280         }
<a name="l00281"></a>00281       <span class="keywordflow">else</span>
<a name="l00282"></a>00282         {
<a name="l00283"></a>00283           <span class="comment">/* Default to the session bus instead if available */</span>
<a name="l00284"></a>00284           <span class="keywordflow">if</span> (bus_connection_addresses[<a class="code" href="group__DBusShared.html#gga980320deb96476bee7555edcdebc3528a2eadb765c0d3c0d374d832bd37d387b7" title="The login session bus.">DBUS_BUS_SESSION</a>] != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00285"></a>00285             {
<a name="l00286"></a>00286               bus_connection_addresses[<a class="code" href="group__DBusShared.html#gga980320deb96476bee7555edcdebc3528a564d3ef2f14a3955e764614b95162ad5" title="The bus that started us, if any.">DBUS_BUS_STARTER</a>] =
<a name="l00287"></a>00287                 <a class="code" href="group__DBusInternalsUtils.html#ga9d00d77f6595b9d7ac1baf59d44bf58c" title="Duplicates a string.">_dbus_strdup</a> (bus_connection_addresses[<a class="code" href="group__DBusShared.html#gga980320deb96476bee7555edcdebc3528a2eadb765c0d3c0d374d832bd37d387b7" title="The login session bus.">DBUS_BUS_SESSION</a>]);
<a name="l00288"></a>00288               <span class="keywordflow">if</span> (bus_connection_addresses[<a class="code" href="group__DBusShared.html#gga980320deb96476bee7555edcdebc3528a564d3ef2f14a3955e764614b95162ad5" title="The bus that started us, if any.">DBUS_BUS_STARTER</a>] == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00289"></a>00289                 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00290"></a>00290             }
<a name="l00291"></a>00291         }
<a name="l00292"></a>00292       
<a name="l00293"></a>00293       <span class="comment">/* If we return FALSE we have to be sure that restarting</span>
<a name="l00294"></a>00294 <span class="comment">       * the above code will work right</span>
<a name="l00295"></a>00295 <span class="comment">       */</span>
<a name="l00296"></a>00296       
<a name="l00297"></a>00297       <span class="keywordflow">if</span> (!<a class="code" href="group__DBusMemoryInternals.html#ga8dc6d5dd0a0e7901ab793da7403ee734" title="Register a cleanup function to be called exactly once the next time dbus_shutdown() is called...">_dbus_register_shutdown_func</a> (addresses_shutdown_func,
<a name="l00298"></a>00298                                          <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>))
<a name="l00299"></a>00299         <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00300"></a>00300       
<a name="l00301"></a>00301       initialized = <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l00302"></a>00302     }
<a name="l00303"></a>00303 
<a name="l00304"></a>00304   <span class="keywordflow">return</span> initialized;
<a name="l00305"></a>00305 }
<a name="l00306"></a>00306 
<a name="l00307"></a>00307 <span class="keyword">static</span> <span class="keywordtype">void</span>
<a name="l00308"></a>00308 bus_data_free (<span class="keywordtype">void</span> *data)
<a name="l00309"></a>00309 {
<a name="l00310"></a>00310   <a class="code" href="structBusData.html" title="Block of message-bus-related data we attach to each DBusConnection used with these convenience functi...">BusData</a> *bd = data;
<a name="l00311"></a>00311   
<a name="l00312"></a>00312   <span class="keywordflow">if</span> (bd-&gt;<a class="code" href="structBusData.html#a0efe71943560d7c5f9eba63618852db2" title="Is one of the well-known connections in our global array.">is_well_known</a>)
<a name="l00313"></a>00313     {
<a name="l00314"></a>00314       <span class="keywordtype">int</span> i;
<a name="l00315"></a>00315 
<a name="l00316"></a>00316       <span class="keywordflow">if</span> (!_DBUS_LOCK (bus))
<a name="l00317"></a>00317         _dbus_assert_not_reached (<span class="stringliteral">&quot;global locks should have been initialized &quot;</span>
<a name="l00318"></a>00318             <span class="stringliteral">&quot;when we attached bus data&quot;</span>);
<a name="l00319"></a>00319 
<a name="l00320"></a>00320       <span class="comment">/* We may be stored in more than one slot */</span>
<a name="l00321"></a>00321       <span class="comment">/* This should now be impossible - these slots are supposed to</span>
<a name="l00322"></a>00322 <span class="comment">       * be cleared on disconnect, so should not need to be cleared on</span>
<a name="l00323"></a>00323 <span class="comment">       * finalize</span>
<a name="l00324"></a>00324 <span class="comment">       */</span>
<a name="l00325"></a>00325       i = 0;
<a name="l00326"></a>00326       <span class="keywordflow">while</span> (i &lt; <a class="code" href="group__DBusBusInternals.html#ga2ae7ac6acf3f48e31fb3809cd038b598" title="Number of bus types.">N_BUS_TYPES</a>)
<a name="l00327"></a>00327         {
<a name="l00328"></a>00328           <span class="keywordflow">if</span> (bus_connections[i] == bd-&gt;<a class="code" href="structBusData.html#a3c78791306fb4810779fe498a1067f46" title="Connection we&#39;re associated with.">connection</a>)
<a name="l00329"></a>00329             bus_connections[i] = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00330"></a>00330           
<a name="l00331"></a>00331           ++i;
<a name="l00332"></a>00332         }
<a name="l00333"></a>00333       _DBUS_UNLOCK (bus);
<a name="l00334"></a>00334     }
<a name="l00335"></a>00335   
<a name="l00336"></a>00336   <a class="code" href="group__DBusMemory.html#ga34e666b19b015035a9a31e53da84b39a" title="Frees a block of memory previously allocated by dbus_malloc() or dbus_malloc0().">dbus_free</a> (bd-&gt;<a class="code" href="structBusData.html#aaba673d2a99c4ca76fada7384942dfc9" title="Unique name of this connection.">unique_name</a>);
<a name="l00337"></a>00337   <a class="code" href="group__DBusMemory.html#ga34e666b19b015035a9a31e53da84b39a" title="Frees a block of memory previously allocated by dbus_malloc() or dbus_malloc0().">dbus_free</a> (bd);
<a name="l00338"></a>00338 
<a name="l00339"></a>00339   <a class="code" href="group__DBusConnection.html#ga7dc8c73d8c3e733f5410d52be84239a0" title="Deallocates a global ID for connection data slots.">dbus_connection_free_data_slot</a> (&amp;bus_data_slot);
<a name="l00340"></a>00340 }
<a name="l00341"></a>00341 
<a name="l00342"></a>00342 <span class="keyword">static</span> <a class="code" href="structBusData.html" title="Block of message-bus-related data we attach to each DBusConnection used with these convenience functi...">BusData</a>*
<a name="l00343"></a>00343 ensure_bus_data (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l00344"></a>00344 {
<a name="l00345"></a>00345   <a class="code" href="structBusData.html" title="Block of message-bus-related data we attach to each DBusConnection used with these convenience functi...">BusData</a> *bd;
<a name="l00346"></a>00346 
<a name="l00347"></a>00347   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusConnection.html#ga728b15c71a492ad244e5a480f1156088" title="Allocates an integer ID to be used for storing application-specific data on any DBusConnection.">dbus_connection_allocate_data_slot</a> (&amp;bus_data_slot))
<a name="l00348"></a>00348     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00349"></a>00349 
<a name="l00350"></a>00350   bd = <a class="code" href="group__DBusConnection.html#ga433fae9844a66d9d078d238e6c723b95" title="Retrieves data previously set with dbus_connection_set_data().">dbus_connection_get_data</a> (connection, bus_data_slot);
<a name="l00351"></a>00351   <span class="keywordflow">if</span> (bd == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00352"></a>00352     {      
<a name="l00353"></a>00353       bd = <a class="code" href="group__DBusMemory.html#gaba9d823abda7f4cadbaf5177d3b8b793" title="Safe macro for using dbus_malloc0().">dbus_new0</a> (<a class="code" href="structBusData.html" title="Block of message-bus-related data we attach to each DBusConnection used with these convenience functi...">BusData</a>, 1);
<a name="l00354"></a>00354       <span class="keywordflow">if</span> (bd == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00355"></a>00355         {
<a name="l00356"></a>00356           <a class="code" href="group__DBusConnection.html#ga7dc8c73d8c3e733f5410d52be84239a0" title="Deallocates a global ID for connection data slots.">dbus_connection_free_data_slot</a> (&amp;bus_data_slot);
<a name="l00357"></a>00357           <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00358"></a>00358         }
<a name="l00359"></a>00359 
<a name="l00360"></a>00360       bd-&gt;<a class="code" href="structBusData.html#a3c78791306fb4810779fe498a1067f46" title="Connection we&#39;re associated with.">connection</a> = connection;
<a name="l00361"></a>00361       
<a name="l00362"></a>00362       <span class="keywordflow">if</span> (!<a class="code" href="group__DBusConnection.html#ga845b4942399f43dd4ac644de7cb9e3ff" title="Stores a pointer on a DBusConnection, along with an optional function to be used for freeing the data...">dbus_connection_set_data</a> (connection, bus_data_slot, bd,
<a name="l00363"></a>00363                                      bus_data_free))
<a name="l00364"></a>00364         {
<a name="l00365"></a>00365           <a class="code" href="group__DBusMemory.html#ga34e666b19b015035a9a31e53da84b39a" title="Frees a block of memory previously allocated by dbus_malloc() or dbus_malloc0().">dbus_free</a> (bd);
<a name="l00366"></a>00366           <a class="code" href="group__DBusConnection.html#ga7dc8c73d8c3e733f5410d52be84239a0" title="Deallocates a global ID for connection data slots.">dbus_connection_free_data_slot</a> (&amp;bus_data_slot);
<a name="l00367"></a>00367           <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00368"></a>00368         }
<a name="l00369"></a>00369 
<a name="l00370"></a>00370       <span class="comment">/* Data slot refcount now held by the BusData */</span>
<a name="l00371"></a>00371     }
<a name="l00372"></a>00372   <span class="keywordflow">else</span>
<a name="l00373"></a>00373     {
<a name="l00374"></a>00374       <a class="code" href="group__DBusConnection.html#ga7dc8c73d8c3e733f5410d52be84239a0" title="Deallocates a global ID for connection data slots.">dbus_connection_free_data_slot</a> (&amp;bus_data_slot);
<a name="l00375"></a>00375     }
<a name="l00376"></a>00376 
<a name="l00377"></a>00377   <span class="keywordflow">return</span> bd;
<a name="l00378"></a>00378 }
<a name="l00379"></a>00379 
<a name="l00386"></a>00386 <span class="keywordtype">void</span>
<a name="l00387"></a><a class="code" href="group__DBusBusInternals.html#ga0e7fe5d0dcaca7ecb4b5a7ace23d6286">00387</a> <a class="code" href="group__DBusBusInternals.html#ga0e7fe5d0dcaca7ecb4b5a7ace23d6286" title="Internal function that checks to see if this is a shared connection owned by the bus and if it is unr...">_dbus_bus_notify_shared_connection_disconnected_unlocked</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l00388"></a>00388 {
<a name="l00389"></a>00389   <span class="keywordtype">int</span> i;
<a name="l00390"></a>00390 
<a name="l00391"></a>00391   <span class="keywordflow">if</span> (!_DBUS_LOCK (bus))
<a name="l00392"></a>00392     {
<a name="l00393"></a>00393       <span class="comment">/* If it was in bus_connections, we would have initialized global locks</span>
<a name="l00394"></a>00394 <span class="comment">       * when we added it. So, it can&#39;t be. */</span>
<a name="l00395"></a>00395       <span class="keywordflow">return</span>;
<a name="l00396"></a>00396     }
<a name="l00397"></a>00397 
<a name="l00398"></a>00398   <span class="comment">/* We are expecting to have the connection saved in only one of these</span>
<a name="l00399"></a>00399 <span class="comment">   * slots, but someone could in a pathological case set system and session</span>
<a name="l00400"></a>00400 <span class="comment">   * bus to the same bus or something. Or set one of them to the starter</span>
<a name="l00401"></a>00401 <span class="comment">   * bus without setting the starter bus type in the env variable.</span>
<a name="l00402"></a>00402 <span class="comment">   * So we don&#39;t break the loop as soon as we find a match.</span>
<a name="l00403"></a>00403 <span class="comment">   */</span>
<a name="l00404"></a>00404   <span class="keywordflow">for</span> (i = 0; i &lt; <a class="code" href="group__DBusBusInternals.html#ga2ae7ac6acf3f48e31fb3809cd038b598" title="Number of bus types.">N_BUS_TYPES</a>; ++i)
<a name="l00405"></a>00405     {
<a name="l00406"></a>00406       <span class="keywordflow">if</span> (bus_connections[i] == connection)
<a name="l00407"></a>00407         {
<a name="l00408"></a>00408           bus_connections[i] = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00409"></a>00409         }
<a name="l00410"></a>00410     }
<a name="l00411"></a>00411 
<a name="l00412"></a>00412   _DBUS_UNLOCK (bus);
<a name="l00413"></a>00413 }
<a name="l00414"></a>00414 
<a name="l00415"></a>00415 <span class="keyword">static</span> <a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *
<a name="l00416"></a>00416 internal_bus_get (<a class="code" href="group__DBusShared.html#ga980320deb96476bee7555edcdebc3528" title="Well-known bus types.">DBusBusType</a>  type,
<a name="l00417"></a>00417                   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>  <span class="keyword">private</span>,
<a name="l00418"></a>00418                   <a class="code" href="structDBusError.html" title="Object representing an exception.">DBusError</a>   *error)
<a name="l00419"></a>00419 {
<a name="l00420"></a>00420   <span class="keyword">const</span> <span class="keywordtype">char</span> *address;
<a name="l00421"></a>00421   <a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection;
<a name="l00422"></a>00422   <a class="code" href="structBusData.html" title="Block of message-bus-related data we attach to each DBusConnection used with these convenience functi...">BusData</a> *bd;
<a name="l00423"></a>00423   <a class="code" href="group__DBusShared.html#ga980320deb96476bee7555edcdebc3528" title="Well-known bus types.">DBusBusType</a> address_type;
<a name="l00424"></a>00424 
<a name="l00425"></a>00425   _dbus_return_val_if_fail (type &gt;= 0 &amp;&amp; type &lt; <a class="code" href="group__DBusBusInternals.html#ga2ae7ac6acf3f48e31fb3809cd038b598" title="Number of bus types.">N_BUS_TYPES</a>, <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l00426"></a>00426   _dbus_return_val_if_error_is_set (error, <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l00427"></a>00427 
<a name="l00428"></a>00428   connection = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00429"></a>00429 
<a name="l00430"></a>00430   <span class="keywordflow">if</span> (!_DBUS_LOCK (bus))
<a name="l00431"></a>00431     {
<a name="l00432"></a>00432       _DBUS_SET_OOM (error);
<a name="l00433"></a>00433       <span class="comment">/* do not &quot;goto out&quot;, that would try to unlock */</span>
<a name="l00434"></a>00434       <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00435"></a>00435     }
<a name="l00436"></a>00436 
<a name="l00437"></a>00437   <span class="keywordflow">if</span> (!init_connections_unlocked ())
<a name="l00438"></a>00438     {
<a name="l00439"></a>00439       _DBUS_SET_OOM (error);
<a name="l00440"></a>00440       <span class="keywordflow">goto</span> out;
<a name="l00441"></a>00441     }
<a name="l00442"></a>00442 
<a name="l00443"></a>00443   <span class="comment">/* We want to use the activation address even if the</span>
<a name="l00444"></a>00444 <span class="comment">   * activating bus is the session or system bus,</span>
<a name="l00445"></a>00445 <span class="comment">   * per the spec.</span>
<a name="l00446"></a>00446 <span class="comment">   */</span>
<a name="l00447"></a>00447   address_type = type;
<a name="l00448"></a>00448   
<a name="l00449"></a>00449   <span class="comment">/* Use the real type of the activation bus for getting its</span>
<a name="l00450"></a>00450 <span class="comment">   * connection, but only if the real type&#39;s address is available. (If</span>
<a name="l00451"></a>00451 <span class="comment">   * the activating bus isn&#39;t a well-known bus then</span>
<a name="l00452"></a>00452 <span class="comment">   * activation_bus_type == DBUS_BUS_STARTER)</span>
<a name="l00453"></a>00453 <span class="comment">   */</span>
<a name="l00454"></a>00454   <span class="keywordflow">if</span> (type == <a class="code" href="group__DBusShared.html#gga980320deb96476bee7555edcdebc3528a564d3ef2f14a3955e764614b95162ad5" title="The bus that started us, if any.">DBUS_BUS_STARTER</a> &amp;&amp;
<a name="l00455"></a>00455       bus_connection_addresses[activation_bus_type] != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00456"></a>00456     type = activation_bus_type;
<a name="l00457"></a>00457   
<a name="l00458"></a>00458   <span class="keywordflow">if</span> (!<span class="keyword">private</span> &amp;&amp; bus_connections[type] != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00459"></a>00459     {
<a name="l00460"></a>00460       connection = bus_connections[type];
<a name="l00461"></a>00461       <a class="code" href="group__DBusConnection.html#gae34751e15f114217e5ad10c663e2ef2e" title="Increments the reference count of a DBusConnection.">dbus_connection_ref</a> (connection);
<a name="l00462"></a>00462       <span class="keywordflow">goto</span> out;
<a name="l00463"></a>00463     }
<a name="l00464"></a>00464 
<a name="l00465"></a>00465   address = bus_connection_addresses[address_type];
<a name="l00466"></a>00466   <span class="keywordflow">if</span> (address == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00467"></a>00467     {
<a name="l00468"></a>00468       <a class="code" href="group__DBusErrors.html#ga89d2ad4bde21f9e0057fac07a79885e3" title="Assigns an error name and message to a DBusError.">dbus_set_error</a> (error, <a class="code" href="group__DBusProtocol.html#gabb62fd6340d0787fbd56ff8dd2f326c7" title="A generic error; &quot;something went wrong&quot; - see the error message for more.">DBUS_ERROR_FAILED</a>,
<a name="l00469"></a>00469                       <span class="stringliteral">&quot;Unable to determine the address of the message bus (try &#39;man dbus-launch&#39; and &#39;man dbus-daemon&#39; for help)&quot;</span>);
<a name="l00470"></a>00470       <span class="keywordflow">goto</span> out;
<a name="l00471"></a>00471     }
<a name="l00472"></a>00472 
<a name="l00473"></a>00473   <span class="keywordflow">if</span> (<span class="keyword">private</span>)
<a name="l00474"></a>00474     connection = <a class="code" href="group__DBusConnection.html#ga434e3fc7ee420fd30e2f05e57ff26b1d" title="Opens a new, dedicated connection to a remote address.">dbus_connection_open_private</a> (address, error);
<a name="l00475"></a>00475   <span class="keywordflow">else</span>
<a name="l00476"></a>00476     connection = <a class="code" href="group__DBusConnection.html#gacd32f819820266598c6b6847dfddaf9c" title="Gets a connection to a remote address.">dbus_connection_open</a> (address, error);
<a name="l00477"></a>00477   
<a name="l00478"></a>00478   <span class="keywordflow">if</span> (!connection)
<a name="l00479"></a>00479     {
<a name="l00480"></a>00480       <span class="keywordflow">goto</span> out;
<a name="l00481"></a>00481     }
<a name="l00482"></a>00482 
<a name="l00483"></a>00483   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusBus.html#ga0c21cf74d05c0bd8003846b56a588a4b" title="Registers a connection with the bus.">dbus_bus_register</a> (connection, error))
<a name="l00484"></a>00484     {
<a name="l00485"></a>00485       <a class="code" href="group__DBusConnectionInternals.html#gadc46f7abfe925f9860fc8c64aeb29ad2" title="Closes a shared OR private connection, while dbus_connection_close() can only be used on private conn...">_dbus_connection_close_possibly_shared</a> (connection);
<a name="l00486"></a>00486       <a class="code" href="group__DBusConnection.html#ga6385ff09bc108238c4429e7c195dab25" title="Decrements the reference count of a DBusConnection, and finalizes it if the count reaches zero...">dbus_connection_unref</a> (connection);
<a name="l00487"></a>00487       connection = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00488"></a>00488       <span class="keywordflow">goto</span> out;
<a name="l00489"></a>00489     }
<a name="l00490"></a>00490 
<a name="l00491"></a>00491   <span class="keywordflow">if</span> (!<span class="keyword">private</span>)
<a name="l00492"></a>00492     {
<a name="l00493"></a>00493       <span class="comment">/* store a weak ref to the connection (dbus-connection.c is</span>
<a name="l00494"></a>00494 <span class="comment">       * supposed to have a strong ref that it drops on disconnect,</span>
<a name="l00495"></a>00495 <span class="comment">       * since this is a shared connection)</span>
<a name="l00496"></a>00496 <span class="comment">       */</span>
<a name="l00497"></a>00497       bus_connections[type] = connection;
<a name="l00498"></a>00498     }
<a name="l00499"></a>00499 
<a name="l00500"></a>00500   <span class="comment">/* By default we&#39;re bound to the lifecycle of</span>
<a name="l00501"></a>00501 <span class="comment">   * the message bus.</span>
<a name="l00502"></a>00502 <span class="comment">   */</span>
<a name="l00503"></a>00503   <a class="code" href="group__DBusConnection.html#ga19091beb74f1504b0e862a7ad10e71cd" title="Set whether _exit() should be called when the connection receives a disconnect signal.">dbus_connection_set_exit_on_disconnect</a> (connection,
<a name="l00504"></a>00504                                           <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>);
<a name="l00505"></a>00505 
<a name="l00506"></a>00506   <span class="keywordflow">if</span> (!_DBUS_LOCK (bus_datas))
<a name="l00507"></a>00507     _dbus_assert_not_reached (<span class="stringliteral">&quot;global locks were initialized already&quot;</span>);
<a name="l00508"></a>00508 
<a name="l00509"></a>00509   bd = ensure_bus_data (connection);
<a name="l00510"></a>00510   _dbus_assert (bd != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>); <span class="comment">/* it should have been created on</span>
<a name="l00511"></a>00511 <span class="comment">                                register, so OOM not possible */</span>
<a name="l00512"></a>00512   bd-&gt;<a class="code" href="structBusData.html#a0efe71943560d7c5f9eba63618852db2" title="Is one of the well-known connections in our global array.">is_well_known</a> = <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l00513"></a>00513   _DBUS_UNLOCK (bus_datas);
<a name="l00514"></a>00514 
<a name="l00515"></a>00515 out:
<a name="l00516"></a>00516   <span class="comment">/* Return a reference to the caller, or NULL with error set. */</span>
<a name="l00517"></a>00517   <span class="keywordflow">if</span> (connection == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00518"></a>00518     _DBUS_ASSERT_ERROR_IS_SET (error);
<a name="l00519"></a>00519 
<a name="l00520"></a>00520   _DBUS_UNLOCK (bus);
<a name="l00521"></a>00521   <span class="keywordflow">return</span> connection;
<a name="l00522"></a>00522 }
<a name="l00523"></a>00523 
<a name="l00524"></a>00524  <span class="comment">/* end of implementation details docs */</span>
<a name="l00526"></a>00526 
<a name="l00557"></a>00557 <a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *
<a name="l00558"></a><a class="code" href="group__DBusBus.html#ga77ba5250adb84620f16007e1b023cf26">00558</a> <a class="code" href="group__DBusBus.html#ga77ba5250adb84620f16007e1b023cf26" title="Connects to a bus daemon and registers the client with it.">dbus_bus_get</a> (<a class="code" href="group__DBusShared.html#ga980320deb96476bee7555edcdebc3528" title="Well-known bus types.">DBusBusType</a>  type,
<a name="l00559"></a>00559               <a class="code" href="structDBusError.html" title="Object representing an exception.">DBusError</a>   *error)
<a name="l00560"></a>00560 {
<a name="l00561"></a>00561   <span class="keywordflow">return</span> internal_bus_get (type, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>, error);
<a name="l00562"></a>00562 }
<a name="l00563"></a>00563 
<a name="l00589"></a>00589 <a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *
<a name="l00590"></a><a class="code" href="group__DBusBus.html#ga9c62186f19cf3bd3c7c604bdcefb4e09">00590</a> <a class="code" href="group__DBusBus.html#ga9c62186f19cf3bd3c7c604bdcefb4e09" title="Connects to a bus daemon and registers the client with it as with dbus_bus_register().">dbus_bus_get_private</a> (<a class="code" href="group__DBusShared.html#ga980320deb96476bee7555edcdebc3528" title="Well-known bus types.">DBusBusType</a>  type,
<a name="l00591"></a>00591                       <a class="code" href="structDBusError.html" title="Object representing an exception.">DBusError</a>   *error)
<a name="l00592"></a>00592 {
<a name="l00593"></a>00593   <span class="keywordflow">return</span> internal_bus_get (type, <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>, error);
<a name="l00594"></a>00594 }
<a name="l00595"></a>00595 
<a name="l00645"></a>00645 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l00646"></a><a class="code" href="group__DBusBus.html#ga0c21cf74d05c0bd8003846b56a588a4b">00646</a> <a class="code" href="group__DBusBus.html#ga0c21cf74d05c0bd8003846b56a588a4b" title="Registers a connection with the bus.">dbus_bus_register</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l00647"></a>00647                    <a class="code" href="structDBusError.html" title="Object representing an exception.">DBusError</a>      *error)
<a name="l00648"></a>00648 {
<a name="l00649"></a>00649   <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message, *reply;
<a name="l00650"></a>00650   <span class="keywordtype">char</span> *name;
<a name="l00651"></a>00651   <a class="code" href="structBusData.html" title="Block of message-bus-related data we attach to each DBusConnection used with these convenience functi...">BusData</a> *bd;
<a name="l00652"></a>00652   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> retval;
<a name="l00653"></a>00653 
<a name="l00654"></a>00654   _dbus_return_val_if_fail (connection != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l00655"></a>00655   _dbus_return_val_if_error_is_set (error, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l00656"></a>00656 
<a name="l00657"></a>00657   retval = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00658"></a>00658   message = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00659"></a>00659   reply = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00660"></a>00660 
<a name="l00661"></a>00661   <span class="keywordflow">if</span> (!_DBUS_LOCK (bus_datas))
<a name="l00662"></a>00662     {
<a name="l00663"></a>00663       _DBUS_SET_OOM (error);
<a name="l00664"></a>00664       <span class="comment">/* do not &quot;goto out&quot;, that would try to unlock */</span>
<a name="l00665"></a>00665       <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00666"></a>00666     }
<a name="l00667"></a>00667 
<a name="l00668"></a>00668   bd = ensure_bus_data (connection);
<a name="l00669"></a>00669   <span class="keywordflow">if</span> (bd == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00670"></a>00670     {
<a name="l00671"></a>00671       _DBUS_SET_OOM (error);
<a name="l00672"></a>00672       <span class="keywordflow">goto</span> out;
<a name="l00673"></a>00673     }
<a name="l00674"></a>00674 
<a name="l00675"></a>00675   <span class="keywordflow">if</span> (bd-&gt;<a class="code" href="structBusData.html#aaba673d2a99c4ca76fada7384942dfc9" title="Unique name of this connection.">unique_name</a> != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00676"></a>00676     {
<a name="l00677"></a>00677       _dbus_verbose (<span class="stringliteral">&quot;Ignoring attempt to register the same DBusConnection %s with the message bus a second time.\n&quot;</span>,
<a name="l00678"></a>00678                      bd-&gt;<a class="code" href="structBusData.html#aaba673d2a99c4ca76fada7384942dfc9" title="Unique name of this connection.">unique_name</a>);
<a name="l00679"></a>00679       <span class="comment">/* Success! */</span>
<a name="l00680"></a>00680       retval = <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l00681"></a>00681       <span class="keywordflow">goto</span> out;
<a name="l00682"></a>00682     }
<a name="l00683"></a>00683   
<a name="l00684"></a>00684   message = <a class="code" href="group__DBusMessage.html#ga98ddc82450d818138ef326a284201ee0" title="Constructs a new message to invoke a method on a remote object.">dbus_message_new_method_call</a> (<a class="code" href="group__DBusShared.html#ga9e017e829e575bdc5c554fd4d07d7355" title="The bus name used to talk to the bus itself.">DBUS_SERVICE_DBUS</a>,
<a name="l00685"></a>00685                                           <a class="code" href="group__DBusShared.html#ga840a593b8fa139c69ef679830f42d91f" title="The object path used to talk to the bus itself.">DBUS_PATH_DBUS</a>,
<a name="l00686"></a>00686                                           <a class="code" href="group__DBusShared.html#gaa34514374bb61b8222a670a3d0b3fdc4" title="The interface exported by the object with DBUS_SERVICE_DBUS and DBUS_PATH_DBUS.">DBUS_INTERFACE_DBUS</a>,
<a name="l00687"></a>00687                                           <span class="stringliteral">&quot;Hello&quot;</span>); 
<a name="l00688"></a>00688 
<a name="l00689"></a>00689   <span class="keywordflow">if</span> (!message)
<a name="l00690"></a>00690     {
<a name="l00691"></a>00691       _DBUS_SET_OOM (error);
<a name="l00692"></a>00692       <span class="keywordflow">goto</span> out;
<a name="l00693"></a>00693     }
<a name="l00694"></a>00694   
<a name="l00695"></a>00695   reply = <a class="code" href="group__DBusConnection.html#ga8d6431f17a9e53c9446d87c2ba8409f0" title="Sends a message and blocks a certain time period while waiting for a reply.">dbus_connection_send_with_reply_and_block</a> (connection, message, -1, error);
<a name="l00696"></a>00696 
<a name="l00697"></a>00697   <span class="keywordflow">if</span> (reply == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00698"></a>00698     <span class="keywordflow">goto</span> out;
<a name="l00699"></a>00699   <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="group__DBusMessage.html#gaba5e49e956e6bbd1f857ffd21c289276" title="Sets a DBusError based on the contents of the given message.">dbus_set_error_from_message</a> (error, reply))
<a name="l00700"></a>00700     <span class="keywordflow">goto</span> out;
<a name="l00701"></a>00701   <span class="keywordflow">else</span> <span class="keywordflow">if</span> (!<a class="code" href="group__DBusMessage.html#gad8953f53ceea7de81cde792e3edd0230" title="Gets arguments from a message given a variable argument list.">dbus_message_get_args</a> (reply, error,
<a name="l00702"></a>00702                                    <a class="code" href="group__DBusProtocol.html#ga7eb77066dadf5415896b44c56d93acce" title="Type code marking a UTF-8 encoded, nul-terminated Unicode string.">DBUS_TYPE_STRING</a>, &amp;name,
<a name="l00703"></a>00703                                    <a class="code" href="group__DBusProtocol.html#gaa9588da889743b2119dc6664712ae51e" title="Type code that is never equal to a legitimate type code.">DBUS_TYPE_INVALID</a>))
<a name="l00704"></a>00704     <span class="keywordflow">goto</span> out;
<a name="l00705"></a>00705   
<a name="l00706"></a>00706   bd-&gt;<a class="code" href="structBusData.html#aaba673d2a99c4ca76fada7384942dfc9" title="Unique name of this connection.">unique_name</a> = <a class="code" href="group__DBusInternalsUtils.html#ga9d00d77f6595b9d7ac1baf59d44bf58c" title="Duplicates a string.">_dbus_strdup</a> (name);
<a name="l00707"></a>00707   <span class="keywordflow">if</span> (bd-&gt;<a class="code" href="structBusData.html#aaba673d2a99c4ca76fada7384942dfc9" title="Unique name of this connection.">unique_name</a> == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00708"></a>00708     {
<a name="l00709"></a>00709       _DBUS_SET_OOM (error);
<a name="l00710"></a>00710       <span class="keywordflow">goto</span> out;
<a name="l00711"></a>00711     }
<a name="l00712"></a>00712   
<a name="l00713"></a>00713   retval = <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l00714"></a>00714   
<a name="l00715"></a>00715  out:
<a name="l00716"></a>00716   _DBUS_UNLOCK (bus_datas);
<a name="l00717"></a>00717 
<a name="l00718"></a>00718   <span class="keywordflow">if</span> (message)
<a name="l00719"></a>00719     <a class="code" href="group__DBusMessage.html#gab69441efe683918f6a82469c8763f464" title="Decrements the reference count of a DBusMessage, freeing the message if the count reaches 0...">dbus_message_unref</a> (message);
<a name="l00720"></a>00720 
<a name="l00721"></a>00721   <span class="keywordflow">if</span> (reply)
<a name="l00722"></a>00722     <a class="code" href="group__DBusMessage.html#gab69441efe683918f6a82469c8763f464" title="Decrements the reference count of a DBusMessage, freeing the message if the count reaches 0...">dbus_message_unref</a> (reply);
<a name="l00723"></a>00723 
<a name="l00724"></a>00724   <span class="keywordflow">if</span> (!retval)
<a name="l00725"></a>00725     _DBUS_ASSERT_ERROR_IS_SET (error);
<a name="l00726"></a>00726 
<a name="l00727"></a>00727   <span class="keywordflow">return</span> retval;
<a name="l00728"></a>00728 }
<a name="l00729"></a>00729 
<a name="l00730"></a>00730 
<a name="l00765"></a>00765 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l00766"></a><a class="code" href="group__DBusBus.html#ga0366177076e88bf37771341f32b0551c">00766</a> <a class="code" href="group__DBusBus.html#ga0366177076e88bf37771341f32b0551c" title="Sets the unique name of the connection, as assigned by the message bus.">dbus_bus_set_unique_name</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l00767"></a>00767                           <span class="keyword">const</span> <span class="keywordtype">char</span>     *unique_name)
<a name="l00768"></a>00768 {
<a name="l00769"></a>00769   <a class="code" href="structBusData.html" title="Block of message-bus-related data we attach to each DBusConnection used with these convenience functi...">BusData</a> *bd;
<a name="l00770"></a>00770   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> success = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00771"></a>00771 
<a name="l00772"></a>00772   _dbus_return_val_if_fail (connection != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l00773"></a>00773   _dbus_return_val_if_fail (unique_name != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l00774"></a>00774 
<a name="l00775"></a>00775   <span class="keywordflow">if</span> (!_DBUS_LOCK (bus_datas))
<a name="l00776"></a>00776     {
<a name="l00777"></a>00777       <span class="comment">/* do not &quot;goto out&quot;, that would try to unlock */</span>
<a name="l00778"></a>00778       <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00779"></a>00779     }
<a name="l00780"></a>00780 
<a name="l00781"></a>00781   bd = ensure_bus_data (connection);
<a name="l00782"></a>00782   <span class="keywordflow">if</span> (bd == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00783"></a>00783     <span class="keywordflow">goto</span> out;
<a name="l00784"></a>00784 
<a name="l00785"></a>00785   _dbus_assert (bd-&gt;<a class="code" href="structBusData.html#aaba673d2a99c4ca76fada7384942dfc9" title="Unique name of this connection.">unique_name</a> == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l00786"></a>00786   
<a name="l00787"></a>00787   bd-&gt;<a class="code" href="structBusData.html#aaba673d2a99c4ca76fada7384942dfc9" title="Unique name of this connection.">unique_name</a> = <a class="code" href="group__DBusInternalsUtils.html#ga9d00d77f6595b9d7ac1baf59d44bf58c" title="Duplicates a string.">_dbus_strdup</a> (unique_name);
<a name="l00788"></a>00788   success = bd-&gt;<a class="code" href="structBusData.html#aaba673d2a99c4ca76fada7384942dfc9" title="Unique name of this connection.">unique_name</a> != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00789"></a>00789 
<a name="l00790"></a>00790 out:
<a name="l00791"></a>00791   _DBUS_UNLOCK (bus_datas);
<a name="l00792"></a>00792   
<a name="l00793"></a>00793   <span class="keywordflow">return</span> success;
<a name="l00794"></a>00794 }
<a name="l00795"></a>00795 
<a name="l00814"></a>00814 <span class="keyword">const</span> <span class="keywordtype">char</span>*
<a name="l00815"></a><a class="code" href="group__DBusBus.html#ga8c10339a1e62f6a2e5752d9c2270d37b">00815</a> <a class="code" href="group__DBusBus.html#ga8c10339a1e62f6a2e5752d9c2270d37b" title="Gets the unique name of the connection as assigned by the message bus.">dbus_bus_get_unique_name</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l00816"></a>00816 {
<a name="l00817"></a>00817   <a class="code" href="structBusData.html" title="Block of message-bus-related data we attach to each DBusConnection used with these convenience functi...">BusData</a> *bd;
<a name="l00818"></a>00818   <span class="keyword">const</span> <span class="keywordtype">char</span> *unique_name = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00819"></a>00819 
<a name="l00820"></a>00820   _dbus_return_val_if_fail (connection != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>, <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l00821"></a>00821 
<a name="l00822"></a>00822   <span class="keywordflow">if</span> (!_DBUS_LOCK (bus_datas))
<a name="l00823"></a>00823     {
<a name="l00824"></a>00824       <span class="comment">/* We&#39;d have initialized locks when we gave it its unique name, if it</span>
<a name="l00825"></a>00825 <span class="comment">       * had one. Don&#39;t &quot;goto out&quot;, that would try to unlock. */</span>
<a name="l00826"></a>00826       <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00827"></a>00827     }
<a name="l00828"></a>00828 
<a name="l00829"></a>00829   bd = ensure_bus_data (connection);
<a name="l00830"></a>00830   <span class="keywordflow">if</span> (bd == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00831"></a>00831     <span class="keywordflow">goto</span> out;
<a name="l00832"></a>00832 
<a name="l00833"></a>00833   unique_name = bd-&gt;<a class="code" href="structBusData.html#aaba673d2a99c4ca76fada7384942dfc9" title="Unique name of this connection.">unique_name</a>;
<a name="l00834"></a>00834 
<a name="l00835"></a>00835 out:
<a name="l00836"></a>00836   _DBUS_UNLOCK (bus_datas);
<a name="l00837"></a>00837 
<a name="l00838"></a>00838   <span class="keywordflow">return</span> unique_name;
<a name="l00839"></a>00839 }
<a name="l00840"></a>00840 
<a name="l00864"></a>00864 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>
<a name="l00865"></a><a class="code" href="group__DBusBus.html#ga24d782c710f3d82caf1b1ed582dcf474">00865</a> <a class="code" href="group__DBusBus.html#ga24d782c710f3d82caf1b1ed582dcf474" title="Asks the bus to return the UID the named connection authenticated as, if any.">dbus_bus_get_unix_user</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l00866"></a>00866                         <span class="keyword">const</span> <span class="keywordtype">char</span>     *name,
<a name="l00867"></a>00867                         <a class="code" href="structDBusError.html" title="Object representing an exception.">DBusError</a>      *error)
<a name="l00868"></a>00868 {
<a name="l00869"></a>00869   <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message, *reply;
<a name="l00870"></a>00870   <a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a> uid;
<a name="l00871"></a>00871 
<a name="l00872"></a>00872   _dbus_return_val_if_fail (connection != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>, <a class="code" href="group__DBusSysdeps.html#ga3d2f3fb32bb759cabe362ca2de383f7d" title="an invalid UID used to represent an uninitialized dbus_uid_t field">DBUS_UID_UNSET</a>);
<a name="l00873"></a>00873   _dbus_return_val_if_fail (name != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>, <a class="code" href="group__DBusSysdeps.html#ga3d2f3fb32bb759cabe362ca2de383f7d" title="an invalid UID used to represent an uninitialized dbus_uid_t field">DBUS_UID_UNSET</a>);
<a name="l00874"></a>00874   _dbus_return_val_if_fail (_dbus_check_is_valid_bus_name (name), <a class="code" href="group__DBusSysdeps.html#ga3d2f3fb32bb759cabe362ca2de383f7d" title="an invalid UID used to represent an uninitialized dbus_uid_t field">DBUS_UID_UNSET</a>);
<a name="l00875"></a>00875   _dbus_return_val_if_error_is_set (error, <a class="code" href="group__DBusSysdeps.html#ga3d2f3fb32bb759cabe362ca2de383f7d" title="an invalid UID used to represent an uninitialized dbus_uid_t field">DBUS_UID_UNSET</a>);
<a name="l00876"></a>00876   
<a name="l00877"></a>00877   message = <a class="code" href="group__DBusMessage.html#ga98ddc82450d818138ef326a284201ee0" title="Constructs a new message to invoke a method on a remote object.">dbus_message_new_method_call</a> (<a class="code" href="group__DBusShared.html#ga9e017e829e575bdc5c554fd4d07d7355" title="The bus name used to talk to the bus itself.">DBUS_SERVICE_DBUS</a>,
<a name="l00878"></a>00878                                           <a class="code" href="group__DBusShared.html#ga840a593b8fa139c69ef679830f42d91f" title="The object path used to talk to the bus itself.">DBUS_PATH_DBUS</a>,
<a name="l00879"></a>00879                                           <a class="code" href="group__DBusShared.html#gaa34514374bb61b8222a670a3d0b3fdc4" title="The interface exported by the object with DBUS_SERVICE_DBUS and DBUS_PATH_DBUS.">DBUS_INTERFACE_DBUS</a>,
<a name="l00880"></a>00880                                           <span class="stringliteral">&quot;GetConnectionUnixUser&quot;</span>);
<a name="l00881"></a>00881 
<a name="l00882"></a>00882   <span class="keywordflow">if</span> (message == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00883"></a>00883     {
<a name="l00884"></a>00884       _DBUS_SET_OOM (error);
<a name="l00885"></a>00885       <span class="keywordflow">return</span> <a class="code" href="group__DBusSysdeps.html#ga3d2f3fb32bb759cabe362ca2de383f7d" title="an invalid UID used to represent an uninitialized dbus_uid_t field">DBUS_UID_UNSET</a>;
<a name="l00886"></a>00886     }
<a name="l00887"></a>00887  
<a name="l00888"></a>00888   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusMessage.html#ga591f3aab5dd2c87e56e05423c2a671d9" title="Appends fields to a message given a variable argument list.">dbus_message_append_args</a> (message,
<a name="l00889"></a>00889                                  <a class="code" href="group__DBusProtocol.html#ga7eb77066dadf5415896b44c56d93acce" title="Type code marking a UTF-8 encoded, nul-terminated Unicode string.">DBUS_TYPE_STRING</a>, &amp;name,
<a name="l00890"></a>00890                                  <a class="code" href="group__DBusProtocol.html#gaa9588da889743b2119dc6664712ae51e" title="Type code that is never equal to a legitimate type code.">DBUS_TYPE_INVALID</a>))
<a name="l00891"></a>00891     {
<a name="l00892"></a>00892       <a class="code" href="group__DBusMessage.html#gab69441efe683918f6a82469c8763f464" title="Decrements the reference count of a DBusMessage, freeing the message if the count reaches 0...">dbus_message_unref</a> (message);
<a name="l00893"></a>00893       _DBUS_SET_OOM (error);
<a name="l00894"></a>00894       <span class="keywordflow">return</span> <a class="code" href="group__DBusSysdeps.html#ga3d2f3fb32bb759cabe362ca2de383f7d" title="an invalid UID used to represent an uninitialized dbus_uid_t field">DBUS_UID_UNSET</a>;
<a name="l00895"></a>00895     }
<a name="l00896"></a>00896   
<a name="l00897"></a>00897   reply = <a class="code" href="group__DBusConnection.html#ga8d6431f17a9e53c9446d87c2ba8409f0" title="Sends a message and blocks a certain time period while waiting for a reply.">dbus_connection_send_with_reply_and_block</a> (connection, message, -1,
<a name="l00898"></a>00898                                                      error);
<a name="l00899"></a>00899   
<a name="l00900"></a>00900   <a class="code" href="group__DBusMessage.html#gab69441efe683918f6a82469c8763f464" title="Decrements the reference count of a DBusMessage, freeing the message if the count reaches 0...">dbus_message_unref</a> (message);
<a name="l00901"></a>00901   
<a name="l00902"></a>00902   <span class="keywordflow">if</span> (reply == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00903"></a>00903     {
<a name="l00904"></a>00904       _DBUS_ASSERT_ERROR_IS_SET (error);
<a name="l00905"></a>00905       <span class="keywordflow">return</span> <a class="code" href="group__DBusSysdeps.html#ga3d2f3fb32bb759cabe362ca2de383f7d" title="an invalid UID used to represent an uninitialized dbus_uid_t field">DBUS_UID_UNSET</a>;
<a name="l00906"></a>00906     }  
<a name="l00907"></a>00907 
<a name="l00908"></a>00908   <span class="keywordflow">if</span> (<a class="code" href="group__DBusMessage.html#gaba5e49e956e6bbd1f857ffd21c289276" title="Sets a DBusError based on the contents of the given message.">dbus_set_error_from_message</a> (error, reply))
<a name="l00909"></a>00909     {
<a name="l00910"></a>00910       _DBUS_ASSERT_ERROR_IS_SET (error);
<a name="l00911"></a>00911       <a class="code" href="group__DBusMessage.html#gab69441efe683918f6a82469c8763f464" title="Decrements the reference count of a DBusMessage, freeing the message if the count reaches 0...">dbus_message_unref</a> (reply);
<a name="l00912"></a>00912       <span class="keywordflow">return</span> <a class="code" href="group__DBusSysdeps.html#ga3d2f3fb32bb759cabe362ca2de383f7d" title="an invalid UID used to represent an uninitialized dbus_uid_t field">DBUS_UID_UNSET</a>;
<a name="l00913"></a>00913     }
<a name="l00914"></a>00914   
<a name="l00915"></a>00915   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusMessage.html#gad8953f53ceea7de81cde792e3edd0230" title="Gets arguments from a message given a variable argument list.">dbus_message_get_args</a> (reply, error,
<a name="l00916"></a>00916                               <a class="code" href="group__DBusProtocol.html#gaedb1740bd8a9174b98ac593eded25d49" title="Type code marking a 32-bit unsigned integer.">DBUS_TYPE_UINT32</a>, &amp;uid,
<a name="l00917"></a>00917                               <a class="code" href="group__DBusProtocol.html#gaa9588da889743b2119dc6664712ae51e" title="Type code that is never equal to a legitimate type code.">DBUS_TYPE_INVALID</a>))
<a name="l00918"></a>00918     {
<a name="l00919"></a>00919       _DBUS_ASSERT_ERROR_IS_SET (error);
<a name="l00920"></a>00920       <a class="code" href="group__DBusMessage.html#gab69441efe683918f6a82469c8763f464" title="Decrements the reference count of a DBusMessage, freeing the message if the count reaches 0...">dbus_message_unref</a> (reply);
<a name="l00921"></a>00921       <span class="keywordflow">return</span> <a class="code" href="group__DBusSysdeps.html#ga3d2f3fb32bb759cabe362ca2de383f7d" title="an invalid UID used to represent an uninitialized dbus_uid_t field">DBUS_UID_UNSET</a>;
<a name="l00922"></a>00922     }
<a name="l00923"></a>00923 
<a name="l00924"></a>00924   <a class="code" href="group__DBusMessage.html#gab69441efe683918f6a82469c8763f464" title="Decrements the reference count of a DBusMessage, freeing the message if the count reaches 0...">dbus_message_unref</a> (reply);
<a name="l00925"></a>00925   
<a name="l00926"></a>00926   <span class="keywordflow">return</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>) uid;
<a name="l00927"></a>00927 }
<a name="l00928"></a>00928 
<a name="l00947"></a>00947 <span class="keywordtype">char</span>*
<a name="l00948"></a><a class="code" href="group__DBusBus.html#ga18314500e7f6890a79bddbeace5df5f9">00948</a> <a class="code" href="group__DBusBus.html#ga18314500e7f6890a79bddbeace5df5f9" title="Asks the bus to return its globally unique ID, as described in the D-Bus specification.">dbus_bus_get_id</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l00949"></a>00949                  <a class="code" href="structDBusError.html" title="Object representing an exception.">DBusError</a>      *error)
<a name="l00950"></a>00950 {
<a name="l00951"></a>00951   <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message, *reply;
<a name="l00952"></a>00952   <span class="keywordtype">char</span> *id;
<a name="l00953"></a>00953   <span class="keyword">const</span> <span class="keywordtype">char</span> *v_STRING;
<a name="l00954"></a>00954 
<a name="l00955"></a>00955   _dbus_return_val_if_fail (connection != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>, <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l00956"></a>00956   _dbus_return_val_if_error_is_set (error, <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l00957"></a>00957   
<a name="l00958"></a>00958   message = <a class="code" href="group__DBusMessage.html#ga98ddc82450d818138ef326a284201ee0" title="Constructs a new message to invoke a method on a remote object.">dbus_message_new_method_call</a> (<a class="code" href="group__DBusShared.html#ga9e017e829e575bdc5c554fd4d07d7355" title="The bus name used to talk to the bus itself.">DBUS_SERVICE_DBUS</a>,
<a name="l00959"></a>00959                                           <a class="code" href="group__DBusShared.html#ga840a593b8fa139c69ef679830f42d91f" title="The object path used to talk to the bus itself.">DBUS_PATH_DBUS</a>,
<a name="l00960"></a>00960                                           <a class="code" href="group__DBusShared.html#gaa34514374bb61b8222a670a3d0b3fdc4" title="The interface exported by the object with DBUS_SERVICE_DBUS and DBUS_PATH_DBUS.">DBUS_INTERFACE_DBUS</a>,
<a name="l00961"></a>00961                                           <span class="stringliteral">&quot;GetId&quot;</span>);
<a name="l00962"></a>00962   
<a name="l00963"></a>00963   <span class="keywordflow">if</span> (message == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00964"></a>00964     {
<a name="l00965"></a>00965       _DBUS_SET_OOM (error);
<a name="l00966"></a>00966       <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00967"></a>00967     }
<a name="l00968"></a>00968   
<a name="l00969"></a>00969   reply = <a class="code" href="group__DBusConnection.html#ga8d6431f17a9e53c9446d87c2ba8409f0" title="Sends a message and blocks a certain time period while waiting for a reply.">dbus_connection_send_with_reply_and_block</a> (connection, message, -1,
<a name="l00970"></a>00970                                                      error);
<a name="l00971"></a>00971   
<a name="l00972"></a>00972   <a class="code" href="group__DBusMessage.html#gab69441efe683918f6a82469c8763f464" title="Decrements the reference count of a DBusMessage, freeing the message if the count reaches 0...">dbus_message_unref</a> (message);
<a name="l00973"></a>00973   
<a name="l00974"></a>00974   <span class="keywordflow">if</span> (reply == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00975"></a>00975     {
<a name="l00976"></a>00976       _DBUS_ASSERT_ERROR_IS_SET (error);
<a name="l00977"></a>00977       <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00978"></a>00978     }  
<a name="l00979"></a>00979 
<a name="l00980"></a>00980   <span class="keywordflow">if</span> (<a class="code" href="group__DBusMessage.html#gaba5e49e956e6bbd1f857ffd21c289276" title="Sets a DBusError based on the contents of the given message.">dbus_set_error_from_message</a> (error, reply))
<a name="l00981"></a>00981     {
<a name="l00982"></a>00982       _DBUS_ASSERT_ERROR_IS_SET (error);
<a name="l00983"></a>00983       <a class="code" href="group__DBusMessage.html#gab69441efe683918f6a82469c8763f464" title="Decrements the reference count of a DBusMessage, freeing the message if the count reaches 0...">dbus_message_unref</a> (reply);
<a name="l00984"></a>00984       <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00985"></a>00985     }
<a name="l00986"></a>00986 
<a name="l00987"></a>00987   v_STRING = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00988"></a>00988   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusMessage.html#gad8953f53ceea7de81cde792e3edd0230" title="Gets arguments from a message given a variable argument list.">dbus_message_get_args</a> (reply, error,
<a name="l00989"></a>00989                               <a class="code" href="group__DBusProtocol.html#ga7eb77066dadf5415896b44c56d93acce" title="Type code marking a UTF-8 encoded, nul-terminated Unicode string.">DBUS_TYPE_STRING</a>, &amp;v_STRING,
<a name="l00990"></a>00990                               <a class="code" href="group__DBusProtocol.html#gaa9588da889743b2119dc6664712ae51e" title="Type code that is never equal to a legitimate type code.">DBUS_TYPE_INVALID</a>))
<a name="l00991"></a>00991     {
<a name="l00992"></a>00992       _DBUS_ASSERT_ERROR_IS_SET (error);
<a name="l00993"></a>00993       <a class="code" href="group__DBusMessage.html#gab69441efe683918f6a82469c8763f464" title="Decrements the reference count of a DBusMessage, freeing the message if the count reaches 0...">dbus_message_unref</a> (reply);
<a name="l00994"></a>00994       <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00995"></a>00995     }
<a name="l00996"></a>00996 
<a name="l00997"></a>00997   <span class="keywordtype">id</span> = <a class="code" href="group__DBusInternalsUtils.html#ga9d00d77f6595b9d7ac1baf59d44bf58c" title="Duplicates a string.">_dbus_strdup</a> (v_STRING); <span class="comment">/* may be NULL */</span>
<a name="l00998"></a>00998   
<a name="l00999"></a>00999   <a class="code" href="group__DBusMessage.html#gab69441efe683918f6a82469c8763f464" title="Decrements the reference count of a DBusMessage, freeing the message if the count reaches 0...">dbus_message_unref</a> (reply);
<a name="l01000"></a>01000 
<a name="l01001"></a>01001   <span class="keywordflow">if</span> (<span class="keywordtype">id</span> == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01002"></a>01002     _DBUS_SET_OOM (error);
<a name="l01003"></a>01003 
<a name="l01004"></a>01004   <span class="comment">/* FIXME it might be nice to cache the ID locally */</span>
<a name="l01005"></a>01005   
<a name="l01006"></a>01006   <span class="keywordflow">return</span> id;
<a name="l01007"></a>01007 }
<a name="l01008"></a>01008 
<a name="l01111"></a>01111 <span class="keywordtype">int</span>
<a name="l01112"></a><a class="code" href="group__DBusBus.html#ga8a9024c78c4ea89b6271f19dbc7861b2">01112</a> <a class="code" href="group__DBusBus.html#ga8a9024c78c4ea89b6271f19dbc7861b2" title="Asks the bus to assign the given name to this connection by invoking the RequestName method on the bu...">dbus_bus_request_name</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l01113"></a>01113                        <span class="keyword">const</span> <span class="keywordtype">char</span>     *name,
<a name="l01114"></a>01114                        <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>    flags,
<a name="l01115"></a>01115                        <a class="code" href="structDBusError.html" title="Object representing an exception.">DBusError</a>      *error)
<a name="l01116"></a>01116 {
<a name="l01117"></a>01117   <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message, *reply;
<a name="l01118"></a>01118   <a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a> result;
<a name="l01119"></a>01119 
<a name="l01120"></a>01120   _dbus_return_val_if_fail (connection != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>, 0);
<a name="l01121"></a>01121   _dbus_return_val_if_fail (name != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>, 0);
<a name="l01122"></a>01122   _dbus_return_val_if_fail (_dbus_check_is_valid_bus_name (name), 0);
<a name="l01123"></a>01123   _dbus_return_val_if_error_is_set (error, 0);
<a name="l01124"></a>01124   
<a name="l01125"></a>01125   message = <a class="code" href="group__DBusMessage.html#ga98ddc82450d818138ef326a284201ee0" title="Constructs a new message to invoke a method on a remote object.">dbus_message_new_method_call</a> (<a class="code" href="group__DBusShared.html#ga9e017e829e575bdc5c554fd4d07d7355" title="The bus name used to talk to the bus itself.">DBUS_SERVICE_DBUS</a>,
<a name="l01126"></a>01126                                           <a class="code" href="group__DBusShared.html#ga840a593b8fa139c69ef679830f42d91f" title="The object path used to talk to the bus itself.">DBUS_PATH_DBUS</a>,
<a name="l01127"></a>01127                                           <a class="code" href="group__DBusShared.html#gaa34514374bb61b8222a670a3d0b3fdc4" title="The interface exported by the object with DBUS_SERVICE_DBUS and DBUS_PATH_DBUS.">DBUS_INTERFACE_DBUS</a>,
<a name="l01128"></a>01128                                           <span class="stringliteral">&quot;RequestName&quot;</span>);
<a name="l01129"></a>01129 
<a name="l01130"></a>01130   <span class="keywordflow">if</span> (message == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01131"></a>01131     {
<a name="l01132"></a>01132       _DBUS_SET_OOM (error);
<a name="l01133"></a>01133       <span class="keywordflow">return</span> -1;
<a name="l01134"></a>01134     }
<a name="l01135"></a>01135  
<a name="l01136"></a>01136   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusMessage.html#ga591f3aab5dd2c87e56e05423c2a671d9" title="Appends fields to a message given a variable argument list.">dbus_message_append_args</a> (message,
<a name="l01137"></a>01137                                  <a class="code" href="group__DBusProtocol.html#ga7eb77066dadf5415896b44c56d93acce" title="Type code marking a UTF-8 encoded, nul-terminated Unicode string.">DBUS_TYPE_STRING</a>, &amp;name,
<a name="l01138"></a>01138                                  <a class="code" href="group__DBusProtocol.html#gaedb1740bd8a9174b98ac593eded25d49" title="Type code marking a 32-bit unsigned integer.">DBUS_TYPE_UINT32</a>, &amp;flags,
<a name="l01139"></a>01139                                  <a class="code" href="group__DBusProtocol.html#gaa9588da889743b2119dc6664712ae51e" title="Type code that is never equal to a legitimate type code.">DBUS_TYPE_INVALID</a>))
<a name="l01140"></a>01140     {
<a name="l01141"></a>01141       <a class="code" href="group__DBusMessage.html#gab69441efe683918f6a82469c8763f464" title="Decrements the reference count of a DBusMessage, freeing the message if the count reaches 0...">dbus_message_unref</a> (message);
<a name="l01142"></a>01142       _DBUS_SET_OOM (error);
<a name="l01143"></a>01143       <span class="keywordflow">return</span> -1;
<a name="l01144"></a>01144     }
<a name="l01145"></a>01145   
<a name="l01146"></a>01146   reply = <a class="code" href="group__DBusConnection.html#ga8d6431f17a9e53c9446d87c2ba8409f0" title="Sends a message and blocks a certain time period while waiting for a reply.">dbus_connection_send_with_reply_and_block</a> (connection, message, -1,
<a name="l01147"></a>01147                                                      error);
<a name="l01148"></a>01148   
<a name="l01149"></a>01149   <a class="code" href="group__DBusMessage.html#gab69441efe683918f6a82469c8763f464" title="Decrements the reference count of a DBusMessage, freeing the message if the count reaches 0...">dbus_message_unref</a> (message);
<a name="l01150"></a>01150   
<a name="l01151"></a>01151   <span class="keywordflow">if</span> (reply == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01152"></a>01152     {
<a name="l01153"></a>01153       _DBUS_ASSERT_ERROR_IS_SET (error);
<a name="l01154"></a>01154       <span class="keywordflow">return</span> -1;
<a name="l01155"></a>01155     }  
<a name="l01156"></a>01156 
<a name="l01157"></a>01157   <span class="keywordflow">if</span> (<a class="code" href="group__DBusMessage.html#gaba5e49e956e6bbd1f857ffd21c289276" title="Sets a DBusError based on the contents of the given message.">dbus_set_error_from_message</a> (error, reply))
<a name="l01158"></a>01158     {
<a name="l01159"></a>01159       _DBUS_ASSERT_ERROR_IS_SET (error);
<a name="l01160"></a>01160       <a class="code" href="group__DBusMessage.html#gab69441efe683918f6a82469c8763f464" title="Decrements the reference count of a DBusMessage, freeing the message if the count reaches 0...">dbus_message_unref</a> (reply);
<a name="l01161"></a>01161       <span class="keywordflow">return</span> -1;
<a name="l01162"></a>01162     }
<a name="l01163"></a>01163   
<a name="l01164"></a>01164   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusMessage.html#gad8953f53ceea7de81cde792e3edd0230" title="Gets arguments from a message given a variable argument list.">dbus_message_get_args</a> (reply, error,
<a name="l01165"></a>01165                               <a class="code" href="group__DBusProtocol.html#gaedb1740bd8a9174b98ac593eded25d49" title="Type code marking a 32-bit unsigned integer.">DBUS_TYPE_UINT32</a>, &amp;result,
<a name="l01166"></a>01166                               <a class="code" href="group__DBusProtocol.html#gaa9588da889743b2119dc6664712ae51e" title="Type code that is never equal to a legitimate type code.">DBUS_TYPE_INVALID</a>))
<a name="l01167"></a>01167     {
<a name="l01168"></a>01168       _DBUS_ASSERT_ERROR_IS_SET (error);
<a name="l01169"></a>01169       <a class="code" href="group__DBusMessage.html#gab69441efe683918f6a82469c8763f464" title="Decrements the reference count of a DBusMessage, freeing the message if the count reaches 0...">dbus_message_unref</a> (reply);
<a name="l01170"></a>01170       <span class="keywordflow">return</span> -1;
<a name="l01171"></a>01171     }
<a name="l01172"></a>01172 
<a name="l01173"></a>01173   <a class="code" href="group__DBusMessage.html#gab69441efe683918f6a82469c8763f464" title="Decrements the reference count of a DBusMessage, freeing the message if the count reaches 0...">dbus_message_unref</a> (reply);
<a name="l01174"></a>01174   
<a name="l01175"></a>01175   <span class="keywordflow">return</span> result;
<a name="l01176"></a>01176 }
<a name="l01177"></a>01177 
<a name="l01178"></a>01178 
<a name="l01197"></a>01197 <span class="keywordtype">int</span>
<a name="l01198"></a><a class="code" href="group__DBusBus.html#gaa4aa5ebe51cdbe8c0651609fc72e841a">01198</a> <a class="code" href="group__DBusBus.html#gaa4aa5ebe51cdbe8c0651609fc72e841a" title="Asks the bus to unassign the given name from this connection by invoking the ReleaseName method on th...">dbus_bus_release_name</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l01199"></a>01199                        <span class="keyword">const</span> <span class="keywordtype">char</span>     *name,
<a name="l01200"></a>01200                        <a class="code" href="structDBusError.html" title="Object representing an exception.">DBusError</a>      *error)
<a name="l01201"></a>01201 {
<a name="l01202"></a>01202   <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message, *reply;
<a name="l01203"></a>01203   <a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a> result;
<a name="l01204"></a>01204 
<a name="l01205"></a>01205   _dbus_return_val_if_fail (connection != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>, 0);
<a name="l01206"></a>01206   _dbus_return_val_if_fail (name != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>, 0);
<a name="l01207"></a>01207   _dbus_return_val_if_fail (_dbus_check_is_valid_bus_name (name), 0);
<a name="l01208"></a>01208   _dbus_return_val_if_error_is_set (error, 0);
<a name="l01209"></a>01209 
<a name="l01210"></a>01210   message = <a class="code" href="group__DBusMessage.html#ga98ddc82450d818138ef326a284201ee0" title="Constructs a new message to invoke a method on a remote object.">dbus_message_new_method_call</a> (<a class="code" href="group__DBusShared.html#ga9e017e829e575bdc5c554fd4d07d7355" title="The bus name used to talk to the bus itself.">DBUS_SERVICE_DBUS</a>,
<a name="l01211"></a>01211                                           <a class="code" href="group__DBusShared.html#ga840a593b8fa139c69ef679830f42d91f" title="The object path used to talk to the bus itself.">DBUS_PATH_DBUS</a>,
<a name="l01212"></a>01212                                           <a class="code" href="group__DBusShared.html#gaa34514374bb61b8222a670a3d0b3fdc4" title="The interface exported by the object with DBUS_SERVICE_DBUS and DBUS_PATH_DBUS.">DBUS_INTERFACE_DBUS</a>,
<a name="l01213"></a>01213                                           <span class="stringliteral">&quot;ReleaseName&quot;</span>);
<a name="l01214"></a>01214 
<a name="l01215"></a>01215   <span class="keywordflow">if</span> (message == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01216"></a>01216     {
<a name="l01217"></a>01217       _DBUS_SET_OOM (error);
<a name="l01218"></a>01218       <span class="keywordflow">return</span> -1;
<a name="l01219"></a>01219     }
<a name="l01220"></a>01220 
<a name="l01221"></a>01221   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusMessage.html#ga591f3aab5dd2c87e56e05423c2a671d9" title="Appends fields to a message given a variable argument list.">dbus_message_append_args</a> (message,
<a name="l01222"></a>01222                                  <a class="code" href="group__DBusProtocol.html#ga7eb77066dadf5415896b44c56d93acce" title="Type code marking a UTF-8 encoded, nul-terminated Unicode string.">DBUS_TYPE_STRING</a>, &amp;name,
<a name="l01223"></a>01223                                  <a class="code" href="group__DBusProtocol.html#gaa9588da889743b2119dc6664712ae51e" title="Type code that is never equal to a legitimate type code.">DBUS_TYPE_INVALID</a>))
<a name="l01224"></a>01224     {
<a name="l01225"></a>01225       <a class="code" href="group__DBusMessage.html#gab69441efe683918f6a82469c8763f464" title="Decrements the reference count of a DBusMessage, freeing the message if the count reaches 0...">dbus_message_unref</a> (message);
<a name="l01226"></a>01226       _DBUS_SET_OOM (error);
<a name="l01227"></a>01227       <span class="keywordflow">return</span> -1;
<a name="l01228"></a>01228     }
<a name="l01229"></a>01229 
<a name="l01230"></a>01230   reply = <a class="code" href="group__DBusConnection.html#ga8d6431f17a9e53c9446d87c2ba8409f0" title="Sends a message and blocks a certain time period while waiting for a reply.">dbus_connection_send_with_reply_and_block</a> (connection, message, -1,
<a name="l01231"></a>01231                                                      error);
<a name="l01232"></a>01232 
<a name="l01233"></a>01233   <a class="code" href="group__DBusMessage.html#gab69441efe683918f6a82469c8763f464" title="Decrements the reference count of a DBusMessage, freeing the message if the count reaches 0...">dbus_message_unref</a> (message);
<a name="l01234"></a>01234 
<a name="l01235"></a>01235   <span class="keywordflow">if</span> (reply == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01236"></a>01236     {
<a name="l01237"></a>01237       _DBUS_ASSERT_ERROR_IS_SET (error);
<a name="l01238"></a>01238       <span class="keywordflow">return</span> -1;
<a name="l01239"></a>01239     }
<a name="l01240"></a>01240 
<a name="l01241"></a>01241   <span class="keywordflow">if</span> (<a class="code" href="group__DBusMessage.html#gaba5e49e956e6bbd1f857ffd21c289276" title="Sets a DBusError based on the contents of the given message.">dbus_set_error_from_message</a> (error, reply))
<a name="l01242"></a>01242     {
<a name="l01243"></a>01243       _DBUS_ASSERT_ERROR_IS_SET (error);
<a name="l01244"></a>01244       <a class="code" href="group__DBusMessage.html#gab69441efe683918f6a82469c8763f464" title="Decrements the reference count of a DBusMessage, freeing the message if the count reaches 0...">dbus_message_unref</a> (reply);
<a name="l01245"></a>01245       <span class="keywordflow">return</span> -1;
<a name="l01246"></a>01246     }
<a name="l01247"></a>01247 
<a name="l01248"></a>01248   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusMessage.html#gad8953f53ceea7de81cde792e3edd0230" title="Gets arguments from a message given a variable argument list.">dbus_message_get_args</a> (reply, error,
<a name="l01249"></a>01249                               <a class="code" href="group__DBusProtocol.html#gaedb1740bd8a9174b98ac593eded25d49" title="Type code marking a 32-bit unsigned integer.">DBUS_TYPE_UINT32</a>, &amp;result,
<a name="l01250"></a>01250                               <a class="code" href="group__DBusProtocol.html#gaa9588da889743b2119dc6664712ae51e" title="Type code that is never equal to a legitimate type code.">DBUS_TYPE_INVALID</a>))
<a name="l01251"></a>01251     {
<a name="l01252"></a>01252       _DBUS_ASSERT_ERROR_IS_SET (error);
<a name="l01253"></a>01253       <a class="code" href="group__DBusMessage.html#gab69441efe683918f6a82469c8763f464" title="Decrements the reference count of a DBusMessage, freeing the message if the count reaches 0...">dbus_message_unref</a> (reply);
<a name="l01254"></a>01254       <span class="keywordflow">return</span> -1;
<a name="l01255"></a>01255     }
<a name="l01256"></a>01256 
<a name="l01257"></a>01257   <a class="code" href="group__DBusMessage.html#gab69441efe683918f6a82469c8763f464" title="Decrements the reference count of a DBusMessage, freeing the message if the count reaches 0...">dbus_message_unref</a> (reply);
<a name="l01258"></a>01258 
<a name="l01259"></a>01259   <span class="keywordflow">return</span> result;
<a name="l01260"></a>01260 }
<a name="l01261"></a>01261 
<a name="l01279"></a>01279 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l01280"></a><a class="code" href="group__DBusBus.html#ga5331b172dd8ed00eec130e894c5c2a0b">01280</a> <a class="code" href="group__DBusBus.html#ga5331b172dd8ed00eec130e894c5c2a0b" title="Asks the bus whether a certain name has an owner.">dbus_bus_name_has_owner</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l01281"></a>01281                          <span class="keyword">const</span> <span class="keywordtype">char</span>     *name,
<a name="l01282"></a>01282                          <a class="code" href="structDBusError.html" title="Object representing an exception.">DBusError</a>      *error)
<a name="l01283"></a>01283 {
<a name="l01284"></a>01284   <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message, *reply;
<a name="l01285"></a>01285   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> exists;
<a name="l01286"></a>01286 
<a name="l01287"></a>01287   _dbus_return_val_if_fail (connection != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l01288"></a>01288   _dbus_return_val_if_fail (name != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l01289"></a>01289   _dbus_return_val_if_fail (_dbus_check_is_valid_bus_name (name), <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l01290"></a>01290   _dbus_return_val_if_error_is_set (error, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l01291"></a>01291   
<a name="l01292"></a>01292   message = <a class="code" href="group__DBusMessage.html#ga98ddc82450d818138ef326a284201ee0" title="Constructs a new message to invoke a method on a remote object.">dbus_message_new_method_call</a> (<a class="code" href="group__DBusShared.html#ga9e017e829e575bdc5c554fd4d07d7355" title="The bus name used to talk to the bus itself.">DBUS_SERVICE_DBUS</a>,
<a name="l01293"></a>01293                                           <a class="code" href="group__DBusShared.html#ga840a593b8fa139c69ef679830f42d91f" title="The object path used to talk to the bus itself.">DBUS_PATH_DBUS</a>,
<a name="l01294"></a>01294                                           <a class="code" href="group__DBusShared.html#gaa34514374bb61b8222a670a3d0b3fdc4" title="The interface exported by the object with DBUS_SERVICE_DBUS and DBUS_PATH_DBUS.">DBUS_INTERFACE_DBUS</a>,
<a name="l01295"></a>01295                                           <span class="stringliteral">&quot;NameHasOwner&quot;</span>);
<a name="l01296"></a>01296   <span class="keywordflow">if</span> (message == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01297"></a>01297     {
<a name="l01298"></a>01298       _DBUS_SET_OOM (error);
<a name="l01299"></a>01299       <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l01300"></a>01300     }
<a name="l01301"></a>01301   
<a name="l01302"></a>01302   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusMessage.html#ga591f3aab5dd2c87e56e05423c2a671d9" title="Appends fields to a message given a variable argument list.">dbus_message_append_args</a> (message,
<a name="l01303"></a>01303                                  <a class="code" href="group__DBusProtocol.html#ga7eb77066dadf5415896b44c56d93acce" title="Type code marking a UTF-8 encoded, nul-terminated Unicode string.">DBUS_TYPE_STRING</a>, &amp;name,
<a name="l01304"></a>01304                                  <a class="code" href="group__DBusProtocol.html#gaa9588da889743b2119dc6664712ae51e" title="Type code that is never equal to a legitimate type code.">DBUS_TYPE_INVALID</a>))
<a name="l01305"></a>01305     {
<a name="l01306"></a>01306       <a class="code" href="group__DBusMessage.html#gab69441efe683918f6a82469c8763f464" title="Decrements the reference count of a DBusMessage, freeing the message if the count reaches 0...">dbus_message_unref</a> (message);
<a name="l01307"></a>01307       _DBUS_SET_OOM (error);
<a name="l01308"></a>01308       <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l01309"></a>01309     }
<a name="l01310"></a>01310   
<a name="l01311"></a>01311   reply = <a class="code" href="group__DBusConnection.html#ga8d6431f17a9e53c9446d87c2ba8409f0" title="Sends a message and blocks a certain time period while waiting for a reply.">dbus_connection_send_with_reply_and_block</a> (connection, message, -1, error);
<a name="l01312"></a>01312   <a class="code" href="group__DBusMessage.html#gab69441efe683918f6a82469c8763f464" title="Decrements the reference count of a DBusMessage, freeing the message if the count reaches 0...">dbus_message_unref</a> (message);
<a name="l01313"></a>01313 
<a name="l01314"></a>01314   <span class="keywordflow">if</span> (reply == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01315"></a>01315     {
<a name="l01316"></a>01316       _DBUS_ASSERT_ERROR_IS_SET (error);
<a name="l01317"></a>01317       <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l01318"></a>01318     }
<a name="l01319"></a>01319 
<a name="l01320"></a>01320   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusMessage.html#gad8953f53ceea7de81cde792e3edd0230" title="Gets arguments from a message given a variable argument list.">dbus_message_get_args</a> (reply, error,
<a name="l01321"></a>01321                               <a class="code" href="group__DBusProtocol.html#ga624ecee83984330ad89cbf064a2b28e6" title="Type code marking a boolean.">DBUS_TYPE_BOOLEAN</a>, &amp;exists,
<a name="l01322"></a>01322                               <a class="code" href="group__DBusProtocol.html#gaa9588da889743b2119dc6664712ae51e" title="Type code that is never equal to a legitimate type code.">DBUS_TYPE_INVALID</a>))
<a name="l01323"></a>01323     {
<a name="l01324"></a>01324       _DBUS_ASSERT_ERROR_IS_SET (error);
<a name="l01325"></a>01325       <a class="code" href="group__DBusMessage.html#gab69441efe683918f6a82469c8763f464" title="Decrements the reference count of a DBusMessage, freeing the message if the count reaches 0...">dbus_message_unref</a> (reply);
<a name="l01326"></a>01326       <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l01327"></a>01327     }
<a name="l01328"></a>01328   
<a name="l01329"></a>01329   <a class="code" href="group__DBusMessage.html#gab69441efe683918f6a82469c8763f464" title="Decrements the reference count of a DBusMessage, freeing the message if the count reaches 0...">dbus_message_unref</a> (reply);
<a name="l01330"></a>01330   <span class="keywordflow">return</span> exists;
<a name="l01331"></a>01331 }
<a name="l01332"></a>01332 
<a name="l01355"></a>01355 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l01356"></a><a class="code" href="group__DBusBus.html#ga81d303bf29d7c97ad4690ce35071b090">01356</a> <a class="code" href="group__DBusBus.html#ga81d303bf29d7c97ad4690ce35071b090" title="Starts a service that will request ownership of the given name.">dbus_bus_start_service_by_name</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l01357"></a>01357                                 <span class="keyword">const</span> <span class="keywordtype">char</span>     *name,
<a name="l01358"></a>01358                                 <a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a>   flags,
<a name="l01359"></a>01359                                 <a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a>  *result,
<a name="l01360"></a>01360                                 <a class="code" href="structDBusError.html" title="Object representing an exception.">DBusError</a>      *error)
<a name="l01361"></a>01361 {
<a name="l01362"></a>01362   <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *msg;
<a name="l01363"></a>01363   <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *reply;
<a name="l01364"></a>01364 
<a name="l01365"></a>01365   _dbus_return_val_if_fail (connection != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l01366"></a>01366   _dbus_return_val_if_fail (_dbus_check_is_valid_bus_name (name), <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l01367"></a>01367   
<a name="l01368"></a>01368   msg = <a class="code" href="group__DBusMessage.html#ga98ddc82450d818138ef326a284201ee0" title="Constructs a new message to invoke a method on a remote object.">dbus_message_new_method_call</a> (<a class="code" href="group__DBusShared.html#ga9e017e829e575bdc5c554fd4d07d7355" title="The bus name used to talk to the bus itself.">DBUS_SERVICE_DBUS</a>,
<a name="l01369"></a>01369                                       <a class="code" href="group__DBusShared.html#ga840a593b8fa139c69ef679830f42d91f" title="The object path used to talk to the bus itself.">DBUS_PATH_DBUS</a>,
<a name="l01370"></a>01370                                       <a class="code" href="group__DBusShared.html#gaa34514374bb61b8222a670a3d0b3fdc4" title="The interface exported by the object with DBUS_SERVICE_DBUS and DBUS_PATH_DBUS.">DBUS_INTERFACE_DBUS</a>,
<a name="l01371"></a>01371                                       <span class="stringliteral">&quot;StartServiceByName&quot;</span>);
<a name="l01372"></a>01372 
<a name="l01373"></a>01373   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusMessage.html#ga591f3aab5dd2c87e56e05423c2a671d9" title="Appends fields to a message given a variable argument list.">dbus_message_append_args</a> (msg, <a class="code" href="group__DBusProtocol.html#ga7eb77066dadf5415896b44c56d93acce" title="Type code marking a UTF-8 encoded, nul-terminated Unicode string.">DBUS_TYPE_STRING</a>, &amp;name,
<a name="l01374"></a>01374                                  <a class="code" href="group__DBusProtocol.html#gaedb1740bd8a9174b98ac593eded25d49" title="Type code marking a 32-bit unsigned integer.">DBUS_TYPE_UINT32</a>, &amp;flags, <a class="code" href="group__DBusProtocol.html#gaa9588da889743b2119dc6664712ae51e" title="Type code that is never equal to a legitimate type code.">DBUS_TYPE_INVALID</a>))
<a name="l01375"></a>01375     {
<a name="l01376"></a>01376       <a class="code" href="group__DBusMessage.html#gab69441efe683918f6a82469c8763f464" title="Decrements the reference count of a DBusMessage, freeing the message if the count reaches 0...">dbus_message_unref</a> (msg);
<a name="l01377"></a>01377       _DBUS_SET_OOM (error);
<a name="l01378"></a>01378       <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l01379"></a>01379     }
<a name="l01380"></a>01380 
<a name="l01381"></a>01381   reply = <a class="code" href="group__DBusConnection.html#ga8d6431f17a9e53c9446d87c2ba8409f0" title="Sends a message and blocks a certain time period while waiting for a reply.">dbus_connection_send_with_reply_and_block</a> (connection, msg,
<a name="l01382"></a>01382                                                      -1, error);
<a name="l01383"></a>01383   <a class="code" href="group__DBusMessage.html#gab69441efe683918f6a82469c8763f464" title="Decrements the reference count of a DBusMessage, freeing the message if the count reaches 0...">dbus_message_unref</a> (msg);
<a name="l01384"></a>01384 
<a name="l01385"></a>01385   <span class="keywordflow">if</span> (reply == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01386"></a>01386     {
<a name="l01387"></a>01387       _DBUS_ASSERT_ERROR_IS_SET (error);
<a name="l01388"></a>01388       <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l01389"></a>01389     }
<a name="l01390"></a>01390 
<a name="l01391"></a>01391   <span class="keywordflow">if</span> (<a class="code" href="group__DBusMessage.html#gaba5e49e956e6bbd1f857ffd21c289276" title="Sets a DBusError based on the contents of the given message.">dbus_set_error_from_message</a> (error, reply))
<a name="l01392"></a>01392     {
<a name="l01393"></a>01393       _DBUS_ASSERT_ERROR_IS_SET (error);
<a name="l01394"></a>01394       <a class="code" href="group__DBusMessage.html#gab69441efe683918f6a82469c8763f464" title="Decrements the reference count of a DBusMessage, freeing the message if the count reaches 0...">dbus_message_unref</a> (reply);
<a name="l01395"></a>01395       <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l01396"></a>01396     }
<a name="l01397"></a>01397 
<a name="l01398"></a>01398   <span class="keywordflow">if</span> (result != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a> &amp;&amp;
<a name="l01399"></a>01399       !<a class="code" href="group__DBusMessage.html#gad8953f53ceea7de81cde792e3edd0230" title="Gets arguments from a message given a variable argument list.">dbus_message_get_args</a> (reply, error, <a class="code" href="group__DBusProtocol.html#gaedb1740bd8a9174b98ac593eded25d49" title="Type code marking a 32-bit unsigned integer.">DBUS_TYPE_UINT32</a>,
<a name="l01400"></a>01400                               result, <a class="code" href="group__DBusProtocol.html#gaa9588da889743b2119dc6664712ae51e" title="Type code that is never equal to a legitimate type code.">DBUS_TYPE_INVALID</a>))
<a name="l01401"></a>01401     {
<a name="l01402"></a>01402       _DBUS_ASSERT_ERROR_IS_SET (error);
<a name="l01403"></a>01403       <a class="code" href="group__DBusMessage.html#gab69441efe683918f6a82469c8763f464" title="Decrements the reference count of a DBusMessage, freeing the message if the count reaches 0...">dbus_message_unref</a> (reply);
<a name="l01404"></a>01404       <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l01405"></a>01405     }
<a name="l01406"></a>01406   
<a name="l01407"></a>01407   <a class="code" href="group__DBusMessage.html#gab69441efe683918f6a82469c8763f464" title="Decrements the reference count of a DBusMessage, freeing the message if the count reaches 0...">dbus_message_unref</a> (reply);
<a name="l01408"></a>01408   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l01409"></a>01409 }
<a name="l01410"></a>01410 
<a name="l01411"></a>01411 <span class="keyword">static</span> <span class="keywordtype">void</span>
<a name="l01412"></a>01412 send_no_return_values (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l01413"></a>01413                        <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>    *msg,
<a name="l01414"></a>01414                        <a class="code" href="structDBusError.html" title="Object representing an exception.">DBusError</a>      *error)
<a name="l01415"></a>01415 {
<a name="l01416"></a>01416   <span class="keywordflow">if</span> (error)
<a name="l01417"></a>01417     {
<a name="l01418"></a>01418       <span class="comment">/* Block to check success codepath */</span>
<a name="l01419"></a>01419       <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *reply;
<a name="l01420"></a>01420       
<a name="l01421"></a>01421       reply = <a class="code" href="group__DBusConnection.html#ga8d6431f17a9e53c9446d87c2ba8409f0" title="Sends a message and blocks a certain time period while waiting for a reply.">dbus_connection_send_with_reply_and_block</a> (connection, msg,
<a name="l01422"></a>01422                                                          -1, error);
<a name="l01423"></a>01423       
<a name="l01424"></a>01424       <span class="keywordflow">if</span> (reply == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01425"></a>01425         _DBUS_ASSERT_ERROR_IS_SET (error);
<a name="l01426"></a>01426       <span class="keywordflow">else</span>
<a name="l01427"></a>01427         <a class="code" href="group__DBusMessage.html#gab69441efe683918f6a82469c8763f464" title="Decrements the reference count of a DBusMessage, freeing the message if the count reaches 0...">dbus_message_unref</a> (reply);
<a name="l01428"></a>01428     }
<a name="l01429"></a>01429   <span class="keywordflow">else</span>
<a name="l01430"></a>01430     {
<a name="l01431"></a>01431       <span class="comment">/* Silently-fail nonblocking codepath */</span>
<a name="l01432"></a>01432       <a class="code" href="group__DBusMessage.html#ga0e86aeb2dc6831ccc9a21fcbf8cc16f7" title="Sets a flag indicating that the message does not want a reply; if this flag is set, the other end of the connection may (but is not required to) optimize by not sending method return or error replies.">dbus_message_set_no_reply</a> (msg, <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>);
<a name="l01433"></a>01433       <a class="code" href="group__DBusConnection.html#gae1cb64f4cf550949b23fd3a756b2f7d0" title="Adds a message to the outgoing message queue.">dbus_connection_send</a> (connection, msg, <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l01434"></a>01434     }
<a name="l01435"></a>01435 }
<a name="l01436"></a>01436 
<a name="l01525"></a>01525 <span class="keywordtype">void</span>
<a name="l01526"></a><a class="code" href="group__DBusBus.html#ga4eb6401ba014da3dbe3dc4e2a8e5b3ef">01526</a> <a class="code" href="group__DBusBus.html#ga4eb6401ba014da3dbe3dc4e2a8e5b3ef" title="Adds a match rule to match messages going through the message bus.">dbus_bus_add_match</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l01527"></a>01527                     <span class="keyword">const</span> <span class="keywordtype">char</span>     *rule,
<a name="l01528"></a>01528                     <a class="code" href="structDBusError.html" title="Object representing an exception.">DBusError</a>      *error)
<a name="l01529"></a>01529 {
<a name="l01530"></a>01530   <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *msg;
<a name="l01531"></a>01531 
<a name="l01532"></a>01532   _dbus_return_if_fail (rule != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l01533"></a>01533 
<a name="l01534"></a>01534   msg = <a class="code" href="group__DBusMessage.html#ga98ddc82450d818138ef326a284201ee0" title="Constructs a new message to invoke a method on a remote object.">dbus_message_new_method_call</a> (<a class="code" href="group__DBusShared.html#ga9e017e829e575bdc5c554fd4d07d7355" title="The bus name used to talk to the bus itself.">DBUS_SERVICE_DBUS</a>,
<a name="l01535"></a>01535                                       <a class="code" href="group__DBusShared.html#ga840a593b8fa139c69ef679830f42d91f" title="The object path used to talk to the bus itself.">DBUS_PATH_DBUS</a>,
<a name="l01536"></a>01536                                       <a class="code" href="group__DBusShared.html#gaa34514374bb61b8222a670a3d0b3fdc4" title="The interface exported by the object with DBUS_SERVICE_DBUS and DBUS_PATH_DBUS.">DBUS_INTERFACE_DBUS</a>,
<a name="l01537"></a>01537                                       <span class="stringliteral">&quot;AddMatch&quot;</span>);
<a name="l01538"></a>01538 
<a name="l01539"></a>01539   <span class="keywordflow">if</span> (msg == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01540"></a>01540     {
<a name="l01541"></a>01541       _DBUS_SET_OOM (error);
<a name="l01542"></a>01542       <span class="keywordflow">return</span>;
<a name="l01543"></a>01543     }
<a name="l01544"></a>01544 
<a name="l01545"></a>01545   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusMessage.html#ga591f3aab5dd2c87e56e05423c2a671d9" title="Appends fields to a message given a variable argument list.">dbus_message_append_args</a> (msg, <a class="code" href="group__DBusProtocol.html#ga7eb77066dadf5415896b44c56d93acce" title="Type code marking a UTF-8 encoded, nul-terminated Unicode string.">DBUS_TYPE_STRING</a>, &amp;rule,
<a name="l01546"></a>01546                                  <a class="code" href="group__DBusProtocol.html#gaa9588da889743b2119dc6664712ae51e" title="Type code that is never equal to a legitimate type code.">DBUS_TYPE_INVALID</a>))
<a name="l01547"></a>01547     {
<a name="l01548"></a>01548       <a class="code" href="group__DBusMessage.html#gab69441efe683918f6a82469c8763f464" title="Decrements the reference count of a DBusMessage, freeing the message if the count reaches 0...">dbus_message_unref</a> (msg);
<a name="l01549"></a>01549       _DBUS_SET_OOM (error);
<a name="l01550"></a>01550       <span class="keywordflow">return</span>;
<a name="l01551"></a>01551     }
<a name="l01552"></a>01552 
<a name="l01553"></a>01553   send_no_return_values (connection, msg, error);
<a name="l01554"></a>01554 
<a name="l01555"></a>01555   <a class="code" href="group__DBusMessage.html#gab69441efe683918f6a82469c8763f464" title="Decrements the reference count of a DBusMessage, freeing the message if the count reaches 0...">dbus_message_unref</a> (msg);
<a name="l01556"></a>01556 }
<a name="l01557"></a>01557 
<a name="l01575"></a>01575 <span class="keywordtype">void</span>
<a name="l01576"></a><a class="code" href="group__DBusBus.html#ga6e6b98e19fa4400de7ef99c27b866b99">01576</a> <a class="code" href="group__DBusBus.html#ga6e6b98e19fa4400de7ef99c27b866b99" title="Removes a previously-added match rule &quot;by value&quot; (the most recently-added identical rule gets removed...">dbus_bus_remove_match</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l01577"></a>01577                        <span class="keyword">const</span> <span class="keywordtype">char</span>     *rule,
<a name="l01578"></a>01578                        <a class="code" href="structDBusError.html" title="Object representing an exception.">DBusError</a>      *error)
<a name="l01579"></a>01579 {
<a name="l01580"></a>01580   <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *msg;
<a name="l01581"></a>01581 
<a name="l01582"></a>01582   _dbus_return_if_fail (rule != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l01583"></a>01583   
<a name="l01584"></a>01584   msg = <a class="code" href="group__DBusMessage.html#ga98ddc82450d818138ef326a284201ee0" title="Constructs a new message to invoke a method on a remote object.">dbus_message_new_method_call</a> (<a class="code" href="group__DBusShared.html#ga9e017e829e575bdc5c554fd4d07d7355" title="The bus name used to talk to the bus itself.">DBUS_SERVICE_DBUS</a>,
<a name="l01585"></a>01585                                       <a class="code" href="group__DBusShared.html#ga840a593b8fa139c69ef679830f42d91f" title="The object path used to talk to the bus itself.">DBUS_PATH_DBUS</a>,
<a name="l01586"></a>01586                                       <a class="code" href="group__DBusShared.html#gaa34514374bb61b8222a670a3d0b3fdc4" title="The interface exported by the object with DBUS_SERVICE_DBUS and DBUS_PATH_DBUS.">DBUS_INTERFACE_DBUS</a>,
<a name="l01587"></a>01587                                       <span class="stringliteral">&quot;RemoveMatch&quot;</span>);
<a name="l01588"></a>01588 
<a name="l01589"></a>01589   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusMessage.html#ga591f3aab5dd2c87e56e05423c2a671d9" title="Appends fields to a message given a variable argument list.">dbus_message_append_args</a> (msg, <a class="code" href="group__DBusProtocol.html#ga7eb77066dadf5415896b44c56d93acce" title="Type code marking a UTF-8 encoded, nul-terminated Unicode string.">DBUS_TYPE_STRING</a>, &amp;rule,
<a name="l01590"></a>01590                                  <a class="code" href="group__DBusProtocol.html#gaa9588da889743b2119dc6664712ae51e" title="Type code that is never equal to a legitimate type code.">DBUS_TYPE_INVALID</a>))
<a name="l01591"></a>01591     {
<a name="l01592"></a>01592       <a class="code" href="group__DBusMessage.html#gab69441efe683918f6a82469c8763f464" title="Decrements the reference count of a DBusMessage, freeing the message if the count reaches 0...">dbus_message_unref</a> (msg);
<a name="l01593"></a>01593       _DBUS_SET_OOM (error);
<a name="l01594"></a>01594       <span class="keywordflow">return</span>;
<a name="l01595"></a>01595     }
<a name="l01596"></a>01596 
<a name="l01597"></a>01597   send_no_return_values (connection, msg, error);
<a name="l01598"></a>01598 
<a name="l01599"></a>01599   <a class="code" href="group__DBusMessage.html#gab69441efe683918f6a82469c8763f464" title="Decrements the reference count of a DBusMessage, freeing the message if the count reaches 0...">dbus_message_unref</a> (msg);
<a name="l01600"></a>01600 }
<a name="l01601"></a>01601 
</pre></div></div><!-- contents -->


<hr class="footer"/><address class="footer"><small>
Generated on Thu Mar 3 2016 17:50:29 for D-Bus by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>

</body>
</html>