Current File : //usr/share/doc/dbus/api/dbus-connection_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-connection.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-connection.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-connection.c DBusConnection object</span>
<a name="l00003"></a>00003 <span class="comment"> *</span>
<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002-2006  Red Hat Inc.</span>
<a name="l00005"></a>00005 <span class="comment"> *</span>
<a name="l00006"></a>00006 <span class="comment"> * Licensed under the Academic Free License version 2.1</span>
<a name="l00007"></a>00007 <span class="comment"> * </span>
<a name="l00008"></a>00008 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
<a name="l00009"></a>00009 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
<a name="l00010"></a>00010 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
<a name="l00011"></a>00011 <span class="comment"> * (at your option) any later version.</span>
<a name="l00012"></a>00012 <span class="comment"> *</span>
<a name="l00013"></a>00013 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
<a name="l00014"></a>00014 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00015"></a>00015 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
<a name="l00016"></a>00016 <span class="comment"> * GNU General Public License for more details.</span>
<a name="l00017"></a>00017 <span class="comment"> * </span>
<a name="l00018"></a>00018 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
<a name="l00019"></a>00019 <span class="comment"> * along with this program; if not, write to the Free Software</span>
<a name="l00020"></a>00020 <span class="comment"> * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA</span>
<a name="l00021"></a>00021 <span class="comment"> *</span>
<a name="l00022"></a>00022 <span class="comment"> */</span>
<a name="l00023"></a>00023 
<a name="l00024"></a>00024 <span class="preprocessor">#include &lt;config.h&gt;</span>
<a name="l00025"></a>00025 <span class="preprocessor">#include &quot;dbus-shared.h&quot;</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include &quot;dbus-connection.h&quot;</span>
<a name="l00027"></a>00027 <span class="preprocessor">#include &quot;dbus-list.h&quot;</span>
<a name="l00028"></a>00028 <span class="preprocessor">#include &quot;dbus-timeout.h&quot;</span>
<a name="l00029"></a>00029 <span class="preprocessor">#include &quot;dbus-transport.h&quot;</span>
<a name="l00030"></a>00030 <span class="preprocessor">#include &quot;dbus-watch.h&quot;</span>
<a name="l00031"></a>00031 <span class="preprocessor">#include &quot;dbus-connection-internal.h&quot;</span>
<a name="l00032"></a>00032 <span class="preprocessor">#include &quot;dbus-pending-call-internal.h&quot;</span>
<a name="l00033"></a>00033 <span class="preprocessor">#include &quot;dbus-list.h&quot;</span>
<a name="l00034"></a>00034 <span class="preprocessor">#include &quot;dbus-hash.h&quot;</span>
<a name="l00035"></a>00035 <span class="preprocessor">#include &quot;dbus-message-internal.h&quot;</span>
<a name="l00036"></a>00036 <span class="preprocessor">#include &quot;dbus-message-private.h&quot;</span>
<a name="l00037"></a>00037 <span class="preprocessor">#include &quot;dbus-threads.h&quot;</span>
<a name="l00038"></a>00038 <span class="preprocessor">#include &quot;dbus-protocol.h&quot;</span>
<a name="l00039"></a>00039 <span class="preprocessor">#include &quot;dbus-dataslot.h&quot;</span>
<a name="l00040"></a>00040 <span class="preprocessor">#include &quot;dbus-string.h&quot;</span>
<a name="l00041"></a>00041 <span class="preprocessor">#include &quot;dbus-signature.h&quot;</span>
<a name="l00042"></a>00042 <span class="preprocessor">#include &quot;dbus-pending-call.h&quot;</span>
<a name="l00043"></a>00043 <span class="preprocessor">#include &quot;dbus-object-tree.h&quot;</span>
<a name="l00044"></a>00044 <span class="preprocessor">#include &quot;dbus-threads-internal.h&quot;</span>
<a name="l00045"></a>00045 <span class="preprocessor">#include &quot;dbus-bus.h&quot;</span>
<a name="l00046"></a>00046 <span class="preprocessor">#include &quot;dbus-marshal-basic.h&quot;</span>
<a name="l00047"></a>00047 
<a name="l00048"></a>00048 <span class="preprocessor">#ifdef DBUS_DISABLE_CHECKS</span>
<a name="l00049"></a>00049 <span class="preprocessor"></span><span class="preprocessor">#define TOOK_LOCK_CHECK(connection)</span>
<a name="l00050"></a>00050 <span class="preprocessor"></span><span class="preprocessor">#define RELEASING_LOCK_CHECK(connection)</span>
<a name="l00051"></a>00051 <span class="preprocessor"></span><span class="preprocessor">#define HAVE_LOCK_CHECK(connection)</span>
<a name="l00052"></a>00052 <span class="preprocessor"></span><span class="preprocessor">#else</span>
<a name="l00053"></a>00053 <span class="preprocessor"></span><span class="preprocessor">#define TOOK_LOCK_CHECK(connection) do {                \</span>
<a name="l00054"></a>00054 <span class="preprocessor">    _dbus_assert (!(connection)-&gt;have_connection_lock); \</span>
<a name="l00055"></a>00055 <span class="preprocessor">    (connection)-&gt;have_connection_lock = TRUE;          \</span>
<a name="l00056"></a>00056 <span class="preprocessor">  } while (0)</span>
<a name="l00057"></a>00057 <span class="preprocessor"></span><span class="preprocessor">#define RELEASING_LOCK_CHECK(connection) do {            \</span>
<a name="l00058"></a>00058 <span class="preprocessor">    _dbus_assert ((connection)-&gt;have_connection_lock);   \</span>
<a name="l00059"></a>00059 <span class="preprocessor">    (connection)-&gt;have_connection_lock = FALSE;          \</span>
<a name="l00060"></a>00060 <span class="preprocessor">  } while (0)</span>
<a name="l00061"></a>00061 <span class="preprocessor"></span><span class="preprocessor">#define HAVE_LOCK_CHECK(connection)        _dbus_assert ((connection)-&gt;have_connection_lock)</span>
<a name="l00062"></a>00062 <span class="preprocessor"></span><span class="comment">/* A &quot;DO_NOT_HAVE_LOCK_CHECK&quot; is impossible since we need the lock to check the flag */</span>
<a name="l00063"></a>00063 <span class="preprocessor">#endif</span>
<a name="l00064"></a>00064 <span class="preprocessor"></span>
<a name="l00065"></a>00065 <span class="preprocessor">#define TRACE_LOCKS 1</span>
<a name="l00066"></a>00066 <span class="preprocessor"></span>
<a name="l00067"></a>00067 <span class="preprocessor">#define CONNECTION_LOCK(connection)   do {                                      \</span>
<a name="l00068"></a>00068 <span class="preprocessor">    if (TRACE_LOCKS) { _dbus_verbose (&quot;LOCK\n&quot;); }   \</span>
<a name="l00069"></a>00069 <span class="preprocessor">    _dbus_rmutex_lock ((connection)-&gt;mutex);                                    \</span>
<a name="l00070"></a>00070 <span class="preprocessor">    TOOK_LOCK_CHECK (connection);                                               \</span>
<a name="l00071"></a>00071 <span class="preprocessor">  } while (0)</span>
<a name="l00072"></a>00072 <span class="preprocessor"></span>
<a name="l00073"></a>00073 <span class="preprocessor">#define CONNECTION_UNLOCK(connection) _dbus_connection_unlock (connection)</span>
<a name="l00074"></a>00074 <span class="preprocessor"></span>
<a name="l00075"></a>00075 <span class="preprocessor">#define SLOTS_LOCK(connection) do {                     \</span>
<a name="l00076"></a>00076 <span class="preprocessor">    _dbus_rmutex_lock ((connection)-&gt;slot_mutex);       \</span>
<a name="l00077"></a>00077 <span class="preprocessor">  } while (0)</span>
<a name="l00078"></a>00078 <span class="preprocessor"></span>
<a name="l00079"></a>00079 <span class="preprocessor">#define SLOTS_UNLOCK(connection) do {                   \</span>
<a name="l00080"></a>00080 <span class="preprocessor">    _dbus_rmutex_unlock ((connection)-&gt;slot_mutex);     \</span>
<a name="l00081"></a>00081 <span class="preprocessor">  } while (0)</span>
<a name="l00082"></a>00082 <span class="preprocessor"></span>
<a name="l00083"></a>00083 <span class="preprocessor">#define DISPATCH_STATUS_NAME(s)                                            \</span>
<a name="l00084"></a>00084 <span class="preprocessor">                     ((s) == DBUS_DISPATCH_COMPLETE ? &quot;complete&quot; :         \</span>
<a name="l00085"></a>00085 <span class="preprocessor">                      (s) == DBUS_DISPATCH_DATA_REMAINS ? &quot;data remains&quot; : \</span>
<a name="l00086"></a>00086 <span class="preprocessor">                      (s) == DBUS_DISPATCH_NEED_MEMORY ? &quot;need memory&quot; :   \</span>
<a name="l00087"></a>00087 <span class="preprocessor">                      &quot;???&quot;)</span>
<a name="l00088"></a>00088 <span class="preprocessor"></span>
<a name="l00206"></a>00206 <span class="keyword">static</span> <span class="keywordtype">void</span>
<a name="l00207"></a>00207 _dbus_connection_trace_ref (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l00208"></a>00208     <span class="keywordtype">int</span> old_refcount,
<a name="l00209"></a>00209     <span class="keywordtype">int</span> new_refcount,
<a name="l00210"></a>00210     <span class="keyword">const</span> <span class="keywordtype">char</span> *why)
<a name="l00211"></a>00211 {
<a name="l00212"></a>00212 <span class="preprocessor">#ifdef DBUS_ENABLE_VERBOSE_MODE</span>
<a name="l00213"></a>00213 <span class="preprocessor"></span>  <span class="keyword">static</span> <span class="keywordtype">int</span> enabled = -1;
<a name="l00214"></a>00214 
<a name="l00215"></a>00215   _dbus_trace_ref (<span class="stringliteral">&quot;DBusConnection&quot;</span>, connection, old_refcount, new_refcount,
<a name="l00216"></a>00216       why, <span class="stringliteral">&quot;DBUS_CONNECTION_TRACE&quot;</span>, &amp;enabled);
<a name="l00217"></a>00217 <span class="preprocessor">#endif</span>
<a name="l00218"></a>00218 <span class="preprocessor"></span>}
<a name="l00219"></a>00219 
<a name="l00223"></a><a class="code" href="group__DBusConnectionInternals.html#gaec8158f55878d1a6459ebdc9950fa783">00223</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structDBusMessageFilter.html" title="Internal struct representing a message filter function.">DBusMessageFilter</a> <a class="code" href="structDBusMessageFilter.html" title="Internal struct representing a message filter function.">DBusMessageFilter</a>;
<a name="l00224"></a>00224 
<a name="l00228"></a><a class="code" href="structDBusMessageFilter.html">00228</a> <span class="keyword">struct </span><a class="code" href="structDBusMessageFilter.html" title="Internal struct representing a message filter function.">DBusMessageFilter</a>
<a name="l00229"></a>00229 {
<a name="l00230"></a><a class="code" href="structDBusMessageFilter.html#a2d2debd9a708cb7d4f8447c18f7458b9">00230</a>   <a class="code" href="structDBusAtomic.html" title="An atomic integer safe to increment or decrement from multiple threads.">DBusAtomic</a> <a class="code" href="structDBusMessageFilter.html#a2d2debd9a708cb7d4f8447c18f7458b9" title="Reference count.">refcount</a>; 
<a name="l00231"></a><a class="code" href="structDBusMessageFilter.html#a56b3643122277ed5dc3d4f07793617fa">00231</a>   <a class="code" href="group__DBusConnection.html#ga13febac22a058c4fc98a90ce7da69489" title="Called when a message needs to be handled.">DBusHandleMessageFunction</a> <span class="keyword">function</span>; 
<a name="l00232"></a><a class="code" href="structDBusMessageFilter.html#a6cf5321325828e39da1cc8fa1b3d7153">00232</a>   <span class="keywordtype">void</span> *<a class="code" href="structDBusMessageFilter.html#a6cf5321325828e39da1cc8fa1b3d7153" title="User data for the function.">user_data</a>; 
<a name="l00233"></a><a class="code" href="structDBusMessageFilter.html#a915f3269a91ee41d963448dcb22d92cd">00233</a>   <a class="code" href="group__DBusMemory.html#ga061bcded226d76c7d7de35beaa165cb5" title="The type of a function which frees a block of memory.">DBusFreeFunction</a> <a class="code" href="structDBusMessageFilter.html#a915f3269a91ee41d963448dcb22d92cd" title="Function to free the user data.">free_user_data_function</a>; 
<a name="l00234"></a>00234 };
<a name="l00235"></a>00235 
<a name="l00236"></a>00236 
<a name="l00240"></a><a class="code" href="structDBusPreallocatedSend.html">00240</a> <span class="keyword">struct </span><a class="code" href="structDBusPreallocatedSend.html" title="Internals of DBusPreallocatedSend.">DBusPreallocatedSend</a>
<a name="l00241"></a>00241 {
<a name="l00242"></a><a class="code" href="structDBusPreallocatedSend.html#a465af3647772c89500df0b46f43d035b">00242</a>   <a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *<a class="code" href="structDBusPreallocatedSend.html#a465af3647772c89500df0b46f43d035b" title="Connection we&#39;d send the message to.">connection</a>; 
<a name="l00243"></a><a class="code" href="structDBusPreallocatedSend.html#ae164fe13f866bebbd714b526104c5bff">00243</a>   <a class="code" href="structDBusList.html" title="A node in a linked list.">DBusList</a> *<a class="code" href="structDBusPreallocatedSend.html#ae164fe13f866bebbd714b526104c5bff" title="Preallocated link in the queue.">queue_link</a>;       
<a name="l00244"></a><a class="code" href="structDBusPreallocatedSend.html#aae6c1bd98f78491482d5f59b6ef138d4">00244</a>   <a class="code" href="structDBusList.html" title="A node in a linked list.">DBusList</a> *<a class="code" href="structDBusPreallocatedSend.html#aae6c1bd98f78491482d5f59b6ef138d4" title="Preallocated link in the resource counter.">counter_link</a>;     
<a name="l00245"></a>00245 };
<a name="l00246"></a>00246 
<a name="l00247"></a>00247 <span class="preprocessor">#if HAVE_DECL_MSG_NOSIGNAL</span>
<a name="l00248"></a>00248 <span class="preprocessor"></span><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> _dbus_modify_sigpipe = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00249"></a>00249 <span class="preprocessor">#else</span>
<a name="l00250"></a>00250 <span class="preprocessor"></span><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> _dbus_modify_sigpipe = <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l00251"></a>00251 <span class="preprocessor">#endif</span>
<a name="l00252"></a>00252 <span class="preprocessor"></span>
<a name="l00256"></a><a class="code" href="structDBusConnection.html">00256</a> <span class="keyword">struct </span><a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>
<a name="l00257"></a>00257 {
<a name="l00258"></a><a class="code" href="structDBusConnection.html#a6fbf0227071fc20ffd5b0e79aef58e92">00258</a>   <a class="code" href="structDBusAtomic.html" title="An atomic integer safe to increment or decrement from multiple threads.">DBusAtomic</a> <a class="code" href="structDBusConnection.html#a6fbf0227071fc20ffd5b0e79aef58e92" title="Reference count.">refcount</a>; 
<a name="l00260"></a><a class="code" href="structDBusConnection.html#a98e26cfd09ddbf0238f90bf4965641bf">00260</a>   <a class="code" href="structDBusRMutex.html">DBusRMutex</a> *<a class="code" href="structDBusConnection.html#a98e26cfd09ddbf0238f90bf4965641bf" title="Lock on the entire DBusConnection.">mutex</a>; 
<a name="l00262"></a><a class="code" href="structDBusConnection.html#ad9e7bf73a48f4951b24ce8eec7bb7ac5">00262</a>   <a class="code" href="structDBusCMutex.html">DBusCMutex</a> *<a class="code" href="structDBusConnection.html#ad9e7bf73a48f4951b24ce8eec7bb7ac5" title="Protects dispatch_acquired.">dispatch_mutex</a>;     
<a name="l00263"></a><a class="code" href="structDBusConnection.html#a201f92bbc0947b503a36eaff9ae0ede9">00263</a>   <a class="code" href="structDBusCondVar.html">DBusCondVar</a> *<a class="code" href="structDBusConnection.html#a201f92bbc0947b503a36eaff9ae0ede9" title="Notify when dispatch_acquired is available.">dispatch_cond</a>;    
<a name="l00264"></a><a class="code" href="structDBusConnection.html#aaad1c7d6e6ba3e049ef790f4f9aa35cd">00264</a>   <a class="code" href="structDBusCMutex.html">DBusCMutex</a> *<a class="code" href="structDBusConnection.html#aaad1c7d6e6ba3e049ef790f4f9aa35cd" title="Protects io_path_acquired.">io_path_mutex</a>;      
<a name="l00265"></a><a class="code" href="structDBusConnection.html#a6d87e03eea7aaff53f5574efcfb8c3e4">00265</a>   <a class="code" href="structDBusCondVar.html">DBusCondVar</a> *<a class="code" href="structDBusConnection.html#a6d87e03eea7aaff53f5574efcfb8c3e4" title="Notify when io_path_acquired is available.">io_path_cond</a>;     
<a name="l00267"></a><a class="code" href="structDBusConnection.html#a714fd51af8730c367b079594c7f756ae">00267</a>   <a class="code" href="structDBusList.html" title="A node in a linked list.">DBusList</a> *<a class="code" href="structDBusConnection.html#a714fd51af8730c367b079594c7f756ae" title="Queue of messages we need to send, send the end of the list first.">outgoing_messages</a>; 
<a name="l00268"></a><a class="code" href="structDBusConnection.html#aacb3a29956aa7712db37916194fde869">00268</a>   <a class="code" href="structDBusList.html" title="A node in a linked list.">DBusList</a> *<a class="code" href="structDBusConnection.html#aacb3a29956aa7712db37916194fde869" title="Queue of messages we have received, end of the list received most recently.">incoming_messages</a>; 
<a name="l00269"></a><a class="code" href="structDBusConnection.html#afc069c0dc7f29123d432650580aec036">00269</a>   <a class="code" href="structDBusList.html" title="A node in a linked list.">DBusList</a> *<a class="code" href="structDBusConnection.html#afc069c0dc7f29123d432650580aec036" title="Messages that will be released when we next unlock.">expired_messages</a>;  
<a name="l00271"></a><a class="code" href="structDBusConnection.html#aef492b411cd2ebd214f8e4dd15e154af">00271</a>   <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *<a class="code" href="structDBusConnection.html#aef492b411cd2ebd214f8e4dd15e154af" title="Filled in if the first incoming message has been borrowed; dispatch_acquired will be set by the borro...">message_borrowed</a>; 
<a name="l00275"></a><a class="code" href="structDBusConnection.html#a07025e177949c5e65d5f983ac5f5e878">00275</a>   <span class="keywordtype">int</span> <a class="code" href="structDBusConnection.html#a07025e177949c5e65d5f983ac5f5e878" title="Length of outgoing queue.">n_outgoing</a>;              
<a name="l00276"></a><a class="code" href="structDBusConnection.html#a9bda45f2d5c9af5c187fc31d7c98b424">00276</a>   <span class="keywordtype">int</span> <a class="code" href="structDBusConnection.html#a9bda45f2d5c9af5c187fc31d7c98b424" title="Length of incoming queue.">n_incoming</a>;              
<a name="l00278"></a><a class="code" href="structDBusConnection.html#a5dcb660883904035076579c6d2f46501">00278</a>   <a class="code" href="structDBusCounter.html" title="Internals of DBusCounter.">DBusCounter</a> *<a class="code" href="structDBusConnection.html#a5dcb660883904035076579c6d2f46501" title="Counts size of outgoing messages.">outgoing_counter</a>; 
<a name="l00280"></a><a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b">00280</a>   <a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>;    
<a name="l00281"></a><a class="code" href="structDBusConnection.html#abdb6a32972d924531fb2cd80c7fd6d37">00281</a>   <a class="code" href="structDBusWatchList.html" title="DBusWatchList implementation details.">DBusWatchList</a> *<a class="code" href="structDBusConnection.html#abdb6a32972d924531fb2cd80c7fd6d37" title="Stores active watches.">watches</a>;      
<a name="l00282"></a><a class="code" href="structDBusConnection.html#af3936ac5c968f2ac09bf05cf36025994">00282</a>   <a class="code" href="structDBusTimeoutList.html" title="DBusTimeoutList implementation details.">DBusTimeoutList</a> *<a class="code" href="structDBusConnection.html#af3936ac5c968f2ac09bf05cf36025994" title="Stores active timeouts.">timeouts</a>;   
<a name="l00284"></a><a class="code" href="structDBusConnection.html#a32d14cefcb4daea257544397755d45ed">00284</a>   <a class="code" href="structDBusList.html" title="A node in a linked list.">DBusList</a> *<a class="code" href="structDBusConnection.html#a32d14cefcb4daea257544397755d45ed" title="List of filters.">filter_list</a>;        
<a name="l00286"></a><a class="code" href="structDBusConnection.html#a773fb4ecd2738548dbbfbe6d1206da92">00286</a>   <a class="code" href="structDBusRMutex.html">DBusRMutex</a> *<a class="code" href="structDBusConnection.html#a773fb4ecd2738548dbbfbe6d1206da92" title="Lock on slot_list so overall connection lock need not be taken.">slot_mutex</a>;        
<a name="l00287"></a><a class="code" href="structDBusConnection.html#a0f805edcd9c09aaf45974510403dccbd">00287</a>   <a class="code" href="structDBusDataSlotList.html" title="Data structure that stores the actual user data set at a given slot.">DBusDataSlotList</a> <a class="code" href="structDBusConnection.html#a0f805edcd9c09aaf45974510403dccbd" title="Data stored by allocated integer ID.">slot_list</a>;   
<a name="l00289"></a><a class="code" href="structDBusConnection.html#ad8fa077f91fe62d0c10862e2ff9e86ca">00289</a>   <a class="code" href="structDBusHashTable.html" title="Internals of DBusHashTable.">DBusHashTable</a> *<a class="code" href="structDBusConnection.html#ad8fa077f91fe62d0c10862e2ff9e86ca" title="Hash of message serials to DBusPendingCall.">pending_replies</a>;  
<a name="l00291"></a><a class="code" href="structDBusConnection.html#a43d0bb9401103383e13ed3c99baf0daa">00291</a>   <a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a> <a class="code" href="structDBusConnection.html#a43d0bb9401103383e13ed3c99baf0daa" title="Client serial.">client_serial</a>;       
<a name="l00292"></a><a class="code" href="structDBusConnection.html#aa70afc41f6184604c027e7f71a314d7f">00292</a>   <a class="code" href="structDBusList.html" title="A node in a linked list.">DBusList</a> *<a class="code" href="structDBusConnection.html#aa70afc41f6184604c027e7f71a314d7f" title="Preallocated list node for queueing the disconnection message.">disconnect_message_link</a>; 
<a name="l00294"></a><a class="code" href="structDBusConnection.html#a211104e37f65d45ab8fcb149e4bcc84e">00294</a>   <a class="code" href="group__DBusConnection.html#ga4bea703ee5b9f8dfe79c4082c347d43d" title="Called when the main loop&#39;s thread should be notified that there&#39;s now work to do.">DBusWakeupMainFunction</a> <a class="code" href="structDBusConnection.html#a211104e37f65d45ab8fcb149e4bcc84e" title="Function to wake up the mainloop.">wakeup_main_function</a>; 
<a name="l00295"></a><a class="code" href="structDBusConnection.html#ac8aff7bafd9ed046d835c5ed80bc218c">00295</a>   <span class="keywordtype">void</span> *<a class="code" href="structDBusConnection.html#ac8aff7bafd9ed046d835c5ed80bc218c" title="Application data for wakeup_main_function.">wakeup_main_data</a>; 
<a name="l00296"></a><a class="code" href="structDBusConnection.html#a8da896126df262503431acd73638c917">00296</a>   <a class="code" href="group__DBusMemory.html#ga061bcded226d76c7d7de35beaa165cb5" title="The type of a function which frees a block of memory.">DBusFreeFunction</a> <a class="code" href="structDBusConnection.html#a8da896126df262503431acd73638c917" title="free wakeup_main_data">free_wakeup_main_data</a>; 
<a name="l00298"></a><a class="code" href="structDBusConnection.html#af6cbafdf80cd474c654fc226581900a2">00298</a>   <a class="code" href="group__DBusConnection.html#gaad6e12a5d298ef30a99d8c667abad58a" title="Called when the return value of dbus_connection_get_dispatch_status() may have changed.">DBusDispatchStatusFunction</a> <a class="code" href="structDBusConnection.html#af6cbafdf80cd474c654fc226581900a2" title="Function on dispatch status changes.">dispatch_status_function</a>; 
<a name="l00299"></a><a class="code" href="structDBusConnection.html#a0225f7934d1bd118ae2eeacf8a1c6f19">00299</a>   <span class="keywordtype">void</span> *<a class="code" href="structDBusConnection.html#a0225f7934d1bd118ae2eeacf8a1c6f19" title="Application data for dispatch_status_function.">dispatch_status_data</a>; 
<a name="l00300"></a><a class="code" href="structDBusConnection.html#a71f8b1e2078c4edb98c62de1886dfb2a">00300</a>   <a class="code" href="group__DBusMemory.html#ga061bcded226d76c7d7de35beaa165cb5" title="The type of a function which frees a block of memory.">DBusFreeFunction</a> <a class="code" href="structDBusConnection.html#a71f8b1e2078c4edb98c62de1886dfb2a" title="free dispatch_status_data">free_dispatch_status_data</a>; 
<a name="l00302"></a><a class="code" href="structDBusConnection.html#af3bbd2ecba171ebb8e952eaa030971d7">00302</a>   <a class="code" href="group__DBusConnection.html#gabf250a32ff740b2a8c99136e0142d8d2" title="Indicates the status of incoming data on a DBusConnection.">DBusDispatchStatus</a> <a class="code" href="structDBusConnection.html#af3bbd2ecba171ebb8e952eaa030971d7" title="The last dispatch status we reported to the application.">last_dispatch_status</a>; 
<a name="l00304"></a><a class="code" href="structDBusConnection.html#acd289771721a459f4f9cdeaca0fa87c2">00304</a>   <a class="code" href="structDBusObjectTree.html" title="Internals of DBusObjectTree.">DBusObjectTree</a> *<a class="code" href="structDBusConnection.html#acd289771721a459f4f9cdeaca0fa87c2" title="Object path handlers registered with this connection.">objects</a>; 
<a name="l00306"></a><a class="code" href="structDBusConnection.html#ad1abb7ad98db87f32b4abda22df075bd">00306</a>   <span class="keywordtype">char</span> *<a class="code" href="structDBusConnection.html#ad1abb7ad98db87f32b4abda22df075bd" title="GUID of server if we are in shared_connections, NULL if server GUID is unknown or connection is priva...">server_guid</a>; 
<a name="l00308"></a>00308   <span class="comment">/* These two MUST be bools and not bitfields, because they are protected by a separate lock</span>
<a name="l00309"></a>00309 <span class="comment">   * from connection-&gt;mutex and all bitfields in a word have to be read/written together.</span>
<a name="l00310"></a>00310 <span class="comment">   * So you can&#39;t have a different lock for different bitfields in the same word.</span>
<a name="l00311"></a>00311 <span class="comment">   */</span>
<a name="l00312"></a><a class="code" href="structDBusConnection.html#a11803a01d74d956ef37e6aa092f0cf17">00312</a>   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> <a class="code" href="structDBusConnection.html#a11803a01d74d956ef37e6aa092f0cf17" title="Someone has dispatch path (can drain incoming queue)">dispatch_acquired</a>; 
<a name="l00313"></a><a class="code" href="structDBusConnection.html#a9f71e445534a4405075c33b5a075589f">00313</a>   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> <a class="code" href="structDBusConnection.html#a9f71e445534a4405075c33b5a075589f" title="Someone has transport io path (can use the transport to read/write messages)">io_path_acquired</a>;  
<a name="l00315"></a><a class="code" href="structDBusConnection.html#aae47138b9b2494b65072ff300d631aa8">00315</a>   <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="structDBusConnection.html#aae47138b9b2494b65072ff300d631aa8" title="TRUE if libdbus owns a reference to the connection and can return it from dbus_connection_open() more...">shareable</a> : 1; 
<a name="l00317"></a><a class="code" href="structDBusConnection.html#a2a9f22339f90157f308a532462218404">00317</a>   <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="structDBusConnection.html#a2a9f22339f90157f308a532462218404" title="If TRUE, exit after handling disconnect signal.">exit_on_disconnect</a> : 1; 
<a name="l00319"></a><a class="code" href="structDBusConnection.html#ab13bc36d7e6f91995768277ecbd5482c">00319</a>   <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="structDBusConnection.html#ab13bc36d7e6f91995768277ecbd5482c" title="If TRUE, if org.freedesktop.DBus.Peer messages have a bus name, don&#39;t handle them automatically...">route_peer_messages</a> : 1; 
<a name="l00321"></a><a class="code" href="structDBusConnection.html#a48d141d4311211e921571043bdbaeefb">00321</a>   <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="structDBusConnection.html#a48d141d4311211e921571043bdbaeefb" title="We popped or are dispatching the disconnected message.">disconnected_message_arrived</a> : 1;   
<a name="l00325"></a><a class="code" href="structDBusConnection.html#a3b2707b9d10d0643f91a8e027ae118b5">00325</a>   <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="structDBusConnection.html#a3b2707b9d10d0643f91a8e027ae118b5" title="We did our default handling of the disconnected message, such as closing the connection.">disconnected_message_processed</a> : 1; 
<a name="l00329"></a>00329 <span class="preprocessor">#ifndef DBUS_DISABLE_CHECKS</span>
<a name="l00330"></a><a class="code" href="structDBusConnection.html#a336a7953a4a28e55f6e6a07acfa11df3">00330</a> <span class="preprocessor"></span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="structDBusConnection.html#a336a7953a4a28e55f6e6a07acfa11df3" title="Used to check locking.">have_connection_lock</a> : 1; 
<a name="l00331"></a>00331 <span class="preprocessor">#endif</span>
<a name="l00332"></a>00332 <span class="preprocessor"></span>
<a name="l00333"></a>00333 <span class="preprocessor">#if defined(DBUS_ENABLE_CHECKS) || defined(DBUS_ENABLE_ASSERT)</span>
<a name="l00334"></a>00334 <span class="preprocessor"></span>  <span class="keywordtype">int</span> generation; 
<a name="l00335"></a>00335 <span class="preprocessor">#endif </span>
<a name="l00336"></a>00336 <span class="preprocessor"></span>};
<a name="l00337"></a>00337 
<a name="l00338"></a>00338 <span class="keyword">static</span> <a class="code" href="group__DBusConnection.html#gabf250a32ff740b2a8c99136e0142d8d2" title="Indicates the status of incoming data on a DBusConnection.">DBusDispatchStatus</a> _dbus_connection_get_dispatch_status_unlocked      (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>     *connection);
<a name="l00339"></a>00339 <span class="keyword">static</span> <span class="keywordtype">void</span>               _dbus_connection_update_dispatch_status_and_unlock (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>     *connection,
<a name="l00340"></a>00340                                                                               <a class="code" href="group__DBusConnection.html#gabf250a32ff740b2a8c99136e0142d8d2" title="Indicates the status of incoming data on a DBusConnection.">DBusDispatchStatus</a>  new_status);
<a name="l00341"></a>00341 <span class="keyword">static</span> <span class="keywordtype">void</span>               _dbus_connection_last_unref                        (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>     *connection);
<a name="l00342"></a>00342 <span class="keyword">static</span> <span class="keywordtype">void</span>               _dbus_connection_acquire_dispatch                  (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>     *connection);
<a name="l00343"></a>00343 <span class="keyword">static</span> <span class="keywordtype">void</span>               _dbus_connection_release_dispatch                  (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>     *connection);
<a name="l00344"></a>00344 <span class="keyword">static</span> <a class="code" href="group__DBusConnection.html#gabf250a32ff740b2a8c99136e0142d8d2" title="Indicates the status of incoming data on a DBusConnection.">DBusDispatchStatus</a> _dbus_connection_flush_unlocked                    (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>     *connection);
<a name="l00345"></a>00345 <span class="keyword">static</span> <span class="keywordtype">void</span>               _dbus_connection_close_possibly_shared_and_unlock  (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>     *connection);
<a name="l00346"></a>00346 <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>        _dbus_connection_get_is_connected_unlocked         (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>     *connection);
<a name="l00347"></a>00347 <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>        _dbus_connection_peek_for_reply_unlocked           (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>     *connection,
<a name="l00348"></a>00348                                                                               <a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a>       client_serial);
<a name="l00349"></a>00349 
<a name="l00350"></a>00350 <span class="keyword">static</span> <a class="code" href="structDBusMessageFilter.html" title="Internal struct representing a message filter function.">DBusMessageFilter</a> *
<a name="l00351"></a>00351 _dbus_message_filter_ref (<a class="code" href="structDBusMessageFilter.html" title="Internal struct representing a message filter function.">DBusMessageFilter</a> *filter)
<a name="l00352"></a>00352 {
<a name="l00353"></a>00353 <span class="preprocessor">#ifdef DBUS_DISABLE_ASSERT</span>
<a name="l00354"></a>00354 <span class="preprocessor"></span>  <a class="code" href="group__DBusSysdeps.html#gae74c3fcf12acaeccdb152ef907de951c" title="Atomically increments an integer.">_dbus_atomic_inc</a> (&amp;filter-&gt;<a class="code" href="structDBusMessageFilter.html#a2d2debd9a708cb7d4f8447c18f7458b9" title="Reference count.">refcount</a>);
<a name="l00355"></a>00355 <span class="preprocessor">#else</span>
<a name="l00356"></a>00356 <span class="preprocessor"></span>  <a class="code" href="group__DBusTypes.html#gab18afa60e9b17b6e322735bda3d863d8" title="A 32-bit signed integer on all platforms.">dbus_int32_t</a> old_value;
<a name="l00357"></a>00357 
<a name="l00358"></a>00358   old_value = <a class="code" href="group__DBusSysdeps.html#gae74c3fcf12acaeccdb152ef907de951c" title="Atomically increments an integer.">_dbus_atomic_inc</a> (&amp;filter-&gt;<a class="code" href="structDBusMessageFilter.html#a2d2debd9a708cb7d4f8447c18f7458b9" title="Reference count.">refcount</a>);
<a name="l00359"></a>00359   _dbus_assert (old_value &gt; 0);
<a name="l00360"></a>00360 <span class="preprocessor">#endif</span>
<a name="l00361"></a>00361 <span class="preprocessor"></span>
<a name="l00362"></a>00362   <span class="keywordflow">return</span> filter;
<a name="l00363"></a>00363 }
<a name="l00364"></a>00364 
<a name="l00365"></a>00365 <span class="keyword">static</span> <span class="keywordtype">void</span>
<a name="l00366"></a>00366 _dbus_message_filter_unref (<a class="code" href="structDBusMessageFilter.html" title="Internal struct representing a message filter function.">DBusMessageFilter</a> *filter)
<a name="l00367"></a>00367 {
<a name="l00368"></a>00368   <a class="code" href="group__DBusTypes.html#gab18afa60e9b17b6e322735bda3d863d8" title="A 32-bit signed integer on all platforms.">dbus_int32_t</a> old_value;
<a name="l00369"></a>00369 
<a name="l00370"></a>00370   old_value = <a class="code" href="group__DBusSysdeps.html#ga3c50a069f795dceeb9172fe2b517bbdc" title="Atomically decrement an integer.">_dbus_atomic_dec</a> (&amp;filter-&gt;<a class="code" href="structDBusMessageFilter.html#a2d2debd9a708cb7d4f8447c18f7458b9" title="Reference count.">refcount</a>);
<a name="l00371"></a>00371   _dbus_assert (old_value &gt; 0);
<a name="l00372"></a>00372 
<a name="l00373"></a>00373   <span class="keywordflow">if</span> (old_value == 1)
<a name="l00374"></a>00374     {
<a name="l00375"></a>00375       <span class="keywordflow">if</span> (filter-&gt;<a class="code" href="structDBusMessageFilter.html#a915f3269a91ee41d963448dcb22d92cd" title="Function to free the user data.">free_user_data_function</a>)
<a name="l00376"></a>00376         (* filter-&gt;<a class="code" href="structDBusMessageFilter.html#a915f3269a91ee41d963448dcb22d92cd" title="Function to free the user data.">free_user_data_function</a>) (filter-&gt;<a class="code" href="structDBusMessageFilter.html#a6cf5321325828e39da1cc8fa1b3d7153" title="User data for the function.">user_data</a>);
<a name="l00377"></a>00377       
<a name="l00378"></a>00378       <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> (filter);
<a name="l00379"></a>00379     }
<a name="l00380"></a>00380 }
<a name="l00381"></a>00381 
<a name="l00387"></a>00387 <span class="keywordtype">void</span>
<a name="l00388"></a><a class="code" href="group__DBusConnectionInternals.html#ga4fe0c8f7b72dc89b9e1a3110db2f778e">00388</a> <a class="code" href="group__DBusConnectionInternals.html#ga4fe0c8f7b72dc89b9e1a3110db2f778e" title="Acquires the connection lock.">_dbus_connection_lock</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l00389"></a>00389 {
<a name="l00390"></a>00390   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l00391"></a>00391 }
<a name="l00392"></a>00392 
<a name="l00398"></a>00398 <span class="keywordtype">void</span>
<a name="l00399"></a><a class="code" href="group__DBusConnectionInternals.html#ga3db10d48ec16e485d5a638aacebd4ad2">00399</a> <a class="code" href="group__DBusConnectionInternals.html#ga3db10d48ec16e485d5a638aacebd4ad2" title="Releases the connection lock.">_dbus_connection_unlock</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l00400"></a>00400 {
<a name="l00401"></a>00401   <a class="code" href="structDBusList.html" title="A node in a linked list.">DBusList</a> *expired_messages;
<a name="l00402"></a>00402   <a class="code" href="structDBusList.html" title="A node in a linked list.">DBusList</a> *iter;
<a name="l00403"></a>00403 
<a name="l00404"></a>00404   <span class="keywordflow">if</span> (TRACE_LOCKS)
<a name="l00405"></a>00405     {
<a name="l00406"></a>00406       _dbus_verbose (<span class="stringliteral">&quot;UNLOCK\n&quot;</span>);
<a name="l00407"></a>00407     }
<a name="l00408"></a>00408 
<a name="l00409"></a>00409   <span class="comment">/* If we had messages that expired (fell off the incoming or outgoing</span>
<a name="l00410"></a>00410 <span class="comment">   * queues) while we were locked, actually release them now */</span>
<a name="l00411"></a>00411   expired_messages = connection-&gt;<a class="code" href="structDBusConnection.html#afc069c0dc7f29123d432650580aec036" title="Messages that will be released when we next unlock.">expired_messages</a>;
<a name="l00412"></a>00412   connection-&gt;<a class="code" href="structDBusConnection.html#afc069c0dc7f29123d432650580aec036" title="Messages that will be released when we next unlock.">expired_messages</a> = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00413"></a>00413 
<a name="l00414"></a>00414   RELEASING_LOCK_CHECK (connection);
<a name="l00415"></a>00415   <a class="code" href="group__DBusThreadsInternals.html#ga5946b9a5ea3e12a81a798b575b45c62f" title="Unlocks a mutex.">_dbus_rmutex_unlock</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a98e26cfd09ddbf0238f90bf4965641bf" title="Lock on the entire DBusConnection.">mutex</a>);
<a name="l00416"></a>00416 
<a name="l00417"></a>00417   <span class="keywordflow">for</span> (iter = <a class="code" href="group__DBusList.html#gaab9a957eca9bf5466bbf377a23b4b25c" title="Removes the first link in the list and returns it.">_dbus_list_pop_first_link</a> (&amp;expired_messages);
<a name="l00418"></a>00418       iter != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00419"></a>00419       iter = <a class="code" href="group__DBusList.html#gaab9a957eca9bf5466bbf377a23b4b25c" title="Removes the first link in the list and returns it.">_dbus_list_pop_first_link</a> (&amp;expired_messages))
<a name="l00420"></a>00420     {
<a name="l00421"></a>00421       <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message = iter-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a>;
<a name="l00422"></a>00422 
<a name="l00423"></a>00423       <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="l00424"></a>00424       <a class="code" href="group__DBusList.html#ga6e824f717125ce40c549d5402e32610f" title="Frees a linked list node allocated with _dbus_list_alloc_link.">_dbus_list_free_link</a> (iter);
<a name="l00425"></a>00425     }
<a name="l00426"></a>00426 }
<a name="l00427"></a>00427 
<a name="l00435"></a>00435 <span class="keyword">static</span> <span class="keywordtype">void</span>
<a name="l00436"></a>00436 _dbus_connection_wakeup_mainloop (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l00437"></a>00437 {
<a name="l00438"></a>00438   <span class="keywordflow">if</span> (connection-&gt;<a class="code" href="structDBusConnection.html#a211104e37f65d45ab8fcb149e4bcc84e" title="Function to wake up the mainloop.">wakeup_main_function</a>)
<a name="l00439"></a>00439     (*connection-&gt;<a class="code" href="structDBusConnection.html#a211104e37f65d45ab8fcb149e4bcc84e" title="Function to wake up the mainloop.">wakeup_main_function</a>) (connection-&gt;<a class="code" href="structDBusConnection.html#ac8aff7bafd9ed046d835c5ed80bc218c" title="Application data for wakeup_main_function.">wakeup_main_data</a>);
<a name="l00440"></a>00440 }
<a name="l00441"></a>00441 
<a name="l00442"></a>00442 <span class="preprocessor">#ifdef DBUS_ENABLE_EMBEDDED_TESTS</span>
<a name="l00443"></a>00443 <span class="preprocessor"></span>
<a name="l00455"></a>00455 <span class="keywordtype">void</span> 
<a name="l00456"></a>00456 _dbus_connection_test_get_locks (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l00457"></a>00457                                  <a class="code" href="group__DBusThreads.html#ga4eb021cd6cd0830423eac2738e0ddc40" title="An opaque mutex type provided by the DBusThreadFunctions implementation installed by dbus_threads_ini...">DBusMutex</a>     **mutex_loc,
<a name="l00458"></a>00458                                  <a class="code" href="group__DBusThreads.html#ga4eb021cd6cd0830423eac2738e0ddc40" title="An opaque mutex type provided by the DBusThreadFunctions implementation installed by dbus_threads_ini...">DBusMutex</a>     **dispatch_mutex_loc,
<a name="l00459"></a>00459                                  <a class="code" href="group__DBusThreads.html#ga4eb021cd6cd0830423eac2738e0ddc40" title="An opaque mutex type provided by the DBusThreadFunctions implementation installed by dbus_threads_ini...">DBusMutex</a>     **io_path_mutex_loc,
<a name="l00460"></a>00460                                  <a class="code" href="structDBusCondVar.html">DBusCondVar</a>   **dispatch_cond_loc,
<a name="l00461"></a>00461                                  <a class="code" href="structDBusCondVar.html">DBusCondVar</a>   **io_path_cond_loc)
<a name="l00462"></a>00462 {
<a name="l00463"></a>00463   *mutex_loc = (<a class="code" href="group__DBusThreads.html#ga4eb021cd6cd0830423eac2738e0ddc40" title="An opaque mutex type provided by the DBusThreadFunctions implementation installed by dbus_threads_ini...">DBusMutex</a> *) connection-&gt;<a class="code" href="structDBusConnection.html#a98e26cfd09ddbf0238f90bf4965641bf" title="Lock on the entire DBusConnection.">mutex</a>;
<a name="l00464"></a>00464   *dispatch_mutex_loc = (<a class="code" href="group__DBusThreads.html#ga4eb021cd6cd0830423eac2738e0ddc40" title="An opaque mutex type provided by the DBusThreadFunctions implementation installed by dbus_threads_ini...">DBusMutex</a> *) connection-&gt;<a class="code" href="structDBusConnection.html#ad9e7bf73a48f4951b24ce8eec7bb7ac5" title="Protects dispatch_acquired.">dispatch_mutex</a>;
<a name="l00465"></a>00465   *io_path_mutex_loc = (<a class="code" href="group__DBusThreads.html#ga4eb021cd6cd0830423eac2738e0ddc40" title="An opaque mutex type provided by the DBusThreadFunctions implementation installed by dbus_threads_ini...">DBusMutex</a> *) connection-&gt;<a class="code" href="structDBusConnection.html#aaad1c7d6e6ba3e049ef790f4f9aa35cd" title="Protects io_path_acquired.">io_path_mutex</a>;
<a name="l00466"></a>00466   *dispatch_cond_loc = connection-&gt;<a class="code" href="structDBusConnection.html#a201f92bbc0947b503a36eaff9ae0ede9" title="Notify when dispatch_acquired is available.">dispatch_cond</a>;
<a name="l00467"></a>00467   *io_path_cond_loc = connection-&gt;<a class="code" href="structDBusConnection.html#a6d87e03eea7aaff53f5574efcfb8c3e4" title="Notify when io_path_acquired is available.">io_path_cond</a>;
<a name="l00468"></a>00468 }
<a name="l00469"></a>00469 <span class="preprocessor">#endif</span>
<a name="l00470"></a>00470 <span class="preprocessor"></span>
<a name="l00479"></a>00479 <span class="keywordtype">void</span>
<a name="l00480"></a><a class="code" href="group__DBusConnectionInternals.html#gac1b92eba0aeee294dc28fcc260c9b749">00480</a> <a class="code" href="group__DBusConnectionInternals.html#gac1b92eba0aeee294dc28fcc260c9b749" title="Adds a message-containing list link to the incoming message queue, taking ownership of the link and t...">_dbus_connection_queue_received_message_link</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>  *connection,
<a name="l00481"></a>00481                                               <a class="code" href="structDBusList.html" title="A node in a linked list.">DBusList</a>        *link)
<a name="l00482"></a>00482 {
<a name="l00483"></a>00483   <a class="code" href="structDBusPendingCall.html" title="Implementation details of DBusPendingCall - all fields are private.">DBusPendingCall</a> *pending;
<a name="l00484"></a>00484   <a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a> reply_serial;
<a name="l00485"></a>00485   <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message;
<a name="l00486"></a>00486 
<a name="l00487"></a>00487   _dbus_assert (<a class="code" href="group__DBusTransport.html#ga59ed246ec0ef9c64bc4684fc17726c1d" title="Returns TRUE if we have been authenticated.">_dbus_transport_peek_is_authenticated</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>));
<a name="l00488"></a>00488 
<a name="l00489"></a>00489   <a class="code" href="group__DBusList.html#ga20e549175e2b8f450f907592dc39d953" title="Appends a link to the list.">_dbus_list_append_link</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#aacb3a29956aa7712db37916194fde869" title="Queue of messages we have received, end of the list received most recently.">incoming_messages</a>,
<a name="l00490"></a>00490                           link);
<a name="l00491"></a>00491   message = link-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a>;
<a name="l00492"></a>00492 
<a name="l00493"></a>00493   <span class="comment">/* If this is a reply we&#39;re waiting on, remove timeout for it */</span>
<a name="l00494"></a>00494   reply_serial = <a class="code" href="group__DBusMessage.html#ga94c43b2b237d842a6b91da6f94818d47" title="Returns the serial that the message is a reply to or 0 if none.">dbus_message_get_reply_serial</a> (message);
<a name="l00495"></a>00495   <span class="keywordflow">if</span> (reply_serial != 0)
<a name="l00496"></a>00496     {
<a name="l00497"></a>00497       pending = <a class="code" href="group__DBusHashTable.html#ga36ff49c4c35599e6fcdadc7f6805c49e" title="Looks up the value for a given integer in a hash table of type DBUS_HASH_INT.">_dbus_hash_table_lookup_int</a> (connection-&gt;<a class="code" href="structDBusConnection.html#ad8fa077f91fe62d0c10862e2ff9e86ca" title="Hash of message serials to DBusPendingCall.">pending_replies</a>,
<a name="l00498"></a>00498                                              reply_serial);
<a name="l00499"></a>00499       <span class="keywordflow">if</span> (pending != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00500"></a>00500         {
<a name="l00501"></a>00501           <span class="keywordflow">if</span> (<a class="code" href="group__DBusPendingCallInternals.html#gaf1e630b966722af540502329ed028254" title="Checks to see if a timeout has been added.">_dbus_pending_call_is_timeout_added_unlocked</a> (pending))
<a name="l00502"></a>00502             <a class="code" href="group__DBusConnectionInternals.html#gabaa6d26f6eca30782904af1ceb703bd1" title="Removes a timeout using the connection&#39;s DBusRemoveTimeoutFunction if available.">_dbus_connection_remove_timeout_unlocked</a> (connection,
<a name="l00503"></a>00503                                                       <a class="code" href="group__DBusPendingCallInternals.html#gaa9acac047b61c9a0eaff1977151e9e08" title="Retrives the timeout.">_dbus_pending_call_get_timeout_unlocked</a> (pending));
<a name="l00504"></a>00504 
<a name="l00505"></a>00505           <a class="code" href="group__DBusPendingCallInternals.html#gafea13f8b9977d341e41201c407adea2a" title="Sets wether the timeout has been added.">_dbus_pending_call_set_timeout_added_unlocked</a> (pending, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l00506"></a>00506         }
<a name="l00507"></a>00507     }
<a name="l00508"></a>00508   
<a name="l00509"></a>00509   
<a name="l00510"></a>00510 
<a name="l00511"></a>00511   connection-&gt;<a class="code" href="structDBusConnection.html#a9bda45f2d5c9af5c187fc31d7c98b424" title="Length of incoming queue.">n_incoming</a> += 1;
<a name="l00512"></a>00512 
<a name="l00513"></a>00513   _dbus_connection_wakeup_mainloop (connection);
<a name="l00514"></a>00514   
<a name="l00515"></a>00515   _dbus_verbose (<span class="stringliteral">&quot;Message %p (%s %s %s %s &#39;%s&#39; reply to %u) added to incoming queue %p, %d incoming\n&quot;</span>,
<a name="l00516"></a>00516                  message,
<a name="l00517"></a>00517                  <a class="code" href="group__DBusMessageInternals.html#ga75bcb613a291eb7e427f77f2f3635b8f" title="Utility function to convert a D-Bus message type into a machine-readable string (not translated)...">dbus_message_type_to_string</a> (<a class="code" href="group__DBusMessage.html#ga41cace31999105137772b6257ea540f9" title="Gets the type of a message.">dbus_message_get_type</a> (message)),
<a name="l00518"></a>00518                  <a class="code" href="group__DBusMessage.html#ga18adf731bb42d324fe2624407319e4af" title="Gets the object path this message is being sent to (for DBUS_MESSAGE_TYPE_METHOD_CALL) or being emitt...">dbus_message_get_path</a> (message) ?
<a name="l00519"></a>00519                  <a class="code" href="group__DBusMessage.html#ga18adf731bb42d324fe2624407319e4af" title="Gets the object path this message is being sent to (for DBUS_MESSAGE_TYPE_METHOD_CALL) or being emitt...">dbus_message_get_path</a> (message) :
<a name="l00520"></a>00520                  <span class="stringliteral">&quot;no path&quot;</span>,
<a name="l00521"></a>00521                  <a class="code" href="group__DBusMessage.html#ga1ad192bd4538cae556121a71b4e09d42" title="Gets the interface this message is being sent to (for DBUS_MESSAGE_TYPE_METHOD_CALL) or being emitted...">dbus_message_get_interface</a> (message) ?
<a name="l00522"></a>00522                  <a class="code" href="group__DBusMessage.html#ga1ad192bd4538cae556121a71b4e09d42" title="Gets the interface this message is being sent to (for DBUS_MESSAGE_TYPE_METHOD_CALL) or being emitted...">dbus_message_get_interface</a> (message) :
<a name="l00523"></a>00523                  <span class="stringliteral">&quot;no interface&quot;</span>,
<a name="l00524"></a>00524                  <a class="code" href="group__DBusMessage.html#gaf5c6b705c53db07a5ae2c6b76f230cf9" title="Gets the interface member being invoked (DBUS_MESSAGE_TYPE_METHOD_CALL) or emitted (DBUS_MESSAGE_TYPE...">dbus_message_get_member</a> (message) ?
<a name="l00525"></a>00525                  <a class="code" href="group__DBusMessage.html#gaf5c6b705c53db07a5ae2c6b76f230cf9" title="Gets the interface member being invoked (DBUS_MESSAGE_TYPE_METHOD_CALL) or emitted (DBUS_MESSAGE_TYPE...">dbus_message_get_member</a> (message) :
<a name="l00526"></a>00526                  <span class="stringliteral">&quot;no member&quot;</span>,
<a name="l00527"></a>00527                  <a class="code" href="group__DBusMessage.html#gaed63e4c2baaa50d782e8ebb7643def19" title="Gets the type signature of the message, i.e.">dbus_message_get_signature</a> (message),
<a name="l00528"></a>00528                  <a class="code" href="group__DBusMessage.html#ga94c43b2b237d842a6b91da6f94818d47" title="Returns the serial that the message is a reply to or 0 if none.">dbus_message_get_reply_serial</a> (message),
<a name="l00529"></a>00529                  connection,
<a name="l00530"></a>00530                  connection-&gt;<a class="code" href="structDBusConnection.html#a9bda45f2d5c9af5c187fc31d7c98b424" title="Length of incoming queue.">n_incoming</a>);
<a name="l00531"></a>00531 
<a name="l00532"></a>00532   _dbus_message_trace_ref (message, -1, -1,
<a name="l00533"></a>00533       <span class="stringliteral">&quot;_dbus_conection_queue_received_message_link&quot;</span>);
<a name="l00534"></a>00534 }
<a name="l00535"></a>00535 
<a name="l00544"></a>00544 <span class="keywordtype">void</span>
<a name="l00545"></a><a class="code" href="group__DBusConnectionInternals.html#gadb7a525dc6b566b575ee4f9b20028b04">00545</a> <a class="code" href="group__DBusConnectionInternals.html#gadb7a525dc6b566b575ee4f9b20028b04" title="Adds a link + message to the incoming message queue.">_dbus_connection_queue_synthesized_message_link</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l00546"></a>00546                                                  <a class="code" href="structDBusList.html" title="A node in a linked list.">DBusList</a> *link)
<a name="l00547"></a>00547 {
<a name="l00548"></a>00548   HAVE_LOCK_CHECK (connection);
<a name="l00549"></a>00549   
<a name="l00550"></a>00550   <a class="code" href="group__DBusList.html#ga20e549175e2b8f450f907592dc39d953" title="Appends a link to the list.">_dbus_list_append_link</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#aacb3a29956aa7712db37916194fde869" title="Queue of messages we have received, end of the list received most recently.">incoming_messages</a>, link);
<a name="l00551"></a>00551 
<a name="l00552"></a>00552   connection-&gt;<a class="code" href="structDBusConnection.html#a9bda45f2d5c9af5c187fc31d7c98b424" title="Length of incoming queue.">n_incoming</a> += 1;
<a name="l00553"></a>00553 
<a name="l00554"></a>00554   _dbus_connection_wakeup_mainloop (connection);
<a name="l00555"></a>00555 
<a name="l00556"></a>00556   _dbus_message_trace_ref (link-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a>, -1, -1,
<a name="l00557"></a>00557       <span class="stringliteral">&quot;_dbus_connection_queue_synthesized_message_link&quot;</span>);
<a name="l00558"></a>00558 
<a name="l00559"></a>00559   _dbus_verbose (<span class="stringliteral">&quot;Synthesized message %p added to incoming queue %p, %d incoming\n&quot;</span>,
<a name="l00560"></a>00560                  link-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a>, connection, connection-&gt;<a class="code" href="structDBusConnection.html#a9bda45f2d5c9af5c187fc31d7c98b424" title="Length of incoming queue.">n_incoming</a>);
<a name="l00561"></a>00561 }
<a name="l00562"></a>00562 
<a name="l00563"></a>00563 
<a name="l00571"></a>00571 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l00572"></a><a class="code" href="group__DBusConnectionInternals.html#ga3d31a01751860b67f960dcaffb7bb4ef">00572</a> <a class="code" href="group__DBusConnectionInternals.html#ga3d31a01751860b67f960dcaffb7bb4ef" title="Checks whether there are messages in the outgoing message queue.">_dbus_connection_has_messages_to_send_unlocked</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l00573"></a>00573 {
<a name="l00574"></a>00574   HAVE_LOCK_CHECK (connection);
<a name="l00575"></a>00575   <span class="keywordflow">return</span> connection-&gt;<a class="code" href="structDBusConnection.html#a714fd51af8730c367b079594c7f756ae" title="Queue of messages we need to send, send the end of the list first.">outgoing_messages</a> != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00576"></a>00576 }
<a name="l00577"></a>00577 
<a name="l00587"></a>00587 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l00588"></a><a class="code" href="group__DBusConnection.html#gac40563ec4c0e309d936daf3163ba9bb7">00588</a> <a class="code" href="group__DBusConnectionInternals.html#ga2210bb5734c1a04d0d654b026f27d94e" title="Checks whether there are messages in the outgoing message queue.">dbus_connection_has_messages_to_send</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l00589"></a>00589 {
<a name="l00590"></a>00590   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> v;
<a name="l00591"></a>00591   
<a name="l00592"></a>00592   _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="l00593"></a>00593 
<a name="l00594"></a>00594   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l00595"></a>00595   v = <a class="code" href="group__DBusConnectionInternals.html#ga3d31a01751860b67f960dcaffb7bb4ef" title="Checks whether there are messages in the outgoing message queue.">_dbus_connection_has_messages_to_send_unlocked</a> (connection);
<a name="l00596"></a>00596   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l00597"></a>00597 
<a name="l00598"></a>00598   <span class="keywordflow">return</span> v;
<a name="l00599"></a>00599 }
<a name="l00600"></a>00600 
<a name="l00608"></a>00608 <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>*
<a name="l00609"></a><a class="code" href="group__DBusConnectionInternals.html#ga3955cd53ac4f671a5bb54019887389a7">00609</a> <a class="code" href="group__DBusConnectionInternals.html#ga3955cd53ac4f671a5bb54019887389a7" title="Gets the next outgoing message.">_dbus_connection_get_message_to_send</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l00610"></a>00610 {
<a name="l00611"></a>00611   HAVE_LOCK_CHECK (connection);
<a name="l00612"></a>00612   
<a name="l00613"></a>00613   <span class="keywordflow">return</span> <a class="code" href="group__DBusList.html#ga18afc36fff1636a71295bcc7a75dc4f6" title="Gets the last data in the list.">_dbus_list_get_last</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#a714fd51af8730c367b079594c7f756ae" title="Queue of messages we need to send, send the end of the list first.">outgoing_messages</a>);
<a name="l00614"></a>00614 }
<a name="l00615"></a>00615 
<a name="l00624"></a>00624 <span class="keywordtype">void</span>
<a name="l00625"></a><a class="code" href="group__DBusConnectionInternals.html#gab93fd3666217ee339c4d2e8d4d33e63c">00625</a> <a class="code" href="group__DBusConnectionInternals.html#gab93fd3666217ee339c4d2e8d4d33e63c" title="Notifies the connection that a message has been sent, so the message can be removed from the outgoing...">_dbus_connection_message_sent_unlocked</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l00626"></a>00626                                         <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>    *message)
<a name="l00627"></a>00627 {
<a name="l00628"></a>00628   <a class="code" href="structDBusList.html" title="A node in a linked list.">DBusList</a> *link;
<a name="l00629"></a>00629 
<a name="l00630"></a>00630   HAVE_LOCK_CHECK (connection);
<a name="l00631"></a>00631   
<a name="l00632"></a>00632   <span class="comment">/* This can be called before we even complete authentication, since</span>
<a name="l00633"></a>00633 <span class="comment">   * it&#39;s called on disconnect to clean up the outgoing queue.</span>
<a name="l00634"></a>00634 <span class="comment">   * It&#39;s also called as we successfully send each message.</span>
<a name="l00635"></a>00635 <span class="comment">   */</span>
<a name="l00636"></a>00636   
<a name="l00637"></a>00637   link = <a class="code" href="group__DBusList.html#ga42736fb02458bfffed948a509962c059" title="Gets the last link in the list.">_dbus_list_get_last_link</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#a714fd51af8730c367b079594c7f756ae" title="Queue of messages we need to send, send the end of the list first.">outgoing_messages</a>);
<a name="l00638"></a>00638   _dbus_assert (link != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l00639"></a>00639   _dbus_assert (link-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a> == message);
<a name="l00640"></a>00640 
<a name="l00641"></a>00641   <a class="code" href="group__DBusList.html#ga57f1fc73dc1a4f8a7bf9860e000b1703" title="Removes the given link from the list, but doesn&#39;t free it.">_dbus_list_unlink</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#a714fd51af8730c367b079594c7f756ae" title="Queue of messages we need to send, send the end of the list first.">outgoing_messages</a>,
<a name="l00642"></a>00642                      link);
<a name="l00643"></a>00643   <a class="code" href="group__DBusList.html#gab3dd068e3bd8a319c0d12150785050a7" title="Prepends a link to the list.">_dbus_list_prepend_link</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#afc069c0dc7f29123d432650580aec036" title="Messages that will be released when we next unlock.">expired_messages</a>, link);
<a name="l00644"></a>00644 
<a name="l00645"></a>00645   connection-&gt;<a class="code" href="structDBusConnection.html#a07025e177949c5e65d5f983ac5f5e878" title="Length of outgoing queue.">n_outgoing</a> -= 1;
<a name="l00646"></a>00646 
<a name="l00647"></a>00647   _dbus_verbose (<span class="stringliteral">&quot;Message %p (%s %s %s %s &#39;%s&#39;) removed from outgoing queue %p, %d left to send\n&quot;</span>,
<a name="l00648"></a>00648                  message,
<a name="l00649"></a>00649                  <a class="code" href="group__DBusMessageInternals.html#ga75bcb613a291eb7e427f77f2f3635b8f" title="Utility function to convert a D-Bus message type into a machine-readable string (not translated)...">dbus_message_type_to_string</a> (<a class="code" href="group__DBusMessage.html#ga41cace31999105137772b6257ea540f9" title="Gets the type of a message.">dbus_message_get_type</a> (message)),
<a name="l00650"></a>00650                  <a class="code" href="group__DBusMessage.html#ga18adf731bb42d324fe2624407319e4af" title="Gets the object path this message is being sent to (for DBUS_MESSAGE_TYPE_METHOD_CALL) or being emitt...">dbus_message_get_path</a> (message) ?
<a name="l00651"></a>00651                  <a class="code" href="group__DBusMessage.html#ga18adf731bb42d324fe2624407319e4af" title="Gets the object path this message is being sent to (for DBUS_MESSAGE_TYPE_METHOD_CALL) or being emitt...">dbus_message_get_path</a> (message) :
<a name="l00652"></a>00652                  <span class="stringliteral">&quot;no path&quot;</span>,
<a name="l00653"></a>00653                  <a class="code" href="group__DBusMessage.html#ga1ad192bd4538cae556121a71b4e09d42" title="Gets the interface this message is being sent to (for DBUS_MESSAGE_TYPE_METHOD_CALL) or being emitted...">dbus_message_get_interface</a> (message) ?
<a name="l00654"></a>00654                  <a class="code" href="group__DBusMessage.html#ga1ad192bd4538cae556121a71b4e09d42" title="Gets the interface this message is being sent to (for DBUS_MESSAGE_TYPE_METHOD_CALL) or being emitted...">dbus_message_get_interface</a> (message) :
<a name="l00655"></a>00655                  <span class="stringliteral">&quot;no interface&quot;</span>,
<a name="l00656"></a>00656                  <a class="code" href="group__DBusMessage.html#gaf5c6b705c53db07a5ae2c6b76f230cf9" title="Gets the interface member being invoked (DBUS_MESSAGE_TYPE_METHOD_CALL) or emitted (DBUS_MESSAGE_TYPE...">dbus_message_get_member</a> (message) ?
<a name="l00657"></a>00657                  <a class="code" href="group__DBusMessage.html#gaf5c6b705c53db07a5ae2c6b76f230cf9" title="Gets the interface member being invoked (DBUS_MESSAGE_TYPE_METHOD_CALL) or emitted (DBUS_MESSAGE_TYPE...">dbus_message_get_member</a> (message) :
<a name="l00658"></a>00658                  <span class="stringliteral">&quot;no member&quot;</span>,
<a name="l00659"></a>00659                  <a class="code" href="group__DBusMessage.html#gaed63e4c2baaa50d782e8ebb7643def19" title="Gets the type signature of the message, i.e.">dbus_message_get_signature</a> (message),
<a name="l00660"></a>00660                  connection, connection-&gt;<a class="code" href="structDBusConnection.html#a07025e177949c5e65d5f983ac5f5e878" title="Length of outgoing queue.">n_outgoing</a>);
<a name="l00661"></a>00661 
<a name="l00662"></a>00662   <span class="comment">/* It&#39;s OK that in principle we call the notify function, because for the</span>
<a name="l00663"></a>00663 <span class="comment">   * outgoing limit, there isn&#39;t one */</span>
<a name="l00664"></a>00664   <a class="code" href="group__DBusMessageInternals.html#gac84be3fd98e49409c1245a87c7de6f7d" title="Removes a counter tracking the size/unix fds of this message, and decrements the counter by the size/...">_dbus_message_remove_counter</a> (message, connection-&gt;<a class="code" href="structDBusConnection.html#a5dcb660883904035076579c6d2f46501" title="Counts size of outgoing messages.">outgoing_counter</a>);
<a name="l00665"></a>00665 
<a name="l00666"></a>00666   <span class="comment">/* The message will actually be unreffed when we unlock */</span>
<a name="l00667"></a>00667 }
<a name="l00668"></a>00668 
<a name="l00670"></a><a class="code" href="group__DBusConnectionInternals.html#gab3c673c1e36e293c5f2baa92418603a3">00670</a> <span class="keyword">typedef</span> <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> (* <a class="code" href="group__DBusConnectionInternals.html#gab3c673c1e36e293c5f2baa92418603a3" title="Function to be called in protected_change_watch() with refcount held.">DBusWatchAddFunction</a>)     (<a class="code" href="structDBusWatchList.html" title="DBusWatchList implementation details.">DBusWatchList</a> *list,
<a name="l00671"></a>00671                                                   <a class="code" href="structDBusWatch.html" title="Implementation of DBusWatch.">DBusWatch</a>     *watch);
<a name="l00673"></a><a class="code" href="group__DBusConnectionInternals.html#ga475a0e9a2f2b7a279ba07fa3352114d4">00673</a> <span class="keyword">typedef</span> void        (* <a class="code" href="group__DBusConnectionInternals.html#ga475a0e9a2f2b7a279ba07fa3352114d4" title="Function to be called in protected_change_watch() with refcount held.">DBusWatchRemoveFunction</a>)  (<a class="code" href="structDBusWatchList.html" title="DBusWatchList implementation details.">DBusWatchList</a> *list,
<a name="l00674"></a>00674                                                   <a class="code" href="structDBusWatch.html" title="Implementation of DBusWatch.">DBusWatch</a>     *watch);
<a name="l00676"></a><a class="code" href="group__DBusConnectionInternals.html#ga851f0958d46980f5a39bcfb874a4cb78">00676</a> <span class="keyword">typedef</span> void        (* <a class="code" href="group__DBusConnectionInternals.html#ga851f0958d46980f5a39bcfb874a4cb78" title="Function to be called in protected_change_watch() with refcount held.">DBusWatchToggleFunction</a>)  (<a class="code" href="structDBusWatchList.html" title="DBusWatchList implementation details.">DBusWatchList</a> *list,
<a name="l00677"></a>00677                                                   <a class="code" href="structDBusWatch.html" title="Implementation of DBusWatch.">DBusWatch</a>     *watch,
<a name="l00678"></a>00678                                                   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>    enabled);
<a name="l00679"></a>00679 
<a name="l00680"></a>00680 <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="l00681"></a>00681 protected_change_watch (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>         *connection,
<a name="l00682"></a>00682                         <a class="code" href="structDBusWatch.html" title="Implementation of DBusWatch.">DBusWatch</a>              *watch,
<a name="l00683"></a>00683                         <a class="code" href="group__DBusConnectionInternals.html#gab3c673c1e36e293c5f2baa92418603a3" title="Function to be called in protected_change_watch() with refcount held.">DBusWatchAddFunction</a>    add_function,
<a name="l00684"></a>00684                         <a class="code" href="group__DBusConnectionInternals.html#ga475a0e9a2f2b7a279ba07fa3352114d4" title="Function to be called in protected_change_watch() with refcount held.">DBusWatchRemoveFunction</a> remove_function,
<a name="l00685"></a>00685                         <a class="code" href="group__DBusConnectionInternals.html#ga851f0958d46980f5a39bcfb874a4cb78" title="Function to be called in protected_change_watch() with refcount held.">DBusWatchToggleFunction</a> toggle_function,
<a name="l00686"></a>00686                         <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>             enabled)
<a name="l00687"></a>00687 {
<a name="l00688"></a>00688   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> retval;
<a name="l00689"></a>00689 
<a name="l00690"></a>00690   HAVE_LOCK_CHECK (connection);
<a name="l00691"></a>00691 
<a name="l00692"></a>00692   <span class="comment">/* The original purpose of protected_change_watch() was to hold a</span>
<a name="l00693"></a>00693 <span class="comment">   * ref on the connection while dropping the connection lock, then</span>
<a name="l00694"></a>00694 <span class="comment">   * calling out to the app.  This was a broken hack that did not</span>
<a name="l00695"></a>00695 <span class="comment">   * work, since the connection was in a hosed state (no WatchList</span>
<a name="l00696"></a>00696 <span class="comment">   * field) while calling out.</span>
<a name="l00697"></a>00697 <span class="comment">   *</span>
<a name="l00698"></a>00698 <span class="comment">   * So for now we&#39;ll just keep the lock while calling out. This means</span>
<a name="l00699"></a>00699 <span class="comment">   * apps are not allowed to call DBusConnection methods inside a</span>
<a name="l00700"></a>00700 <span class="comment">   * watch function or they will deadlock.</span>
<a name="l00701"></a>00701 <span class="comment">   *</span>
<a name="l00702"></a>00702 <span class="comment">   * The &quot;real fix&quot; is to use the _and_unlock() pattern found</span>
<a name="l00703"></a>00703 <span class="comment">   * elsewhere in the code, to defer calling out to the app until</span>
<a name="l00704"></a>00704 <span class="comment">   * we&#39;re about to drop locks and return flow of control to the app</span>
<a name="l00705"></a>00705 <span class="comment">   * anyway.</span>
<a name="l00706"></a>00706 <span class="comment">   *</span>
<a name="l00707"></a>00707 <span class="comment">   * See http://lists.freedesktop.org/archives/dbus/2007-July/thread.html#8144</span>
<a name="l00708"></a>00708 <span class="comment">   */</span>
<a name="l00709"></a>00709 
<a name="l00710"></a>00710   <span class="keywordflow">if</span> (connection-&gt;<a class="code" href="structDBusConnection.html#abdb6a32972d924531fb2cd80c7fd6d37" title="Stores active watches.">watches</a>)
<a name="l00711"></a>00711     {
<a name="l00712"></a>00712       <span class="keywordflow">if</span> (add_function)
<a name="l00713"></a>00713         retval = (* add_function) (connection-&gt;<a class="code" href="structDBusConnection.html#abdb6a32972d924531fb2cd80c7fd6d37" title="Stores active watches.">watches</a>, watch);
<a name="l00714"></a>00714       <span class="keywordflow">else</span> <span class="keywordflow">if</span> (remove_function)
<a name="l00715"></a>00715         {
<a name="l00716"></a>00716           retval = <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l00717"></a>00717           (* remove_function) (connection-&gt;<a class="code" href="structDBusConnection.html#abdb6a32972d924531fb2cd80c7fd6d37" title="Stores active watches.">watches</a>, watch);
<a name="l00718"></a>00718         }
<a name="l00719"></a>00719       <span class="keywordflow">else</span>
<a name="l00720"></a>00720         {
<a name="l00721"></a>00721           retval = <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l00722"></a>00722           (* toggle_function) (connection-&gt;<a class="code" href="structDBusConnection.html#abdb6a32972d924531fb2cd80c7fd6d37" title="Stores active watches.">watches</a>, watch, enabled);
<a name="l00723"></a>00723         }
<a name="l00724"></a>00724       <span class="keywordflow">return</span> retval;
<a name="l00725"></a>00725     }
<a name="l00726"></a>00726   <span class="keywordflow">else</span>
<a name="l00727"></a>00727     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00728"></a>00728 }
<a name="l00729"></a>00729      
<a name="l00730"></a>00730 
<a name="l00742"></a>00742 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l00743"></a><a class="code" href="group__DBusConnectionInternals.html#ga82adef36b4cd583bc1146eae5756c063">00743</a> <a class="code" href="group__DBusConnectionInternals.html#ga82adef36b4cd583bc1146eae5756c063" title="Adds a watch using the connection&#39;s DBusAddWatchFunction if available.">_dbus_connection_add_watch_unlocked</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l00744"></a>00744                                      <a class="code" href="structDBusWatch.html" title="Implementation of DBusWatch.">DBusWatch</a>      *watch)
<a name="l00745"></a>00745 {
<a name="l00746"></a>00746   <span class="keywordflow">return</span> protected_change_watch (connection, watch,
<a name="l00747"></a>00747                                  <a class="code" href="group__DBusWatchInternals.html#gaec61655a4bd6186a6a1ec104771d8af5" title="Adds a new watch to the watch list, invoking the application DBusAddWatchFunction if appropriate...">_dbus_watch_list_add_watch</a>,
<a name="l00748"></a>00748                                  <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 class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l00749"></a>00749 }
<a name="l00750"></a>00750 
<a name="l00760"></a>00760 <span class="keywordtype">void</span>
<a name="l00761"></a><a class="code" href="group__DBusConnectionInternals.html#ga65fc02c0756d0c7caaa39cd60922c99b">00761</a> <a class="code" href="group__DBusConnectionInternals.html#ga65fc02c0756d0c7caaa39cd60922c99b" title="Removes a watch using the connection&#39;s DBusRemoveWatchFunction if available.">_dbus_connection_remove_watch_unlocked</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l00762"></a>00762                                         <a class="code" href="structDBusWatch.html" title="Implementation of DBusWatch.">DBusWatch</a>      *watch)
<a name="l00763"></a>00763 {
<a name="l00764"></a>00764   protected_change_watch (connection, watch,
<a name="l00765"></a>00765                           <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>,
<a name="l00766"></a>00766                           <a class="code" href="group__DBusWatchInternals.html#ga76894d297bc7d7d23cbacdc2b1778884" title="Removes a watch from the watch list, invoking the application&#39;s DBusRemoveWatchFunction if appropriat...">_dbus_watch_list_remove_watch</a>,
<a name="l00767"></a>00767                           <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="l00768"></a>00768 }
<a name="l00769"></a>00769 
<a name="l00780"></a>00780 <span class="keywordtype">void</span>
<a name="l00781"></a><a class="code" href="group__DBusConnectionInternals.html#ga6c00e2eaf225b154760976af5688d250">00781</a> <a class="code" href="group__DBusConnectionInternals.html#ga6c00e2eaf225b154760976af5688d250" title="Toggles a watch and notifies app via connection&#39;s DBusWatchToggledFunction if available.">_dbus_connection_toggle_watch_unlocked</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l00782"></a>00782                                         <a class="code" href="structDBusWatch.html" title="Implementation of DBusWatch.">DBusWatch</a>      *watch,
<a name="l00783"></a>00783                                         <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>     enabled)
<a name="l00784"></a>00784 {
<a name="l00785"></a>00785   _dbus_assert (watch != <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   protected_change_watch (connection, watch,
<a name="l00788"></a>00788                           <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="l00789"></a>00789                           <a class="code" href="group__DBusWatchInternals.html#ga14bb50e8663a1d9d3960b4f73c09c097" title="Sets a watch to the given enabled state, invoking the application&#39;s DBusWatchToggledFunction if appro...">_dbus_watch_list_toggle_watch</a>,
<a name="l00790"></a>00790                           enabled);
<a name="l00791"></a>00791 }
<a name="l00792"></a>00792 
<a name="l00794"></a><a class="code" href="group__DBusConnectionInternals.html#ga6ca28a0af7de84c51fdbafe8786d3446">00794</a> <span class="keyword">typedef</span> <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> (* <a class="code" href="group__DBusConnectionInternals.html#ga6ca28a0af7de84c51fdbafe8786d3446" title="Function to be called in protected_change_timeout() with refcount held.">DBusTimeoutAddFunction</a>)    (<a class="code" href="structDBusTimeoutList.html" title="DBusTimeoutList implementation details.">DBusTimeoutList</a> *list,
<a name="l00795"></a>00795                                                    <a class="code" href="structDBusTimeout.html" title="Internals of DBusTimeout.">DBusTimeout</a>     *timeout);
<a name="l00797"></a><a class="code" href="group__DBusConnectionInternals.html#gafe75d05f2abf712c7fe13691ef27754c">00797</a> <span class="keyword">typedef</span> void        (* <a class="code" href="group__DBusConnectionInternals.html#gafe75d05f2abf712c7fe13691ef27754c" title="Function to be called in protected_change_timeout() with refcount held.">DBusTimeoutRemoveFunction</a>) (<a class="code" href="structDBusTimeoutList.html" title="DBusTimeoutList implementation details.">DBusTimeoutList</a> *list,
<a name="l00798"></a>00798                                                    <a class="code" href="structDBusTimeout.html" title="Internals of DBusTimeout.">DBusTimeout</a>     *timeout);
<a name="l00800"></a><a class="code" href="group__DBusConnectionInternals.html#ga1b4c97e7ef6f2cb8704cf74acc03c727">00800</a> <span class="keyword">typedef</span> void        (* <a class="code" href="group__DBusConnectionInternals.html#ga1b4c97e7ef6f2cb8704cf74acc03c727" title="Function to be called in protected_change_timeout() with refcount held.">DBusTimeoutToggleFunction</a>) (<a class="code" href="structDBusTimeoutList.html" title="DBusTimeoutList implementation details.">DBusTimeoutList</a> *list,
<a name="l00801"></a>00801                                                    <a class="code" href="structDBusTimeout.html" title="Internals of DBusTimeout.">DBusTimeout</a>     *timeout,
<a name="l00802"></a>00802                                                    <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>      enabled);
<a name="l00803"></a>00803 
<a name="l00804"></a>00804 <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="l00805"></a>00805 protected_change_timeout (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>           *connection,
<a name="l00806"></a>00806                           <a class="code" href="structDBusTimeout.html" title="Internals of DBusTimeout.">DBusTimeout</a>              *timeout,
<a name="l00807"></a>00807                           <a class="code" href="group__DBusConnectionInternals.html#ga6ca28a0af7de84c51fdbafe8786d3446" title="Function to be called in protected_change_timeout() with refcount held.">DBusTimeoutAddFunction</a>    add_function,
<a name="l00808"></a>00808                           <a class="code" href="group__DBusConnectionInternals.html#gafe75d05f2abf712c7fe13691ef27754c" title="Function to be called in protected_change_timeout() with refcount held.">DBusTimeoutRemoveFunction</a> remove_function,
<a name="l00809"></a>00809                           <a class="code" href="group__DBusConnectionInternals.html#ga1b4c97e7ef6f2cb8704cf74acc03c727" title="Function to be called in protected_change_timeout() with refcount held.">DBusTimeoutToggleFunction</a> toggle_function,
<a name="l00810"></a>00810                           <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>               enabled)
<a name="l00811"></a>00811 {
<a name="l00812"></a>00812   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> retval;
<a name="l00813"></a>00813 
<a name="l00814"></a>00814   HAVE_LOCK_CHECK (connection);
<a name="l00815"></a>00815 
<a name="l00816"></a>00816   <span class="comment">/* The original purpose of protected_change_timeout() was to hold a</span>
<a name="l00817"></a>00817 <span class="comment">   * ref on the connection while dropping the connection lock, then</span>
<a name="l00818"></a>00818 <span class="comment">   * calling out to the app.  This was a broken hack that did not</span>
<a name="l00819"></a>00819 <span class="comment">   * work, since the connection was in a hosed state (no TimeoutList</span>
<a name="l00820"></a>00820 <span class="comment">   * field) while calling out.</span>
<a name="l00821"></a>00821 <span class="comment">   *</span>
<a name="l00822"></a>00822 <span class="comment">   * So for now we&#39;ll just keep the lock while calling out. This means</span>
<a name="l00823"></a>00823 <span class="comment">   * apps are not allowed to call DBusConnection methods inside a</span>
<a name="l00824"></a>00824 <span class="comment">   * timeout function or they will deadlock.</span>
<a name="l00825"></a>00825 <span class="comment">   *</span>
<a name="l00826"></a>00826 <span class="comment">   * The &quot;real fix&quot; is to use the _and_unlock() pattern found</span>
<a name="l00827"></a>00827 <span class="comment">   * elsewhere in the code, to defer calling out to the app until</span>
<a name="l00828"></a>00828 <span class="comment">   * we&#39;re about to drop locks and return flow of control to the app</span>
<a name="l00829"></a>00829 <span class="comment">   * anyway.</span>
<a name="l00830"></a>00830 <span class="comment">   *</span>
<a name="l00831"></a>00831 <span class="comment">   * See http://lists.freedesktop.org/archives/dbus/2007-July/thread.html#8144</span>
<a name="l00832"></a>00832 <span class="comment">   */</span>
<a name="l00833"></a>00833 
<a name="l00834"></a>00834   <span class="keywordflow">if</span> (connection-&gt;<a class="code" href="structDBusConnection.html#af3936ac5c968f2ac09bf05cf36025994" title="Stores active timeouts.">timeouts</a>)
<a name="l00835"></a>00835     {
<a name="l00836"></a>00836       <span class="keywordflow">if</span> (add_function)
<a name="l00837"></a>00837         retval = (* add_function) (connection-&gt;<a class="code" href="structDBusConnection.html#af3936ac5c968f2ac09bf05cf36025994" title="Stores active timeouts.">timeouts</a>, timeout);
<a name="l00838"></a>00838       <span class="keywordflow">else</span> <span class="keywordflow">if</span> (remove_function)
<a name="l00839"></a>00839         {
<a name="l00840"></a>00840           retval = <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l00841"></a>00841           (* remove_function) (connection-&gt;<a class="code" href="structDBusConnection.html#af3936ac5c968f2ac09bf05cf36025994" title="Stores active timeouts.">timeouts</a>, timeout);
<a name="l00842"></a>00842         }
<a name="l00843"></a>00843       <span class="keywordflow">else</span>
<a name="l00844"></a>00844         {
<a name="l00845"></a>00845           retval = <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l00846"></a>00846           (* toggle_function) (connection-&gt;<a class="code" href="structDBusConnection.html#af3936ac5c968f2ac09bf05cf36025994" title="Stores active timeouts.">timeouts</a>, timeout, enabled);
<a name="l00847"></a>00847         }
<a name="l00848"></a>00848       <span class="keywordflow">return</span> retval;
<a name="l00849"></a>00849     }
<a name="l00850"></a>00850   <span class="keywordflow">else</span>
<a name="l00851"></a>00851     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00852"></a>00852 }
<a name="l00853"></a>00853 
<a name="l00866"></a>00866 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l00867"></a><a class="code" href="group__DBusConnectionInternals.html#ga69e87e3be94b8c681585ec870e39a64a">00867</a> <a class="code" href="group__DBusConnectionInternals.html#ga69e87e3be94b8c681585ec870e39a64a" title="Adds a timeout using the connection&#39;s DBusAddTimeoutFunction if available.">_dbus_connection_add_timeout_unlocked</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l00868"></a>00868                                        <a class="code" href="structDBusTimeout.html" title="Internals of DBusTimeout.">DBusTimeout</a>    *timeout)
<a name="l00869"></a>00869 {
<a name="l00870"></a>00870   <span class="keywordflow">return</span> protected_change_timeout (connection, timeout,
<a name="l00871"></a>00871                                    <a class="code" href="group__DBusTimeoutInternals.html#ga14955f061551ece122808b9e6ddc0757" title="Adds a new timeout to the timeout list, invoking the application DBusAddTimeoutFunction if appropriat...">_dbus_timeout_list_add_timeout</a>,
<a name="l00872"></a>00872                                    <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 class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l00873"></a>00873 }
<a name="l00874"></a>00874 
<a name="l00884"></a>00884 <span class="keywordtype">void</span>
<a name="l00885"></a><a class="code" href="group__DBusConnectionInternals.html#gabaa6d26f6eca30782904af1ceb703bd1">00885</a> <a class="code" href="group__DBusConnectionInternals.html#gabaa6d26f6eca30782904af1ceb703bd1" title="Removes a timeout using the connection&#39;s DBusRemoveTimeoutFunction if available.">_dbus_connection_remove_timeout_unlocked</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l00886"></a>00886                                           <a class="code" href="structDBusTimeout.html" title="Internals of DBusTimeout.">DBusTimeout</a>    *timeout)
<a name="l00887"></a>00887 {
<a name="l00888"></a>00888   protected_change_timeout (connection, timeout,
<a name="l00889"></a>00889                             <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>,
<a name="l00890"></a>00890                             <a class="code" href="group__DBusTimeoutInternals.html#gaec0ffafdcac87f23878a2ddded044822" title="Removes a timeout from the timeout list, invoking the application&#39;s DBusRemoveTimeoutFunction if appr...">_dbus_timeout_list_remove_timeout</a>,
<a name="l00891"></a>00891                             <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="l00892"></a>00892 }
<a name="l00893"></a>00893 
<a name="l00904"></a>00904 <span class="keywordtype">void</span>
<a name="l00905"></a><a class="code" href="group__DBusConnectionInternals.html#ga165dcfd8b995ff0edd19aebcf3e1a61a">00905</a> <a class="code" href="group__DBusConnectionInternals.html#ga165dcfd8b995ff0edd19aebcf3e1a61a" title="Toggles a timeout and notifies app via connection&#39;s DBusTimeoutToggledFunction if available...">_dbus_connection_toggle_timeout_unlocked</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>   *connection,
<a name="l00906"></a>00906                                           <a class="code" href="structDBusTimeout.html" title="Internals of DBusTimeout.">DBusTimeout</a>      *timeout,
<a name="l00907"></a>00907                                           <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>       enabled)
<a name="l00908"></a>00908 {
<a name="l00909"></a>00909   protected_change_timeout (connection, timeout,
<a name="l00910"></a>00910                             <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="l00911"></a>00911                             <a class="code" href="group__DBusTimeoutInternals.html#ga3d1ee0968a47651c5428ebf48711b217" title="Sets a timeout to the given enabled state, invoking the application&#39;s DBusTimeoutToggledFunction if a...">_dbus_timeout_list_toggle_timeout</a>,
<a name="l00912"></a>00912                             enabled);
<a name="l00913"></a>00913 }
<a name="l00914"></a>00914 
<a name="l00915"></a>00915 <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="l00916"></a>00916 _dbus_connection_attach_pending_call_unlocked (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>  *connection,
<a name="l00917"></a>00917                                                <a class="code" href="structDBusPendingCall.html" title="Implementation details of DBusPendingCall - all fields are private.">DBusPendingCall</a> *pending)
<a name="l00918"></a>00918 {
<a name="l00919"></a>00919   <a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a> reply_serial;
<a name="l00920"></a>00920   <a class="code" href="structDBusTimeout.html" title="Internals of DBusTimeout.">DBusTimeout</a> *timeout;
<a name="l00921"></a>00921 
<a name="l00922"></a>00922   HAVE_LOCK_CHECK (connection);
<a name="l00923"></a>00923 
<a name="l00924"></a>00924   reply_serial = <a class="code" href="group__DBusPendingCallInternals.html#gaf5f3df36149bfe55d824eb08d00768fc" title="Gets the reply&#39;s serial number.">_dbus_pending_call_get_reply_serial_unlocked</a> (pending);
<a name="l00925"></a>00925 
<a name="l00926"></a>00926   _dbus_assert (reply_serial != 0);
<a name="l00927"></a>00927 
<a name="l00928"></a>00928   timeout = <a class="code" href="group__DBusPendingCallInternals.html#gaa9acac047b61c9a0eaff1977151e9e08" title="Retrives the timeout.">_dbus_pending_call_get_timeout_unlocked</a> (pending);
<a name="l00929"></a>00929 
<a name="l00930"></a>00930   <span class="keywordflow">if</span> (timeout)
<a name="l00931"></a>00931     {
<a name="l00932"></a>00932       <span class="keywordflow">if</span> (!<a class="code" href="group__DBusConnectionInternals.html#ga69e87e3be94b8c681585ec870e39a64a" title="Adds a timeout using the connection&#39;s DBusAddTimeoutFunction if available.">_dbus_connection_add_timeout_unlocked</a> (connection, timeout))
<a name="l00933"></a>00933         <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00934"></a>00934       
<a name="l00935"></a>00935       <span class="keywordflow">if</span> (!<a class="code" href="group__DBusHashTable.html#gaca20a83f3214db08fa34df2c49c8edd5" title="Creates a hash entry with the given key and value.">_dbus_hash_table_insert_int</a> (connection-&gt;<a class="code" href="structDBusConnection.html#ad8fa077f91fe62d0c10862e2ff9e86ca" title="Hash of message serials to DBusPendingCall.">pending_replies</a>,
<a name="l00936"></a>00936                                         reply_serial,
<a name="l00937"></a>00937                                         pending))
<a name="l00938"></a>00938         {
<a name="l00939"></a>00939           <a class="code" href="group__DBusConnectionInternals.html#gabaa6d26f6eca30782904af1ceb703bd1" title="Removes a timeout using the connection&#39;s DBusRemoveTimeoutFunction if available.">_dbus_connection_remove_timeout_unlocked</a> (connection, timeout);
<a name="l00940"></a>00940 
<a name="l00941"></a>00941           <a class="code" href="group__DBusPendingCallInternals.html#gafea13f8b9977d341e41201c407adea2a" title="Sets wether the timeout has been added.">_dbus_pending_call_set_timeout_added_unlocked</a> (pending, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l00942"></a>00942           HAVE_LOCK_CHECK (connection);
<a name="l00943"></a>00943           <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00944"></a>00944         }
<a name="l00945"></a>00945       
<a name="l00946"></a>00946       <a class="code" href="group__DBusPendingCallInternals.html#gafea13f8b9977d341e41201c407adea2a" title="Sets wether the timeout has been added.">_dbus_pending_call_set_timeout_added_unlocked</a> (pending, <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>);
<a name="l00947"></a>00947     }
<a name="l00948"></a>00948   <span class="keywordflow">else</span>
<a name="l00949"></a>00949     {
<a name="l00950"></a>00950       <span class="keywordflow">if</span> (!<a class="code" href="group__DBusHashTable.html#gaca20a83f3214db08fa34df2c49c8edd5" title="Creates a hash entry with the given key and value.">_dbus_hash_table_insert_int</a> (connection-&gt;<a class="code" href="structDBusConnection.html#ad8fa077f91fe62d0c10862e2ff9e86ca" title="Hash of message serials to DBusPendingCall.">pending_replies</a>,
<a name="l00951"></a>00951                                         reply_serial,
<a name="l00952"></a>00952                                         pending))
<a name="l00953"></a>00953         {
<a name="l00954"></a>00954           HAVE_LOCK_CHECK (connection);
<a name="l00955"></a>00955           <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00956"></a>00956         }
<a name="l00957"></a>00957     }
<a name="l00958"></a>00958 
<a name="l00959"></a>00959   <a class="code" href="group__DBusPendingCallInternals.html#ga9d8987da3747604d370ffec2c5e1e10a" title="Increments the reference count on a pending call, while the lock on its connection is already held...">_dbus_pending_call_ref_unlocked</a> (pending);
<a name="l00960"></a>00960 
<a name="l00961"></a>00961   HAVE_LOCK_CHECK (connection);
<a name="l00962"></a>00962   
<a name="l00963"></a>00963   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l00964"></a>00964 }
<a name="l00965"></a>00965 
<a name="l00966"></a>00966 <span class="keyword">static</span> <span class="keywordtype">void</span>
<a name="l00967"></a>00967 free_pending_call_on_hash_removal (<span class="keywordtype">void</span> *data)
<a name="l00968"></a>00968 {
<a name="l00969"></a>00969   <a class="code" href="structDBusPendingCall.html" title="Implementation details of DBusPendingCall - all fields are private.">DBusPendingCall</a> *pending;
<a name="l00970"></a>00970   <a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>  *connection;
<a name="l00971"></a>00971   
<a name="l00972"></a>00972   <span class="keywordflow">if</span> (data == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00973"></a>00973     <span class="keywordflow">return</span>;
<a name="l00974"></a>00974 
<a name="l00975"></a>00975   pending = data;
<a name="l00976"></a>00976 
<a name="l00977"></a>00977   connection = <a class="code" href="group__DBusPendingCallInternals.html#gae725060aa80d9df58dcee4f1fa108784" title="Gets the connection associated with this pending call.">_dbus_pending_call_get_connection_unlocked</a> (pending);
<a name="l00978"></a>00978 
<a name="l00979"></a>00979   HAVE_LOCK_CHECK (connection);
<a name="l00980"></a>00980   
<a name="l00981"></a>00981   <span class="keywordflow">if</span> (<a class="code" href="group__DBusPendingCallInternals.html#gaf1e630b966722af540502329ed028254" title="Checks to see if a timeout has been added.">_dbus_pending_call_is_timeout_added_unlocked</a> (pending))
<a name="l00982"></a>00982     {
<a name="l00983"></a>00983       <a class="code" href="group__DBusConnectionInternals.html#gabaa6d26f6eca30782904af1ceb703bd1" title="Removes a timeout using the connection&#39;s DBusRemoveTimeoutFunction if available.">_dbus_connection_remove_timeout_unlocked</a> (connection,
<a name="l00984"></a>00984                                                 <a class="code" href="group__DBusPendingCallInternals.html#gaa9acac047b61c9a0eaff1977151e9e08" title="Retrives the timeout.">_dbus_pending_call_get_timeout_unlocked</a> (pending));
<a name="l00985"></a>00985       
<a name="l00986"></a>00986       <a class="code" href="group__DBusPendingCallInternals.html#gafea13f8b9977d341e41201c407adea2a" title="Sets wether the timeout has been added.">_dbus_pending_call_set_timeout_added_unlocked</a> (pending, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l00987"></a>00987     }
<a name="l00988"></a>00988 
<a name="l00989"></a>00989   <span class="comment">/* FIXME 1.0? this is sort of dangerous and undesirable to drop the lock </span>
<a name="l00990"></a>00990 <span class="comment">   * here, but the pending call finalizer could in principle call out to </span>
<a name="l00991"></a>00991 <span class="comment">   * application code so we pretty much have to... some larger code reorg </span>
<a name="l00992"></a>00992 <span class="comment">   * might be needed.</span>
<a name="l00993"></a>00993 <span class="comment">   */</span>
<a name="l00994"></a>00994   <a class="code" href="group__DBusConnectionInternals.html#ga7151f75b5d2308ec80cfe893aba72aa1" title="Increments the reference count of a DBusConnection.">_dbus_connection_ref_unlocked</a> (connection);
<a name="l00995"></a>00995   <a class="code" href="group__DBusPendingCallInternals.html#ga26f09beed0dd6323cca0452abf344567" title="Decrements the reference count on a pending call, freeing it if the count reaches 0...">_dbus_pending_call_unref_and_unlock</a> (pending);
<a name="l00996"></a>00996   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l00997"></a>00997   <a class="code" href="group__DBusConnectionInternals.html#ga9ffbd9aa4f07cb30d92887e956a9fd43" title="Decrements the reference count of a DBusConnection.">_dbus_connection_unref_unlocked</a> (connection);
<a name="l00998"></a>00998 }
<a name="l00999"></a>00999 
<a name="l01000"></a>01000 <span class="keyword">static</span> <span class="keywordtype">void</span>
<a name="l01001"></a>01001 _dbus_connection_detach_pending_call_unlocked (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>  *connection,
<a name="l01002"></a>01002                                                <a class="code" href="structDBusPendingCall.html" title="Implementation details of DBusPendingCall - all fields are private.">DBusPendingCall</a> *pending)
<a name="l01003"></a>01003 {
<a name="l01004"></a>01004   <span class="comment">/* This ends up unlocking to call the pending call finalizer, which is unexpected to</span>
<a name="l01005"></a>01005 <span class="comment">   * say the least.</span>
<a name="l01006"></a>01006 <span class="comment">   */</span>
<a name="l01007"></a>01007   <a class="code" href="group__DBusHashTable.html#gacdebe75bd692605a69dc73c15e0eefd0" title="Removes the hash entry for the given key.">_dbus_hash_table_remove_int</a> (connection-&gt;<a class="code" href="structDBusConnection.html#ad8fa077f91fe62d0c10862e2ff9e86ca" title="Hash of message serials to DBusPendingCall.">pending_replies</a>,
<a name="l01008"></a>01008                                <a class="code" href="group__DBusPendingCallInternals.html#gaf5f3df36149bfe55d824eb08d00768fc" title="Gets the reply&#39;s serial number.">_dbus_pending_call_get_reply_serial_unlocked</a> (pending));
<a name="l01009"></a>01009 }
<a name="l01010"></a>01010 
<a name="l01011"></a>01011 <span class="keyword">static</span> <span class="keywordtype">void</span>
<a name="l01012"></a>01012 _dbus_connection_detach_pending_call_and_unlock (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>  *connection,
<a name="l01013"></a>01013                                                  <a class="code" href="structDBusPendingCall.html" title="Implementation details of DBusPendingCall - all fields are private.">DBusPendingCall</a> *pending)
<a name="l01014"></a>01014 {
<a name="l01015"></a>01015   <span class="comment">/* The idea here is to avoid finalizing the pending call</span>
<a name="l01016"></a>01016 <span class="comment">   * with the lock held, since there&#39;s a destroy notifier</span>
<a name="l01017"></a>01017 <span class="comment">   * in pending call that goes out to application code.</span>
<a name="l01018"></a>01018 <span class="comment">   *</span>
<a name="l01019"></a>01019 <span class="comment">   * There&#39;s an extra unlock inside the hash table</span>
<a name="l01020"></a>01020 <span class="comment">   * &quot;free pending call&quot; function FIXME...</span>
<a name="l01021"></a>01021 <span class="comment">   */</span>
<a name="l01022"></a>01022   <a class="code" href="group__DBusPendingCallInternals.html#ga9d8987da3747604d370ffec2c5e1e10a" title="Increments the reference count on a pending call, while the lock on its connection is already held...">_dbus_pending_call_ref_unlocked</a> (pending);
<a name="l01023"></a>01023   <a class="code" href="group__DBusHashTable.html#gacdebe75bd692605a69dc73c15e0eefd0" title="Removes the hash entry for the given key.">_dbus_hash_table_remove_int</a> (connection-&gt;<a class="code" href="structDBusConnection.html#ad8fa077f91fe62d0c10862e2ff9e86ca" title="Hash of message serials to DBusPendingCall.">pending_replies</a>,
<a name="l01024"></a>01024                                <a class="code" href="group__DBusPendingCallInternals.html#gaf5f3df36149bfe55d824eb08d00768fc" title="Gets the reply&#39;s serial number.">_dbus_pending_call_get_reply_serial_unlocked</a> (pending));
<a name="l01025"></a>01025 
<a name="l01026"></a>01026   <span class="keywordflow">if</span> (<a class="code" href="group__DBusPendingCallInternals.html#gaf1e630b966722af540502329ed028254" title="Checks to see if a timeout has been added.">_dbus_pending_call_is_timeout_added_unlocked</a> (pending))
<a name="l01027"></a>01027       <a class="code" href="group__DBusConnectionInternals.html#gabaa6d26f6eca30782904af1ceb703bd1" title="Removes a timeout using the connection&#39;s DBusRemoveTimeoutFunction if available.">_dbus_connection_remove_timeout_unlocked</a> (connection,
<a name="l01028"></a>01028               <a class="code" href="group__DBusPendingCallInternals.html#gaa9acac047b61c9a0eaff1977151e9e08" title="Retrives the timeout.">_dbus_pending_call_get_timeout_unlocked</a> (pending));
<a name="l01029"></a>01029 
<a name="l01030"></a>01030   <a class="code" href="group__DBusPendingCallInternals.html#gafea13f8b9977d341e41201c407adea2a" title="Sets wether the timeout has been added.">_dbus_pending_call_set_timeout_added_unlocked</a> (pending, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l01031"></a>01031 
<a name="l01032"></a>01032   <a class="code" href="group__DBusPendingCallInternals.html#ga26f09beed0dd6323cca0452abf344567" title="Decrements the reference count on a pending call, freeing it if the count reaches 0...">_dbus_pending_call_unref_and_unlock</a> (pending);
<a name="l01033"></a>01033 }
<a name="l01034"></a>01034 
<a name="l01043"></a>01043 <span class="keywordtype">void</span>
<a name="l01044"></a><a class="code" href="group__DBusConnectionInternals.html#ga968196bee49659e75c54b53d7c85fa51">01044</a> <a class="code" href="group__DBusConnectionInternals.html#ga968196bee49659e75c54b53d7c85fa51" title="Removes a pending call from the connection, such that the pending reply will be ignored.">_dbus_connection_remove_pending_call</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>  *connection,
<a name="l01045"></a>01045                                       <a class="code" href="structDBusPendingCall.html" title="Implementation details of DBusPendingCall - all fields are private.">DBusPendingCall</a> *pending)
<a name="l01046"></a>01046 {
<a name="l01047"></a>01047   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l01048"></a>01048   _dbus_connection_detach_pending_call_and_unlock (connection, pending);
<a name="l01049"></a>01049 }
<a name="l01050"></a>01050 
<a name="l01060"></a>01060 <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="l01061"></a>01061 _dbus_connection_acquire_io_path (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l01062"></a>01062                                   <span class="keywordtype">int</span>             timeout_milliseconds)
<a name="l01063"></a>01063 {
<a name="l01064"></a>01064   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> we_acquired;
<a name="l01065"></a>01065   
<a name="l01066"></a>01066   HAVE_LOCK_CHECK (connection);
<a name="l01067"></a>01067 
<a name="l01068"></a>01068   <span class="comment">/* We don&#39;t want the connection to vanish */</span>
<a name="l01069"></a>01069   <a class="code" href="group__DBusConnectionInternals.html#ga7151f75b5d2308ec80cfe893aba72aa1" title="Increments the reference count of a DBusConnection.">_dbus_connection_ref_unlocked</a> (connection);
<a name="l01070"></a>01070 
<a name="l01071"></a>01071   <span class="comment">/* We will only touch io_path_acquired which is protected by our mutex */</span>
<a name="l01072"></a>01072   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l01073"></a>01073   
<a name="l01074"></a>01074   _dbus_verbose (<span class="stringliteral">&quot;locking io_path_mutex\n&quot;</span>);
<a name="l01075"></a>01075   <a class="code" href="group__DBusThreadsInternals.html#gabea1bdc19c155bca909839090c05eee2" title="Locks a mutex.">_dbus_cmutex_lock</a> (connection-&gt;<a class="code" href="structDBusConnection.html#aaad1c7d6e6ba3e049ef790f4f9aa35cd" title="Protects io_path_acquired.">io_path_mutex</a>);
<a name="l01076"></a>01076 
<a name="l01077"></a>01077   _dbus_verbose (<span class="stringliteral">&quot;start connection-&gt;io_path_acquired = %d timeout = %d\n&quot;</span>,
<a name="l01078"></a>01078                  connection-&gt;<a class="code" href="structDBusConnection.html#a9f71e445534a4405075c33b5a075589f" title="Someone has transport io path (can use the transport to read/write messages)">io_path_acquired</a>, timeout_milliseconds);
<a name="l01079"></a>01079 
<a name="l01080"></a>01080   we_acquired = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l01081"></a>01081   
<a name="l01082"></a>01082   <span class="keywordflow">if</span> (connection-&gt;<a class="code" href="structDBusConnection.html#a9f71e445534a4405075c33b5a075589f" title="Someone has transport io path (can use the transport to read/write messages)">io_path_acquired</a>)
<a name="l01083"></a>01083     {
<a name="l01084"></a>01084       <span class="keywordflow">if</span> (timeout_milliseconds != -1)
<a name="l01085"></a>01085         {
<a name="l01086"></a>01086           _dbus_verbose (<span class="stringliteral">&quot;waiting %d for IO path to be acquirable\n&quot;</span>,
<a name="l01087"></a>01087                          timeout_milliseconds);
<a name="l01088"></a>01088 
<a name="l01089"></a>01089           <span class="keywordflow">if</span> (!<a class="code" href="group__DBusThreadsInternals.html#ga918e53c2abc48ff496f3c75566ba8bd3" title="Atomically unlocks the mutex and waits for the conditions variable to be signalled, or for a timeout.">_dbus_condvar_wait_timeout</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a6d87e03eea7aaff53f5574efcfb8c3e4" title="Notify when io_path_acquired is available.">io_path_cond</a>,
<a name="l01090"></a>01090                                            connection-&gt;<a class="code" href="structDBusConnection.html#aaad1c7d6e6ba3e049ef790f4f9aa35cd" title="Protects io_path_acquired.">io_path_mutex</a>,
<a name="l01091"></a>01091                                            timeout_milliseconds))
<a name="l01092"></a>01092             {
<a name="l01093"></a>01093               <span class="comment">/* We timed out before anyone signaled. */</span>
<a name="l01094"></a>01094               <span class="comment">/* (writing the loop to handle the !timedout case by</span>
<a name="l01095"></a>01095 <span class="comment">               * waiting longer if needed is a pain since dbus</span>
<a name="l01096"></a>01096 <span class="comment">               * wraps pthread_cond_timedwait to take a relative</span>
<a name="l01097"></a>01097 <span class="comment">               * time instead of absolute, something kind of stupid</span>
<a name="l01098"></a>01098 <span class="comment">               * on our part. for now it doesn&#39;t matter, we will just</span>
<a name="l01099"></a>01099 <span class="comment">               * end up back here eventually.)</span>
<a name="l01100"></a>01100 <span class="comment">               */</span>
<a name="l01101"></a>01101             }
<a name="l01102"></a>01102         }
<a name="l01103"></a>01103       <span class="keywordflow">else</span>
<a name="l01104"></a>01104         {
<a name="l01105"></a>01105           <span class="keywordflow">while</span> (connection-&gt;<a class="code" href="structDBusConnection.html#a9f71e445534a4405075c33b5a075589f" title="Someone has transport io path (can use the transport to read/write messages)">io_path_acquired</a>)
<a name="l01106"></a>01106             {
<a name="l01107"></a>01107               _dbus_verbose (<span class="stringliteral">&quot;waiting for IO path to be acquirable\n&quot;</span>);
<a name="l01108"></a>01108               <a class="code" href="group__DBusThreadsInternals.html#ga6938b8a4547ce48290615990f64bd3bb" title="Atomically unlocks the mutex and waits for the conditions variable to be signalled.">_dbus_condvar_wait</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a6d87e03eea7aaff53f5574efcfb8c3e4" title="Notify when io_path_acquired is available.">io_path_cond</a>, 
<a name="l01109"></a>01109                                   connection-&gt;<a class="code" href="structDBusConnection.html#aaad1c7d6e6ba3e049ef790f4f9aa35cd" title="Protects io_path_acquired.">io_path_mutex</a>);
<a name="l01110"></a>01110             }
<a name="l01111"></a>01111         }
<a name="l01112"></a>01112     }
<a name="l01113"></a>01113   
<a name="l01114"></a>01114   <span class="keywordflow">if</span> (!connection-&gt;<a class="code" href="structDBusConnection.html#a9f71e445534a4405075c33b5a075589f" title="Someone has transport io path (can use the transport to read/write messages)">io_path_acquired</a>)
<a name="l01115"></a>01115     {
<a name="l01116"></a>01116       we_acquired = <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l01117"></a>01117       connection-&gt;<a class="code" href="structDBusConnection.html#a9f71e445534a4405075c33b5a075589f" title="Someone has transport io path (can use the transport to read/write messages)">io_path_acquired</a> = <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l01118"></a>01118     }
<a name="l01119"></a>01119   
<a name="l01120"></a>01120   _dbus_verbose (<span class="stringliteral">&quot;end connection-&gt;io_path_acquired = %d we_acquired = %d\n&quot;</span>,
<a name="l01121"></a>01121                  connection-&gt;<a class="code" href="structDBusConnection.html#a9f71e445534a4405075c33b5a075589f" title="Someone has transport io path (can use the transport to read/write messages)">io_path_acquired</a>, we_acquired);
<a name="l01122"></a>01122 
<a name="l01123"></a>01123   _dbus_verbose (<span class="stringliteral">&quot;unlocking io_path_mutex\n&quot;</span>);
<a name="l01124"></a>01124   <a class="code" href="group__DBusThreadsInternals.html#gad199edcd1bb88cfd2e9dcfb47cbc732f" title="Unlocks a mutex.">_dbus_cmutex_unlock</a> (connection-&gt;<a class="code" href="structDBusConnection.html#aaad1c7d6e6ba3e049ef790f4f9aa35cd" title="Protects io_path_acquired.">io_path_mutex</a>);
<a name="l01125"></a>01125 
<a name="l01126"></a>01126   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l01127"></a>01127   
<a name="l01128"></a>01128   HAVE_LOCK_CHECK (connection);
<a name="l01129"></a>01129 
<a name="l01130"></a>01130   <a class="code" href="group__DBusConnectionInternals.html#ga9ffbd9aa4f07cb30d92887e956a9fd43" title="Decrements the reference count of a DBusConnection.">_dbus_connection_unref_unlocked</a> (connection);
<a name="l01131"></a>01131   
<a name="l01132"></a>01132   <span class="keywordflow">return</span> we_acquired;
<a name="l01133"></a>01133 }
<a name="l01134"></a>01134 
<a name="l01142"></a>01142 <span class="keyword">static</span> <span class="keywordtype">void</span>
<a name="l01143"></a>01143 _dbus_connection_release_io_path (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l01144"></a>01144 {
<a name="l01145"></a>01145   HAVE_LOCK_CHECK (connection);
<a name="l01146"></a>01146   
<a name="l01147"></a>01147   _dbus_verbose (<span class="stringliteral">&quot;locking io_path_mutex\n&quot;</span>);
<a name="l01148"></a>01148   <a class="code" href="group__DBusThreadsInternals.html#gabea1bdc19c155bca909839090c05eee2" title="Locks a mutex.">_dbus_cmutex_lock</a> (connection-&gt;<a class="code" href="structDBusConnection.html#aaad1c7d6e6ba3e049ef790f4f9aa35cd" title="Protects io_path_acquired.">io_path_mutex</a>);
<a name="l01149"></a>01149   
<a name="l01150"></a>01150   _dbus_assert (connection-&gt;<a class="code" href="structDBusConnection.html#a9f71e445534a4405075c33b5a075589f" title="Someone has transport io path (can use the transport to read/write messages)">io_path_acquired</a>);
<a name="l01151"></a>01151 
<a name="l01152"></a>01152   _dbus_verbose (<span class="stringliteral">&quot;start connection-&gt;io_path_acquired = %d\n&quot;</span>,
<a name="l01153"></a>01153                  connection-&gt;<a class="code" href="structDBusConnection.html#a9f71e445534a4405075c33b5a075589f" title="Someone has transport io path (can use the transport to read/write messages)">io_path_acquired</a>);
<a name="l01154"></a>01154   
<a name="l01155"></a>01155   connection-&gt;<a class="code" href="structDBusConnection.html#a9f71e445534a4405075c33b5a075589f" title="Someone has transport io path (can use the transport to read/write messages)">io_path_acquired</a> = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l01156"></a>01156   <a class="code" href="group__DBusThreadsInternals.html#ga8af2fd84773022e7e7ce1f21f0126203" title="If there are threads waiting on the condition variable, wake up exactly one.">_dbus_condvar_wake_one</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a6d87e03eea7aaff53f5574efcfb8c3e4" title="Notify when io_path_acquired is available.">io_path_cond</a>);
<a name="l01157"></a>01157 
<a name="l01158"></a>01158   _dbus_verbose (<span class="stringliteral">&quot;unlocking io_path_mutex\n&quot;</span>);
<a name="l01159"></a>01159   <a class="code" href="group__DBusThreadsInternals.html#gad199edcd1bb88cfd2e9dcfb47cbc732f" title="Unlocks a mutex.">_dbus_cmutex_unlock</a> (connection-&gt;<a class="code" href="structDBusConnection.html#aaad1c7d6e6ba3e049ef790f4f9aa35cd" title="Protects io_path_acquired.">io_path_mutex</a>);
<a name="l01160"></a>01160 }
<a name="l01161"></a>01161 
<a name="l01197"></a>01197 <span class="keywordtype">void</span>
<a name="l01198"></a><a class="code" href="group__DBusConnectionInternals.html#ga283f0254537c4bf4453dbed6fad2e21e">01198</a> <a class="code" href="group__DBusConnectionInternals.html#ga283f0254537c4bf4453dbed6fad2e21e" title="Queues incoming messages and sends outgoing messages for this connection, optionally blocking in the ...">_dbus_connection_do_iteration_unlocked</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l01199"></a>01199                                         <a class="code" href="structDBusPendingCall.html" title="Implementation details of DBusPendingCall - all fields are private.">DBusPendingCall</a> *pending,
<a name="l01200"></a>01200                                         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>    flags,
<a name="l01201"></a>01201                                         <span class="keywordtype">int</span>             timeout_milliseconds)
<a name="l01202"></a>01202 {
<a name="l01203"></a>01203   _dbus_verbose (<span class="stringliteral">&quot;start\n&quot;</span>);
<a name="l01204"></a>01204   
<a name="l01205"></a>01205   HAVE_LOCK_CHECK (connection);
<a name="l01206"></a>01206   
<a name="l01207"></a>01207   <span class="keywordflow">if</span> (connection-&gt;<a class="code" href="structDBusConnection.html#a07025e177949c5e65d5f983ac5f5e878" title="Length of outgoing queue.">n_outgoing</a> == 0)
<a name="l01208"></a>01208     flags &amp;= ~DBUS_ITERATION_DO_WRITING;
<a name="l01209"></a>01209 
<a name="l01210"></a>01210   <span class="keywordflow">if</span> (_dbus_connection_acquire_io_path (connection,
<a name="l01211"></a>01211                                         (flags &amp; DBUS_ITERATION_BLOCK) ? timeout_milliseconds : 0))
<a name="l01212"></a>01212     {
<a name="l01213"></a>01213       HAVE_LOCK_CHECK (connection);
<a name="l01214"></a>01214       
<a name="l01215"></a>01215       <span class="keywordflow">if</span> ( (pending != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>) &amp;&amp; <a class="code" href="group__DBusPendingCallInternals.html#ga37bef4359b3c29629a57f5fe480690a1" title="Checks whether the pending call has received a reply yet, or not.">_dbus_pending_call_get_completed_unlocked</a>(pending))
<a name="l01216"></a>01216         {
<a name="l01217"></a>01217           _dbus_verbose (<span class="stringliteral">&quot;pending call completed while acquiring I/O path&quot;</span>);
<a name="l01218"></a>01218         }
<a name="l01219"></a>01219       <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( (pending != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>) &amp;&amp;
<a name="l01220"></a>01220                 _dbus_connection_peek_for_reply_unlocked (connection,
<a name="l01221"></a>01221                                                           <a class="code" href="group__DBusPendingCallInternals.html#gaf5f3df36149bfe55d824eb08d00768fc" title="Gets the reply&#39;s serial number.">_dbus_pending_call_get_reply_serial_unlocked</a> (pending)))
<a name="l01222"></a>01222         {
<a name="l01223"></a>01223           _dbus_verbose (<span class="stringliteral">&quot;pending call completed while acquiring I/O path (reply found in queue)&quot;</span>);
<a name="l01224"></a>01224         }
<a name="l01225"></a>01225       <span class="keywordflow">else</span>
<a name="l01226"></a>01226         {
<a name="l01227"></a>01227           <a class="code" href="group__DBusTransport.html#gac5e6d7a01debcf852b8d5a2fbc666fde" title="Performs a single poll()/select() on the transport&#39;s file descriptors and then reads/writes data as a...">_dbus_transport_do_iteration</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>,
<a name="l01228"></a>01228                                         flags, timeout_milliseconds);
<a name="l01229"></a>01229         }
<a name="l01230"></a>01230 
<a name="l01231"></a>01231       _dbus_connection_release_io_path (connection);
<a name="l01232"></a>01232     }
<a name="l01233"></a>01233 
<a name="l01234"></a>01234   HAVE_LOCK_CHECK (connection);
<a name="l01235"></a>01235 
<a name="l01236"></a>01236   _dbus_verbose (<span class="stringliteral">&quot;end\n&quot;</span>);
<a name="l01237"></a>01237 }
<a name="l01238"></a>01238 
<a name="l01248"></a>01248 <a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>*
<a name="l01249"></a><a class="code" href="group__DBusConnectionInternals.html#ga2cdffe9215251b69cb39ff36b9f50e6c">01249</a> <a class="code" href="group__DBusConnectionInternals.html#ga2cdffe9215251b69cb39ff36b9f50e6c" title="Creates a new connection for the given transport.">_dbus_connection_new_for_transport</a> (<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport)
<a name="l01250"></a>01250 {
<a name="l01251"></a>01251   <a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection;
<a name="l01252"></a>01252   <a class="code" href="structDBusWatchList.html" title="DBusWatchList implementation details.">DBusWatchList</a> *watch_list;
<a name="l01253"></a>01253   <a class="code" href="structDBusTimeoutList.html" title="DBusTimeoutList implementation details.">DBusTimeoutList</a> *timeout_list;
<a name="l01254"></a>01254   <a class="code" href="structDBusHashTable.html" title="Internals of DBusHashTable.">DBusHashTable</a> *pending_replies;
<a name="l01255"></a>01255   <a class="code" href="structDBusList.html" title="A node in a linked list.">DBusList</a> *disconnect_link;
<a name="l01256"></a>01256   <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *disconnect_message;
<a name="l01257"></a>01257   <a class="code" href="structDBusCounter.html" title="Internals of DBusCounter.">DBusCounter</a> *outgoing_counter;
<a name="l01258"></a>01258   <a class="code" href="structDBusObjectTree.html" title="Internals of DBusObjectTree.">DBusObjectTree</a> *objects;
<a name="l01259"></a>01259   
<a name="l01260"></a>01260   watch_list = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l01261"></a>01261   connection = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l01262"></a>01262   pending_replies = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l01263"></a>01263   timeout_list = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l01264"></a>01264   disconnect_link = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l01265"></a>01265   disconnect_message = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l01266"></a>01266   outgoing_counter = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l01267"></a>01267   objects = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l01268"></a>01268   
<a name="l01269"></a>01269   watch_list = <a class="code" href="group__DBusWatchInternals.html#ga5d9db5d0af5916a5ec890eb38d5741eb" title="Creates a new watch list.">_dbus_watch_list_new</a> ();
<a name="l01270"></a>01270   <span class="keywordflow">if</span> (watch_list == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01271"></a>01271     <span class="keywordflow">goto</span> error;
<a name="l01272"></a>01272 
<a name="l01273"></a>01273   timeout_list = <a class="code" href="group__DBusTimeoutInternals.html#ga5b122b35cdb3926b7dc2d084ddff9d62" title="Creates a new timeout list.">_dbus_timeout_list_new</a> ();
<a name="l01274"></a>01274   <span class="keywordflow">if</span> (timeout_list == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01275"></a>01275     <span class="keywordflow">goto</span> error;  
<a name="l01276"></a>01276 
<a name="l01277"></a>01277   pending_replies =
<a name="l01278"></a>01278     <a class="code" href="group__DBusHashTable.html#gac8e434348a354b9606d4c50c127a5eb4" title="Constructs a new hash table.">_dbus_hash_table_new</a> (<a class="code" href="group__DBusHashTable.html#ggab0ab9767ffa5b6720a13b3d741630852a26446bd9fbb15c6c381b35a810207141" title="Hash keys are integers.">DBUS_HASH_INT</a>,
<a name="l01279"></a>01279                           <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>,
<a name="l01280"></a>01280                           (<a class="code" href="group__DBusMemory.html#ga061bcded226d76c7d7de35beaa165cb5" title="The type of a function which frees a block of memory.">DBusFreeFunction</a>)free_pending_call_on_hash_removal);
<a name="l01281"></a>01281   <span class="keywordflow">if</span> (pending_replies == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01282"></a>01282     <span class="keywordflow">goto</span> error;
<a name="l01283"></a>01283   
<a name="l01284"></a>01284   connection = <a class="code" href="group__DBusMemory.html#gaba9d823abda7f4cadbaf5177d3b8b793" title="Safe macro for using dbus_malloc0().">dbus_new0</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>, 1);
<a name="l01285"></a>01285   <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="l01286"></a>01286     <span class="keywordflow">goto</span> error;
<a name="l01287"></a>01287 
<a name="l01288"></a>01288   <a class="code" href="group__DBusThreadsInternals.html#ga191deedb97c76fae82bdbc8e1559a849" title="Creates a new mutex or creates a no-op mutex if threads are not initialized.">_dbus_rmutex_new_at_location</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#a98e26cfd09ddbf0238f90bf4965641bf" title="Lock on the entire DBusConnection.">mutex</a>);
<a name="l01289"></a>01289   <span class="keywordflow">if</span> (connection-&gt;<a class="code" href="structDBusConnection.html#a98e26cfd09ddbf0238f90bf4965641bf" title="Lock on the entire DBusConnection.">mutex</a> == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01290"></a>01290     <span class="keywordflow">goto</span> error;
<a name="l01291"></a>01291 
<a name="l01292"></a>01292   <a class="code" href="group__DBusThreadsInternals.html#ga89495162caac2ace36c6b9c2031bc962" title="Creates a new mutex or creates a no-op mutex if threads are not initialized.">_dbus_cmutex_new_at_location</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#aaad1c7d6e6ba3e049ef790f4f9aa35cd" title="Protects io_path_acquired.">io_path_mutex</a>);
<a name="l01293"></a>01293   <span class="keywordflow">if</span> (connection-&gt;<a class="code" href="structDBusConnection.html#aaad1c7d6e6ba3e049ef790f4f9aa35cd" title="Protects io_path_acquired.">io_path_mutex</a> == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01294"></a>01294     <span class="keywordflow">goto</span> error;
<a name="l01295"></a>01295 
<a name="l01296"></a>01296   <a class="code" href="group__DBusThreadsInternals.html#ga89495162caac2ace36c6b9c2031bc962" title="Creates a new mutex or creates a no-op mutex if threads are not initialized.">_dbus_cmutex_new_at_location</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#ad9e7bf73a48f4951b24ce8eec7bb7ac5" title="Protects dispatch_acquired.">dispatch_mutex</a>);
<a name="l01297"></a>01297   <span class="keywordflow">if</span> (connection-&gt;<a class="code" href="structDBusConnection.html#ad9e7bf73a48f4951b24ce8eec7bb7ac5" title="Protects dispatch_acquired.">dispatch_mutex</a> == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01298"></a>01298     <span class="keywordflow">goto</span> error;
<a name="l01299"></a>01299   
<a name="l01300"></a>01300   <a class="code" href="group__DBusThreadsInternals.html#ga859c5830e3c212323c1d6dafee3858a1" title="This does the same thing as _dbus_condvar_new.">_dbus_condvar_new_at_location</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#a201f92bbc0947b503a36eaff9ae0ede9" title="Notify when dispatch_acquired is available.">dispatch_cond</a>);
<a name="l01301"></a>01301   <span class="keywordflow">if</span> (connection-&gt;<a class="code" href="structDBusConnection.html#a201f92bbc0947b503a36eaff9ae0ede9" title="Notify when dispatch_acquired is available.">dispatch_cond</a> == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01302"></a>01302     <span class="keywordflow">goto</span> error;
<a name="l01303"></a>01303   
<a name="l01304"></a>01304   <a class="code" href="group__DBusThreadsInternals.html#ga859c5830e3c212323c1d6dafee3858a1" title="This does the same thing as _dbus_condvar_new.">_dbus_condvar_new_at_location</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#a6d87e03eea7aaff53f5574efcfb8c3e4" title="Notify when io_path_acquired is available.">io_path_cond</a>);
<a name="l01305"></a>01305   <span class="keywordflow">if</span> (connection-&gt;<a class="code" href="structDBusConnection.html#a6d87e03eea7aaff53f5574efcfb8c3e4" title="Notify when io_path_acquired is available.">io_path_cond</a> == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01306"></a>01306     <span class="keywordflow">goto</span> error;
<a name="l01307"></a>01307 
<a name="l01308"></a>01308   <a class="code" href="group__DBusThreadsInternals.html#ga191deedb97c76fae82bdbc8e1559a849" title="Creates a new mutex or creates a no-op mutex if threads are not initialized.">_dbus_rmutex_new_at_location</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#a773fb4ecd2738548dbbfbe6d1206da92" title="Lock on slot_list so overall connection lock need not be taken.">slot_mutex</a>);
<a name="l01309"></a>01309   <span class="keywordflow">if</span> (connection-&gt;<a class="code" href="structDBusConnection.html#a773fb4ecd2738548dbbfbe6d1206da92" title="Lock on slot_list so overall connection lock need not be taken.">slot_mutex</a> == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01310"></a>01310     <span class="keywordflow">goto</span> error;
<a name="l01311"></a>01311 
<a name="l01312"></a>01312   disconnect_message = <a class="code" href="group__DBusMessage.html#ga6ce3213dfb17be7956affba40207a5a0" title="Constructs a new message representing a signal emission.">dbus_message_new_signal</a> (<a class="code" href="group__DBusShared.html#ga850990a54a46142ee7c5f8174cc932c1" title="The object path used in local/in-process-generated messages.">DBUS_PATH_LOCAL</a>,
<a name="l01313"></a>01313                                                 <a class="code" href="group__DBusShared.html#ga9ef6478aae637449ec0c5de1679f75ce" title="This is a special interface whose methods can only be invoked by the local implementation (messages f...">DBUS_INTERFACE_LOCAL</a>,
<a name="l01314"></a>01314                                                 <span class="stringliteral">&quot;Disconnected&quot;</span>);
<a name="l01315"></a>01315   
<a name="l01316"></a>01316   <span class="keywordflow">if</span> (disconnect_message == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01317"></a>01317     <span class="keywordflow">goto</span> error;
<a name="l01318"></a>01318 
<a name="l01319"></a>01319   disconnect_link = <a class="code" href="group__DBusList.html#gac20b9981531cef590d49a59240344cd8" title="Allocates a linked list node.">_dbus_list_alloc_link</a> (disconnect_message);
<a name="l01320"></a>01320   <span class="keywordflow">if</span> (disconnect_link == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01321"></a>01321     <span class="keywordflow">goto</span> error;
<a name="l01322"></a>01322 
<a name="l01323"></a>01323   outgoing_counter = <a class="code" href="group__DBusResources.html#ga9911dd8fa020299a2b517251ea0be399" title="Creates a new DBusCounter.">_dbus_counter_new</a> ();
<a name="l01324"></a>01324   <span class="keywordflow">if</span> (outgoing_counter == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01325"></a>01325     <span class="keywordflow">goto</span> error;
<a name="l01326"></a>01326 
<a name="l01327"></a>01327   objects = <a class="code" href="group__DBusObjectTree.html#ga5920f14b487122f13a3d439952d5ed2e" title="Creates a new object tree, representing a mapping from paths to handler vtables.">_dbus_object_tree_new</a> (connection);
<a name="l01328"></a>01328   <span class="keywordflow">if</span> (objects == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01329"></a>01329     <span class="keywordflow">goto</span> error;
<a name="l01330"></a>01330   
<a name="l01331"></a>01331   <span class="keywordflow">if</span> (_dbus_modify_sigpipe)
<a name="l01332"></a>01332     <a class="code" href="group__DBusSysdeps.html#ga6890d4cde3afec0bf274ca2af8c9e204" title="signal (SIGPIPE, SIG_IGN);">_dbus_disable_sigpipe</a> ();
<a name="l01333"></a>01333 
<a name="l01334"></a>01334   <span class="comment">/* initialized to 0: use atomic op to avoid mixing atomic and non-atomic */</span>
<a name="l01335"></a>01335   <a class="code" href="group__DBusSysdeps.html#gae74c3fcf12acaeccdb152ef907de951c" title="Atomically increments an integer.">_dbus_atomic_inc</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#a6fbf0227071fc20ffd5b0e79aef58e92" title="Reference count.">refcount</a>);
<a name="l01336"></a>01336   connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a> = transport;
<a name="l01337"></a>01337   connection-&gt;<a class="code" href="structDBusConnection.html#abdb6a32972d924531fb2cd80c7fd6d37" title="Stores active watches.">watches</a> = watch_list;
<a name="l01338"></a>01338   connection-&gt;<a class="code" href="structDBusConnection.html#af3936ac5c968f2ac09bf05cf36025994" title="Stores active timeouts.">timeouts</a> = timeout_list;
<a name="l01339"></a>01339   connection-&gt;<a class="code" href="structDBusConnection.html#ad8fa077f91fe62d0c10862e2ff9e86ca" title="Hash of message serials to DBusPendingCall.">pending_replies</a> = pending_replies;
<a name="l01340"></a>01340   connection-&gt;<a class="code" href="structDBusConnection.html#a5dcb660883904035076579c6d2f46501" title="Counts size of outgoing messages.">outgoing_counter</a> = outgoing_counter;
<a name="l01341"></a>01341   connection-&gt;<a class="code" href="structDBusConnection.html#a32d14cefcb4daea257544397755d45ed" title="List of filters.">filter_list</a> = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l01342"></a>01342   connection-&gt;<a class="code" href="structDBusConnection.html#af3bbd2ecba171ebb8e952eaa030971d7" title="The last dispatch status we reported to the application.">last_dispatch_status</a> = <a class="code" href="group__DBusConnection.html#ggabf250a32ff740b2a8c99136e0142d8d2acb9bb9daa90f520d5fc9e84de3c5f017" title="All currently available data has been processed.">DBUS_DISPATCH_COMPLETE</a>; <span class="comment">/* so we&#39;re notified first time there&#39;s data */</span>
<a name="l01343"></a>01343   connection-&gt;<a class="code" href="structDBusConnection.html#acd289771721a459f4f9cdeaca0fa87c2" title="Object path handlers registered with this connection.">objects</a> = objects;
<a name="l01344"></a>01344   connection-&gt;<a class="code" href="structDBusConnection.html#a2a9f22339f90157f308a532462218404" title="If TRUE, exit after handling disconnect signal.">exit_on_disconnect</a> = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l01345"></a>01345   connection-&gt;<a class="code" href="structDBusConnection.html#aae47138b9b2494b65072ff300d631aa8" title="TRUE if libdbus owns a reference to the connection and can return it from dbus_connection_open() more...">shareable</a> = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l01346"></a>01346   connection-&gt;<a class="code" href="structDBusConnection.html#ab13bc36d7e6f91995768277ecbd5482c" title="If TRUE, if org.freedesktop.DBus.Peer messages have a bus name, don&#39;t handle them automatically...">route_peer_messages</a> = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l01347"></a>01347   connection-&gt;<a class="code" href="structDBusConnection.html#a48d141d4311211e921571043bdbaeefb" title="We popped or are dispatching the disconnected message.">disconnected_message_arrived</a> = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l01348"></a>01348   connection-&gt;<a class="code" href="structDBusConnection.html#a3b2707b9d10d0643f91a8e027ae118b5" title="We did our default handling of the disconnected message, such as closing the connection.">disconnected_message_processed</a> = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l01349"></a>01349   
<a name="l01350"></a>01350 <span class="preprocessor">#if defined(DBUS_ENABLE_CHECKS) || defined(DBUS_ENABLE_ASSERT)</span>
<a name="l01351"></a>01351 <span class="preprocessor"></span>  connection-&gt;generation = <a class="code" href="group__DBusMemoryInternals.html#ga7c224d82013e2bdc181c1d85dcb6f295" title="_dbus_current_generation is used to track each time that dbus_shutdown() is called, so we can reinit things after it&#39;s been called.">_dbus_current_generation</a>;
<a name="l01352"></a>01352 <span class="preprocessor">#endif</span>
<a name="l01353"></a>01353 <span class="preprocessor"></span>  
<a name="l01354"></a>01354   <a class="code" href="group__DBusDataSlot.html#ga6de49b3a1210202215d40a5a19806992" title="Initializes a slot list.">_dbus_data_slot_list_init</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#a0f805edcd9c09aaf45974510403dccbd" title="Data stored by allocated integer ID.">slot_list</a>);
<a name="l01355"></a>01355 
<a name="l01356"></a>01356   connection-&gt;<a class="code" href="structDBusConnection.html#a43d0bb9401103383e13ed3c99baf0daa" title="Client serial.">client_serial</a> = 1;
<a name="l01357"></a>01357 
<a name="l01358"></a>01358   connection-&gt;<a class="code" href="structDBusConnection.html#aa70afc41f6184604c027e7f71a314d7f" title="Preallocated list node for queueing the disconnection message.">disconnect_message_link</a> = disconnect_link;
<a name="l01359"></a>01359 
<a name="l01360"></a>01360   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l01361"></a>01361   
<a name="l01362"></a>01362   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusTransport.html#ga9aaa3f8bf429c94d4ed180dff36c503c" title="Sets the connection using this transport.">_dbus_transport_set_connection</a> (transport, connection))
<a name="l01363"></a>01363     {
<a name="l01364"></a>01364       <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l01365"></a>01365 
<a name="l01366"></a>01366       <span class="keywordflow">goto</span> error;
<a name="l01367"></a>01367     }
<a name="l01368"></a>01368 
<a name="l01369"></a>01369   <a class="code" href="group__DBusTransport.html#ga31d6dbc864c9ea643d72521bbb1b7c56" title="Increments the reference count for the transport.">_dbus_transport_ref</a> (transport);
<a name="l01370"></a>01370 
<a name="l01371"></a>01371   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l01372"></a>01372 
<a name="l01373"></a>01373   _dbus_connection_trace_ref (connection, 0, 1, <span class="stringliteral">&quot;new_for_transport&quot;</span>);
<a name="l01374"></a>01374   <span class="keywordflow">return</span> connection;
<a name="l01375"></a>01375   
<a name="l01376"></a>01376  error:
<a name="l01377"></a>01377   <span class="keywordflow">if</span> (disconnect_message != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01378"></a>01378     <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> (disconnect_message);
<a name="l01379"></a>01379   
<a name="l01380"></a>01380   <span class="keywordflow">if</span> (disconnect_link != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01381"></a>01381     <a class="code" href="group__DBusList.html#ga6e824f717125ce40c549d5402e32610f" title="Frees a linked list node allocated with _dbus_list_alloc_link.">_dbus_list_free_link</a> (disconnect_link);
<a name="l01382"></a>01382   
<a name="l01383"></a>01383   <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="l01384"></a>01384     {
<a name="l01385"></a>01385       <a class="code" href="group__DBusThreadsInternals.html#ga29444a34b569fca22fac48067832aacd" title="Frees a condition variable; does nothing if passed a NULL pointer.">_dbus_condvar_free_at_location</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#a6d87e03eea7aaff53f5574efcfb8c3e4" title="Notify when io_path_acquired is available.">io_path_cond</a>);
<a name="l01386"></a>01386       <a class="code" href="group__DBusThreadsInternals.html#ga29444a34b569fca22fac48067832aacd" title="Frees a condition variable; does nothing if passed a NULL pointer.">_dbus_condvar_free_at_location</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#a201f92bbc0947b503a36eaff9ae0ede9" title="Notify when dispatch_acquired is available.">dispatch_cond</a>);
<a name="l01387"></a>01387       <a class="code" href="group__DBusThreadsInternals.html#gae1c95a3f47bcc78d32fc0a5a8ed37c91" title="Frees a DBusRMutex; does nothing if passed a NULL pointer.">_dbus_rmutex_free_at_location</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#a98e26cfd09ddbf0238f90bf4965641bf" title="Lock on the entire DBusConnection.">mutex</a>);
<a name="l01388"></a>01388       <a class="code" href="group__DBusThreadsInternals.html#ga20ec8aeb88b1f65445a4d3c1c0bd0048" title="Frees a DBusCMutex; does nothing if passed a NULL pointer.">_dbus_cmutex_free_at_location</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#aaad1c7d6e6ba3e049ef790f4f9aa35cd" title="Protects io_path_acquired.">io_path_mutex</a>);
<a name="l01389"></a>01389       <a class="code" href="group__DBusThreadsInternals.html#ga20ec8aeb88b1f65445a4d3c1c0bd0048" title="Frees a DBusCMutex; does nothing if passed a NULL pointer.">_dbus_cmutex_free_at_location</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#ad9e7bf73a48f4951b24ce8eec7bb7ac5" title="Protects dispatch_acquired.">dispatch_mutex</a>);
<a name="l01390"></a>01390       <a class="code" href="group__DBusThreadsInternals.html#gae1c95a3f47bcc78d32fc0a5a8ed37c91" title="Frees a DBusRMutex; does nothing if passed a NULL pointer.">_dbus_rmutex_free_at_location</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#a773fb4ecd2738548dbbfbe6d1206da92" title="Lock on slot_list so overall connection lock need not be taken.">slot_mutex</a>);
<a name="l01391"></a>01391       <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> (connection);
<a name="l01392"></a>01392     }
<a name="l01393"></a>01393   <span class="keywordflow">if</span> (pending_replies)
<a name="l01394"></a>01394     <a class="code" href="group__DBusHashTable.html#ga96b777e00764b44e0f3216fd8478f5a9" title="Decrements the reference count for a hash table, freeing the hash table if the count reaches zero...">_dbus_hash_table_unref</a> (pending_replies);
<a name="l01395"></a>01395   
<a name="l01396"></a>01396   <span class="keywordflow">if</span> (watch_list)
<a name="l01397"></a>01397     <a class="code" href="group__DBusWatchInternals.html#gac3f75c0da2c8c51e8708f45dd27f9e2d" title="Frees a DBusWatchList.">_dbus_watch_list_free</a> (watch_list);
<a name="l01398"></a>01398 
<a name="l01399"></a>01399   <span class="keywordflow">if</span> (timeout_list)
<a name="l01400"></a>01400     <a class="code" href="group__DBusTimeoutInternals.html#ga1b399ef2d7f128e59bb32dbb5b590e1b" title="Frees a DBusTimeoutList.">_dbus_timeout_list_free</a> (timeout_list);
<a name="l01401"></a>01401 
<a name="l01402"></a>01402   <span class="keywordflow">if</span> (outgoing_counter)
<a name="l01403"></a>01403     <a class="code" href="group__DBusResources.html#ga48d9b53d1a395ab3c4f1846ca569ef3f" title="Decrements refcount of the counter and possibly finalizes the counter.">_dbus_counter_unref</a> (outgoing_counter);
<a name="l01404"></a>01404 
<a name="l01405"></a>01405   <span class="keywordflow">if</span> (objects)
<a name="l01406"></a>01406     <a class="code" href="group__DBusObjectTree.html#ga7639e273ab160c422a7cef0cda60ded5" title="Decrement the reference count.">_dbus_object_tree_unref</a> (objects);
<a name="l01407"></a>01407   
<a name="l01408"></a>01408   <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="l01409"></a>01409 }
<a name="l01410"></a>01410 
<a name="l01418"></a>01418 <a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *
<a name="l01419"></a><a class="code" href="group__DBusConnectionInternals.html#ga7151f75b5d2308ec80cfe893aba72aa1">01419</a> <a class="code" href="group__DBusConnectionInternals.html#ga7151f75b5d2308ec80cfe893aba72aa1" title="Increments the reference count of a DBusConnection.">_dbus_connection_ref_unlocked</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l01420"></a>01420 {
<a name="l01421"></a>01421   <a class="code" href="group__DBusTypes.html#gab18afa60e9b17b6e322735bda3d863d8" title="A 32-bit signed integer on all platforms.">dbus_int32_t</a> old_refcount;
<a name="l01422"></a>01422 
<a name="l01423"></a>01423   _dbus_assert (connection != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l01424"></a>01424   _dbus_assert (connection-&gt;generation == <a class="code" href="group__DBusMemoryInternals.html#ga7c224d82013e2bdc181c1d85dcb6f295" title="_dbus_current_generation is used to track each time that dbus_shutdown() is called, so we can reinit things after it&#39;s been called.">_dbus_current_generation</a>);
<a name="l01425"></a>01425 
<a name="l01426"></a>01426   HAVE_LOCK_CHECK (connection);
<a name="l01427"></a>01427 
<a name="l01428"></a>01428   old_refcount = <a class="code" href="group__DBusSysdeps.html#gae74c3fcf12acaeccdb152ef907de951c" title="Atomically increments an integer.">_dbus_atomic_inc</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#a6fbf0227071fc20ffd5b0e79aef58e92" title="Reference count.">refcount</a>);
<a name="l01429"></a>01429   _dbus_connection_trace_ref (connection, old_refcount, old_refcount + 1,
<a name="l01430"></a>01430       <span class="stringliteral">&quot;ref_unlocked&quot;</span>);
<a name="l01431"></a>01431 
<a name="l01432"></a>01432   <span class="keywordflow">return</span> connection;
<a name="l01433"></a>01433 }
<a name="l01434"></a>01434 
<a name="l01441"></a>01441 <span class="keywordtype">void</span>
<a name="l01442"></a><a class="code" href="group__DBusConnectionInternals.html#ga9ffbd9aa4f07cb30d92887e956a9fd43">01442</a> <a class="code" href="group__DBusConnectionInternals.html#ga9ffbd9aa4f07cb30d92887e956a9fd43" title="Decrements the reference count of a DBusConnection.">_dbus_connection_unref_unlocked</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l01443"></a>01443 {
<a name="l01444"></a>01444   <a class="code" href="group__DBusTypes.html#gab18afa60e9b17b6e322735bda3d863d8" title="A 32-bit signed integer on all platforms.">dbus_int32_t</a> old_refcount;
<a name="l01445"></a>01445 
<a name="l01446"></a>01446   HAVE_LOCK_CHECK (connection);
<a name="l01447"></a>01447 
<a name="l01448"></a>01448   _dbus_assert (connection != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l01449"></a>01449 
<a name="l01450"></a>01450   old_refcount = <a class="code" href="group__DBusSysdeps.html#ga3c50a069f795dceeb9172fe2b517bbdc" title="Atomically decrement an integer.">_dbus_atomic_dec</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#a6fbf0227071fc20ffd5b0e79aef58e92" title="Reference count.">refcount</a>);
<a name="l01451"></a>01451 
<a name="l01452"></a>01452   _dbus_connection_trace_ref (connection, old_refcount, old_refcount - 1,
<a name="l01453"></a>01453       <span class="stringliteral">&quot;unref_unlocked&quot;</span>);
<a name="l01454"></a>01454 
<a name="l01455"></a>01455   <span class="keywordflow">if</span> (old_refcount == 1)
<a name="l01456"></a>01456     _dbus_connection_last_unref (connection);
<a name="l01457"></a>01457 }
<a name="l01458"></a>01458 
<a name="l01459"></a>01459 <span class="keyword">static</span> <a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a>
<a name="l01460"></a>01460 _dbus_connection_get_next_client_serial (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l01461"></a>01461 {
<a name="l01462"></a>01462   <a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a> serial;
<a name="l01463"></a>01463 
<a name="l01464"></a>01464   serial = connection-&gt;<a class="code" href="structDBusConnection.html#a43d0bb9401103383e13ed3c99baf0daa" title="Client serial.">client_serial</a>++;
<a name="l01465"></a>01465 
<a name="l01466"></a>01466   <span class="keywordflow">if</span> (connection-&gt;<a class="code" href="structDBusConnection.html#a43d0bb9401103383e13ed3c99baf0daa" title="Client serial.">client_serial</a> == 0)
<a name="l01467"></a>01467     connection-&gt;<a class="code" href="structDBusConnection.html#a43d0bb9401103383e13ed3c99baf0daa" title="Client serial.">client_serial</a> = 1;
<a name="l01468"></a>01468 
<a name="l01469"></a>01469   <span class="keywordflow">return</span> serial;
<a name="l01470"></a>01470 }
<a name="l01471"></a>01471 
<a name="l01485"></a>01485 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l01486"></a><a class="code" href="group__DBusConnectionInternals.html#ga12756797bd5c1918aa065f9c37ed7bba">01486</a> <a class="code" href="group__DBusConnectionInternals.html#ga12756797bd5c1918aa065f9c37ed7bba" title="A callback for use with dbus_watch_new() to create a DBusWatch.">_dbus_connection_handle_watch</a> (<a class="code" href="structDBusWatch.html" title="Implementation of DBusWatch.">DBusWatch</a>                   *watch,
<a name="l01487"></a>01487                                <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>                 condition,
<a name="l01488"></a>01488                                <span class="keywordtype">void</span>                        *data)
<a name="l01489"></a>01489 {
<a name="l01490"></a>01490   <a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection;
<a name="l01491"></a>01491   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> retval;
<a name="l01492"></a>01492   <a class="code" href="group__DBusConnection.html#gabf250a32ff740b2a8c99136e0142d8d2" title="Indicates the status of incoming data on a DBusConnection.">DBusDispatchStatus</a> status;
<a name="l01493"></a>01493 
<a name="l01494"></a>01494   connection = data;
<a name="l01495"></a>01495 
<a name="l01496"></a>01496   _dbus_verbose (<span class="stringliteral">&quot;start\n&quot;</span>);
<a name="l01497"></a>01497   
<a name="l01498"></a>01498   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l01499"></a>01499 
<a name="l01500"></a>01500   <span class="keywordflow">if</span> (!_dbus_connection_acquire_io_path (connection, 1))
<a name="l01501"></a>01501     {
<a name="l01502"></a>01502       <span class="comment">/* another thread is handling the message */</span>
<a name="l01503"></a>01503       <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l01504"></a>01504       <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l01505"></a>01505     }
<a name="l01506"></a>01506 
<a name="l01507"></a>01507   HAVE_LOCK_CHECK (connection);
<a name="l01508"></a>01508   retval = <a class="code" href="group__DBusTransport.html#ga4a010098fe079eb6f201ff034d15fdff" title="Handles a watch by reading data, writing data, or disconnecting the transport, as appropriate for the...">_dbus_transport_handle_watch</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>,
<a name="l01509"></a>01509                                          watch, condition);
<a name="l01510"></a>01510 
<a name="l01511"></a>01511   _dbus_connection_release_io_path (connection);
<a name="l01512"></a>01512 
<a name="l01513"></a>01513   HAVE_LOCK_CHECK (connection);
<a name="l01514"></a>01514 
<a name="l01515"></a>01515   _dbus_verbose (<span class="stringliteral">&quot;middle\n&quot;</span>);
<a name="l01516"></a>01516   
<a name="l01517"></a>01517   status = _dbus_connection_get_dispatch_status_unlocked (connection);
<a name="l01518"></a>01518 
<a name="l01519"></a>01519   <span class="comment">/* this calls out to user code */</span>
<a name="l01520"></a>01520   _dbus_connection_update_dispatch_status_and_unlock (connection, status);
<a name="l01521"></a>01521 
<a name="l01522"></a>01522   _dbus_verbose (<span class="stringliteral">&quot;end\n&quot;</span>);
<a name="l01523"></a>01523   
<a name="l01524"></a>01524   <span class="keywordflow">return</span> retval;
<a name="l01525"></a>01525 }
<a name="l01526"></a>01526 
<a name="l01527"></a>01527 <span class="comment">/* Protected by _DBUS_LOCK (shared_connections) */</span>
<a name="l01528"></a>01528 <span class="keyword">static</span> <a class="code" href="structDBusHashTable.html" title="Internals of DBusHashTable.">DBusHashTable</a> *shared_connections = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l01529"></a>01529 <span class="keyword">static</span> <a class="code" href="structDBusList.html" title="A node in a linked list.">DBusList</a> *shared_connections_no_guid = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l01530"></a>01530 
<a name="l01531"></a>01531 <span class="keyword">static</span> <span class="keywordtype">void</span>
<a name="l01532"></a>01532 close_connection_on_shutdown (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l01533"></a>01533 {
<a name="l01534"></a>01534   <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message;
<a name="l01535"></a>01535 
<a name="l01536"></a>01536   <a class="code" href="group__DBusConnection.html#gae34751e15f114217e5ad10c663e2ef2e" title="Increments the reference count of a DBusConnection.">dbus_connection_ref</a> (connection);
<a name="l01537"></a>01537   <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="l01538"></a>01538 
<a name="l01539"></a>01539   <span class="comment">/* Churn through to the Disconnected message */</span>
<a name="l01540"></a>01540   <span class="keywordflow">while</span> ((message = <a class="code" href="group__DBusConnection.html#ga1e40d994ea162ce767e78de1c4988566" title="Returns the first-received message from the incoming message queue, removing it from the queue...">dbus_connection_pop_message</a> (connection)))
<a name="l01541"></a>01541     {
<a name="l01542"></a>01542       <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="l01543"></a>01543     }
<a name="l01544"></a>01544   <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="l01545"></a>01545 }
<a name="l01546"></a>01546 
<a name="l01547"></a>01547 <span class="keyword">static</span> <span class="keywordtype">void</span>
<a name="l01548"></a>01548 shared_connections_shutdown (<span class="keywordtype">void</span> *data)
<a name="l01549"></a>01549 {
<a name="l01550"></a>01550   <span class="keywordtype">int</span> n_entries;
<a name="l01551"></a>01551 
<a name="l01552"></a>01552   <span class="keywordflow">if</span> (!_DBUS_LOCK (shared_connections))
<a name="l01553"></a>01553     {
<a name="l01554"></a>01554       <span class="comment">/* We&#39;d have initialized locks before adding anything, so there</span>
<a name="l01555"></a>01555 <span class="comment">       * can&#39;t be anything there. */</span>
<a name="l01556"></a>01556       <span class="keywordflow">return</span>;
<a name="l01557"></a>01557     }
<a name="l01558"></a>01558 
<a name="l01559"></a>01559   <span class="comment">/* This is a little bit unpleasant... better ideas? */</span>
<a name="l01560"></a>01560   <span class="keywordflow">while</span> ((n_entries = <a class="code" href="group__DBusHashTable.html#gad48297fc27442c19a7c4bd4d1ef9ef77" title="Gets the number of hash entries in a hash table.">_dbus_hash_table_get_n_entries</a> (shared_connections)) &gt; 0)
<a name="l01561"></a>01561     {
<a name="l01562"></a>01562       <a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection;
<a name="l01563"></a>01563       <a class="code" href="structDBusHashIter.html" title="Hash iterator object.">DBusHashIter</a> iter;
<a name="l01564"></a>01564       
<a name="l01565"></a>01565       <a class="code" href="group__DBusHashTable.html#ga1b0e6df8a8617ef0f8f25adfba3acc4c" title="Initializes a hash table iterator.">_dbus_hash_iter_init</a> (shared_connections, &amp;iter);
<a name="l01566"></a>01566       <a class="code" href="group__DBusHashTable.html#ga723e61fcc91ca673e90ff872c07ea19c" title="Move the hash iterator forward one step, to the next hash entry.">_dbus_hash_iter_next</a> (&amp;iter);
<a name="l01567"></a>01567        
<a name="l01568"></a>01568       connection = <a class="code" href="group__DBusHashTable.html#ga34bf277ee37f919bd00516b5ae4e12b5" title="Gets the value of the current entry.">_dbus_hash_iter_get_value</a> (&amp;iter);
<a name="l01569"></a>01569 
<a name="l01570"></a>01570       _DBUS_UNLOCK (shared_connections);
<a name="l01571"></a>01571       close_connection_on_shutdown (connection);
<a name="l01572"></a>01572       <span class="keywordflow">if</span> (!_DBUS_LOCK (shared_connections))
<a name="l01573"></a>01573         _dbus_assert_not_reached (<span class="stringliteral">&quot;global locks were already initialized&quot;</span>);
<a name="l01574"></a>01574 
<a name="l01575"></a>01575       <span class="comment">/* The connection should now be dead and not in our hash ... */</span>
<a name="l01576"></a>01576       _dbus_assert (<a class="code" href="group__DBusHashTable.html#gad48297fc27442c19a7c4bd4d1ef9ef77" title="Gets the number of hash entries in a hash table.">_dbus_hash_table_get_n_entries</a> (shared_connections) &lt; n_entries);
<a name="l01577"></a>01577     }
<a name="l01578"></a>01578 
<a name="l01579"></a>01579   _dbus_assert (<a class="code" href="group__DBusHashTable.html#gad48297fc27442c19a7c4bd4d1ef9ef77" title="Gets the number of hash entries in a hash table.">_dbus_hash_table_get_n_entries</a> (shared_connections) == 0);
<a name="l01580"></a>01580   
<a name="l01581"></a>01581   <a class="code" href="group__DBusHashTable.html#ga96b777e00764b44e0f3216fd8478f5a9" title="Decrements the reference count for a hash table, freeing the hash table if the count reaches zero...">_dbus_hash_table_unref</a> (shared_connections);
<a name="l01582"></a>01582   shared_connections = <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   <span class="keywordflow">if</span> (shared_connections_no_guid != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01585"></a>01585     {
<a name="l01586"></a>01586       <a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection;
<a name="l01587"></a>01587       connection = <a class="code" href="group__DBusList.html#gacb96c9d3e9a869e63b8db4f8913a5a60" title="Removes the first value in the list and returns it.">_dbus_list_pop_first</a> (&amp;shared_connections_no_guid);
<a name="l01588"></a>01588       <span class="keywordflow">while</span> (connection != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01589"></a>01589         {
<a name="l01590"></a>01590           _DBUS_UNLOCK (shared_connections);
<a name="l01591"></a>01591           close_connection_on_shutdown (connection);
<a name="l01592"></a>01592           <span class="keywordflow">if</span> (!_DBUS_LOCK (shared_connections))
<a name="l01593"></a>01593             _dbus_assert_not_reached (<span class="stringliteral">&quot;global locks were already initialized&quot;</span>);
<a name="l01594"></a>01594           connection = <a class="code" href="group__DBusList.html#gacb96c9d3e9a869e63b8db4f8913a5a60" title="Removes the first value in the list and returns it.">_dbus_list_pop_first</a> (&amp;shared_connections_no_guid);
<a name="l01595"></a>01595         }
<a name="l01596"></a>01596     }
<a name="l01597"></a>01597 
<a name="l01598"></a>01598   shared_connections_no_guid = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l01599"></a>01599   
<a name="l01600"></a>01600   _DBUS_UNLOCK (shared_connections);
<a name="l01601"></a>01601 }
<a name="l01602"></a>01602 
<a name="l01603"></a>01603 <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="l01604"></a>01604 connection_lookup_shared (<a class="code" href="structDBusAddressEntry.html" title="Internals of DBusAddressEntry.">DBusAddressEntry</a>  *entry,
<a name="l01605"></a>01605                           <a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>   **result)
<a name="l01606"></a>01606 {
<a name="l01607"></a>01607   _dbus_verbose (<span class="stringliteral">&quot;checking for existing connection\n&quot;</span>);
<a name="l01608"></a>01608   
<a name="l01609"></a>01609   *result = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l01610"></a>01610 
<a name="l01611"></a>01611   <span class="keywordflow">if</span> (!_DBUS_LOCK (shared_connections))
<a name="l01612"></a>01612     {
<a name="l01613"></a>01613       <span class="comment">/* If it was shared, we&#39;d have initialized global locks when we put</span>
<a name="l01614"></a>01614 <span class="comment">       * it in shared_connections. */</span>
<a name="l01615"></a>01615       <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l01616"></a>01616     }
<a name="l01617"></a>01617 
<a name="l01618"></a>01618   <span class="keywordflow">if</span> (shared_connections == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01619"></a>01619     {
<a name="l01620"></a>01620       _dbus_verbose (<span class="stringliteral">&quot;creating shared_connections hash table\n&quot;</span>);
<a name="l01621"></a>01621       
<a name="l01622"></a>01622       shared_connections = <a class="code" href="group__DBusHashTable.html#gac8e434348a354b9606d4c50c127a5eb4" title="Constructs a new hash table.">_dbus_hash_table_new</a> (<a class="code" href="group__DBusHashTable.html#ggab0ab9767ffa5b6720a13b3d741630852a481fd0166d28da725b3e97f15192434e" title="Hash keys are strings.">DBUS_HASH_STRING</a>,
<a name="l01623"></a>01623                                                  <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>,
<a name="l01624"></a>01624                                                  <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l01625"></a>01625       <span class="keywordflow">if</span> (shared_connections == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01626"></a>01626         {
<a name="l01627"></a>01627           _DBUS_UNLOCK (shared_connections);
<a name="l01628"></a>01628           <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l01629"></a>01629         }
<a name="l01630"></a>01630 
<a name="l01631"></a>01631       <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> (shared_connections_shutdown, <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>))
<a name="l01632"></a>01632         {
<a name="l01633"></a>01633           <a class="code" href="group__DBusHashTable.html#ga96b777e00764b44e0f3216fd8478f5a9" title="Decrements the reference count for a hash table, freeing the hash table if the count reaches zero...">_dbus_hash_table_unref</a> (shared_connections);
<a name="l01634"></a>01634           shared_connections = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l01635"></a>01635           _DBUS_UNLOCK (shared_connections);
<a name="l01636"></a>01636           <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l01637"></a>01637         }
<a name="l01638"></a>01638 
<a name="l01639"></a>01639       _dbus_verbose (<span class="stringliteral">&quot;  successfully created shared_connections\n&quot;</span>);
<a name="l01640"></a>01640       
<a name="l01641"></a>01641       _DBUS_UNLOCK (shared_connections);
<a name="l01642"></a>01642       <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>; <span class="comment">/* no point looking up in the hash we just made */</span>
<a name="l01643"></a>01643     }
<a name="l01644"></a>01644   <span class="keywordflow">else</span>
<a name="l01645"></a>01645     {
<a name="l01646"></a>01646       <span class="keyword">const</span> <span class="keywordtype">char</span> *guid;
<a name="l01647"></a>01647 
<a name="l01648"></a>01648       guid = <a class="code" href="group__DBusAddress.html#gae6f014689b49099e835b1f97d032034e" title="Returns a value from a key of an entry.">dbus_address_entry_get_value</a> (entry, <span class="stringliteral">&quot;guid&quot;</span>);
<a name="l01649"></a>01649       
<a name="l01650"></a>01650       <span class="keywordflow">if</span> (guid != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01651"></a>01651         {
<a name="l01652"></a>01652           <a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection;
<a name="l01653"></a>01653           
<a name="l01654"></a>01654           connection = <a class="code" href="group__DBusHashTable.html#gad51eb3fe682721dd4f6a920ca87cb730" title="Looks up the value for a given string in a hash table of type DBUS_HASH_STRING.">_dbus_hash_table_lookup_string</a> (shared_connections,
<a name="l01655"></a>01655                                                        guid);
<a name="l01656"></a>01656 
<a name="l01657"></a>01657           <span class="keywordflow">if</span> (connection)
<a name="l01658"></a>01658             {
<a name="l01659"></a>01659               <span class="comment">/* The DBusConnection can&#39;t be finalized without taking</span>
<a name="l01660"></a>01660 <span class="comment">               * the shared_connections lock to remove it from the</span>
<a name="l01661"></a>01661 <span class="comment">               * hash.  So it&#39;s safe to ref the connection here.</span>
<a name="l01662"></a>01662 <span class="comment">               * However, it may be disconnected if the Disconnected</span>
<a name="l01663"></a>01663 <span class="comment">               * message hasn&#39;t been processed yet, in which case we</span>
<a name="l01664"></a>01664 <span class="comment">               * want to pretend it isn&#39;t in the hash and avoid</span>
<a name="l01665"></a>01665 <span class="comment">               * returning it.</span>
<a name="l01666"></a>01666 <span class="comment">               *</span>
<a name="l01667"></a>01667 <span class="comment">               * The idea is to avoid ever returning a disconnected connection</span>
<a name="l01668"></a>01668 <span class="comment">               * from dbus_connection_open(). We could just synchronously</span>
<a name="l01669"></a>01669 <span class="comment">               * drop our shared ref to the connection on connection disconnect,</span>
<a name="l01670"></a>01670 <span class="comment">               * and then assert here that the connection is connected, but</span>
<a name="l01671"></a>01671 <span class="comment">               * that causes reentrancy headaches.</span>
<a name="l01672"></a>01672 <span class="comment">               */</span>
<a name="l01673"></a>01673               <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l01674"></a>01674               <span class="keywordflow">if</span> (_dbus_connection_get_is_connected_unlocked (connection))
<a name="l01675"></a>01675                 {
<a name="l01676"></a>01676                   <a class="code" href="group__DBusConnectionInternals.html#ga7151f75b5d2308ec80cfe893aba72aa1" title="Increments the reference count of a DBusConnection.">_dbus_connection_ref_unlocked</a> (connection);
<a name="l01677"></a>01677                   *result = connection;
<a name="l01678"></a>01678                   _dbus_verbose (<span class="stringliteral">&quot;looked up existing connection to server guid %s\n&quot;</span>,
<a name="l01679"></a>01679                                  guid);
<a name="l01680"></a>01680                 }
<a name="l01681"></a>01681               <span class="keywordflow">else</span>
<a name="l01682"></a>01682                 {
<a name="l01683"></a>01683                   _dbus_verbose (<span class="stringliteral">&quot;looked up existing connection to server guid %s but it was disconnected so ignoring it\n&quot;</span>,
<a name="l01684"></a>01684                                  guid);
<a name="l01685"></a>01685                 }
<a name="l01686"></a>01686               <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l01687"></a>01687             }
<a name="l01688"></a>01688         }
<a name="l01689"></a>01689       
<a name="l01690"></a>01690       _DBUS_UNLOCK (shared_connections);
<a name="l01691"></a>01691       <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l01692"></a>01692     }
<a name="l01693"></a>01693 }
<a name="l01694"></a>01694 
<a name="l01695"></a>01695 <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="l01696"></a>01696 connection_record_shared_unlocked (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l01697"></a>01697                                    <span class="keyword">const</span> <span class="keywordtype">char</span>     *guid)
<a name="l01698"></a>01698 {
<a name="l01699"></a>01699   <span class="keywordtype">char</span> *guid_key;
<a name="l01700"></a>01700   <span class="keywordtype">char</span> *guid_in_connection;
<a name="l01701"></a>01701 
<a name="l01702"></a>01702   HAVE_LOCK_CHECK (connection);
<a name="l01703"></a>01703   _dbus_assert (connection-&gt;<a class="code" href="structDBusConnection.html#ad1abb7ad98db87f32b4abda22df075bd" title="GUID of server if we are in shared_connections, NULL if server GUID is unknown or connection is priva...">server_guid</a> == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l01704"></a>01704   _dbus_assert (connection-&gt;<a class="code" href="structDBusConnection.html#aae47138b9b2494b65072ff300d631aa8" title="TRUE if libdbus owns a reference to the connection and can return it from dbus_connection_open() more...">shareable</a>);
<a name="l01705"></a>01705 
<a name="l01706"></a>01706   <span class="comment">/* get a hard ref on this connection, even if</span>
<a name="l01707"></a>01707 <span class="comment">   * we won&#39;t in fact store it in the hash, we still</span>
<a name="l01708"></a>01708 <span class="comment">   * need to hold a ref on it until it&#39;s disconnected.</span>
<a name="l01709"></a>01709 <span class="comment">   */</span>
<a name="l01710"></a>01710   <a class="code" href="group__DBusConnectionInternals.html#ga7151f75b5d2308ec80cfe893aba72aa1" title="Increments the reference count of a DBusConnection.">_dbus_connection_ref_unlocked</a> (connection);
<a name="l01711"></a>01711 
<a name="l01712"></a>01712   <span class="keywordflow">if</span> (guid == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01713"></a>01713     {
<a name="l01714"></a>01714       <span class="keywordflow">if</span> (!_DBUS_LOCK (shared_connections))
<a name="l01715"></a>01715         <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l01716"></a>01716 
<a name="l01717"></a>01717       <span class="keywordflow">if</span> (!<a class="code" href="group__DBusList.html#gab4aa60e0466ac7075f3d1751909d6a52" title="Prepends a value to the list.">_dbus_list_prepend</a> (&amp;shared_connections_no_guid, connection))
<a name="l01718"></a>01718         {
<a name="l01719"></a>01719           _DBUS_UNLOCK (shared_connections);
<a name="l01720"></a>01720           <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l01721"></a>01721         }
<a name="l01722"></a>01722 
<a name="l01723"></a>01723       _DBUS_UNLOCK (shared_connections);
<a name="l01724"></a>01724       <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>; <span class="comment">/* don&#39;t store in the hash */</span>
<a name="l01725"></a>01725     }
<a name="l01726"></a>01726   
<a name="l01727"></a>01727   <span class="comment">/* A separate copy of the key is required in the hash table, because</span>
<a name="l01728"></a>01728 <span class="comment">   * we don&#39;t have a lock on the connection when we are doing a hash</span>
<a name="l01729"></a>01729 <span class="comment">   * lookup.</span>
<a name="l01730"></a>01730 <span class="comment">   */</span>
<a name="l01731"></a>01731   
<a name="l01732"></a>01732   guid_key = <a class="code" href="group__DBusInternalsUtils.html#ga9d00d77f6595b9d7ac1baf59d44bf58c" title="Duplicates a string.">_dbus_strdup</a> (guid);
<a name="l01733"></a>01733   <span class="keywordflow">if</span> (guid_key == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01734"></a>01734     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l01735"></a>01735 
<a name="l01736"></a>01736   guid_in_connection = <a class="code" href="group__DBusInternalsUtils.html#ga9d00d77f6595b9d7ac1baf59d44bf58c" title="Duplicates a string.">_dbus_strdup</a> (guid);
<a name="l01737"></a>01737   <span class="keywordflow">if</span> (guid_in_connection == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01738"></a>01738     {
<a name="l01739"></a>01739       <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> (guid_key);
<a name="l01740"></a>01740       <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l01741"></a>01741     }
<a name="l01742"></a>01742 
<a name="l01743"></a>01743   <span class="keywordflow">if</span> (!_DBUS_LOCK (shared_connections))
<a name="l01744"></a>01744     {
<a name="l01745"></a>01745       <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> (guid_in_connection);
<a name="l01746"></a>01746       <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> (guid_key);
<a name="l01747"></a>01747       <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l01748"></a>01748     }
<a name="l01749"></a>01749 
<a name="l01750"></a>01750   _dbus_assert (shared_connections != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l01751"></a>01751   
<a name="l01752"></a>01752   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusHashTable.html#ga43e98a91a11952824c544330e19f6c22" title="Creates a hash entry with the given key and value.">_dbus_hash_table_insert_string</a> (shared_connections,
<a name="l01753"></a>01753                                        guid_key, connection))
<a name="l01754"></a>01754     {
<a name="l01755"></a>01755       <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> (guid_key);
<a name="l01756"></a>01756       <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> (guid_in_connection);
<a name="l01757"></a>01757       _DBUS_UNLOCK (shared_connections);
<a name="l01758"></a>01758       <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l01759"></a>01759     }
<a name="l01760"></a>01760 
<a name="l01761"></a>01761   connection-&gt;<a class="code" href="structDBusConnection.html#ad1abb7ad98db87f32b4abda22df075bd" title="GUID of server if we are in shared_connections, NULL if server GUID is unknown or connection is priva...">server_guid</a> = guid_in_connection;
<a name="l01762"></a>01762 
<a name="l01763"></a>01763   _dbus_verbose (<span class="stringliteral">&quot;stored connection to %s to be shared\n&quot;</span>,
<a name="l01764"></a>01764                  connection-&gt;<a class="code" href="structDBusConnection.html#ad1abb7ad98db87f32b4abda22df075bd" title="GUID of server if we are in shared_connections, NULL if server GUID is unknown or connection is priva...">server_guid</a>);
<a name="l01765"></a>01765   
<a name="l01766"></a>01766   _DBUS_UNLOCK (shared_connections);
<a name="l01767"></a>01767 
<a name="l01768"></a>01768   _dbus_assert (connection-&gt;<a class="code" href="structDBusConnection.html#ad1abb7ad98db87f32b4abda22df075bd" title="GUID of server if we are in shared_connections, NULL if server GUID is unknown or connection is priva...">server_guid</a> != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l01769"></a>01769   
<a name="l01770"></a>01770   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l01771"></a>01771 }
<a name="l01772"></a>01772 
<a name="l01773"></a>01773 <span class="keyword">static</span> <span class="keywordtype">void</span>
<a name="l01774"></a>01774 connection_forget_shared_unlocked (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l01775"></a>01775 {
<a name="l01776"></a>01776   HAVE_LOCK_CHECK (connection);
<a name="l01777"></a>01777 
<a name="l01778"></a>01778   <span class="keywordflow">if</span> (!connection-&gt;<a class="code" href="structDBusConnection.html#aae47138b9b2494b65072ff300d631aa8" title="TRUE if libdbus owns a reference to the connection and can return it from dbus_connection_open() more...">shareable</a>)
<a name="l01779"></a>01779     <span class="keywordflow">return</span>;
<a name="l01780"></a>01780 
<a name="l01781"></a>01781   <span class="keywordflow">if</span> (!_DBUS_LOCK (shared_connections))
<a name="l01782"></a>01782     {
<a name="l01783"></a>01783       <span class="comment">/* If it was shared, we&#39;d have initialized global locks when we put</span>
<a name="l01784"></a>01784 <span class="comment">       * it in the table; so it can&#39;t be there. */</span>
<a name="l01785"></a>01785       <span class="keywordflow">return</span>;
<a name="l01786"></a>01786     }
<a name="l01787"></a>01787 
<a name="l01788"></a>01788   <span class="keywordflow">if</span> (connection-&gt;<a class="code" href="structDBusConnection.html#ad1abb7ad98db87f32b4abda22df075bd" title="GUID of server if we are in shared_connections, NULL if server GUID is unknown or connection is priva...">server_guid</a> != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01789"></a>01789     {
<a name="l01790"></a>01790       _dbus_verbose (<span class="stringliteral">&quot;dropping connection to %s out of the shared table\n&quot;</span>,
<a name="l01791"></a>01791                      connection-&gt;<a class="code" href="structDBusConnection.html#ad1abb7ad98db87f32b4abda22df075bd" title="GUID of server if we are in shared_connections, NULL if server GUID is unknown or connection is priva...">server_guid</a>);
<a name="l01792"></a>01792       
<a name="l01793"></a>01793       <span class="keywordflow">if</span> (!<a class="code" href="group__DBusHashTable.html#ga388d50ce1a07bf0790b9f2ecdb08a396" title="Removes the hash entry for the given key.">_dbus_hash_table_remove_string</a> (shared_connections,
<a name="l01794"></a>01794                                            connection-&gt;<a class="code" href="structDBusConnection.html#ad1abb7ad98db87f32b4abda22df075bd" title="GUID of server if we are in shared_connections, NULL if server GUID is unknown or connection is priva...">server_guid</a>))
<a name="l01795"></a>01795         _dbus_assert_not_reached (<span class="stringliteral">&quot;connection was not in the shared table&quot;</span>);
<a name="l01796"></a>01796       
<a name="l01797"></a>01797       <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> (connection-&gt;<a class="code" href="structDBusConnection.html#ad1abb7ad98db87f32b4abda22df075bd" title="GUID of server if we are in shared_connections, NULL if server GUID is unknown or connection is priva...">server_guid</a>);
<a name="l01798"></a>01798       connection-&gt;<a class="code" href="structDBusConnection.html#ad1abb7ad98db87f32b4abda22df075bd" title="GUID of server if we are in shared_connections, NULL if server GUID is unknown or connection is priva...">server_guid</a> = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l01799"></a>01799     }
<a name="l01800"></a>01800   <span class="keywordflow">else</span>
<a name="l01801"></a>01801     {
<a name="l01802"></a>01802       <a class="code" href="group__DBusList.html#ga202e6ac8ad3e4a9d4413e0248ffcf3e3" title="Removes a value from the list.">_dbus_list_remove</a> (&amp;shared_connections_no_guid, connection);
<a name="l01803"></a>01803     }
<a name="l01804"></a>01804 
<a name="l01805"></a>01805   _DBUS_UNLOCK (shared_connections);
<a name="l01806"></a>01806   
<a name="l01807"></a>01807   <span class="comment">/* remove our reference held on all shareable connections */</span>
<a name="l01808"></a>01808   <a class="code" href="group__DBusConnectionInternals.html#ga9ffbd9aa4f07cb30d92887e956a9fd43" title="Decrements the reference count of a DBusConnection.">_dbus_connection_unref_unlocked</a> (connection);
<a name="l01809"></a>01809 }
<a name="l01810"></a>01810 
<a name="l01811"></a>01811 <span class="keyword">static</span> <a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>*
<a name="l01812"></a>01812 connection_try_from_address_entry (<a class="code" href="structDBusAddressEntry.html" title="Internals of DBusAddressEntry.">DBusAddressEntry</a> *entry,
<a name="l01813"></a>01813                                    <a class="code" href="structDBusError.html" title="Object representing an exception.">DBusError</a>        *error)
<a name="l01814"></a>01814 {
<a name="l01815"></a>01815   <a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport;
<a name="l01816"></a>01816   <a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection;
<a name="l01817"></a>01817 
<a name="l01818"></a>01818   transport = <a class="code" href="group__DBusTransport.html#ga0893897223056c89f33b2641a7b21cf8" title="Try to open a new transport for the given address entry.">_dbus_transport_open</a> (entry, error);
<a name="l01819"></a>01819 
<a name="l01820"></a>01820   <span class="keywordflow">if</span> (transport == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01821"></a>01821     {
<a name="l01822"></a>01822       _DBUS_ASSERT_ERROR_IS_SET (error);
<a name="l01823"></a>01823       <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="l01824"></a>01824     }
<a name="l01825"></a>01825 
<a name="l01826"></a>01826   connection = <a class="code" href="group__DBusConnectionInternals.html#ga2cdffe9215251b69cb39ff36b9f50e6c" title="Creates a new connection for the given transport.">_dbus_connection_new_for_transport</a> (transport);
<a name="l01827"></a>01827 
<a name="l01828"></a>01828   <a class="code" href="group__DBusTransport.html#gab7c53c32a2320c81aae8ce4345762e73" title="Decrements the reference count for the transport.">_dbus_transport_unref</a> (transport);
<a name="l01829"></a>01829   
<a name="l01830"></a>01830   <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="l01831"></a>01831     {
<a name="l01832"></a>01832       _DBUS_SET_OOM (error);
<a name="l01833"></a>01833       <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="l01834"></a>01834     }
<a name="l01835"></a>01835 
<a name="l01836"></a>01836 <span class="preprocessor">#ifndef DBUS_DISABLE_CHECKS</span>
<a name="l01837"></a>01837 <span class="preprocessor"></span>  _dbus_assert (!connection-&gt;<a class="code" href="structDBusConnection.html#a336a7953a4a28e55f6e6a07acfa11df3" title="Used to check locking.">have_connection_lock</a>);
<a name="l01838"></a>01838 <span class="preprocessor">#endif</span>
<a name="l01839"></a>01839 <span class="preprocessor"></span>  <span class="keywordflow">return</span> connection;
<a name="l01840"></a>01840 }
<a name="l01841"></a>01841 
<a name="l01842"></a>01842 <span class="comment">/*</span>
<a name="l01843"></a>01843 <span class="comment"> * If the shared parameter is true, then any existing connection will</span>
<a name="l01844"></a>01844 <span class="comment"> * be used (and if a new connection is created, it will be available</span>
<a name="l01845"></a>01845 <span class="comment"> * for use by others). If the shared parameter is false, a new</span>
<a name="l01846"></a>01846 <span class="comment"> * connection will always be created, and the new connection will</span>
<a name="l01847"></a>01847 <span class="comment"> * never be returned to other callers.</span>
<a name="l01848"></a>01848 <span class="comment"> *</span>
<a name="l01849"></a>01849 <span class="comment"> * @param address the address</span>
<a name="l01850"></a>01850 <span class="comment"> * @param shared whether the connection is shared or private</span>
<a name="l01851"></a>01851 <span class="comment"> * @param error error return</span>
<a name="l01852"></a>01852 <span class="comment"> * @returns the connection or #NULL on error</span>
<a name="l01853"></a>01853 <span class="comment"> */</span>
<a name="l01854"></a>01854 <span class="keyword">static</span> <a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>*
<a name="l01855"></a>01855 _dbus_connection_open_internal (<span class="keyword">const</span> <span class="keywordtype">char</span>     *address,
<a name="l01856"></a>01856                                 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>     shared,
<a name="l01857"></a>01857                                 <a class="code" href="structDBusError.html" title="Object representing an exception.">DBusError</a>      *error)
<a name="l01858"></a>01858 {
<a name="l01859"></a>01859   <a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection;
<a name="l01860"></a>01860   <a class="code" href="structDBusAddressEntry.html" title="Internals of DBusAddressEntry.">DBusAddressEntry</a> **entries;
<a name="l01861"></a>01861   <a class="code" href="structDBusError.html" title="Object representing an exception.">DBusError</a> tmp_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="l01862"></a>01862   <a class="code" href="structDBusError.html" title="Object representing an exception.">DBusError</a> first_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="l01863"></a>01863   <span class="keywordtype">int</span> len, i;
<a name="l01864"></a>01864 
<a name="l01865"></a>01865   _DBUS_ASSERT_ERROR_IS_CLEAR (error);
<a name="l01866"></a>01866 
<a name="l01867"></a>01867   _dbus_verbose (<span class="stringliteral">&quot;opening %s connection to: %s\n&quot;</span>,
<a name="l01868"></a>01868                  shared ? <span class="stringliteral">&quot;shared&quot;</span> : <span class="stringliteral">&quot;private&quot;</span>, address);
<a name="l01869"></a>01869   
<a name="l01870"></a>01870   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusAddress.html#ga3cbf5947262b79601598276c720e2098" title="Parses an address string of the form:">dbus_parse_address</a> (address, &amp;entries, &amp;len, error))
<a name="l01871"></a>01871     <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="l01872"></a>01872 
<a name="l01873"></a>01873   _DBUS_ASSERT_ERROR_IS_CLEAR (error);
<a name="l01874"></a>01874   
<a name="l01875"></a>01875   connection = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l01876"></a>01876 
<a name="l01877"></a>01877   <span class="keywordflow">for</span> (i = 0; i &lt; len; i++)
<a name="l01878"></a>01878     {
<a name="l01879"></a>01879       <span class="keywordflow">if</span> (shared)
<a name="l01880"></a>01880         {
<a name="l01881"></a>01881           <span class="keywordflow">if</span> (!connection_lookup_shared (entries[i], &amp;connection))
<a name="l01882"></a>01882             _DBUS_SET_OOM (&amp;tmp_error);
<a name="l01883"></a>01883         }
<a name="l01884"></a>01884 
<a name="l01885"></a>01885       <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="l01886"></a>01886         {
<a name="l01887"></a>01887           connection = connection_try_from_address_entry (entries[i],
<a name="l01888"></a>01888                                                           &amp;tmp_error);
<a name="l01889"></a>01889 
<a name="l01890"></a>01890           <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> &amp;&amp; shared)
<a name="l01891"></a>01891             {
<a name="l01892"></a>01892               <span class="keyword">const</span> <span class="keywordtype">char</span> *guid;
<a name="l01893"></a>01893                   
<a name="l01894"></a>01894               connection-&gt;<a class="code" href="structDBusConnection.html#aae47138b9b2494b65072ff300d631aa8" title="TRUE if libdbus owns a reference to the connection and can return it from dbus_connection_open() more...">shareable</a> = <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l01895"></a>01895                   
<a name="l01896"></a>01896               <span class="comment">/* guid may be NULL */</span>
<a name="l01897"></a>01897               guid = <a class="code" href="group__DBusAddress.html#gae6f014689b49099e835b1f97d032034e" title="Returns a value from a key of an entry.">dbus_address_entry_get_value</a> (entries[i], <span class="stringliteral">&quot;guid&quot;</span>);
<a name="l01898"></a>01898                   
<a name="l01899"></a>01899               <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l01900"></a>01900           
<a name="l01901"></a>01901               <span class="keywordflow">if</span> (!connection_record_shared_unlocked (connection, guid))
<a name="l01902"></a>01902                 {
<a name="l01903"></a>01903                   _DBUS_SET_OOM (&amp;tmp_error);
<a name="l01904"></a>01904                   _dbus_connection_close_possibly_shared_and_unlock (connection);
<a name="l01905"></a>01905                   <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="l01906"></a>01906                   connection = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l01907"></a>01907                 }
<a name="l01908"></a>01908               <span class="keywordflow">else</span>
<a name="l01909"></a>01909                 <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l01910"></a>01910             }
<a name="l01911"></a>01911         }
<a name="l01912"></a>01912       
<a name="l01913"></a>01913       <span class="keywordflow">if</span> (connection)
<a name="l01914"></a>01914         <span class="keywordflow">break</span>;
<a name="l01915"></a>01915 
<a name="l01916"></a>01916       _DBUS_ASSERT_ERROR_IS_SET (&amp;tmp_error);
<a name="l01917"></a>01917       
<a name="l01918"></a>01918       <span class="keywordflow">if</span> (i == 0)
<a name="l01919"></a>01919         <a class="code" href="group__DBusErrors.html#ga0a27fb9f1af0c2bfd105d7e8622b93f4" title="Moves an error src into dest, freeing src and overwriting dest.">dbus_move_error</a> (&amp;tmp_error, &amp;first_error);
<a name="l01920"></a>01920       <span class="keywordflow">else</span>
<a name="l01921"></a>01921         <a class="code" href="group__DBusErrors.html#gaac6c14ead14829ee4e090f39de6a7568" title="Frees an error that&#39;s been set (or just initialized), then reinitializes the error as in dbus_error_i...">dbus_error_free</a> (&amp;tmp_error);
<a name="l01922"></a>01922     }
<a name="l01923"></a>01923   
<a name="l01924"></a>01924   _DBUS_ASSERT_ERROR_IS_CLEAR (error);
<a name="l01925"></a>01925   _DBUS_ASSERT_ERROR_IS_CLEAR (&amp;tmp_error);
<a name="l01926"></a>01926   
<a name="l01927"></a>01927   <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="l01928"></a>01928     {
<a name="l01929"></a>01929       _DBUS_ASSERT_ERROR_IS_SET (&amp;first_error);
<a name="l01930"></a>01930       <a class="code" href="group__DBusErrors.html#ga0a27fb9f1af0c2bfd105d7e8622b93f4" title="Moves an error src into dest, freeing src and overwriting dest.">dbus_move_error</a> (&amp;first_error, error);
<a name="l01931"></a>01931     }
<a name="l01932"></a>01932   <span class="keywordflow">else</span>
<a name="l01933"></a>01933     <a class="code" href="group__DBusErrors.html#gaac6c14ead14829ee4e090f39de6a7568" title="Frees an error that&#39;s been set (or just initialized), then reinitializes the error as in dbus_error_i...">dbus_error_free</a> (&amp;first_error);
<a name="l01934"></a>01934   
<a name="l01935"></a>01935   <a class="code" href="group__DBusAddress.html#ga37a7009b07cf991ff07f3e86d71bf352" title="Frees a NULL-terminated array of address entries.">dbus_address_entries_free</a> (entries);
<a name="l01936"></a>01936   <span class="keywordflow">return</span> connection;
<a name="l01937"></a>01937 }
<a name="l01938"></a>01938 
<a name="l01947"></a>01947 <span class="keywordtype">void</span>
<a name="l01948"></a><a class="code" href="group__DBusConnectionInternals.html#gadc46f7abfe925f9860fc8c64aeb29ad2">01948</a> <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> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l01949"></a>01949 {
<a name="l01950"></a>01950   _dbus_assert (connection != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l01951"></a>01951   _dbus_assert (connection-&gt;generation == <a class="code" href="group__DBusMemoryInternals.html#ga7c224d82013e2bdc181c1d85dcb6f295" title="_dbus_current_generation is used to track each time that dbus_shutdown() is called, so we can reinit things after it&#39;s been called.">_dbus_current_generation</a>);
<a name="l01952"></a>01952 
<a name="l01953"></a>01953   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l01954"></a>01954   _dbus_connection_close_possibly_shared_and_unlock (connection);
<a name="l01955"></a>01955 }
<a name="l01956"></a>01956 
<a name="l01957"></a>01957 <span class="keyword">static</span> <a class="code" href="structDBusPreallocatedSend.html" title="Internals of DBusPreallocatedSend.">DBusPreallocatedSend</a>*
<a name="l01958"></a>01958 _dbus_connection_preallocate_send_unlocked (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l01959"></a>01959 {
<a name="l01960"></a>01960   <a class="code" href="structDBusPreallocatedSend.html" title="Internals of DBusPreallocatedSend.">DBusPreallocatedSend</a> *preallocated;
<a name="l01961"></a>01961 
<a name="l01962"></a>01962   HAVE_LOCK_CHECK (connection);
<a name="l01963"></a>01963   
<a name="l01964"></a>01964   _dbus_assert (connection != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l01965"></a>01965   
<a name="l01966"></a>01966   preallocated = <a class="code" href="group__DBusMemory.html#ga54ccb556e7964112a825a7f46c156ca0" title="Safe macro for using dbus_malloc().">dbus_new</a> (<a class="code" href="structDBusPreallocatedSend.html" title="Internals of DBusPreallocatedSend.">DBusPreallocatedSend</a>, 1);
<a name="l01967"></a>01967   <span class="keywordflow">if</span> (preallocated == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01968"></a>01968     <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="l01969"></a>01969 
<a name="l01970"></a>01970   preallocated-&gt;<a class="code" href="structDBusPreallocatedSend.html#ae164fe13f866bebbd714b526104c5bff" title="Preallocated link in the queue.">queue_link</a> = <a class="code" href="group__DBusList.html#gac20b9981531cef590d49a59240344cd8" title="Allocates a linked list node.">_dbus_list_alloc_link</a> (<a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l01971"></a>01971   <span class="keywordflow">if</span> (preallocated-&gt;<a class="code" href="structDBusPreallocatedSend.html#ae164fe13f866bebbd714b526104c5bff" title="Preallocated link in the queue.">queue_link</a> == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01972"></a>01972     <span class="keywordflow">goto</span> failed_0;
<a name="l01973"></a>01973 
<a name="l01974"></a>01974   preallocated-&gt;<a class="code" href="structDBusPreallocatedSend.html#aae6c1bd98f78491482d5f59b6ef138d4" title="Preallocated link in the resource counter.">counter_link</a> = <a class="code" href="group__DBusList.html#gac20b9981531cef590d49a59240344cd8" title="Allocates a linked list node.">_dbus_list_alloc_link</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a5dcb660883904035076579c6d2f46501" title="Counts size of outgoing messages.">outgoing_counter</a>);
<a name="l01975"></a>01975   <span class="keywordflow">if</span> (preallocated-&gt;<a class="code" href="structDBusPreallocatedSend.html#aae6c1bd98f78491482d5f59b6ef138d4" title="Preallocated link in the resource counter.">counter_link</a> == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01976"></a>01976     <span class="keywordflow">goto</span> failed_1;
<a name="l01977"></a>01977 
<a name="l01978"></a>01978   <a class="code" href="group__DBusResources.html#gae93240c77bfb66642453518c9bb90bc4" title="Increments refcount of the counter.">_dbus_counter_ref</a> (preallocated-&gt;<a class="code" href="structDBusPreallocatedSend.html#aae6c1bd98f78491482d5f59b6ef138d4" title="Preallocated link in the resource counter.">counter_link</a>-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a>);
<a name="l01979"></a>01979 
<a name="l01980"></a>01980   preallocated-&gt;<a class="code" href="structDBusPreallocatedSend.html#a465af3647772c89500df0b46f43d035b" title="Connection we&#39;d send the message to.">connection</a> = connection;
<a name="l01981"></a>01981   
<a name="l01982"></a>01982   <span class="keywordflow">return</span> preallocated;
<a name="l01983"></a>01983   
<a name="l01984"></a>01984  failed_1:
<a name="l01985"></a>01985   <a class="code" href="group__DBusList.html#ga6e824f717125ce40c549d5402e32610f" title="Frees a linked list node allocated with _dbus_list_alloc_link.">_dbus_list_free_link</a> (preallocated-&gt;<a class="code" href="structDBusPreallocatedSend.html#ae164fe13f866bebbd714b526104c5bff" title="Preallocated link in the queue.">queue_link</a>);
<a name="l01986"></a>01986  failed_0:
<a name="l01987"></a>01987   <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> (preallocated);
<a name="l01988"></a>01988   
<a name="l01989"></a>01989   <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="l01990"></a>01990 }
<a name="l01991"></a>01991 
<a name="l01992"></a>01992 <span class="comment">/* Called with lock held, does not update dispatch status */</span>
<a name="l01993"></a>01993 <span class="keyword">static</span> <span class="keywordtype">void</span>
<a name="l01994"></a>01994 _dbus_connection_send_preallocated_unlocked_no_update (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>       *connection,
<a name="l01995"></a>01995                                                        <a class="code" href="structDBusPreallocatedSend.html" title="Internals of DBusPreallocatedSend.">DBusPreallocatedSend</a> *preallocated,
<a name="l01996"></a>01996                                                        <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>          *message,
<a name="l01997"></a>01997                                                        <a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a>        *client_serial)
<a name="l01998"></a>01998 {
<a name="l01999"></a>01999   <a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a> serial;
<a name="l02000"></a>02000 
<a name="l02001"></a>02001   preallocated-&gt;<a class="code" href="structDBusPreallocatedSend.html#ae164fe13f866bebbd714b526104c5bff" title="Preallocated link in the queue.">queue_link</a>-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a> = message;
<a name="l02002"></a>02002   <a class="code" href="group__DBusList.html#gab3dd068e3bd8a319c0d12150785050a7" title="Prepends a link to the list.">_dbus_list_prepend_link</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#a714fd51af8730c367b079594c7f756ae" title="Queue of messages we need to send, send the end of the list first.">outgoing_messages</a>,
<a name="l02003"></a>02003                            preallocated-&gt;<a class="code" href="structDBusPreallocatedSend.html#ae164fe13f866bebbd714b526104c5bff" title="Preallocated link in the queue.">queue_link</a>);
<a name="l02004"></a>02004 
<a name="l02005"></a>02005   <span class="comment">/* It&#39;s OK that we&#39;ll never call the notify function, because for the</span>
<a name="l02006"></a>02006 <span class="comment">   * outgoing limit, there isn&#39;t one */</span>
<a name="l02007"></a>02007   <a class="code" href="group__DBusMessageInternals.html#gafaed2adc00b2ec54b2827ecb778bbe7e" title="Adds a counter to be incremented immediately with the size/unix fds of this message, and decremented by the size/unix fds of this message when this message if finalized.">_dbus_message_add_counter_link</a> (message,
<a name="l02008"></a>02008                                   preallocated-&gt;<a class="code" href="structDBusPreallocatedSend.html#aae6c1bd98f78491482d5f59b6ef138d4" title="Preallocated link in the resource counter.">counter_link</a>);
<a name="l02009"></a>02009 
<a name="l02010"></a>02010   <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> (preallocated);
<a name="l02011"></a>02011   preallocated = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l02012"></a>02012   
<a name="l02013"></a>02013   <a class="code" href="group__DBusMessage.html#ga834035e4817acd64adc8ca584bdf3982" title="Increments the reference count of a DBusMessage.">dbus_message_ref</a> (message);
<a name="l02014"></a>02014   
<a name="l02015"></a>02015   connection-&gt;<a class="code" href="structDBusConnection.html#a07025e177949c5e65d5f983ac5f5e878" title="Length of outgoing queue.">n_outgoing</a> += 1;
<a name="l02016"></a>02016 
<a name="l02017"></a>02017   _dbus_verbose (<span class="stringliteral">&quot;Message %p (%s %s %s %s &#39;%s&#39;) for %s added to outgoing queue %p, %d pending to send\n&quot;</span>,
<a name="l02018"></a>02018                  message,
<a name="l02019"></a>02019                  <a class="code" href="group__DBusMessageInternals.html#ga75bcb613a291eb7e427f77f2f3635b8f" title="Utility function to convert a D-Bus message type into a machine-readable string (not translated)...">dbus_message_type_to_string</a> (<a class="code" href="group__DBusMessage.html#ga41cace31999105137772b6257ea540f9" title="Gets the type of a message.">dbus_message_get_type</a> (message)),
<a name="l02020"></a>02020                  <a class="code" href="group__DBusMessage.html#ga18adf731bb42d324fe2624407319e4af" title="Gets the object path this message is being sent to (for DBUS_MESSAGE_TYPE_METHOD_CALL) or being emitt...">dbus_message_get_path</a> (message) ?
<a name="l02021"></a>02021                  <a class="code" href="group__DBusMessage.html#ga18adf731bb42d324fe2624407319e4af" title="Gets the object path this message is being sent to (for DBUS_MESSAGE_TYPE_METHOD_CALL) or being emitt...">dbus_message_get_path</a> (message) :
<a name="l02022"></a>02022                  <span class="stringliteral">&quot;no path&quot;</span>,
<a name="l02023"></a>02023                  <a class="code" href="group__DBusMessage.html#ga1ad192bd4538cae556121a71b4e09d42" title="Gets the interface this message is being sent to (for DBUS_MESSAGE_TYPE_METHOD_CALL) or being emitted...">dbus_message_get_interface</a> (message) ?
<a name="l02024"></a>02024                  <a class="code" href="group__DBusMessage.html#ga1ad192bd4538cae556121a71b4e09d42" title="Gets the interface this message is being sent to (for DBUS_MESSAGE_TYPE_METHOD_CALL) or being emitted...">dbus_message_get_interface</a> (message) :
<a name="l02025"></a>02025                  <span class="stringliteral">&quot;no interface&quot;</span>,
<a name="l02026"></a>02026                  <a class="code" href="group__DBusMessage.html#gaf5c6b705c53db07a5ae2c6b76f230cf9" title="Gets the interface member being invoked (DBUS_MESSAGE_TYPE_METHOD_CALL) or emitted (DBUS_MESSAGE_TYPE...">dbus_message_get_member</a> (message) ?
<a name="l02027"></a>02027                  <a class="code" href="group__DBusMessage.html#gaf5c6b705c53db07a5ae2c6b76f230cf9" title="Gets the interface member being invoked (DBUS_MESSAGE_TYPE_METHOD_CALL) or emitted (DBUS_MESSAGE_TYPE...">dbus_message_get_member</a> (message) :
<a name="l02028"></a>02028                  <span class="stringliteral">&quot;no member&quot;</span>,
<a name="l02029"></a>02029                  <a class="code" href="group__DBusMessage.html#gaed63e4c2baaa50d782e8ebb7643def19" title="Gets the type signature of the message, i.e.">dbus_message_get_signature</a> (message),
<a name="l02030"></a>02030                  <a class="code" href="group__DBusMessage.html#gaac65c926e6253e49aa689b4f032fad45" title="Gets the destination of a message or NULL if there is none set.">dbus_message_get_destination</a> (message) ?
<a name="l02031"></a>02031                  <a class="code" href="group__DBusMessage.html#gaac65c926e6253e49aa689b4f032fad45" title="Gets the destination of a message or NULL if there is none set.">dbus_message_get_destination</a> (message) :
<a name="l02032"></a>02032                  <span class="stringliteral">&quot;null&quot;</span>,
<a name="l02033"></a>02033                  connection,
<a name="l02034"></a>02034                  connection-&gt;<a class="code" href="structDBusConnection.html#a07025e177949c5e65d5f983ac5f5e878" title="Length of outgoing queue.">n_outgoing</a>);
<a name="l02035"></a>02035 
<a name="l02036"></a>02036   <span class="keywordflow">if</span> (<a class="code" href="group__DBusMessage.html#ga390710c25564c80025a006c376da2030" title="Returns the serial of a message or 0 if none has been specified.">dbus_message_get_serial</a> (message) == 0)
<a name="l02037"></a>02037     {
<a name="l02038"></a>02038       serial = _dbus_connection_get_next_client_serial (connection);
<a name="l02039"></a>02039       <a class="code" href="group__DBusMessageInternals.html#ga3dd30a62c63eb9972cc0c564f2a89c3b" title="Sets the serial number of a message.">dbus_message_set_serial</a> (message, serial);
<a name="l02040"></a>02040       <span class="keywordflow">if</span> (client_serial)
<a name="l02041"></a>02041         *client_serial = serial;
<a name="l02042"></a>02042     }
<a name="l02043"></a>02043   <span class="keywordflow">else</span>
<a name="l02044"></a>02044     {
<a name="l02045"></a>02045       <span class="keywordflow">if</span> (client_serial)
<a name="l02046"></a>02046         *client_serial = <a class="code" href="group__DBusMessage.html#ga390710c25564c80025a006c376da2030" title="Returns the serial of a message or 0 if none has been specified.">dbus_message_get_serial</a> (message);
<a name="l02047"></a>02047     }
<a name="l02048"></a>02048 
<a name="l02049"></a>02049   _dbus_verbose (<span class="stringliteral">&quot;Message %p serial is %u\n&quot;</span>,
<a name="l02050"></a>02050                  message, <a class="code" href="group__DBusMessage.html#ga390710c25564c80025a006c376da2030" title="Returns the serial of a message or 0 if none has been specified.">dbus_message_get_serial</a> (message));
<a name="l02051"></a>02051   
<a name="l02052"></a>02052   <a class="code" href="group__DBusMessageInternals.html#ga3ecc9c24381af05289161f477ad6a578" title="Locks a message.">dbus_message_lock</a> (message);
<a name="l02053"></a>02053 
<a name="l02054"></a>02054   <span class="comment">/* Now we need to run an iteration to hopefully just write the messages</span>
<a name="l02055"></a>02055 <span class="comment">   * out immediately, and otherwise get them queued up</span>
<a name="l02056"></a>02056 <span class="comment">   */</span>
<a name="l02057"></a>02057   <a class="code" href="group__DBusConnectionInternals.html#ga283f0254537c4bf4453dbed6fad2e21e" title="Queues incoming messages and sends outgoing messages for this connection, optionally blocking in the ...">_dbus_connection_do_iteration_unlocked</a> (connection,
<a name="l02058"></a>02058                                           <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>,
<a name="l02059"></a>02059                                           DBUS_ITERATION_DO_WRITING,
<a name="l02060"></a>02060                                           -1);
<a name="l02061"></a>02061 
<a name="l02062"></a>02062   <span class="comment">/* If stuff is still queued up, be sure we wake up the main loop */</span>
<a name="l02063"></a>02063   <span class="keywordflow">if</span> (connection-&gt;<a class="code" href="structDBusConnection.html#a07025e177949c5e65d5f983ac5f5e878" title="Length of outgoing queue.">n_outgoing</a> &gt; 0)
<a name="l02064"></a>02064     _dbus_connection_wakeup_mainloop (connection);
<a name="l02065"></a>02065 }
<a name="l02066"></a>02066 
<a name="l02067"></a>02067 <span class="keyword">static</span> <span class="keywordtype">void</span>
<a name="l02068"></a>02068 _dbus_connection_send_preallocated_and_unlock (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>       *connection,
<a name="l02069"></a>02069                                                <a class="code" href="structDBusPreallocatedSend.html" title="Internals of DBusPreallocatedSend.">DBusPreallocatedSend</a> *preallocated,
<a name="l02070"></a>02070                                                <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>          *message,
<a name="l02071"></a>02071                                                <a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a>        *client_serial)
<a name="l02072"></a>02072 {
<a name="l02073"></a>02073   <a class="code" href="group__DBusConnection.html#gabf250a32ff740b2a8c99136e0142d8d2" title="Indicates the status of incoming data on a DBusConnection.">DBusDispatchStatus</a> status;
<a name="l02074"></a>02074 
<a name="l02075"></a>02075   HAVE_LOCK_CHECK (connection);
<a name="l02076"></a>02076   
<a name="l02077"></a>02077   _dbus_connection_send_preallocated_unlocked_no_update (connection,
<a name="l02078"></a>02078                                                          preallocated,
<a name="l02079"></a>02079                                                          message, client_serial);
<a name="l02080"></a>02080 
<a name="l02081"></a>02081   _dbus_verbose (<span class="stringliteral">&quot;middle\n&quot;</span>);
<a name="l02082"></a>02082   status = _dbus_connection_get_dispatch_status_unlocked (connection);
<a name="l02083"></a>02083 
<a name="l02084"></a>02084   <span class="comment">/* this calls out to user code */</span>
<a name="l02085"></a>02085   _dbus_connection_update_dispatch_status_and_unlock (connection, status);
<a name="l02086"></a>02086 }
<a name="l02087"></a>02087 
<a name="l02097"></a>02097 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l02098"></a><a class="code" href="group__DBusConnectionInternals.html#ga2974eb1c261305fafc635e14fc575d03">02098</a> <a class="code" href="group__DBusConnectionInternals.html#ga2974eb1c261305fafc635e14fc575d03" title="Like dbus_connection_send(), but assumes the connection is already locked on function entry...">_dbus_connection_send_and_unlock</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l02099"></a>02099                                   <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>    *message,
<a name="l02100"></a>02100                                   <a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a>  *client_serial)
<a name="l02101"></a>02101 {
<a name="l02102"></a>02102   <a class="code" href="structDBusPreallocatedSend.html" title="Internals of DBusPreallocatedSend.">DBusPreallocatedSend</a> *preallocated;
<a name="l02103"></a>02103 
<a name="l02104"></a>02104   _dbus_assert (connection != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l02105"></a>02105   _dbus_assert (message != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l02106"></a>02106   
<a name="l02107"></a>02107   preallocated = _dbus_connection_preallocate_send_unlocked (connection);
<a name="l02108"></a>02108   <span class="keywordflow">if</span> (preallocated == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l02109"></a>02109     {
<a name="l02110"></a>02110       <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l02111"></a>02111       <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l02112"></a>02112     }
<a name="l02113"></a>02113 
<a name="l02114"></a>02114   _dbus_connection_send_preallocated_and_unlock (connection,
<a name="l02115"></a>02115                                                  preallocated,
<a name="l02116"></a>02116                                                  message,
<a name="l02117"></a>02117                                                  client_serial);
<a name="l02118"></a>02118   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l02119"></a>02119 }
<a name="l02120"></a>02120 
<a name="l02145"></a>02145 <span class="keywordtype">void</span>
<a name="l02146"></a><a class="code" href="group__DBusConnectionInternals.html#ga9f9665902c763bd1ddf9d9bc57d7a7ba">02146</a> <a class="code" href="group__DBusConnectionInternals.html#ga9f9665902c763bd1ddf9d9bc57d7a7ba" title="Used internally to handle the semantics of dbus_server_set_new_connection_function().">_dbus_connection_close_if_only_one_ref</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l02147"></a>02147 {
<a name="l02148"></a>02148   <a class="code" href="group__DBusTypes.html#gab18afa60e9b17b6e322735bda3d863d8" title="A 32-bit signed integer on all platforms.">dbus_int32_t</a> refcount;
<a name="l02149"></a>02149 
<a name="l02150"></a>02150   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l02151"></a>02151 
<a name="l02152"></a>02152   refcount = <a class="code" href="group__DBusSysdeps.html#ga626c810359ba0e362367ce2ec6691aca" title="Atomically get the value of an integer.">_dbus_atomic_get</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#a6fbf0227071fc20ffd5b0e79aef58e92" title="Reference count.">refcount</a>);
<a name="l02153"></a>02153   <span class="comment">/* The caller should have at least one ref */</span>
<a name="l02154"></a>02154   _dbus_assert (refcount &gt;= 1);
<a name="l02155"></a>02155 
<a name="l02156"></a>02156   <span class="keywordflow">if</span> (refcount == 1)
<a name="l02157"></a>02157     _dbus_connection_close_possibly_shared_and_unlock (connection);
<a name="l02158"></a>02158   <span class="keywordflow">else</span>
<a name="l02159"></a>02159     <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l02160"></a>02160 }
<a name="l02161"></a>02161 
<a name="l02162"></a>02162 
<a name="l02172"></a>02172 <span class="keyword">static</span> <span class="keywordtype">void</span>
<a name="l02173"></a>02173 _dbus_memory_pause_based_on_timeout (<span class="keywordtype">int</span> timeout_milliseconds)
<a name="l02174"></a>02174 {
<a name="l02175"></a>02175   <span class="keywordflow">if</span> (timeout_milliseconds == -1)
<a name="l02176"></a>02176     <a class="code" href="group__DBusSysdeps.html#ga1153b4669819148af6b3f6f2b7c9183a" title="Sleeps the given number of milliseconds.">_dbus_sleep_milliseconds</a> (1000);
<a name="l02177"></a>02177   <span class="keywordflow">else</span> <span class="keywordflow">if</span> (timeout_milliseconds &lt; 100)
<a name="l02178"></a>02178     ; <span class="comment">/* just busy loop */</span>
<a name="l02179"></a>02179   <span class="keywordflow">else</span> <span class="keywordflow">if</span> (timeout_milliseconds &lt;= 1000)
<a name="l02180"></a>02180     <a class="code" href="group__DBusSysdeps.html#ga1153b4669819148af6b3f6f2b7c9183a" title="Sleeps the given number of milliseconds.">_dbus_sleep_milliseconds</a> (timeout_milliseconds / 3);
<a name="l02181"></a>02181   <span class="keywordflow">else</span>
<a name="l02182"></a>02182     <a class="code" href="group__DBusSysdeps.html#ga1153b4669819148af6b3f6f2b7c9183a" title="Sleeps the given number of milliseconds.">_dbus_sleep_milliseconds</a> (1000);
<a name="l02183"></a>02183 }
<a name="l02184"></a>02184 
<a name="l02185"></a>02185 <span class="keyword">static</span> <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *
<a name="l02186"></a>02186 generate_local_error_message (<a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a> serial, 
<a name="l02187"></a>02187                               <span class="keywordtype">char</span> *error_name, 
<a name="l02188"></a>02188                               <span class="keywordtype">char</span> *error_msg)
<a name="l02189"></a>02189 {
<a name="l02190"></a>02190   <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message;
<a name="l02191"></a>02191   message = <a class="code" href="group__DBusMessage.html#gab9e5bf8d87a95c5ca7026a791148ebd4" title="Constructs a new message of the given message type.">dbus_message_new</a> (<a class="code" href="group__DBusProtocol.html#ga2b9423d95066313d73eeea8eeaf86812" title="Message type of an error reply message, see dbus_message_get_type()">DBUS_MESSAGE_TYPE_ERROR</a>);
<a name="l02192"></a>02192   <span class="keywordflow">if</span> (!message)
<a name="l02193"></a>02193     <span class="keywordflow">goto</span> out;
<a name="l02194"></a>02194 
<a name="l02195"></a>02195   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusMessage.html#ga892f9857707371c2a53cec6b54c843c7" title="Sets the name of the error (DBUS_MESSAGE_TYPE_ERROR).">dbus_message_set_error_name</a> (message, error_name))
<a name="l02196"></a>02196     {
<a name="l02197"></a>02197       <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="l02198"></a>02198       message = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l02199"></a>02199       <span class="keywordflow">goto</span> out; 
<a name="l02200"></a>02200     }
<a name="l02201"></a>02201 
<a name="l02202"></a>02202   <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> (message, <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>); 
<a name="l02203"></a>02203 
<a name="l02204"></a>02204   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusMessage.html#gaec08603ff3d49bbcded67d25188a23f1" title="Sets the reply serial of a message (the serial of the message this is a reply to).">dbus_message_set_reply_serial</a> (message,
<a name="l02205"></a>02205                                       serial))
<a name="l02206"></a>02206     {
<a name="l02207"></a>02207       <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="l02208"></a>02208       message = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l02209"></a>02209       <span class="keywordflow">goto</span> out;
<a name="l02210"></a>02210     }
<a name="l02211"></a>02211 
<a name="l02212"></a>02212   <span class="keywordflow">if</span> (error_msg != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l02213"></a>02213     {
<a name="l02214"></a>02214       <a class="code" href="structDBusMessageIter.html" title="DBusMessageIter struct; contains no public fields.">DBusMessageIter</a> iter;
<a name="l02215"></a>02215 
<a name="l02216"></a>02216       <a class="code" href="group__DBusMessage.html#gaf733047c467ce21f4a53b65a388f1e9d" title="Initializes a DBusMessageIter for appending arguments to the end of a message.">dbus_message_iter_init_append</a> (message, &amp;iter);
<a name="l02217"></a>02217       <span class="keywordflow">if</span> (!<a class="code" href="group__DBusMessage.html#ga17491f3b75b3203f6fc47dcc2e3b221b" title="Appends a basic-typed value to the message.">dbus_message_iter_append_basic</a> (&amp;iter,
<a name="l02218"></a>02218                                            <a class="code" href="group__DBusProtocol.html#ga7eb77066dadf5415896b44c56d93acce" title="Type code marking a UTF-8 encoded, nul-terminated Unicode string.">DBUS_TYPE_STRING</a>,
<a name="l02219"></a>02219                                            &amp;error_msg))
<a name="l02220"></a>02220         {
<a name="l02221"></a>02221           <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="l02222"></a>02222           message = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l02223"></a>02223           <span class="keywordflow">goto</span> out;
<a name="l02224"></a>02224         }
<a name="l02225"></a>02225     }
<a name="l02226"></a>02226 
<a name="l02227"></a>02227  out:
<a name="l02228"></a>02228   <span class="keywordflow">return</span> message;
<a name="l02229"></a>02229 }
<a name="l02230"></a>02230 
<a name="l02231"></a>02231 <span class="comment">/*</span>
<a name="l02232"></a>02232 <span class="comment"> * Peek the incoming queue to see if we got reply for a specific serial</span>
<a name="l02233"></a>02233 <span class="comment"> */</span>
<a name="l02234"></a>02234 <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="l02235"></a>02235 _dbus_connection_peek_for_reply_unlocked (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l02236"></a>02236                                           <a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a>   client_serial)
<a name="l02237"></a>02237 {
<a name="l02238"></a>02238   <a class="code" href="structDBusList.html" title="A node in a linked list.">DBusList</a> *link;
<a name="l02239"></a>02239   HAVE_LOCK_CHECK (connection);
<a name="l02240"></a>02240 
<a name="l02241"></a>02241   link = <a class="code" href="group__DBusList.html#ga1e26ce4fb4acb50593bd5ed2f4eeb3ae" title="Gets the first link in the list.">_dbus_list_get_first_link</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#aacb3a29956aa7712db37916194fde869" title="Queue of messages we have received, end of the list received most recently.">incoming_messages</a>);
<a name="l02242"></a>02242 
<a name="l02243"></a>02243   <span class="keywordflow">while</span> (link != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l02244"></a>02244     {
<a name="l02245"></a>02245       <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *reply = link-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a>;
<a name="l02246"></a>02246 
<a name="l02247"></a>02247       <span class="keywordflow">if</span> (<a class="code" href="group__DBusMessage.html#ga94c43b2b237d842a6b91da6f94818d47" title="Returns the serial that the message is a reply to or 0 if none.">dbus_message_get_reply_serial</a> (reply) == client_serial)
<a name="l02248"></a>02248         {
<a name="l02249"></a>02249           _dbus_verbose (<span class="stringliteral">&quot;%s reply to %d found in queue\n&quot;</span>, _DBUS_FUNCTION_NAME, client_serial);
<a name="l02250"></a>02250           <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l02251"></a>02251         }
<a name="l02252"></a>02252       link = <a class="code" href="group__DBusList.html#gaede4ace46d5ee497d75074bfec4490a2" title="Gets the next link in the list, or NULL if there are no more links.">_dbus_list_get_next_link</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#aacb3a29956aa7712db37916194fde869" title="Queue of messages we have received, end of the list received most recently.">incoming_messages</a>, link);
<a name="l02253"></a>02253     }
<a name="l02254"></a>02254 
<a name="l02255"></a>02255   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l02256"></a>02256 }
<a name="l02257"></a>02257 
<a name="l02258"></a>02258 <span class="comment">/* This is slightly strange since we can pop a message here without</span>
<a name="l02259"></a>02259 <span class="comment"> * the dispatch lock.</span>
<a name="l02260"></a>02260 <span class="comment"> */</span>
<a name="l02261"></a>02261 <span class="keyword">static</span> <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>*
<a name="l02262"></a>02262 check_for_reply_unlocked (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l02263"></a>02263                           <a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a>   client_serial)
<a name="l02264"></a>02264 {
<a name="l02265"></a>02265   <a class="code" href="structDBusList.html" title="A node in a linked list.">DBusList</a> *link;
<a name="l02266"></a>02266 
<a name="l02267"></a>02267   HAVE_LOCK_CHECK (connection);
<a name="l02268"></a>02268   
<a name="l02269"></a>02269   link = <a class="code" href="group__DBusList.html#ga1e26ce4fb4acb50593bd5ed2f4eeb3ae" title="Gets the first link in the list.">_dbus_list_get_first_link</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#aacb3a29956aa7712db37916194fde869" title="Queue of messages we have received, end of the list received most recently.">incoming_messages</a>);
<a name="l02270"></a>02270 
<a name="l02271"></a>02271   <span class="keywordflow">while</span> (link != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l02272"></a>02272     {
<a name="l02273"></a>02273       <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *reply = link-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a>;
<a name="l02274"></a>02274 
<a name="l02275"></a>02275       <span class="keywordflow">if</span> (<a class="code" href="group__DBusMessage.html#ga94c43b2b237d842a6b91da6f94818d47" title="Returns the serial that the message is a reply to or 0 if none.">dbus_message_get_reply_serial</a> (reply) == client_serial)
<a name="l02276"></a>02276         {
<a name="l02277"></a>02277           <a class="code" href="group__DBusList.html#ga40abea762d9cb44e5ec6b31b1769dc2e" title="Removes a link from the list.">_dbus_list_remove_link</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#aacb3a29956aa7712db37916194fde869" title="Queue of messages we have received, end of the list received most recently.">incoming_messages</a>, link);
<a name="l02278"></a>02278           connection-&gt;<a class="code" href="structDBusConnection.html#a9bda45f2d5c9af5c187fc31d7c98b424" title="Length of incoming queue.">n_incoming</a>  -= 1;
<a name="l02279"></a>02279           <span class="keywordflow">return</span> reply;
<a name="l02280"></a>02280         }
<a name="l02281"></a>02281       link = <a class="code" href="group__DBusList.html#gaede4ace46d5ee497d75074bfec4490a2" title="Gets the next link in the list, or NULL if there are no more links.">_dbus_list_get_next_link</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#aacb3a29956aa7712db37916194fde869" title="Queue of messages we have received, end of the list received most recently.">incoming_messages</a>, link);
<a name="l02282"></a>02282     }
<a name="l02283"></a>02283 
<a name="l02284"></a>02284   <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="l02285"></a>02285 }
<a name="l02286"></a>02286 
<a name="l02287"></a>02287 <span class="keyword">static</span> <span class="keywordtype">void</span>
<a name="l02288"></a>02288 connection_timeout_and_complete_all_pending_calls_unlocked (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l02289"></a>02289 {
<a name="l02290"></a>02290    <span class="comment">/* We can&#39;t iterate over the hash in the normal way since we&#39;ll be</span>
<a name="l02291"></a>02291 <span class="comment">    * dropping the lock for each item. So we restart the</span>
<a name="l02292"></a>02292 <span class="comment">    * iter each time as we drain the hash table.</span>
<a name="l02293"></a>02293 <span class="comment">    */</span>
<a name="l02294"></a>02294    
<a name="l02295"></a>02295    <span class="keywordflow">while</span> (<a class="code" href="group__DBusHashTable.html#gad48297fc27442c19a7c4bd4d1ef9ef77" title="Gets the number of hash entries in a hash table.">_dbus_hash_table_get_n_entries</a> (connection-&gt;<a class="code" href="structDBusConnection.html#ad8fa077f91fe62d0c10862e2ff9e86ca" title="Hash of message serials to DBusPendingCall.">pending_replies</a>) &gt; 0)
<a name="l02296"></a>02296     {
<a name="l02297"></a>02297       <a class="code" href="structDBusPendingCall.html" title="Implementation details of DBusPendingCall - all fields are private.">DBusPendingCall</a> *pending;
<a name="l02298"></a>02298       <a class="code" href="structDBusHashIter.html" title="Hash iterator object.">DBusHashIter</a> iter;
<a name="l02299"></a>02299       
<a name="l02300"></a>02300       <a class="code" href="group__DBusHashTable.html#ga1b0e6df8a8617ef0f8f25adfba3acc4c" title="Initializes a hash table iterator.">_dbus_hash_iter_init</a> (connection-&gt;<a class="code" href="structDBusConnection.html#ad8fa077f91fe62d0c10862e2ff9e86ca" title="Hash of message serials to DBusPendingCall.">pending_replies</a>, &amp;iter);
<a name="l02301"></a>02301       <a class="code" href="group__DBusHashTable.html#ga723e61fcc91ca673e90ff872c07ea19c" title="Move the hash iterator forward one step, to the next hash entry.">_dbus_hash_iter_next</a> (&amp;iter);
<a name="l02302"></a>02302        
<a name="l02303"></a>02303       pending = <a class="code" href="group__DBusHashTable.html#ga34bf277ee37f919bd00516b5ae4e12b5" title="Gets the value of the current entry.">_dbus_hash_iter_get_value</a> (&amp;iter);
<a name="l02304"></a>02304       <a class="code" href="group__DBusPendingCallInternals.html#ga9d8987da3747604d370ffec2c5e1e10a" title="Increments the reference count on a pending call, while the lock on its connection is already held...">_dbus_pending_call_ref_unlocked</a> (pending);
<a name="l02305"></a>02305        
<a name="l02306"></a>02306       <a class="code" href="group__DBusPendingCallInternals.html#ga1bc4de7652108d0629522a4e3adffcab" title="If the pending call hasn&#39;t been timed out, add its timeout error reply to the connection&#39;s incoming m...">_dbus_pending_call_queue_timeout_error_unlocked</a> (pending, 
<a name="l02307"></a>02307                                                        connection);
<a name="l02308"></a>02308 
<a name="l02309"></a>02309       <span class="keywordflow">if</span> (<a class="code" href="group__DBusPendingCallInternals.html#gaf1e630b966722af540502329ed028254" title="Checks to see if a timeout has been added.">_dbus_pending_call_is_timeout_added_unlocked</a> (pending))
<a name="l02310"></a>02310           <a class="code" href="group__DBusConnectionInternals.html#gabaa6d26f6eca30782904af1ceb703bd1" title="Removes a timeout using the connection&#39;s DBusRemoveTimeoutFunction if available.">_dbus_connection_remove_timeout_unlocked</a> (connection,
<a name="l02311"></a>02311                                                     <a class="code" href="group__DBusPendingCallInternals.html#gaa9acac047b61c9a0eaff1977151e9e08" title="Retrives the timeout.">_dbus_pending_call_get_timeout_unlocked</a> (pending));
<a name="l02312"></a>02312       <a class="code" href="group__DBusPendingCallInternals.html#gafea13f8b9977d341e41201c407adea2a" title="Sets wether the timeout has been added.">_dbus_pending_call_set_timeout_added_unlocked</a> (pending, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);       
<a name="l02313"></a>02313       <a class="code" href="group__DBusHashTable.html#ga0ef12d773a546f070cff91cbf1e8d16e" title="Removes the current entry from the hash table.">_dbus_hash_iter_remove_entry</a> (&amp;iter);
<a name="l02314"></a>02314 
<a name="l02315"></a>02315       <a class="code" href="group__DBusPendingCallInternals.html#ga26f09beed0dd6323cca0452abf344567" title="Decrements the reference count on a pending call, freeing it if the count reaches 0...">_dbus_pending_call_unref_and_unlock</a> (pending);
<a name="l02316"></a>02316       <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l02317"></a>02317     }
<a name="l02318"></a>02318   HAVE_LOCK_CHECK (connection);
<a name="l02319"></a>02319 }
<a name="l02320"></a>02320 
<a name="l02321"></a>02321 <span class="keyword">static</span> <span class="keywordtype">void</span>
<a name="l02322"></a>02322 complete_pending_call_and_unlock (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>  *connection,
<a name="l02323"></a>02323                                   <a class="code" href="structDBusPendingCall.html" title="Implementation details of DBusPendingCall - all fields are private.">DBusPendingCall</a> *pending,
<a name="l02324"></a>02324                                   <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>     *message)
<a name="l02325"></a>02325 {
<a name="l02326"></a>02326   <a class="code" href="group__DBusPendingCallInternals.html#ga4b8cc560549160aecd924037a872009d" title="Sets the reply of a pending call with the given message, or if the message is NULL, by timing out the pending call.">_dbus_pending_call_set_reply_unlocked</a> (pending, message);
<a name="l02327"></a>02327   <a class="code" href="group__DBusPendingCallInternals.html#ga9d8987da3747604d370ffec2c5e1e10a" title="Increments the reference count on a pending call, while the lock on its connection is already held...">_dbus_pending_call_ref_unlocked</a> (pending); <span class="comment">/* in case there&#39;s no app with a ref held */</span>
<a name="l02328"></a>02328   _dbus_connection_detach_pending_call_and_unlock (connection, pending);
<a name="l02329"></a>02329  
<a name="l02330"></a>02330   <span class="comment">/* Must be called unlocked since it invokes app callback */</span>
<a name="l02331"></a>02331   <a class="code" href="group__DBusPendingCallInternals.html#ga6b10d157242e540fd18bd3db733dab5c" title="Calls notifier function for the pending call and sets the call to completed.">_dbus_pending_call_complete</a> (pending);
<a name="l02332"></a>02332   <a class="code" href="group__DBusPendingCall.html#gadaba15a74ba4925cdef52d4791cd3147" title="Decrements the reference count on a pending call, freeing it if the count reaches 0...">dbus_pending_call_unref</a> (pending);
<a name="l02333"></a>02333 }
<a name="l02334"></a>02334 
<a name="l02335"></a>02335 <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="l02336"></a>02336 check_for_reply_and_update_dispatch_unlocked (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>  *connection,
<a name="l02337"></a>02337                                               <a class="code" href="structDBusPendingCall.html" title="Implementation details of DBusPendingCall - all fields are private.">DBusPendingCall</a> *pending)
<a name="l02338"></a>02338 {
<a name="l02339"></a>02339   <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *reply;
<a name="l02340"></a>02340   <a class="code" href="group__DBusConnection.html#gabf250a32ff740b2a8c99136e0142d8d2" title="Indicates the status of incoming data on a DBusConnection.">DBusDispatchStatus</a> status;
<a name="l02341"></a>02341 
<a name="l02342"></a>02342   reply = check_for_reply_unlocked (connection, 
<a name="l02343"></a>02343                                     <a class="code" href="group__DBusPendingCallInternals.html#gaf5f3df36149bfe55d824eb08d00768fc" title="Gets the reply&#39;s serial number.">_dbus_pending_call_get_reply_serial_unlocked</a> (pending));
<a name="l02344"></a>02344   <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="l02345"></a>02345     {
<a name="l02346"></a>02346       _dbus_verbose (<span class="stringliteral">&quot;checked for reply\n&quot;</span>);
<a name="l02347"></a>02347 
<a name="l02348"></a>02348       _dbus_verbose (<span class="stringliteral">&quot;dbus_connection_send_with_reply_and_block(): got reply\n&quot;</span>);
<a name="l02349"></a>02349 
<a name="l02350"></a>02350       complete_pending_call_and_unlock (connection, pending, reply);
<a name="l02351"></a>02351       <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="l02352"></a>02352 
<a name="l02353"></a>02353       <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l02354"></a>02354       status = _dbus_connection_get_dispatch_status_unlocked (connection);
<a name="l02355"></a>02355       _dbus_connection_update_dispatch_status_and_unlock (connection, status);
<a name="l02356"></a>02356       <a class="code" href="group__DBusPendingCall.html#gadaba15a74ba4925cdef52d4791cd3147" title="Decrements the reference count on a pending call, freeing it if the count reaches 0...">dbus_pending_call_unref</a> (pending);
<a name="l02357"></a>02357 
<a name="l02358"></a>02358       <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l02359"></a>02359     }
<a name="l02360"></a>02360 
<a name="l02361"></a>02361   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l02362"></a>02362 }
<a name="l02363"></a>02363 
<a name="l02378"></a>02378 <span class="keywordtype">void</span>
<a name="l02379"></a><a class="code" href="group__DBusConnectionInternals.html#gad5e725e66dc16a411544e25675fb9fba">02379</a> <a class="code" href="group__DBusConnectionInternals.html#gad5e725e66dc16a411544e25675fb9fba" title="Blocks until a pending call times out or gets a reply.">_dbus_connection_block_pending_call</a> (<a class="code" href="structDBusPendingCall.html" title="Implementation details of DBusPendingCall - all fields are private.">DBusPendingCall</a> *pending)
<a name="l02380"></a>02380 {
<a name="l02381"></a>02381   <span class="keywordtype">long</span> start_tv_sec, start_tv_usec;
<a name="l02382"></a>02382   <span class="keywordtype">long</span> tv_sec, tv_usec;
<a name="l02383"></a>02383   <a class="code" href="group__DBusConnection.html#gabf250a32ff740b2a8c99136e0142d8d2" title="Indicates the status of incoming data on a DBusConnection.">DBusDispatchStatus</a> status;
<a name="l02384"></a>02384   <a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection;
<a name="l02385"></a>02385   <a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a> client_serial;
<a name="l02386"></a>02386   <a class="code" href="structDBusTimeout.html" title="Internals of DBusTimeout.">DBusTimeout</a> *timeout;
<a name="l02387"></a>02387   <span class="keywordtype">int</span> timeout_milliseconds, elapsed_milliseconds;
<a name="l02388"></a>02388 
<a name="l02389"></a>02389   _dbus_assert (pending != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l02390"></a>02390 
<a name="l02391"></a>02391   <span class="keywordflow">if</span> (<a class="code" href="group__DBusPendingCall.html#gacbf33ae8a1cc125628f9ea44d175c159" title="Checks whether the pending call has received a reply yet, or not.">dbus_pending_call_get_completed</a> (pending))
<a name="l02392"></a>02392     <span class="keywordflow">return</span>;
<a name="l02393"></a>02393 
<a name="l02394"></a>02394   <a class="code" href="group__DBusPendingCall.html#ga334f6c6621583e15fdaf1a3f93dd2221" title="Increments the reference count on a pending call.">dbus_pending_call_ref</a> (pending); <span class="comment">/* necessary because the call could be canceled */</span>
<a name="l02395"></a>02395 
<a name="l02396"></a>02396   connection = <a class="code" href="group__DBusPendingCallInternals.html#ga68e5ff616e6a6563d83966c3d88b9b32" title="Gets the connection associated with this pending call.">_dbus_pending_call_get_connection_and_lock</a> (pending);
<a name="l02397"></a>02397   
<a name="l02398"></a>02398   <span class="comment">/* Flush message queue - note, can affect dispatch status */</span>
<a name="l02399"></a>02399   _dbus_connection_flush_unlocked (connection);
<a name="l02400"></a>02400 
<a name="l02401"></a>02401   client_serial = <a class="code" href="group__DBusPendingCallInternals.html#gaf5f3df36149bfe55d824eb08d00768fc" title="Gets the reply&#39;s serial number.">_dbus_pending_call_get_reply_serial_unlocked</a> (pending);
<a name="l02402"></a>02402 
<a name="l02403"></a>02403   <span class="comment">/* note that timeout_milliseconds is limited to a smallish value</span>
<a name="l02404"></a>02404 <span class="comment">   * in _dbus_pending_call_new() so overflows aren&#39;t possible</span>
<a name="l02405"></a>02405 <span class="comment">   * below</span>
<a name="l02406"></a>02406 <span class="comment">   */</span>
<a name="l02407"></a>02407   timeout = <a class="code" href="group__DBusPendingCallInternals.html#gaa9acac047b61c9a0eaff1977151e9e08" title="Retrives the timeout.">_dbus_pending_call_get_timeout_unlocked</a> (pending);
<a name="l02408"></a>02408   <a class="code" href="group__DBusSysdeps.html#gab9951a7fd8c33188bf86314e7fd56300" title="Get current time, as in gettimeofday().">_dbus_get_monotonic_time</a> (&amp;start_tv_sec, &amp;start_tv_usec);
<a name="l02409"></a>02409   <span class="keywordflow">if</span> (timeout)
<a name="l02410"></a>02410     {
<a name="l02411"></a>02411       timeout_milliseconds = <a class="code" href="group__DBusTimeout.html#ga67ba21b6189438875c6007ee79da5e37" title="Gets the timeout interval.">dbus_timeout_get_interval</a> (timeout);
<a name="l02412"></a>02412 
<a name="l02413"></a>02413       _dbus_verbose (<span class="stringliteral">&quot;dbus_connection_send_with_reply_and_block(): will block %d milliseconds for reply serial %u from %ld sec %ld usec\n&quot;</span>,
<a name="l02414"></a>02414                      timeout_milliseconds,
<a name="l02415"></a>02415                      client_serial,
<a name="l02416"></a>02416                      start_tv_sec, start_tv_usec);
<a name="l02417"></a>02417     }
<a name="l02418"></a>02418   <span class="keywordflow">else</span>
<a name="l02419"></a>02419     {
<a name="l02420"></a>02420       timeout_milliseconds = -1;
<a name="l02421"></a>02421 
<a name="l02422"></a>02422       _dbus_verbose (<span class="stringliteral">&quot;dbus_connection_send_with_reply_and_block(): will block for reply serial %u\n&quot;</span>, client_serial);
<a name="l02423"></a>02423     }
<a name="l02424"></a>02424 
<a name="l02425"></a>02425   <span class="comment">/* check to see if we already got the data off the socket */</span>
<a name="l02426"></a>02426   <span class="comment">/* from another blocked pending call */</span>
<a name="l02427"></a>02427   <span class="keywordflow">if</span> (check_for_reply_and_update_dispatch_unlocked (connection, pending))
<a name="l02428"></a>02428     <span class="keywordflow">return</span>;
<a name="l02429"></a>02429 
<a name="l02430"></a>02430   <span class="comment">/* Now we wait... */</span>
<a name="l02431"></a>02431   <span class="comment">/* always block at least once as we know we don&#39;t have the reply yet */</span>
<a name="l02432"></a>02432   <a class="code" href="group__DBusConnectionInternals.html#ga283f0254537c4bf4453dbed6fad2e21e" title="Queues incoming messages and sends outgoing messages for this connection, optionally blocking in the ...">_dbus_connection_do_iteration_unlocked</a> (connection,
<a name="l02433"></a>02433                                           pending,
<a name="l02434"></a>02434                                           DBUS_ITERATION_DO_READING |
<a name="l02435"></a>02435                                           DBUS_ITERATION_BLOCK,
<a name="l02436"></a>02436                                           timeout_milliseconds);
<a name="l02437"></a>02437 
<a name="l02438"></a>02438  recheck_status:
<a name="l02439"></a>02439 
<a name="l02440"></a>02440   _dbus_verbose (<span class="stringliteral">&quot;top of recheck\n&quot;</span>);
<a name="l02441"></a>02441   
<a name="l02442"></a>02442   HAVE_LOCK_CHECK (connection);
<a name="l02443"></a>02443   
<a name="l02444"></a>02444   <span class="comment">/* queue messages and get status */</span>
<a name="l02445"></a>02445 
<a name="l02446"></a>02446   status = _dbus_connection_get_dispatch_status_unlocked (connection);
<a name="l02447"></a>02447 
<a name="l02448"></a>02448   <span class="comment">/* the get_completed() is in case a dispatch() while we were blocking</span>
<a name="l02449"></a>02449 <span class="comment">   * got the reply instead of us.</span>
<a name="l02450"></a>02450 <span class="comment">   */</span>
<a name="l02451"></a>02451   <span class="keywordflow">if</span> (<a class="code" href="group__DBusPendingCallInternals.html#ga37bef4359b3c29629a57f5fe480690a1" title="Checks whether the pending call has received a reply yet, or not.">_dbus_pending_call_get_completed_unlocked</a> (pending))
<a name="l02452"></a>02452     {
<a name="l02453"></a>02453       _dbus_verbose (<span class="stringliteral">&quot;Pending call completed by dispatch\n&quot;</span>);
<a name="l02454"></a>02454       _dbus_connection_update_dispatch_status_and_unlock (connection, status);
<a name="l02455"></a>02455       <a class="code" href="group__DBusPendingCall.html#gadaba15a74ba4925cdef52d4791cd3147" title="Decrements the reference count on a pending call, freeing it if the count reaches 0...">dbus_pending_call_unref</a> (pending);
<a name="l02456"></a>02456       <span class="keywordflow">return</span>;
<a name="l02457"></a>02457     }
<a name="l02458"></a>02458   
<a name="l02459"></a>02459   <span class="keywordflow">if</span> (status == <a class="code" href="group__DBusConnection.html#ggabf250a32ff740b2a8c99136e0142d8d2adf8e8a594ab338cb9cf7855b19e37e93" title="There is more data to potentially convert to messages.">DBUS_DISPATCH_DATA_REMAINS</a>)
<a name="l02460"></a>02460     {
<a name="l02461"></a>02461       <span class="keywordflow">if</span> (check_for_reply_and_update_dispatch_unlocked (connection, pending))
<a name="l02462"></a>02462         <span class="keywordflow">return</span>;
<a name="l02463"></a>02463     }
<a name="l02464"></a>02464   
<a name="l02465"></a>02465   <a class="code" href="group__DBusSysdeps.html#gab9951a7fd8c33188bf86314e7fd56300" title="Get current time, as in gettimeofday().">_dbus_get_monotonic_time</a> (&amp;tv_sec, &amp;tv_usec);
<a name="l02466"></a>02466   elapsed_milliseconds = (tv_sec - start_tv_sec) * 1000 +
<a name="l02467"></a>02467           (tv_usec - start_tv_usec) / 1000;
<a name="l02468"></a>02468   
<a name="l02469"></a>02469   <span class="keywordflow">if</span> (!_dbus_connection_get_is_connected_unlocked (connection))
<a name="l02470"></a>02470     {
<a name="l02471"></a>02471       <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *error_msg;
<a name="l02472"></a>02472 
<a name="l02473"></a>02473       error_msg = generate_local_error_message (client_serial,
<a name="l02474"></a>02474                                                 <a class="code" href="group__DBusProtocol.html#gaef6443e0bd8cdcc1606d985a775d07a7" title="The connection is disconnected and you&#39;re trying to use it.">DBUS_ERROR_DISCONNECTED</a>, 
<a name="l02475"></a>02475                                                 <span class="stringliteral">&quot;Connection was disconnected before a reply was received&quot;</span>); 
<a name="l02476"></a>02476 
<a name="l02477"></a>02477       <span class="comment">/* on OOM error_msg is set to NULL */</span>
<a name="l02478"></a>02478       complete_pending_call_and_unlock (connection, pending, error_msg);
<a name="l02479"></a>02479       <a class="code" href="group__DBusPendingCall.html#gadaba15a74ba4925cdef52d4791cd3147" title="Decrements the reference count on a pending call, freeing it if the count reaches 0...">dbus_pending_call_unref</a> (pending);
<a name="l02480"></a>02480       <span class="keywordflow">return</span>;
<a name="l02481"></a>02481     }
<a name="l02482"></a>02482   <span class="keywordflow">else</span> <span class="keywordflow">if</span> (connection-&gt;<a class="code" href="structDBusConnection.html#aa70afc41f6184604c027e7f71a314d7f" title="Preallocated list node for queueing the disconnection message.">disconnect_message_link</a> == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l02483"></a>02483     _dbus_verbose (<span class="stringliteral">&quot;dbus_connection_send_with_reply_and_block(): disconnected\n&quot;</span>);
<a name="l02484"></a>02484   <span class="keywordflow">else</span> <span class="keywordflow">if</span> (timeout == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l02485"></a>02485     {
<a name="l02486"></a>02486        <span class="keywordflow">if</span> (status == <a class="code" href="group__DBusConnection.html#ggabf250a32ff740b2a8c99136e0142d8d2a5af20a035f29cfa67fb8d69fb693b685" title="More memory is needed to continue.">DBUS_DISPATCH_NEED_MEMORY</a>)
<a name="l02487"></a>02487         {
<a name="l02488"></a>02488           <span class="comment">/* Try sleeping a bit, as we aren&#39;t sure we need to block for reading,</span>
<a name="l02489"></a>02489 <span class="comment">           * we may already have a reply in the buffer and just can&#39;t process</span>
<a name="l02490"></a>02490 <span class="comment">           * it.</span>
<a name="l02491"></a>02491 <span class="comment">           */</span>
<a name="l02492"></a>02492           _dbus_verbose (<span class="stringliteral">&quot;dbus_connection_send_with_reply_and_block() waiting for more memory\n&quot;</span>);
<a name="l02493"></a>02493 
<a name="l02494"></a>02494           _dbus_memory_pause_based_on_timeout (timeout_milliseconds - elapsed_milliseconds);
<a name="l02495"></a>02495         }
<a name="l02496"></a>02496       <span class="keywordflow">else</span>
<a name="l02497"></a>02497         {          
<a name="l02498"></a>02498           <span class="comment">/* block again, we don&#39;t have the reply buffered yet. */</span>
<a name="l02499"></a>02499           <a class="code" href="group__DBusConnectionInternals.html#ga283f0254537c4bf4453dbed6fad2e21e" title="Queues incoming messages and sends outgoing messages for this connection, optionally blocking in the ...">_dbus_connection_do_iteration_unlocked</a> (connection,
<a name="l02500"></a>02500                                                   pending,
<a name="l02501"></a>02501                                                   DBUS_ITERATION_DO_READING |
<a name="l02502"></a>02502                                                   DBUS_ITERATION_BLOCK,
<a name="l02503"></a>02503                                                   timeout_milliseconds - elapsed_milliseconds);
<a name="l02504"></a>02504         }
<a name="l02505"></a>02505 
<a name="l02506"></a>02506       <span class="keywordflow">goto</span> recheck_status;
<a name="l02507"></a>02507     }
<a name="l02508"></a>02508   <span class="keywordflow">else</span> <span class="keywordflow">if</span> (tv_sec &lt; start_tv_sec)
<a name="l02509"></a>02509     _dbus_verbose (<span class="stringliteral">&quot;dbus_connection_send_with_reply_and_block(): clock set backward\n&quot;</span>);
<a name="l02510"></a>02510   <span class="keywordflow">else</span> <span class="keywordflow">if</span> (elapsed_milliseconds &lt; timeout_milliseconds)
<a name="l02511"></a>02511     {
<a name="l02512"></a>02512       _dbus_verbose (<span class="stringliteral">&quot;dbus_connection_send_with_reply_and_block(): %d milliseconds remain\n&quot;</span>, timeout_milliseconds - elapsed_milliseconds);
<a name="l02513"></a>02513       
<a name="l02514"></a>02514       <span class="keywordflow">if</span> (status == <a class="code" href="group__DBusConnection.html#ggabf250a32ff740b2a8c99136e0142d8d2a5af20a035f29cfa67fb8d69fb693b685" title="More memory is needed to continue.">DBUS_DISPATCH_NEED_MEMORY</a>)
<a name="l02515"></a>02515         {
<a name="l02516"></a>02516           <span class="comment">/* Try sleeping a bit, as we aren&#39;t sure we need to block for reading,</span>
<a name="l02517"></a>02517 <span class="comment">           * we may already have a reply in the buffer and just can&#39;t process</span>
<a name="l02518"></a>02518 <span class="comment">           * it.</span>
<a name="l02519"></a>02519 <span class="comment">           */</span>
<a name="l02520"></a>02520           _dbus_verbose (<span class="stringliteral">&quot;dbus_connection_send_with_reply_and_block() waiting for more memory\n&quot;</span>);
<a name="l02521"></a>02521 
<a name="l02522"></a>02522           _dbus_memory_pause_based_on_timeout (timeout_milliseconds - elapsed_milliseconds);
<a name="l02523"></a>02523         }
<a name="l02524"></a>02524       <span class="keywordflow">else</span>
<a name="l02525"></a>02525         {          
<a name="l02526"></a>02526           <span class="comment">/* block again, we don&#39;t have the reply buffered yet. */</span>
<a name="l02527"></a>02527           <a class="code" href="group__DBusConnectionInternals.html#ga283f0254537c4bf4453dbed6fad2e21e" title="Queues incoming messages and sends outgoing messages for this connection, optionally blocking in the ...">_dbus_connection_do_iteration_unlocked</a> (connection,
<a name="l02528"></a>02528                                                   <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>,
<a name="l02529"></a>02529                                                   DBUS_ITERATION_DO_READING |
<a name="l02530"></a>02530                                                   DBUS_ITERATION_BLOCK,
<a name="l02531"></a>02531                                                   timeout_milliseconds - elapsed_milliseconds);
<a name="l02532"></a>02532         }
<a name="l02533"></a>02533 
<a name="l02534"></a>02534       <span class="keywordflow">goto</span> recheck_status;
<a name="l02535"></a>02535     }
<a name="l02536"></a>02536 
<a name="l02537"></a>02537   _dbus_verbose (<span class="stringliteral">&quot;dbus_connection_send_with_reply_and_block(): Waited %d milliseconds and got no reply\n&quot;</span>,
<a name="l02538"></a>02538                  elapsed_milliseconds);
<a name="l02539"></a>02539 
<a name="l02540"></a>02540   _dbus_assert (!<a class="code" href="group__DBusPendingCallInternals.html#ga37bef4359b3c29629a57f5fe480690a1" title="Checks whether the pending call has received a reply yet, or not.">_dbus_pending_call_get_completed_unlocked</a> (pending));
<a name="l02541"></a>02541   
<a name="l02542"></a>02542   <span class="comment">/* unlock and call user code */</span>
<a name="l02543"></a>02543   complete_pending_call_and_unlock (connection, pending, <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l02544"></a>02544 
<a name="l02545"></a>02545   <span class="comment">/* update user code on dispatch status */</span>
<a name="l02546"></a>02546   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l02547"></a>02547   status = _dbus_connection_get_dispatch_status_unlocked (connection);
<a name="l02548"></a>02548   _dbus_connection_update_dispatch_status_and_unlock (connection, status);
<a name="l02549"></a>02549   <a class="code" href="group__DBusPendingCall.html#gadaba15a74ba4925cdef52d4791cd3147" title="Decrements the reference count on a pending call, freeing it if the count reaches 0...">dbus_pending_call_unref</a> (pending);
<a name="l02550"></a>02550 }
<a name="l02551"></a>02551 
<a name="l02557"></a>02557 <span class="keywordtype">int</span>
<a name="l02558"></a><a class="code" href="group__DBusConnectionInternals.html#gac6dba97d98f486b87468ae8076349a66">02558</a> <a class="code" href="group__DBusConnectionInternals.html#gac6dba97d98f486b87468ae8076349a66" title="Return how many file descriptors are pending in the loader.">_dbus_connection_get_pending_fds_count</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l02559"></a>02559 {
<a name="l02560"></a>02560   <span class="keywordflow">return</span> <a class="code" href="group__DBusTransport.html#ga3545c064545957f73f583bf63d07c40c" title="Return how many file descriptors are pending in the loader.">_dbus_transport_get_pending_fds_count</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>);
<a name="l02561"></a>02561 }
<a name="l02562"></a>02562 
<a name="l02570"></a>02570 <span class="keywordtype">void</span>
<a name="l02571"></a><a class="code" href="group__DBusConnectionInternals.html#gac84ff2ad1060326f8c1f94a171fefa98">02571</a> <a class="code" href="group__DBusConnectionInternals.html#gac84ff2ad1060326f8c1f94a171fefa98" title="Register a function to be called whenever the number of pending file descriptors in the loader change...">_dbus_connection_set_pending_fds_function</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l02572"></a>02572                                            DBusPendingFdsChangeFunction callback,
<a name="l02573"></a>02573                                            <span class="keywordtype">void</span> *data)
<a name="l02574"></a>02574 {
<a name="l02575"></a>02575   <a class="code" href="group__DBusTransport.html#gad6dccbcdc149e3305101db4b2ebae6d6" title="Register a function to be called whenever the number of pending file descriptors in the loader change...">_dbus_transport_set_pending_fds_function</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>,
<a name="l02576"></a>02576                                             callback, data);
<a name="l02577"></a>02577 }
<a name="l02578"></a>02578 
<a name="l02615"></a>02615 <a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>*
<a name="l02616"></a><a class="code" href="group__DBusConnection.html#gacd32f819820266598c6b6847dfddaf9c">02616</a> <a class="code" href="group__DBusConnection.html#gacd32f819820266598c6b6847dfddaf9c" title="Gets a connection to a remote address.">dbus_connection_open</a> (<span class="keyword">const</span> <span class="keywordtype">char</span>     *address,
<a name="l02617"></a>02617                       <a class="code" href="structDBusError.html" title="Object representing an exception.">DBusError</a>      *error)
<a name="l02618"></a>02618 {
<a name="l02619"></a>02619   <a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection;
<a name="l02620"></a>02620 
<a name="l02621"></a>02621   _dbus_return_val_if_fail (address != <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="l02622"></a>02622   _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="l02623"></a>02623 
<a name="l02624"></a>02624   connection = _dbus_connection_open_internal (address,
<a name="l02625"></a>02625                                                <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>,
<a name="l02626"></a>02626                                                error);
<a name="l02627"></a>02627 
<a name="l02628"></a>02628   <span class="keywordflow">return</span> connection;
<a name="l02629"></a>02629 }
<a name="l02630"></a>02630 
<a name="l02658"></a>02658 <a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>*
<a name="l02659"></a><a class="code" href="group__DBusConnection.html#ga434e3fc7ee420fd30e2f05e57ff26b1d">02659</a> <a class="code" href="group__DBusConnection.html#ga434e3fc7ee420fd30e2f05e57ff26b1d" title="Opens a new, dedicated connection to a remote address.">dbus_connection_open_private</a> (<span class="keyword">const</span> <span class="keywordtype">char</span>     *address,
<a name="l02660"></a>02660                               <a class="code" href="structDBusError.html" title="Object representing an exception.">DBusError</a>      *error)
<a name="l02661"></a>02661 {
<a name="l02662"></a>02662   <a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection;
<a name="l02663"></a>02663 
<a name="l02664"></a>02664   _dbus_return_val_if_fail (address != <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="l02665"></a>02665   _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="l02666"></a>02666 
<a name="l02667"></a>02667   connection = _dbus_connection_open_internal (address,
<a name="l02668"></a>02668                                                <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>,
<a name="l02669"></a>02669                                                error);
<a name="l02670"></a>02670 
<a name="l02671"></a>02671   <span class="keywordflow">return</span> connection;
<a name="l02672"></a>02672 }
<a name="l02673"></a>02673 
<a name="l02680"></a>02680 <a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *
<a name="l02681"></a><a class="code" href="group__DBusConnection.html#gae34751e15f114217e5ad10c663e2ef2e">02681</a> <a class="code" href="group__DBusConnection.html#gae34751e15f114217e5ad10c663e2ef2e" title="Increments the reference count of a DBusConnection.">dbus_connection_ref</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l02682"></a>02682 {
<a name="l02683"></a>02683   <a class="code" href="group__DBusTypes.html#gab18afa60e9b17b6e322735bda3d863d8" title="A 32-bit signed integer on all platforms.">dbus_int32_t</a> old_refcount;
<a name="l02684"></a>02684 
<a name="l02685"></a>02685   _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="l02686"></a>02686   _dbus_return_val_if_fail (connection-&gt;generation == <a class="code" href="group__DBusMemoryInternals.html#ga7c224d82013e2bdc181c1d85dcb6f295" title="_dbus_current_generation is used to track each time that dbus_shutdown() is called, so we can reinit things after it&#39;s been called.">_dbus_current_generation</a>, <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l02687"></a>02687   old_refcount = <a class="code" href="group__DBusSysdeps.html#gae74c3fcf12acaeccdb152ef907de951c" title="Atomically increments an integer.">_dbus_atomic_inc</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#a6fbf0227071fc20ffd5b0e79aef58e92" title="Reference count.">refcount</a>);
<a name="l02688"></a>02688   _dbus_connection_trace_ref (connection, old_refcount, old_refcount + 1,
<a name="l02689"></a>02689       <span class="stringliteral">&quot;ref&quot;</span>);
<a name="l02690"></a>02690 
<a name="l02691"></a>02691   <span class="keywordflow">return</span> connection;
<a name="l02692"></a>02692 }
<a name="l02693"></a>02693 
<a name="l02694"></a>02694 <span class="keyword">static</span> <span class="keywordtype">void</span>
<a name="l02695"></a>02695 free_outgoing_message (<span class="keywordtype">void</span> *element,
<a name="l02696"></a>02696                        <span class="keywordtype">void</span> *data)
<a name="l02697"></a>02697 {
<a name="l02698"></a>02698   <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message = element;
<a name="l02699"></a>02699   <a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection = data;
<a name="l02700"></a>02700 
<a name="l02701"></a>02701   <a class="code" href="group__DBusMessageInternals.html#gac84be3fd98e49409c1245a87c7de6f7d" title="Removes a counter tracking the size/unix fds of this message, and decrements the counter by the size/...">_dbus_message_remove_counter</a> (message, connection-&gt;<a class="code" href="structDBusConnection.html#a5dcb660883904035076579c6d2f46501" title="Counts size of outgoing messages.">outgoing_counter</a>);
<a name="l02702"></a>02702   <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="l02703"></a>02703 }
<a name="l02704"></a>02704 
<a name="l02705"></a>02705 <span class="comment">/* This is run without the mutex held, but after the last reference</span>
<a name="l02706"></a>02706 <span class="comment"> * to the connection has been dropped we should have no thread-related</span>
<a name="l02707"></a>02707 <span class="comment"> * problems</span>
<a name="l02708"></a>02708 <span class="comment"> */</span>
<a name="l02709"></a>02709 <span class="keyword">static</span> <span class="keywordtype">void</span>
<a name="l02710"></a>02710 _dbus_connection_last_unref (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l02711"></a>02711 {
<a name="l02712"></a>02712   <a class="code" href="structDBusList.html" title="A node in a linked list.">DBusList</a> *link;
<a name="l02713"></a>02713 
<a name="l02714"></a>02714   _dbus_verbose (<span class="stringliteral">&quot;Finalizing connection %p\n&quot;</span>, connection);
<a name="l02715"></a>02715 
<a name="l02716"></a>02716   _dbus_assert (<a class="code" href="group__DBusSysdeps.html#ga626c810359ba0e362367ce2ec6691aca" title="Atomically get the value of an integer.">_dbus_atomic_get</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#a6fbf0227071fc20ffd5b0e79aef58e92" title="Reference count.">refcount</a>) == 0);
<a name="l02717"></a>02717 
<a name="l02718"></a>02718   <span class="comment">/* You have to disconnect the connection before unref:ing it. Otherwise</span>
<a name="l02719"></a>02719 <span class="comment">   * you won&#39;t get the disconnected message.</span>
<a name="l02720"></a>02720 <span class="comment">   */</span>
<a name="l02721"></a>02721   _dbus_assert (!<a class="code" href="group__DBusTransport.html#gaceee4b098b0177870ad934daad90a9c6" title="Returns TRUE if the transport has not been disconnected.">_dbus_transport_get_is_connected</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>));
<a name="l02722"></a>02722   _dbus_assert (connection-&gt;<a class="code" href="structDBusConnection.html#ad1abb7ad98db87f32b4abda22df075bd" title="GUID of server if we are in shared_connections, NULL if server GUID is unknown or connection is priva...">server_guid</a> == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l02723"></a>02723   
<a name="l02724"></a>02724   <span class="comment">/* ---- We&#39;re going to call various application callbacks here, hope it doesn&#39;t break anything... */</span>
<a name="l02725"></a>02725   <a class="code" href="group__DBusObjectTree.html#ga1c51e43233ce0f3855c128f2555317eb" title="Free all the handlers in the tree.">_dbus_object_tree_free_all_unlocked</a> (connection-&gt;<a class="code" href="structDBusConnection.html#acd289771721a459f4f9cdeaca0fa87c2" title="Object path handlers registered with this connection.">objects</a>);
<a name="l02726"></a>02726   
<a name="l02727"></a>02727   <a class="code" href="group__DBusConnection.html#ga55ff88cd22c0672441c7deffbfb68fbf" title="Set a function to be invoked when the dispatch status changes.">dbus_connection_set_dispatch_status_function</a> (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 class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l02728"></a>02728   <a class="code" href="group__DBusConnection.html#ga2b1df13251c7ec348bcba39c0924e881" title="Sets the mainloop wakeup function for the connection.">dbus_connection_set_wakeup_main_function</a> (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 class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l02729"></a>02729   <a class="code" href="group__DBusConnection.html#ga6b78379badb4c5804344f4f3d87a958a" title="Sets a predicate function used to determine whether a given user ID is allowed to connect...">dbus_connection_set_unix_user_function</a> (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 class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l02730"></a>02730   <a class="code" href="group__DBusConnection.html#gaa35ced9ccd29d3366749ae383b120f9c" title="Sets a predicate function used to determine whether a given user ID is allowed to connect...">dbus_connection_set_windows_user_function</a> (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 class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l02731"></a>02731   
<a name="l02732"></a>02732   <a class="code" href="group__DBusWatchInternals.html#gac3f75c0da2c8c51e8708f45dd27f9e2d" title="Frees a DBusWatchList.">_dbus_watch_list_free</a> (connection-&gt;<a class="code" href="structDBusConnection.html#abdb6a32972d924531fb2cd80c7fd6d37" title="Stores active watches.">watches</a>);
<a name="l02733"></a>02733   connection-&gt;<a class="code" href="structDBusConnection.html#abdb6a32972d924531fb2cd80c7fd6d37" title="Stores active watches.">watches</a> = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l02734"></a>02734   
<a name="l02735"></a>02735   <a class="code" href="group__DBusTimeoutInternals.html#ga1b399ef2d7f128e59bb32dbb5b590e1b" title="Frees a DBusTimeoutList.">_dbus_timeout_list_free</a> (connection-&gt;<a class="code" href="structDBusConnection.html#af3936ac5c968f2ac09bf05cf36025994" title="Stores active timeouts.">timeouts</a>);
<a name="l02736"></a>02736   connection-&gt;<a class="code" href="structDBusConnection.html#af3936ac5c968f2ac09bf05cf36025994" title="Stores active timeouts.">timeouts</a> = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l02737"></a>02737 
<a name="l02738"></a>02738   <a class="code" href="group__DBusDataSlot.html#gabc399733376c462c3010271a2d431e73" title="Frees the data slot list and all data slots contained in it, calling application-provided free functi...">_dbus_data_slot_list_free</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#a0f805edcd9c09aaf45974510403dccbd" title="Data stored by allocated integer ID.">slot_list</a>);
<a name="l02739"></a>02739   
<a name="l02740"></a>02740   link = <a class="code" href="group__DBusList.html#ga1e26ce4fb4acb50593bd5ed2f4eeb3ae" title="Gets the first link in the list.">_dbus_list_get_first_link</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#a32d14cefcb4daea257544397755d45ed" title="List of filters.">filter_list</a>);
<a name="l02741"></a>02741   <span class="keywordflow">while</span> (link != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l02742"></a>02742     {
<a name="l02743"></a>02743       <a class="code" href="structDBusMessageFilter.html" title="Internal struct representing a message filter function.">DBusMessageFilter</a> *filter = link-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a>;
<a name="l02744"></a>02744       <a class="code" href="structDBusList.html" title="A node in a linked list.">DBusList</a> *next = <a class="code" href="group__DBusList.html#gaede4ace46d5ee497d75074bfec4490a2" title="Gets the next link in the list, or NULL if there are no more links.">_dbus_list_get_next_link</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#a32d14cefcb4daea257544397755d45ed" title="List of filters.">filter_list</a>, link);
<a name="l02745"></a>02745 
<a name="l02746"></a>02746       filter-&gt;<a class="code" href="structDBusMessageFilter.html#a56b3643122277ed5dc3d4f07793617fa" title="Function to call to filter.">function</a> = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l02747"></a>02747       _dbus_message_filter_unref (filter); <span class="comment">/* calls app callback */</span>
<a name="l02748"></a>02748       link-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a> = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l02749"></a>02749       
<a name="l02750"></a>02750       link = next;
<a name="l02751"></a>02751     }
<a name="l02752"></a>02752   <a class="code" href="group__DBusList.html#gaa36d13444a050a923941c53650b72f9d" title="Frees all links in the list and sets the list head to NULL.">_dbus_list_clear</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#a32d14cefcb4daea257544397755d45ed" title="List of filters.">filter_list</a>);
<a name="l02753"></a>02753   
<a name="l02754"></a>02754   <span class="comment">/* ---- Done with stuff that invokes application callbacks */</span>
<a name="l02755"></a>02755 
<a name="l02756"></a>02756   <a class="code" href="group__DBusObjectTree.html#ga7639e273ab160c422a7cef0cda60ded5" title="Decrement the reference count.">_dbus_object_tree_unref</a> (connection-&gt;<a class="code" href="structDBusConnection.html#acd289771721a459f4f9cdeaca0fa87c2" title="Object path handlers registered with this connection.">objects</a>);  
<a name="l02757"></a>02757 
<a name="l02758"></a>02758   <a class="code" href="group__DBusHashTable.html#ga96b777e00764b44e0f3216fd8478f5a9" title="Decrements the reference count for a hash table, freeing the hash table if the count reaches zero...">_dbus_hash_table_unref</a> (connection-&gt;<a class="code" href="structDBusConnection.html#ad8fa077f91fe62d0c10862e2ff9e86ca" title="Hash of message serials to DBusPendingCall.">pending_replies</a>);
<a name="l02759"></a>02759   connection-&gt;<a class="code" href="structDBusConnection.html#ad8fa077f91fe62d0c10862e2ff9e86ca" title="Hash of message serials to DBusPendingCall.">pending_replies</a> = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l02760"></a>02760   
<a name="l02761"></a>02761   <a class="code" href="group__DBusList.html#gaa36d13444a050a923941c53650b72f9d" title="Frees all links in the list and sets the list head to NULL.">_dbus_list_clear</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#a32d14cefcb4daea257544397755d45ed" title="List of filters.">filter_list</a>);
<a name="l02762"></a>02762   
<a name="l02763"></a>02763   <a class="code" href="group__DBusList.html#ga8dd69084b53361803a765e6d53d5b9d1" title="Calls the given function for each element in the list.">_dbus_list_foreach</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#a714fd51af8730c367b079594c7f756ae" title="Queue of messages we need to send, send the end of the list first.">outgoing_messages</a>,
<a name="l02764"></a>02764                       free_outgoing_message,
<a name="l02765"></a>02765                       connection);
<a name="l02766"></a>02766   <a class="code" href="group__DBusList.html#gaa36d13444a050a923941c53650b72f9d" title="Frees all links in the list and sets the list head to NULL.">_dbus_list_clear</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#a714fd51af8730c367b079594c7f756ae" title="Queue of messages we need to send, send the end of the list first.">outgoing_messages</a>);
<a name="l02767"></a>02767   
<a name="l02768"></a>02768   <a class="code" href="group__DBusList.html#ga8dd69084b53361803a765e6d53d5b9d1" title="Calls the given function for each element in the list.">_dbus_list_foreach</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#aacb3a29956aa7712db37916194fde869" title="Queue of messages we have received, end of the list received most recently.">incoming_messages</a>,
<a name="l02769"></a>02769                       (DBusForeachFunction) <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>,
<a name="l02770"></a>02770                       <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l02771"></a>02771   <a class="code" href="group__DBusList.html#gaa36d13444a050a923941c53650b72f9d" title="Frees all links in the list and sets the list head to NULL.">_dbus_list_clear</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#aacb3a29956aa7712db37916194fde869" title="Queue of messages we have received, end of the list received most recently.">incoming_messages</a>);
<a name="l02772"></a>02772 
<a name="l02773"></a>02773   <a class="code" href="group__DBusResources.html#ga48d9b53d1a395ab3c4f1846ca569ef3f" title="Decrements refcount of the counter and possibly finalizes the counter.">_dbus_counter_unref</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a5dcb660883904035076579c6d2f46501" title="Counts size of outgoing messages.">outgoing_counter</a>);
<a name="l02774"></a>02774 
<a name="l02775"></a>02775   <a class="code" href="group__DBusTransport.html#gab7c53c32a2320c81aae8ce4345762e73" title="Decrements the reference count for the transport.">_dbus_transport_unref</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>);
<a name="l02776"></a>02776 
<a name="l02777"></a>02777   <span class="keywordflow">if</span> (connection-&gt;<a class="code" href="structDBusConnection.html#aa70afc41f6184604c027e7f71a314d7f" title="Preallocated list node for queueing the disconnection message.">disconnect_message_link</a>)
<a name="l02778"></a>02778     {
<a name="l02779"></a>02779       <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message = connection-&gt;<a class="code" href="structDBusConnection.html#aa70afc41f6184604c027e7f71a314d7f" title="Preallocated list node for queueing the disconnection message.">disconnect_message_link</a>-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a>;
<a name="l02780"></a>02780       <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="l02781"></a>02781       <a class="code" href="group__DBusList.html#ga6e824f717125ce40c549d5402e32610f" title="Frees a linked list node allocated with _dbus_list_alloc_link.">_dbus_list_free_link</a> (connection-&gt;<a class="code" href="structDBusConnection.html#aa70afc41f6184604c027e7f71a314d7f" title="Preallocated list node for queueing the disconnection message.">disconnect_message_link</a>);
<a name="l02782"></a>02782     }
<a name="l02783"></a>02783 
<a name="l02784"></a>02784   <a class="code" href="group__DBusThreadsInternals.html#ga29444a34b569fca22fac48067832aacd" title="Frees a condition variable; does nothing if passed a NULL pointer.">_dbus_condvar_free_at_location</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#a201f92bbc0947b503a36eaff9ae0ede9" title="Notify when dispatch_acquired is available.">dispatch_cond</a>);
<a name="l02785"></a>02785   <a class="code" href="group__DBusThreadsInternals.html#ga29444a34b569fca22fac48067832aacd" title="Frees a condition variable; does nothing if passed a NULL pointer.">_dbus_condvar_free_at_location</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#a6d87e03eea7aaff53f5574efcfb8c3e4" title="Notify when io_path_acquired is available.">io_path_cond</a>);
<a name="l02786"></a>02786 
<a name="l02787"></a>02787   <a class="code" href="group__DBusThreadsInternals.html#ga20ec8aeb88b1f65445a4d3c1c0bd0048" title="Frees a DBusCMutex; does nothing if passed a NULL pointer.">_dbus_cmutex_free_at_location</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#aaad1c7d6e6ba3e049ef790f4f9aa35cd" title="Protects io_path_acquired.">io_path_mutex</a>);
<a name="l02788"></a>02788   <a class="code" href="group__DBusThreadsInternals.html#ga20ec8aeb88b1f65445a4d3c1c0bd0048" title="Frees a DBusCMutex; does nothing if passed a NULL pointer.">_dbus_cmutex_free_at_location</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#ad9e7bf73a48f4951b24ce8eec7bb7ac5" title="Protects dispatch_acquired.">dispatch_mutex</a>);
<a name="l02789"></a>02789 
<a name="l02790"></a>02790   <a class="code" href="group__DBusThreadsInternals.html#gae1c95a3f47bcc78d32fc0a5a8ed37c91" title="Frees a DBusRMutex; does nothing if passed a NULL pointer.">_dbus_rmutex_free_at_location</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#a773fb4ecd2738548dbbfbe6d1206da92" title="Lock on slot_list so overall connection lock need not be taken.">slot_mutex</a>);
<a name="l02791"></a>02791 
<a name="l02792"></a>02792   <a class="code" href="group__DBusThreadsInternals.html#gae1c95a3f47bcc78d32fc0a5a8ed37c91" title="Frees a DBusRMutex; does nothing if passed a NULL pointer.">_dbus_rmutex_free_at_location</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#a98e26cfd09ddbf0238f90bf4965641bf" title="Lock on the entire DBusConnection.">mutex</a>);
<a name="l02793"></a>02793   
<a name="l02794"></a>02794   <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> (connection);
<a name="l02795"></a>02795 }
<a name="l02796"></a>02796 
<a name="l02816"></a>02816 <span class="keywordtype">void</span>
<a name="l02817"></a><a class="code" href="group__DBusConnection.html#ga6385ff09bc108238c4429e7c195dab25">02817</a> <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> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l02818"></a>02818 {
<a name="l02819"></a>02819   <a class="code" href="group__DBusTypes.html#gab18afa60e9b17b6e322735bda3d863d8" title="A 32-bit signed integer on all platforms.">dbus_int32_t</a> old_refcount;
<a name="l02820"></a>02820 
<a name="l02821"></a>02821   _dbus_return_if_fail (connection != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l02822"></a>02822   _dbus_return_if_fail (connection-&gt;generation == <a class="code" href="group__DBusMemoryInternals.html#ga7c224d82013e2bdc181c1d85dcb6f295" title="_dbus_current_generation is used to track each time that dbus_shutdown() is called, so we can reinit things after it&#39;s been called.">_dbus_current_generation</a>);
<a name="l02823"></a>02823 
<a name="l02824"></a>02824   old_refcount = <a class="code" href="group__DBusSysdeps.html#ga3c50a069f795dceeb9172fe2b517bbdc" title="Atomically decrement an integer.">_dbus_atomic_dec</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#a6fbf0227071fc20ffd5b0e79aef58e92" title="Reference count.">refcount</a>);
<a name="l02825"></a>02825 
<a name="l02826"></a>02826   _dbus_connection_trace_ref (connection, old_refcount, old_refcount - 1,
<a name="l02827"></a>02827       <span class="stringliteral">&quot;unref&quot;</span>);
<a name="l02828"></a>02828 
<a name="l02829"></a>02829   <span class="keywordflow">if</span> (old_refcount == 1)
<a name="l02830"></a>02830     {
<a name="l02831"></a>02831 <span class="preprocessor">#ifndef DBUS_DISABLE_CHECKS</span>
<a name="l02832"></a>02832 <span class="preprocessor"></span>      <span class="keywordflow">if</span> (<a class="code" href="group__DBusTransport.html#gaceee4b098b0177870ad934daad90a9c6" title="Returns TRUE if the transport has not been disconnected.">_dbus_transport_get_is_connected</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>))
<a name="l02833"></a>02833         {
<a name="l02834"></a>02834           <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;The last reference on a connection was dropped without closing the connection. This is a bug in an application. See dbus_connection_unref() documentation for details.\n%s&quot;</span>,
<a name="l02835"></a>02835                                    connection-&gt;<a class="code" href="structDBusConnection.html#aae47138b9b2494b65072ff300d631aa8" title="TRUE if libdbus owns a reference to the connection and can return it from dbus_connection_open() more...">shareable</a> ?
<a name="l02836"></a>02836                                    <span class="stringliteral">&quot;Most likely, the application called unref() too many times and removed a reference belonging to libdbus, since this is a shared connection.\n&quot;</span> : 
<a name="l02837"></a>02837                                     <span class="stringliteral">&quot;Most likely, the application was supposed to call dbus_connection_close(), since this is a private connection.\n&quot;</span>);
<a name="l02838"></a>02838           <span class="keywordflow">return</span>;
<a name="l02839"></a>02839         }
<a name="l02840"></a>02840 <span class="preprocessor">#endif</span>
<a name="l02841"></a>02841 <span class="preprocessor"></span>      _dbus_connection_last_unref (connection);
<a name="l02842"></a>02842     }
<a name="l02843"></a>02843 }
<a name="l02844"></a>02844 
<a name="l02845"></a>02845 <span class="comment">/*</span>
<a name="l02846"></a>02846 <span class="comment"> * Note that the transport can disconnect itself (other end drops us)</span>
<a name="l02847"></a>02847 <span class="comment"> * and in that case this function never runs. So this function must</span>
<a name="l02848"></a>02848 <span class="comment"> * not do anything more than disconnect the transport and update the</span>
<a name="l02849"></a>02849 <span class="comment"> * dispatch status.</span>
<a name="l02850"></a>02850 <span class="comment"> * </span>
<a name="l02851"></a>02851 <span class="comment"> * If the transport self-disconnects, then we assume someone will</span>
<a name="l02852"></a>02852 <span class="comment"> * dispatch the connection to cause the dispatch status update.</span>
<a name="l02853"></a>02853 <span class="comment"> */</span>
<a name="l02854"></a>02854 <span class="keyword">static</span> <span class="keywordtype">void</span>
<a name="l02855"></a>02855 _dbus_connection_close_possibly_shared_and_unlock (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l02856"></a>02856 {
<a name="l02857"></a>02857   <a class="code" href="group__DBusConnection.html#gabf250a32ff740b2a8c99136e0142d8d2" title="Indicates the status of incoming data on a DBusConnection.">DBusDispatchStatus</a> status;
<a name="l02858"></a>02858 
<a name="l02859"></a>02859   HAVE_LOCK_CHECK (connection);
<a name="l02860"></a>02860   
<a name="l02861"></a>02861   _dbus_verbose (<span class="stringliteral">&quot;Disconnecting %p\n&quot;</span>, connection);
<a name="l02862"></a>02862 
<a name="l02863"></a>02863   <span class="comment">/* We need to ref because update_dispatch_status_and_unlock will unref</span>
<a name="l02864"></a>02864 <span class="comment">   * the connection if it was shared and libdbus was the only remaining</span>
<a name="l02865"></a>02865 <span class="comment">   * refcount holder.</span>
<a name="l02866"></a>02866 <span class="comment">   */</span>
<a name="l02867"></a>02867   <a class="code" href="group__DBusConnectionInternals.html#ga7151f75b5d2308ec80cfe893aba72aa1" title="Increments the reference count of a DBusConnection.">_dbus_connection_ref_unlocked</a> (connection);
<a name="l02868"></a>02868   
<a name="l02869"></a>02869   <a class="code" href="group__DBusTransport.html#ga78444dd8f6c6d6b429433ad81c3e318a" title="Closes our end of the connection to a remote application.">_dbus_transport_disconnect</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>);
<a name="l02870"></a>02870 
<a name="l02871"></a>02871   <span class="comment">/* This has the side effect of queuing the disconnect message link</span>
<a name="l02872"></a>02872 <span class="comment">   * (unless we don&#39;t have enough memory, possibly, so don&#39;t assert it).</span>
<a name="l02873"></a>02873 <span class="comment">   * After the disconnect message link is queued, dbus_bus_get/dbus_connection_open</span>
<a name="l02874"></a>02874 <span class="comment">   * should never again return the newly-disconnected connection.</span>
<a name="l02875"></a>02875 <span class="comment">   *</span>
<a name="l02876"></a>02876 <span class="comment">   * However, we only unref the shared connection and exit_on_disconnect when</span>
<a name="l02877"></a>02877 <span class="comment">   * the disconnect message reaches the head of the message queue,</span>
<a name="l02878"></a>02878 <span class="comment">   * NOT when it&#39;s first queued.</span>
<a name="l02879"></a>02879 <span class="comment">   */</span>
<a name="l02880"></a>02880   status = _dbus_connection_get_dispatch_status_unlocked (connection);
<a name="l02881"></a>02881 
<a name="l02882"></a>02882   <span class="comment">/* This calls out to user code */</span>
<a name="l02883"></a>02883   _dbus_connection_update_dispatch_status_and_unlock (connection, status);
<a name="l02884"></a>02884 
<a name="l02885"></a>02885   <span class="comment">/* Could also call out to user code */</span>
<a name="l02886"></a>02886   <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="l02887"></a>02887 }
<a name="l02888"></a>02888 
<a name="l02931"></a>02931 <span class="keywordtype">void</span>
<a name="l02932"></a><a class="code" href="group__DBusConnection.html#ga2522ac5075dfe0a1535471f6e045e1ee">02932</a> <a class="code" href="group__DBusConnection.html#ga2522ac5075dfe0a1535471f6e045e1ee" title="Closes a private connection, so no further data can be sent or received.">dbus_connection_close</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l02933"></a>02933 {
<a name="l02934"></a>02934   _dbus_return_if_fail (connection != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l02935"></a>02935   _dbus_return_if_fail (connection-&gt;generation == <a class="code" href="group__DBusMemoryInternals.html#ga7c224d82013e2bdc181c1d85dcb6f295" title="_dbus_current_generation is used to track each time that dbus_shutdown() is called, so we can reinit things after it&#39;s been called.">_dbus_current_generation</a>);
<a name="l02936"></a>02936 
<a name="l02937"></a>02937   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l02938"></a>02938 
<a name="l02939"></a>02939 <span class="preprocessor">#ifndef DBUS_DISABLE_CHECKS</span>
<a name="l02940"></a>02940 <span class="preprocessor"></span>  <span class="keywordflow">if</span> (connection-&gt;<a class="code" href="structDBusConnection.html#aae47138b9b2494b65072ff300d631aa8" title="TRUE if libdbus owns a reference to the connection and can return it from dbus_connection_open() more...">shareable</a>)
<a name="l02941"></a>02941     {
<a name="l02942"></a>02942       <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l02943"></a>02943 
<a name="l02944"></a>02944       <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;Applications must not close shared connections - see dbus_connection_close() docs. This is a bug in the application.\n&quot;</span>);
<a name="l02945"></a>02945       <span class="keywordflow">return</span>;
<a name="l02946"></a>02946     }
<a name="l02947"></a>02947 <span class="preprocessor">#endif</span>
<a name="l02948"></a>02948 <span class="preprocessor"></span>  
<a name="l02949"></a>02949   _dbus_connection_close_possibly_shared_and_unlock (connection);
<a name="l02950"></a>02950 }
<a name="l02951"></a>02951 
<a name="l02952"></a>02952 <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="l02953"></a>02953 _dbus_connection_get_is_connected_unlocked (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l02954"></a>02954 {
<a name="l02955"></a>02955   HAVE_LOCK_CHECK (connection);
<a name="l02956"></a>02956   <span class="keywordflow">return</span> <a class="code" href="group__DBusTransport.html#gaceee4b098b0177870ad934daad90a9c6" title="Returns TRUE if the transport has not been disconnected.">_dbus_transport_get_is_connected</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>);
<a name="l02957"></a>02957 }
<a name="l02958"></a>02958 
<a name="l02972"></a>02972 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l02973"></a><a class="code" href="group__DBusConnection.html#ga611ae94556af36fe30bfb547366ca4e1">02973</a> <a class="code" href="group__DBusConnection.html#ga611ae94556af36fe30bfb547366ca4e1" title="Gets whether the connection is currently open.">dbus_connection_get_is_connected</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l02974"></a>02974 {
<a name="l02975"></a>02975   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> res;
<a name="l02976"></a>02976 
<a name="l02977"></a>02977   _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="l02978"></a>02978   
<a name="l02979"></a>02979   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l02980"></a>02980   res = _dbus_connection_get_is_connected_unlocked (connection);
<a name="l02981"></a>02981   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l02982"></a>02982   
<a name="l02983"></a>02983   <span class="keywordflow">return</span> res;
<a name="l02984"></a>02984 }
<a name="l02985"></a>02985 
<a name="l02994"></a>02994 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l02995"></a><a class="code" href="group__DBusConnection.html#ga2f1fa02c9897b6f07f4d33c862de4a1d">02995</a> <a class="code" href="group__DBusConnection.html#ga2f1fa02c9897b6f07f4d33c862de4a1d" title="Gets whether the connection was authenticated.">dbus_connection_get_is_authenticated</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l02996"></a>02996 {
<a name="l02997"></a>02997   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> res;
<a name="l02998"></a>02998 
<a name="l02999"></a>02999   _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="l03000"></a>03000 
<a name="l03001"></a>03001   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l03002"></a>03002   res = <a class="code" href="group__DBusTransport.html#gabe774b134a4bf8c8fc09e6186470874f" title="Returns TRUE if we have been authenticated.">_dbus_transport_try_to_authenticate</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>);
<a name="l03003"></a>03003   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l03004"></a>03004   
<a name="l03005"></a>03005   <span class="keywordflow">return</span> res;
<a name="l03006"></a>03006 }
<a name="l03007"></a>03007 
<a name="l03028"></a>03028 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l03029"></a><a class="code" href="group__DBusConnection.html#gaa6c5d523e16d8a5b9316c92d9ff1ac17">03029</a> <a class="code" href="group__DBusConnection.html#gaa6c5d523e16d8a5b9316c92d9ff1ac17" title="Gets whether the connection is not authenticated as a specific user.">dbus_connection_get_is_anonymous</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l03030"></a>03030 {
<a name="l03031"></a>03031   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> res;
<a name="l03032"></a>03032 
<a name="l03033"></a>03033   _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="l03034"></a>03034   
<a name="l03035"></a>03035   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l03036"></a>03036   res = <a class="code" href="group__DBusTransport.html#gaf0588dd4a6d1c556dd885d4c67622399" title="See dbus_connection_get_is_anonymous().">_dbus_transport_get_is_anonymous</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>);
<a name="l03037"></a>03037   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l03038"></a>03038   
<a name="l03039"></a>03039   <span class="keywordflow">return</span> res;
<a name="l03040"></a>03040 }
<a name="l03041"></a>03041 
<a name="l03073"></a>03073 <span class="keywordtype">char</span>*
<a name="l03074"></a><a class="code" href="group__DBusConnection.html#gae6c19e146a37f9de6a06c1617874bed9">03074</a> <a class="code" href="group__DBusConnection.html#gae6c19e146a37f9de6a06c1617874bed9" title="Gets the ID of the server address we are authenticated to, if this connection is on the client side...">dbus_connection_get_server_id</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l03075"></a>03075 {
<a name="l03076"></a>03076   <span class="keywordtype">char</span> *id;
<a name="l03077"></a>03077 
<a name="l03078"></a>03078   _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="l03079"></a>03079 
<a name="l03080"></a>03080   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l03081"></a>03081   <span class="keywordtype">id</span> = <a class="code" href="group__DBusInternalsUtils.html#ga9d00d77f6595b9d7ac1baf59d44bf58c" title="Duplicates a string.">_dbus_strdup</a> (<a class="code" href="group__DBusTransport.html#ga920abde00e77a970330fa3fc552fe7ea" title="Gets the id of the server we are connected to (see dbus_server_get_id()).">_dbus_transport_get_server_id</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>));
<a name="l03082"></a>03082   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l03083"></a>03083 
<a name="l03084"></a>03084   <span class="keywordflow">return</span> id;
<a name="l03085"></a>03085 }
<a name="l03086"></a>03086 
<a name="l03104"></a>03104 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l03105"></a><a class="code" href="group__DBusConnection.html#ga3e41509b3afdbc22872bacc5754e85c2">03105</a> <a class="code" href="group__DBusConnection.html#ga3e41509b3afdbc22872bacc5754e85c2" title="Tests whether a certain type can be send via the connection.">dbus_connection_can_send_type</a>(<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l03106"></a>03106                                   <span class="keywordtype">int</span> type)
<a name="l03107"></a>03107 {
<a name="l03108"></a>03108   _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="l03109"></a>03109 
<a name="l03110"></a>03110   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusSignature.html#ga7093ae3b35eb073dab939dae69b8c689" title="Return TRUE if the argument is a valid typecode.">dbus_type_is_valid</a> (type))
<a name="l03111"></a>03111     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l03112"></a>03112 
<a name="l03113"></a>03113   <span class="keywordflow">if</span> (type != <a class="code" href="group__DBusProtocol.html#ga59f8acaeb207b182982dfb97174b7f16" title="Type code marking a unix file descriptor.">DBUS_TYPE_UNIX_FD</a>)
<a name="l03114"></a>03114     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l03115"></a>03115 
<a name="l03116"></a>03116 <span class="preprocessor">#ifdef HAVE_UNIX_FD_PASSING</span>
<a name="l03117"></a>03117 <span class="preprocessor"></span>  {
<a name="l03118"></a>03118     <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> b;
<a name="l03119"></a>03119 
<a name="l03120"></a>03120     <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a>(connection);
<a name="l03121"></a>03121     b = <a class="code" href="group__DBusTransport.html#gab98dc7cad59472a4513489628f1393f1" title="Returns TRUE if the transport supports sending unix fds.">_dbus_transport_can_pass_unix_fd</a>(connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>);
<a name="l03122"></a>03122     <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a>(connection);
<a name="l03123"></a>03123 
<a name="l03124"></a>03124     <span class="keywordflow">return</span> b;
<a name="l03125"></a>03125   }
<a name="l03126"></a>03126 <span class="preprocessor">#endif</span>
<a name="l03127"></a>03127 <span class="preprocessor"></span>
<a name="l03128"></a>03128   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l03129"></a>03129 }
<a name="l03130"></a>03130 
<a name="l03144"></a>03144 <span class="keywordtype">void</span>
<a name="l03145"></a><a class="code" href="group__DBusConnection.html#ga19091beb74f1504b0e862a7ad10e71cd">03145</a> <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> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l03146"></a>03146                                         <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>     exit_on_disconnect)
<a name="l03147"></a>03147 {
<a name="l03148"></a>03148   _dbus_return_if_fail (connection != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l03149"></a>03149 
<a name="l03150"></a>03150   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l03151"></a>03151   connection-&gt;<a class="code" href="structDBusConnection.html#a2a9f22339f90157f308a532462218404" title="If TRUE, exit after handling disconnect signal.">exit_on_disconnect</a> = exit_on_disconnect != <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l03152"></a>03152   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l03153"></a>03153 }
<a name="l03154"></a>03154 
<a name="l03164"></a>03164 <a class="code" href="structDBusPreallocatedSend.html" title="Internals of DBusPreallocatedSend.">DBusPreallocatedSend</a>*
<a name="l03165"></a><a class="code" href="group__DBusConnection.html#ga6136968eba30e8313e668a622fcfb08d">03165</a> <a class="code" href="group__DBusConnection.html#ga6136968eba30e8313e668a622fcfb08d" title="Preallocates resources needed to send a message, allowing the message to be sent without the possibil...">dbus_connection_preallocate_send</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l03166"></a>03166 {
<a name="l03167"></a>03167   <a class="code" href="structDBusPreallocatedSend.html" title="Internals of DBusPreallocatedSend.">DBusPreallocatedSend</a> *preallocated;
<a name="l03168"></a>03168 
<a name="l03169"></a>03169   _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="l03170"></a>03170 
<a name="l03171"></a>03171   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l03172"></a>03172   
<a name="l03173"></a>03173   preallocated =
<a name="l03174"></a>03174     _dbus_connection_preallocate_send_unlocked (connection);
<a name="l03175"></a>03175 
<a name="l03176"></a>03176   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l03177"></a>03177 
<a name="l03178"></a>03178   <span class="keywordflow">return</span> preallocated;
<a name="l03179"></a>03179 }
<a name="l03180"></a>03180 
<a name="l03190"></a>03190 <span class="keywordtype">void</span>
<a name="l03191"></a><a class="code" href="group__DBusConnection.html#gad0ea06307b418616711131ea7bdae8ac">03191</a> <a class="code" href="group__DBusConnection.html#gad0ea06307b418616711131ea7bdae8ac" title="Frees preallocated message-sending resources from dbus_connection_preallocate_send().">dbus_connection_free_preallocated_send</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>       *connection,
<a name="l03192"></a>03192                                         <a class="code" href="structDBusPreallocatedSend.html" title="Internals of DBusPreallocatedSend.">DBusPreallocatedSend</a> *preallocated)
<a name="l03193"></a>03193 {
<a name="l03194"></a>03194   _dbus_return_if_fail (connection != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l03195"></a>03195   _dbus_return_if_fail (preallocated != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);  
<a name="l03196"></a>03196   _dbus_return_if_fail (connection == preallocated-&gt;<a class="code" href="structDBusPreallocatedSend.html#a465af3647772c89500df0b46f43d035b" title="Connection we&#39;d send the message to.">connection</a>);
<a name="l03197"></a>03197 
<a name="l03198"></a>03198   <a class="code" href="group__DBusList.html#ga6e824f717125ce40c549d5402e32610f" title="Frees a linked list node allocated with _dbus_list_alloc_link.">_dbus_list_free_link</a> (preallocated-&gt;<a class="code" href="structDBusPreallocatedSend.html#ae164fe13f866bebbd714b526104c5bff" title="Preallocated link in the queue.">queue_link</a>);
<a name="l03199"></a>03199   <a class="code" href="group__DBusResources.html#ga48d9b53d1a395ab3c4f1846ca569ef3f" title="Decrements refcount of the counter and possibly finalizes the counter.">_dbus_counter_unref</a> (preallocated-&gt;<a class="code" href="structDBusPreallocatedSend.html#aae6c1bd98f78491482d5f59b6ef138d4" title="Preallocated link in the resource counter.">counter_link</a>-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a>);
<a name="l03200"></a>03200   <a class="code" href="group__DBusList.html#ga6e824f717125ce40c549d5402e32610f" title="Frees a linked list node allocated with _dbus_list_alloc_link.">_dbus_list_free_link</a> (preallocated-&gt;<a class="code" href="structDBusPreallocatedSend.html#aae6c1bd98f78491482d5f59b6ef138d4" title="Preallocated link in the resource counter.">counter_link</a>);
<a name="l03201"></a>03201   <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> (preallocated);
<a name="l03202"></a>03202 }
<a name="l03203"></a>03203 
<a name="l03216"></a>03216 <span class="keywordtype">void</span>
<a name="l03217"></a><a class="code" href="group__DBusConnection.html#ga2fea5f972d1bfe7bcde8c0ec65ca9e90">03217</a> <a class="code" href="group__DBusConnection.html#ga2fea5f972d1bfe7bcde8c0ec65ca9e90" title="Sends a message using preallocated resources.">dbus_connection_send_preallocated</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>       *connection,
<a name="l03218"></a>03218                                    <a class="code" href="structDBusPreallocatedSend.html" title="Internals of DBusPreallocatedSend.">DBusPreallocatedSend</a> *preallocated,
<a name="l03219"></a>03219                                    <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>          *message,
<a name="l03220"></a>03220                                    <a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a>        *client_serial)
<a name="l03221"></a>03221 {
<a name="l03222"></a>03222   _dbus_return_if_fail (connection != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l03223"></a>03223   _dbus_return_if_fail (preallocated != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l03224"></a>03224   _dbus_return_if_fail (message != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l03225"></a>03225   _dbus_return_if_fail (preallocated-&gt;<a class="code" href="structDBusPreallocatedSend.html#a465af3647772c89500df0b46f43d035b" title="Connection we&#39;d send the message to.">connection</a> == connection);
<a name="l03226"></a>03226   _dbus_return_if_fail (<a class="code" href="group__DBusMessage.html#ga41cace31999105137772b6257ea540f9" title="Gets the type of a message.">dbus_message_get_type</a> (message) != <a class="code" href="group__DBusProtocol.html#ga09416afd76b65139eddd31e1085d9ebf" title="Message type of a method call message, see dbus_message_get_type()">DBUS_MESSAGE_TYPE_METHOD_CALL</a> ||
<a name="l03227"></a>03227                         <a class="code" href="group__DBusMessage.html#gaf5c6b705c53db07a5ae2c6b76f230cf9" title="Gets the interface member being invoked (DBUS_MESSAGE_TYPE_METHOD_CALL) or emitted (DBUS_MESSAGE_TYPE...">dbus_message_get_member</a> (message) != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l03228"></a>03228   _dbus_return_if_fail (<a class="code" href="group__DBusMessage.html#ga41cace31999105137772b6257ea540f9" title="Gets the type of a message.">dbus_message_get_type</a> (message) != <a class="code" href="group__DBusProtocol.html#ga728d893ff0c00e126517ba39835220a5" title="Message type of a signal message, see dbus_message_get_type()">DBUS_MESSAGE_TYPE_SIGNAL</a> ||
<a name="l03229"></a>03229                         (<a class="code" href="group__DBusMessage.html#ga1ad192bd4538cae556121a71b4e09d42" title="Gets the interface this message is being sent to (for DBUS_MESSAGE_TYPE_METHOD_CALL) or being emitted...">dbus_message_get_interface</a> (message) != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a> &amp;&amp;
<a name="l03230"></a>03230                          <a class="code" href="group__DBusMessage.html#gaf5c6b705c53db07a5ae2c6b76f230cf9" title="Gets the interface member being invoked (DBUS_MESSAGE_TYPE_METHOD_CALL) or emitted (DBUS_MESSAGE_TYPE...">dbus_message_get_member</a> (message) != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>));
<a name="l03231"></a>03231 
<a name="l03232"></a>03232   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l03233"></a>03233 
<a name="l03234"></a>03234 <span class="preprocessor">#ifdef HAVE_UNIX_FD_PASSING</span>
<a name="l03235"></a>03235 <span class="preprocessor"></span>
<a name="l03236"></a>03236   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusTransport.html#gab98dc7cad59472a4513489628f1393f1" title="Returns TRUE if the transport supports sending unix fds.">_dbus_transport_can_pass_unix_fd</a>(connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>) &amp;&amp;
<a name="l03237"></a>03237       message-&gt;n_unix_fds &gt; 0)
<a name="l03238"></a>03238     {
<a name="l03239"></a>03239       <span class="comment">/* Refuse to send fds on a connection that cannot handle</span>
<a name="l03240"></a>03240 <span class="comment">         them. Unfortunately we cannot return a proper error here, so</span>
<a name="l03241"></a>03241 <span class="comment">         the best we can is just return. */</span>
<a name="l03242"></a>03242       <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l03243"></a>03243       <span class="keywordflow">return</span>;
<a name="l03244"></a>03244     }
<a name="l03245"></a>03245 
<a name="l03246"></a>03246 <span class="preprocessor">#endif</span>
<a name="l03247"></a>03247 <span class="preprocessor"></span>
<a name="l03248"></a>03248   _dbus_connection_send_preallocated_and_unlock (connection,
<a name="l03249"></a>03249                                                  preallocated,
<a name="l03250"></a>03250                                                  message, client_serial);
<a name="l03251"></a>03251 }
<a name="l03252"></a>03252 
<a name="l03253"></a>03253 <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="l03254"></a>03254 _dbus_connection_send_unlocked_no_update (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l03255"></a>03255                                           <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>    *message,
<a name="l03256"></a>03256                                           <a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a>  *client_serial)
<a name="l03257"></a>03257 {
<a name="l03258"></a>03258   <a class="code" href="structDBusPreallocatedSend.html" title="Internals of DBusPreallocatedSend.">DBusPreallocatedSend</a> *preallocated;
<a name="l03259"></a>03259 
<a name="l03260"></a>03260   _dbus_assert (connection != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l03261"></a>03261   _dbus_assert (message != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l03262"></a>03262   
<a name="l03263"></a>03263   preallocated = _dbus_connection_preallocate_send_unlocked (connection);
<a name="l03264"></a>03264   <span class="keywordflow">if</span> (preallocated == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l03265"></a>03265     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l03266"></a>03266 
<a name="l03267"></a>03267   _dbus_connection_send_preallocated_unlocked_no_update (connection,
<a name="l03268"></a>03268                                                          preallocated,
<a name="l03269"></a>03269                                                          message,
<a name="l03270"></a>03270                                                          client_serial);
<a name="l03271"></a>03271   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l03272"></a>03272 }
<a name="l03273"></a>03273 
<a name="l03301"></a>03301 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l03302"></a><a class="code" href="group__DBusConnection.html#gae1cb64f4cf550949b23fd3a756b2f7d0">03302</a> <a class="code" href="group__DBusConnection.html#gae1cb64f4cf550949b23fd3a756b2f7d0" title="Adds a message to the outgoing message queue.">dbus_connection_send</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l03303"></a>03303                       <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>    *message,
<a name="l03304"></a>03304                       <a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a>  *serial)
<a name="l03305"></a>03305 {
<a name="l03306"></a>03306   _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="l03307"></a>03307   _dbus_return_val_if_fail (message != <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="l03308"></a>03308 
<a name="l03309"></a>03309   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l03310"></a>03310 
<a name="l03311"></a>03311 <span class="preprocessor">#ifdef HAVE_UNIX_FD_PASSING</span>
<a name="l03312"></a>03312 <span class="preprocessor"></span>
<a name="l03313"></a>03313   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusTransport.html#gab98dc7cad59472a4513489628f1393f1" title="Returns TRUE if the transport supports sending unix fds.">_dbus_transport_can_pass_unix_fd</a>(connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>) &amp;&amp;
<a name="l03314"></a>03314       message-&gt;n_unix_fds &gt; 0)
<a name="l03315"></a>03315     {
<a name="l03316"></a>03316       <span class="comment">/* Refuse to send fds on a connection that cannot handle</span>
<a name="l03317"></a>03317 <span class="comment">         them. Unfortunately we cannot return a proper error here, so</span>
<a name="l03318"></a>03318 <span class="comment">         the best we can is just return. */</span>
<a name="l03319"></a>03319       <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l03320"></a>03320       <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l03321"></a>03321     }
<a name="l03322"></a>03322 
<a name="l03323"></a>03323 <span class="preprocessor">#endif</span>
<a name="l03324"></a>03324 <span class="preprocessor"></span>
<a name="l03325"></a>03325   <span class="keywordflow">return</span> <a class="code" href="group__DBusConnectionInternals.html#ga2974eb1c261305fafc635e14fc575d03" title="Like dbus_connection_send(), but assumes the connection is already locked on function entry...">_dbus_connection_send_and_unlock</a> (connection,
<a name="l03326"></a>03326                                            message,
<a name="l03327"></a>03327                                            serial);
<a name="l03328"></a>03328 }
<a name="l03329"></a>03329 
<a name="l03330"></a>03330 <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="l03331"></a>03331 reply_handler_timeout (<span class="keywordtype">void</span> *data)
<a name="l03332"></a>03332 {
<a name="l03333"></a>03333   <a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection;
<a name="l03334"></a>03334   <a class="code" href="group__DBusConnection.html#gabf250a32ff740b2a8c99136e0142d8d2" title="Indicates the status of incoming data on a DBusConnection.">DBusDispatchStatus</a> status;
<a name="l03335"></a>03335   <a class="code" href="structDBusPendingCall.html" title="Implementation details of DBusPendingCall - all fields are private.">DBusPendingCall</a> *pending = data;
<a name="l03336"></a>03336 
<a name="l03337"></a>03337   connection = <a class="code" href="group__DBusPendingCallInternals.html#ga68e5ff616e6a6563d83966c3d88b9b32" title="Gets the connection associated with this pending call.">_dbus_pending_call_get_connection_and_lock</a> (pending);
<a name="l03338"></a>03338   <a class="code" href="group__DBusConnectionInternals.html#ga7151f75b5d2308ec80cfe893aba72aa1" title="Increments the reference count of a DBusConnection.">_dbus_connection_ref_unlocked</a> (connection);
<a name="l03339"></a>03339 
<a name="l03340"></a>03340   <a class="code" href="group__DBusPendingCallInternals.html#ga1bc4de7652108d0629522a4e3adffcab" title="If the pending call hasn&#39;t been timed out, add its timeout error reply to the connection&#39;s incoming m...">_dbus_pending_call_queue_timeout_error_unlocked</a> (pending, 
<a name="l03341"></a>03341                                                    connection);
<a name="l03342"></a>03342   <a class="code" href="group__DBusConnectionInternals.html#gabaa6d26f6eca30782904af1ceb703bd1" title="Removes a timeout using the connection&#39;s DBusRemoveTimeoutFunction if available.">_dbus_connection_remove_timeout_unlocked</a> (connection,
<a name="l03343"></a>03343                                             <a class="code" href="group__DBusPendingCallInternals.html#gaa9acac047b61c9a0eaff1977151e9e08" title="Retrives the timeout.">_dbus_pending_call_get_timeout_unlocked</a> (pending));
<a name="l03344"></a>03344   <a class="code" href="group__DBusPendingCallInternals.html#gafea13f8b9977d341e41201c407adea2a" title="Sets wether the timeout has been added.">_dbus_pending_call_set_timeout_added_unlocked</a> (pending, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l03345"></a>03345 
<a name="l03346"></a>03346   _dbus_verbose (<span class="stringliteral">&quot;middle\n&quot;</span>);
<a name="l03347"></a>03347   status = _dbus_connection_get_dispatch_status_unlocked (connection);
<a name="l03348"></a>03348 
<a name="l03349"></a>03349   <span class="comment">/* Unlocks, and calls out to user code */</span>
<a name="l03350"></a>03350   _dbus_connection_update_dispatch_status_and_unlock (connection, status);
<a name="l03351"></a>03351   <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="l03352"></a>03352   
<a name="l03353"></a>03353   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l03354"></a>03354 }
<a name="l03355"></a>03355 
<a name="l03398"></a>03398 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l03399"></a><a class="code" href="group__DBusConnection.html#gaa215df7ab7ca6dce7be153c6b9cc80ba">03399</a> <a class="code" href="group__DBusConnection.html#gaa215df7ab7ca6dce7be153c6b9cc80ba" title="Queues a message to send, as with dbus_connection_send(), but also returns a DBusPendingCall used to ...">dbus_connection_send_with_reply</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>     *connection,
<a name="l03400"></a>03400                                  <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>        *message,
<a name="l03401"></a>03401                                  <a class="code" href="structDBusPendingCall.html" title="Implementation details of DBusPendingCall - all fields are private.">DBusPendingCall</a>   **pending_return,
<a name="l03402"></a>03402                                  <span class="keywordtype">int</span>                 timeout_milliseconds)
<a name="l03403"></a>03403 {
<a name="l03404"></a>03404   <a class="code" href="structDBusPendingCall.html" title="Implementation details of DBusPendingCall - all fields are private.">DBusPendingCall</a> *pending;
<a name="l03405"></a>03405   <a class="code" href="group__DBusTypes.html#gab18afa60e9b17b6e322735bda3d863d8" title="A 32-bit signed integer on all platforms.">dbus_int32_t</a> serial = -1;
<a name="l03406"></a>03406   <a class="code" href="group__DBusConnection.html#gabf250a32ff740b2a8c99136e0142d8d2" title="Indicates the status of incoming data on a DBusConnection.">DBusDispatchStatus</a> status;
<a name="l03407"></a>03407 
<a name="l03408"></a>03408   _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="l03409"></a>03409   _dbus_return_val_if_fail (message != <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="l03410"></a>03410   _dbus_return_val_if_fail (timeout_milliseconds &gt;= 0 || timeout_milliseconds == -1, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l03411"></a>03411 
<a name="l03412"></a>03412   <span class="keywordflow">if</span> (pending_return)
<a name="l03413"></a>03413     *pending_return = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l03414"></a>03414 
<a name="l03415"></a>03415   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l03416"></a>03416 
<a name="l03417"></a>03417 <span class="preprocessor">#ifdef HAVE_UNIX_FD_PASSING</span>
<a name="l03418"></a>03418 <span class="preprocessor"></span>
<a name="l03419"></a>03419   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusTransport.html#gab98dc7cad59472a4513489628f1393f1" title="Returns TRUE if the transport supports sending unix fds.">_dbus_transport_can_pass_unix_fd</a>(connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>) &amp;&amp;
<a name="l03420"></a>03420       message-&gt;n_unix_fds &gt; 0)
<a name="l03421"></a>03421     {
<a name="l03422"></a>03422       <span class="comment">/* Refuse to send fds on a connection that cannot handle</span>
<a name="l03423"></a>03423 <span class="comment">         them. Unfortunately we cannot return a proper error here, so</span>
<a name="l03424"></a>03424 <span class="comment">         the best we can do is return TRUE but leave *pending_return</span>
<a name="l03425"></a>03425 <span class="comment">         as NULL. */</span>
<a name="l03426"></a>03426       <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l03427"></a>03427       <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l03428"></a>03428     }
<a name="l03429"></a>03429 
<a name="l03430"></a>03430 <span class="preprocessor">#endif</span>
<a name="l03431"></a>03431 <span class="preprocessor"></span>
<a name="l03432"></a>03432    <span class="keywordflow">if</span> (!_dbus_connection_get_is_connected_unlocked (connection))
<a name="l03433"></a>03433     {
<a name="l03434"></a>03434       <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l03435"></a>03435 
<a name="l03436"></a>03436       <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l03437"></a>03437     }
<a name="l03438"></a>03438 
<a name="l03439"></a>03439   pending = <a class="code" href="group__DBusPendingCallInternals.html#ga3f2300d7a768783bc2fae0991bcc55df" title="Creates a new pending reply object.">_dbus_pending_call_new_unlocked</a> (connection,
<a name="l03440"></a>03440                                              timeout_milliseconds,
<a name="l03441"></a>03441                                              reply_handler_timeout);
<a name="l03442"></a>03442 
<a name="l03443"></a>03443   <span class="keywordflow">if</span> (pending == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l03444"></a>03444     {
<a name="l03445"></a>03445       <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l03446"></a>03446       <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l03447"></a>03447     }
<a name="l03448"></a>03448 
<a name="l03449"></a>03449   <span class="comment">/* Assign a serial to the message */</span>
<a name="l03450"></a>03450   serial = <a class="code" href="group__DBusMessage.html#ga390710c25564c80025a006c376da2030" title="Returns the serial of a message or 0 if none has been specified.">dbus_message_get_serial</a> (message);
<a name="l03451"></a>03451   <span class="keywordflow">if</span> (serial == 0)
<a name="l03452"></a>03452     {
<a name="l03453"></a>03453       serial = _dbus_connection_get_next_client_serial (connection);
<a name="l03454"></a>03454       <a class="code" href="group__DBusMessageInternals.html#ga3dd30a62c63eb9972cc0c564f2a89c3b" title="Sets the serial number of a message.">dbus_message_set_serial</a> (message, serial);
<a name="l03455"></a>03455     }
<a name="l03456"></a>03456 
<a name="l03457"></a>03457   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusPendingCallInternals.html#ga9901fc4c5fd2db9bf1ce2dcc9abf55fc" title="Sets the reply message associated with the pending call to a timeout error.">_dbus_pending_call_set_timeout_error_unlocked</a> (pending, message, serial))
<a name="l03458"></a>03458     <span class="keywordflow">goto</span> error;
<a name="l03459"></a>03459     
<a name="l03460"></a>03460   <span class="comment">/* Insert the serial in the pending replies hash;</span>
<a name="l03461"></a>03461 <span class="comment">   * hash takes a refcount on DBusPendingCall.</span>
<a name="l03462"></a>03462 <span class="comment">   * Also, add the timeout.</span>
<a name="l03463"></a>03463 <span class="comment">   */</span>
<a name="l03464"></a>03464   <span class="keywordflow">if</span> (!_dbus_connection_attach_pending_call_unlocked (connection,
<a name="l03465"></a>03465                                                       pending))
<a name="l03466"></a>03466     <span class="keywordflow">goto</span> error;
<a name="l03467"></a>03467  
<a name="l03468"></a>03468   <span class="keywordflow">if</span> (!_dbus_connection_send_unlocked_no_update (connection, message, <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>))
<a name="l03469"></a>03469     {
<a name="l03470"></a>03470       _dbus_connection_detach_pending_call_and_unlock (connection,
<a name="l03471"></a>03471                                                        pending);
<a name="l03472"></a>03472       <span class="keywordflow">goto</span> error_unlocked;
<a name="l03473"></a>03473     }
<a name="l03474"></a>03474 
<a name="l03475"></a>03475   <span class="keywordflow">if</span> (pending_return)
<a name="l03476"></a>03476     *pending_return = pending; <span class="comment">/* hand off refcount */</span>
<a name="l03477"></a>03477   <span class="keywordflow">else</span>
<a name="l03478"></a>03478     {
<a name="l03479"></a>03479       _dbus_connection_detach_pending_call_unlocked (connection, pending);
<a name="l03480"></a>03480       <span class="comment">/* we still have a ref to the pending call in this case, we unref</span>
<a name="l03481"></a>03481 <span class="comment">       * after unlocking, below</span>
<a name="l03482"></a>03482 <span class="comment">       */</span>
<a name="l03483"></a>03483     }
<a name="l03484"></a>03484 
<a name="l03485"></a>03485   status = _dbus_connection_get_dispatch_status_unlocked (connection);
<a name="l03486"></a>03486 
<a name="l03487"></a>03487   <span class="comment">/* this calls out to user code */</span>
<a name="l03488"></a>03488   _dbus_connection_update_dispatch_status_and_unlock (connection, status);
<a name="l03489"></a>03489 
<a name="l03490"></a>03490   <span class="keywordflow">if</span> (pending_return == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l03491"></a>03491     <a class="code" href="group__DBusPendingCall.html#gadaba15a74ba4925cdef52d4791cd3147" title="Decrements the reference count on a pending call, freeing it if the count reaches 0...">dbus_pending_call_unref</a> (pending);
<a name="l03492"></a>03492   
<a name="l03493"></a>03493   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l03494"></a>03494 
<a name="l03495"></a>03495  error:
<a name="l03496"></a>03496   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l03497"></a>03497  error_unlocked:
<a name="l03498"></a>03498   <a class="code" href="group__DBusPendingCall.html#gadaba15a74ba4925cdef52d4791cd3147" title="Decrements the reference count on a pending call, freeing it if the count reaches 0...">dbus_pending_call_unref</a> (pending);
<a name="l03499"></a>03499   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l03500"></a>03500 }
<a name="l03501"></a>03501 
<a name="l03534"></a>03534 <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>*
<a name="l03535"></a><a class="code" href="group__DBusConnection.html#ga8d6431f17a9e53c9446d87c2ba8409f0">03535</a> <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> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>     *connection,
<a name="l03536"></a>03536                                            <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>        *message,
<a name="l03537"></a>03537                                            <span class="keywordtype">int</span>                 timeout_milliseconds,
<a name="l03538"></a>03538                                            <a class="code" href="structDBusError.html" title="Object representing an exception.">DBusError</a>          *error)
<a name="l03539"></a>03539 {
<a name="l03540"></a>03540   <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *reply;
<a name="l03541"></a>03541   <a class="code" href="structDBusPendingCall.html" title="Implementation details of DBusPendingCall - all fields are private.">DBusPendingCall</a> *pending;
<a name="l03542"></a>03542 
<a name="l03543"></a>03543   _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="l03544"></a>03544   _dbus_return_val_if_fail (message != <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="l03545"></a>03545   _dbus_return_val_if_fail (timeout_milliseconds &gt;= 0 || timeout_milliseconds == -1, <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l03546"></a>03546   _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="l03547"></a>03547 
<a name="l03548"></a>03548 <span class="preprocessor">#ifdef HAVE_UNIX_FD_PASSING</span>
<a name="l03549"></a>03549 <span class="preprocessor"></span>
<a name="l03550"></a>03550   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l03551"></a>03551   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusTransport.html#gab98dc7cad59472a4513489628f1393f1" title="Returns TRUE if the transport supports sending unix fds.">_dbus_transport_can_pass_unix_fd</a>(connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>) &amp;&amp;
<a name="l03552"></a>03552       message-&gt;n_unix_fds &gt; 0)
<a name="l03553"></a>03553     {
<a name="l03554"></a>03554       <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l03555"></a>03555       <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>, <span class="stringliteral">&quot;Cannot send file descriptors on this connection.&quot;</span>);
<a name="l03556"></a>03556       <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="l03557"></a>03557     }
<a name="l03558"></a>03558   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l03559"></a>03559 
<a name="l03560"></a>03560 <span class="preprocessor">#endif</span>
<a name="l03561"></a>03561 <span class="preprocessor"></span>
<a name="l03562"></a>03562   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusConnection.html#gaa215df7ab7ca6dce7be153c6b9cc80ba" title="Queues a message to send, as with dbus_connection_send(), but also returns a DBusPendingCall used to ...">dbus_connection_send_with_reply</a> (connection, message,
<a name="l03563"></a>03563                                         &amp;pending, timeout_milliseconds))
<a name="l03564"></a>03564     {
<a name="l03565"></a>03565       _DBUS_SET_OOM (error);
<a name="l03566"></a>03566       <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="l03567"></a>03567     }
<a name="l03568"></a>03568 
<a name="l03569"></a>03569   <span class="keywordflow">if</span> (pending == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l03570"></a>03570     {
<a name="l03571"></a>03571       <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#gaef6443e0bd8cdcc1606d985a775d07a7" title="The connection is disconnected and you&#39;re trying to use it.">DBUS_ERROR_DISCONNECTED</a>, <span class="stringliteral">&quot;Connection is closed&quot;</span>);
<a name="l03572"></a>03572       <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="l03573"></a>03573     }
<a name="l03574"></a>03574   
<a name="l03575"></a>03575   <a class="code" href="group__DBusPendingCall.html#ga67b99f749a7f477c7b5d70f2acee5452" title="Block until the pending call is completed.">dbus_pending_call_block</a> (pending);
<a name="l03576"></a>03576 
<a name="l03577"></a>03577   reply = <a class="code" href="group__DBusPendingCall.html#ga5a738928c2369fef093ce00658903d06" title="Gets the reply, or returns NULL if none has been received yet.">dbus_pending_call_steal_reply</a> (pending);
<a name="l03578"></a>03578   <a class="code" href="group__DBusPendingCall.html#gadaba15a74ba4925cdef52d4791cd3147" title="Decrements the reference count on a pending call, freeing it if the count reaches 0...">dbus_pending_call_unref</a> (pending);
<a name="l03579"></a>03579 
<a name="l03580"></a>03580   <span class="comment">/* call_complete_and_unlock() called from pending_call_block() should</span>
<a name="l03581"></a>03581 <span class="comment">   * always fill this in.</span>
<a name="l03582"></a>03582 <span class="comment">   */</span>
<a name="l03583"></a>03583   _dbus_assert (reply != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l03584"></a>03584   
<a name="l03585"></a>03585    <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="l03586"></a>03586     {
<a name="l03587"></a>03587       <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="l03588"></a>03588       <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="l03589"></a>03589     }
<a name="l03590"></a>03590   <span class="keywordflow">else</span>
<a name="l03591"></a>03591     <span class="keywordflow">return</span> reply;
<a name="l03592"></a>03592 }
<a name="l03593"></a>03593 
<a name="l03602"></a>03602 <span class="keyword">static</span> <a class="code" href="group__DBusConnection.html#gabf250a32ff740b2a8c99136e0142d8d2" title="Indicates the status of incoming data on a DBusConnection.">DBusDispatchStatus</a>
<a name="l03603"></a>03603 _dbus_connection_flush_unlocked (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l03604"></a>03604 {
<a name="l03605"></a>03605   <span class="comment">/* We have to specify DBUS_ITERATION_DO_READING here because</span>
<a name="l03606"></a>03606 <span class="comment">   * otherwise we could have two apps deadlock if they are both doing</span>
<a name="l03607"></a>03607 <span class="comment">   * a flush(), and the kernel buffers fill up. This could change the</span>
<a name="l03608"></a>03608 <span class="comment">   * dispatch status.</span>
<a name="l03609"></a>03609 <span class="comment">   */</span>
<a name="l03610"></a>03610   <a class="code" href="group__DBusConnection.html#gabf250a32ff740b2a8c99136e0142d8d2" title="Indicates the status of incoming data on a DBusConnection.">DBusDispatchStatus</a> status;
<a name="l03611"></a>03611 
<a name="l03612"></a>03612   HAVE_LOCK_CHECK (connection);
<a name="l03613"></a>03613   
<a name="l03614"></a>03614   <span class="keywordflow">while</span> (connection-&gt;<a class="code" href="structDBusConnection.html#a07025e177949c5e65d5f983ac5f5e878" title="Length of outgoing queue.">n_outgoing</a> &gt; 0 &amp;&amp;
<a name="l03615"></a>03615          _dbus_connection_get_is_connected_unlocked (connection))
<a name="l03616"></a>03616     {
<a name="l03617"></a>03617       _dbus_verbose (<span class="stringliteral">&quot;doing iteration in\n&quot;</span>);
<a name="l03618"></a>03618       HAVE_LOCK_CHECK (connection);
<a name="l03619"></a>03619       <a class="code" href="group__DBusConnectionInternals.html#ga283f0254537c4bf4453dbed6fad2e21e" title="Queues incoming messages and sends outgoing messages for this connection, optionally blocking in the ...">_dbus_connection_do_iteration_unlocked</a> (connection,
<a name="l03620"></a>03620                                               <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>,
<a name="l03621"></a>03621                                               DBUS_ITERATION_DO_READING |
<a name="l03622"></a>03622                                               DBUS_ITERATION_DO_WRITING |
<a name="l03623"></a>03623                                               DBUS_ITERATION_BLOCK,
<a name="l03624"></a>03624                                               -1);
<a name="l03625"></a>03625     }
<a name="l03626"></a>03626 
<a name="l03627"></a>03627   HAVE_LOCK_CHECK (connection);
<a name="l03628"></a>03628   _dbus_verbose (<span class="stringliteral">&quot;middle\n&quot;</span>);
<a name="l03629"></a>03629   status = _dbus_connection_get_dispatch_status_unlocked (connection);
<a name="l03630"></a>03630 
<a name="l03631"></a>03631   HAVE_LOCK_CHECK (connection);
<a name="l03632"></a>03632   <span class="keywordflow">return</span> status;
<a name="l03633"></a>03633 }
<a name="l03634"></a>03634 
<a name="l03640"></a>03640 <span class="keywordtype">void</span>
<a name="l03641"></a><a class="code" href="group__DBusConnection.html#ga10e68d9d2f41d655a4151ddeb807ff54">03641</a> <a class="code" href="group__DBusConnection.html#ga10e68d9d2f41d655a4151ddeb807ff54" title="Blocks until the outgoing message queue is empty.">dbus_connection_flush</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l03642"></a>03642 {
<a name="l03643"></a>03643   <span class="comment">/* We have to specify DBUS_ITERATION_DO_READING here because</span>
<a name="l03644"></a>03644 <span class="comment">   * otherwise we could have two apps deadlock if they are both doing</span>
<a name="l03645"></a>03645 <span class="comment">   * a flush(), and the kernel buffers fill up. This could change the</span>
<a name="l03646"></a>03646 <span class="comment">   * dispatch status.</span>
<a name="l03647"></a>03647 <span class="comment">   */</span>
<a name="l03648"></a>03648   <a class="code" href="group__DBusConnection.html#gabf250a32ff740b2a8c99136e0142d8d2" title="Indicates the status of incoming data on a DBusConnection.">DBusDispatchStatus</a> status;
<a name="l03649"></a>03649 
<a name="l03650"></a>03650   _dbus_return_if_fail (connection != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l03651"></a>03651   
<a name="l03652"></a>03652   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l03653"></a>03653 
<a name="l03654"></a>03654   status = _dbus_connection_flush_unlocked (connection);
<a name="l03655"></a>03655   
<a name="l03656"></a>03656   HAVE_LOCK_CHECK (connection);
<a name="l03657"></a>03657   <span class="comment">/* Unlocks and calls out to user code */</span>
<a name="l03658"></a>03658   _dbus_connection_update_dispatch_status_and_unlock (connection, status);
<a name="l03659"></a>03659 
<a name="l03660"></a>03660   _dbus_verbose (<span class="stringliteral">&quot;end\n&quot;</span>);
<a name="l03661"></a>03661 }
<a name="l03662"></a>03662 
<a name="l03673"></a>03673 <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="l03674"></a>03674 _dbus_connection_read_write_dispatch (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l03675"></a>03675                                      <span class="keywordtype">int</span>             timeout_milliseconds, 
<a name="l03676"></a>03676                                      <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>     dispatch)
<a name="l03677"></a>03677 {
<a name="l03678"></a>03678   <a class="code" href="group__DBusConnection.html#gabf250a32ff740b2a8c99136e0142d8d2" title="Indicates the status of incoming data on a DBusConnection.">DBusDispatchStatus</a> dstatus;
<a name="l03679"></a>03679   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> progress_possible;
<a name="l03680"></a>03680 
<a name="l03681"></a>03681   <span class="comment">/* Need to grab a ref here in case we&#39;re a private connection and</span>
<a name="l03682"></a>03682 <span class="comment">   * the user drops the last ref in a handler we call; see bug </span>
<a name="l03683"></a>03683 <span class="comment">   * https://bugs.freedesktop.org/show_bug.cgi?id=15635</span>
<a name="l03684"></a>03684 <span class="comment">   */</span>
<a name="l03685"></a>03685   <a class="code" href="group__DBusConnection.html#gae34751e15f114217e5ad10c663e2ef2e" title="Increments the reference count of a DBusConnection.">dbus_connection_ref</a> (connection);
<a name="l03686"></a>03686   dstatus = <a class="code" href="group__DBusConnection.html#ga893d18d8b36ffb371f16d13645071289" title="Gets the current state of the incoming message queue.">dbus_connection_get_dispatch_status</a> (connection);
<a name="l03687"></a>03687 
<a name="l03688"></a>03688   <span class="keywordflow">if</span> (dispatch &amp;&amp; dstatus == <a class="code" href="group__DBusConnection.html#ggabf250a32ff740b2a8c99136e0142d8d2adf8e8a594ab338cb9cf7855b19e37e93" title="There is more data to potentially convert to messages.">DBUS_DISPATCH_DATA_REMAINS</a>)
<a name="l03689"></a>03689     {
<a name="l03690"></a>03690       _dbus_verbose (<span class="stringliteral">&quot;doing dispatch\n&quot;</span>);
<a name="l03691"></a>03691       <a class="code" href="group__DBusConnection.html#ga66ba7df50d75f4bda6b6e942430b81c7" title="Processes any incoming data.">dbus_connection_dispatch</a> (connection);
<a name="l03692"></a>03692       <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l03693"></a>03693     }
<a name="l03694"></a>03694   <span class="keywordflow">else</span> <span class="keywordflow">if</span> (dstatus == <a class="code" href="group__DBusConnection.html#ggabf250a32ff740b2a8c99136e0142d8d2a5af20a035f29cfa67fb8d69fb693b685" title="More memory is needed to continue.">DBUS_DISPATCH_NEED_MEMORY</a>)
<a name="l03695"></a>03695     {
<a name="l03696"></a>03696       _dbus_verbose (<span class="stringliteral">&quot;pausing for memory\n&quot;</span>);
<a name="l03697"></a>03697       _dbus_memory_pause_based_on_timeout (timeout_milliseconds);
<a name="l03698"></a>03698       <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l03699"></a>03699     }
<a name="l03700"></a>03700   <span class="keywordflow">else</span>
<a name="l03701"></a>03701     {
<a name="l03702"></a>03702       <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l03703"></a>03703       <span class="keywordflow">if</span> (_dbus_connection_get_is_connected_unlocked (connection))
<a name="l03704"></a>03704         {
<a name="l03705"></a>03705           _dbus_verbose (<span class="stringliteral">&quot;doing iteration\n&quot;</span>);
<a name="l03706"></a>03706           <a class="code" href="group__DBusConnectionInternals.html#ga283f0254537c4bf4453dbed6fad2e21e" title="Queues incoming messages and sends outgoing messages for this connection, optionally blocking in the ...">_dbus_connection_do_iteration_unlocked</a> (connection,
<a name="l03707"></a>03707                                                   <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>,
<a name="l03708"></a>03708                                                   DBUS_ITERATION_DO_READING |
<a name="l03709"></a>03709                                                   DBUS_ITERATION_DO_WRITING |
<a name="l03710"></a>03710                                                   DBUS_ITERATION_BLOCK,
<a name="l03711"></a>03711                                                   timeout_milliseconds);
<a name="l03712"></a>03712         }
<a name="l03713"></a>03713     }
<a name="l03714"></a>03714   
<a name="l03715"></a>03715   HAVE_LOCK_CHECK (connection);
<a name="l03716"></a>03716   <span class="comment">/* If we can dispatch, we can make progress until the Disconnected message</span>
<a name="l03717"></a>03717 <span class="comment">   * has been processed; if we can only read/write, we can make progress</span>
<a name="l03718"></a>03718 <span class="comment">   * as long as the transport is open.</span>
<a name="l03719"></a>03719 <span class="comment">   */</span>
<a name="l03720"></a>03720   <span class="keywordflow">if</span> (dispatch)
<a name="l03721"></a>03721     progress_possible = connection-&gt;<a class="code" href="structDBusConnection.html#a9bda45f2d5c9af5c187fc31d7c98b424" title="Length of incoming queue.">n_incoming</a> != 0 ||
<a name="l03722"></a>03722       connection-&gt;<a class="code" href="structDBusConnection.html#aa70afc41f6184604c027e7f71a314d7f" title="Preallocated list node for queueing the disconnection message.">disconnect_message_link</a> != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l03723"></a>03723   <span class="keywordflow">else</span>
<a name="l03724"></a>03724     progress_possible = _dbus_connection_get_is_connected_unlocked (connection);
<a name="l03725"></a>03725 
<a name="l03726"></a>03726   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l03727"></a>03727 
<a name="l03728"></a>03728   <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="l03729"></a>03729 
<a name="l03730"></a>03730   <span class="keywordflow">return</span> progress_possible; <span class="comment">/* TRUE if we can make more progress */</span>
<a name="l03731"></a>03731 }
<a name="l03732"></a>03732 
<a name="l03733"></a>03733 
<a name="l03768"></a>03768 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l03769"></a><a class="code" href="group__DBusConnection.html#ga580d8766c23fe5f49418bc7d87b67dc6">03769</a> <a class="code" href="group__DBusConnection.html#ga580d8766c23fe5f49418bc7d87b67dc6" title="This function is intended for use with applications that don&#39;t want to write a main loop and deal wit...">dbus_connection_read_write_dispatch</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l03770"></a>03770                                      <span class="keywordtype">int</span>             timeout_milliseconds)
<a name="l03771"></a>03771 {
<a name="l03772"></a>03772   _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="l03773"></a>03773   _dbus_return_val_if_fail (timeout_milliseconds &gt;= 0 || timeout_milliseconds == -1, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l03774"></a>03774    <span class="keywordflow">return</span> _dbus_connection_read_write_dispatch(connection, timeout_milliseconds, <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>);
<a name="l03775"></a>03775 }
<a name="l03776"></a>03776 
<a name="l03800"></a>03800 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> 
<a name="l03801"></a><a class="code" href="group__DBusConnection.html#ga371163b4955a6e0bf0f1f70f38390c14">03801</a> <a class="code" href="group__DBusConnection.html#ga371163b4955a6e0bf0f1f70f38390c14" title="This function is intended for use with applications that don&#39;t want to write a main loop and deal wit...">dbus_connection_read_write</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection, 
<a name="l03802"></a>03802                             <span class="keywordtype">int</span>             timeout_milliseconds) 
<a name="l03803"></a>03803 { 
<a name="l03804"></a>03804   _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="l03805"></a>03805   _dbus_return_val_if_fail (timeout_milliseconds &gt;= 0 || timeout_milliseconds == -1, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l03806"></a>03806    <span class="keywordflow">return</span> _dbus_connection_read_write_dispatch(connection, timeout_milliseconds, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l03807"></a>03807 }
<a name="l03808"></a>03808 
<a name="l03809"></a>03809 <span class="comment">/* We need to call this anytime we pop the head of the queue, and then</span>
<a name="l03810"></a>03810 <span class="comment"> * update_dispatch_status_and_unlock needs to be called afterward</span>
<a name="l03811"></a>03811 <span class="comment"> * which will &quot;process&quot; the disconnected message and set</span>
<a name="l03812"></a>03812 <span class="comment"> * disconnected_message_processed.</span>
<a name="l03813"></a>03813 <span class="comment"> */</span>
<a name="l03814"></a>03814 <span class="keyword">static</span> <span class="keywordtype">void</span>
<a name="l03815"></a>03815 check_disconnected_message_arrived_unlocked (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l03816"></a>03816                                              <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>    *head_of_queue)
<a name="l03817"></a>03817 {
<a name="l03818"></a>03818   HAVE_LOCK_CHECK (connection);
<a name="l03819"></a>03819 
<a name="l03820"></a>03820   <span class="comment">/* checking that the link is NULL is an optimization to avoid the is_signal call */</span>
<a name="l03821"></a>03821   <span class="keywordflow">if</span> (connection-&gt;<a class="code" href="structDBusConnection.html#aa70afc41f6184604c027e7f71a314d7f" title="Preallocated list node for queueing the disconnection message.">disconnect_message_link</a> == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a> &amp;&amp;
<a name="l03822"></a>03822       <a class="code" href="group__DBusMessage.html#gaed0e32329f142cc246662227c81d5d1f" title="Checks whether the message is a signal with the given interface and member fields.">dbus_message_is_signal</a> (head_of_queue,
<a name="l03823"></a>03823                               <a class="code" href="group__DBusShared.html#ga9ef6478aae637449ec0c5de1679f75ce" title="This is a special interface whose methods can only be invoked by the local implementation (messages f...">DBUS_INTERFACE_LOCAL</a>,
<a name="l03824"></a>03824                               <span class="stringliteral">&quot;Disconnected&quot;</span>))
<a name="l03825"></a>03825     {
<a name="l03826"></a>03826       connection-&gt;<a class="code" href="structDBusConnection.html#a48d141d4311211e921571043bdbaeefb" title="We popped or are dispatching the disconnected message.">disconnected_message_arrived</a> = <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l03827"></a>03827     }
<a name="l03828"></a>03828 }
<a name="l03829"></a>03829 
<a name="l03849"></a>03849 <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>*
<a name="l03850"></a><a class="code" href="group__DBusConnection.html#ga9d07083c520e291591a68adb78f64094">03850</a> <a class="code" href="group__DBusConnection.html#ga9d07083c520e291591a68adb78f64094" title="Returns the first-received message from the incoming message queue, leaving it in the queue...">dbus_connection_borrow_message</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l03851"></a>03851 {
<a name="l03852"></a>03852   <a class="code" href="group__DBusConnection.html#gabf250a32ff740b2a8c99136e0142d8d2" title="Indicates the status of incoming data on a DBusConnection.">DBusDispatchStatus</a> status;
<a name="l03853"></a>03853   <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message;
<a name="l03854"></a>03854 
<a name="l03855"></a>03855   _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="l03856"></a>03856 
<a name="l03857"></a>03857   _dbus_verbose (<span class="stringliteral">&quot;start\n&quot;</span>);
<a name="l03858"></a>03858   
<a name="l03859"></a>03859   <span class="comment">/* this is called for the side effect that it queues</span>
<a name="l03860"></a>03860 <span class="comment">   * up any messages from the transport</span>
<a name="l03861"></a>03861 <span class="comment">   */</span>
<a name="l03862"></a>03862   status = <a class="code" href="group__DBusConnection.html#ga893d18d8b36ffb371f16d13645071289" title="Gets the current state of the incoming message queue.">dbus_connection_get_dispatch_status</a> (connection);
<a name="l03863"></a>03863   <span class="keywordflow">if</span> (status != <a class="code" href="group__DBusConnection.html#ggabf250a32ff740b2a8c99136e0142d8d2adf8e8a594ab338cb9cf7855b19e37e93" title="There is more data to potentially convert to messages.">DBUS_DISPATCH_DATA_REMAINS</a>)
<a name="l03864"></a>03864     <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="l03865"></a>03865   
<a name="l03866"></a>03866   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l03867"></a>03867 
<a name="l03868"></a>03868   _dbus_connection_acquire_dispatch (connection);
<a name="l03869"></a>03869 
<a name="l03870"></a>03870   <span class="comment">/* While a message is outstanding, the dispatch lock is held */</span>
<a name="l03871"></a>03871   _dbus_assert (connection-&gt;<a class="code" href="structDBusConnection.html#aef492b411cd2ebd214f8e4dd15e154af" title="Filled in if the first incoming message has been borrowed; dispatch_acquired will be set by the borro...">message_borrowed</a> == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l03872"></a>03872 
<a name="l03873"></a>03873   connection-&gt;<a class="code" href="structDBusConnection.html#aef492b411cd2ebd214f8e4dd15e154af" title="Filled in if the first incoming message has been borrowed; dispatch_acquired will be set by the borro...">message_borrowed</a> = <a class="code" href="group__DBusList.html#ga254e18f698f5fc518bde031e723e67c6" title="Gets the first data in the list.">_dbus_list_get_first</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#aacb3a29956aa7712db37916194fde869" title="Queue of messages we have received, end of the list received most recently.">incoming_messages</a>);
<a name="l03874"></a>03874   
<a name="l03875"></a>03875   message = connection-&gt;<a class="code" href="structDBusConnection.html#aef492b411cd2ebd214f8e4dd15e154af" title="Filled in if the first incoming message has been borrowed; dispatch_acquired will be set by the borro...">message_borrowed</a>;
<a name="l03876"></a>03876 
<a name="l03877"></a>03877   check_disconnected_message_arrived_unlocked (connection, message);
<a name="l03878"></a>03878   
<a name="l03879"></a>03879   <span class="comment">/* Note that we KEEP the dispatch lock until the message is returned */</span>
<a name="l03880"></a>03880   <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="l03881"></a>03881     _dbus_connection_release_dispatch (connection);
<a name="l03882"></a>03882 
<a name="l03883"></a>03883   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l03884"></a>03884 
<a name="l03885"></a>03885   _dbus_message_trace_ref (message, -1, -1, <span class="stringliteral">&quot;dbus_connection_borrow_message&quot;</span>);
<a name="l03886"></a>03886 
<a name="l03887"></a>03887   <span class="comment">/* We don&#39;t update dispatch status until it&#39;s returned or stolen */</span>
<a name="l03888"></a>03888   
<a name="l03889"></a>03889   <span class="keywordflow">return</span> message;
<a name="l03890"></a>03890 }
<a name="l03891"></a>03891 
<a name="l03900"></a>03900 <span class="keywordtype">void</span>
<a name="l03901"></a><a class="code" href="group__DBusConnection.html#ga0586da03a01c9c6f332fbea900ef55e3">03901</a> <a class="code" href="group__DBusConnection.html#ga0586da03a01c9c6f332fbea900ef55e3" title="Used to return a message after peeking at it using dbus_connection_borrow_message().">dbus_connection_return_message</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l03902"></a>03902                                 <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>    *message)
<a name="l03903"></a>03903 {
<a name="l03904"></a>03904   <a class="code" href="group__DBusConnection.html#gabf250a32ff740b2a8c99136e0142d8d2" title="Indicates the status of incoming data on a DBusConnection.">DBusDispatchStatus</a> status;
<a name="l03905"></a>03905   
<a name="l03906"></a>03906   _dbus_return_if_fail (connection != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l03907"></a>03907   _dbus_return_if_fail (message != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l03908"></a>03908   _dbus_return_if_fail (message == connection-&gt;<a class="code" href="structDBusConnection.html#aef492b411cd2ebd214f8e4dd15e154af" title="Filled in if the first incoming message has been borrowed; dispatch_acquired will be set by the borro...">message_borrowed</a>);
<a name="l03909"></a>03909   _dbus_return_if_fail (connection-&gt;<a class="code" href="structDBusConnection.html#a11803a01d74d956ef37e6aa092f0cf17" title="Someone has dispatch path (can drain incoming queue)">dispatch_acquired</a>);
<a name="l03910"></a>03910   
<a name="l03911"></a>03911   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l03912"></a>03912   
<a name="l03913"></a>03913   _dbus_assert (message == connection-&gt;<a class="code" href="structDBusConnection.html#aef492b411cd2ebd214f8e4dd15e154af" title="Filled in if the first incoming message has been borrowed; dispatch_acquired will be set by the borro...">message_borrowed</a>);
<a name="l03914"></a>03914   
<a name="l03915"></a>03915   connection-&gt;<a class="code" href="structDBusConnection.html#aef492b411cd2ebd214f8e4dd15e154af" title="Filled in if the first incoming message has been borrowed; dispatch_acquired will be set by the borro...">message_borrowed</a> = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l03916"></a>03916 
<a name="l03917"></a>03917   _dbus_connection_release_dispatch (connection); 
<a name="l03918"></a>03918 
<a name="l03919"></a>03919   status = _dbus_connection_get_dispatch_status_unlocked (connection);
<a name="l03920"></a>03920   _dbus_connection_update_dispatch_status_and_unlock (connection, status);
<a name="l03921"></a>03921 
<a name="l03922"></a>03922   _dbus_message_trace_ref (message, -1, -1, <span class="stringliteral">&quot;dbus_connection_return_message&quot;</span>);
<a name="l03923"></a>03923 }
<a name="l03924"></a>03924 
<a name="l03934"></a>03934 <span class="keywordtype">void</span>
<a name="l03935"></a><a class="code" href="group__DBusConnection.html#ga7125d747575b2f596aceaf7be53eae68">03935</a> <a class="code" href="group__DBusConnection.html#ga7125d747575b2f596aceaf7be53eae68" title="Used to keep a message after peeking at it using dbus_connection_borrow_message().">dbus_connection_steal_borrowed_message</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l03936"></a>03936                                         <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>    *message)
<a name="l03937"></a>03937 {
<a name="l03938"></a>03938   <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *pop_message;
<a name="l03939"></a>03939   <a class="code" href="group__DBusConnection.html#gabf250a32ff740b2a8c99136e0142d8d2" title="Indicates the status of incoming data on a DBusConnection.">DBusDispatchStatus</a> status;
<a name="l03940"></a>03940 
<a name="l03941"></a>03941   _dbus_return_if_fail (connection != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l03942"></a>03942   _dbus_return_if_fail (message != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l03943"></a>03943   _dbus_return_if_fail (message == connection-&gt;<a class="code" href="structDBusConnection.html#aef492b411cd2ebd214f8e4dd15e154af" title="Filled in if the first incoming message has been borrowed; dispatch_acquired will be set by the borro...">message_borrowed</a>);
<a name="l03944"></a>03944   _dbus_return_if_fail (connection-&gt;<a class="code" href="structDBusConnection.html#a11803a01d74d956ef37e6aa092f0cf17" title="Someone has dispatch path (can drain incoming queue)">dispatch_acquired</a>);
<a name="l03945"></a>03945   
<a name="l03946"></a>03946   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l03947"></a>03947  
<a name="l03948"></a>03948   _dbus_assert (message == connection-&gt;<a class="code" href="structDBusConnection.html#aef492b411cd2ebd214f8e4dd15e154af" title="Filled in if the first incoming message has been borrowed; dispatch_acquired will be set by the borro...">message_borrowed</a>);
<a name="l03949"></a>03949 
<a name="l03950"></a>03950   pop_message = <a class="code" href="group__DBusList.html#gacb96c9d3e9a869e63b8db4f8913a5a60" title="Removes the first value in the list and returns it.">_dbus_list_pop_first</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#aacb3a29956aa7712db37916194fde869" title="Queue of messages we have received, end of the list received most recently.">incoming_messages</a>);
<a name="l03951"></a>03951   _dbus_assert (message == pop_message);
<a name="l03952"></a>03952   (void) pop_message; <span class="comment">/* unused unless asserting */</span>
<a name="l03953"></a>03953 
<a name="l03954"></a>03954   connection-&gt;<a class="code" href="structDBusConnection.html#a9bda45f2d5c9af5c187fc31d7c98b424" title="Length of incoming queue.">n_incoming</a> -= 1;
<a name="l03955"></a>03955  
<a name="l03956"></a>03956   _dbus_verbose (<span class="stringliteral">&quot;Incoming message %p stolen from queue, %d incoming\n&quot;</span>,
<a name="l03957"></a>03957                  message, connection-&gt;<a class="code" href="structDBusConnection.html#a9bda45f2d5c9af5c187fc31d7c98b424" title="Length of incoming queue.">n_incoming</a>);
<a name="l03958"></a>03958  
<a name="l03959"></a>03959   connection-&gt;<a class="code" href="structDBusConnection.html#aef492b411cd2ebd214f8e4dd15e154af" title="Filled in if the first incoming message has been borrowed; dispatch_acquired will be set by the borro...">message_borrowed</a> = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l03960"></a>03960 
<a name="l03961"></a>03961   _dbus_connection_release_dispatch (connection);
<a name="l03962"></a>03962 
<a name="l03963"></a>03963   status = _dbus_connection_get_dispatch_status_unlocked (connection);
<a name="l03964"></a>03964   _dbus_connection_update_dispatch_status_and_unlock (connection, status);
<a name="l03965"></a>03965   _dbus_message_trace_ref (message, -1, -1,
<a name="l03966"></a>03966       <span class="stringliteral">&quot;dbus_connection_steal_borrowed_message&quot;</span>);
<a name="l03967"></a>03967 }
<a name="l03968"></a>03968 
<a name="l03969"></a>03969 <span class="comment">/* See dbus_connection_pop_message, but requires the caller to own</span>
<a name="l03970"></a>03970 <span class="comment"> * the lock before calling. May drop the lock while running.</span>
<a name="l03971"></a>03971 <span class="comment"> */</span>
<a name="l03972"></a>03972 <span class="keyword">static</span> <a class="code" href="structDBusList.html" title="A node in a linked list.">DBusList</a>*
<a name="l03973"></a>03973 _dbus_connection_pop_message_link_unlocked (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l03974"></a>03974 {
<a name="l03975"></a>03975   HAVE_LOCK_CHECK (connection);
<a name="l03976"></a>03976   
<a name="l03977"></a>03977   _dbus_assert (connection-&gt;<a class="code" href="structDBusConnection.html#aef492b411cd2ebd214f8e4dd15e154af" title="Filled in if the first incoming message has been borrowed; dispatch_acquired will be set by the borro...">message_borrowed</a> == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l03978"></a>03978   
<a name="l03979"></a>03979   <span class="keywordflow">if</span> (connection-&gt;<a class="code" href="structDBusConnection.html#a9bda45f2d5c9af5c187fc31d7c98b424" title="Length of incoming queue.">n_incoming</a> &gt; 0)
<a name="l03980"></a>03980     {
<a name="l03981"></a>03981       <a class="code" href="structDBusList.html" title="A node in a linked list.">DBusList</a> *link;
<a name="l03982"></a>03982 
<a name="l03983"></a>03983       link = <a class="code" href="group__DBusList.html#gaab9a957eca9bf5466bbf377a23b4b25c" title="Removes the first link in the list and returns it.">_dbus_list_pop_first_link</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#aacb3a29956aa7712db37916194fde869" title="Queue of messages we have received, end of the list received most recently.">incoming_messages</a>);
<a name="l03984"></a>03984       connection-&gt;<a class="code" href="structDBusConnection.html#a9bda45f2d5c9af5c187fc31d7c98b424" title="Length of incoming queue.">n_incoming</a> -= 1;
<a name="l03985"></a>03985 
<a name="l03986"></a>03986       _dbus_verbose (<span class="stringliteral">&quot;Message %p (%s %s %s %s sig:&#39;%s&#39; serial:%u) removed from incoming queue %p, %d incoming\n&quot;</span>,
<a name="l03987"></a>03987                      link-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a>,
<a name="l03988"></a>03988                      <a class="code" href="group__DBusMessageInternals.html#ga75bcb613a291eb7e427f77f2f3635b8f" title="Utility function to convert a D-Bus message type into a machine-readable string (not translated)...">dbus_message_type_to_string</a> (<a class="code" href="group__DBusMessage.html#ga41cace31999105137772b6257ea540f9" title="Gets the type of a message.">dbus_message_get_type</a> (link-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a>)),
<a name="l03989"></a>03989                      <a class="code" href="group__DBusMessage.html#ga18adf731bb42d324fe2624407319e4af" title="Gets the object path this message is being sent to (for DBUS_MESSAGE_TYPE_METHOD_CALL) or being emitt...">dbus_message_get_path</a> (link-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a>) ?
<a name="l03990"></a>03990                      <a class="code" href="group__DBusMessage.html#ga18adf731bb42d324fe2624407319e4af" title="Gets the object path this message is being sent to (for DBUS_MESSAGE_TYPE_METHOD_CALL) or being emitt...">dbus_message_get_path</a> (link-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a>) :
<a name="l03991"></a>03991                      <span class="stringliteral">&quot;no path&quot;</span>,
<a name="l03992"></a>03992                      <a class="code" href="group__DBusMessage.html#ga1ad192bd4538cae556121a71b4e09d42" title="Gets the interface this message is being sent to (for DBUS_MESSAGE_TYPE_METHOD_CALL) or being emitted...">dbus_message_get_interface</a> (link-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a>) ?
<a name="l03993"></a>03993                      <a class="code" href="group__DBusMessage.html#ga1ad192bd4538cae556121a71b4e09d42" title="Gets the interface this message is being sent to (for DBUS_MESSAGE_TYPE_METHOD_CALL) or being emitted...">dbus_message_get_interface</a> (link-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a>) :
<a name="l03994"></a>03994                      <span class="stringliteral">&quot;no interface&quot;</span>,
<a name="l03995"></a>03995                      <a class="code" href="group__DBusMessage.html#gaf5c6b705c53db07a5ae2c6b76f230cf9" title="Gets the interface member being invoked (DBUS_MESSAGE_TYPE_METHOD_CALL) or emitted (DBUS_MESSAGE_TYPE...">dbus_message_get_member</a> (link-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a>) ?
<a name="l03996"></a>03996                      <a class="code" href="group__DBusMessage.html#gaf5c6b705c53db07a5ae2c6b76f230cf9" title="Gets the interface member being invoked (DBUS_MESSAGE_TYPE_METHOD_CALL) or emitted (DBUS_MESSAGE_TYPE...">dbus_message_get_member</a> (link-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a>) :
<a name="l03997"></a>03997                      <span class="stringliteral">&quot;no member&quot;</span>,
<a name="l03998"></a>03998                      <a class="code" href="group__DBusMessage.html#gaed63e4c2baaa50d782e8ebb7643def19" title="Gets the type signature of the message, i.e.">dbus_message_get_signature</a> (link-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a>),
<a name="l03999"></a>03999                      <a class="code" href="group__DBusMessage.html#ga390710c25564c80025a006c376da2030" title="Returns the serial of a message or 0 if none has been specified.">dbus_message_get_serial</a> (link-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a>),
<a name="l04000"></a>04000                      connection, connection-&gt;<a class="code" href="structDBusConnection.html#a9bda45f2d5c9af5c187fc31d7c98b424" title="Length of incoming queue.">n_incoming</a>);
<a name="l04001"></a>04001 
<a name="l04002"></a>04002       _dbus_message_trace_ref (link-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a>, -1, -1,
<a name="l04003"></a>04003           <span class="stringliteral">&quot;_dbus_connection_pop_message_link_unlocked&quot;</span>);
<a name="l04004"></a>04004 
<a name="l04005"></a>04005       check_disconnected_message_arrived_unlocked (connection, link-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a>);
<a name="l04006"></a>04006       
<a name="l04007"></a>04007       <span class="keywordflow">return</span> link;
<a name="l04008"></a>04008     }
<a name="l04009"></a>04009   <span class="keywordflow">else</span>
<a name="l04010"></a>04010     <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="l04011"></a>04011 }
<a name="l04012"></a>04012 
<a name="l04013"></a>04013 <span class="comment">/* See dbus_connection_pop_message, but requires the caller to own</span>
<a name="l04014"></a>04014 <span class="comment"> * the lock before calling. May drop the lock while running.</span>
<a name="l04015"></a>04015 <span class="comment"> */</span>
<a name="l04016"></a>04016 <span class="keyword">static</span> <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>*
<a name="l04017"></a>04017 _dbus_connection_pop_message_unlocked (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l04018"></a>04018 {
<a name="l04019"></a>04019   <a class="code" href="structDBusList.html" title="A node in a linked list.">DBusList</a> *link;
<a name="l04020"></a>04020 
<a name="l04021"></a>04021   HAVE_LOCK_CHECK (connection);
<a name="l04022"></a>04022   
<a name="l04023"></a>04023   link = _dbus_connection_pop_message_link_unlocked (connection);
<a name="l04024"></a>04024 
<a name="l04025"></a>04025   <span class="keywordflow">if</span> (link != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l04026"></a>04026     {
<a name="l04027"></a>04027       <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message;
<a name="l04028"></a>04028       
<a name="l04029"></a>04029       message = link-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a>;
<a name="l04030"></a>04030       
<a name="l04031"></a>04031       <a class="code" href="group__DBusList.html#ga6e824f717125ce40c549d5402e32610f" title="Frees a linked list node allocated with _dbus_list_alloc_link.">_dbus_list_free_link</a> (link);
<a name="l04032"></a>04032       
<a name="l04033"></a>04033       <span class="keywordflow">return</span> message;
<a name="l04034"></a>04034     }
<a name="l04035"></a>04035   <span class="keywordflow">else</span>
<a name="l04036"></a>04036     <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="l04037"></a>04037 }
<a name="l04038"></a>04038 
<a name="l04039"></a>04039 <span class="keyword">static</span> <span class="keywordtype">void</span>
<a name="l04040"></a>04040 _dbus_connection_putback_message_link_unlocked (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l04041"></a>04041                                                 <a class="code" href="structDBusList.html" title="A node in a linked list.">DBusList</a>       *message_link)
<a name="l04042"></a>04042 {
<a name="l04043"></a>04043   HAVE_LOCK_CHECK (connection);
<a name="l04044"></a>04044   
<a name="l04045"></a>04045   _dbus_assert (message_link != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l04046"></a>04046   <span class="comment">/* You can&#39;t borrow a message while a link is outstanding */</span>
<a name="l04047"></a>04047   _dbus_assert (connection-&gt;<a class="code" href="structDBusConnection.html#aef492b411cd2ebd214f8e4dd15e154af" title="Filled in if the first incoming message has been borrowed; dispatch_acquired will be set by the borro...">message_borrowed</a> == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l04048"></a>04048   <span class="comment">/* We had to have the dispatch lock across the pop/putback */</span>
<a name="l04049"></a>04049   _dbus_assert (connection-&gt;<a class="code" href="structDBusConnection.html#a11803a01d74d956ef37e6aa092f0cf17" title="Someone has dispatch path (can drain incoming queue)">dispatch_acquired</a>);
<a name="l04050"></a>04050 
<a name="l04051"></a>04051   <a class="code" href="group__DBusList.html#gab3dd068e3bd8a319c0d12150785050a7" title="Prepends a link to the list.">_dbus_list_prepend_link</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#aacb3a29956aa7712db37916194fde869" title="Queue of messages we have received, end of the list received most recently.">incoming_messages</a>,
<a name="l04052"></a>04052                            message_link);
<a name="l04053"></a>04053   connection-&gt;<a class="code" href="structDBusConnection.html#a9bda45f2d5c9af5c187fc31d7c98b424" title="Length of incoming queue.">n_incoming</a> += 1;
<a name="l04054"></a>04054 
<a name="l04055"></a>04055   _dbus_verbose (<span class="stringliteral">&quot;Message %p (%s %s %s &#39;%s&#39;) put back into queue %p, %d incoming\n&quot;</span>,
<a name="l04056"></a>04056                  message_link-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a>,
<a name="l04057"></a>04057                  <a class="code" href="group__DBusMessageInternals.html#ga75bcb613a291eb7e427f77f2f3635b8f" title="Utility function to convert a D-Bus message type into a machine-readable string (not translated)...">dbus_message_type_to_string</a> (<a class="code" href="group__DBusMessage.html#ga41cace31999105137772b6257ea540f9" title="Gets the type of a message.">dbus_message_get_type</a> (message_link-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a>)),
<a name="l04058"></a>04058                  <a class="code" href="group__DBusMessage.html#ga1ad192bd4538cae556121a71b4e09d42" title="Gets the interface this message is being sent to (for DBUS_MESSAGE_TYPE_METHOD_CALL) or being emitted...">dbus_message_get_interface</a> (message_link-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a>) ?
<a name="l04059"></a>04059                  <a class="code" href="group__DBusMessage.html#ga1ad192bd4538cae556121a71b4e09d42" title="Gets the interface this message is being sent to (for DBUS_MESSAGE_TYPE_METHOD_CALL) or being emitted...">dbus_message_get_interface</a> (message_link-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a>) :
<a name="l04060"></a>04060                  <span class="stringliteral">&quot;no interface&quot;</span>,
<a name="l04061"></a>04061                  <a class="code" href="group__DBusMessage.html#gaf5c6b705c53db07a5ae2c6b76f230cf9" title="Gets the interface member being invoked (DBUS_MESSAGE_TYPE_METHOD_CALL) or emitted (DBUS_MESSAGE_TYPE...">dbus_message_get_member</a> (message_link-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a>) ?
<a name="l04062"></a>04062                  <a class="code" href="group__DBusMessage.html#gaf5c6b705c53db07a5ae2c6b76f230cf9" title="Gets the interface member being invoked (DBUS_MESSAGE_TYPE_METHOD_CALL) or emitted (DBUS_MESSAGE_TYPE...">dbus_message_get_member</a> (message_link-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a>) :
<a name="l04063"></a>04063                  <span class="stringliteral">&quot;no member&quot;</span>,
<a name="l04064"></a>04064                  <a class="code" href="group__DBusMessage.html#gaed63e4c2baaa50d782e8ebb7643def19" title="Gets the type signature of the message, i.e.">dbus_message_get_signature</a> (message_link-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a>),
<a name="l04065"></a>04065                  connection, connection-&gt;<a class="code" href="structDBusConnection.html#a9bda45f2d5c9af5c187fc31d7c98b424" title="Length of incoming queue.">n_incoming</a>);
<a name="l04066"></a>04066 
<a name="l04067"></a>04067   _dbus_message_trace_ref (message_link-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a>, -1, -1,
<a name="l04068"></a>04068       <span class="stringliteral">&quot;_dbus_connection_putback_message_link_unlocked&quot;</span>);
<a name="l04069"></a>04069 }
<a name="l04070"></a>04070 
<a name="l04090"></a>04090 <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>*
<a name="l04091"></a><a class="code" href="group__DBusConnection.html#ga1e40d994ea162ce767e78de1c4988566">04091</a> <a class="code" href="group__DBusConnection.html#ga1e40d994ea162ce767e78de1c4988566" title="Returns the first-received message from the incoming message queue, removing it from the queue...">dbus_connection_pop_message</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l04092"></a>04092 {
<a name="l04093"></a>04093   <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message;
<a name="l04094"></a>04094   <a class="code" href="group__DBusConnection.html#gabf250a32ff740b2a8c99136e0142d8d2" title="Indicates the status of incoming data on a DBusConnection.">DBusDispatchStatus</a> status;
<a name="l04095"></a>04095 
<a name="l04096"></a>04096   _dbus_verbose (<span class="stringliteral">&quot;start\n&quot;</span>);
<a name="l04097"></a>04097   
<a name="l04098"></a>04098   <span class="comment">/* this is called for the side effect that it queues</span>
<a name="l04099"></a>04099 <span class="comment">   * up any messages from the transport</span>
<a name="l04100"></a>04100 <span class="comment">   */</span>
<a name="l04101"></a>04101   status = <a class="code" href="group__DBusConnection.html#ga893d18d8b36ffb371f16d13645071289" title="Gets the current state of the incoming message queue.">dbus_connection_get_dispatch_status</a> (connection);
<a name="l04102"></a>04102   <span class="keywordflow">if</span> (status != <a class="code" href="group__DBusConnection.html#ggabf250a32ff740b2a8c99136e0142d8d2adf8e8a594ab338cb9cf7855b19e37e93" title="There is more data to potentially convert to messages.">DBUS_DISPATCH_DATA_REMAINS</a>)
<a name="l04103"></a>04103     <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="l04104"></a>04104   
<a name="l04105"></a>04105   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l04106"></a>04106   _dbus_connection_acquire_dispatch (connection);
<a name="l04107"></a>04107   HAVE_LOCK_CHECK (connection);
<a name="l04108"></a>04108   
<a name="l04109"></a>04109   message = _dbus_connection_pop_message_unlocked (connection);
<a name="l04110"></a>04110 
<a name="l04111"></a>04111   _dbus_verbose (<span class="stringliteral">&quot;Returning popped message %p\n&quot;</span>, message);    
<a name="l04112"></a>04112 
<a name="l04113"></a>04113   _dbus_connection_release_dispatch (connection);
<a name="l04114"></a>04114 
<a name="l04115"></a>04115   status = _dbus_connection_get_dispatch_status_unlocked (connection);
<a name="l04116"></a>04116   _dbus_connection_update_dispatch_status_and_unlock (connection, status);
<a name="l04117"></a>04117   
<a name="l04118"></a>04118   <span class="keywordflow">return</span> message;
<a name="l04119"></a>04119 }
<a name="l04120"></a>04120 
<a name="l04128"></a>04128 <span class="keyword">static</span> <span class="keywordtype">void</span>
<a name="l04129"></a>04129 _dbus_connection_acquire_dispatch (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l04130"></a>04130 {
<a name="l04131"></a>04131   HAVE_LOCK_CHECK (connection);
<a name="l04132"></a>04132 
<a name="l04133"></a>04133   <a class="code" href="group__DBusConnectionInternals.html#ga7151f75b5d2308ec80cfe893aba72aa1" title="Increments the reference count of a DBusConnection.">_dbus_connection_ref_unlocked</a> (connection);
<a name="l04134"></a>04134   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l04135"></a>04135   
<a name="l04136"></a>04136   _dbus_verbose (<span class="stringliteral">&quot;locking dispatch_mutex\n&quot;</span>);
<a name="l04137"></a>04137   <a class="code" href="group__DBusThreadsInternals.html#gabea1bdc19c155bca909839090c05eee2" title="Locks a mutex.">_dbus_cmutex_lock</a> (connection-&gt;<a class="code" href="structDBusConnection.html#ad9e7bf73a48f4951b24ce8eec7bb7ac5" title="Protects dispatch_acquired.">dispatch_mutex</a>);
<a name="l04138"></a>04138 
<a name="l04139"></a>04139   <span class="keywordflow">while</span> (connection-&gt;<a class="code" href="structDBusConnection.html#a11803a01d74d956ef37e6aa092f0cf17" title="Someone has dispatch path (can drain incoming queue)">dispatch_acquired</a>)
<a name="l04140"></a>04140     {
<a name="l04141"></a>04141       _dbus_verbose (<span class="stringliteral">&quot;waiting for dispatch to be acquirable\n&quot;</span>);
<a name="l04142"></a>04142       <a class="code" href="group__DBusThreadsInternals.html#ga6938b8a4547ce48290615990f64bd3bb" title="Atomically unlocks the mutex and waits for the conditions variable to be signalled.">_dbus_condvar_wait</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a201f92bbc0947b503a36eaff9ae0ede9" title="Notify when dispatch_acquired is available.">dispatch_cond</a>, 
<a name="l04143"></a>04143                           connection-&gt;<a class="code" href="structDBusConnection.html#ad9e7bf73a48f4951b24ce8eec7bb7ac5" title="Protects dispatch_acquired.">dispatch_mutex</a>);
<a name="l04144"></a>04144     }
<a name="l04145"></a>04145   
<a name="l04146"></a>04146   _dbus_assert (!connection-&gt;<a class="code" href="structDBusConnection.html#a11803a01d74d956ef37e6aa092f0cf17" title="Someone has dispatch path (can drain incoming queue)">dispatch_acquired</a>);
<a name="l04147"></a>04147 
<a name="l04148"></a>04148   connection-&gt;<a class="code" href="structDBusConnection.html#a11803a01d74d956ef37e6aa092f0cf17" title="Someone has dispatch path (can drain incoming queue)">dispatch_acquired</a> = <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l04149"></a>04149 
<a name="l04150"></a>04150   _dbus_verbose (<span class="stringliteral">&quot;unlocking dispatch_mutex\n&quot;</span>);
<a name="l04151"></a>04151   <a class="code" href="group__DBusThreadsInternals.html#gad199edcd1bb88cfd2e9dcfb47cbc732f" title="Unlocks a mutex.">_dbus_cmutex_unlock</a> (connection-&gt;<a class="code" href="structDBusConnection.html#ad9e7bf73a48f4951b24ce8eec7bb7ac5" title="Protects dispatch_acquired.">dispatch_mutex</a>);
<a name="l04152"></a>04152   
<a name="l04153"></a>04153   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l04154"></a>04154   <a class="code" href="group__DBusConnectionInternals.html#ga9ffbd9aa4f07cb30d92887e956a9fd43" title="Decrements the reference count of a DBusConnection.">_dbus_connection_unref_unlocked</a> (connection);
<a name="l04155"></a>04155 }
<a name="l04156"></a>04156 
<a name="l04164"></a>04164 <span class="keyword">static</span> <span class="keywordtype">void</span>
<a name="l04165"></a>04165 _dbus_connection_release_dispatch (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l04166"></a>04166 {
<a name="l04167"></a>04167   HAVE_LOCK_CHECK (connection);
<a name="l04168"></a>04168   
<a name="l04169"></a>04169   _dbus_verbose (<span class="stringliteral">&quot;locking dispatch_mutex\n&quot;</span>);
<a name="l04170"></a>04170   <a class="code" href="group__DBusThreadsInternals.html#gabea1bdc19c155bca909839090c05eee2" title="Locks a mutex.">_dbus_cmutex_lock</a> (connection-&gt;<a class="code" href="structDBusConnection.html#ad9e7bf73a48f4951b24ce8eec7bb7ac5" title="Protects dispatch_acquired.">dispatch_mutex</a>);
<a name="l04171"></a>04171   
<a name="l04172"></a>04172   _dbus_assert (connection-&gt;<a class="code" href="structDBusConnection.html#a11803a01d74d956ef37e6aa092f0cf17" title="Someone has dispatch path (can drain incoming queue)">dispatch_acquired</a>);
<a name="l04173"></a>04173 
<a name="l04174"></a>04174   connection-&gt;<a class="code" href="structDBusConnection.html#a11803a01d74d956ef37e6aa092f0cf17" title="Someone has dispatch path (can drain incoming queue)">dispatch_acquired</a> = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l04175"></a>04175   <a class="code" href="group__DBusThreadsInternals.html#ga8af2fd84773022e7e7ce1f21f0126203" title="If there are threads waiting on the condition variable, wake up exactly one.">_dbus_condvar_wake_one</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a201f92bbc0947b503a36eaff9ae0ede9" title="Notify when dispatch_acquired is available.">dispatch_cond</a>);
<a name="l04176"></a>04176 
<a name="l04177"></a>04177   _dbus_verbose (<span class="stringliteral">&quot;unlocking dispatch_mutex\n&quot;</span>);
<a name="l04178"></a>04178   <a class="code" href="group__DBusThreadsInternals.html#gad199edcd1bb88cfd2e9dcfb47cbc732f" title="Unlocks a mutex.">_dbus_cmutex_unlock</a> (connection-&gt;<a class="code" href="structDBusConnection.html#ad9e7bf73a48f4951b24ce8eec7bb7ac5" title="Protects dispatch_acquired.">dispatch_mutex</a>);
<a name="l04179"></a>04179 }
<a name="l04180"></a>04180 
<a name="l04181"></a>04181 <span class="keyword">static</span> <span class="keywordtype">void</span>
<a name="l04182"></a>04182 _dbus_connection_failed_pop (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l04183"></a>04183                              <a class="code" href="structDBusList.html" title="A node in a linked list.">DBusList</a>       *message_link)
<a name="l04184"></a>04184 {
<a name="l04185"></a>04185   <a class="code" href="group__DBusList.html#gab3dd068e3bd8a319c0d12150785050a7" title="Prepends a link to the list.">_dbus_list_prepend_link</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#aacb3a29956aa7712db37916194fde869" title="Queue of messages we have received, end of the list received most recently.">incoming_messages</a>,
<a name="l04186"></a>04186                            message_link);
<a name="l04187"></a>04187   connection-&gt;<a class="code" href="structDBusConnection.html#a9bda45f2d5c9af5c187fc31d7c98b424" title="Length of incoming queue.">n_incoming</a> += 1;
<a name="l04188"></a>04188 }
<a name="l04189"></a>04189 
<a name="l04190"></a>04190 <span class="comment">/* Note this may be called multiple times since we don&#39;t track whether we already did it */</span>
<a name="l04191"></a>04191 <span class="keyword">static</span> <span class="keywordtype">void</span>
<a name="l04192"></a>04192 notify_disconnected_unlocked (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l04193"></a>04193 {
<a name="l04194"></a>04194   HAVE_LOCK_CHECK (connection);
<a name="l04195"></a>04195 
<a name="l04196"></a>04196   <span class="comment">/* Set the weakref in dbus-bus.c to NULL, so nobody will get a disconnected</span>
<a name="l04197"></a>04197 <span class="comment">   * connection from dbus_bus_get(). We make the same guarantee for</span>
<a name="l04198"></a>04198 <span class="comment">   * dbus_connection_open() but in a different way since we don&#39;t want to</span>
<a name="l04199"></a>04199 <span class="comment">   * unref right here; we instead check for connectedness before returning</span>
<a name="l04200"></a>04200 <span class="comment">   * the connection from the hash.</span>
<a name="l04201"></a>04201 <span class="comment">   */</span>
<a name="l04202"></a>04202   <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> (connection);
<a name="l04203"></a>04203 
<a name="l04204"></a>04204   <span class="comment">/* Dump the outgoing queue, we aren&#39;t going to be able to</span>
<a name="l04205"></a>04205 <span class="comment">   * send it now, and we&#39;d like accessors like</span>
<a name="l04206"></a>04206 <span class="comment">   * dbus_connection_get_outgoing_size() to be accurate.</span>
<a name="l04207"></a>04207 <span class="comment">   */</span>
<a name="l04208"></a>04208   <span class="keywordflow">if</span> (connection-&gt;<a class="code" href="structDBusConnection.html#a07025e177949c5e65d5f983ac5f5e878" title="Length of outgoing queue.">n_outgoing</a> &gt; 0)
<a name="l04209"></a>04209     {
<a name="l04210"></a>04210       <a class="code" href="structDBusList.html" title="A node in a linked list.">DBusList</a> *link;
<a name="l04211"></a>04211       
<a name="l04212"></a>04212       _dbus_verbose (<span class="stringliteral">&quot;Dropping %d outgoing messages since we&#39;re disconnected\n&quot;</span>,
<a name="l04213"></a>04213                      connection-&gt;<a class="code" href="structDBusConnection.html#a07025e177949c5e65d5f983ac5f5e878" title="Length of outgoing queue.">n_outgoing</a>);
<a name="l04214"></a>04214       
<a name="l04215"></a>04215       <span class="keywordflow">while</span> ((link = <a class="code" href="group__DBusList.html#ga42736fb02458bfffed948a509962c059" title="Gets the last link in the list.">_dbus_list_get_last_link</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#a714fd51af8730c367b079594c7f756ae" title="Queue of messages we need to send, send the end of the list first.">outgoing_messages</a>)))
<a name="l04216"></a>04216         {
<a name="l04217"></a>04217           <a class="code" href="group__DBusConnectionInternals.html#gab93fd3666217ee339c4d2e8d4d33e63c" title="Notifies the connection that a message has been sent, so the message can be removed from the outgoing...">_dbus_connection_message_sent_unlocked</a> (connection, link-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a>);
<a name="l04218"></a>04218         }
<a name="l04219"></a>04219     } 
<a name="l04220"></a>04220 }
<a name="l04221"></a>04221 
<a name="l04222"></a>04222 <span class="comment">/* Note this may be called multiple times since we don&#39;t track whether we already did it */</span>
<a name="l04223"></a>04223 <span class="keyword">static</span> <a class="code" href="group__DBusConnection.html#gabf250a32ff740b2a8c99136e0142d8d2" title="Indicates the status of incoming data on a DBusConnection.">DBusDispatchStatus</a>
<a name="l04224"></a>04224 notify_disconnected_and_dispatch_complete_unlocked (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l04225"></a>04225 {
<a name="l04226"></a>04226   HAVE_LOCK_CHECK (connection);
<a name="l04227"></a>04227   
<a name="l04228"></a>04228   <span class="keywordflow">if</span> (connection-&gt;<a class="code" href="structDBusConnection.html#aa70afc41f6184604c027e7f71a314d7f" title="Preallocated list node for queueing the disconnection message.">disconnect_message_link</a> != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l04229"></a>04229     {
<a name="l04230"></a>04230       _dbus_verbose (<span class="stringliteral">&quot;Sending disconnect message\n&quot;</span>);
<a name="l04231"></a>04231       
<a name="l04232"></a>04232       <span class="comment">/* If we have pending calls, queue their timeouts - we want the Disconnected</span>
<a name="l04233"></a>04233 <span class="comment">       * to be the last message, after these timeouts.</span>
<a name="l04234"></a>04234 <span class="comment">       */</span>
<a name="l04235"></a>04235       connection_timeout_and_complete_all_pending_calls_unlocked (connection);
<a name="l04236"></a>04236       
<a name="l04237"></a>04237       <span class="comment">/* We haven&#39;t sent the disconnect message already,</span>
<a name="l04238"></a>04238 <span class="comment">       * and all real messages have been queued up.</span>
<a name="l04239"></a>04239 <span class="comment">       */</span>
<a name="l04240"></a>04240       <a class="code" href="group__DBusConnectionInternals.html#gadb7a525dc6b566b575ee4f9b20028b04" title="Adds a link + message to the incoming message queue.">_dbus_connection_queue_synthesized_message_link</a> (connection,
<a name="l04241"></a>04241                                                        connection-&gt;<a class="code" href="structDBusConnection.html#aa70afc41f6184604c027e7f71a314d7f" title="Preallocated list node for queueing the disconnection message.">disconnect_message_link</a>);
<a name="l04242"></a>04242       connection-&gt;<a class="code" href="structDBusConnection.html#aa70afc41f6184604c027e7f71a314d7f" title="Preallocated list node for queueing the disconnection message.">disconnect_message_link</a> = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l04243"></a>04243 
<a name="l04244"></a>04244       <span class="keywordflow">return</span> <a class="code" href="group__DBusConnection.html#ggabf250a32ff740b2a8c99136e0142d8d2adf8e8a594ab338cb9cf7855b19e37e93" title="There is more data to potentially convert to messages.">DBUS_DISPATCH_DATA_REMAINS</a>;
<a name="l04245"></a>04245     }
<a name="l04246"></a>04246 
<a name="l04247"></a>04247   <span class="keywordflow">return</span> <a class="code" href="group__DBusConnection.html#ggabf250a32ff740b2a8c99136e0142d8d2acb9bb9daa90f520d5fc9e84de3c5f017" title="All currently available data has been processed.">DBUS_DISPATCH_COMPLETE</a>;
<a name="l04248"></a>04248 }
<a name="l04249"></a>04249 
<a name="l04250"></a>04250 <span class="keyword">static</span> <a class="code" href="group__DBusConnection.html#gabf250a32ff740b2a8c99136e0142d8d2" title="Indicates the status of incoming data on a DBusConnection.">DBusDispatchStatus</a>
<a name="l04251"></a>04251 _dbus_connection_get_dispatch_status_unlocked (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l04252"></a>04252 {
<a name="l04253"></a>04253   HAVE_LOCK_CHECK (connection);
<a name="l04254"></a>04254   
<a name="l04255"></a>04255   <span class="keywordflow">if</span> (connection-&gt;<a class="code" href="structDBusConnection.html#a9bda45f2d5c9af5c187fc31d7c98b424" title="Length of incoming queue.">n_incoming</a> &gt; 0)
<a name="l04256"></a>04256     <span class="keywordflow">return</span> <a class="code" href="group__DBusConnection.html#ggabf250a32ff740b2a8c99136e0142d8d2adf8e8a594ab338cb9cf7855b19e37e93" title="There is more data to potentially convert to messages.">DBUS_DISPATCH_DATA_REMAINS</a>;
<a name="l04257"></a>04257   <span class="keywordflow">else</span> <span class="keywordflow">if</span> (!<a class="code" href="group__DBusTransport.html#ga4046f36ecbdb75219f2b667f92e75a2b" title="Processes data we&#39;ve read while handling a watch, potentially converting some of it to messages and q...">_dbus_transport_queue_messages</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>))
<a name="l04258"></a>04258     <span class="keywordflow">return</span> <a class="code" href="group__DBusConnection.html#ggabf250a32ff740b2a8c99136e0142d8d2a5af20a035f29cfa67fb8d69fb693b685" title="More memory is needed to continue.">DBUS_DISPATCH_NEED_MEMORY</a>;
<a name="l04259"></a>04259   <span class="keywordflow">else</span>
<a name="l04260"></a>04260     {
<a name="l04261"></a>04261       <a class="code" href="group__DBusConnection.html#gabf250a32ff740b2a8c99136e0142d8d2" title="Indicates the status of incoming data on a DBusConnection.">DBusDispatchStatus</a> status;
<a name="l04262"></a>04262       <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> is_connected;
<a name="l04263"></a>04263       
<a name="l04264"></a>04264       status = <a class="code" href="group__DBusTransport.html#ga32153a834758b5a88d7bde8f7a205c71" title="Reports our current dispatch status (whether there&#39;s buffered data to be queued as messages...">_dbus_transport_get_dispatch_status</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>);
<a name="l04265"></a>04265       is_connected = <a class="code" href="group__DBusTransport.html#gaceee4b098b0177870ad934daad90a9c6" title="Returns TRUE if the transport has not been disconnected.">_dbus_transport_get_is_connected</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>);
<a name="l04266"></a>04266 
<a name="l04267"></a>04267       _dbus_verbose (<span class="stringliteral">&quot;dispatch status = %s is_connected = %d\n&quot;</span>,
<a name="l04268"></a>04268                      DISPATCH_STATUS_NAME (status), is_connected);
<a name="l04269"></a>04269       
<a name="l04270"></a>04270       <span class="keywordflow">if</span> (!is_connected)
<a name="l04271"></a>04271         {
<a name="l04272"></a>04272           <span class="comment">/* It&#39;s possible this would be better done by having an explicit</span>
<a name="l04273"></a>04273 <span class="comment">           * notification from _dbus_transport_disconnect() that would</span>
<a name="l04274"></a>04274 <span class="comment">           * synchronously do this, instead of waiting for the next dispatch</span>
<a name="l04275"></a>04275 <span class="comment">           * status check. However, probably not good to change until it causes</span>
<a name="l04276"></a>04276 <span class="comment">           * a problem.</span>
<a name="l04277"></a>04277 <span class="comment">           */</span>
<a name="l04278"></a>04278           notify_disconnected_unlocked (connection);
<a name="l04279"></a>04279 
<a name="l04280"></a>04280           <span class="comment">/* I&#39;m not sure this is needed; the idea is that we want to</span>
<a name="l04281"></a>04281 <span class="comment">           * queue the Disconnected only after we&#39;ve read all the</span>
<a name="l04282"></a>04282 <span class="comment">           * messages, but if we&#39;re disconnected maybe we are guaranteed</span>
<a name="l04283"></a>04283 <span class="comment">           * to have read them all ?</span>
<a name="l04284"></a>04284 <span class="comment">           */</span>
<a name="l04285"></a>04285           <span class="keywordflow">if</span> (status == <a class="code" href="group__DBusConnection.html#ggabf250a32ff740b2a8c99136e0142d8d2acb9bb9daa90f520d5fc9e84de3c5f017" title="All currently available data has been processed.">DBUS_DISPATCH_COMPLETE</a>)
<a name="l04286"></a>04286             status = notify_disconnected_and_dispatch_complete_unlocked (connection);
<a name="l04287"></a>04287         }
<a name="l04288"></a>04288       
<a name="l04289"></a>04289       <span class="keywordflow">if</span> (status != <a class="code" href="group__DBusConnection.html#ggabf250a32ff740b2a8c99136e0142d8d2acb9bb9daa90f520d5fc9e84de3c5f017" title="All currently available data has been processed.">DBUS_DISPATCH_COMPLETE</a>)
<a name="l04290"></a>04290         <span class="keywordflow">return</span> status;
<a name="l04291"></a>04291       <span class="keywordflow">else</span> <span class="keywordflow">if</span> (connection-&gt;<a class="code" href="structDBusConnection.html#a9bda45f2d5c9af5c187fc31d7c98b424" title="Length of incoming queue.">n_incoming</a> &gt; 0)
<a name="l04292"></a>04292         <span class="keywordflow">return</span> <a class="code" href="group__DBusConnection.html#ggabf250a32ff740b2a8c99136e0142d8d2adf8e8a594ab338cb9cf7855b19e37e93" title="There is more data to potentially convert to messages.">DBUS_DISPATCH_DATA_REMAINS</a>;
<a name="l04293"></a>04293       <span class="keywordflow">else</span>
<a name="l04294"></a>04294         <span class="keywordflow">return</span> <a class="code" href="group__DBusConnection.html#ggabf250a32ff740b2a8c99136e0142d8d2acb9bb9daa90f520d5fc9e84de3c5f017" title="All currently available data has been processed.">DBUS_DISPATCH_COMPLETE</a>;
<a name="l04295"></a>04295     }
<a name="l04296"></a>04296 }
<a name="l04297"></a>04297 
<a name="l04298"></a>04298 <span class="keyword">static</span> <span class="keywordtype">void</span>
<a name="l04299"></a>04299 _dbus_connection_update_dispatch_status_and_unlock (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>    *connection,
<a name="l04300"></a>04300                                                     <a class="code" href="group__DBusConnection.html#gabf250a32ff740b2a8c99136e0142d8d2" title="Indicates the status of incoming data on a DBusConnection.">DBusDispatchStatus</a> new_status)
<a name="l04301"></a>04301 {
<a name="l04302"></a>04302   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> changed;
<a name="l04303"></a>04303   <a class="code" href="group__DBusConnection.html#gaad6e12a5d298ef30a99d8c667abad58a" title="Called when the return value of dbus_connection_get_dispatch_status() may have changed.">DBusDispatchStatusFunction</a> <span class="keyword">function</span>;
<a name="l04304"></a>04304   <span class="keywordtype">void</span> *data;
<a name="l04305"></a>04305 
<a name="l04306"></a>04306   HAVE_LOCK_CHECK (connection);
<a name="l04307"></a>04307 
<a name="l04308"></a>04308   <a class="code" href="group__DBusConnectionInternals.html#ga7151f75b5d2308ec80cfe893aba72aa1" title="Increments the reference count of a DBusConnection.">_dbus_connection_ref_unlocked</a> (connection);
<a name="l04309"></a>04309 
<a name="l04310"></a>04310   changed = new_status != connection-&gt;<a class="code" href="structDBusConnection.html#af3bbd2ecba171ebb8e952eaa030971d7" title="The last dispatch status we reported to the application.">last_dispatch_status</a>;
<a name="l04311"></a>04311 
<a name="l04312"></a>04312   connection-&gt;<a class="code" href="structDBusConnection.html#af3bbd2ecba171ebb8e952eaa030971d7" title="The last dispatch status we reported to the application.">last_dispatch_status</a> = new_status;
<a name="l04313"></a>04313 
<a name="l04314"></a>04314   <span class="keyword">function</span> = connection-&gt;<a class="code" href="structDBusConnection.html#af6cbafdf80cd474c654fc226581900a2" title="Function on dispatch status changes.">dispatch_status_function</a>;
<a name="l04315"></a>04315   data = connection-&gt;<a class="code" href="structDBusConnection.html#a0225f7934d1bd118ae2eeacf8a1c6f19" title="Application data for dispatch_status_function.">dispatch_status_data</a>;
<a name="l04316"></a>04316 
<a name="l04317"></a>04317   <span class="keywordflow">if</span> (connection-&gt;<a class="code" href="structDBusConnection.html#a48d141d4311211e921571043bdbaeefb" title="We popped or are dispatching the disconnected message.">disconnected_message_arrived</a> &amp;&amp;
<a name="l04318"></a>04318       !connection-&gt;<a class="code" href="structDBusConnection.html#a3b2707b9d10d0643f91a8e027ae118b5" title="We did our default handling of the disconnected message, such as closing the connection.">disconnected_message_processed</a>)
<a name="l04319"></a>04319     {
<a name="l04320"></a>04320       connection-&gt;<a class="code" href="structDBusConnection.html#a3b2707b9d10d0643f91a8e027ae118b5" title="We did our default handling of the disconnected message, such as closing the connection.">disconnected_message_processed</a> = <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l04321"></a>04321       
<a name="l04322"></a>04322       <span class="comment">/* this does an unref, but we have a ref</span>
<a name="l04323"></a>04323 <span class="comment">       * so we should not run the finalizer here</span>
<a name="l04324"></a>04324 <span class="comment">       * inside the lock.</span>
<a name="l04325"></a>04325 <span class="comment">       */</span>
<a name="l04326"></a>04326       connection_forget_shared_unlocked (connection);
<a name="l04327"></a>04327 
<a name="l04328"></a>04328       <span class="keywordflow">if</span> (connection-&gt;<a class="code" href="structDBusConnection.html#a2a9f22339f90157f308a532462218404" title="If TRUE, exit after handling disconnect signal.">exit_on_disconnect</a>)
<a name="l04329"></a>04329         {
<a name="l04330"></a>04330           <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);            
<a name="l04331"></a>04331           
<a name="l04332"></a>04332           _dbus_verbose (<span class="stringliteral">&quot;Exiting on Disconnected signal\n&quot;</span>);
<a name="l04333"></a>04333           <a class="code" href="group__DBusSysdeps.html#ga203e3257b50597a8fe7757c920474a20" title="Exit the process, returning the given value.">_dbus_exit</a> (1);
<a name="l04334"></a>04334           _dbus_assert_not_reached (<span class="stringliteral">&quot;Call to exit() returned&quot;</span>);
<a name="l04335"></a>04335         }
<a name="l04336"></a>04336     }
<a name="l04337"></a>04337   
<a name="l04338"></a>04338   <span class="comment">/* We drop the lock */</span>
<a name="l04339"></a>04339   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l04340"></a>04340   
<a name="l04341"></a>04341   <span class="keywordflow">if</span> (changed &amp;&amp; <span class="keyword">function</span>)
<a name="l04342"></a>04342     {
<a name="l04343"></a>04343       _dbus_verbose (<span class="stringliteral">&quot;Notifying of change to dispatch status of %p now %d (%s)\n&quot;</span>,
<a name="l04344"></a>04344                      connection, new_status,
<a name="l04345"></a>04345                      DISPATCH_STATUS_NAME (new_status));
<a name="l04346"></a>04346       (* function) (connection, new_status, data);      
<a name="l04347"></a>04347     }
<a name="l04348"></a>04348   
<a name="l04349"></a>04349   <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="l04350"></a>04350 }
<a name="l04351"></a>04351 
<a name="l04377"></a>04377 <a class="code" href="group__DBusConnection.html#gabf250a32ff740b2a8c99136e0142d8d2" title="Indicates the status of incoming data on a DBusConnection.">DBusDispatchStatus</a>
<a name="l04378"></a><a class="code" href="group__DBusConnection.html#ga893d18d8b36ffb371f16d13645071289">04378</a> <a class="code" href="group__DBusConnection.html#ga893d18d8b36ffb371f16d13645071289" title="Gets the current state of the incoming message queue.">dbus_connection_get_dispatch_status</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l04379"></a>04379 {
<a name="l04380"></a>04380   <a class="code" href="group__DBusConnection.html#gabf250a32ff740b2a8c99136e0142d8d2" title="Indicates the status of incoming data on a DBusConnection.">DBusDispatchStatus</a> status;
<a name="l04381"></a>04381 
<a name="l04382"></a>04382   _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__DBusConnection.html#ggabf250a32ff740b2a8c99136e0142d8d2acb9bb9daa90f520d5fc9e84de3c5f017" title="All currently available data has been processed.">DBUS_DISPATCH_COMPLETE</a>);
<a name="l04383"></a>04383 
<a name="l04384"></a>04384   _dbus_verbose (<span class="stringliteral">&quot;start\n&quot;</span>);
<a name="l04385"></a>04385   
<a name="l04386"></a>04386   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l04387"></a>04387 
<a name="l04388"></a>04388   status = _dbus_connection_get_dispatch_status_unlocked (connection);
<a name="l04389"></a>04389   
<a name="l04390"></a>04390   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l04391"></a>04391 
<a name="l04392"></a>04392   <span class="keywordflow">return</span> status;
<a name="l04393"></a>04393 }
<a name="l04394"></a>04394 
<a name="l04398"></a>04398 <span class="keyword">static</span> <a class="code" href="group__DBusShared.html#ga8244b29230187624c24986c24edab1de" title="Results that a message handler can return.">DBusHandlerResult</a>
<a name="l04399"></a>04399 _dbus_connection_peer_filter_unlocked_no_update (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l04400"></a>04400                                                  <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>    *message)
<a name="l04401"></a>04401 {
<a name="l04402"></a>04402   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> sent = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l04403"></a>04403   <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *ret = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l04404"></a>04404   <a class="code" href="structDBusList.html" title="A node in a linked list.">DBusList</a> *expire_link;
<a name="l04405"></a>04405 
<a name="l04406"></a>04406   <span class="keywordflow">if</span> (connection-&gt;<a class="code" href="structDBusConnection.html#ab13bc36d7e6f91995768277ecbd5482c" title="If TRUE, if org.freedesktop.DBus.Peer messages have a bus name, don&#39;t handle them automatically...">route_peer_messages</a> &amp;&amp; <a class="code" href="group__DBusMessage.html#gaac65c926e6253e49aa689b4f032fad45" title="Gets the destination of a message or NULL if there is none set.">dbus_message_get_destination</a> (message) != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l04407"></a>04407     {
<a name="l04408"></a>04408       <span class="comment">/* This means we&#39;re letting the bus route this message */</span>
<a name="l04409"></a>04409       <span class="keywordflow">return</span> <a class="code" href="group__DBusShared.html#gga8244b29230187624c24986c24edab1deacb84b64c92055f2585fe9c29f1e5df68" title="Message has not had any effect - see if other handlers want it.">DBUS_HANDLER_RESULT_NOT_YET_HANDLED</a>;
<a name="l04410"></a>04410     }
<a name="l04411"></a>04411 
<a name="l04412"></a>04412   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusMessage.html#ga0d1debd1c101a80c386d6ec92cdb1d93" title="Checks if the message has an interface.">dbus_message_has_interface</a> (message, <a class="code" href="group__DBusShared.html#gaacbd4e8ccdef18c75edd0785fbcc70ef" title="The interface supported by most dbus peers.">DBUS_INTERFACE_PEER</a>))
<a name="l04413"></a>04413     {
<a name="l04414"></a>04414       <span class="keywordflow">return</span> <a class="code" href="group__DBusShared.html#gga8244b29230187624c24986c24edab1deacb84b64c92055f2585fe9c29f1e5df68" title="Message has not had any effect - see if other handlers want it.">DBUS_HANDLER_RESULT_NOT_YET_HANDLED</a>;
<a name="l04415"></a>04415     }
<a name="l04416"></a>04416 
<a name="l04417"></a>04417   <span class="comment">/* Preallocate a linked-list link, so that if we need to dispose of a</span>
<a name="l04418"></a>04418 <span class="comment">   * message, we can attach it to the expired list */</span>
<a name="l04419"></a>04419   expire_link = <a class="code" href="group__DBusList.html#gac20b9981531cef590d49a59240344cd8" title="Allocates a linked list node.">_dbus_list_alloc_link</a> (<a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l04420"></a>04420 
<a name="l04421"></a>04421   <span class="keywordflow">if</span> (!expire_link)
<a name="l04422"></a>04422     <span class="keywordflow">return</span> <a class="code" href="group__DBusShared.html#gga8244b29230187624c24986c24edab1dea01f00ce4578559c7b14b91256bfede7d" title="Need more memory in order to return DBUS_HANDLER_RESULT_HANDLED or DBUS_HANDLER_RESULT_NOT_YET_HANDLE...">DBUS_HANDLER_RESULT_NEED_MEMORY</a>;
<a name="l04423"></a>04423 
<a name="l04424"></a>04424   <span class="keywordflow">if</span> (<a class="code" href="group__DBusMessage.html#gad8bd4730941af47d8d0f9c9b00562a44" title="Checks whether the message is a method call with the given interface and member fields.">dbus_message_is_method_call</a> (message,
<a name="l04425"></a>04425                                    <a class="code" href="group__DBusShared.html#gaacbd4e8ccdef18c75edd0785fbcc70ef" title="The interface supported by most dbus peers.">DBUS_INTERFACE_PEER</a>,
<a name="l04426"></a>04426                                    <span class="stringliteral">&quot;Ping&quot;</span>))
<a name="l04427"></a>04427     {
<a name="l04428"></a>04428       ret = <a class="code" href="group__DBusMessage.html#ga95142bd8288f397194ee0eefb1d27125" title="Constructs a message that is a reply to a method call.">dbus_message_new_method_return</a> (message);
<a name="l04429"></a>04429       <span class="keywordflow">if</span> (ret == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l04430"></a>04430         <span class="keywordflow">goto</span> out;
<a name="l04431"></a>04431 
<a name="l04432"></a>04432       sent = _dbus_connection_send_unlocked_no_update (connection, ret, <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l04433"></a>04433     }
<a name="l04434"></a>04434   <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="group__DBusMessage.html#gad8bd4730941af47d8d0f9c9b00562a44" title="Checks whether the message is a method call with the given interface and member fields.">dbus_message_is_method_call</a> (message,
<a name="l04435"></a>04435                                         <a class="code" href="group__DBusShared.html#gaacbd4e8ccdef18c75edd0785fbcc70ef" title="The interface supported by most dbus peers.">DBUS_INTERFACE_PEER</a>,
<a name="l04436"></a>04436                                         <span class="stringliteral">&quot;GetMachineId&quot;</span>))
<a name="l04437"></a>04437     {
<a name="l04438"></a>04438       <a class="code" href="structDBusString.html">DBusString</a> uuid;
<a name="l04439"></a>04439       
<a name="l04440"></a>04440       ret = <a class="code" href="group__DBusMessage.html#ga95142bd8288f397194ee0eefb1d27125" title="Constructs a message that is a reply to a method call.">dbus_message_new_method_return</a> (message);
<a name="l04441"></a>04441       <span class="keywordflow">if</span> (ret == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l04442"></a>04442         <span class="keywordflow">goto</span> out;
<a name="l04443"></a>04443 
<a name="l04444"></a>04444       <a class="code" href="group__DBusString.html#ga348252317f7bb8ac43529972945830ae" title="Initializes a string.">_dbus_string_init</a> (&amp;uuid);
<a name="l04445"></a>04445       <span class="keywordflow">if</span> (<a class="code" href="group__DBusInternalsUtils.html#ga49ba67405d677af6cde9329ed87ea91f" title="Gets the hex-encoded UUID of the machine this function is executed on.">_dbus_get_local_machine_uuid_encoded</a> (&amp;uuid))
<a name="l04446"></a>04446         {
<a name="l04447"></a>04447           <span class="keyword">const</span> <span class="keywordtype">char</span> *v_STRING = <a class="code" href="group__DBusString.html#ga33e20241ae7d784624f97d89b1a0539e" title="Gets the raw character buffer from a const string.">_dbus_string_get_const_data</a> (&amp;uuid);
<a name="l04448"></a>04448           <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> (ret,
<a name="l04449"></a>04449                                         <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="l04450"></a>04450                                         <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="l04451"></a>04451             {
<a name="l04452"></a>04452               sent = _dbus_connection_send_unlocked_no_update (connection, ret, <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l04453"></a>04453             }
<a name="l04454"></a>04454         }
<a name="l04455"></a>04455       <a class="code" href="group__DBusString.html#ga781ca91acda49a834dce7d0ed0eef212" title="Frees a string created by _dbus_string_init().">_dbus_string_free</a> (&amp;uuid);
<a name="l04456"></a>04456     }
<a name="l04457"></a>04457   <span class="keywordflow">else</span>
<a name="l04458"></a>04458     {
<a name="l04459"></a>04459       <span class="comment">/* We need to bounce anything else with this interface, otherwise apps</span>
<a name="l04460"></a>04460 <span class="comment">       * could start extending the interface and when we added extensions</span>
<a name="l04461"></a>04461 <span class="comment">       * here to DBusConnection we&#39;d break those apps.</span>
<a name="l04462"></a>04462 <span class="comment">       */</span>
<a name="l04463"></a>04463       ret = <a class="code" href="group__DBusMessage.html#ga2ab896965aec97fb21293affeed36232" title="Creates a new message that is an error reply to another message.">dbus_message_new_error</a> (message,
<a name="l04464"></a>04464                                     <a class="code" href="group__DBusProtocol.html#ga46c7cbfa1806b0cccb56e9a7ca92f02b" title="Method name you invoked isn&#39;t known by the object you invoked it on.">DBUS_ERROR_UNKNOWN_METHOD</a>,
<a name="l04465"></a>04465                                     <span class="stringliteral">&quot;Unknown method invoked on org.freedesktop.DBus.Peer interface&quot;</span>);
<a name="l04466"></a>04466       <span class="keywordflow">if</span> (ret == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l04467"></a>04467         <span class="keywordflow">goto</span> out;
<a name="l04468"></a>04468 
<a name="l04469"></a>04469       sent = _dbus_connection_send_unlocked_no_update (connection, ret, <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l04470"></a>04470     }
<a name="l04471"></a>04471 
<a name="l04472"></a>04472 out:
<a name="l04473"></a>04473   <span class="keywordflow">if</span> (ret == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l04474"></a>04474     {
<a name="l04475"></a>04475       <a class="code" href="group__DBusList.html#ga6e824f717125ce40c549d5402e32610f" title="Frees a linked list node allocated with _dbus_list_alloc_link.">_dbus_list_free_link</a> (expire_link);
<a name="l04476"></a>04476     }
<a name="l04477"></a>04477   <span class="keywordflow">else</span>
<a name="l04478"></a>04478     {
<a name="l04479"></a>04479       <span class="comment">/* It&#39;ll be safe to unref the reply when we unlock */</span>
<a name="l04480"></a>04480       expire_link-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a> = ret;
<a name="l04481"></a>04481       <a class="code" href="group__DBusList.html#gab3dd068e3bd8a319c0d12150785050a7" title="Prepends a link to the list.">_dbus_list_prepend_link</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#afc069c0dc7f29123d432650580aec036" title="Messages that will be released when we next unlock.">expired_messages</a>, expire_link);
<a name="l04482"></a>04482     }
<a name="l04483"></a>04483 
<a name="l04484"></a>04484   <span class="keywordflow">if</span> (!sent)
<a name="l04485"></a>04485     <span class="keywordflow">return</span> <a class="code" href="group__DBusShared.html#gga8244b29230187624c24986c24edab1dea01f00ce4578559c7b14b91256bfede7d" title="Need more memory in order to return DBUS_HANDLER_RESULT_HANDLED or DBUS_HANDLER_RESULT_NOT_YET_HANDLE...">DBUS_HANDLER_RESULT_NEED_MEMORY</a>;
<a name="l04486"></a>04486 
<a name="l04487"></a>04487   <span class="keywordflow">return</span> <a class="code" href="group__DBusShared.html#gga8244b29230187624c24986c24edab1deab6df40880a8f322694f14cd2804d3f76" title="Message has had its effect - no need to run more handlers.">DBUS_HANDLER_RESULT_HANDLED</a>;
<a name="l04488"></a>04488 }
<a name="l04489"></a>04489 
<a name="l04496"></a>04496 <span class="keyword">static</span> <a class="code" href="group__DBusShared.html#ga8244b29230187624c24986c24edab1de" title="Results that a message handler can return.">DBusHandlerResult</a>
<a name="l04497"></a>04497 _dbus_connection_run_builtin_filters_unlocked_no_update (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l04498"></a>04498                                                            <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>    *message)
<a name="l04499"></a>04499 {
<a name="l04500"></a>04500   <span class="comment">/* We just run one filter for now but have the option to run more</span>
<a name="l04501"></a>04501 <span class="comment">     if the spec calls for it in the future */</span>
<a name="l04502"></a>04502 
<a name="l04503"></a>04503   <span class="keywordflow">return</span> _dbus_connection_peer_filter_unlocked_no_update (connection, message);
<a name="l04504"></a>04504 }
<a name="l04505"></a>04505 
<a name="l04548"></a>04548 <a class="code" href="group__DBusConnection.html#gabf250a32ff740b2a8c99136e0142d8d2" title="Indicates the status of incoming data on a DBusConnection.">DBusDispatchStatus</a>
<a name="l04549"></a><a class="code" href="group__DBusConnection.html#ga66ba7df50d75f4bda6b6e942430b81c7">04549</a> <a class="code" href="group__DBusConnection.html#ga66ba7df50d75f4bda6b6e942430b81c7" title="Processes any incoming data.">dbus_connection_dispatch</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l04550"></a>04550 {
<a name="l04551"></a>04551   <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message;
<a name="l04552"></a>04552   <a class="code" href="structDBusList.html" title="A node in a linked list.">DBusList</a> *link, *filter_list_copy, *message_link;
<a name="l04553"></a>04553   <a class="code" href="group__DBusShared.html#ga8244b29230187624c24986c24edab1de" title="Results that a message handler can return.">DBusHandlerResult</a> result;
<a name="l04554"></a>04554   <a class="code" href="structDBusPendingCall.html" title="Implementation details of DBusPendingCall - all fields are private.">DBusPendingCall</a> *pending;
<a name="l04555"></a>04555   <a class="code" href="group__DBusTypes.html#gab18afa60e9b17b6e322735bda3d863d8" title="A 32-bit signed integer on all platforms.">dbus_int32_t</a> reply_serial;
<a name="l04556"></a>04556   <a class="code" href="group__DBusConnection.html#gabf250a32ff740b2a8c99136e0142d8d2" title="Indicates the status of incoming data on a DBusConnection.">DBusDispatchStatus</a> status;
<a name="l04557"></a>04557   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> found_object;
<a name="l04558"></a>04558 
<a name="l04559"></a>04559   _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__DBusConnection.html#ggabf250a32ff740b2a8c99136e0142d8d2acb9bb9daa90f520d5fc9e84de3c5f017" title="All currently available data has been processed.">DBUS_DISPATCH_COMPLETE</a>);
<a name="l04560"></a>04560 
<a name="l04561"></a>04561   _dbus_verbose (<span class="stringliteral">&quot;\n&quot;</span>);
<a name="l04562"></a>04562   
<a name="l04563"></a>04563   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l04564"></a>04564   status = _dbus_connection_get_dispatch_status_unlocked (connection);
<a name="l04565"></a>04565   <span class="keywordflow">if</span> (status != <a class="code" href="group__DBusConnection.html#ggabf250a32ff740b2a8c99136e0142d8d2adf8e8a594ab338cb9cf7855b19e37e93" title="There is more data to potentially convert to messages.">DBUS_DISPATCH_DATA_REMAINS</a>)
<a name="l04566"></a>04566     {
<a name="l04567"></a>04567       <span class="comment">/* unlocks and calls out to user code */</span>
<a name="l04568"></a>04568       _dbus_connection_update_dispatch_status_and_unlock (connection, status);
<a name="l04569"></a>04569       <span class="keywordflow">return</span> status;
<a name="l04570"></a>04570     }
<a name="l04571"></a>04571   
<a name="l04572"></a>04572   <span class="comment">/* We need to ref the connection since the callback could potentially</span>
<a name="l04573"></a>04573 <span class="comment">   * drop the last ref to it</span>
<a name="l04574"></a>04574 <span class="comment">   */</span>
<a name="l04575"></a>04575   <a class="code" href="group__DBusConnectionInternals.html#ga7151f75b5d2308ec80cfe893aba72aa1" title="Increments the reference count of a DBusConnection.">_dbus_connection_ref_unlocked</a> (connection);
<a name="l04576"></a>04576 
<a name="l04577"></a>04577   _dbus_connection_acquire_dispatch (connection);
<a name="l04578"></a>04578   HAVE_LOCK_CHECK (connection);
<a name="l04579"></a>04579 
<a name="l04580"></a>04580   message_link = _dbus_connection_pop_message_link_unlocked (connection);
<a name="l04581"></a>04581   <span class="keywordflow">if</span> (message_link == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l04582"></a>04582     {
<a name="l04583"></a>04583       <span class="comment">/* another thread dispatched our stuff */</span>
<a name="l04584"></a>04584 
<a name="l04585"></a>04585       _dbus_verbose (<span class="stringliteral">&quot;another thread dispatched message (during acquire_dispatch above)\n&quot;</span>);
<a name="l04586"></a>04586       
<a name="l04587"></a>04587       _dbus_connection_release_dispatch (connection);
<a name="l04588"></a>04588 
<a name="l04589"></a>04589       status = _dbus_connection_get_dispatch_status_unlocked (connection);
<a name="l04590"></a>04590 
<a name="l04591"></a>04591       _dbus_connection_update_dispatch_status_and_unlock (connection, status);
<a name="l04592"></a>04592       
<a name="l04593"></a>04593       <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="l04594"></a>04594       
<a name="l04595"></a>04595       <span class="keywordflow">return</span> status;
<a name="l04596"></a>04596     }
<a name="l04597"></a>04597 
<a name="l04598"></a>04598   message = message_link-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a>;
<a name="l04599"></a>04599 
<a name="l04600"></a>04600   _dbus_verbose (<span class="stringliteral">&quot; dispatching message %p (%s %s %s &#39;%s&#39;)\n&quot;</span>,
<a name="l04601"></a>04601                  message,
<a name="l04602"></a>04602                  <a class="code" href="group__DBusMessageInternals.html#ga75bcb613a291eb7e427f77f2f3635b8f" title="Utility function to convert a D-Bus message type into a machine-readable string (not translated)...">dbus_message_type_to_string</a> (<a class="code" href="group__DBusMessage.html#ga41cace31999105137772b6257ea540f9" title="Gets the type of a message.">dbus_message_get_type</a> (message)),
<a name="l04603"></a>04603                  <a class="code" href="group__DBusMessage.html#ga1ad192bd4538cae556121a71b4e09d42" title="Gets the interface this message is being sent to (for DBUS_MESSAGE_TYPE_METHOD_CALL) or being emitted...">dbus_message_get_interface</a> (message) ?
<a name="l04604"></a>04604                  <a class="code" href="group__DBusMessage.html#ga1ad192bd4538cae556121a71b4e09d42" title="Gets the interface this message is being sent to (for DBUS_MESSAGE_TYPE_METHOD_CALL) or being emitted...">dbus_message_get_interface</a> (message) :
<a name="l04605"></a>04605                  <span class="stringliteral">&quot;no interface&quot;</span>,
<a name="l04606"></a>04606                  <a class="code" href="group__DBusMessage.html#gaf5c6b705c53db07a5ae2c6b76f230cf9" title="Gets the interface member being invoked (DBUS_MESSAGE_TYPE_METHOD_CALL) or emitted (DBUS_MESSAGE_TYPE...">dbus_message_get_member</a> (message) ?
<a name="l04607"></a>04607                  <a class="code" href="group__DBusMessage.html#gaf5c6b705c53db07a5ae2c6b76f230cf9" title="Gets the interface member being invoked (DBUS_MESSAGE_TYPE_METHOD_CALL) or emitted (DBUS_MESSAGE_TYPE...">dbus_message_get_member</a> (message) :
<a name="l04608"></a>04608                  <span class="stringliteral">&quot;no member&quot;</span>,
<a name="l04609"></a>04609                  <a class="code" href="group__DBusMessage.html#gaed63e4c2baaa50d782e8ebb7643def19" title="Gets the type signature of the message, i.e.">dbus_message_get_signature</a> (message));
<a name="l04610"></a>04610 
<a name="l04611"></a>04611   result = <a class="code" href="group__DBusShared.html#gga8244b29230187624c24986c24edab1deacb84b64c92055f2585fe9c29f1e5df68" title="Message has not had any effect - see if other handlers want it.">DBUS_HANDLER_RESULT_NOT_YET_HANDLED</a>;
<a name="l04612"></a>04612   
<a name="l04613"></a>04613   <span class="comment">/* Pending call handling must be first, because if you do</span>
<a name="l04614"></a>04614 <span class="comment">   * dbus_connection_send_with_reply_and_block() or</span>
<a name="l04615"></a>04615 <span class="comment">   * dbus_pending_call_block() then no handlers/filters will be run on</span>
<a name="l04616"></a>04616 <span class="comment">   * the reply. We want consistent semantics in the case where we</span>
<a name="l04617"></a>04617 <span class="comment">   * dbus_connection_dispatch() the reply.</span>
<a name="l04618"></a>04618 <span class="comment">   */</span>
<a name="l04619"></a>04619   
<a name="l04620"></a>04620   reply_serial = <a class="code" href="group__DBusMessage.html#ga94c43b2b237d842a6b91da6f94818d47" title="Returns the serial that the message is a reply to or 0 if none.">dbus_message_get_reply_serial</a> (message);
<a name="l04621"></a>04621   pending = <a class="code" href="group__DBusHashTable.html#ga36ff49c4c35599e6fcdadc7f6805c49e" title="Looks up the value for a given integer in a hash table of type DBUS_HASH_INT.">_dbus_hash_table_lookup_int</a> (connection-&gt;<a class="code" href="structDBusConnection.html#ad8fa077f91fe62d0c10862e2ff9e86ca" title="Hash of message serials to DBusPendingCall.">pending_replies</a>,
<a name="l04622"></a>04622                                          reply_serial);
<a name="l04623"></a>04623   <span class="keywordflow">if</span> (pending)
<a name="l04624"></a>04624     {
<a name="l04625"></a>04625       _dbus_verbose (<span class="stringliteral">&quot;Dispatching a pending reply\n&quot;</span>);
<a name="l04626"></a>04626       complete_pending_call_and_unlock (connection, pending, message);
<a name="l04627"></a>04627       pending = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>; <span class="comment">/* it&#39;s probably unref&#39;d */</span>
<a name="l04628"></a>04628       
<a name="l04629"></a>04629       <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l04630"></a>04630       _dbus_verbose (<span class="stringliteral">&quot;pending call completed in dispatch\n&quot;</span>);
<a name="l04631"></a>04631       result = <a class="code" href="group__DBusShared.html#gga8244b29230187624c24986c24edab1deab6df40880a8f322694f14cd2804d3f76" title="Message has had its effect - no need to run more handlers.">DBUS_HANDLER_RESULT_HANDLED</a>;
<a name="l04632"></a>04632       <span class="keywordflow">goto</span> out;
<a name="l04633"></a>04633     }
<a name="l04634"></a>04634 
<a name="l04635"></a>04635   result = _dbus_connection_run_builtin_filters_unlocked_no_update (connection, message);
<a name="l04636"></a>04636   <span class="keywordflow">if</span> (result != <a class="code" href="group__DBusShared.html#gga8244b29230187624c24986c24edab1deacb84b64c92055f2585fe9c29f1e5df68" title="Message has not had any effect - see if other handlers want it.">DBUS_HANDLER_RESULT_NOT_YET_HANDLED</a>)
<a name="l04637"></a>04637     <span class="keywordflow">goto</span> out;
<a name="l04638"></a>04638  
<a name="l04639"></a>04639   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusList.html#ga1a85785891866750c9438bc10ad0350a" title="Copies a list.">_dbus_list_copy</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#a32d14cefcb4daea257544397755d45ed" title="List of filters.">filter_list</a>, &amp;filter_list_copy))
<a name="l04640"></a>04640     {
<a name="l04641"></a>04641       _dbus_connection_release_dispatch (connection);
<a name="l04642"></a>04642       HAVE_LOCK_CHECK (connection);
<a name="l04643"></a>04643       
<a name="l04644"></a>04644       _dbus_connection_failed_pop (connection, message_link);
<a name="l04645"></a>04645 
<a name="l04646"></a>04646       <span class="comment">/* unlocks and calls user code */</span>
<a name="l04647"></a>04647       _dbus_connection_update_dispatch_status_and_unlock (connection,
<a name="l04648"></a>04648                                                           <a class="code" href="group__DBusConnection.html#ggabf250a32ff740b2a8c99136e0142d8d2a5af20a035f29cfa67fb8d69fb693b685" title="More memory is needed to continue.">DBUS_DISPATCH_NEED_MEMORY</a>);
<a name="l04649"></a>04649       <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="l04650"></a>04650       
<a name="l04651"></a>04651       <span class="keywordflow">return</span> <a class="code" href="group__DBusConnection.html#ggabf250a32ff740b2a8c99136e0142d8d2a5af20a035f29cfa67fb8d69fb693b685" title="More memory is needed to continue.">DBUS_DISPATCH_NEED_MEMORY</a>;
<a name="l04652"></a>04652     }
<a name="l04653"></a>04653   
<a name="l04654"></a>04654   <a class="code" href="group__DBusList.html#ga8dd69084b53361803a765e6d53d5b9d1" title="Calls the given function for each element in the list.">_dbus_list_foreach</a> (&amp;filter_list_copy,
<a name="l04655"></a>04655                       (DBusForeachFunction)_dbus_message_filter_ref,
<a name="l04656"></a>04656                       <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l04657"></a>04657 
<a name="l04658"></a>04658   <span class="comment">/* We&#39;re still protected from dispatch() reentrancy here</span>
<a name="l04659"></a>04659 <span class="comment">   * since we acquired the dispatcher</span>
<a name="l04660"></a>04660 <span class="comment">   */</span>
<a name="l04661"></a>04661   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l04662"></a>04662   
<a name="l04663"></a>04663   link = <a class="code" href="group__DBusList.html#ga1e26ce4fb4acb50593bd5ed2f4eeb3ae" title="Gets the first link in the list.">_dbus_list_get_first_link</a> (&amp;filter_list_copy);
<a name="l04664"></a>04664   <span class="keywordflow">while</span> (link != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l04665"></a>04665     {
<a name="l04666"></a>04666       <a class="code" href="structDBusMessageFilter.html" title="Internal struct representing a message filter function.">DBusMessageFilter</a> *filter = link-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a>;
<a name="l04667"></a>04667       <a class="code" href="structDBusList.html" title="A node in a linked list.">DBusList</a> *next = <a class="code" href="group__DBusList.html#gaede4ace46d5ee497d75074bfec4490a2" title="Gets the next link in the list, or NULL if there are no more links.">_dbus_list_get_next_link</a> (&amp;filter_list_copy, link);
<a name="l04668"></a>04668 
<a name="l04669"></a>04669       <span class="keywordflow">if</span> (filter-&gt;<a class="code" href="structDBusMessageFilter.html#a56b3643122277ed5dc3d4f07793617fa" title="Function to call to filter.">function</a> == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l04670"></a>04670         {
<a name="l04671"></a>04671           _dbus_verbose (<span class="stringliteral">&quot;  filter was removed in a callback function\n&quot;</span>);
<a name="l04672"></a>04672           link = next;
<a name="l04673"></a>04673           <span class="keywordflow">continue</span>;
<a name="l04674"></a>04674         }
<a name="l04675"></a>04675 
<a name="l04676"></a>04676       _dbus_verbose (<span class="stringliteral">&quot;  running filter on message %p\n&quot;</span>, message);
<a name="l04677"></a>04677       result = (* filter-&gt;<a class="code" href="structDBusMessageFilter.html#a56b3643122277ed5dc3d4f07793617fa" title="Function to call to filter.">function</a>) (connection, message, filter-&gt;<a class="code" href="structDBusMessageFilter.html#a6cf5321325828e39da1cc8fa1b3d7153" title="User data for the function.">user_data</a>);
<a name="l04678"></a>04678 
<a name="l04679"></a>04679       <span class="keywordflow">if</span> (result != <a class="code" href="group__DBusShared.html#gga8244b29230187624c24986c24edab1deacb84b64c92055f2585fe9c29f1e5df68" title="Message has not had any effect - see if other handlers want it.">DBUS_HANDLER_RESULT_NOT_YET_HANDLED</a>)
<a name="l04680"></a>04680         <span class="keywordflow">break</span>;
<a name="l04681"></a>04681 
<a name="l04682"></a>04682       link = next;
<a name="l04683"></a>04683     }
<a name="l04684"></a>04684 
<a name="l04685"></a>04685   <a class="code" href="group__DBusList.html#ga8dd69084b53361803a765e6d53d5b9d1" title="Calls the given function for each element in the list.">_dbus_list_foreach</a> (&amp;filter_list_copy,
<a name="l04686"></a>04686                       (DBusForeachFunction)_dbus_message_filter_unref,
<a name="l04687"></a>04687                       <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l04688"></a>04688   <a class="code" href="group__DBusList.html#gaa36d13444a050a923941c53650b72f9d" title="Frees all links in the list and sets the list head to NULL.">_dbus_list_clear</a> (&amp;filter_list_copy);
<a name="l04689"></a>04689   
<a name="l04690"></a>04690   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l04691"></a>04691 
<a name="l04692"></a>04692   <span class="keywordflow">if</span> (result == <a class="code" href="group__DBusShared.html#gga8244b29230187624c24986c24edab1dea01f00ce4578559c7b14b91256bfede7d" title="Need more memory in order to return DBUS_HANDLER_RESULT_HANDLED or DBUS_HANDLER_RESULT_NOT_YET_HANDLE...">DBUS_HANDLER_RESULT_NEED_MEMORY</a>)
<a name="l04693"></a>04693     {
<a name="l04694"></a>04694       _dbus_verbose (<span class="stringliteral">&quot;No memory\n&quot;</span>);
<a name="l04695"></a>04695       <span class="keywordflow">goto</span> out;
<a name="l04696"></a>04696     }
<a name="l04697"></a>04697   <span class="keywordflow">else</span> <span class="keywordflow">if</span> (result == <a class="code" href="group__DBusShared.html#gga8244b29230187624c24986c24edab1deab6df40880a8f322694f14cd2804d3f76" title="Message has had its effect - no need to run more handlers.">DBUS_HANDLER_RESULT_HANDLED</a>)
<a name="l04698"></a>04698     {
<a name="l04699"></a>04699       _dbus_verbose (<span class="stringliteral">&quot;filter handled message in dispatch\n&quot;</span>);
<a name="l04700"></a>04700       <span class="keywordflow">goto</span> out;
<a name="l04701"></a>04701     }
<a name="l04702"></a>04702 
<a name="l04703"></a>04703   <span class="comment">/* We&#39;re still protected from dispatch() reentrancy here</span>
<a name="l04704"></a>04704 <span class="comment">   * since we acquired the dispatcher</span>
<a name="l04705"></a>04705 <span class="comment">   */</span>
<a name="l04706"></a>04706   _dbus_verbose (<span class="stringliteral">&quot;  running object path dispatch on message %p (%s %s %s &#39;%s&#39;)\n&quot;</span>,
<a name="l04707"></a>04707                  message,
<a name="l04708"></a>04708                  <a class="code" href="group__DBusMessageInternals.html#ga75bcb613a291eb7e427f77f2f3635b8f" title="Utility function to convert a D-Bus message type into a machine-readable string (not translated)...">dbus_message_type_to_string</a> (<a class="code" href="group__DBusMessage.html#ga41cace31999105137772b6257ea540f9" title="Gets the type of a message.">dbus_message_get_type</a> (message)),
<a name="l04709"></a>04709                  <a class="code" href="group__DBusMessage.html#ga1ad192bd4538cae556121a71b4e09d42" title="Gets the interface this message is being sent to (for DBUS_MESSAGE_TYPE_METHOD_CALL) or being emitted...">dbus_message_get_interface</a> (message) ?
<a name="l04710"></a>04710                  <a class="code" href="group__DBusMessage.html#ga1ad192bd4538cae556121a71b4e09d42" title="Gets the interface this message is being sent to (for DBUS_MESSAGE_TYPE_METHOD_CALL) or being emitted...">dbus_message_get_interface</a> (message) :
<a name="l04711"></a>04711                  <span class="stringliteral">&quot;no interface&quot;</span>,
<a name="l04712"></a>04712                  <a class="code" href="group__DBusMessage.html#gaf5c6b705c53db07a5ae2c6b76f230cf9" title="Gets the interface member being invoked (DBUS_MESSAGE_TYPE_METHOD_CALL) or emitted (DBUS_MESSAGE_TYPE...">dbus_message_get_member</a> (message) ?
<a name="l04713"></a>04713                  <a class="code" href="group__DBusMessage.html#gaf5c6b705c53db07a5ae2c6b76f230cf9" title="Gets the interface member being invoked (DBUS_MESSAGE_TYPE_METHOD_CALL) or emitted (DBUS_MESSAGE_TYPE...">dbus_message_get_member</a> (message) :
<a name="l04714"></a>04714                  <span class="stringliteral">&quot;no member&quot;</span>,
<a name="l04715"></a>04715                  <a class="code" href="group__DBusMessage.html#gaed63e4c2baaa50d782e8ebb7643def19" title="Gets the type signature of the message, i.e.">dbus_message_get_signature</a> (message));
<a name="l04716"></a>04716 
<a name="l04717"></a>04717   HAVE_LOCK_CHECK (connection);
<a name="l04718"></a>04718   result = <a class="code" href="group__DBusObjectTree.html#gad660d78a12fa207d891838863dfc6ba7" title="Tries to dispatch a message by directing it to handler for the object path listed in the message head...">_dbus_object_tree_dispatch_and_unlock</a> (connection-&gt;<a class="code" href="structDBusConnection.html#acd289771721a459f4f9cdeaca0fa87c2" title="Object path handlers registered with this connection.">objects</a>,
<a name="l04719"></a>04719                                                   message,
<a name="l04720"></a>04720                                                   &amp;found_object);
<a name="l04721"></a>04721   
<a name="l04722"></a>04722   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l04723"></a>04723 
<a name="l04724"></a>04724   <span class="keywordflow">if</span> (result != <a class="code" href="group__DBusShared.html#gga8244b29230187624c24986c24edab1deacb84b64c92055f2585fe9c29f1e5df68" title="Message has not had any effect - see if other handlers want it.">DBUS_HANDLER_RESULT_NOT_YET_HANDLED</a>)
<a name="l04725"></a>04725     {
<a name="l04726"></a>04726       _dbus_verbose (<span class="stringliteral">&quot;object tree handled message in dispatch\n&quot;</span>);
<a name="l04727"></a>04727       <span class="keywordflow">goto</span> out;
<a name="l04728"></a>04728     }
<a name="l04729"></a>04729 
<a name="l04730"></a>04730   <span class="keywordflow">if</span> (<a class="code" href="group__DBusMessage.html#ga41cace31999105137772b6257ea540f9" title="Gets the type of a message.">dbus_message_get_type</a> (message) == <a class="code" href="group__DBusProtocol.html#ga09416afd76b65139eddd31e1085d9ebf" title="Message type of a method call message, see dbus_message_get_type()">DBUS_MESSAGE_TYPE_METHOD_CALL</a>)
<a name="l04731"></a>04731     {
<a name="l04732"></a>04732       <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *reply;
<a name="l04733"></a>04733       <a class="code" href="structDBusString.html">DBusString</a> str;
<a name="l04734"></a>04734       <a class="code" href="structDBusPreallocatedSend.html" title="Internals of DBusPreallocatedSend.">DBusPreallocatedSend</a> *preallocated;
<a name="l04735"></a>04735       <a class="code" href="structDBusList.html" title="A node in a linked list.">DBusList</a> *expire_link;
<a name="l04736"></a>04736 
<a name="l04737"></a>04737       _dbus_verbose (<span class="stringliteral">&quot;  sending error %s\n&quot;</span>,
<a name="l04738"></a>04738                      <a class="code" href="group__DBusProtocol.html#ga46c7cbfa1806b0cccb56e9a7ca92f02b" title="Method name you invoked isn&#39;t known by the object you invoked it on.">DBUS_ERROR_UNKNOWN_METHOD</a>);
<a name="l04739"></a>04739 
<a name="l04740"></a>04740       <span class="keywordflow">if</span> (!<a class="code" href="group__DBusString.html#ga348252317f7bb8ac43529972945830ae" title="Initializes a string.">_dbus_string_init</a> (&amp;str))
<a name="l04741"></a>04741         {
<a name="l04742"></a>04742           result = <a class="code" href="group__DBusShared.html#gga8244b29230187624c24986c24edab1dea01f00ce4578559c7b14b91256bfede7d" title="Need more memory in order to return DBUS_HANDLER_RESULT_HANDLED or DBUS_HANDLER_RESULT_NOT_YET_HANDLE...">DBUS_HANDLER_RESULT_NEED_MEMORY</a>;
<a name="l04743"></a>04743           _dbus_verbose (<span class="stringliteral">&quot;no memory for error string in dispatch\n&quot;</span>);
<a name="l04744"></a>04744           <span class="keywordflow">goto</span> out;
<a name="l04745"></a>04745         }
<a name="l04746"></a>04746               
<a name="l04747"></a>04747       <span class="keywordflow">if</span> (!<a class="code" href="group__DBusString.html#gab0078cf7e0e5bd784ec6d6e0cc3923a2" title="Appends a printf-style formatted string to the DBusString.">_dbus_string_append_printf</a> (&amp;str,
<a name="l04748"></a>04748                                        <span class="stringliteral">&quot;Method \&quot;%s\&quot; with signature \&quot;%s\&quot; on interface \&quot;%s\&quot; doesn&#39;t exist\n&quot;</span>,
<a name="l04749"></a>04749                                        <a class="code" href="group__DBusMessage.html#gaf5c6b705c53db07a5ae2c6b76f230cf9" title="Gets the interface member being invoked (DBUS_MESSAGE_TYPE_METHOD_CALL) or emitted (DBUS_MESSAGE_TYPE...">dbus_message_get_member</a> (message),
<a name="l04750"></a>04750                                        <a class="code" href="group__DBusMessage.html#gaed63e4c2baaa50d782e8ebb7643def19" title="Gets the type signature of the message, i.e.">dbus_message_get_signature</a> (message),
<a name="l04751"></a>04751                                        <a class="code" href="group__DBusMessage.html#ga1ad192bd4538cae556121a71b4e09d42" title="Gets the interface this message is being sent to (for DBUS_MESSAGE_TYPE_METHOD_CALL) or being emitted...">dbus_message_get_interface</a> (message)))
<a name="l04752"></a>04752         {
<a name="l04753"></a>04753           <a class="code" href="group__DBusString.html#ga781ca91acda49a834dce7d0ed0eef212" title="Frees a string created by _dbus_string_init().">_dbus_string_free</a> (&amp;str);
<a name="l04754"></a>04754           result = <a class="code" href="group__DBusShared.html#gga8244b29230187624c24986c24edab1dea01f00ce4578559c7b14b91256bfede7d" title="Need more memory in order to return DBUS_HANDLER_RESULT_HANDLED or DBUS_HANDLER_RESULT_NOT_YET_HANDLE...">DBUS_HANDLER_RESULT_NEED_MEMORY</a>;
<a name="l04755"></a>04755           _dbus_verbose (<span class="stringliteral">&quot;no memory for error string in dispatch\n&quot;</span>);
<a name="l04756"></a>04756           <span class="keywordflow">goto</span> out;
<a name="l04757"></a>04757         }
<a name="l04758"></a>04758       
<a name="l04759"></a>04759       reply = <a class="code" href="group__DBusMessage.html#ga2ab896965aec97fb21293affeed36232" title="Creates a new message that is an error reply to another message.">dbus_message_new_error</a> (message,
<a name="l04760"></a>04760                                       found_object ? <a class="code" href="group__DBusProtocol.html#ga46c7cbfa1806b0cccb56e9a7ca92f02b" title="Method name you invoked isn&#39;t known by the object you invoked it on.">DBUS_ERROR_UNKNOWN_METHOD</a> : <a class="code" href="group__DBusProtocol.html#gaa31b8b1f9226530bb41ff1b01a836f6a" title="Object you invoked a method on isn&#39;t known.">DBUS_ERROR_UNKNOWN_OBJECT</a>,
<a name="l04761"></a>04761                                       <a class="code" href="group__DBusString.html#ga33e20241ae7d784624f97d89b1a0539e" title="Gets the raw character buffer from a const string.">_dbus_string_get_const_data</a> (&amp;str));
<a name="l04762"></a>04762       <a class="code" href="group__DBusString.html#ga781ca91acda49a834dce7d0ed0eef212" title="Frees a string created by _dbus_string_init().">_dbus_string_free</a> (&amp;str);
<a name="l04763"></a>04763 
<a name="l04764"></a>04764       <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="l04765"></a>04765         {
<a name="l04766"></a>04766           result = <a class="code" href="group__DBusShared.html#gga8244b29230187624c24986c24edab1dea01f00ce4578559c7b14b91256bfede7d" title="Need more memory in order to return DBUS_HANDLER_RESULT_HANDLED or DBUS_HANDLER_RESULT_NOT_YET_HANDLE...">DBUS_HANDLER_RESULT_NEED_MEMORY</a>;
<a name="l04767"></a>04767           _dbus_verbose (<span class="stringliteral">&quot;no memory for error reply in dispatch\n&quot;</span>);
<a name="l04768"></a>04768           <span class="keywordflow">goto</span> out;
<a name="l04769"></a>04769         }
<a name="l04770"></a>04770 
<a name="l04771"></a>04771       expire_link = <a class="code" href="group__DBusList.html#gac20b9981531cef590d49a59240344cd8" title="Allocates a linked list node.">_dbus_list_alloc_link</a> (reply);
<a name="l04772"></a>04772 
<a name="l04773"></a>04773       <span class="keywordflow">if</span> (expire_link == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l04774"></a>04774         {
<a name="l04775"></a>04775           <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="l04776"></a>04776           result = <a class="code" href="group__DBusShared.html#gga8244b29230187624c24986c24edab1dea01f00ce4578559c7b14b91256bfede7d" title="Need more memory in order to return DBUS_HANDLER_RESULT_HANDLED or DBUS_HANDLER_RESULT_NOT_YET_HANDLE...">DBUS_HANDLER_RESULT_NEED_MEMORY</a>;
<a name="l04777"></a>04777           _dbus_verbose (<span class="stringliteral">&quot;no memory for error send in dispatch\n&quot;</span>);
<a name="l04778"></a>04778           <span class="keywordflow">goto</span> out;
<a name="l04779"></a>04779         }
<a name="l04780"></a>04780 
<a name="l04781"></a>04781       preallocated = _dbus_connection_preallocate_send_unlocked (connection);
<a name="l04782"></a>04782 
<a name="l04783"></a>04783       <span class="keywordflow">if</span> (preallocated == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l04784"></a>04784         {
<a name="l04785"></a>04785           <a class="code" href="group__DBusList.html#ga6e824f717125ce40c549d5402e32610f" title="Frees a linked list node allocated with _dbus_list_alloc_link.">_dbus_list_free_link</a> (expire_link);
<a name="l04786"></a>04786           <span class="comment">/* It&#39;s OK that this is finalized, because it hasn&#39;t been seen by</span>
<a name="l04787"></a>04787 <span class="comment">           * anything that could attach user callbacks */</span>
<a name="l04788"></a>04788           <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="l04789"></a>04789           result = <a class="code" href="group__DBusShared.html#gga8244b29230187624c24986c24edab1dea01f00ce4578559c7b14b91256bfede7d" title="Need more memory in order to return DBUS_HANDLER_RESULT_HANDLED or DBUS_HANDLER_RESULT_NOT_YET_HANDLE...">DBUS_HANDLER_RESULT_NEED_MEMORY</a>;
<a name="l04790"></a>04790           _dbus_verbose (<span class="stringliteral">&quot;no memory for error send in dispatch\n&quot;</span>);
<a name="l04791"></a>04791           <span class="keywordflow">goto</span> out;
<a name="l04792"></a>04792         }
<a name="l04793"></a>04793 
<a name="l04794"></a>04794       _dbus_connection_send_preallocated_unlocked_no_update (connection, preallocated,
<a name="l04795"></a>04795                                                              reply, <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l04796"></a>04796       <span class="comment">/* reply will be freed when we release the lock */</span>
<a name="l04797"></a>04797       <a class="code" href="group__DBusList.html#gab3dd068e3bd8a319c0d12150785050a7" title="Prepends a link to the list.">_dbus_list_prepend_link</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#afc069c0dc7f29123d432650580aec036" title="Messages that will be released when we next unlock.">expired_messages</a>, expire_link);
<a name="l04798"></a>04798 
<a name="l04799"></a>04799       result = <a class="code" href="group__DBusShared.html#gga8244b29230187624c24986c24edab1deab6df40880a8f322694f14cd2804d3f76" title="Message has had its effect - no need to run more handlers.">DBUS_HANDLER_RESULT_HANDLED</a>;
<a name="l04800"></a>04800     }
<a name="l04801"></a>04801   
<a name="l04802"></a>04802   _dbus_verbose (<span class="stringliteral">&quot;  done dispatching %p (%s %s %s &#39;%s&#39;) on connection %p\n&quot;</span>, message,
<a name="l04803"></a>04803                  <a class="code" href="group__DBusMessageInternals.html#ga75bcb613a291eb7e427f77f2f3635b8f" title="Utility function to convert a D-Bus message type into a machine-readable string (not translated)...">dbus_message_type_to_string</a> (<a class="code" href="group__DBusMessage.html#ga41cace31999105137772b6257ea540f9" title="Gets the type of a message.">dbus_message_get_type</a> (message)),
<a name="l04804"></a>04804                  <a class="code" href="group__DBusMessage.html#ga1ad192bd4538cae556121a71b4e09d42" title="Gets the interface this message is being sent to (for DBUS_MESSAGE_TYPE_METHOD_CALL) or being emitted...">dbus_message_get_interface</a> (message) ?
<a name="l04805"></a>04805                  <a class="code" href="group__DBusMessage.html#ga1ad192bd4538cae556121a71b4e09d42" title="Gets the interface this message is being sent to (for DBUS_MESSAGE_TYPE_METHOD_CALL) or being emitted...">dbus_message_get_interface</a> (message) :
<a name="l04806"></a>04806                  <span class="stringliteral">&quot;no interface&quot;</span>,
<a name="l04807"></a>04807                  <a class="code" href="group__DBusMessage.html#gaf5c6b705c53db07a5ae2c6b76f230cf9" title="Gets the interface member being invoked (DBUS_MESSAGE_TYPE_METHOD_CALL) or emitted (DBUS_MESSAGE_TYPE...">dbus_message_get_member</a> (message) ?
<a name="l04808"></a>04808                  <a class="code" href="group__DBusMessage.html#gaf5c6b705c53db07a5ae2c6b76f230cf9" title="Gets the interface member being invoked (DBUS_MESSAGE_TYPE_METHOD_CALL) or emitted (DBUS_MESSAGE_TYPE...">dbus_message_get_member</a> (message) :
<a name="l04809"></a>04809                  <span class="stringliteral">&quot;no member&quot;</span>,
<a name="l04810"></a>04810                  <a class="code" href="group__DBusMessage.html#gaed63e4c2baaa50d782e8ebb7643def19" title="Gets the type signature of the message, i.e.">dbus_message_get_signature</a> (message),
<a name="l04811"></a>04811                  connection);
<a name="l04812"></a>04812   
<a name="l04813"></a>04813  out:
<a name="l04814"></a>04814   <span class="keywordflow">if</span> (result == <a class="code" href="group__DBusShared.html#gga8244b29230187624c24986c24edab1dea01f00ce4578559c7b14b91256bfede7d" title="Need more memory in order to return DBUS_HANDLER_RESULT_HANDLED or DBUS_HANDLER_RESULT_NOT_YET_HANDLE...">DBUS_HANDLER_RESULT_NEED_MEMORY</a>)
<a name="l04815"></a>04815     {
<a name="l04816"></a>04816       _dbus_verbose (<span class="stringliteral">&quot;out of memory\n&quot;</span>);
<a name="l04817"></a>04817       
<a name="l04818"></a>04818       <span class="comment">/* Put message back, and we&#39;ll start over.</span>
<a name="l04819"></a>04819 <span class="comment">       * Yes this means handlers must be idempotent if they</span>
<a name="l04820"></a>04820 <span class="comment">       * don&#39;t return HANDLED; c&#39;est la vie.</span>
<a name="l04821"></a>04821 <span class="comment">       */</span>
<a name="l04822"></a>04822       _dbus_connection_putback_message_link_unlocked (connection,
<a name="l04823"></a>04823                                                       message_link);
<a name="l04824"></a>04824       <span class="comment">/* now we don&#39;t want to free them */</span>
<a name="l04825"></a>04825       message_link = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l04826"></a>04826       message = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l04827"></a>04827     }
<a name="l04828"></a>04828   <span class="keywordflow">else</span>
<a name="l04829"></a>04829     {
<a name="l04830"></a>04830       _dbus_verbose (<span class="stringliteral">&quot; ... done dispatching\n&quot;</span>);
<a name="l04831"></a>04831     }
<a name="l04832"></a>04832 
<a name="l04833"></a>04833   _dbus_connection_release_dispatch (connection);
<a name="l04834"></a>04834   HAVE_LOCK_CHECK (connection);
<a name="l04835"></a>04835 
<a name="l04836"></a>04836   <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="l04837"></a>04837     {
<a name="l04838"></a>04838       <span class="comment">/* We don&#39;t want this message to count in maximum message limits when</span>
<a name="l04839"></a>04839 <span class="comment">       * computing the dispatch status, below. We have to drop the lock</span>
<a name="l04840"></a>04840 <span class="comment">       * temporarily, because finalizing a message can trigger callbacks.</span>
<a name="l04841"></a>04841 <span class="comment">       *</span>
<a name="l04842"></a>04842 <span class="comment">       * We have a reference to the connection, and we don&#39;t use any cached</span>
<a name="l04843"></a>04843 <span class="comment">       * pointers to the connection&#39;s internals below this point, so it should</span>
<a name="l04844"></a>04844 <span class="comment">       * be safe to drop the lock and take it back. */</span>
<a name="l04845"></a>04845       <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l04846"></a>04846       <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="l04847"></a>04847       <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l04848"></a>04848     }
<a name="l04849"></a>04849 
<a name="l04850"></a>04850   <span class="keywordflow">if</span> (message_link != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l04851"></a>04851     <a class="code" href="group__DBusList.html#ga6e824f717125ce40c549d5402e32610f" title="Frees a linked list node allocated with _dbus_list_alloc_link.">_dbus_list_free_link</a> (message_link);
<a name="l04852"></a>04852 
<a name="l04853"></a>04853   _dbus_verbose (<span class="stringliteral">&quot;before final status update\n&quot;</span>);
<a name="l04854"></a>04854   status = _dbus_connection_get_dispatch_status_unlocked (connection);
<a name="l04855"></a>04855 
<a name="l04856"></a>04856   <span class="comment">/* unlocks and calls user code */</span>
<a name="l04857"></a>04857   _dbus_connection_update_dispatch_status_and_unlock (connection, status);
<a name="l04858"></a>04858   
<a name="l04859"></a>04859   <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="l04860"></a>04860   
<a name="l04861"></a>04861   <span class="keywordflow">return</span> status;
<a name="l04862"></a>04862 }
<a name="l04863"></a>04863 
<a name="l04925"></a>04925 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l04926"></a><a class="code" href="group__DBusConnection.html#gaebf031eb444b4f847606aa27daa3d8e6">04926</a> <a class="code" href="group__DBusConnection.html#gaebf031eb444b4f847606aa27daa3d8e6" title="Sets the watch functions for the connection.">dbus_connection_set_watch_functions</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>              *connection,
<a name="l04927"></a>04927                                      <a class="code" href="group__DBusConnection.html#ga9188ca3fd89c957dc269dbe8601b270e" title="Called when libdbus needs a new watch to be monitored by the main loop.">DBusAddWatchFunction</a>         add_function,
<a name="l04928"></a>04928                                      <a class="code" href="group__DBusConnection.html#gaaab846a872d938b27503129551ea0c62" title="Called when libdbus no longer needs a watch to be monitored by the main loop.">DBusRemoveWatchFunction</a>      remove_function,
<a name="l04929"></a>04929                                      <a class="code" href="group__DBusConnection.html#gace13544ff3075b5fccbce896682ec6ff" title="Called when dbus_watch_get_enabled() may return a different value than it did before.">DBusWatchToggledFunction</a>     toggled_function,
<a name="l04930"></a>04930                                      <span class="keywordtype">void</span>                        *data,
<a name="l04931"></a>04931                                      <a class="code" href="group__DBusMemory.html#ga061bcded226d76c7d7de35beaa165cb5" title="The type of a function which frees a block of memory.">DBusFreeFunction</a>             free_data_function)
<a name="l04932"></a>04932 {
<a name="l04933"></a>04933   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> retval;
<a name="l04934"></a>04934 
<a name="l04935"></a>04935   _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="l04936"></a>04936   
<a name="l04937"></a>04937   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l04938"></a>04938 
<a name="l04939"></a>04939   retval = <a class="code" href="group__DBusWatchInternals.html#gae9ab8cf14f4191191e94183be9a031d9" title="Sets the watch functions.">_dbus_watch_list_set_functions</a> (connection-&gt;<a class="code" href="structDBusConnection.html#abdb6a32972d924531fb2cd80c7fd6d37" title="Stores active watches.">watches</a>,
<a name="l04940"></a>04940                                            add_function, remove_function,
<a name="l04941"></a>04941                                            toggled_function,
<a name="l04942"></a>04942                                            data, free_data_function);
<a name="l04943"></a>04943 
<a name="l04944"></a>04944   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l04945"></a>04945 
<a name="l04946"></a>04946   <span class="keywordflow">return</span> retval;
<a name="l04947"></a>04947 }
<a name="l04948"></a>04948 
<a name="l04988"></a>04988 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l04989"></a><a class="code" href="group__DBusConnection.html#gab3cbc68eec427e9ce1783b25d44fe93c">04989</a> <a class="code" href="group__DBusConnection.html#gab3cbc68eec427e9ce1783b25d44fe93c" title="Sets the timeout functions for the connection.">dbus_connection_set_timeout_functions</a>   (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>            *connection,
<a name="l04990"></a>04990                                          <a class="code" href="group__DBusConnection.html#ga01a45587090d82ee97b5042b49037a08" title="Called when libdbus needs a new timeout to be monitored by the main loop.">DBusAddTimeoutFunction</a>     add_function,
<a name="l04991"></a>04991                                          <a class="code" href="group__DBusConnection.html#ga13aae9d5981de45abca0db1717dc7daf" title="Called when libdbus no longer needs a timeout to be monitored by the main loop.">DBusRemoveTimeoutFunction</a>  remove_function,
<a name="l04992"></a>04992                                          <a class="code" href="group__DBusConnection.html#ga62eea9a2032ae15b6738534b93d18e86" title="Called when dbus_timeout_get_enabled() may return a different value than it did before.">DBusTimeoutToggledFunction</a> toggled_function,
<a name="l04993"></a>04993                                          <span class="keywordtype">void</span>                      *data,
<a name="l04994"></a>04994                                          <a class="code" href="group__DBusMemory.html#ga061bcded226d76c7d7de35beaa165cb5" title="The type of a function which frees a block of memory.">DBusFreeFunction</a>           free_data_function)
<a name="l04995"></a>04995 {
<a name="l04996"></a>04996   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> retval;
<a name="l04997"></a>04997 
<a name="l04998"></a>04998   _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="l04999"></a>04999   
<a name="l05000"></a>05000   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l05001"></a>05001 
<a name="l05002"></a>05002   retval = <a class="code" href="group__DBusTimeoutInternals.html#ga6760d1963b870b45f855501e38b49fd9" title="Sets the timeout functions.">_dbus_timeout_list_set_functions</a> (connection-&gt;<a class="code" href="structDBusConnection.html#af3936ac5c968f2ac09bf05cf36025994" title="Stores active timeouts.">timeouts</a>,
<a name="l05003"></a>05003                                              add_function, remove_function,
<a name="l05004"></a>05004                                              toggled_function,
<a name="l05005"></a>05005                                              data, free_data_function);
<a name="l05006"></a>05006 
<a name="l05007"></a>05007   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l05008"></a>05008 
<a name="l05009"></a>05009   <span class="keywordflow">return</span> retval;
<a name="l05010"></a>05010 }
<a name="l05011"></a>05011 
<a name="l05026"></a>05026 <span class="keywordtype">void</span>
<a name="l05027"></a><a class="code" href="group__DBusConnection.html#ga2b1df13251c7ec348bcba39c0924e881">05027</a> <a class="code" href="group__DBusConnection.html#ga2b1df13251c7ec348bcba39c0924e881" title="Sets the mainloop wakeup function for the connection.">dbus_connection_set_wakeup_main_function</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>            *connection,
<a name="l05028"></a>05028                                           <a class="code" href="group__DBusConnection.html#ga4bea703ee5b9f8dfe79c4082c347d43d" title="Called when the main loop&#39;s thread should be notified that there&#39;s now work to do.">DBusWakeupMainFunction</a>     wakeup_main_function,
<a name="l05029"></a>05029                                           <span class="keywordtype">void</span>                      *data,
<a name="l05030"></a>05030                                           <a class="code" href="group__DBusMemory.html#ga061bcded226d76c7d7de35beaa165cb5" title="The type of a function which frees a block of memory.">DBusFreeFunction</a>           free_data_function)
<a name="l05031"></a>05031 {
<a name="l05032"></a>05032   <span class="keywordtype">void</span> *old_data;
<a name="l05033"></a>05033   <a class="code" href="group__DBusMemory.html#ga061bcded226d76c7d7de35beaa165cb5" title="The type of a function which frees a block of memory.">DBusFreeFunction</a> old_free_data;
<a name="l05034"></a>05034 
<a name="l05035"></a>05035   _dbus_return_if_fail (connection != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l05036"></a>05036   
<a name="l05037"></a>05037   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l05038"></a>05038   old_data = connection-&gt;<a class="code" href="structDBusConnection.html#ac8aff7bafd9ed046d835c5ed80bc218c" title="Application data for wakeup_main_function.">wakeup_main_data</a>;
<a name="l05039"></a>05039   old_free_data = connection-&gt;<a class="code" href="structDBusConnection.html#a8da896126df262503431acd73638c917" title="free wakeup_main_data">free_wakeup_main_data</a>;
<a name="l05040"></a>05040 
<a name="l05041"></a>05041   connection-&gt;<a class="code" href="structDBusConnection.html#a211104e37f65d45ab8fcb149e4bcc84e" title="Function to wake up the mainloop.">wakeup_main_function</a> = wakeup_main_function;
<a name="l05042"></a>05042   connection-&gt;<a class="code" href="structDBusConnection.html#ac8aff7bafd9ed046d835c5ed80bc218c" title="Application data for wakeup_main_function.">wakeup_main_data</a> = data;
<a name="l05043"></a>05043   connection-&gt;<a class="code" href="structDBusConnection.html#a8da896126df262503431acd73638c917" title="free wakeup_main_data">free_wakeup_main_data</a> = free_data_function;
<a name="l05044"></a>05044   
<a name="l05045"></a>05045   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l05046"></a>05046 
<a name="l05047"></a>05047   <span class="comment">/* Callback outside the lock */</span>
<a name="l05048"></a>05048   <span class="keywordflow">if</span> (old_free_data)
<a name="l05049"></a>05049     (*old_free_data) (old_data);
<a name="l05050"></a>05050 }
<a name="l05051"></a>05051 
<a name="l05072"></a>05072 <span class="keywordtype">void</span>
<a name="l05073"></a><a class="code" href="group__DBusConnection.html#ga55ff88cd22c0672441c7deffbfb68fbf">05073</a> <a class="code" href="group__DBusConnection.html#ga55ff88cd22c0672441c7deffbfb68fbf" title="Set a function to be invoked when the dispatch status changes.">dbus_connection_set_dispatch_status_function</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>             *connection,
<a name="l05074"></a>05074                                               <a class="code" href="group__DBusConnection.html#gaad6e12a5d298ef30a99d8c667abad58a" title="Called when the return value of dbus_connection_get_dispatch_status() may have changed.">DBusDispatchStatusFunction</a>  <span class="keyword">function</span>,
<a name="l05075"></a>05075                                               <span class="keywordtype">void</span>                       *data,
<a name="l05076"></a>05076                                               <a class="code" href="group__DBusMemory.html#ga061bcded226d76c7d7de35beaa165cb5" title="The type of a function which frees a block of memory.">DBusFreeFunction</a>            free_data_function)
<a name="l05077"></a>05077 {
<a name="l05078"></a>05078   <span class="keywordtype">void</span> *old_data;
<a name="l05079"></a>05079   <a class="code" href="group__DBusMemory.html#ga061bcded226d76c7d7de35beaa165cb5" title="The type of a function which frees a block of memory.">DBusFreeFunction</a> old_free_data;
<a name="l05080"></a>05080 
<a name="l05081"></a>05081   _dbus_return_if_fail (connection != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l05082"></a>05082   
<a name="l05083"></a>05083   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l05084"></a>05084   old_data = connection-&gt;<a class="code" href="structDBusConnection.html#a0225f7934d1bd118ae2eeacf8a1c6f19" title="Application data for dispatch_status_function.">dispatch_status_data</a>;
<a name="l05085"></a>05085   old_free_data = connection-&gt;<a class="code" href="structDBusConnection.html#a71f8b1e2078c4edb98c62de1886dfb2a" title="free dispatch_status_data">free_dispatch_status_data</a>;
<a name="l05086"></a>05086 
<a name="l05087"></a>05087   connection-&gt;<a class="code" href="structDBusConnection.html#af6cbafdf80cd474c654fc226581900a2" title="Function on dispatch status changes.">dispatch_status_function</a> = <span class="keyword">function</span>;
<a name="l05088"></a>05088   connection-&gt;<a class="code" href="structDBusConnection.html#a0225f7934d1bd118ae2eeacf8a1c6f19" title="Application data for dispatch_status_function.">dispatch_status_data</a> = data;
<a name="l05089"></a>05089   connection-&gt;<a class="code" href="structDBusConnection.html#a71f8b1e2078c4edb98c62de1886dfb2a" title="free dispatch_status_data">free_dispatch_status_data</a> = free_data_function;
<a name="l05090"></a>05090   
<a name="l05091"></a>05091   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l05092"></a>05092 
<a name="l05093"></a>05093   <span class="comment">/* Callback outside the lock */</span>
<a name="l05094"></a>05094   <span class="keywordflow">if</span> (old_free_data)
<a name="l05095"></a>05095     (*old_free_data) (old_data);
<a name="l05096"></a>05096 }
<a name="l05097"></a>05097 
<a name="l05117"></a>05117 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l05118"></a><a class="code" href="group__DBusConnection.html#ga38297f511f4124accdfa68c321e081cc">05118</a> <a class="code" href="group__DBusConnection.html#ga38297f511f4124accdfa68c321e081cc" title="Get the UNIX file descriptor of the connection, if any.">dbus_connection_get_unix_fd</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l05119"></a>05119                              <span class="keywordtype">int</span>            *fd)
<a name="l05120"></a>05120 {
<a name="l05121"></a>05121   _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="l05122"></a>05122   _dbus_return_val_if_fail (connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</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#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l05123"></a>05123 
<a name="l05124"></a>05124 <span class="preprocessor">#ifdef DBUS_WIN</span>
<a name="l05125"></a>05125 <span class="preprocessor"></span>  <span class="comment">/* FIXME do this on a lower level */</span>
<a name="l05126"></a>05126   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l05127"></a>05127 <span class="preprocessor">#endif</span>
<a name="l05128"></a>05128 <span class="preprocessor"></span>  
<a name="l05129"></a>05129   <span class="keywordflow">return</span> <a class="code" href="group__DBusConnection.html#ga1c14590d77b148390bde9e82a7544434" title="Gets the underlying Windows or UNIX socket file descriptor of the connection, if any.">dbus_connection_get_socket</a>(connection, fd);
<a name="l05130"></a>05130 }
<a name="l05131"></a>05131 
<a name="l05147"></a>05147 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l05148"></a><a class="code" href="group__DBusConnection.html#ga1c14590d77b148390bde9e82a7544434">05148</a> <a class="code" href="group__DBusConnection.html#ga1c14590d77b148390bde9e82a7544434" title="Gets the underlying Windows or UNIX socket file descriptor of the connection, if any.">dbus_connection_get_socket</a>(<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>              *connection,
<a name="l05149"></a>05149                            <span class="keywordtype">int</span>                         *fd)
<a name="l05150"></a>05150 {
<a name="l05151"></a>05151   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> retval;
<a name="l05152"></a>05152 
<a name="l05153"></a>05153   _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="l05154"></a>05154   _dbus_return_val_if_fail (connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</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#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l05155"></a>05155   
<a name="l05156"></a>05156   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l05157"></a>05157   
<a name="l05158"></a>05158   retval = <a class="code" href="group__DBusTransport.html#gac58d38eb19b39774f89271fc6472e087" title="Get the socket file descriptor, if any.">_dbus_transport_get_socket_fd</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>,
<a name="l05159"></a>05159                                           fd);
<a name="l05160"></a>05160 
<a name="l05161"></a>05161   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l05162"></a>05162 
<a name="l05163"></a>05163   <span class="keywordflow">return</span> retval;
<a name="l05164"></a>05164 }
<a name="l05165"></a>05165 
<a name="l05166"></a>05166 
<a name="l05189"></a>05189 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l05190"></a><a class="code" href="group__DBusConnection.html#gaef670c3a8170ab9c719ec955252459d0">05190</a> <a class="code" href="group__DBusConnection.html#gaef670c3a8170ab9c719ec955252459d0" title="Gets the UNIX user ID of the connection if known.">dbus_connection_get_unix_user</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l05191"></a>05191                                <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>  *uid)
<a name="l05192"></a>05192 {
<a name="l05193"></a>05193   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> result;
<a name="l05194"></a>05194 
<a name="l05195"></a>05195   _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="l05196"></a>05196   _dbus_return_val_if_fail (uid != <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="l05197"></a>05197 
<a name="l05198"></a>05198   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l05199"></a>05199 
<a name="l05200"></a>05200   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusTransport.html#gabe774b134a4bf8c8fc09e6186470874f" title="Returns TRUE if we have been authenticated.">_dbus_transport_try_to_authenticate</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>))
<a name="l05201"></a>05201     result = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l05202"></a>05202   <span class="keywordflow">else</span>
<a name="l05203"></a>05203     result = <a class="code" href="group__DBusTransport.html#gaf3c4a47f73bd584a9fda1e5e7a825da9" title="See dbus_connection_get_unix_user().">_dbus_transport_get_unix_user</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>,
<a name="l05204"></a>05204                                             uid);
<a name="l05205"></a>05205 
<a name="l05206"></a>05206 <span class="preprocessor">#ifdef DBUS_WIN</span>
<a name="l05207"></a>05207 <span class="preprocessor"></span>  _dbus_assert (!result);
<a name="l05208"></a>05208 <span class="preprocessor">#endif</span>
<a name="l05209"></a>05209 <span class="preprocessor"></span>  
<a name="l05210"></a>05210   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l05211"></a>05211 
<a name="l05212"></a>05212   <span class="keywordflow">return</span> result;
<a name="l05213"></a>05213 }
<a name="l05214"></a>05214 
<a name="l05225"></a>05225 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l05226"></a><a class="code" href="group__DBusConnection.html#gaeebeadcafa87e2d30eed4296f26fb73c">05226</a> <a class="code" href="group__DBusConnection.html#gaeebeadcafa87e2d30eed4296f26fb73c" title="Gets the process ID of the connection if any.">dbus_connection_get_unix_process_id</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l05227"></a>05227                                      <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>  *pid)
<a name="l05228"></a>05228 {
<a name="l05229"></a>05229   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> result;
<a name="l05230"></a>05230 
<a name="l05231"></a>05231   _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="l05232"></a>05232   _dbus_return_val_if_fail (pid != <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="l05233"></a>05233 
<a name="l05234"></a>05234   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l05235"></a>05235 
<a name="l05236"></a>05236   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusTransport.html#gabe774b134a4bf8c8fc09e6186470874f" title="Returns TRUE if we have been authenticated.">_dbus_transport_try_to_authenticate</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>))
<a name="l05237"></a>05237     result = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l05238"></a>05238   <span class="keywordflow">else</span>
<a name="l05239"></a>05239     result = <a class="code" href="group__DBusTransport.html#gae66bc81abe904a4b3ab32d8920c8fe1e" title="See dbus_connection_get_unix_process_id().">_dbus_transport_get_unix_process_id</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>,
<a name="l05240"></a>05240                                                   pid);
<a name="l05241"></a>05241 
<a name="l05242"></a>05242   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l05243"></a>05243 
<a name="l05244"></a>05244   <span class="keywordflow">return</span> result;
<a name="l05245"></a>05245 }
<a name="l05246"></a>05246 
<a name="l05258"></a>05258 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l05259"></a><a class="code" href="group__DBusConnection.html#ga969b9dafe806c9fe0a54c9d8a565c2e1">05259</a> <a class="code" href="group__DBusConnection.html#ga969b9dafe806c9fe0a54c9d8a565c2e1" title="Gets the ADT audit data of the connection if any.">dbus_connection_get_adt_audit_session_data</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l05260"></a>05260                                             <span class="keywordtype">void</span>          **data,
<a name="l05261"></a>05261                                             <a class="code" href="group__DBusTypes.html#gab18afa60e9b17b6e322735bda3d863d8" title="A 32-bit signed integer on all platforms.">dbus_int32_t</a>   *data_size)
<a name="l05262"></a>05262 {
<a name="l05263"></a>05263   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> result;
<a name="l05264"></a>05264 
<a name="l05265"></a>05265   _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="l05266"></a>05266   _dbus_return_val_if_fail (data != <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="l05267"></a>05267   _dbus_return_val_if_fail (data_size != <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="l05268"></a>05268 
<a name="l05269"></a>05269   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l05270"></a>05270 
<a name="l05271"></a>05271   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusTransport.html#gabe774b134a4bf8c8fc09e6186470874f" title="Returns TRUE if we have been authenticated.">_dbus_transport_try_to_authenticate</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>))
<a name="l05272"></a>05272     result = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l05273"></a>05273   <span class="keywordflow">else</span>
<a name="l05274"></a>05274     result = <a class="code" href="group__DBusTransport.html#ga36ccd8321491895ca632e744028eea42" title="See dbus_connection_get_adt_audit_session_data().">_dbus_transport_get_adt_audit_session_data</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>,
<a name="l05275"></a>05275                                                          data,
<a name="l05276"></a>05276                                                          data_size);
<a name="l05277"></a>05277   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l05278"></a>05278 
<a name="l05279"></a>05279   <span class="keywordflow">return</span> result;
<a name="l05280"></a>05280 }
<a name="l05281"></a>05281 
<a name="l05304"></a>05304 <span class="keywordtype">void</span>
<a name="l05305"></a><a class="code" href="group__DBusConnection.html#ga6b78379badb4c5804344f4f3d87a958a">05305</a> <a class="code" href="group__DBusConnection.html#ga6b78379badb4c5804344f4f3d87a958a" title="Sets a predicate function used to determine whether a given user ID is allowed to connect...">dbus_connection_set_unix_user_function</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>             *connection,
<a name="l05306"></a>05306                                         <a class="code" href="group__DBusConnection.html#ga36419a145848f3b234b3ba5640b0a3d0" title="Called during authentication to check whether the given UNIX user ID is allowed to connect...">DBusAllowUnixUserFunction</a>   <span class="keyword">function</span>,
<a name="l05307"></a>05307                                         <span class="keywordtype">void</span>                       *data,
<a name="l05308"></a>05308                                         <a class="code" href="group__DBusMemory.html#ga061bcded226d76c7d7de35beaa165cb5" title="The type of a function which frees a block of memory.">DBusFreeFunction</a>            free_data_function)
<a name="l05309"></a>05309 {
<a name="l05310"></a>05310   <span class="keywordtype">void</span> *old_data = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l05311"></a>05311   <a class="code" href="group__DBusMemory.html#ga061bcded226d76c7d7de35beaa165cb5" title="The type of a function which frees a block of memory.">DBusFreeFunction</a> old_free_function = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l05312"></a>05312 
<a name="l05313"></a>05313   _dbus_return_if_fail (connection != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l05314"></a>05314   
<a name="l05315"></a>05315   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l05316"></a>05316   <a class="code" href="group__DBusTransport.html#ga9f0ab472678a107c2ebe7f1da0754c44" title="See dbus_connection_set_unix_user_function().">_dbus_transport_set_unix_user_function</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>,
<a name="l05317"></a>05317                                           <span class="keyword">function</span>, data, free_data_function,
<a name="l05318"></a>05318                                           &amp;old_data, &amp;old_free_function);
<a name="l05319"></a>05319   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l05320"></a>05320 
<a name="l05321"></a>05321   <span class="keywordflow">if</span> (old_free_function != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l05322"></a>05322     (* old_free_function) (old_data);
<a name="l05323"></a>05323 }
<a name="l05324"></a>05324 
<a name="l05356"></a>05356 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l05357"></a><a class="code" href="group__DBusConnection.html#ga2b3cb488f1922aeecdeafdcb110e91a8">05357</a> <a class="code" href="group__DBusConnection.html#ga2b3cb488f1922aeecdeafdcb110e91a8" title="Gets the Windows user SID of the connection if known.">dbus_connection_get_windows_user</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>             *connection,
<a name="l05358"></a>05358                                   <span class="keywordtype">char</span>                      **windows_sid_p)
<a name="l05359"></a>05359 {
<a name="l05360"></a>05360   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> result;
<a name="l05361"></a>05361 
<a name="l05362"></a>05362   _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="l05363"></a>05363   _dbus_return_val_if_fail (windows_sid_p != <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="l05364"></a>05364 
<a name="l05365"></a>05365   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l05366"></a>05366 
<a name="l05367"></a>05367   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusTransport.html#gabe774b134a4bf8c8fc09e6186470874f" title="Returns TRUE if we have been authenticated.">_dbus_transport_try_to_authenticate</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>))
<a name="l05368"></a>05368     result = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l05369"></a>05369   <span class="keywordflow">else</span>
<a name="l05370"></a>05370     result = <a class="code" href="group__DBusTransport.html#ga3f4f4ce9eaef18567fd21f5c6a1fde99" title="See dbus_connection_get_windows_user().">_dbus_transport_get_windows_user</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>,
<a name="l05371"></a>05371                                                windows_sid_p);
<a name="l05372"></a>05372 
<a name="l05373"></a>05373 <span class="preprocessor">#ifdef DBUS_UNIX</span>
<a name="l05374"></a>05374 <span class="preprocessor"></span>  _dbus_assert (!result);
<a name="l05375"></a>05375 <span class="preprocessor">#endif</span>
<a name="l05376"></a>05376 <span class="preprocessor"></span>  
<a name="l05377"></a>05377   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l05378"></a>05378 
<a name="l05379"></a>05379   <span class="keywordflow">return</span> result;
<a name="l05380"></a>05380 }
<a name="l05381"></a>05381 
<a name="l05403"></a>05403 <span class="keywordtype">void</span>
<a name="l05404"></a><a class="code" href="group__DBusConnection.html#gaa35ced9ccd29d3366749ae383b120f9c">05404</a> <a class="code" href="group__DBusConnection.html#gaa35ced9ccd29d3366749ae383b120f9c" title="Sets a predicate function used to determine whether a given user ID is allowed to connect...">dbus_connection_set_windows_user_function</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>              *connection,
<a name="l05405"></a>05405                                            <a class="code" href="group__DBusConnection.html#ga47436366726762688036c600d651bab6" title="Called during authentication to check whether the given Windows user ID is allowed to connect...">DBusAllowWindowsUserFunction</a> <span class="keyword">function</span>,
<a name="l05406"></a>05406                                            <span class="keywordtype">void</span>                        *data,
<a name="l05407"></a>05407                                            <a class="code" href="group__DBusMemory.html#ga061bcded226d76c7d7de35beaa165cb5" title="The type of a function which frees a block of memory.">DBusFreeFunction</a>             free_data_function)
<a name="l05408"></a>05408 {
<a name="l05409"></a>05409   <span class="keywordtype">void</span> *old_data = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l05410"></a>05410   <a class="code" href="group__DBusMemory.html#ga061bcded226d76c7d7de35beaa165cb5" title="The type of a function which frees a block of memory.">DBusFreeFunction</a> old_free_function = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l05411"></a>05411 
<a name="l05412"></a>05412   _dbus_return_if_fail (connection != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l05413"></a>05413   
<a name="l05414"></a>05414   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l05415"></a>05415   <a class="code" href="group__DBusTransport.html#gadbf528ef41efde73d0bc386d10b7f5b1" title="See dbus_connection_set_windows_user_function().">_dbus_transport_set_windows_user_function</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>,
<a name="l05416"></a>05416                                              <span class="keyword">function</span>, data, free_data_function,
<a name="l05417"></a>05417                                              &amp;old_data, &amp;old_free_function);
<a name="l05418"></a>05418   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l05419"></a>05419 
<a name="l05420"></a>05420   <span class="keywordflow">if</span> (old_free_function != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l05421"></a>05421     (* old_free_function) (old_data);
<a name="l05422"></a>05422 }
<a name="l05423"></a>05423 
<a name="l05450"></a>05450 <span class="keywordtype">void</span>
<a name="l05451"></a><a class="code" href="group__DBusConnection.html#gade349ff04ed548993a8054250e317c12">05451</a> <a class="code" href="group__DBusConnection.html#gade349ff04ed548993a8054250e317c12" title="This function must be called on the server side of a connection when the connection is first seen in ...">dbus_connection_set_allow_anonymous</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>             *connection,
<a name="l05452"></a>05452                                      <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>                 value)
<a name="l05453"></a>05453 {
<a name="l05454"></a>05454   _dbus_return_if_fail (connection != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l05455"></a>05455   
<a name="l05456"></a>05456   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l05457"></a>05457   <a class="code" href="group__DBusTransport.html#ga5f4bd7eb5621003595b75cb8033463cd" title="See dbus_connection_set_allow_anonymous()">_dbus_transport_set_allow_anonymous</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>, value);
<a name="l05458"></a>05458   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l05459"></a>05459 }
<a name="l05460"></a>05460 
<a name="l05478"></a>05478 <span class="keywordtype">void</span>
<a name="l05479"></a><a class="code" href="group__DBusConnection.html#gaf58e8cc7b8717db1581459c0c3d34b08">05479</a> <a class="code" href="group__DBusConnection.html#gaf58e8cc7b8717db1581459c0c3d34b08" title="Normally DBusConnection automatically handles all messages to the org.freedesktop.DBus.Peer interface.">dbus_connection_set_route_peer_messages</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>             *connection,
<a name="l05480"></a>05480                                          <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>                 value)
<a name="l05481"></a>05481 {
<a name="l05482"></a>05482   _dbus_return_if_fail (connection != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l05483"></a>05483   
<a name="l05484"></a>05484   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l05485"></a>05485   connection-&gt;<a class="code" href="structDBusConnection.html#ab13bc36d7e6f91995768277ecbd5482c" title="If TRUE, if org.freedesktop.DBus.Peer messages have a bus name, don&#39;t handle them automatically...">route_peer_messages</a> = value;
<a name="l05486"></a>05486   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l05487"></a>05487 }
<a name="l05488"></a>05488 
<a name="l05510"></a>05510 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l05511"></a><a class="code" href="group__DBusConnection.html#gae00f581e5487408cb294bf71826aff86">05511</a> <a class="code" href="group__DBusConnection.html#gae00f581e5487408cb294bf71826aff86" title="Adds a message filter.">dbus_connection_add_filter</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>            *connection,
<a name="l05512"></a>05512                             <a class="code" href="group__DBusConnection.html#ga13febac22a058c4fc98a90ce7da69489" title="Called when a message needs to be handled.">DBusHandleMessageFunction</a>  <span class="keyword">function</span>,
<a name="l05513"></a>05513                             <span class="keywordtype">void</span>                      *user_data,
<a name="l05514"></a>05514                             <a class="code" href="group__DBusMemory.html#ga061bcded226d76c7d7de35beaa165cb5" title="The type of a function which frees a block of memory.">DBusFreeFunction</a>           free_data_function)
<a name="l05515"></a>05515 {
<a name="l05516"></a>05516   <a class="code" href="structDBusMessageFilter.html" title="Internal struct representing a message filter function.">DBusMessageFilter</a> *filter;
<a name="l05517"></a>05517   
<a name="l05518"></a>05518   _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="l05519"></a>05519   _dbus_return_val_if_fail (<span class="keyword">function</span> != <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="l05520"></a>05520 
<a name="l05521"></a>05521   filter = <a class="code" href="group__DBusMemory.html#gaba9d823abda7f4cadbaf5177d3b8b793" title="Safe macro for using dbus_malloc0().">dbus_new0</a> (<a class="code" href="structDBusMessageFilter.html" title="Internal struct representing a message filter function.">DBusMessageFilter</a>, 1);
<a name="l05522"></a>05522   <span class="keywordflow">if</span> (filter == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l05523"></a>05523     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l05524"></a>05524 
<a name="l05525"></a>05525   <a class="code" href="group__DBusSysdeps.html#gae74c3fcf12acaeccdb152ef907de951c" title="Atomically increments an integer.">_dbus_atomic_inc</a> (&amp;filter-&gt;<a class="code" href="structDBusMessageFilter.html#a2d2debd9a708cb7d4f8447c18f7458b9" title="Reference count.">refcount</a>);
<a name="l05526"></a>05526 
<a name="l05527"></a>05527   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l05528"></a>05528 
<a name="l05529"></a>05529   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusList.html#gad99045e79db46159babe69718f343053" title="Appends a value to the list.">_dbus_list_append</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#a32d14cefcb4daea257544397755d45ed" title="List of filters.">filter_list</a>,
<a name="l05530"></a>05530                           filter))
<a name="l05531"></a>05531     {
<a name="l05532"></a>05532       _dbus_message_filter_unref (filter);
<a name="l05533"></a>05533       <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l05534"></a>05534       <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l05535"></a>05535     }
<a name="l05536"></a>05536 
<a name="l05537"></a>05537   <span class="comment">/* Fill in filter after all memory allocated,</span>
<a name="l05538"></a>05538 <span class="comment">   * so we don&#39;t run the free_user_data_function</span>
<a name="l05539"></a>05539 <span class="comment">   * if the add_filter() fails</span>
<a name="l05540"></a>05540 <span class="comment">   */</span>
<a name="l05541"></a>05541   
<a name="l05542"></a>05542   filter-&gt;<a class="code" href="structDBusMessageFilter.html#a56b3643122277ed5dc3d4f07793617fa" title="Function to call to filter.">function</a> = <span class="keyword">function</span>;
<a name="l05543"></a>05543   filter-&gt;<a class="code" href="structDBusMessageFilter.html#a6cf5321325828e39da1cc8fa1b3d7153" title="User data for the function.">user_data</a> = user_data;
<a name="l05544"></a>05544   filter-&gt;<a class="code" href="structDBusMessageFilter.html#a915f3269a91ee41d963448dcb22d92cd" title="Function to free the user data.">free_user_data_function</a> = free_data_function;
<a name="l05545"></a>05545         
<a name="l05546"></a>05546   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l05547"></a>05547   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l05548"></a>05548 }
<a name="l05549"></a>05549 
<a name="l05562"></a>05562 <span class="keywordtype">void</span>
<a name="l05563"></a><a class="code" href="group__DBusConnection.html#ga5e7f1dad410506a8a6f5182c55e7c4fe">05563</a> <a class="code" href="group__DBusConnection.html#ga5e7f1dad410506a8a6f5182c55e7c4fe" title="Removes a previously-added message filter.">dbus_connection_remove_filter</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>            *connection,
<a name="l05564"></a>05564                                <a class="code" href="group__DBusConnection.html#ga13febac22a058c4fc98a90ce7da69489" title="Called when a message needs to be handled.">DBusHandleMessageFunction</a>  <span class="keyword">function</span>,
<a name="l05565"></a>05565                                <span class="keywordtype">void</span>                      *user_data)
<a name="l05566"></a>05566 {
<a name="l05567"></a>05567   <a class="code" href="structDBusList.html" title="A node in a linked list.">DBusList</a> *link;
<a name="l05568"></a>05568   <a class="code" href="structDBusMessageFilter.html" title="Internal struct representing a message filter function.">DBusMessageFilter</a> *filter;
<a name="l05569"></a>05569   
<a name="l05570"></a>05570   _dbus_return_if_fail (connection != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l05571"></a>05571   _dbus_return_if_fail (<span class="keyword">function</span> != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l05572"></a>05572   
<a name="l05573"></a>05573   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l05574"></a>05574 
<a name="l05575"></a>05575   filter = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l05576"></a>05576   
<a name="l05577"></a>05577   link = <a class="code" href="group__DBusList.html#ga42736fb02458bfffed948a509962c059" title="Gets the last link in the list.">_dbus_list_get_last_link</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#a32d14cefcb4daea257544397755d45ed" title="List of filters.">filter_list</a>);
<a name="l05578"></a>05578   <span class="keywordflow">while</span> (link != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l05579"></a>05579     {
<a name="l05580"></a>05580       filter = link-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a>;
<a name="l05581"></a>05581 
<a name="l05582"></a>05582       <span class="keywordflow">if</span> (filter-&gt;<a class="code" href="structDBusMessageFilter.html#a56b3643122277ed5dc3d4f07793617fa" title="Function to call to filter.">function</a> == <span class="keyword">function</span> &amp;&amp;
<a name="l05583"></a>05583           filter-&gt;<a class="code" href="structDBusMessageFilter.html#a6cf5321325828e39da1cc8fa1b3d7153" title="User data for the function.">user_data</a> == user_data)
<a name="l05584"></a>05584         {
<a name="l05585"></a>05585           <a class="code" href="group__DBusList.html#ga40abea762d9cb44e5ec6b31b1769dc2e" title="Removes a link from the list.">_dbus_list_remove_link</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#a32d14cefcb4daea257544397755d45ed" title="List of filters.">filter_list</a>, link);
<a name="l05586"></a>05586           filter-&gt;<a class="code" href="structDBusMessageFilter.html#a56b3643122277ed5dc3d4f07793617fa" title="Function to call to filter.">function</a> = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l05587"></a>05587           
<a name="l05588"></a>05588           <span class="keywordflow">break</span>;
<a name="l05589"></a>05589         }
<a name="l05590"></a>05590         
<a name="l05591"></a>05591       link = <a class="code" href="group__DBusList.html#ga6637493bf5fc09bddb44ac295c475cae" title="Gets the previous link in the list, or NULL if there are no more links.">_dbus_list_get_prev_link</a> (&amp;connection-&gt;<a class="code" href="structDBusConnection.html#a32d14cefcb4daea257544397755d45ed" title="List of filters.">filter_list</a>, link);
<a name="l05592"></a>05592       filter = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l05593"></a>05593     }
<a name="l05594"></a>05594   
<a name="l05595"></a>05595   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l05596"></a>05596 
<a name="l05597"></a>05597 <span class="preprocessor">#ifndef DBUS_DISABLE_CHECKS</span>
<a name="l05598"></a>05598 <span class="preprocessor"></span>  <span class="keywordflow">if</span> (filter == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l05599"></a>05599     {
<a name="l05600"></a>05600       <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;Attempt to remove filter function %p user data %p, but no such filter has been added\n&quot;</span>,
<a name="l05601"></a>05601                                <span class="keyword">function</span>, user_data);
<a name="l05602"></a>05602       <span class="keywordflow">return</span>;
<a name="l05603"></a>05603     }
<a name="l05604"></a>05604 <span class="preprocessor">#endif</span>
<a name="l05605"></a>05605 <span class="preprocessor"></span>  
<a name="l05606"></a>05606   <span class="comment">/* Call application code */</span>
<a name="l05607"></a>05607   <span class="keywordflow">if</span> (filter-&gt;<a class="code" href="structDBusMessageFilter.html#a915f3269a91ee41d963448dcb22d92cd" title="Function to free the user data.">free_user_data_function</a>)
<a name="l05608"></a>05608     (* filter-&gt;<a class="code" href="structDBusMessageFilter.html#a915f3269a91ee41d963448dcb22d92cd" title="Function to free the user data.">free_user_data_function</a>) (filter-&gt;<a class="code" href="structDBusMessageFilter.html#a6cf5321325828e39da1cc8fa1b3d7153" title="User data for the function.">user_data</a>);
<a name="l05609"></a>05609 
<a name="l05610"></a>05610   filter-&gt;<a class="code" href="structDBusMessageFilter.html#a915f3269a91ee41d963448dcb22d92cd" title="Function to free the user data.">free_user_data_function</a> = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l05611"></a>05611   filter-&gt;<a class="code" href="structDBusMessageFilter.html#a6cf5321325828e39da1cc8fa1b3d7153" title="User data for the function.">user_data</a> = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l05612"></a>05612   
<a name="l05613"></a>05613   _dbus_message_filter_unref (filter);
<a name="l05614"></a>05614 }
<a name="l05615"></a>05615 
<a name="l05631"></a>05631 <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="l05632"></a>05632 _dbus_connection_register_object_path (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>              *connection,
<a name="l05633"></a>05633                                        <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>                  fallback,
<a name="l05634"></a>05634                                        <span class="keyword">const</span> <span class="keywordtype">char</span>                  *path,
<a name="l05635"></a>05635                                        <span class="keyword">const</span> <a class="code" href="structDBusObjectPathVTable.html" title="Virtual table that must be implemented to handle a portion of the object path hierarchy.">DBusObjectPathVTable</a>  *vtable,
<a name="l05636"></a>05636                                        <span class="keywordtype">void</span>                        *user_data,
<a name="l05637"></a>05637                                        <a class="code" href="structDBusError.html" title="Object representing an exception.">DBusError</a>                   *error)
<a name="l05638"></a>05638 {
<a name="l05639"></a>05639   <span class="keywordtype">char</span> **decomposed_path;
<a name="l05640"></a>05640   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> retval;
<a name="l05641"></a>05641 
<a name="l05642"></a>05642   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusObjectTree.html#gab282b916368cd512842d3aaae31e65c7" title="Decompose an object path.">_dbus_decompose_path</a> (path, strlen (path), &amp;decomposed_path, <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>))
<a name="l05643"></a>05643     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l05644"></a>05644 
<a name="l05645"></a>05645   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l05646"></a>05646 
<a name="l05647"></a>05647   retval = <a class="code" href="group__DBusObjectTree.html#gab3da15ee1a73d3b26008d1bce20a78a0" title="Registers a new subtree in the global object tree.">_dbus_object_tree_register</a> (connection-&gt;<a class="code" href="structDBusConnection.html#acd289771721a459f4f9cdeaca0fa87c2" title="Object path handlers registered with this connection.">objects</a>,
<a name="l05648"></a>05648                                        fallback,
<a name="l05649"></a>05649                                        (<span class="keyword">const</span> <span class="keywordtype">char</span> **) decomposed_path, vtable,
<a name="l05650"></a>05650                                        user_data, error);
<a name="l05651"></a>05651 
<a name="l05652"></a>05652   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l05653"></a>05653 
<a name="l05654"></a>05654   <a class="code" href="group__DBusMemory.html#gac200b2dbc8b3f6ecac4d42426fb97b40" title="Frees a NULL-terminated array of strings.">dbus_free_string_array</a> (decomposed_path);
<a name="l05655"></a>05655 
<a name="l05656"></a>05656   <span class="keywordflow">return</span> retval;
<a name="l05657"></a>05657 }
<a name="l05658"></a>05658 
<a name="l05671"></a>05671 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l05672"></a><a class="code" href="group__DBusConnection.html#ga708b1e108feed18f5775ff404c9dda4b">05672</a> <a class="code" href="group__DBusConnection.html#ga708b1e108feed18f5775ff404c9dda4b" title="Registers a handler for a given path in the object hierarchy.">dbus_connection_try_register_object_path</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>              *connection,
<a name="l05673"></a>05673                                           <span class="keyword">const</span> <span class="keywordtype">char</span>                  *path,
<a name="l05674"></a>05674                                           <span class="keyword">const</span> <a class="code" href="structDBusObjectPathVTable.html" title="Virtual table that must be implemented to handle a portion of the object path hierarchy.">DBusObjectPathVTable</a>  *vtable,
<a name="l05675"></a>05675                                           <span class="keywordtype">void</span>                        *user_data,
<a name="l05676"></a>05676                                           <a class="code" href="structDBusError.html" title="Object representing an exception.">DBusError</a>                   *error)
<a name="l05677"></a>05677 {
<a name="l05678"></a>05678   _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="l05679"></a>05679   _dbus_return_val_if_fail (path != <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="l05680"></a>05680   _dbus_return_val_if_fail (path[0] == <span class="charliteral">&#39;/&#39;</span>, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l05681"></a>05681   _dbus_return_val_if_fail (vtable != <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="l05682"></a>05682 
<a name="l05683"></a>05683   <span class="keywordflow">return</span> _dbus_connection_register_object_path (connection, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>, path, vtable, user_data, error);
<a name="l05684"></a>05684 }
<a name="l05685"></a>05685 
<a name="l05701"></a>05701 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l05702"></a><a class="code" href="group__DBusConnection.html#ga24730ca6fd2e9132873962a32df7628c">05702</a> <a class="code" href="group__DBusConnection.html#ga24730ca6fd2e9132873962a32df7628c" title="Registers a handler for a given path in the object hierarchy.">dbus_connection_register_object_path</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>              *connection,
<a name="l05703"></a>05703                                       <span class="keyword">const</span> <span class="keywordtype">char</span>                  *path,
<a name="l05704"></a>05704                                       <span class="keyword">const</span> <a class="code" href="structDBusObjectPathVTable.html" title="Virtual table that must be implemented to handle a portion of the object path hierarchy.">DBusObjectPathVTable</a>  *vtable,
<a name="l05705"></a>05705                                       <span class="keywordtype">void</span>                        *user_data)
<a name="l05706"></a>05706 {
<a name="l05707"></a>05707   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> retval;
<a name="l05708"></a>05708   <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="l05709"></a>05709 
<a name="l05710"></a>05710   _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="l05711"></a>05711   _dbus_return_val_if_fail (path != <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="l05712"></a>05712   _dbus_return_val_if_fail (path[0] == <span class="charliteral">&#39;/&#39;</span>, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l05713"></a>05713   _dbus_return_val_if_fail (vtable != <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="l05714"></a>05714 
<a name="l05715"></a>05715   retval = _dbus_connection_register_object_path (connection, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>, path, vtable, user_data, &amp;error);
<a name="l05716"></a>05716 
<a name="l05717"></a>05717   <span class="keywordflow">if</span> (<a class="code" href="group__DBusErrors.html#ga48515c580199514026542fe053ef1887" title="Checks whether the error is set and has the given name.">dbus_error_has_name</a> (&amp;error, <a class="code" href="group__DBusProtocol.html#ga6a4358a62f0cd68d637532772475e576" title="There&#39;s already an object with the requested object path.">DBUS_ERROR_OBJECT_PATH_IN_USE</a>))
<a name="l05718"></a>05718     {
<a name="l05719"></a>05719       <a class="code" href="group__DBusInternalsUtils.html#gabea2c16d6d3fe7c4eb5b9496fc877f84" title="Prints a warning message to stderr.">_dbus_warn</a> (<span class="stringliteral">&quot;%s\n&quot;</span>, error.<a class="code" href="structDBusError.html#afb559175326de5b6b340e26204e92d72" title="public error message field">message</a>);
<a name="l05720"></a>05720       <a class="code" href="group__DBusErrors.html#gaac6c14ead14829ee4e090f39de6a7568" title="Frees an error that&#39;s been set (or just initialized), then reinitializes the error as in dbus_error_i...">dbus_error_free</a> (&amp;error);
<a name="l05721"></a>05721       <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l05722"></a>05722     }
<a name="l05723"></a>05723 
<a name="l05724"></a>05724   <span class="keywordflow">return</span> retval;
<a name="l05725"></a>05725 }
<a name="l05726"></a>05726 
<a name="l05741"></a>05741 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l05742"></a><a class="code" href="group__DBusConnection.html#ga8e9d2d4ff17c3071124e4993d1536ed4">05742</a> <a class="code" href="group__DBusConnection.html#ga8e9d2d4ff17c3071124e4993d1536ed4" title="Registers a fallback handler for a given subsection of the object hierarchy.">dbus_connection_try_register_fallback</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>              *connection,
<a name="l05743"></a>05743                                        <span class="keyword">const</span> <span class="keywordtype">char</span>                  *path,
<a name="l05744"></a>05744                                        <span class="keyword">const</span> <a class="code" href="structDBusObjectPathVTable.html" title="Virtual table that must be implemented to handle a portion of the object path hierarchy.">DBusObjectPathVTable</a>  *vtable,
<a name="l05745"></a>05745                                        <span class="keywordtype">void</span>                        *user_data,
<a name="l05746"></a>05746                                        <a class="code" href="structDBusError.html" title="Object representing an exception.">DBusError</a>                   *error)
<a name="l05747"></a>05747 {
<a name="l05748"></a>05748   _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="l05749"></a>05749   _dbus_return_val_if_fail (path != <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="l05750"></a>05750   _dbus_return_val_if_fail (path[0] == <span class="charliteral">&#39;/&#39;</span>, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l05751"></a>05751   _dbus_return_val_if_fail (vtable != <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="l05752"></a>05752 
<a name="l05753"></a>05753   <span class="keywordflow">return</span> _dbus_connection_register_object_path (connection, <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>, path, vtable, user_data, error);
<a name="l05754"></a>05754 }
<a name="l05755"></a>05755 
<a name="l05773"></a>05773 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l05774"></a><a class="code" href="group__DBusConnection.html#gac4473b37bfa74ccf7459959d27e7bc59">05774</a> <a class="code" href="group__DBusConnection.html#gac4473b37bfa74ccf7459959d27e7bc59" title="Registers a fallback handler for a given subsection of the object hierarchy.">dbus_connection_register_fallback</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>              *connection,
<a name="l05775"></a>05775                                    <span class="keyword">const</span> <span class="keywordtype">char</span>                  *path,
<a name="l05776"></a>05776                                    <span class="keyword">const</span> <a class="code" href="structDBusObjectPathVTable.html" title="Virtual table that must be implemented to handle a portion of the object path hierarchy.">DBusObjectPathVTable</a>  *vtable,
<a name="l05777"></a>05777                                    <span class="keywordtype">void</span>                        *user_data)
<a name="l05778"></a>05778 {
<a name="l05779"></a>05779   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> retval;
<a name="l05780"></a>05780   <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="l05781"></a>05781 
<a name="l05782"></a>05782   _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="l05783"></a>05783   _dbus_return_val_if_fail (path != <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="l05784"></a>05784   _dbus_return_val_if_fail (path[0] == <span class="charliteral">&#39;/&#39;</span>, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l05785"></a>05785   _dbus_return_val_if_fail (vtable != <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="l05786"></a>05786 
<a name="l05787"></a>05787   retval = _dbus_connection_register_object_path (connection, <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>, path, vtable, user_data, &amp;error);
<a name="l05788"></a>05788 
<a name="l05789"></a>05789   <span class="keywordflow">if</span> (<a class="code" href="group__DBusErrors.html#ga48515c580199514026542fe053ef1887" title="Checks whether the error is set and has the given name.">dbus_error_has_name</a> (&amp;error, <a class="code" href="group__DBusProtocol.html#ga6a4358a62f0cd68d637532772475e576" title="There&#39;s already an object with the requested object path.">DBUS_ERROR_OBJECT_PATH_IN_USE</a>))
<a name="l05790"></a>05790     {
<a name="l05791"></a>05791       <a class="code" href="group__DBusInternalsUtils.html#gabea2c16d6d3fe7c4eb5b9496fc877f84" title="Prints a warning message to stderr.">_dbus_warn</a> (<span class="stringliteral">&quot;%s\n&quot;</span>, error.<a class="code" href="structDBusError.html#afb559175326de5b6b340e26204e92d72" title="public error message field">message</a>);
<a name="l05792"></a>05792       <a class="code" href="group__DBusErrors.html#gaac6c14ead14829ee4e090f39de6a7568" title="Frees an error that&#39;s been set (or just initialized), then reinitializes the error as in dbus_error_i...">dbus_error_free</a> (&amp;error);
<a name="l05793"></a>05793       <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l05794"></a>05794     }
<a name="l05795"></a>05795 
<a name="l05796"></a>05796   <span class="keywordflow">return</span> retval;
<a name="l05797"></a>05797 }
<a name="l05798"></a>05798 
<a name="l05808"></a>05808 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l05809"></a><a class="code" href="group__DBusConnection.html#ga6ae8f005dedf24c5f2df1768795392fb">05809</a> <a class="code" href="group__DBusConnection.html#ga6ae8f005dedf24c5f2df1768795392fb" title="Unregisters the handler registered with exactly the given path.">dbus_connection_unregister_object_path</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>              *connection,
<a name="l05810"></a>05810                                         <span class="keyword">const</span> <span class="keywordtype">char</span>                  *path)
<a name="l05811"></a>05811 {
<a name="l05812"></a>05812   <span class="keywordtype">char</span> **decomposed_path;
<a name="l05813"></a>05813 
<a name="l05814"></a>05814   _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="l05815"></a>05815   _dbus_return_val_if_fail (path != <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="l05816"></a>05816   _dbus_return_val_if_fail (path[0] == <span class="charliteral">&#39;/&#39;</span>, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l05817"></a>05817 
<a name="l05818"></a>05818   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusObjectTree.html#gab282b916368cd512842d3aaae31e65c7" title="Decompose an object path.">_dbus_decompose_path</a> (path, strlen (path), &amp;decomposed_path, <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>))
<a name="l05819"></a>05819       <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l05820"></a>05820 
<a name="l05821"></a>05821   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l05822"></a>05822 
<a name="l05823"></a>05823   <a class="code" href="group__DBusObjectTree.html#ga3babe73ed342b6963997ef2efd73ef75" title="Unregisters an object subtree that was registered with the same path.">_dbus_object_tree_unregister_and_unlock</a> (connection-&gt;<a class="code" href="structDBusConnection.html#acd289771721a459f4f9cdeaca0fa87c2" title="Object path handlers registered with this connection.">objects</a>, (<span class="keyword">const</span> <span class="keywordtype">char</span> **) decomposed_path);
<a name="l05824"></a>05824 
<a name="l05825"></a>05825   <a class="code" href="group__DBusMemory.html#gac200b2dbc8b3f6ecac4d42426fb97b40" title="Frees a NULL-terminated array of strings.">dbus_free_string_array</a> (decomposed_path);
<a name="l05826"></a>05826 
<a name="l05827"></a>05827   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l05828"></a>05828 }
<a name="l05829"></a>05829 
<a name="l05840"></a>05840 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l05841"></a><a class="code" href="group__DBusConnection.html#ga08ee6e70b74c294fe24d0f391f16db24">05841</a> <a class="code" href="group__DBusConnection.html#ga08ee6e70b74c294fe24d0f391f16db24" title="Gets the user data passed to dbus_connection_register_object_path() or dbus_connection_register_fallb...">dbus_connection_get_object_path_data</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l05842"></a>05842                                       <span class="keyword">const</span> <span class="keywordtype">char</span>     *path,
<a name="l05843"></a>05843                                       <span class="keywordtype">void</span>          **data_p)
<a name="l05844"></a>05844 {
<a name="l05845"></a>05845   <span class="keywordtype">char</span> **decomposed_path;
<a name="l05846"></a>05846 
<a name="l05847"></a>05847   _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="l05848"></a>05848   _dbus_return_val_if_fail (path != <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="l05849"></a>05849   _dbus_return_val_if_fail (data_p != <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="l05850"></a>05850 
<a name="l05851"></a>05851   *data_p = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l05852"></a>05852   
<a name="l05853"></a>05853   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusObjectTree.html#gab282b916368cd512842d3aaae31e65c7" title="Decompose an object path.">_dbus_decompose_path</a> (path, strlen (path), &amp;decomposed_path, <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>))
<a name="l05854"></a>05854     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l05855"></a>05855   
<a name="l05856"></a>05856   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l05857"></a>05857 
<a name="l05858"></a>05858   *data_p = <a class="code" href="group__DBusObjectTree.html#ga4cf5a5f35d2bd18b6fa8aa58ba6b5de4" title="Looks up the data passed to _dbus_object_tree_register() for a handler at the given path...">_dbus_object_tree_get_user_data_unlocked</a> (connection-&gt;<a class="code" href="structDBusConnection.html#acd289771721a459f4f9cdeaca0fa87c2" title="Object path handlers registered with this connection.">objects</a>, (<span class="keyword">const</span> <span class="keywordtype">char</span>**) decomposed_path);
<a name="l05859"></a>05859 
<a name="l05860"></a>05860   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l05861"></a>05861 
<a name="l05862"></a>05862   <a class="code" href="group__DBusMemory.html#gac200b2dbc8b3f6ecac4d42426fb97b40" title="Frees a NULL-terminated array of strings.">dbus_free_string_array</a> (decomposed_path);
<a name="l05863"></a>05863 
<a name="l05864"></a>05864   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l05865"></a>05865 }
<a name="l05866"></a>05866 
<a name="l05877"></a>05877 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l05878"></a><a class="code" href="group__DBusConnection.html#ga3e9de2067d0eed66ef73230fae8d8be2">05878</a> <a class="code" href="group__DBusConnection.html#ga3e9de2067d0eed66ef73230fae8d8be2" title="Lists the registered fallback handlers and object path handlers at the given parent_path.">dbus_connection_list_registered</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>              *connection,
<a name="l05879"></a>05879                                  <span class="keyword">const</span> <span class="keywordtype">char</span>                  *parent_path,
<a name="l05880"></a>05880                                  <span class="keywordtype">char</span>                      ***child_entries)
<a name="l05881"></a>05881 {
<a name="l05882"></a>05882   <span class="keywordtype">char</span> **decomposed_path;
<a name="l05883"></a>05883   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> retval;
<a name="l05884"></a>05884   _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="l05885"></a>05885   _dbus_return_val_if_fail (parent_path != <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="l05886"></a>05886   _dbus_return_val_if_fail (parent_path[0] == <span class="charliteral">&#39;/&#39;</span>, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l05887"></a>05887   _dbus_return_val_if_fail (child_entries != <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="l05888"></a>05888 
<a name="l05889"></a>05889   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusObjectTree.html#gab282b916368cd512842d3aaae31e65c7" title="Decompose an object path.">_dbus_decompose_path</a> (parent_path, strlen (parent_path), &amp;decomposed_path, <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>))
<a name="l05890"></a>05890     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l05891"></a>05891 
<a name="l05892"></a>05892   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l05893"></a>05893 
<a name="l05894"></a>05894   retval = <a class="code" href="group__DBusObjectTree.html#gaab7040bd1bf037d99e9bbb75d0869a2f" title="Lists the registered fallback handlers and object path handlers at the given parent_path.">_dbus_object_tree_list_registered_and_unlock</a> (connection-&gt;<a class="code" href="structDBusConnection.html#acd289771721a459f4f9cdeaca0fa87c2" title="Object path handlers registered with this connection.">objects</a>,
<a name="l05895"></a>05895                                                          (<span class="keyword">const</span> <span class="keywordtype">char</span> **) decomposed_path,
<a name="l05896"></a>05896                                                          child_entries);
<a name="l05897"></a>05897   <a class="code" href="group__DBusMemory.html#gac200b2dbc8b3f6ecac4d42426fb97b40" title="Frees a NULL-terminated array of strings.">dbus_free_string_array</a> (decomposed_path);
<a name="l05898"></a>05898 
<a name="l05899"></a>05899   <span class="keywordflow">return</span> retval;
<a name="l05900"></a>05900 }
<a name="l05901"></a>05901 
<a name="l05902"></a>05902 <span class="keyword">static</span> <a class="code" href="structDBusDataSlotAllocator.html" title="An allocator that tracks a set of slot IDs.">DBusDataSlotAllocator</a> slot_allocator =
<a name="l05903"></a>05903   _DBUS_DATA_SLOT_ALLOCATOR_INIT (_DBUS_LOCK_NAME (connection_slots));
<a name="l05904"></a>05904 
<a name="l05919"></a>05919 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l05920"></a><a class="code" href="group__DBusConnection.html#ga728b15c71a492ad244e5a480f1156088">05920</a> <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> (<a class="code" href="group__DBusTypes.html#gab18afa60e9b17b6e322735bda3d863d8" title="A 32-bit signed integer on all platforms.">dbus_int32_t</a> *slot_p)
<a name="l05921"></a>05921 {
<a name="l05922"></a>05922   <span class="keywordflow">return</span> <a class="code" href="group__DBusDataSlot.html#gaf61f2bd0148bace4f67a2d6d97b26ea9" title="Allocates an integer ID to be used for storing data in a DBusDataSlotList.">_dbus_data_slot_allocator_alloc</a> (&amp;slot_allocator,
<a name="l05923"></a>05923                                           slot_p);
<a name="l05924"></a>05924 }
<a name="l05925"></a>05925 
<a name="l05937"></a>05937 <span class="keywordtype">void</span>
<a name="l05938"></a><a class="code" href="group__DBusConnection.html#ga7dc8c73d8c3e733f5410d52be84239a0">05938</a> <a class="code" href="group__DBusConnection.html#ga7dc8c73d8c3e733f5410d52be84239a0" title="Deallocates a global ID for connection data slots.">dbus_connection_free_data_slot</a> (<a class="code" href="group__DBusTypes.html#gab18afa60e9b17b6e322735bda3d863d8" title="A 32-bit signed integer on all platforms.">dbus_int32_t</a> *slot_p)
<a name="l05939"></a>05939 {
<a name="l05940"></a>05940   _dbus_return_if_fail (*slot_p &gt;= 0);
<a name="l05941"></a>05941   
<a name="l05942"></a>05942   <a class="code" href="group__DBusDataSlot.html#ga059c50a24cd9fc984e918e6159841633" title="Deallocates an ID previously allocated with _dbus_data_slot_allocator_alloc().">_dbus_data_slot_allocator_free</a> (&amp;slot_allocator, slot_p);
<a name="l05943"></a>05943 }
<a name="l05944"></a>05944 
<a name="l05967"></a>05967 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l05968"></a><a class="code" href="group__DBusConnection.html#ga845b4942399f43dd4ac644de7cb9e3ff">05968</a> <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> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>   *connection,
<a name="l05969"></a>05969                           <a class="code" href="group__DBusTypes.html#gab18afa60e9b17b6e322735bda3d863d8" title="A 32-bit signed integer on all platforms.">dbus_int32_t</a>      slot,
<a name="l05970"></a>05970                           <span class="keywordtype">void</span>             *data,
<a name="l05971"></a>05971                           <a class="code" href="group__DBusMemory.html#ga061bcded226d76c7d7de35beaa165cb5" title="The type of a function which frees a block of memory.">DBusFreeFunction</a>  free_data_func)
<a name="l05972"></a>05972 {
<a name="l05973"></a>05973   <a class="code" href="group__DBusMemory.html#ga061bcded226d76c7d7de35beaa165cb5" title="The type of a function which frees a block of memory.">DBusFreeFunction</a> old_free_func;
<a name="l05974"></a>05974   <span class="keywordtype">void</span> *old_data;
<a name="l05975"></a>05975   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> retval;
<a name="l05976"></a>05976 
<a name="l05977"></a>05977   _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="l05978"></a>05978   _dbus_return_val_if_fail (slot &gt;= 0, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l05979"></a>05979   
<a name="l05980"></a>05980   SLOTS_LOCK (connection);
<a name="l05981"></a>05981 
<a name="l05982"></a>05982   retval = <a class="code" href="group__DBusDataSlot.html#gad2952f9f686d96e7114fc49ab7452e1a" title="Stores a pointer in the data slot list, along with an optional function to be used for freeing the da...">_dbus_data_slot_list_set</a> (&amp;slot_allocator,
<a name="l05983"></a>05983                                      &amp;connection-&gt;<a class="code" href="structDBusConnection.html#a0f805edcd9c09aaf45974510403dccbd" title="Data stored by allocated integer ID.">slot_list</a>,
<a name="l05984"></a>05984                                      slot, data, free_data_func,
<a name="l05985"></a>05985                                      &amp;old_free_func, &amp;old_data);
<a name="l05986"></a>05986   
<a name="l05987"></a>05987   SLOTS_UNLOCK (connection);
<a name="l05988"></a>05988 
<a name="l05989"></a>05989   <span class="keywordflow">if</span> (retval)
<a name="l05990"></a>05990     {
<a name="l05991"></a>05991       <span class="comment">/* Do the actual free outside the connection lock */</span>
<a name="l05992"></a>05992       <span class="keywordflow">if</span> (old_free_func)
<a name="l05993"></a>05993         (* old_free_func) (old_data);
<a name="l05994"></a>05994     }
<a name="l05995"></a>05995 
<a name="l05996"></a>05996   <span class="keywordflow">return</span> retval;
<a name="l05997"></a>05997 }
<a name="l05998"></a>05998 
<a name="l06016"></a>06016 <span class="keywordtype">void</span>*
<a name="l06017"></a><a class="code" href="group__DBusConnection.html#ga433fae9844a66d9d078d238e6c723b95">06017</a> <a class="code" href="group__DBusConnection.html#ga433fae9844a66d9d078d238e6c723b95" title="Retrieves data previously set with dbus_connection_set_data().">dbus_connection_get_data</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a>   *connection,
<a name="l06018"></a>06018                           <a class="code" href="group__DBusTypes.html#gab18afa60e9b17b6e322735bda3d863d8" title="A 32-bit signed integer on all platforms.">dbus_int32_t</a>      slot)
<a name="l06019"></a>06019 {
<a name="l06020"></a>06020   <span class="keywordtype">void</span> *res;
<a name="l06021"></a>06021 
<a name="l06022"></a>06022   _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="l06023"></a>06023   _dbus_return_val_if_fail (slot &gt;= 0, <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l06024"></a>06024 
<a name="l06025"></a>06025   SLOTS_LOCK (connection);
<a name="l06026"></a>06026 
<a name="l06027"></a>06027   res = <a class="code" href="group__DBusDataSlot.html#ga43f741229f0c38788442601e2750ec66" title="Retrieves data previously set with _dbus_data_slot_list_set_data().">_dbus_data_slot_list_get</a> (&amp;slot_allocator,
<a name="l06028"></a>06028                                   &amp;connection-&gt;<a class="code" href="structDBusConnection.html#a0f805edcd9c09aaf45974510403dccbd" title="Data stored by allocated integer ID.">slot_list</a>,
<a name="l06029"></a>06029                                   slot);
<a name="l06030"></a>06030   
<a name="l06031"></a>06031   SLOTS_UNLOCK (connection);
<a name="l06032"></a>06032 
<a name="l06033"></a>06033   <span class="keywordflow">return</span> res;
<a name="l06034"></a>06034 }
<a name="l06035"></a>06035 
<a name="l06042"></a>06042 <span class="keywordtype">void</span>
<a name="l06043"></a><a class="code" href="group__DBusConnection.html#ga794d0b572e30448fb262618222f76124">06043</a> <a class="code" href="group__DBusConnection.html#ga794d0b572e30448fb262618222f76124" title="This function sets a global flag for whether dbus_connection_new() will set SIGPIPE behavior to SIG_I...">dbus_connection_set_change_sigpipe</a> (<a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> will_modify_sigpipe)
<a name="l06044"></a>06044 {  
<a name="l06045"></a>06045   _dbus_modify_sigpipe = will_modify_sigpipe != <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l06046"></a>06046 }
<a name="l06047"></a>06047 
<a name="l06056"></a>06056 <span class="keywordtype">void</span>
<a name="l06057"></a><a class="code" href="group__DBusConnection.html#ga0d783462274a6c71d3767f5821c29ce9">06057</a> <a class="code" href="group__DBusConnection.html#ga0d783462274a6c71d3767f5821c29ce9" title="Specifies the maximum size message this connection is allowed to receive.">dbus_connection_set_max_message_size</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l06058"></a>06058                                       <span class="keywordtype">long</span>            size)
<a name="l06059"></a>06059 {
<a name="l06060"></a>06060   _dbus_return_if_fail (connection != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l06061"></a>06061   
<a name="l06062"></a>06062   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l06063"></a>06063   <a class="code" href="group__DBusTransport.html#ga03ea875260e71f59af708146cabf95ab" title="See dbus_connection_set_max_message_size().">_dbus_transport_set_max_message_size</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>,
<a name="l06064"></a>06064                                         size);
<a name="l06065"></a>06065   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l06066"></a>06066 }
<a name="l06067"></a>06067 
<a name="l06074"></a>06074 <span class="keywordtype">long</span>
<a name="l06075"></a><a class="code" href="group__DBusConnection.html#ga7a459e64d7dca7b592136cec0a73422c">06075</a> <a class="code" href="group__DBusConnection.html#ga7a459e64d7dca7b592136cec0a73422c" title="Gets the value set by dbus_connection_set_max_message_size().">dbus_connection_get_max_message_size</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l06076"></a>06076 {
<a name="l06077"></a>06077   <span class="keywordtype">long</span> res;
<a name="l06078"></a>06078 
<a name="l06079"></a>06079   _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="l06080"></a>06080   
<a name="l06081"></a>06081   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l06082"></a>06082   res = <a class="code" href="group__DBusTransport.html#gae36d2a90bad6ef13c0379fa9864ff68e" title="See dbus_connection_get_max_message_size().">_dbus_transport_get_max_message_size</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>);
<a name="l06083"></a>06083   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l06084"></a>06084   <span class="keywordflow">return</span> res;
<a name="l06085"></a>06085 }
<a name="l06086"></a>06086 
<a name="l06095"></a>06095 <span class="keywordtype">void</span>
<a name="l06096"></a><a class="code" href="group__DBusConnection.html#ga2aadce7d15c0e11983363912292b3fcd">06096</a> <a class="code" href="group__DBusConnection.html#ga2aadce7d15c0e11983363912292b3fcd" title="Specifies the maximum number of unix fds a message on this connection is allowed to receive...">dbus_connection_set_max_message_unix_fds</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l06097"></a>06097                                           <span class="keywordtype">long</span>            n)
<a name="l06098"></a>06098 {
<a name="l06099"></a>06099   _dbus_return_if_fail (connection != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l06100"></a>06100 
<a name="l06101"></a>06101   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l06102"></a>06102   <a class="code" href="group__DBusTransport.html#gad005fffd646202e74a789765ae82a40f" title="See dbus_connection_set_max_message_unix_fds().">_dbus_transport_set_max_message_unix_fds</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>,
<a name="l06103"></a>06103                                             n);
<a name="l06104"></a>06104   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l06105"></a>06105 }
<a name="l06106"></a>06106 
<a name="l06113"></a>06113 <span class="keywordtype">long</span>
<a name="l06114"></a><a class="code" href="group__DBusConnection.html#ga18abaca9a512dbb7b6f921c3df6875d9">06114</a> <a class="code" href="group__DBusConnection.html#ga18abaca9a512dbb7b6f921c3df6875d9" title="Gets the value set by dbus_connection_set_max_message_unix_fds().">dbus_connection_get_max_message_unix_fds</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l06115"></a>06115 {
<a name="l06116"></a>06116   <span class="keywordtype">long</span> res;
<a name="l06117"></a>06117 
<a name="l06118"></a>06118   _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="l06119"></a>06119 
<a name="l06120"></a>06120   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l06121"></a>06121   res = <a class="code" href="group__DBusTransport.html#gaa28e8edd4d849108b158d95eb7da812d" title="See dbus_connection_get_max_message_unix_fds().">_dbus_transport_get_max_message_unix_fds</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>);
<a name="l06122"></a>06122   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l06123"></a>06123   <span class="keywordflow">return</span> res;
<a name="l06124"></a>06124 }
<a name="l06125"></a>06125 
<a name="l06151"></a>06151 <span class="keywordtype">void</span>
<a name="l06152"></a><a class="code" href="group__DBusConnection.html#ga6565d75f16e6e803372b2ae3d94d991b">06152</a> <a class="code" href="group__DBusConnection.html#ga6565d75f16e6e803372b2ae3d94d991b" title="Sets the maximum total number of bytes that can be used for all messages received on this connection...">dbus_connection_set_max_received_size</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l06153"></a>06153                                        <span class="keywordtype">long</span>            size)
<a name="l06154"></a>06154 {
<a name="l06155"></a>06155   _dbus_return_if_fail (connection != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l06156"></a>06156   
<a name="l06157"></a>06157   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l06158"></a>06158   <a class="code" href="group__DBusTransport.html#ga08e0368732df5f4e58a2c838fe4484f6" title="See dbus_connection_set_max_received_size().">_dbus_transport_set_max_received_size</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>,
<a name="l06159"></a>06159                                          size);
<a name="l06160"></a>06160   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l06161"></a>06161 }
<a name="l06162"></a>06162 
<a name="l06169"></a>06169 <span class="keywordtype">long</span>
<a name="l06170"></a><a class="code" href="group__DBusConnection.html#ga376529acf41d1d34b4f46c0d9d515c85">06170</a> <a class="code" href="group__DBusConnection.html#ga376529acf41d1d34b4f46c0d9d515c85" title="Gets the value set by dbus_connection_set_max_received_size().">dbus_connection_get_max_received_size</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l06171"></a>06171 {
<a name="l06172"></a>06172   <span class="keywordtype">long</span> res;
<a name="l06173"></a>06173 
<a name="l06174"></a>06174   _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="l06175"></a>06175   
<a name="l06176"></a>06176   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l06177"></a>06177   res = <a class="code" href="group__DBusTransport.html#ga8992b33d9060a103bd38705462a0ea96" title="See dbus_connection_get_max_received_size().">_dbus_transport_get_max_received_size</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>);
<a name="l06178"></a>06178   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l06179"></a>06179   <span class="keywordflow">return</span> res;
<a name="l06180"></a>06180 }
<a name="l06181"></a>06181 
<a name="l06193"></a>06193 <span class="keywordtype">void</span>
<a name="l06194"></a><a class="code" href="group__DBusConnection.html#ga81e63dc6d9298e8a7f92c0d93d0e80b3">06194</a> <a class="code" href="group__DBusConnection.html#ga81e63dc6d9298e8a7f92c0d93d0e80b3" title="Sets the maximum total number of unix fds that can be used for all messages received on this connecti...">dbus_connection_set_max_received_unix_fds</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l06195"></a>06195                                            <span class="keywordtype">long</span>            n)
<a name="l06196"></a>06196 {
<a name="l06197"></a>06197   _dbus_return_if_fail (connection != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l06198"></a>06198 
<a name="l06199"></a>06199   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l06200"></a>06200   <a class="code" href="group__DBusTransport.html#gaae297c86eb0b79b6cef4a1f7e4b50356" title="See dbus_connection_set_max_received_unix_fds().">_dbus_transport_set_max_received_unix_fds</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>,
<a name="l06201"></a>06201                                              n);
<a name="l06202"></a>06202   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l06203"></a>06203 }
<a name="l06204"></a>06204 
<a name="l06211"></a>06211 <span class="keywordtype">long</span>
<a name="l06212"></a><a class="code" href="group__DBusConnection.html#ga219f31132338616f82dc975c070ff418">06212</a> <a class="code" href="group__DBusConnection.html#ga219f31132338616f82dc975c070ff418" title="Gets the value set by dbus_connection_set_max_received_unix_fds().">dbus_connection_get_max_received_unix_fds</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l06213"></a>06213 {
<a name="l06214"></a>06214   <span class="keywordtype">long</span> res;
<a name="l06215"></a>06215 
<a name="l06216"></a>06216   _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="l06217"></a>06217 
<a name="l06218"></a>06218   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l06219"></a>06219   res = <a class="code" href="group__DBusTransport.html#gacd0b2e68c65dc3b0c1cfdf3fb8358a44" title="See dbus_connection_set_max_received_unix_fds().">_dbus_transport_get_max_received_unix_fds</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>);
<a name="l06220"></a>06220   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l06221"></a>06221   <span class="keywordflow">return</span> res;
<a name="l06222"></a>06222 }
<a name="l06223"></a>06223 
<a name="l06234"></a>06234 <span class="keywordtype">long</span>
<a name="l06235"></a><a class="code" href="group__DBusConnection.html#ga47aff801f586e7116f9c54532bb1baf9">06235</a> <a class="code" href="group__DBusConnection.html#ga47aff801f586e7116f9c54532bb1baf9" title="Gets the approximate size in bytes of all messages in the outgoing message queue.">dbus_connection_get_outgoing_size</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l06236"></a>06236 {
<a name="l06237"></a>06237   <span class="keywordtype">long</span> res;
<a name="l06238"></a>06238 
<a name="l06239"></a>06239   _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="l06240"></a>06240 
<a name="l06241"></a>06241   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l06242"></a>06242   res = <a class="code" href="group__DBusResources.html#ga49de078fb626aff30f273933ad5c8b2a" title="Gets the current value of the size counter.">_dbus_counter_get_size_value</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a5dcb660883904035076579c6d2f46501" title="Counts size of outgoing messages.">outgoing_counter</a>);
<a name="l06243"></a>06243   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l06244"></a>06244   <span class="keywordflow">return</span> res;
<a name="l06245"></a>06245 }
<a name="l06246"></a>06246 
<a name="l06247"></a>06247 <span class="preprocessor">#ifdef DBUS_ENABLE_STATS</span>
<a name="l06248"></a>06248 <span class="preprocessor"></span><span class="keywordtype">void</span>
<a name="l06249"></a>06249 _dbus_connection_get_stats (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection,
<a name="l06250"></a>06250                             <a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a>  *in_messages,
<a name="l06251"></a>06251                             <a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a>  *in_bytes,
<a name="l06252"></a>06252                             <a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a>  *in_fds,
<a name="l06253"></a>06253                             <a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a>  *in_peak_bytes,
<a name="l06254"></a>06254                             <a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a>  *in_peak_fds,
<a name="l06255"></a>06255                             <a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a>  *out_messages,
<a name="l06256"></a>06256                             <a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a>  *out_bytes,
<a name="l06257"></a>06257                             <a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a>  *out_fds,
<a name="l06258"></a>06258                             <a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a>  *out_peak_bytes,
<a name="l06259"></a>06259                             <a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a>  *out_peak_fds)
<a name="l06260"></a>06260 {
<a name="l06261"></a>06261   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l06262"></a>06262 
<a name="l06263"></a>06263   <span class="keywordflow">if</span> (in_messages != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l06264"></a>06264     *in_messages = connection-&gt;<a class="code" href="structDBusConnection.html#a9bda45f2d5c9af5c187fc31d7c98b424" title="Length of incoming queue.">n_incoming</a>;
<a name="l06265"></a>06265 
<a name="l06266"></a>06266   _dbus_transport_get_stats (connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>,
<a name="l06267"></a>06267                              in_bytes, in_fds, in_peak_bytes, in_peak_fds);
<a name="l06268"></a>06268 
<a name="l06269"></a>06269   <span class="keywordflow">if</span> (out_messages != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l06270"></a>06270     *out_messages = connection-&gt;<a class="code" href="structDBusConnection.html#a07025e177949c5e65d5f983ac5f5e878" title="Length of outgoing queue.">n_outgoing</a>;
<a name="l06271"></a>06271 
<a name="l06272"></a>06272   <span class="keywordflow">if</span> (out_bytes != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l06273"></a>06273     *out_bytes = <a class="code" href="group__DBusResources.html#ga49de078fb626aff30f273933ad5c8b2a" title="Gets the current value of the size counter.">_dbus_counter_get_size_value</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a5dcb660883904035076579c6d2f46501" title="Counts size of outgoing messages.">outgoing_counter</a>);
<a name="l06274"></a>06274 
<a name="l06275"></a>06275   <span class="keywordflow">if</span> (out_fds != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l06276"></a>06276     *out_fds = <a class="code" href="group__DBusResources.html#ga25b2d12b9dc4d3525df2b8401f4ce56d" title="Gets the current value of the unix fd counter.">_dbus_counter_get_unix_fd_value</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a5dcb660883904035076579c6d2f46501" title="Counts size of outgoing messages.">outgoing_counter</a>);
<a name="l06277"></a>06277 
<a name="l06278"></a>06278   <span class="keywordflow">if</span> (out_peak_bytes != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l06279"></a>06279     *out_peak_bytes = _dbus_counter_get_peak_size_value (connection-&gt;<a class="code" href="structDBusConnection.html#a5dcb660883904035076579c6d2f46501" title="Counts size of outgoing messages.">outgoing_counter</a>);
<a name="l06280"></a>06280 
<a name="l06281"></a>06281   <span class="keywordflow">if</span> (out_peak_fds != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l06282"></a>06282     *out_peak_fds = _dbus_counter_get_peak_unix_fd_value (connection-&gt;<a class="code" href="structDBusConnection.html#a5dcb660883904035076579c6d2f46501" title="Counts size of outgoing messages.">outgoing_counter</a>);
<a name="l06283"></a>06283 
<a name="l06284"></a>06284   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l06285"></a>06285 }
<a name="l06286"></a>06286 <span class="preprocessor">#endif </span><span class="comment">/* DBUS_ENABLE_STATS */</span>
<a name="l06287"></a>06287 
<a name="l06295"></a>06295 <span class="keywordtype">long</span>
<a name="l06296"></a><a class="code" href="group__DBusConnection.html#gad218838fdaa8d36c606723c63e96f453">06296</a> <a class="code" href="group__DBusConnection.html#gad218838fdaa8d36c606723c63e96f453" title="Gets the approximate number of uni fds of all messages in the outgoing message queue.">dbus_connection_get_outgoing_unix_fds</a> (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l06297"></a>06297 {
<a name="l06298"></a>06298   <span class="keywordtype">long</span> res;
<a name="l06299"></a>06299 
<a name="l06300"></a>06300   _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="l06301"></a>06301 
<a name="l06302"></a>06302   <a class="code" href="group__DBusPendingCallInternals.html#ga99fcbae5b8f2ed2cc019cab85f63d4e4" title="Internals of DBusPendingCall.">CONNECTION_LOCK</a> (connection);
<a name="l06303"></a>06303   res = <a class="code" href="group__DBusResources.html#ga25b2d12b9dc4d3525df2b8401f4ce56d" title="Gets the current value of the unix fd counter.">_dbus_counter_get_unix_fd_value</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a5dcb660883904035076579c6d2f46501" title="Counts size of outgoing messages.">outgoing_counter</a>);
<a name="l06304"></a>06304   <a class="code" href="group__DBusPendingCallInternals.html#gab21a3014fa3cacf2a580e079321abc33" title="shorter and more visible way to write _dbus_connection_unlock()">CONNECTION_UNLOCK</a> (connection);
<a name="l06305"></a>06305   <span class="keywordflow">return</span> res;
<a name="l06306"></a>06306 }
<a name="l06307"></a>06307 
<a name="l06308"></a>06308 <span class="preprocessor">#ifdef DBUS_ENABLE_EMBEDDED_TESTS</span>
<a name="l06309"></a>06309 <span class="preprocessor"></span>
<a name="l06315"></a>06315 <span class="keyword">const</span> <span class="keywordtype">char</span>*
<a name="l06316"></a>06316 _dbus_connection_get_address (<a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l06317"></a>06317 {
<a name="l06318"></a>06318   <span class="keywordflow">return</span> <a class="code" href="group__DBusTransport.html#gac7e53868392b5e550454f47a1bc0a737" title="Gets the address of a transport.">_dbus_transport_get_address</a> (connection-&gt;<a class="code" href="structDBusConnection.html#a9855f1d7d5404770dd4aa09239c70b3b" title="Object that sends/receives messages over network.">transport</a>);
<a name="l06319"></a>06319 }
<a name="l06320"></a>06320 <span class="preprocessor">#endif</span>
<a name="l06321"></a>06321 <span class="preprocessor"></span>
</pre></div></div><!-- contents -->


<hr class="footer"/><address class="footer"><small>
Generated on Thu Mar 3 2016 17:50:30 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>