Current File : //usr/share/doc/dbus/api/dbus-message_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-message.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-message.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-message.c  DBusMessage object</span>
<a name="l00003"></a>00003 <span class="comment"> *</span>
<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002, 2003, 2004, 2005  Red Hat Inc.</span>
<a name="l00005"></a>00005 <span class="comment"> * Copyright (C) 2002, 2003  CodeFactory AB</span>
<a name="l00006"></a>00006 <span class="comment"> *</span>
<a name="l00007"></a>00007 <span class="comment"> * Licensed under the Academic Free License version 2.1</span>
<a name="l00008"></a>00008 <span class="comment"> *</span>
<a name="l00009"></a>00009 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
<a name="l00010"></a>00010 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
<a name="l00011"></a>00011 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
<a name="l00012"></a>00012 <span class="comment"> * (at your option) any later version.</span>
<a name="l00013"></a>00013 <span class="comment"> *</span>
<a name="l00014"></a>00014 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
<a name="l00015"></a>00015 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00016"></a>00016 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
<a name="l00017"></a>00017 <span class="comment"> * GNU General Public License for more details.</span>
<a name="l00018"></a>00018 <span class="comment"> *</span>
<a name="l00019"></a>00019 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
<a name="l00020"></a>00020 <span class="comment"> * along with this program; if not, write to the Free Software</span>
<a name="l00021"></a>00021 <span class="comment"> * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA</span>
<a name="l00022"></a>00022 <span class="comment"> *</span>
<a name="l00023"></a>00023 <span class="comment"> */</span>
<a name="l00024"></a>00024 
<a name="l00025"></a>00025 <span class="preprocessor">#include &lt;config.h&gt;</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include &quot;dbus-internals.h&quot;</span>
<a name="l00027"></a>00027 <span class="preprocessor">#include &quot;dbus-marshal-recursive.h&quot;</span>
<a name="l00028"></a>00028 <span class="preprocessor">#include &quot;dbus-marshal-validate.h&quot;</span>
<a name="l00029"></a>00029 <span class="preprocessor">#include &quot;dbus-marshal-byteswap.h&quot;</span>
<a name="l00030"></a>00030 <span class="preprocessor">#include &quot;dbus-marshal-header.h&quot;</span>
<a name="l00031"></a>00031 <span class="preprocessor">#include &quot;dbus-signature.h&quot;</span>
<a name="l00032"></a>00032 <span class="preprocessor">#include &quot;dbus-message-private.h&quot;</span>
<a name="l00033"></a>00033 <span class="preprocessor">#include &quot;dbus-object-tree.h&quot;</span>
<a name="l00034"></a>00034 <span class="preprocessor">#include &quot;dbus-memory.h&quot;</span>
<a name="l00035"></a>00035 <span class="preprocessor">#include &quot;dbus-list.h&quot;</span>
<a name="l00036"></a>00036 <span class="preprocessor">#include &quot;dbus-threads-internal.h&quot;</span>
<a name="l00037"></a>00037 <span class="preprocessor">#ifdef HAVE_UNIX_FD_PASSING</span>
<a name="l00038"></a>00038 <span class="preprocessor"></span><span class="preprocessor">#include &quot;dbus-sysdeps.h&quot;</span>
<a name="l00039"></a>00039 <span class="preprocessor">#include &quot;dbus-sysdeps-unix.h&quot;</span>
<a name="l00040"></a>00040 <span class="preprocessor">#endif</span>
<a name="l00041"></a>00041 <span class="preprocessor"></span>
<a name="l00042"></a>00042 <span class="preprocessor">#include &lt;string.h&gt;</span>
<a name="l00043"></a>00043 
<a name="l00044"></a>00044 <span class="preprocessor">#define _DBUS_TYPE_IS_STRINGLIKE(type) \</span>
<a name="l00045"></a>00045 <span class="preprocessor">  (type == DBUS_TYPE_STRING || type == DBUS_TYPE_SIGNATURE || \</span>
<a name="l00046"></a>00046 <span class="preprocessor">   type == DBUS_TYPE_OBJECT_PATH)</span>
<a name="l00047"></a>00047 <span class="preprocessor"></span>
<a name="l00048"></a>00048 <span class="keyword">static</span> <span class="keywordtype">void</span> dbus_message_finalize (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message);
<a name="l00049"></a>00049 
<a name="l00060"></a>00060 <span class="preprocessor">#ifdef DBUS_ENABLE_EMBEDDED_TESTS</span>
<a name="l00061"></a>00061 <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>
<a name="l00062"></a>00062 _dbus_enable_message_cache (<span class="keywordtype">void</span>)
<a name="l00063"></a>00063 {
<a name="l00064"></a>00064   <span class="keyword">static</span> <span class="keywordtype">int</span> enabled = -1;
<a name="l00065"></a>00065 
<a name="l00066"></a>00066   <span class="keywordflow">if</span> (enabled &lt; 0)
<a name="l00067"></a>00067     {
<a name="l00068"></a>00068       <span class="keyword">const</span> <span class="keywordtype">char</span> *s = <a class="code" href="group__DBusSysdeps.html#gab846071a4de54cb7e518654f9375313a" title="Wrapper for getenv().">_dbus_getenv</a> (<span class="stringliteral">&quot;DBUS_MESSAGE_CACHE&quot;</span>);
<a name="l00069"></a>00069 
<a name="l00070"></a>00070       enabled = <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l00071"></a>00071 
<a name="l00072"></a>00072       <span class="keywordflow">if</span> (s &amp;&amp; *s)
<a name="l00073"></a>00073         {
<a name="l00074"></a>00074           <span class="keywordflow">if</span> (*s == <span class="charliteral">&#39;0&#39;</span>)
<a name="l00075"></a>00075             enabled = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00076"></a>00076           <span class="keywordflow">else</span> <span class="keywordflow">if</span> (*s == <span class="charliteral">&#39;1&#39;</span>)
<a name="l00077"></a>00077             enabled = <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l00078"></a>00078           <span class="keywordflow">else</span>
<a name="l00079"></a>00079             <a class="code" href="group__DBusInternalsUtils.html#gabea2c16d6d3fe7c4eb5b9496fc877f84" title="Prints a warning message to stderr.">_dbus_warn</a> (<span class="stringliteral">&quot;DBUS_MESSAGE_CACHE should be 0 or 1 if set, not &#39;%s&#39;&quot;</span>,
<a name="l00080"></a>00080                 s);
<a name="l00081"></a>00081         }
<a name="l00082"></a>00082     }
<a name="l00083"></a>00083 
<a name="l00084"></a>00084   <span class="keywordflow">return</span> enabled;
<a name="l00085"></a>00085 }
<a name="l00086"></a>00086 <span class="preprocessor">#else</span>
<a name="l00087"></a>00087 <span class="preprocessor"></span>    <span class="comment">/* constant expression, should be optimized away */</span>
<a name="l00088"></a>00088 <span class="preprocessor">#   define _dbus_enable_message_cache() (TRUE)</span>
<a name="l00089"></a>00089 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00090"></a>00090 <span class="preprocessor"></span>
<a name="l00091"></a>00091 <span class="preprocessor">#ifndef _dbus_message_trace_ref</span>
<a name="l00092"></a>00092 <span class="preprocessor"></span><span class="keywordtype">void</span>
<a name="l00093"></a>00093 _dbus_message_trace_ref (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message,
<a name="l00094"></a>00094                          <span class="keywordtype">int</span>          old_refcount,
<a name="l00095"></a>00095                          <span class="keywordtype">int</span>          new_refcount,
<a name="l00096"></a>00096                          <span class="keyword">const</span> <span class="keywordtype">char</span>  *why)
<a name="l00097"></a>00097 {
<a name="l00098"></a>00098   <span class="keyword">static</span> <span class="keywordtype">int</span> enabled = -1;
<a name="l00099"></a>00099 
<a name="l00100"></a>00100   _dbus_trace_ref (<span class="stringliteral">&quot;DBusMessage&quot;</span>, message, old_refcount, new_refcount, why,
<a name="l00101"></a>00101       <span class="stringliteral">&quot;DBUS_MESSAGE_TRACE&quot;</span>, &amp;enabled);
<a name="l00102"></a>00102 }
<a name="l00103"></a>00103 <span class="preprocessor">#endif</span>
<a name="l00104"></a>00104 <span class="preprocessor"></span>
<a name="l00105"></a>00105 <span class="comment">/* Not thread locked, but strictly const/read-only so should be OK</span>
<a name="l00106"></a>00106 <span class="comment"> */</span>
<a name="l00108"></a>00108 <a class="code" href="group__DBusMarshal.html#gab49ca4819ef45b26463427bb09060844" title="Static DBusString containing the signature of a message header.">_DBUS_STRING_DEFINE_STATIC</a>(_dbus_empty_signature_str,  <span class="stringliteral">&quot;&quot;</span>);
<a name="l00109"></a>00109 
<a name="l00110"></a>00110 <span class="comment">/* these have wacky values to help trap uninitialized iterators;</span>
<a name="l00111"></a>00111 <span class="comment"> * but has to fit in 3 bits</span>
<a name="l00112"></a>00112 <span class="comment"> */</span>
<a name="l00113"></a>00113 <span class="keyword">enum</span> {
<a name="l00114"></a>00114   DBUS_MESSAGE_ITER_TYPE_READER = 3,
<a name="l00115"></a>00115   DBUS_MESSAGE_ITER_TYPE_WRITER = 7
<a name="l00116"></a>00116 };
<a name="l00117"></a>00117 
<a name="l00119"></a><a class="code" href="group__DBusMessageInternals.html#ga84c2bf86d0ab364b236814eafb85e512">00119</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> <a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a>;
<a name="l00120"></a>00120 
<a name="l00126"></a><a class="code" href="structDBusMessageRealIter.html">00126</a> <span class="keyword">struct </span><a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a>
<a name="l00127"></a>00127 {
<a name="l00128"></a><a class="code" href="structDBusMessageRealIter.html#a552cb582c65645ed46d9d1ad38ece3c7">00128</a>   <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *<a class="code" href="structDBusMessageRealIter.html#a552cb582c65645ed46d9d1ad38ece3c7" title="Message used.">message</a>; 
<a name="l00129"></a><a class="code" href="structDBusMessageRealIter.html#ac10324f74497a5c2288eef8fbcd3ae42">00129</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="structDBusMessageRealIter.html#ac10324f74497a5c2288eef8fbcd3ae42" title="stamp to detect invalid iters">changed_stamp</a> : <a class="code" href="group__DBusMessageInternals.html#ga660989658f3be5e403da430f63afd0b7" title="How many bits are in the changed_stamp used to validate iterators.">CHANGED_STAMP_BITS</a>; 
<a name="l00130"></a><a class="code" href="structDBusMessageRealIter.html#a835b7990b2909beb06fc2dc38b76a089">00130</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="structDBusMessageRealIter.html#a835b7990b2909beb06fc2dc38b76a089" title="whether this is a reader or writer iter">iter_type</a> : 3;      
<a name="l00131"></a><a class="code" href="structDBusMessageRealIter.html#a93789e6f814d55b5952fee34d286f6d6">00131</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="structDBusMessageRealIter.html#a93789e6f814d55b5952fee34d286f6d6" title="depth of open_signature()">sig_refcount</a> : 8;   
<a name="l00132"></a>00132   <span class="keyword">union</span>
<a name="l00133"></a>00133   {
<a name="l00134"></a><a class="code" href="structDBusMessageRealIter.html#a93bc11bb1521743170b0b411b32140cf">00134</a>     <a class="code" href="structDBusTypeWriter.html" title="The type writer is an iterator for writing to a block of values.">DBusTypeWriter</a> <a class="code" href="structDBusMessageRealIter.html#a93bc11bb1521743170b0b411b32140cf" title="writer">writer</a>; 
<a name="l00135"></a><a class="code" href="structDBusMessageRealIter.html#ae5c4e45b0a5d6642850144f642d7db67">00135</a>     <a class="code" href="structDBusTypeReader.html" title="The type reader is an iterator for reading values from a block of values.">DBusTypeReader</a> <a class="code" href="structDBusMessageRealIter.html#ae5c4e45b0a5d6642850144f642d7db67" title="reader">reader</a>; 
<a name="l00136"></a>00136   } <a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>; 
<a name="l00137"></a>00137 };
<a name="l00138"></a>00138 
<a name="l00139"></a>00139 <span class="keyword">static</span> <span class="keywordtype">void</span>
<a name="l00140"></a>00140 get_const_signature (<a class="code" href="structDBusHeader.html" title="Message header data and some cached details of it.">DBusHeader</a>        *header,
<a name="l00141"></a>00141                      <span class="keyword">const</span> <a class="code" href="structDBusString.html">DBusString</a> **type_str_p,
<a name="l00142"></a>00142                      <span class="keywordtype">int</span>               *type_pos_p)
<a name="l00143"></a>00143 {
<a name="l00144"></a>00144   <span class="keywordflow">if</span> (<a class="code" href="group__DBusMarshal.html#gaf4661ba8e7067f349ba03c9f5776bbb0" title="Gets the raw marshaled data for a field.">_dbus_header_get_field_raw</a> (header,
<a name="l00145"></a>00145                                   <a class="code" href="group__DBusProtocol.html#ga450d63fa110d3cb891082e23291580b4" title="Header field code for the type signature of a message.">DBUS_HEADER_FIELD_SIGNATURE</a>,
<a name="l00146"></a>00146                                   type_str_p,
<a name="l00147"></a>00147                                   type_pos_p))
<a name="l00148"></a>00148     {
<a name="l00149"></a>00149       *type_pos_p += 1; <span class="comment">/* skip the signature length which is 1 byte */</span>
<a name="l00150"></a>00150     }
<a name="l00151"></a>00151   <span class="keywordflow">else</span>
<a name="l00152"></a>00152     {
<a name="l00153"></a>00153       *type_str_p = &amp;_dbus_empty_signature_str;
<a name="l00154"></a>00154       *type_pos_p = 0;
<a name="l00155"></a>00155     }
<a name="l00156"></a>00156 }
<a name="l00157"></a>00157 
<a name="l00163"></a>00163 <span class="keyword">static</span> <span class="keywordtype">void</span>
<a name="l00164"></a>00164 _dbus_message_byteswap (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message)
<a name="l00165"></a>00165 {
<a name="l00166"></a>00166   <span class="keyword">const</span> <a class="code" href="structDBusString.html">DBusString</a> *type_str;
<a name="l00167"></a>00167   <span class="keywordtype">int</span> type_pos;
<a name="l00168"></a>00168   <span class="keywordtype">char</span> byte_order;
<a name="l00169"></a>00169 
<a name="l00170"></a>00170   byte_order = <a class="code" href="group__DBusMarshal.html#ga65c023673b837c27e8ccda5c2528d806" title="Returns the header&#39;s byte order.">_dbus_header_get_byte_order</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>);
<a name="l00171"></a>00171 
<a name="l00172"></a>00172   <span class="keywordflow">if</span> (byte_order == DBUS_COMPILER_BYTE_ORDER)
<a name="l00173"></a>00173     <span class="keywordflow">return</span>;
<a name="l00174"></a>00174 
<a name="l00175"></a>00175   _dbus_verbose (<span class="stringliteral">&quot;Swapping message into compiler byte order\n&quot;</span>);
<a name="l00176"></a>00176   
<a name="l00177"></a>00177   get_const_signature (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>, &amp;type_str, &amp;type_pos);
<a name="l00178"></a>00178   
<a name="l00179"></a>00179   <a class="code" href="group__DBusMarshal.html#ga609a4b8c0b65096890766fda73a4c40f" title="Byteswaps the marshaled data in the given value_str.">_dbus_marshal_byteswap</a> (type_str, type_pos,
<a name="l00180"></a>00180                           byte_order,
<a name="l00181"></a>00181                           DBUS_COMPILER_BYTE_ORDER,
<a name="l00182"></a>00182                           &amp;message-&gt;<a class="code" href="structDBusMessage.html#a0b9d14d6e0529f0ec2e3c0087fe62a9e" title="Body network data.">body</a>, 0);
<a name="l00183"></a>00183 
<a name="l00184"></a>00184   <a class="code" href="group__DBusMarshal.html#gae5277c7b7bfb7b85e421baceac0398c8" title="Swaps the header into the given order if required.">_dbus_header_byteswap</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>, DBUS_COMPILER_BYTE_ORDER);
<a name="l00185"></a>00185   _dbus_assert (<a class="code" href="group__DBusMarshal.html#ga65c023673b837c27e8ccda5c2528d806" title="Returns the header&#39;s byte order.">_dbus_header_get_byte_order</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>) ==
<a name="l00186"></a>00186                 DBUS_COMPILER_BYTE_ORDER);
<a name="l00187"></a>00187 }
<a name="l00188"></a>00188 
<a name="l00195"></a><a class="code" href="group__DBusMessageInternals.html#ga1dfae386ef0d4d808584abeafc44e8ca">00195</a> <span class="preprocessor">#define ensure_byte_order(message) _dbus_message_byteswap (message)</span>
<a name="l00196"></a>00196 <span class="preprocessor"></span>
<a name="l00207"></a>00207 <span class="keywordtype">void</span>
<a name="l00208"></a><a class="code" href="group__DBusMessageInternals.html#ga617811b117ac5eb31151ffb7dabea7a8">00208</a> <a class="code" href="group__DBusMessageInternals.html#ga617811b117ac5eb31151ffb7dabea7a8" title="Gets the data to be sent over the network for this message.">_dbus_message_get_network_data</a> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>          *message,
<a name="l00209"></a>00209                                 <span class="keyword">const</span> <a class="code" href="structDBusString.html">DBusString</a>    **header,
<a name="l00210"></a>00210                                 <span class="keyword">const</span> <a class="code" href="structDBusString.html">DBusString</a>    **body)
<a name="l00211"></a>00211 {
<a name="l00212"></a>00212   _dbus_assert (message-&gt;<a class="code" href="structDBusMessage.html#ac926e7027f22608d75a6dfe18680b9e7" title="Message being sent, no modifications allowed.">locked</a>);
<a name="l00213"></a>00213 
<a name="l00214"></a>00214   *header = &amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>.<a class="code" href="structDBusHeader.html#a67df8bff43c10e2d4f6ae36b56ee5814" title="Header network data, stored separately from body so we can independently realloc it.">data</a>;
<a name="l00215"></a>00215   *body = &amp;message-&gt;<a class="code" href="structDBusMessage.html#a0b9d14d6e0529f0ec2e3c0087fe62a9e" title="Body network data.">body</a>;
<a name="l00216"></a>00216 }
<a name="l00217"></a>00217 
<a name="l00227"></a><a class="code" href="group__DBusMessageInternals.html#ga577e9d5224c56b9cf2ca2691be2e838c">00227</a> <span class="keywordtype">void</span> <a class="code" href="group__DBusMessageInternals.html#ga577e9d5224c56b9cf2ca2691be2e838c" title="Gets the unix fds to be sent over the network for this message.">_dbus_message_get_unix_fds</a>(<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message,
<a name="l00228"></a>00228                                 <span class="keyword">const</span> <span class="keywordtype">int</span>  **fds,
<a name="l00229"></a>00229                                 <span class="keywordtype">unsigned</span>    *n_fds)
<a name="l00230"></a>00230 {
<a name="l00231"></a>00231   _dbus_assert (message-&gt;<a class="code" href="structDBusMessage.html#ac926e7027f22608d75a6dfe18680b9e7" title="Message being sent, no modifications allowed.">locked</a>);
<a name="l00232"></a>00232 
<a name="l00233"></a>00233 <span class="preprocessor">#ifdef HAVE_UNIX_FD_PASSING</span>
<a name="l00234"></a>00234 <span class="preprocessor"></span>  *fds = message-&gt;unix_fds;
<a name="l00235"></a>00235   *n_fds = message-&gt;n_unix_fds;
<a name="l00236"></a>00236 <span class="preprocessor">#else</span>
<a name="l00237"></a>00237 <span class="preprocessor"></span>  *fds = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00238"></a>00238   *n_fds = 0;
<a name="l00239"></a>00239 <span class="preprocessor">#endif</span>
<a name="l00240"></a>00240 <span class="preprocessor"></span>}
<a name="l00241"></a>00241 
<a name="l00253"></a>00253 <span class="keywordtype">void</span> 
<a name="l00254"></a><a class="code" href="group__DBusMessage.html#gaa35c17742d8fe091aa039cbd29961c52">00254</a> <a class="code" href="group__DBusMessageInternals.html#ga3dd30a62c63eb9972cc0c564f2a89c3b" title="Sets the serial number of a message.">dbus_message_set_serial</a> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>   *message,
<a name="l00255"></a>00255                          <a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a>  serial)
<a name="l00256"></a>00256 {
<a name="l00257"></a>00257   _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="l00258"></a>00258   _dbus_return_if_fail (!message-&gt;<a class="code" href="structDBusMessage.html#ac926e7027f22608d75a6dfe18680b9e7" title="Message being sent, no modifications allowed.">locked</a>);
<a name="l00259"></a>00259 
<a name="l00260"></a>00260   <a class="code" href="group__DBusMarshal.html#gad92e0b1992cf96a4da642a4a54a5d26d" title="Sets the serial number of a header.">_dbus_header_set_serial</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>, serial);
<a name="l00261"></a>00261 }
<a name="l00262"></a>00262 
<a name="l00279"></a>00279 <span class="keywordtype">void</span>
<a name="l00280"></a><a class="code" href="group__DBusMessageInternals.html#gafaed2adc00b2ec54b2827ecb778bbe7e">00280</a> <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> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>  *message,
<a name="l00281"></a>00281                                 <a class="code" href="structDBusList.html" title="A node in a linked list.">DBusList</a>     *link)
<a name="l00282"></a>00282 {
<a name="l00283"></a>00283   <span class="comment">/* right now we don&#39;t recompute the delta when message</span>
<a name="l00284"></a>00284 <span class="comment">   * size changes, and that&#39;s OK for current purposes</span>
<a name="l00285"></a>00285 <span class="comment">   * I think, but could be important to change later.</span>
<a name="l00286"></a>00286 <span class="comment">   * Do recompute it whenever there are no outstanding counters,</span>
<a name="l00287"></a>00287 <span class="comment">   * since it&#39;s basically free.</span>
<a name="l00288"></a>00288 <span class="comment">   */</span>
<a name="l00289"></a>00289   <span class="keywordflow">if</span> (message-&gt;<a class="code" href="structDBusMessage.html#ac6fc05ddffb11ac60b9da046abd2dc52" title="0-N DBusCounter used to track message size/unix fds.">counters</a> == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00290"></a>00290     {
<a name="l00291"></a>00291       message-&gt;<a class="code" href="structDBusMessage.html#ab8f43d40fa870f97f1126256568cec61" title="Size we incremented the size counters by.">size_counter_delta</a> =
<a name="l00292"></a>00292         <a class="code" href="group__DBusString.html#gaa5136e6fd2c5188f4b88de7863369c6d" title="Gets the length of a string (not including nul termination).">_dbus_string_get_length</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>.<a class="code" href="structDBusHeader.html#a67df8bff43c10e2d4f6ae36b56ee5814" title="Header network data, stored separately from body so we can independently realloc it.">data</a>) +
<a name="l00293"></a>00293         <a class="code" href="group__DBusString.html#gaa5136e6fd2c5188f4b88de7863369c6d" title="Gets the length of a string (not including nul termination).">_dbus_string_get_length</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a0b9d14d6e0529f0ec2e3c0087fe62a9e" title="Body network data.">body</a>);
<a name="l00294"></a>00294 
<a name="l00295"></a>00295 <span class="preprocessor">#ifdef HAVE_UNIX_FD_PASSING</span>
<a name="l00296"></a>00296 <span class="preprocessor"></span>      message-&gt;unix_fd_counter_delta = message-&gt;n_unix_fds;
<a name="l00297"></a>00297 <span class="preprocessor">#endif</span>
<a name="l00298"></a>00298 <span class="preprocessor"></span>
<a name="l00299"></a>00299 <span class="preprocessor">#if 0</span>
<a name="l00300"></a>00300 <span class="preprocessor"></span>      _dbus_verbose (<span class="stringliteral">&quot;message has size %ld\n&quot;</span>,
<a name="l00301"></a>00301                      message-&gt;<a class="code" href="structDBusMessage.html#ab8f43d40fa870f97f1126256568cec61" title="Size we incremented the size counters by.">size_counter_delta</a>);
<a name="l00302"></a>00302 <span class="preprocessor">#endif</span>
<a name="l00303"></a>00303 <span class="preprocessor"></span>    }
<a name="l00304"></a>00304 
<a name="l00305"></a>00305   <a class="code" href="group__DBusList.html#ga20e549175e2b8f450f907592dc39d953" title="Appends a link to the list.">_dbus_list_append_link</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#ac6fc05ddffb11ac60b9da046abd2dc52" title="0-N DBusCounter used to track message size/unix fds.">counters</a>, link);
<a name="l00306"></a>00306 
<a name="l00307"></a>00307   <a class="code" href="group__DBusResources.html#gae37410c196947675c2a222a7979e9dee" title="Adjusts the value of the size counter by the given delta which may be positive or negative...">_dbus_counter_adjust_size</a> (link-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a>, message-&gt;<a class="code" href="structDBusMessage.html#ab8f43d40fa870f97f1126256568cec61" title="Size we incremented the size counters by.">size_counter_delta</a>);
<a name="l00308"></a>00308 
<a name="l00309"></a>00309 <span class="preprocessor">#ifdef HAVE_UNIX_FD_PASSING</span>
<a name="l00310"></a>00310 <span class="preprocessor"></span>  <a class="code" href="group__DBusResources.html#ga7d9411d27b337289ab5648beb148cde6" title="Adjusts the value of the unix fd counter by the given delta which may be positive or negative...">_dbus_counter_adjust_unix_fd</a> (link-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a>, message-&gt;unix_fd_counter_delta);
<a name="l00311"></a>00311 <span class="preprocessor">#endif</span>
<a name="l00312"></a>00312 <span class="preprocessor"></span>}
<a name="l00313"></a>00313 
<a name="l00328"></a>00328 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l00329"></a><a class="code" href="group__DBusMessageInternals.html#gad009d79879d654a009c83627726435d8">00329</a> <a class="code" href="group__DBusMessageInternals.html#gad009d79879d654a009c83627726435d8" 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</a> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message,
<a name="l00330"></a>00330                            <a class="code" href="structDBusCounter.html" title="Internals of DBusCounter.">DBusCounter</a> *counter)
<a name="l00331"></a>00331 {
<a name="l00332"></a>00332   <a class="code" href="structDBusList.html" title="A node in a linked list.">DBusList</a> *link;
<a name="l00333"></a>00333 
<a name="l00334"></a>00334   link = <a class="code" href="group__DBusList.html#gac20b9981531cef590d49a59240344cd8" title="Allocates a linked list node.">_dbus_list_alloc_link</a> (counter);
<a name="l00335"></a>00335   <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="l00336"></a>00336     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00337"></a>00337 
<a name="l00338"></a>00338   <a class="code" href="group__DBusResources.html#gae93240c77bfb66642453518c9bb90bc4" title="Increments refcount of the counter.">_dbus_counter_ref</a> (counter);
<a name="l00339"></a>00339   <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, link);
<a name="l00340"></a>00340 
<a name="l00341"></a>00341   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l00342"></a>00342 }
<a name="l00343"></a>00343 
<a name="l00351"></a>00351 <span class="keywordtype">void</span>
<a name="l00352"></a><a class="code" href="group__DBusMessageInternals.html#gac84be3fd98e49409c1245a87c7de6f7d">00352</a> <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> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>  *message,
<a name="l00353"></a>00353                               <a class="code" href="structDBusCounter.html" title="Internals of DBusCounter.">DBusCounter</a>  *counter)
<a name="l00354"></a>00354 {
<a name="l00355"></a>00355   <a class="code" href="structDBusList.html" title="A node in a linked list.">DBusList</a> *link;
<a name="l00356"></a>00356 
<a name="l00357"></a>00357   link = <a class="code" href="group__DBusList.html#ga5929ad5253d2f538158e513e9df3002b" title="Finds a value in the list.">_dbus_list_find_last</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#ac6fc05ddffb11ac60b9da046abd2dc52" title="0-N DBusCounter used to track message size/unix fds.">counters</a>,
<a name="l00358"></a>00358                                counter);
<a name="l00359"></a>00359   _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="l00360"></a>00360 
<a name="l00361"></a>00361   <a class="code" href="group__DBusList.html#ga40abea762d9cb44e5ec6b31b1769dc2e" title="Removes a link from the list.">_dbus_list_remove_link</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#ac6fc05ddffb11ac60b9da046abd2dc52" title="0-N DBusCounter used to track message size/unix fds.">counters</a>, link);
<a name="l00362"></a>00362 
<a name="l00363"></a>00363   <a class="code" href="group__DBusResources.html#gae37410c196947675c2a222a7979e9dee" title="Adjusts the value of the size counter by the given delta which may be positive or negative...">_dbus_counter_adjust_size</a> (counter, - message-&gt;<a class="code" href="structDBusMessage.html#ab8f43d40fa870f97f1126256568cec61" title="Size we incremented the size counters by.">size_counter_delta</a>);
<a name="l00364"></a>00364 
<a name="l00365"></a>00365 <span class="preprocessor">#ifdef HAVE_UNIX_FD_PASSING</span>
<a name="l00366"></a>00366 <span class="preprocessor"></span>  <a class="code" href="group__DBusResources.html#ga7d9411d27b337289ab5648beb148cde6" title="Adjusts the value of the unix fd counter by the given delta which may be positive or negative...">_dbus_counter_adjust_unix_fd</a> (counter, - message-&gt;unix_fd_counter_delta);
<a name="l00367"></a>00367 <span class="preprocessor">#endif</span>
<a name="l00368"></a>00368 <span class="preprocessor"></span>
<a name="l00369"></a>00369   <a class="code" href="group__DBusResources.html#gab8c0e970e0c3b4696ba06723639d8239" title="Calls the notify function from _dbus_counter_set_notify(), if that function has been specified and th...">_dbus_counter_notify</a> (counter);
<a name="l00370"></a>00370   <a class="code" href="group__DBusResources.html#ga48d9b53d1a395ab3c4f1846ca569ef3f" title="Decrements refcount of the counter and possibly finalizes the counter.">_dbus_counter_unref</a> (counter);
<a name="l00371"></a>00371 }
<a name="l00372"></a>00372 
<a name="l00383"></a>00383 <span class="keywordtype">void</span>
<a name="l00384"></a><a class="code" href="group__DBusMessage.html#gad3d6b8ec4745ec19f57cae07621f3a47">00384</a> <a class="code" href="group__DBusMessageInternals.html#ga3ecc9c24381af05289161f477ad6a578" title="Locks a message.">dbus_message_lock</a> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>  *message)
<a name="l00385"></a>00385 {
<a name="l00386"></a>00386   <span class="keywordflow">if</span> (!message-&gt;<a class="code" href="structDBusMessage.html#ac926e7027f22608d75a6dfe18680b9e7" title="Message being sent, no modifications allowed.">locked</a>)
<a name="l00387"></a>00387     {
<a name="l00388"></a>00388       <a class="code" href="group__DBusMarshal.html#ga0cff04252f97f6a25552c368199897f5" title="Fills in the correct body length.">_dbus_header_update_lengths</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>,
<a name="l00389"></a>00389                                    <a class="code" href="group__DBusString.html#gaa5136e6fd2c5188f4b88de7863369c6d" title="Gets the length of a string (not including nul termination).">_dbus_string_get_length</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a0b9d14d6e0529f0ec2e3c0087fe62a9e" title="Body network data.">body</a>));
<a name="l00390"></a>00390 
<a name="l00391"></a>00391       <span class="comment">/* must have a signature if you have a body */</span>
<a name="l00392"></a>00392       _dbus_assert (<a class="code" href="group__DBusString.html#gaa5136e6fd2c5188f4b88de7863369c6d" title="Gets the length of a string (not including nul termination).">_dbus_string_get_length</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a0b9d14d6e0529f0ec2e3c0087fe62a9e" title="Body network data.">body</a>) == 0 ||
<a name="l00393"></a>00393                     <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 class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l00394"></a>00394 
<a name="l00395"></a>00395       message-&gt;<a class="code" href="structDBusMessage.html#ac926e7027f22608d75a6dfe18680b9e7" title="Message being sent, no modifications allowed.">locked</a> = <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l00396"></a>00396     }
<a name="l00397"></a>00397 }
<a name="l00398"></a>00398 
<a name="l00399"></a>00399 <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="l00400"></a>00400 set_or_delete_string_field (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message,
<a name="l00401"></a>00401                             <span class="keywordtype">int</span>          field,
<a name="l00402"></a>00402                             <span class="keywordtype">int</span>          typecode,
<a name="l00403"></a>00403                             <span class="keyword">const</span> <span class="keywordtype">char</span>  *value)
<a name="l00404"></a>00404 {
<a name="l00405"></a>00405   <span class="keywordflow">if</span> (value == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00406"></a>00406     <span class="keywordflow">return</span> <a class="code" href="group__DBusMarshal.html#ga7814248f4d74d109d29dc00487cd9b0c" title="Deletes a field, if it exists.">_dbus_header_delete_field</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>, field);
<a name="l00407"></a>00407   <span class="keywordflow">else</span>
<a name="l00408"></a>00408     <span class="keywordflow">return</span> <a class="code" href="group__DBusMarshal.html#ga4349de00b7754a337526e36fda133464" title="Sets the value of a field with basic type.">_dbus_header_set_field_basic</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>,
<a name="l00409"></a>00409                                          field,
<a name="l00410"></a>00410                                          typecode,
<a name="l00411"></a>00411                                          &amp;value);
<a name="l00412"></a>00412 }
<a name="l00413"></a>00413 
<a name="l00414"></a>00414 <span class="preprocessor">#if 0</span>
<a name="l00415"></a>00415 <span class="preprocessor"></span><span class="comment">/* Probably we don&#39;t need to use this */</span>
<a name="l00439"></a>00439 <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="l00440"></a>00440 _dbus_message_set_signature (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message,
<a name="l00441"></a>00441                              <span class="keyword">const</span> <span class="keywordtype">char</span>  *signature)
<a name="l00442"></a>00442 {
<a name="l00443"></a>00443   _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="l00444"></a>00444   _dbus_return_val_if_fail (!message-&gt;<a class="code" href="structDBusMessage.html#ac926e7027f22608d75a6dfe18680b9e7" title="Message being sent, no modifications allowed.">locked</a>, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l00445"></a>00445   _dbus_return_val_if_fail (signature == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a> ||
<a name="l00446"></a>00446                             _dbus_check_is_valid_signature (signature));
<a name="l00447"></a>00447   <span class="comment">/* can&#39;t delete the signature if you have a message body */</span>
<a name="l00448"></a>00448   _dbus_return_val_if_fail (<a class="code" href="group__DBusString.html#gaa5136e6fd2c5188f4b88de7863369c6d" title="Gets the length of a string (not including nul termination).">_dbus_string_get_length</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a0b9d14d6e0529f0ec2e3c0087fe62a9e" title="Body network data.">body</a>) == 0 ||
<a name="l00449"></a>00449                             signature != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l00450"></a>00450 
<a name="l00451"></a>00451   <span class="keywordflow">return</span> set_or_delete_string_field (message,
<a name="l00452"></a>00452                                      <a class="code" href="group__DBusProtocol.html#ga450d63fa110d3cb891082e23291580b4" title="Header field code for the type signature of a message.">DBUS_HEADER_FIELD_SIGNATURE</a>,
<a name="l00453"></a>00453                                      <a class="code" href="group__DBusProtocol.html#ga26ed6c20c3d9f0b50ea0a1cf80be3279" title="Type code marking a D-Bus type signature.">DBUS_TYPE_SIGNATURE</a>,
<a name="l00454"></a>00454                                      signature);
<a name="l00455"></a>00455 }
<a name="l00456"></a>00456 <span class="preprocessor">#endif</span>
<a name="l00457"></a>00457 <span class="preprocessor"></span>
<a name="l00458"></a>00458 <span class="comment">/* Message Cache</span>
<a name="l00459"></a>00459 <span class="comment"> *</span>
<a name="l00460"></a>00460 <span class="comment"> * We cache some DBusMessage to reduce the overhead of allocating</span>
<a name="l00461"></a>00461 <span class="comment"> * them.  In my profiling this consistently made about an 8%</span>
<a name="l00462"></a>00462 <span class="comment"> * difference.  It avoids the malloc for the message, the malloc for</span>
<a name="l00463"></a>00463 <span class="comment"> * the slot list, the malloc for the header string and body string,</span>
<a name="l00464"></a>00464 <span class="comment"> * and the associated free() calls. It does introduce another global</span>
<a name="l00465"></a>00465 <span class="comment"> * lock which could be a performance issue in certain cases.</span>
<a name="l00466"></a>00466 <span class="comment"> *</span>
<a name="l00467"></a>00467 <span class="comment"> * For the echo client/server the round trip time goes from around</span>
<a name="l00468"></a>00468 <span class="comment"> * .000077 to .000069 with the message cache on my laptop. The sysprof</span>
<a name="l00469"></a>00469 <span class="comment"> * change is as follows (numbers are cumulative percentage):</span>
<a name="l00470"></a>00470 <span class="comment"> *</span>
<a name="l00471"></a>00471 <span class="comment"> *  with message cache implemented as array as it is now (0.000069 per):</span>
<a name="l00472"></a>00472 <span class="comment"> *    new_empty_header           1.46</span>
<a name="l00473"></a>00473 <span class="comment"> *      mutex_lock               0.56    # i.e. _DBUS_LOCK(message_cache)</span>
<a name="l00474"></a>00474 <span class="comment"> *      mutex_unlock             0.25</span>
<a name="l00475"></a>00475 <span class="comment"> *      self                     0.41</span>
<a name="l00476"></a>00476 <span class="comment"> *    unref                      2.24</span>
<a name="l00477"></a>00477 <span class="comment"> *      self                     0.68</span>
<a name="l00478"></a>00478 <span class="comment"> *      list_clear               0.43</span>
<a name="l00479"></a>00479 <span class="comment"> *      mutex_lock               0.33    # i.e. _DBUS_LOCK(message_cache)</span>
<a name="l00480"></a>00480 <span class="comment"> *      mutex_unlock             0.25</span>
<a name="l00481"></a>00481 <span class="comment"> *</span>
<a name="l00482"></a>00482 <span class="comment"> *  with message cache implemented as list (0.000070 per roundtrip):</span>
<a name="l00483"></a>00483 <span class="comment"> *    new_empty_header           2.72</span>
<a name="l00484"></a>00484 <span class="comment"> *      list_pop_first           1.88</span>
<a name="l00485"></a>00485 <span class="comment"> *    unref                      3.3</span>
<a name="l00486"></a>00486 <span class="comment"> *      list_prepend             1.63</span>
<a name="l00487"></a>00487 <span class="comment"> *</span>
<a name="l00488"></a>00488 <span class="comment"> * without cache (0.000077 per roundtrip):</span>
<a name="l00489"></a>00489 <span class="comment"> *    new_empty_header           6.7</span>
<a name="l00490"></a>00490 <span class="comment"> *      string_init_preallocated 3.43</span>
<a name="l00491"></a>00491 <span class="comment"> *        dbus_malloc            2.43</span>
<a name="l00492"></a>00492 <span class="comment"> *      dbus_malloc0             2.59</span>
<a name="l00493"></a>00493 <span class="comment"> *</span>
<a name="l00494"></a>00494 <span class="comment"> *    unref                      4.02</span>
<a name="l00495"></a>00495 <span class="comment"> *      string_free              1.82</span>
<a name="l00496"></a>00496 <span class="comment"> *        dbus_free              1.63</span>
<a name="l00497"></a>00497 <span class="comment"> *      dbus_free                0.71</span>
<a name="l00498"></a>00498 <span class="comment"> *</span>
<a name="l00499"></a>00499 <span class="comment"> * If you implement the message_cache with a list, the primary reason</span>
<a name="l00500"></a>00500 <span class="comment"> * it&#39;s slower is that you add another thread lock (on the DBusList</span>
<a name="l00501"></a>00501 <span class="comment"> * mempool).</span>
<a name="l00502"></a>00502 <span class="comment"> */</span>
<a name="l00503"></a>00503 
<a name="l00505"></a><a class="code" href="group__DBusMessageInternals.html#ga2c5c6aef45dd0b5cc10c800f986a7ce7">00505</a> <span class="preprocessor">#define MAX_MESSAGE_SIZE_TO_CACHE 10 * _DBUS_ONE_KILOBYTE</span>
<a name="l00506"></a>00506 <span class="preprocessor"></span>
<a name="l00508"></a><a class="code" href="group__DBusMessageInternals.html#gaeab2038ce58cd314dc1f23103abec5b0">00508</a> <span class="preprocessor">#define MAX_MESSAGE_CACHE_SIZE    5</span>
<a name="l00509"></a>00509 <span class="preprocessor"></span>
<a name="l00510"></a>00510 <span class="comment">/* Protected by _DBUS_LOCK (message_cache) */</span>
<a name="l00511"></a>00511 <span class="keyword">static</span> <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message_cache[<a class="code" href="group__DBusMessageInternals.html#gaeab2038ce58cd314dc1f23103abec5b0" title="Avoid caching too many messages.">MAX_MESSAGE_CACHE_SIZE</a>];
<a name="l00512"></a>00512 <span class="keyword">static</span> <span class="keywordtype">int</span> message_cache_count = 0;
<a name="l00513"></a>00513 <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> message_cache_shutdown_registered = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00514"></a>00514 
<a name="l00515"></a>00515 <span class="keyword">static</span> <span class="keywordtype">void</span>
<a name="l00516"></a>00516 dbus_message_cache_shutdown (<span class="keywordtype">void</span> *data)
<a name="l00517"></a>00517 {
<a name="l00518"></a>00518   <span class="keywordtype">int</span> i;
<a name="l00519"></a>00519 
<a name="l00520"></a>00520   <span class="keywordflow">if</span> (!_DBUS_LOCK (message_cache))
<a name="l00521"></a>00521     _dbus_assert_not_reached (<span class="stringliteral">&quot;we would have initialized global locks &quot;</span>
<a name="l00522"></a>00522         <span class="stringliteral">&quot;before registering a shutdown function&quot;</span>);
<a name="l00523"></a>00523 
<a name="l00524"></a>00524   i = 0;
<a name="l00525"></a>00525   <span class="keywordflow">while</span> (i &lt; <a class="code" href="group__DBusMessageInternals.html#gaeab2038ce58cd314dc1f23103abec5b0" title="Avoid caching too many messages.">MAX_MESSAGE_CACHE_SIZE</a>)
<a name="l00526"></a>00526     {
<a name="l00527"></a>00527       <span class="keywordflow">if</span> (message_cache[i])
<a name="l00528"></a>00528         dbus_message_finalize (message_cache[i]);
<a name="l00529"></a>00529 
<a name="l00530"></a>00530       ++i;
<a name="l00531"></a>00531     }
<a name="l00532"></a>00532 
<a name="l00533"></a>00533   message_cache_count = 0;
<a name="l00534"></a>00534   message_cache_shutdown_registered = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00535"></a>00535 
<a name="l00536"></a>00536   _DBUS_UNLOCK (message_cache);
<a name="l00537"></a>00537 }
<a name="l00538"></a>00538 
<a name="l00546"></a>00546 <span class="keyword">static</span> <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>*
<a name="l00547"></a>00547 dbus_message_get_cached (<span class="keywordtype">void</span>)
<a name="l00548"></a>00548 {
<a name="l00549"></a>00549   <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message;
<a name="l00550"></a>00550   <span class="keywordtype">int</span> i;
<a name="l00551"></a>00551 
<a name="l00552"></a>00552   message = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00553"></a>00553 
<a name="l00554"></a>00554   <span class="keywordflow">if</span> (!_DBUS_LOCK (message_cache))
<a name="l00555"></a>00555     {
<a name="l00556"></a>00556       <span class="comment">/* we&#39;d have initialized global locks before caching anything,</span>
<a name="l00557"></a>00557 <span class="comment">       * so there can&#39;t be anything in the cache */</span>
<a name="l00558"></a>00558       <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="l00559"></a>00559     }
<a name="l00560"></a>00560 
<a name="l00561"></a>00561   _dbus_assert (message_cache_count &gt;= 0);
<a name="l00562"></a>00562 
<a name="l00563"></a>00563   <span class="keywordflow">if</span> (message_cache_count == 0)
<a name="l00564"></a>00564     {
<a name="l00565"></a>00565       _DBUS_UNLOCK (message_cache);
<a name="l00566"></a>00566       <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="l00567"></a>00567     }
<a name="l00568"></a>00568 
<a name="l00569"></a>00569   <span class="comment">/* This is not necessarily true unless count &gt; 0, and</span>
<a name="l00570"></a>00570 <span class="comment">   * message_cache is uninitialized until the shutdown is</span>
<a name="l00571"></a>00571 <span class="comment">   * registered</span>
<a name="l00572"></a>00572 <span class="comment">   */</span>
<a name="l00573"></a>00573   _dbus_assert (message_cache_shutdown_registered);
<a name="l00574"></a>00574 
<a name="l00575"></a>00575   i = 0;
<a name="l00576"></a>00576   <span class="keywordflow">while</span> (i &lt; <a class="code" href="group__DBusMessageInternals.html#gaeab2038ce58cd314dc1f23103abec5b0" title="Avoid caching too many messages.">MAX_MESSAGE_CACHE_SIZE</a>)
<a name="l00577"></a>00577     {
<a name="l00578"></a>00578       <span class="keywordflow">if</span> (message_cache[i])
<a name="l00579"></a>00579         {
<a name="l00580"></a>00580           message = message_cache[i];
<a name="l00581"></a>00581           message_cache[i] = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00582"></a>00582           message_cache_count -= 1;
<a name="l00583"></a>00583           <span class="keywordflow">break</span>;
<a name="l00584"></a>00584         }
<a name="l00585"></a>00585       ++i;
<a name="l00586"></a>00586     }
<a name="l00587"></a>00587   _dbus_assert (message_cache_count &gt;= 0);
<a name="l00588"></a>00588   _dbus_assert (i &lt; <a class="code" href="group__DBusMessageInternals.html#gaeab2038ce58cd314dc1f23103abec5b0" title="Avoid caching too many messages.">MAX_MESSAGE_CACHE_SIZE</a>);
<a name="l00589"></a>00589   _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="l00590"></a>00590 
<a name="l00591"></a>00591   _dbus_assert (<a class="code" href="group__DBusSysdeps.html#ga626c810359ba0e362367ce2ec6691aca" title="Atomically get the value of an integer.">_dbus_atomic_get</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a324c5377e0be18dd84ac519ab2d23f0d" title="Reference count.">refcount</a>) == 0);
<a name="l00592"></a>00592 
<a name="l00593"></a>00593   _dbus_assert (message-&gt;<a class="code" href="structDBusMessage.html#ac6fc05ddffb11ac60b9da046abd2dc52" title="0-N DBusCounter used to track message size/unix fds.">counters</a> == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l00594"></a>00594   
<a name="l00595"></a>00595   _DBUS_UNLOCK (message_cache);
<a name="l00596"></a>00596 
<a name="l00597"></a>00597   <span class="keywordflow">return</span> message;
<a name="l00598"></a>00598 }
<a name="l00599"></a>00599 
<a name="l00600"></a>00600 <span class="preprocessor">#ifdef HAVE_UNIX_FD_PASSING</span>
<a name="l00601"></a>00601 <span class="preprocessor"></span><span class="keyword">static</span> <span class="keywordtype">void</span>
<a name="l00602"></a>00602 close_unix_fds(<span class="keywordtype">int</span> *fds, <span class="keywordtype">unsigned</span> *n_fds)
<a name="l00603"></a>00603 {
<a name="l00604"></a>00604   <a class="code" href="structDBusError.html" title="Object representing an exception.">DBusError</a> e;
<a name="l00605"></a>00605   <span class="keywordtype">int</span> i;
<a name="l00606"></a>00606 
<a name="l00607"></a>00607   <span class="keywordflow">if</span> (*n_fds &lt;= 0)
<a name="l00608"></a>00608     <span class="keywordflow">return</span>;
<a name="l00609"></a>00609 
<a name="l00610"></a>00610   <a class="code" href="group__DBusErrors.html#ga8937f0b7cdf8554fa6305158ce453fbe" title="Initializes a DBusError structure.">dbus_error_init</a>(&amp;e);
<a name="l00611"></a>00611 
<a name="l00612"></a>00612   <span class="keywordflow">for</span> (i = 0; i &lt; *n_fds; i++)
<a name="l00613"></a>00613     {
<a name="l00614"></a>00614       <span class="keywordflow">if</span> (!<a class="code" href="group__DBusSysdepsUnix.html#gac448479a1674e3b86cee9a4bdc7eba03" title="Closes a file descriptor.">_dbus_close</a>(fds[i], &amp;e))
<a name="l00615"></a>00615         {
<a name="l00616"></a>00616           <a class="code" href="group__DBusInternalsUtils.html#gabea2c16d6d3fe7c4eb5b9496fc877f84" title="Prints a warning message to stderr.">_dbus_warn</a>(<span class="stringliteral">&quot;Failed to close file descriptor: %s\n&quot;</span>, e.<a class="code" href="structDBusError.html#afb559175326de5b6b340e26204e92d72" title="public error message field">message</a>);
<a name="l00617"></a>00617           <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;e);
<a name="l00618"></a>00618         }
<a name="l00619"></a>00619     }
<a name="l00620"></a>00620 
<a name="l00621"></a>00621   *n_fds = 0;
<a name="l00622"></a>00622 
<a name="l00623"></a>00623   <span class="comment">/* We don&#39;t free the array here, in case we can recycle it later */</span>
<a name="l00624"></a>00624 }
<a name="l00625"></a>00625 <span class="preprocessor">#endif</span>
<a name="l00626"></a>00626 <span class="preprocessor"></span>
<a name="l00627"></a>00627 <span class="keyword">static</span> <span class="keywordtype">void</span>
<a name="l00628"></a>00628 free_counter (<span class="keywordtype">void</span> *element,
<a name="l00629"></a>00629               <span class="keywordtype">void</span> *data)
<a name="l00630"></a>00630 {
<a name="l00631"></a>00631   <a class="code" href="structDBusCounter.html" title="Internals of DBusCounter.">DBusCounter</a> *counter = element;
<a name="l00632"></a>00632   <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message = data;
<a name="l00633"></a>00633 
<a name="l00634"></a>00634   <a class="code" href="group__DBusResources.html#gae37410c196947675c2a222a7979e9dee" title="Adjusts the value of the size counter by the given delta which may be positive or negative...">_dbus_counter_adjust_size</a> (counter, - message-&gt;<a class="code" href="structDBusMessage.html#ab8f43d40fa870f97f1126256568cec61" title="Size we incremented the size counters by.">size_counter_delta</a>);
<a name="l00635"></a>00635 <span class="preprocessor">#ifdef HAVE_UNIX_FD_PASSING</span>
<a name="l00636"></a>00636 <span class="preprocessor"></span>  <a class="code" href="group__DBusResources.html#ga7d9411d27b337289ab5648beb148cde6" title="Adjusts the value of the unix fd counter by the given delta which may be positive or negative...">_dbus_counter_adjust_unix_fd</a> (counter, - message-&gt;unix_fd_counter_delta);
<a name="l00637"></a>00637 <span class="preprocessor">#endif</span>
<a name="l00638"></a>00638 <span class="preprocessor"></span>
<a name="l00639"></a>00639   <a class="code" href="group__DBusResources.html#gab8c0e970e0c3b4696ba06723639d8239" title="Calls the notify function from _dbus_counter_set_notify(), if that function has been specified and th...">_dbus_counter_notify</a> (counter);
<a name="l00640"></a>00640   <a class="code" href="group__DBusResources.html#ga48d9b53d1a395ab3c4f1846ca569ef3f" title="Decrements refcount of the counter and possibly finalizes the counter.">_dbus_counter_unref</a> (counter);
<a name="l00641"></a>00641 }
<a name="l00642"></a>00642 
<a name="l00648"></a>00648 <span class="keyword">static</span> <span class="keywordtype">void</span>
<a name="l00649"></a>00649 dbus_message_cache_or_finalize (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message)
<a name="l00650"></a>00650 {
<a name="l00651"></a>00651   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> was_cached;
<a name="l00652"></a>00652   <span class="keywordtype">int</span> i;
<a name="l00653"></a>00653 
<a name="l00654"></a>00654   _dbus_assert (<a class="code" href="group__DBusSysdeps.html#ga626c810359ba0e362367ce2ec6691aca" title="Atomically get the value of an integer.">_dbus_atomic_get</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a324c5377e0be18dd84ac519ab2d23f0d" title="Reference count.">refcount</a>) == 0);
<a name="l00655"></a>00655 
<a name="l00656"></a>00656   <span class="comment">/* This calls application code and has to be done first thing</span>
<a name="l00657"></a>00657 <span class="comment">   * without holding the lock</span>
<a name="l00658"></a>00658 <span class="comment">   */</span>
<a name="l00659"></a>00659   <a class="code" href="group__DBusDataSlot.html#ga3c96d2ca263ba397b4da2956a49ae282" title="Frees all data slots contained in the list, calling application-provided free functions if they exist...">_dbus_data_slot_list_clear</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a179c446523c6321e04f88a671363be19" title="Data stored by allocated integer ID.">slot_list</a>);
<a name="l00660"></a>00660 
<a name="l00661"></a>00661   <a class="code" href="group__DBusList.html#ga8dd69084b53361803a765e6d53d5b9d1" title="Calls the given function for each element in the list.">_dbus_list_foreach</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#ac6fc05ddffb11ac60b9da046abd2dc52" title="0-N DBusCounter used to track message size/unix fds.">counters</a>,
<a name="l00662"></a>00662                       free_counter, message);
<a name="l00663"></a>00663   <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;message-&gt;<a class="code" href="structDBusMessage.html#ac6fc05ddffb11ac60b9da046abd2dc52" title="0-N DBusCounter used to track message size/unix fds.">counters</a>);
<a name="l00664"></a>00664 
<a name="l00665"></a>00665 <span class="preprocessor">#ifdef HAVE_UNIX_FD_PASSING</span>
<a name="l00666"></a>00666 <span class="preprocessor"></span>  close_unix_fds(message-&gt;unix_fds, &amp;message-&gt;n_unix_fds);
<a name="l00667"></a>00667 <span class="preprocessor">#endif</span>
<a name="l00668"></a>00668 <span class="preprocessor"></span>
<a name="l00669"></a>00669   was_cached = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00670"></a>00670 
<a name="l00671"></a>00671   <span class="keywordflow">if</span> (!_DBUS_LOCK (message_cache))
<a name="l00672"></a>00672     {
<a name="l00673"></a>00673       <span class="comment">/* The only way to get a non-null message goes through</span>
<a name="l00674"></a>00674 <span class="comment">       * dbus_message_get_cached() which takes the lock. */</span>
<a name="l00675"></a>00675       _dbus_assert_not_reached (<span class="stringliteral">&quot;we would have initialized global locks &quot;</span>
<a name="l00676"></a>00676           <span class="stringliteral">&quot;the first time we constructed a message&quot;</span>);
<a name="l00677"></a>00677     }
<a name="l00678"></a>00678 
<a name="l00679"></a>00679   <span class="keywordflow">if</span> (!message_cache_shutdown_registered)
<a name="l00680"></a>00680     {
<a name="l00681"></a>00681       _dbus_assert (message_cache_count == 0);
<a name="l00682"></a>00682 
<a name="l00683"></a>00683       <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> (dbus_message_cache_shutdown, <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>))
<a name="l00684"></a>00684         <span class="keywordflow">goto</span> out;
<a name="l00685"></a>00685 
<a name="l00686"></a>00686       i = 0;
<a name="l00687"></a>00687       <span class="keywordflow">while</span> (i &lt; <a class="code" href="group__DBusMessageInternals.html#gaeab2038ce58cd314dc1f23103abec5b0" title="Avoid caching too many messages.">MAX_MESSAGE_CACHE_SIZE</a>)
<a name="l00688"></a>00688         {
<a name="l00689"></a>00689           message_cache[i] = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00690"></a>00690           ++i;
<a name="l00691"></a>00691         }
<a name="l00692"></a>00692 
<a name="l00693"></a>00693       message_cache_shutdown_registered = <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l00694"></a>00694     }
<a name="l00695"></a>00695 
<a name="l00696"></a>00696   _dbus_assert (message_cache_count &gt;= 0);
<a name="l00697"></a>00697 
<a name="l00698"></a>00698   <span class="keywordflow">if</span> (!_dbus_enable_message_cache ())
<a name="l00699"></a>00699     <span class="keywordflow">goto</span> out;
<a name="l00700"></a>00700 
<a name="l00701"></a>00701   <span class="keywordflow">if</span> ((<a class="code" href="group__DBusString.html#gaa5136e6fd2c5188f4b88de7863369c6d" title="Gets the length of a string (not including nul termination).">_dbus_string_get_length</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>.<a class="code" href="structDBusHeader.html#a67df8bff43c10e2d4f6ae36b56ee5814" title="Header network data, stored separately from body so we can independently realloc it.">data</a>) +
<a name="l00702"></a>00702        <a class="code" href="group__DBusString.html#gaa5136e6fd2c5188f4b88de7863369c6d" title="Gets the length of a string (not including nul termination).">_dbus_string_get_length</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a0b9d14d6e0529f0ec2e3c0087fe62a9e" title="Body network data.">body</a>)) &gt;
<a name="l00703"></a>00703       <a class="code" href="group__DBusMessageInternals.html#ga2c5c6aef45dd0b5cc10c800f986a7ce7" title="Avoid caching huge messages.">MAX_MESSAGE_SIZE_TO_CACHE</a>)
<a name="l00704"></a>00704     <span class="keywordflow">goto</span> out;
<a name="l00705"></a>00705 
<a name="l00706"></a>00706   <span class="keywordflow">if</span> (message_cache_count &gt;= <a class="code" href="group__DBusMessageInternals.html#gaeab2038ce58cd314dc1f23103abec5b0" title="Avoid caching too many messages.">MAX_MESSAGE_CACHE_SIZE</a>)
<a name="l00707"></a>00707     <span class="keywordflow">goto</span> out;
<a name="l00708"></a>00708 
<a name="l00709"></a>00709   <span class="comment">/* Find empty slot */</span>
<a name="l00710"></a>00710   i = 0;
<a name="l00711"></a>00711   <span class="keywordflow">while</span> (message_cache[i] != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00712"></a>00712     ++i;
<a name="l00713"></a>00713 
<a name="l00714"></a>00714   _dbus_assert (i &lt; <a class="code" href="group__DBusMessageInternals.html#gaeab2038ce58cd314dc1f23103abec5b0" title="Avoid caching too many messages.">MAX_MESSAGE_CACHE_SIZE</a>);
<a name="l00715"></a>00715 
<a name="l00716"></a>00716   _dbus_assert (message_cache[i] == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l00717"></a>00717   message_cache[i] = message;
<a name="l00718"></a>00718   message_cache_count += 1;
<a name="l00719"></a>00719   was_cached = <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l00720"></a>00720 <span class="preprocessor">#ifndef DBUS_DISABLE_CHECKS</span>
<a name="l00721"></a>00721 <span class="preprocessor"></span>  message-&gt;<a class="code" href="structDBusMessage.html#ac71fa5534264093e6af8bc41f15237c8" title="Has been &quot;freed&quot; since it&#39;s in the cache (this is a debug feature)">in_cache</a> = <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l00722"></a>00722 <span class="preprocessor">#endif</span>
<a name="l00723"></a>00723 <span class="preprocessor"></span>
<a name="l00724"></a>00724  out:
<a name="l00725"></a>00725   _dbus_assert (<a class="code" href="group__DBusSysdeps.html#ga626c810359ba0e362367ce2ec6691aca" title="Atomically get the value of an integer.">_dbus_atomic_get</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a324c5377e0be18dd84ac519ab2d23f0d" title="Reference count.">refcount</a>) == 0);
<a name="l00726"></a>00726 
<a name="l00727"></a>00727   _DBUS_UNLOCK (message_cache);
<a name="l00728"></a>00728   
<a name="l00729"></a>00729   <span class="keywordflow">if</span> (!was_cached)
<a name="l00730"></a>00730     dbus_message_finalize (message);
<a name="l00731"></a>00731 }
<a name="l00732"></a>00732 
<a name="l00733"></a>00733 <span class="preprocessor">#if defined(DBUS_ENABLE_CHECKS) || defined(DBUS_ENABLE_ASSERT)</span>
<a name="l00734"></a>00734 <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>
<a name="l00735"></a>00735 _dbus_message_iter_check (<a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *iter)
<a name="l00736"></a>00736 {
<a name="l00737"></a>00737   <span class="keywordtype">char</span> byte_order;
<a name="l00738"></a>00738 
<a name="l00739"></a>00739   <span class="keywordflow">if</span> (iter == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00740"></a>00740     {
<a name="l00741"></a>00741       <a class="code" href="group__DBusInternalsUtils.html#ga63f2f8a068454b781f214ba596e313b4" title="Prints a &quot;critical&quot; warning to stderr when an assertion fails; differs from _dbus_warn primarily in t...">_dbus_warn_check_failed</a> (<span class="stringliteral">&quot;dbus message iterator is NULL\n&quot;</span>);
<a name="l00742"></a>00742       <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00743"></a>00743     }
<a name="l00744"></a>00744 
<a name="l00745"></a>00745   byte_order = <a class="code" href="group__DBusMarshal.html#ga65c023673b837c27e8ccda5c2528d806" title="Returns the header&#39;s byte order.">_dbus_header_get_byte_order</a> (&amp;iter-&gt;<a class="code" href="structDBusMessageRealIter.html#a552cb582c65645ed46d9d1ad38ece3c7" title="Message used.">message</a>-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>);
<a name="l00746"></a>00746 
<a name="l00747"></a>00747   <span class="keywordflow">if</span> (iter-&gt;<a class="code" href="structDBusMessageRealIter.html#a835b7990b2909beb06fc2dc38b76a089" title="whether this is a reader or writer iter">iter_type</a> == DBUS_MESSAGE_ITER_TYPE_READER)
<a name="l00748"></a>00748     {
<a name="l00749"></a>00749       <span class="keywordflow">if</span> (iter-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#ae5c4e45b0a5d6642850144f642d7db67" title="reader">reader</a>.<a class="code" href="structDBusTypeReader.html#aeb0846d954066f420e1df98b81148702" title="byte order of the block">byte_order</a> != byte_order)
<a name="l00750"></a>00750         {
<a name="l00751"></a>00751           <a class="code" href="group__DBusInternalsUtils.html#ga63f2f8a068454b781f214ba596e313b4" title="Prints a &quot;critical&quot; warning to stderr when an assertion fails; differs from _dbus_warn primarily in t...">_dbus_warn_check_failed</a> (<span class="stringliteral">&quot;dbus message changed byte order since iterator was created\n&quot;</span>);
<a name="l00752"></a>00752           <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00753"></a>00753         }
<a name="l00754"></a>00754       <span class="comment">/* because we swap the message into compiler order when you init an iter */</span>
<a name="l00755"></a>00755       _dbus_assert (iter-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#ae5c4e45b0a5d6642850144f642d7db67" title="reader">reader</a>.<a class="code" href="structDBusTypeReader.html#aeb0846d954066f420e1df98b81148702" title="byte order of the block">byte_order</a> == DBUS_COMPILER_BYTE_ORDER);
<a name="l00756"></a>00756     }
<a name="l00757"></a>00757   <span class="keywordflow">else</span> <span class="keywordflow">if</span> (iter-&gt;<a class="code" href="structDBusMessageRealIter.html#a835b7990b2909beb06fc2dc38b76a089" title="whether this is a reader or writer iter">iter_type</a> == DBUS_MESSAGE_ITER_TYPE_WRITER)
<a name="l00758"></a>00758     {
<a name="l00759"></a>00759       <span class="keywordflow">if</span> (iter-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#a93bc11bb1521743170b0b411b32140cf" title="writer">writer</a>.<a class="code" href="structDBusTypeWriter.html#a6c4baf0b7148cf3f76924b654dada148" title="byte order to write values with">byte_order</a> != byte_order)
<a name="l00760"></a>00760         {
<a name="l00761"></a>00761           <a class="code" href="group__DBusInternalsUtils.html#ga63f2f8a068454b781f214ba596e313b4" title="Prints a &quot;critical&quot; warning to stderr when an assertion fails; differs from _dbus_warn primarily in t...">_dbus_warn_check_failed</a> (<span class="stringliteral">&quot;dbus message changed byte order since append iterator was created\n&quot;</span>);
<a name="l00762"></a>00762           <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00763"></a>00763         }
<a name="l00764"></a>00764       <span class="comment">/* because we swap the message into compiler order when you init an iter */</span>
<a name="l00765"></a>00765       _dbus_assert (iter-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#a93bc11bb1521743170b0b411b32140cf" title="writer">writer</a>.<a class="code" href="structDBusTypeWriter.html#a6c4baf0b7148cf3f76924b654dada148" title="byte order to write values with">byte_order</a> == DBUS_COMPILER_BYTE_ORDER);
<a name="l00766"></a>00766     }
<a name="l00767"></a>00767   <span class="keywordflow">else</span>
<a name="l00768"></a>00768     {
<a name="l00769"></a>00769       <a class="code" href="group__DBusInternalsUtils.html#ga63f2f8a068454b781f214ba596e313b4" title="Prints a &quot;critical&quot; warning to stderr when an assertion fails; differs from _dbus_warn primarily in t...">_dbus_warn_check_failed</a> (<span class="stringliteral">&quot;dbus message iterator looks uninitialized or corrupted\n&quot;</span>);
<a name="l00770"></a>00770       <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00771"></a>00771     }
<a name="l00772"></a>00772 
<a name="l00773"></a>00773   <span class="keywordflow">if</span> (iter-&gt;<a class="code" href="structDBusMessageRealIter.html#ac10324f74497a5c2288eef8fbcd3ae42" title="stamp to detect invalid iters">changed_stamp</a> != iter-&gt;<a class="code" href="structDBusMessageRealIter.html#a552cb582c65645ed46d9d1ad38ece3c7" title="Message used.">message</a>-&gt;<a class="code" href="structDBusMessage.html#a5d102e908f6ff96a5a0aa6a39b4963a8" title="Incremented when iterators are invalidated.">changed_stamp</a>)
<a name="l00774"></a>00774     {
<a name="l00775"></a>00775       <a class="code" href="group__DBusInternalsUtils.html#ga63f2f8a068454b781f214ba596e313b4" title="Prints a &quot;critical&quot; warning to stderr when an assertion fails; differs from _dbus_warn primarily in t...">_dbus_warn_check_failed</a> (<span class="stringliteral">&quot;dbus message iterator invalid because the message has been modified (or perhaps the iterator is just uninitialized)\n&quot;</span>);
<a name="l00776"></a>00776       <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00777"></a>00777     }
<a name="l00778"></a>00778 
<a name="l00779"></a>00779   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l00780"></a>00780 }
<a name="l00781"></a>00781 <span class="preprocessor">#endif </span><span class="comment">/* DBUS_ENABLE_CHECKS || DBUS_ENABLE_ASSERT */</span>
<a name="l00782"></a>00782 
<a name="l00795"></a>00795 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l00796"></a><a class="code" href="group__DBusMessageInternals.html#ga1ae02a435d19c3363e11c74b08c43ab2">00796</a> <a class="code" href="group__DBusMessageInternals.html#ga1ae02a435d19c3363e11c74b08c43ab2" title="Implementation of the varargs arg-getting functions.">_dbus_message_iter_get_args_valist</a> (<a class="code" href="structDBusMessageIter.html" title="DBusMessageIter struct; contains no public fields.">DBusMessageIter</a> *iter,
<a name="l00797"></a>00797                                     <a class="code" href="structDBusError.html" title="Object representing an exception.">DBusError</a>       *error,
<a name="l00798"></a>00798                                     <span class="keywordtype">int</span>              first_arg_type,
<a name="l00799"></a>00799                                     va_list          var_args)
<a name="l00800"></a>00800 {
<a name="l00801"></a>00801   <a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *real = (<a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *)iter;
<a name="l00802"></a>00802   <span class="keywordtype">int</span> spec_type, msg_type, i, j;
<a name="l00803"></a>00803   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> retval;
<a name="l00804"></a>00804   va_list copy_args;
<a name="l00805"></a>00805 
<a name="l00806"></a>00806   _dbus_assert (_dbus_message_iter_check (real));
<a name="l00807"></a>00807 
<a name="l00808"></a>00808   retval = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00809"></a>00809 
<a name="l00810"></a>00810   spec_type = first_arg_type;
<a name="l00811"></a>00811   i = 0;
<a name="l00812"></a>00812 
<a name="l00813"></a>00813   <span class="comment">/* copy var_args first, then we can do another iteration over it to</span>
<a name="l00814"></a>00814 <span class="comment">   * free memory and close unix fds if parse failed at some point.</span>
<a name="l00815"></a>00815 <span class="comment">   */</span>
<a name="l00816"></a>00816   DBUS_VA_COPY (copy_args, var_args);
<a name="l00817"></a>00817 
<a name="l00818"></a>00818   <span class="keywordflow">while</span> (spec_type != <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="l00819"></a>00819     {
<a name="l00820"></a>00820       msg_type = <a class="code" href="group__DBusMessage.html#ga5aae3c882a75aed953d8b3d489e9b271" title="Returns the argument type of the argument that the message iterator points to.">dbus_message_iter_get_arg_type</a> (iter);
<a name="l00821"></a>00821 
<a name="l00822"></a>00822       <span class="keywordflow">if</span> (msg_type != spec_type)
<a name="l00823"></a>00823         {
<a name="l00824"></a>00824           <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#gacf5321b161193ad66d5bdf5c910a9792" title="Invalid arguments passed to a method call.">DBUS_ERROR_INVALID_ARGS</a>,
<a name="l00825"></a>00825                           <span class="stringliteral">&quot;Argument %d is specified to be of type \&quot;%s\&quot;, but &quot;</span>
<a name="l00826"></a>00826                           <span class="stringliteral">&quot;is actually of type \&quot;%s\&quot;\n&quot;</span>, i,
<a name="l00827"></a>00827                           <a class="code" href="group__DBusMarshal.html#ga48a595c2b26dce6e9c25ce040e5247e5" title="Returns a string describing the given type.">_dbus_type_to_string</a> (spec_type),
<a name="l00828"></a>00828                           <a class="code" href="group__DBusMarshal.html#ga48a595c2b26dce6e9c25ce040e5247e5" title="Returns a string describing the given type.">_dbus_type_to_string</a> (msg_type));
<a name="l00829"></a>00829 
<a name="l00830"></a>00830           <span class="keywordflow">goto</span> out;
<a name="l00831"></a>00831         }
<a name="l00832"></a>00832 
<a name="l00833"></a>00833       <span class="keywordflow">if</span> (spec_type == <a class="code" href="group__DBusProtocol.html#ga59f8acaeb207b182982dfb97174b7f16" title="Type code marking a unix file descriptor.">DBUS_TYPE_UNIX_FD</a>)
<a name="l00834"></a>00834         {
<a name="l00835"></a>00835 <span class="preprocessor">#ifdef HAVE_UNIX_FD_PASSING</span>
<a name="l00836"></a>00836 <span class="preprocessor"></span>          <a class="code" href="unionDBusBasicValue.html" title="A simple value union that lets you access bytes as if they were various types; useful when dealing wi...">DBusBasicValue</a> idx;
<a name="l00837"></a>00837           <span class="keywordtype">int</span> *pfd, nfd;
<a name="l00838"></a>00838 
<a name="l00839"></a>00839           pfd = va_arg (var_args, <span class="keywordtype">int</span>*);
<a name="l00840"></a>00840           _dbus_assert(pfd);
<a name="l00841"></a>00841 
<a name="l00842"></a>00842           <a class="code" href="group__DBusMarshal.html#gaa54355ee98d6721d7a29b5ae7d92eb9a" title="Reads a basic-typed value, as with _dbus_marshal_read_basic().">_dbus_type_reader_read_basic</a>(&amp;real-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#ae5c4e45b0a5d6642850144f642d7db67" title="reader">reader</a>, &amp;idx);
<a name="l00843"></a>00843 
<a name="l00844"></a>00844           <span class="keywordflow">if</span> (idx.<a class="code" href="unionDBusBasicValue.html#a2501e54560ae240442d9d841b96b086b" title="as int32">u32</a> &gt;= real-&gt;<a class="code" href="structDBusMessageRealIter.html#a552cb582c65645ed46d9d1ad38ece3c7" title="Message used.">message</a>-&gt;n_unix_fds)
<a name="l00845"></a>00845             {
<a name="l00846"></a>00846               <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#ga2a23b986cd4cef832b8823b6b0d1bcb1" title="The message meta data does not match the payload.">DBUS_ERROR_INCONSISTENT_MESSAGE</a>,
<a name="l00847"></a>00847                               <span class="stringliteral">&quot;Message refers to file descriptor at index %i,&quot;</span>
<a name="l00848"></a>00848                               <span class="stringliteral">&quot;but has only %i descriptors attached.\n&quot;</span>,
<a name="l00849"></a>00849                               idx.<a class="code" href="unionDBusBasicValue.html#a2501e54560ae240442d9d841b96b086b" title="as int32">u32</a>,
<a name="l00850"></a>00850                               real-&gt;<a class="code" href="structDBusMessageRealIter.html#a552cb582c65645ed46d9d1ad38ece3c7" title="Message used.">message</a>-&gt;n_unix_fds);
<a name="l00851"></a>00851               <span class="keywordflow">goto</span> out;
<a name="l00852"></a>00852             }
<a name="l00853"></a>00853 
<a name="l00854"></a>00854           <span class="keywordflow">if</span> ((nfd = <a class="code" href="group__DBusSysdepsUnix.html#gad79d20e59fb519233004208988851cf1" title="Duplicates a file descriptor.">_dbus_dup</a>(real-&gt;<a class="code" href="structDBusMessageRealIter.html#a552cb582c65645ed46d9d1ad38ece3c7" title="Message used.">message</a>-&gt;unix_fds[idx.<a class="code" href="unionDBusBasicValue.html#a2501e54560ae240442d9d841b96b086b" title="as int32">u32</a>], error)) &lt; 0)
<a name="l00855"></a>00855             <span class="keywordflow">goto</span> out;
<a name="l00856"></a>00856 
<a name="l00857"></a>00857           *pfd = nfd;
<a name="l00858"></a>00858 <span class="preprocessor">#else</span>
<a name="l00859"></a>00859 <span class="preprocessor"></span>          <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#ga33122bcaf8f5896ec222c755b6effb40" title="Requested operation isn&#39;t supported (like ENOSYS on UNIX).">DBUS_ERROR_NOT_SUPPORTED</a>,
<a name="l00860"></a>00860                           <span class="stringliteral">&quot;Platform does not support file desciptor passing.\n&quot;</span>);
<a name="l00861"></a>00861           <span class="keywordflow">goto</span> out;
<a name="l00862"></a>00862 <span class="preprocessor">#endif</span>
<a name="l00863"></a>00863 <span class="preprocessor"></span>        }
<a name="l00864"></a>00864       <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="group__DBusSignature.html#ga2d8afef7d754cf15d6b9733f00654c0e" title="A &quot;basic type&quot; is a somewhat arbitrary concept, but the intent is to include those types that are ful...">dbus_type_is_basic</a> (spec_type))
<a name="l00865"></a>00865         {
<a name="l00866"></a>00866           <a class="code" href="unionDBusBasicValue.html" title="A simple value union that lets you access bytes as if they were various types; useful when dealing wi...">DBusBasicValue</a> *ptr;
<a name="l00867"></a>00867 
<a name="l00868"></a>00868           ptr = va_arg (var_args, <a class="code" href="unionDBusBasicValue.html" title="A simple value union that lets you access bytes as if they were various types; useful when dealing wi...">DBusBasicValue</a>*);
<a name="l00869"></a>00869 
<a name="l00870"></a>00870           _dbus_assert (ptr != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l00871"></a>00871 
<a name="l00872"></a>00872           <a class="code" href="group__DBusMarshal.html#gaa54355ee98d6721d7a29b5ae7d92eb9a" title="Reads a basic-typed value, as with _dbus_marshal_read_basic().">_dbus_type_reader_read_basic</a> (&amp;real-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#ae5c4e45b0a5d6642850144f642d7db67" title="reader">reader</a>,
<a name="l00873"></a>00873                                         ptr);
<a name="l00874"></a>00874         }
<a name="l00875"></a>00875       <span class="keywordflow">else</span> <span class="keywordflow">if</span> (spec_type == <a class="code" href="group__DBusProtocol.html#ga8912f600f81a773066ca03d9163613a9" title="Type code marking a D-Bus array type.">DBUS_TYPE_ARRAY</a>)
<a name="l00876"></a>00876         {
<a name="l00877"></a>00877           <span class="keywordtype">int</span> element_type;
<a name="l00878"></a>00878           <span class="keywordtype">int</span> spec_element_type;
<a name="l00879"></a>00879           <span class="keyword">const</span> <a class="code" href="unionDBusBasicValue.html" title="A simple value union that lets you access bytes as if they were various types; useful when dealing wi...">DBusBasicValue</a> **ptr;
<a name="l00880"></a>00880           <span class="keywordtype">int</span> *n_elements_p;
<a name="l00881"></a>00881           <a class="code" href="structDBusTypeReader.html" title="The type reader is an iterator for reading values from a block of values.">DBusTypeReader</a> array;
<a name="l00882"></a>00882 
<a name="l00883"></a>00883           spec_element_type = va_arg (var_args, <span class="keywordtype">int</span>);
<a name="l00884"></a>00884           element_type = <a class="code" href="group__DBusMarshal.html#ga6e5439f7ca5ee8a1ce943ddab7611d0d" title="Gets the type of an element of the array the reader is currently pointing to.">_dbus_type_reader_get_element_type</a> (&amp;real-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#ae5c4e45b0a5d6642850144f642d7db67" title="reader">reader</a>);
<a name="l00885"></a>00885 
<a name="l00886"></a>00886           <span class="keywordflow">if</span> (spec_element_type != element_type)
<a name="l00887"></a>00887             {
<a name="l00888"></a>00888               <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#gacf5321b161193ad66d5bdf5c910a9792" title="Invalid arguments passed to a method call.">DBUS_ERROR_INVALID_ARGS</a>,
<a name="l00889"></a>00889                               <span class="stringliteral">&quot;Argument %d is specified to be an array of \&quot;%s\&quot;, but &quot;</span>
<a name="l00890"></a>00890                               <span class="stringliteral">&quot;is actually an array of \&quot;%s\&quot;\n&quot;</span>,
<a name="l00891"></a>00891                               i,
<a name="l00892"></a>00892                               <a class="code" href="group__DBusMarshal.html#ga48a595c2b26dce6e9c25ce040e5247e5" title="Returns a string describing the given type.">_dbus_type_to_string</a> (spec_element_type),
<a name="l00893"></a>00893                               <a class="code" href="group__DBusMarshal.html#ga48a595c2b26dce6e9c25ce040e5247e5" title="Returns a string describing the given type.">_dbus_type_to_string</a> (element_type));
<a name="l00894"></a>00894 
<a name="l00895"></a>00895               <span class="keywordflow">goto</span> out;
<a name="l00896"></a>00896             }
<a name="l00897"></a>00897 
<a name="l00898"></a>00898           <span class="keywordflow">if</span> (<a class="code" href="group__DBusSignature.html#ga2f89962cbd33e4ad843824157bae2093" title="Tells you whether values of this type can change length if you set them to some other value...">dbus_type_is_fixed</a> (spec_element_type) &amp;&amp;
<a name="l00899"></a>00899               element_type != <a class="code" href="group__DBusProtocol.html#ga59f8acaeb207b182982dfb97174b7f16" title="Type code marking a unix file descriptor.">DBUS_TYPE_UNIX_FD</a>)
<a name="l00900"></a>00900             {
<a name="l00901"></a>00901               ptr = va_arg (var_args, <span class="keyword">const</span> <a class="code" href="unionDBusBasicValue.html" title="A simple value union that lets you access bytes as if they were various types; useful when dealing wi...">DBusBasicValue</a>**);
<a name="l00902"></a>00902               n_elements_p = va_arg (var_args, <span class="keywordtype">int</span>*);
<a name="l00903"></a>00903 
<a name="l00904"></a>00904               _dbus_assert (ptr != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l00905"></a>00905               _dbus_assert (n_elements_p != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l00906"></a>00906 
<a name="l00907"></a>00907               <a class="code" href="group__DBusMarshal.html#ga082b410820c74b2a6ca816a8e0c91803" title="Initialize a new reader pointing to the first type and corresponding value that&#39;s a child of the curr...">_dbus_type_reader_recurse</a> (&amp;real-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#ae5c4e45b0a5d6642850144f642d7db67" title="reader">reader</a>, &amp;array);
<a name="l00908"></a>00908 
<a name="l00909"></a>00909               <a class="code" href="group__DBusMarshal.html#gae9a65c05e58ace9c83352f65af2fe745" title="Reads a block of fixed-length basic values, from the current point in an array to the end of the arra...">_dbus_type_reader_read_fixed_multi</a> (&amp;array,
<a name="l00910"></a>00910                                                   (<span class="keywordtype">void</span> *) ptr, n_elements_p);
<a name="l00911"></a>00911             }
<a name="l00912"></a>00912           <span class="keywordflow">else</span> <span class="keywordflow">if</span> (_DBUS_TYPE_IS_STRINGLIKE (spec_element_type))
<a name="l00913"></a>00913             {
<a name="l00914"></a>00914               <span class="keywordtype">char</span> ***str_array_p;
<a name="l00915"></a>00915               <span class="keywordtype">int</span> n_elements;
<a name="l00916"></a>00916               <span class="keywordtype">char</span> **str_array;
<a name="l00917"></a>00917 
<a name="l00918"></a>00918               str_array_p = va_arg (var_args, <span class="keywordtype">char</span>***);
<a name="l00919"></a>00919               n_elements_p = va_arg (var_args, <span class="keywordtype">int</span>*);
<a name="l00920"></a>00920 
<a name="l00921"></a>00921               _dbus_assert (str_array_p != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l00922"></a>00922               _dbus_assert (n_elements_p != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l00923"></a>00923 
<a name="l00924"></a>00924               <span class="comment">/* Count elements in the array */</span>
<a name="l00925"></a>00925               <a class="code" href="group__DBusMarshal.html#ga082b410820c74b2a6ca816a8e0c91803" title="Initialize a new reader pointing to the first type and corresponding value that&#39;s a child of the curr...">_dbus_type_reader_recurse</a> (&amp;real-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#ae5c4e45b0a5d6642850144f642d7db67" title="reader">reader</a>, &amp;array);
<a name="l00926"></a>00926 
<a name="l00927"></a>00927               n_elements = 0;
<a name="l00928"></a>00928               <span class="keywordflow">while</span> (<a class="code" href="group__DBusMarshal.html#gab8e39cb8084247d54d7f272c51622a73" title="Gets the type of the value the reader is currently pointing to; or for a types-only reader gets the t...">_dbus_type_reader_get_current_type</a> (&amp;array) != <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="l00929"></a>00929                 {
<a name="l00930"></a>00930                   ++n_elements;
<a name="l00931"></a>00931                   <a class="code" href="group__DBusMarshal.html#ga746c09512d4905f2d2fac7ed4c3c63c2" title="Skip to the next value on this &quot;level&quot;.">_dbus_type_reader_next</a> (&amp;array);
<a name="l00932"></a>00932                 }
<a name="l00933"></a>00933 
<a name="l00934"></a>00934               str_array = <a class="code" href="group__DBusMemory.html#gaba9d823abda7f4cadbaf5177d3b8b793" title="Safe macro for using dbus_malloc0().">dbus_new0</a> (<span class="keywordtype">char</span>*, n_elements + 1);
<a name="l00935"></a>00935               <span class="keywordflow">if</span> (str_array == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00936"></a>00936                 {
<a name="l00937"></a>00937                   _DBUS_SET_OOM (error);
<a name="l00938"></a>00938                   <span class="keywordflow">goto</span> out;
<a name="l00939"></a>00939                 }
<a name="l00940"></a>00940 
<a name="l00941"></a>00941               <span class="comment">/* Now go through and dup each string */</span>
<a name="l00942"></a>00942               <a class="code" href="group__DBusMarshal.html#ga082b410820c74b2a6ca816a8e0c91803" title="Initialize a new reader pointing to the first type and corresponding value that&#39;s a child of the curr...">_dbus_type_reader_recurse</a> (&amp;real-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#ae5c4e45b0a5d6642850144f642d7db67" title="reader">reader</a>, &amp;array);
<a name="l00943"></a>00943 
<a name="l00944"></a>00944               j = 0;
<a name="l00945"></a>00945               <span class="keywordflow">while</span> (j &lt; n_elements)
<a name="l00946"></a>00946                 {
<a name="l00947"></a>00947                   <span class="keyword">const</span> <span class="keywordtype">char</span> *s;
<a name="l00948"></a>00948                   <a class="code" href="group__DBusMarshal.html#gaa54355ee98d6721d7a29b5ae7d92eb9a" title="Reads a basic-typed value, as with _dbus_marshal_read_basic().">_dbus_type_reader_read_basic</a> (&amp;array,
<a name="l00949"></a>00949                                                 (<span class="keywordtype">void</span> *) &amp;s);
<a name="l00950"></a>00950                   
<a name="l00951"></a>00951                   str_array[j] = <a class="code" href="group__DBusInternalsUtils.html#ga9d00d77f6595b9d7ac1baf59d44bf58c" title="Duplicates a string.">_dbus_strdup</a> (s);
<a name="l00952"></a>00952                   <span class="keywordflow">if</span> (str_array[j] == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00953"></a>00953                     {
<a name="l00954"></a>00954                       <a class="code" href="group__DBusMemory.html#gac200b2dbc8b3f6ecac4d42426fb97b40" title="Frees a NULL-terminated array of strings.">dbus_free_string_array</a> (str_array);
<a name="l00955"></a>00955                       _DBUS_SET_OOM (error);
<a name="l00956"></a>00956                       <span class="keywordflow">goto</span> out;
<a name="l00957"></a>00957                     }
<a name="l00958"></a>00958                   
<a name="l00959"></a>00959                   ++j;
<a name="l00960"></a>00960                   
<a name="l00961"></a>00961                   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusMarshal.html#ga746c09512d4905f2d2fac7ed4c3c63c2" title="Skip to the next value on this &quot;level&quot;.">_dbus_type_reader_next</a> (&amp;array))
<a name="l00962"></a>00962                     _dbus_assert (j == n_elements);
<a name="l00963"></a>00963                 }
<a name="l00964"></a>00964 
<a name="l00965"></a>00965               _dbus_assert (<a class="code" href="group__DBusMarshal.html#gab8e39cb8084247d54d7f272c51622a73" title="Gets the type of the value the reader is currently pointing to; or for a types-only reader gets the t...">_dbus_type_reader_get_current_type</a> (&amp;array) == <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="l00966"></a>00966               _dbus_assert (j == n_elements);
<a name="l00967"></a>00967               _dbus_assert (str_array[j] == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l00968"></a>00968 
<a name="l00969"></a>00969               *str_array_p = str_array;
<a name="l00970"></a>00970               *n_elements_p = n_elements;
<a name="l00971"></a>00971             }
<a name="l00972"></a>00972 <span class="preprocessor">#ifndef DBUS_DISABLE_CHECKS</span>
<a name="l00973"></a>00973 <span class="preprocessor"></span>          <span class="keywordflow">else</span>
<a name="l00974"></a>00974             {
<a name="l00975"></a>00975               <a class="code" href="group__DBusInternalsUtils.html#gabea2c16d6d3fe7c4eb5b9496fc877f84" title="Prints a warning message to stderr.">_dbus_warn</a> (<span class="stringliteral">&quot;you can&#39;t read arrays of container types (struct, variant, array) with %s for now\n&quot;</span>,
<a name="l00976"></a>00976                           _DBUS_FUNCTION_NAME);
<a name="l00977"></a>00977               <span class="keywordflow">goto</span> out;
<a name="l00978"></a>00978             }
<a name="l00979"></a>00979 <span class="preprocessor">#endif</span>
<a name="l00980"></a>00980 <span class="preprocessor"></span>        }
<a name="l00981"></a>00981 <span class="preprocessor">#ifndef DBUS_DISABLE_CHECKS</span>
<a name="l00982"></a>00982 <span class="preprocessor"></span>      <span class="keywordflow">else</span>
<a name="l00983"></a>00983         {
<a name="l00984"></a>00984           <a class="code" href="group__DBusInternalsUtils.html#gabea2c16d6d3fe7c4eb5b9496fc877f84" title="Prints a warning message to stderr.">_dbus_warn</a> (<span class="stringliteral">&quot;you can only read arrays and basic types with %s for now\n&quot;</span>,
<a name="l00985"></a>00985                       _DBUS_FUNCTION_NAME);
<a name="l00986"></a>00986           <span class="keywordflow">goto</span> out;
<a name="l00987"></a>00987         }
<a name="l00988"></a>00988 <span class="preprocessor">#endif</span>
<a name="l00989"></a>00989 <span class="preprocessor"></span>
<a name="l00990"></a>00990       <span class="comment">/* how many arguments already handled */</span>
<a name="l00991"></a>00991       i++;
<a name="l00992"></a>00992 
<a name="l00993"></a>00993       spec_type = va_arg (var_args, <span class="keywordtype">int</span>);
<a name="l00994"></a>00994       <span class="keywordflow">if</span> (!<a class="code" href="group__DBusMarshal.html#ga746c09512d4905f2d2fac7ed4c3c63c2" title="Skip to the next value on this &quot;level&quot;.">_dbus_type_reader_next</a> (&amp;real-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#ae5c4e45b0a5d6642850144f642d7db67" title="reader">reader</a>) &amp;&amp; spec_type != <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="l00995"></a>00995         {
<a name="l00996"></a>00996           <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#gacf5321b161193ad66d5bdf5c910a9792" title="Invalid arguments passed to a method call.">DBUS_ERROR_INVALID_ARGS</a>,
<a name="l00997"></a>00997                           <span class="stringliteral">&quot;Message has only %d arguments, but more were expected&quot;</span>, i);
<a name="l00998"></a>00998           <span class="keywordflow">goto</span> out;
<a name="l00999"></a>00999         }
<a name="l01000"></a>01000     }
<a name="l01001"></a>01001 
<a name="l01002"></a>01002   retval = <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l01003"></a>01003 
<a name="l01004"></a>01004  out:
<a name="l01005"></a>01005   <span class="comment">/* there may memory or unix fd leak in the above iteration if parse failed.</span>
<a name="l01006"></a>01006 <span class="comment">   * so we have another iteration over copy_args to free memory and close</span>
<a name="l01007"></a>01007 <span class="comment">   * unix fds.</span>
<a name="l01008"></a>01008 <span class="comment">   */</span>
<a name="l01009"></a>01009   <span class="keywordflow">if</span> (!retval)
<a name="l01010"></a>01010     {
<a name="l01011"></a>01011       spec_type = first_arg_type;
<a name="l01012"></a>01012       j = 0;
<a name="l01013"></a>01013 
<a name="l01014"></a>01014       <span class="keywordflow">while</span> (j &lt; i)
<a name="l01015"></a>01015         {
<a name="l01016"></a>01016           <span class="keywordflow">if</span> (spec_type == <a class="code" href="group__DBusProtocol.html#ga59f8acaeb207b182982dfb97174b7f16" title="Type code marking a unix file descriptor.">DBUS_TYPE_UNIX_FD</a>)
<a name="l01017"></a>01017             {
<a name="l01018"></a>01018 <span class="preprocessor">#ifdef HAVE_UNIX_FD_PASSING</span>
<a name="l01019"></a>01019 <span class="preprocessor"></span>              <span class="keywordtype">int</span> *pfd;
<a name="l01020"></a>01020 
<a name="l01021"></a>01021               pfd = va_arg (copy_args, <span class="keywordtype">int</span> *);
<a name="l01022"></a>01022               _dbus_assert(pfd);
<a name="l01023"></a>01023               <span class="keywordflow">if</span> (*pfd &gt;= 0)
<a name="l01024"></a>01024                 {
<a name="l01025"></a>01025                   <a class="code" href="group__DBusSysdepsUnix.html#gac448479a1674e3b86cee9a4bdc7eba03" title="Closes a file descriptor.">_dbus_close</a> (*pfd, <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l01026"></a>01026                   *pfd = -1;
<a name="l01027"></a>01027                 }
<a name="l01028"></a>01028 <span class="preprocessor">#endif</span>
<a name="l01029"></a>01029 <span class="preprocessor"></span>            }
<a name="l01030"></a>01030           <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="group__DBusSignature.html#ga2d8afef7d754cf15d6b9733f00654c0e" title="A &quot;basic type&quot; is a somewhat arbitrary concept, but the intent is to include those types that are ful...">dbus_type_is_basic</a> (spec_type))
<a name="l01031"></a>01031             {
<a name="l01032"></a>01032               <span class="comment">/* move the index forward */</span>
<a name="l01033"></a>01033               va_arg (copy_args, <a class="code" href="unionDBusBasicValue.html" title="A simple value union that lets you access bytes as if they were various types; useful when dealing wi...">DBusBasicValue</a> *);
<a name="l01034"></a>01034             }
<a name="l01035"></a>01035           <span class="keywordflow">else</span> <span class="keywordflow">if</span> (spec_type == <a class="code" href="group__DBusProtocol.html#ga8912f600f81a773066ca03d9163613a9" title="Type code marking a D-Bus array type.">DBUS_TYPE_ARRAY</a>)
<a name="l01036"></a>01036             {
<a name="l01037"></a>01037               <span class="keywordtype">int</span> spec_element_type;
<a name="l01038"></a>01038 
<a name="l01039"></a>01039               spec_element_type = va_arg (copy_args, <span class="keywordtype">int</span>);
<a name="l01040"></a>01040               <span class="keywordflow">if</span> (<a class="code" href="group__DBusSignature.html#ga2f89962cbd33e4ad843824157bae2093" title="Tells you whether values of this type can change length if you set them to some other value...">dbus_type_is_fixed</a> (spec_element_type))
<a name="l01041"></a>01041                 {
<a name="l01042"></a>01042                   <span class="comment">/* move the index forward */</span>
<a name="l01043"></a>01043                   va_arg (copy_args, <span class="keyword">const</span> <a class="code" href="unionDBusBasicValue.html" title="A simple value union that lets you access bytes as if they were various types; useful when dealing wi...">DBusBasicValue</a> **);
<a name="l01044"></a>01044                   va_arg (copy_args, <span class="keywordtype">int</span> *);
<a name="l01045"></a>01045                 }
<a name="l01046"></a>01046               <span class="keywordflow">else</span> <span class="keywordflow">if</span> (_DBUS_TYPE_IS_STRINGLIKE (spec_element_type))
<a name="l01047"></a>01047                 {
<a name="l01048"></a>01048                   <span class="keywordtype">char</span> ***str_array_p;
<a name="l01049"></a>01049 
<a name="l01050"></a>01050                   str_array_p = va_arg (copy_args, <span class="keywordtype">char</span> ***);
<a name="l01051"></a>01051                   <span class="comment">/* move the index forward */</span>
<a name="l01052"></a>01052                   va_arg (copy_args, <span class="keywordtype">int</span> *);
<a name="l01053"></a>01053                   _dbus_assert (str_array_p != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l01054"></a>01054                   <a class="code" href="group__DBusMemory.html#gac200b2dbc8b3f6ecac4d42426fb97b40" title="Frees a NULL-terminated array of strings.">dbus_free_string_array</a> (*str_array_p);
<a name="l01055"></a>01055                   *str_array_p = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l01056"></a>01056                 }
<a name="l01057"></a>01057             }
<a name="l01058"></a>01058 
<a name="l01059"></a>01059           spec_type = va_arg (copy_args, <span class="keywordtype">int</span>);
<a name="l01060"></a>01060           j++;
<a name="l01061"></a>01061         }
<a name="l01062"></a>01062     }
<a name="l01063"></a>01063 
<a name="l01064"></a>01064   va_end (copy_args);
<a name="l01065"></a>01065   <span class="keywordflow">return</span> retval;
<a name="l01066"></a>01066 }
<a name="l01067"></a>01067 
<a name="l01126"></a>01126 <a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a>
<a name="l01127"></a><a class="code" href="group__DBusMessage.html#ga390710c25564c80025a006c376da2030">01127</a> <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> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message)
<a name="l01128"></a>01128 {
<a name="l01129"></a>01129   _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>, 0);
<a name="l01130"></a>01130 
<a name="l01131"></a>01131   <span class="keywordflow">return</span> <a class="code" href="group__DBusMarshal.html#ga7ec7222423db42935aae4a24499ee0fb" title="See dbus_message_get_serial()">_dbus_header_get_serial</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>);
<a name="l01132"></a>01132 }
<a name="l01133"></a>01133 
<a name="l01142"></a>01142 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l01143"></a><a class="code" href="group__DBusMessage.html#gaec08603ff3d49bbcded67d25188a23f1">01143</a> <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> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>   *message,
<a name="l01144"></a>01144                                <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="l01145"></a>01145 {
<a name="l01146"></a>01146   _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="l01147"></a>01147   _dbus_return_val_if_fail (!message-&gt;<a class="code" href="structDBusMessage.html#ac926e7027f22608d75a6dfe18680b9e7" title="Message being sent, no modifications allowed.">locked</a>, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l01148"></a>01148   _dbus_return_val_if_fail (reply_serial != 0, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>); <span class="comment">/* 0 is invalid */</span>
<a name="l01149"></a>01149 
<a name="l01150"></a>01150   <span class="keywordflow">return</span> <a class="code" href="group__DBusMarshal.html#ga4349de00b7754a337526e36fda133464" title="Sets the value of a field with basic type.">_dbus_header_set_field_basic</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>,
<a name="l01151"></a>01151                                        <a class="code" href="group__DBusProtocol.html#ga1067e28a7151a161e5fd601a3b017584" title="Header field code for a reply serial, used to match a DBUS_MESSAGE_TYPE_METHOD_RETURN message with th...">DBUS_HEADER_FIELD_REPLY_SERIAL</a>,
<a name="l01152"></a>01152                                        <a class="code" href="group__DBusProtocol.html#gaedb1740bd8a9174b98ac593eded25d49" title="Type code marking a 32-bit unsigned integer.">DBUS_TYPE_UINT32</a>,
<a name="l01153"></a>01153                                        &amp;reply_serial);
<a name="l01154"></a>01154 }
<a name="l01155"></a>01155 
<a name="l01162"></a>01162 <a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a>
<a name="l01163"></a><a class="code" href="group__DBusMessage.html#ga94c43b2b237d842a6b91da6f94818d47">01163</a> <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>  (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message)
<a name="l01164"></a>01164 {
<a name="l01165"></a>01165   <a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a> v_UINT32;
<a name="l01166"></a>01166 
<a name="l01167"></a>01167   _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>, 0);
<a name="l01168"></a>01168 
<a name="l01169"></a>01169   <span class="keywordflow">if</span> (<a class="code" href="group__DBusMarshal.html#ga499973a18dcb17d854eaf14101a66736" title="Gets the value of a field with basic type.">_dbus_header_get_field_basic</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>,
<a name="l01170"></a>01170                                     <a class="code" href="group__DBusProtocol.html#ga1067e28a7151a161e5fd601a3b017584" title="Header field code for a reply serial, used to match a DBUS_MESSAGE_TYPE_METHOD_RETURN message with th...">DBUS_HEADER_FIELD_REPLY_SERIAL</a>,
<a name="l01171"></a>01171                                     <a class="code" href="group__DBusProtocol.html#gaedb1740bd8a9174b98ac593eded25d49" title="Type code marking a 32-bit unsigned integer.">DBUS_TYPE_UINT32</a>,
<a name="l01172"></a>01172                                     &amp;v_UINT32))
<a name="l01173"></a>01173     <span class="keywordflow">return</span> v_UINT32;
<a name="l01174"></a>01174   <span class="keywordflow">else</span>
<a name="l01175"></a>01175     <span class="keywordflow">return</span> 0;
<a name="l01176"></a>01176 }
<a name="l01177"></a>01177 
<a name="l01178"></a>01178 <span class="keyword">static</span> <span class="keywordtype">void</span>
<a name="l01179"></a>01179 dbus_message_finalize (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message)
<a name="l01180"></a>01180 {
<a name="l01181"></a>01181   _dbus_assert (<a class="code" href="group__DBusSysdeps.html#ga626c810359ba0e362367ce2ec6691aca" title="Atomically get the value of an integer.">_dbus_atomic_get</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a324c5377e0be18dd84ac519ab2d23f0d" title="Reference count.">refcount</a>) == 0);
<a name="l01182"></a>01182 
<a name="l01183"></a>01183   <span class="comment">/* This calls application callbacks! */</span>
<a name="l01184"></a>01184   <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;message-&gt;<a class="code" href="structDBusMessage.html#a179c446523c6321e04f88a671363be19" title="Data stored by allocated integer ID.">slot_list</a>);
<a name="l01185"></a>01185 
<a name="l01186"></a>01186   <a class="code" href="group__DBusList.html#ga8dd69084b53361803a765e6d53d5b9d1" title="Calls the given function for each element in the list.">_dbus_list_foreach</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#ac6fc05ddffb11ac60b9da046abd2dc52" title="0-N DBusCounter used to track message size/unix fds.">counters</a>,
<a name="l01187"></a>01187                       free_counter, message);
<a name="l01188"></a>01188   <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;message-&gt;<a class="code" href="structDBusMessage.html#ac6fc05ddffb11ac60b9da046abd2dc52" title="0-N DBusCounter used to track message size/unix fds.">counters</a>);
<a name="l01189"></a>01189 
<a name="l01190"></a>01190   <a class="code" href="group__DBusMarshal.html#gab90a814a27aeeace7e02c4ed130539cf" title="Frees a header.">_dbus_header_free</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>);
<a name="l01191"></a>01191   <a class="code" href="group__DBusString.html#ga781ca91acda49a834dce7d0ed0eef212" title="Frees a string created by _dbus_string_init().">_dbus_string_free</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a0b9d14d6e0529f0ec2e3c0087fe62a9e" title="Body network data.">body</a>);
<a name="l01192"></a>01192 
<a name="l01193"></a>01193 <span class="preprocessor">#ifdef HAVE_UNIX_FD_PASSING</span>
<a name="l01194"></a>01194 <span class="preprocessor"></span>  close_unix_fds(message-&gt;unix_fds, &amp;message-&gt;n_unix_fds);
<a name="l01195"></a>01195   <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>(message-&gt;unix_fds);
<a name="l01196"></a>01196 <span class="preprocessor">#endif</span>
<a name="l01197"></a>01197 <span class="preprocessor"></span>
<a name="l01198"></a>01198   _dbus_assert (<a class="code" href="group__DBusSysdeps.html#ga626c810359ba0e362367ce2ec6691aca" title="Atomically get the value of an integer.">_dbus_atomic_get</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a324c5377e0be18dd84ac519ab2d23f0d" title="Reference count.">refcount</a>) == 0);
<a name="l01199"></a>01199 
<a name="l01200"></a>01200   <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> (message);
<a name="l01201"></a>01201 }
<a name="l01202"></a>01202 
<a name="l01203"></a>01203 <span class="keyword">static</span> <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>*
<a name="l01204"></a>01204 dbus_message_new_empty_header (<span class="keywordtype">void</span>)
<a name="l01205"></a>01205 {
<a name="l01206"></a>01206   <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message;
<a name="l01207"></a>01207   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> from_cache;
<a name="l01208"></a>01208 
<a name="l01209"></a>01209   message = dbus_message_get_cached ();
<a name="l01210"></a>01210 
<a name="l01211"></a>01211   <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="l01212"></a>01212     {
<a name="l01213"></a>01213       from_cache = <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l01214"></a>01214     }
<a name="l01215"></a>01215   <span class="keywordflow">else</span>
<a name="l01216"></a>01216     {
<a name="l01217"></a>01217       from_cache = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l01218"></a>01218       message = <a class="code" href="group__DBusMemory.html#gaba9d823abda7f4cadbaf5177d3b8b793" title="Safe macro for using dbus_malloc0().">dbus_new0</a> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>, 1);
<a name="l01219"></a>01219       <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="l01220"></a>01220         <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="l01221"></a>01221 <span class="preprocessor">#ifndef DBUS_DISABLE_CHECKS</span>
<a name="l01222"></a>01222 <span class="preprocessor"></span>      message-&gt;<a class="code" href="structDBusMessage.html#a96263aa8a777c8c661d2596911c7d592" title="_dbus_current_generation when message was created">generation</a> = <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="l01223"></a>01223 <span class="preprocessor">#endif</span>
<a name="l01224"></a>01224 <span class="preprocessor"></span>
<a name="l01225"></a>01225 <span class="preprocessor">#ifdef HAVE_UNIX_FD_PASSING</span>
<a name="l01226"></a>01226 <span class="preprocessor"></span>      message-&gt;unix_fds = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l01227"></a>01227       message-&gt;n_unix_fds_allocated = 0;
<a name="l01228"></a>01228 <span class="preprocessor">#endif</span>
<a name="l01229"></a>01229 <span class="preprocessor"></span>    }
<a name="l01230"></a>01230 
<a name="l01231"></a>01231   <a class="code" href="group__DBusSysdeps.html#gae74c3fcf12acaeccdb152ef907de951c" title="Atomically increments an integer.">_dbus_atomic_inc</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a324c5377e0be18dd84ac519ab2d23f0d" title="Reference count.">refcount</a>);
<a name="l01232"></a>01232 
<a name="l01233"></a>01233   _dbus_message_trace_ref (message, 0, 1, <span class="stringliteral">&quot;new_empty_header&quot;</span>);
<a name="l01234"></a>01234 
<a name="l01235"></a>01235   message-&gt;<a class="code" href="structDBusMessage.html#ac926e7027f22608d75a6dfe18680b9e7" title="Message being sent, no modifications allowed.">locked</a> = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l01236"></a>01236 <span class="preprocessor">#ifndef DBUS_DISABLE_CHECKS</span>
<a name="l01237"></a>01237 <span class="preprocessor"></span>  message-&gt;<a class="code" href="structDBusMessage.html#ac71fa5534264093e6af8bc41f15237c8" title="Has been &quot;freed&quot; since it&#39;s in the cache (this is a debug feature)">in_cache</a> = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l01238"></a>01238 <span class="preprocessor">#endif</span>
<a name="l01239"></a>01239 <span class="preprocessor"></span>  message-&gt;<a class="code" href="structDBusMessage.html#ac6fc05ddffb11ac60b9da046abd2dc52" title="0-N DBusCounter used to track message size/unix fds.">counters</a> = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l01240"></a>01240   message-&gt;<a class="code" href="structDBusMessage.html#ab8f43d40fa870f97f1126256568cec61" title="Size we incremented the size counters by.">size_counter_delta</a> = 0;
<a name="l01241"></a>01241   message-&gt;<a class="code" href="structDBusMessage.html#a5d102e908f6ff96a5a0aa6a39b4963a8" title="Incremented when iterators are invalidated.">changed_stamp</a> = 0;
<a name="l01242"></a>01242 
<a name="l01243"></a>01243 <span class="preprocessor">#ifdef HAVE_UNIX_FD_PASSING</span>
<a name="l01244"></a>01244 <span class="preprocessor"></span>  message-&gt;n_unix_fds = 0;
<a name="l01245"></a>01245   message-&gt;n_unix_fds_allocated = 0;
<a name="l01246"></a>01246   message-&gt;unix_fd_counter_delta = 0;
<a name="l01247"></a>01247 <span class="preprocessor">#endif</span>
<a name="l01248"></a>01248 <span class="preprocessor"></span>
<a name="l01249"></a>01249   <span class="keywordflow">if</span> (!from_cache)
<a name="l01250"></a>01250     <a class="code" href="group__DBusDataSlot.html#ga6de49b3a1210202215d40a5a19806992" title="Initializes a slot list.">_dbus_data_slot_list_init</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a179c446523c6321e04f88a671363be19" title="Data stored by allocated integer ID.">slot_list</a>);
<a name="l01251"></a>01251 
<a name="l01252"></a>01252   <span class="keywordflow">if</span> (from_cache)
<a name="l01253"></a>01253     {
<a name="l01254"></a>01254       <a class="code" href="group__DBusMarshal.html#ga6d41ad4de211c87f4b8a43340b6893e2" title="Re-initializes a header that was previously initialized and never freed.">_dbus_header_reinit</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>);
<a name="l01255"></a>01255       <a class="code" href="group__DBusString.html#ga08c423b93c28dd746dcb93e0461ab95c" title="Sets the length of a string.">_dbus_string_set_length</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a0b9d14d6e0529f0ec2e3c0087fe62a9e" title="Body network data.">body</a>, 0);
<a name="l01256"></a>01256     }
<a name="l01257"></a>01257   <span class="keywordflow">else</span>
<a name="l01258"></a>01258     {
<a name="l01259"></a>01259       <span class="keywordflow">if</span> (!<a class="code" href="group__DBusMarshal.html#gabe1b78193d712976734a39d35842f033" title="Initializes a header, but doesn&#39;t prepare it for use; to make the header valid, you have to call _dbu...">_dbus_header_init</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>))
<a name="l01260"></a>01260         {
<a name="l01261"></a>01261           <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> (message);
<a name="l01262"></a>01262           <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="l01263"></a>01263         }
<a name="l01264"></a>01264 
<a name="l01265"></a>01265       <span class="keywordflow">if</span> (!<a class="code" href="group__DBusString.html#ga569b784beea1b4fa98f05d27e6dd0e72" title="Initializes a string that can be up to the given allocation size before it has to realloc...">_dbus_string_init_preallocated</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a0b9d14d6e0529f0ec2e3c0087fe62a9e" title="Body network data.">body</a>, 32))
<a name="l01266"></a>01266         {
<a name="l01267"></a>01267           <a class="code" href="group__DBusMarshal.html#gab90a814a27aeeace7e02c4ed130539cf" title="Frees a header.">_dbus_header_free</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>);
<a name="l01268"></a>01268           <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> (message);
<a name="l01269"></a>01269           <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="l01270"></a>01270         }
<a name="l01271"></a>01271     }
<a name="l01272"></a>01272 
<a name="l01273"></a>01273   <span class="keywordflow">return</span> message;
<a name="l01274"></a>01274 }
<a name="l01275"></a>01275 
<a name="l01288"></a>01288 <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>*
<a name="l01289"></a><a class="code" href="group__DBusMessage.html#gab9e5bf8d87a95c5ca7026a791148ebd4">01289</a> <a class="code" href="group__DBusMessage.html#gab9e5bf8d87a95c5ca7026a791148ebd4" title="Constructs a new message of the given message type.">dbus_message_new</a> (<span class="keywordtype">int</span> message_type)
<a name="l01290"></a>01290 {
<a name="l01291"></a>01291   <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message;
<a name="l01292"></a>01292 
<a name="l01293"></a>01293   _dbus_return_val_if_fail (message_type != <a class="code" href="group__DBusProtocol.html#gac975525a6ce258a7a70c583c9741b516" title="This value is never a valid message type, see dbus_message_get_type()">DBUS_MESSAGE_TYPE_INVALID</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 
<a name="l01295"></a>01295   message = dbus_message_new_empty_header ();
<a name="l01296"></a>01296   <span class="keywordflow">if</span> (message == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01297"></a>01297     <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="l01298"></a>01298 
<a name="l01299"></a>01299   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusMarshal.html#gac7901e4196f10d4763df89b42d5db03e" title="Fills in the primary fields of the header, so the header is ready for use.">_dbus_header_create</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>,
<a name="l01300"></a>01300                             DBUS_COMPILER_BYTE_ORDER,
<a name="l01301"></a>01301                             message_type,
<a name="l01302"></a>01302                             <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 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="l01303"></a>01303     {
<a name="l01304"></a>01304       <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="l01305"></a>01305       <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="l01306"></a>01306     }
<a name="l01307"></a>01307 
<a name="l01308"></a>01308   <span class="keywordflow">return</span> message;
<a name="l01309"></a>01309 }
<a name="l01310"></a>01310 
<a name="l01332"></a>01332 <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>*
<a name="l01333"></a><a class="code" href="group__DBusMessage.html#ga98ddc82450d818138ef326a284201ee0">01333</a> <a class="code" href="group__DBusMessage.html#ga98ddc82450d818138ef326a284201ee0" title="Constructs a new message to invoke a method on a remote object.">dbus_message_new_method_call</a> (<span class="keyword">const</span> <span class="keywordtype">char</span> *destination,
<a name="l01334"></a>01334                               <span class="keyword">const</span> <span class="keywordtype">char</span> *path,
<a name="l01335"></a>01335                               <span class="keyword">const</span> <span class="keywordtype">char</span> *iface,
<a name="l01336"></a>01336                               <span class="keyword">const</span> <span class="keywordtype">char</span> *method)
<a name="l01337"></a>01337 {
<a name="l01338"></a>01338   <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message;
<a name="l01339"></a>01339 
<a name="l01340"></a>01340   _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#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l01341"></a>01341   _dbus_return_val_if_fail (method != <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="l01342"></a>01342   _dbus_return_val_if_fail (destination == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a> ||
<a name="l01343"></a>01343                             _dbus_check_is_valid_bus_name (destination), <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l01344"></a>01344   _dbus_return_val_if_fail (_dbus_check_is_valid_path (path), <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l01345"></a>01345   _dbus_return_val_if_fail (iface == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a> ||
<a name="l01346"></a>01346                             _dbus_check_is_valid_interface (iface), <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l01347"></a>01347   _dbus_return_val_if_fail (_dbus_check_is_valid_member (method), <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l01348"></a>01348 
<a name="l01349"></a>01349   message = dbus_message_new_empty_header ();
<a name="l01350"></a>01350   <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="l01351"></a>01351     <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="l01352"></a>01352 
<a name="l01353"></a>01353   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusMarshal.html#gac7901e4196f10d4763df89b42d5db03e" title="Fills in the primary fields of the header, so the header is ready for use.">_dbus_header_create</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>,
<a name="l01354"></a>01354                             DBUS_COMPILER_BYTE_ORDER,
<a name="l01355"></a>01355                             <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="l01356"></a>01356                             destination, path, iface, method, <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>))
<a name="l01357"></a>01357     {
<a name="l01358"></a>01358       <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="l01359"></a>01359       <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="l01360"></a>01360     }
<a name="l01361"></a>01361 
<a name="l01362"></a>01362   <span class="keywordflow">return</span> message;
<a name="l01363"></a>01363 }
<a name="l01364"></a>01364 
<a name="l01372"></a>01372 <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>*
<a name="l01373"></a><a class="code" href="group__DBusMessage.html#ga95142bd8288f397194ee0eefb1d27125">01373</a> <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> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *method_call)
<a name="l01374"></a>01374 {
<a name="l01375"></a>01375   <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message;
<a name="l01376"></a>01376   <span class="keyword">const</span> <span class="keywordtype">char</span> *sender;
<a name="l01377"></a>01377 
<a name="l01378"></a>01378   _dbus_return_val_if_fail (method_call != <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="l01379"></a>01379 
<a name="l01380"></a>01380   sender = <a class="code" href="group__DBusMessage.html#ga13ce514ceb2d1598751f3a7760cf1375" title="Gets the unique name of the connection which originated this message, or NULL if unknown or inapplica...">dbus_message_get_sender</a> (method_call);
<a name="l01381"></a>01381 
<a name="l01382"></a>01382   <span class="comment">/* sender is allowed to be null here in peer-to-peer case */</span>
<a name="l01383"></a>01383 
<a name="l01384"></a>01384   message = dbus_message_new_empty_header ();
<a name="l01385"></a>01385   <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="l01386"></a>01386     <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="l01387"></a>01387 
<a name="l01388"></a>01388   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusMarshal.html#gac7901e4196f10d4763df89b42d5db03e" title="Fills in the primary fields of the header, so the header is ready for use.">_dbus_header_create</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>,
<a name="l01389"></a>01389                             DBUS_COMPILER_BYTE_ORDER,
<a name="l01390"></a>01390                             <a class="code" href="group__DBusProtocol.html#ga4a9012edd7f22342f845e98150aeb858" title="Message type of a method return message, see dbus_message_get_type()">DBUS_MESSAGE_TYPE_METHOD_RETURN</a>,
<a name="l01391"></a>01391                             sender, <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 class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>))
<a name="l01392"></a>01392     {
<a name="l01393"></a>01393       <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="l01394"></a>01394       <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="l01395"></a>01395     }
<a name="l01396"></a>01396 
<a name="l01397"></a>01397   <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="l01398"></a>01398 
<a name="l01399"></a>01399   <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="l01400"></a>01400                                       <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> (method_call)))
<a name="l01401"></a>01401     {
<a name="l01402"></a>01402       <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="l01403"></a>01403       <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="l01404"></a>01404     }
<a name="l01405"></a>01405 
<a name="l01406"></a>01406   <span class="keywordflow">return</span> message;
<a name="l01407"></a>01407 }
<a name="l01408"></a>01408 
<a name="l01423"></a>01423 <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>*
<a name="l01424"></a><a class="code" href="group__DBusMessage.html#ga6ce3213dfb17be7956affba40207a5a0">01424</a> <a class="code" href="group__DBusMessage.html#ga6ce3213dfb17be7956affba40207a5a0" title="Constructs a new message representing a signal emission.">dbus_message_new_signal</a> (<span class="keyword">const</span> <span class="keywordtype">char</span> *path,
<a name="l01425"></a>01425                          <span class="keyword">const</span> <span class="keywordtype">char</span> *iface,
<a name="l01426"></a>01426                          <span class="keyword">const</span> <span class="keywordtype">char</span> *name)
<a name="l01427"></a>01427 {
<a name="l01428"></a>01428   <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message;
<a name="l01429"></a>01429 
<a name="l01430"></a>01430   _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#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l01431"></a>01431   _dbus_return_val_if_fail (iface != <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="l01432"></a>01432   _dbus_return_val_if_fail (name != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>, <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l01433"></a>01433   _dbus_return_val_if_fail (_dbus_check_is_valid_path (path), <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l01434"></a>01434   _dbus_return_val_if_fail (_dbus_check_is_valid_interface (iface), <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l01435"></a>01435   _dbus_return_val_if_fail (_dbus_check_is_valid_member (name), <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l01436"></a>01436 
<a name="l01437"></a>01437   message = dbus_message_new_empty_header ();
<a name="l01438"></a>01438   <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="l01439"></a>01439     <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="l01440"></a>01440 
<a name="l01441"></a>01441   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusMarshal.html#gac7901e4196f10d4763df89b42d5db03e" title="Fills in the primary fields of the header, so the header is ready for use.">_dbus_header_create</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>,
<a name="l01442"></a>01442                             DBUS_COMPILER_BYTE_ORDER,
<a name="l01443"></a>01443                             <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="l01444"></a>01444                             <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>, path, iface, name, <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>))
<a name="l01445"></a>01445     {
<a name="l01446"></a>01446       <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="l01447"></a>01447       <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="l01448"></a>01448     }
<a name="l01449"></a>01449 
<a name="l01450"></a>01450   <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="l01451"></a>01451 
<a name="l01452"></a>01452   <span class="keywordflow">return</span> message;
<a name="l01453"></a>01453 }
<a name="l01454"></a>01454 
<a name="l01469"></a>01469 <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>*
<a name="l01470"></a><a class="code" href="group__DBusMessage.html#ga2ab896965aec97fb21293affeed36232">01470</a> <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> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *reply_to,
<a name="l01471"></a>01471                         <span class="keyword">const</span> <span class="keywordtype">char</span>  *error_name,
<a name="l01472"></a>01472                         <span class="keyword">const</span> <span class="keywordtype">char</span>  *error_message)
<a name="l01473"></a>01473 {
<a name="l01474"></a>01474   <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message;
<a name="l01475"></a>01475   <span class="keyword">const</span> <span class="keywordtype">char</span> *sender;
<a name="l01476"></a>01476   <a class="code" href="structDBusMessageIter.html" title="DBusMessageIter struct; contains no public fields.">DBusMessageIter</a> iter;
<a name="l01477"></a>01477 
<a name="l01478"></a>01478   _dbus_return_val_if_fail (reply_to != <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="l01479"></a>01479   _dbus_return_val_if_fail (error_name != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>, <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l01480"></a>01480   _dbus_return_val_if_fail (_dbus_check_is_valid_error_name (error_name), <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l01481"></a>01481 
<a name="l01482"></a>01482   sender = <a class="code" href="group__DBusMessage.html#ga13ce514ceb2d1598751f3a7760cf1375" title="Gets the unique name of the connection which originated this message, or NULL if unknown or inapplica...">dbus_message_get_sender</a> (reply_to);
<a name="l01483"></a>01483 
<a name="l01484"></a>01484   <span class="comment">/* sender may be NULL for non-message-bus case or</span>
<a name="l01485"></a>01485 <span class="comment">   * when the message bus is dealing with an unregistered</span>
<a name="l01486"></a>01486 <span class="comment">   * connection.</span>
<a name="l01487"></a>01487 <span class="comment">   */</span>
<a name="l01488"></a>01488   message = dbus_message_new_empty_header ();
<a name="l01489"></a>01489   <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="l01490"></a>01490     <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="l01491"></a>01491 
<a name="l01492"></a>01492   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusMarshal.html#gac7901e4196f10d4763df89b42d5db03e" title="Fills in the primary fields of the header, so the header is ready for use.">_dbus_header_create</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>,
<a name="l01493"></a>01493                             DBUS_COMPILER_BYTE_ORDER,
<a name="l01494"></a>01494                             <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="l01495"></a>01495                             sender, <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>, error_name))
<a name="l01496"></a>01496     {
<a name="l01497"></a>01497       <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="l01498"></a>01498       <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="l01499"></a>01499     }
<a name="l01500"></a>01500 
<a name="l01501"></a>01501   <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="l01502"></a>01502 
<a name="l01503"></a>01503   <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="l01504"></a>01504                                       <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> (reply_to)))
<a name="l01505"></a>01505     {
<a name="l01506"></a>01506       <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="l01507"></a>01507       <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="l01508"></a>01508     }
<a name="l01509"></a>01509 
<a name="l01510"></a>01510   <span class="keywordflow">if</span> (error_message != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01511"></a>01511     {
<a name="l01512"></a>01512       <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="l01513"></a>01513       <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="l01514"></a>01514                                            <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="l01515"></a>01515                                            &amp;error_message))
<a name="l01516"></a>01516         {
<a name="l01517"></a>01517           <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="l01518"></a>01518           <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="l01519"></a>01519         }
<a name="l01520"></a>01520     }
<a name="l01521"></a>01521 
<a name="l01522"></a>01522   <span class="keywordflow">return</span> message;
<a name="l01523"></a>01523 }
<a name="l01524"></a>01524 
<a name="l01541"></a>01541 <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>*
<a name="l01542"></a><a class="code" href="group__DBusMessage.html#ga707a27881820f964e3606bc906a47978">01542</a> <a class="code" href="group__DBusMessage.html#ga707a27881820f964e3606bc906a47978" title="Creates a new message that is an error reply to another message, allowing you to use printf formattin...">dbus_message_new_error_printf</a> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *reply_to,
<a name="l01543"></a>01543                                <span class="keyword">const</span> <span class="keywordtype">char</span>  *error_name,
<a name="l01544"></a>01544                                <span class="keyword">const</span> <span class="keywordtype">char</span>  *error_format,
<a name="l01545"></a>01545                                ...)
<a name="l01546"></a>01546 {
<a name="l01547"></a>01547   va_list args;
<a name="l01548"></a>01548   <a class="code" href="structDBusString.html">DBusString</a> str;
<a name="l01549"></a>01549   <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message;
<a name="l01550"></a>01550 
<a name="l01551"></a>01551   _dbus_return_val_if_fail (reply_to != <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="l01552"></a>01552   _dbus_return_val_if_fail (error_name != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>, <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l01553"></a>01553   _dbus_return_val_if_fail (_dbus_check_is_valid_error_name (error_name), <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l01554"></a>01554 
<a name="l01555"></a>01555   <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="l01556"></a>01556     <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="l01557"></a>01557 
<a name="l01558"></a>01558   va_start (args, error_format);
<a name="l01559"></a>01559 
<a name="l01560"></a>01560   <span class="keywordflow">if</span> (<a class="code" href="group__DBusString.html#ga8d794f292831d1a7edeb971b13a2c641" title="Appends a printf-style formatted string to the DBusString.">_dbus_string_append_printf_valist</a> (&amp;str, error_format, args))
<a name="l01561"></a>01561     message = <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> (reply_to, error_name,
<a name="l01562"></a>01562                                       <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="l01563"></a>01563   <span class="keywordflow">else</span>
<a name="l01564"></a>01564     message = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l01565"></a>01565 
<a name="l01566"></a>01566   <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="l01567"></a>01567 
<a name="l01568"></a>01568   va_end (args);
<a name="l01569"></a>01569 
<a name="l01570"></a>01570   <span class="keywordflow">return</span> message;
<a name="l01571"></a>01571 }
<a name="l01572"></a>01572 
<a name="l01573"></a>01573 
<a name="l01586"></a>01586 <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *
<a name="l01587"></a><a class="code" href="group__DBusMessage.html#ga4bed3858b3b48ec7c86d9fc56a6ce372">01587</a> <a class="code" href="group__DBusMessage.html#ga4bed3858b3b48ec7c86d9fc56a6ce372" title="Creates a new message that is an exact replica of the message specified, except that its refcount is ...">dbus_message_copy</a> (<span class="keyword">const</span> <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message)
<a name="l01588"></a>01588 {
<a name="l01589"></a>01589   <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *retval;
<a name="l01590"></a>01590 
<a name="l01591"></a>01591   _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="l01592"></a>01592 
<a name="l01593"></a>01593   retval = <a class="code" href="group__DBusMemory.html#gaba9d823abda7f4cadbaf5177d3b8b793" title="Safe macro for using dbus_malloc0().">dbus_new0</a> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>, 1);
<a name="l01594"></a>01594   <span class="keywordflow">if</span> (retval == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01595"></a>01595     <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="l01596"></a>01596 
<a name="l01597"></a>01597   <a class="code" href="group__DBusSysdeps.html#gae74c3fcf12acaeccdb152ef907de951c" title="Atomically increments an integer.">_dbus_atomic_inc</a> (&amp;retval-&gt;<a class="code" href="structDBusMessage.html#a324c5377e0be18dd84ac519ab2d23f0d" title="Reference count.">refcount</a>);
<a name="l01598"></a>01598 
<a name="l01599"></a>01599   retval-&gt;<a class="code" href="structDBusMessage.html#ac926e7027f22608d75a6dfe18680b9e7" title="Message being sent, no modifications allowed.">locked</a> = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l01600"></a>01600 <span class="preprocessor">#ifndef DBUS_DISABLE_CHECKS</span>
<a name="l01601"></a>01601 <span class="preprocessor"></span>  retval-&gt;<a class="code" href="structDBusMessage.html#a96263aa8a777c8c661d2596911c7d592" title="_dbus_current_generation when message was created">generation</a> = message-&gt;<a class="code" href="structDBusMessage.html#a96263aa8a777c8c661d2596911c7d592" title="_dbus_current_generation when message was created">generation</a>;
<a name="l01602"></a>01602 <span class="preprocessor">#endif</span>
<a name="l01603"></a>01603 <span class="preprocessor"></span>
<a name="l01604"></a>01604   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusMarshal.html#ga0d5aad82f8bf5a314dcf3f70930e254b" title="Initializes dest with a copy of the given header.">_dbus_header_copy</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>, &amp;retval-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>))
<a name="l01605"></a>01605     {
<a name="l01606"></a>01606       <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> (retval);
<a name="l01607"></a>01607       <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="l01608"></a>01608     }
<a name="l01609"></a>01609 
<a name="l01610"></a>01610   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusString.html#ga569b784beea1b4fa98f05d27e6dd0e72" title="Initializes a string that can be up to the given allocation size before it has to realloc...">_dbus_string_init_preallocated</a> (&amp;retval-&gt;<a class="code" href="structDBusMessage.html#a0b9d14d6e0529f0ec2e3c0087fe62a9e" title="Body network data.">body</a>,
<a name="l01611"></a>01611                                        <a class="code" href="group__DBusString.html#gaa5136e6fd2c5188f4b88de7863369c6d" title="Gets the length of a string (not including nul termination).">_dbus_string_get_length</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a0b9d14d6e0529f0ec2e3c0087fe62a9e" title="Body network data.">body</a>)))
<a name="l01612"></a>01612     {
<a name="l01613"></a>01613       <a class="code" href="group__DBusMarshal.html#gab90a814a27aeeace7e02c4ed130539cf" title="Frees a header.">_dbus_header_free</a> (&amp;retval-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>);
<a name="l01614"></a>01614       <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> (retval);
<a name="l01615"></a>01615       <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="l01616"></a>01616     }
<a name="l01617"></a>01617 
<a name="l01618"></a>01618   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusString.html#ga3c10f0d1bcaa3b450025b9c6a8b901d7" title="Like _dbus_string_move(), but does not delete the section of the source string that&#39;s copied to the d...">_dbus_string_copy</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a0b9d14d6e0529f0ec2e3c0087fe62a9e" title="Body network data.">body</a>, 0,
<a name="l01619"></a>01619                           &amp;retval-&gt;<a class="code" href="structDBusMessage.html#a0b9d14d6e0529f0ec2e3c0087fe62a9e" title="Body network data.">body</a>, 0))
<a name="l01620"></a>01620     <span class="keywordflow">goto</span> failed_copy;
<a name="l01621"></a>01621 
<a name="l01622"></a>01622 <span class="preprocessor">#ifdef HAVE_UNIX_FD_PASSING</span>
<a name="l01623"></a>01623 <span class="preprocessor"></span>  retval-&gt;unix_fds = <a class="code" href="group__DBusMemory.html#ga54ccb556e7964112a825a7f46c156ca0" title="Safe macro for using dbus_malloc().">dbus_new</a>(<span class="keywordtype">int</span>, message-&gt;n_unix_fds);
<a name="l01624"></a>01624   <span class="keywordflow">if</span> (retval-&gt;unix_fds == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a> &amp;&amp; message-&gt;n_unix_fds &gt; 0)
<a name="l01625"></a>01625     <span class="keywordflow">goto</span> failed_copy;
<a name="l01626"></a>01626 
<a name="l01627"></a>01627   retval-&gt;n_unix_fds_allocated = message-&gt;n_unix_fds;
<a name="l01628"></a>01628 
<a name="l01629"></a>01629   <span class="keywordflow">for</span> (retval-&gt;n_unix_fds = 0;
<a name="l01630"></a>01630        retval-&gt;n_unix_fds &lt; message-&gt;n_unix_fds;
<a name="l01631"></a>01631        retval-&gt;n_unix_fds++)
<a name="l01632"></a>01632     {
<a name="l01633"></a>01633       retval-&gt;unix_fds[retval-&gt;n_unix_fds] = <a class="code" href="group__DBusSysdepsUnix.html#gad79d20e59fb519233004208988851cf1" title="Duplicates a file descriptor.">_dbus_dup</a>(message-&gt;unix_fds[retval-&gt;n_unix_fds], <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l01634"></a>01634 
<a name="l01635"></a>01635       <span class="keywordflow">if</span> (retval-&gt;unix_fds[retval-&gt;n_unix_fds] &lt; 0)
<a name="l01636"></a>01636         <span class="keywordflow">goto</span> failed_copy;
<a name="l01637"></a>01637     }
<a name="l01638"></a>01638 
<a name="l01639"></a>01639 <span class="preprocessor">#endif</span>
<a name="l01640"></a>01640 <span class="preprocessor"></span>
<a name="l01641"></a>01641   _dbus_message_trace_ref (retval, 0, 1, <span class="stringliteral">&quot;copy&quot;</span>);
<a name="l01642"></a>01642   <span class="keywordflow">return</span> retval;
<a name="l01643"></a>01643 
<a name="l01644"></a>01644  failed_copy:
<a name="l01645"></a>01645   <a class="code" href="group__DBusMarshal.html#gab90a814a27aeeace7e02c4ed130539cf" title="Frees a header.">_dbus_header_free</a> (&amp;retval-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>);
<a name="l01646"></a>01646   <a class="code" href="group__DBusString.html#ga781ca91acda49a834dce7d0ed0eef212" title="Frees a string created by _dbus_string_init().">_dbus_string_free</a> (&amp;retval-&gt;<a class="code" href="structDBusMessage.html#a0b9d14d6e0529f0ec2e3c0087fe62a9e" title="Body network data.">body</a>);
<a name="l01647"></a>01647 
<a name="l01648"></a>01648 <span class="preprocessor">#ifdef HAVE_UNIX_FD_PASSING</span>
<a name="l01649"></a>01649 <span class="preprocessor"></span>  close_unix_fds(retval-&gt;unix_fds, &amp;retval-&gt;n_unix_fds);
<a name="l01650"></a>01650   <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>(retval-&gt;unix_fds);
<a name="l01651"></a>01651 <span class="preprocessor">#endif</span>
<a name="l01652"></a>01652 <span class="preprocessor"></span>
<a name="l01653"></a>01653   <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> (retval);
<a name="l01654"></a>01654 
<a name="l01655"></a>01655   <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="l01656"></a>01656 }
<a name="l01657"></a>01657 
<a name="l01658"></a>01658 
<a name="l01666"></a>01666 <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *
<a name="l01667"></a><a class="code" href="group__DBusMessage.html#ga834035e4817acd64adc8ca584bdf3982">01667</a> <a class="code" href="group__DBusMessage.html#ga834035e4817acd64adc8ca584bdf3982" title="Increments the reference count of a DBusMessage.">dbus_message_ref</a> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message)
<a name="l01668"></a>01668 {
<a name="l01669"></a>01669   <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="l01670"></a>01670 
<a name="l01671"></a>01671   _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="l01672"></a>01672   _dbus_return_val_if_fail (message-&gt;<a class="code" href="structDBusMessage.html#a96263aa8a777c8c661d2596911c7d592" title="_dbus_current_generation when message was created">generation</a> == <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="l01673"></a>01673   _dbus_return_val_if_fail (!message-&gt;<a class="code" href="structDBusMessage.html#ac71fa5534264093e6af8bc41f15237c8" title="Has been &quot;freed&quot; since it&#39;s in the cache (this is a debug feature)">in_cache</a>, <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l01674"></a>01674 
<a name="l01675"></a>01675   old_refcount = <a class="code" href="group__DBusSysdeps.html#gae74c3fcf12acaeccdb152ef907de951c" title="Atomically increments an integer.">_dbus_atomic_inc</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a324c5377e0be18dd84ac519ab2d23f0d" title="Reference count.">refcount</a>);
<a name="l01676"></a>01676   _dbus_assert (old_refcount &gt;= 1);
<a name="l01677"></a>01677   _dbus_message_trace_ref (message, old_refcount, old_refcount + 1, <span class="stringliteral">&quot;ref&quot;</span>);
<a name="l01678"></a>01678 
<a name="l01679"></a>01679   <span class="keywordflow">return</span> message;
<a name="l01680"></a>01680 }
<a name="l01681"></a>01681 
<a name="l01689"></a>01689 <span class="keywordtype">void</span>
<a name="l01690"></a><a class="code" href="group__DBusMessage.html#gab69441efe683918f6a82469c8763f464">01690</a> <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 class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message)
<a name="l01691"></a>01691 {
<a name="l01692"></a>01692  <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="l01693"></a>01693 
<a name="l01694"></a>01694   _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="l01695"></a>01695   _dbus_return_if_fail (message-&gt;<a class="code" href="structDBusMessage.html#a96263aa8a777c8c661d2596911c7d592" title="_dbus_current_generation when message was created">generation</a> == <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="l01696"></a>01696   _dbus_return_if_fail (!message-&gt;<a class="code" href="structDBusMessage.html#ac71fa5534264093e6af8bc41f15237c8" title="Has been &quot;freed&quot; since it&#39;s in the cache (this is a debug feature)">in_cache</a>);
<a name="l01697"></a>01697 
<a name="l01698"></a>01698   old_refcount = <a class="code" href="group__DBusSysdeps.html#ga3c50a069f795dceeb9172fe2b517bbdc" title="Atomically decrement an integer.">_dbus_atomic_dec</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a324c5377e0be18dd84ac519ab2d23f0d" title="Reference count.">refcount</a>);
<a name="l01699"></a>01699 
<a name="l01700"></a>01700   _dbus_assert (old_refcount &gt;= 1);
<a name="l01701"></a>01701 
<a name="l01702"></a>01702   _dbus_message_trace_ref (message, old_refcount, old_refcount - 1, <span class="stringliteral">&quot;unref&quot;</span>);
<a name="l01703"></a>01703 
<a name="l01704"></a>01704   <span class="keywordflow">if</span> (old_refcount == 1)
<a name="l01705"></a>01705     {
<a name="l01706"></a>01706       <span class="comment">/* Calls application callbacks! */</span>
<a name="l01707"></a>01707       dbus_message_cache_or_finalize (message);
<a name="l01708"></a>01708     }
<a name="l01709"></a>01709 }
<a name="l01710"></a>01710 
<a name="l01721"></a>01721 <span class="keywordtype">int</span>
<a name="l01722"></a><a class="code" href="group__DBusMessage.html#ga41cace31999105137772b6257ea540f9">01722</a> <a class="code" href="group__DBusMessage.html#ga41cace31999105137772b6257ea540f9" title="Gets the type of a message.">dbus_message_get_type</a> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message)
<a name="l01723"></a>01723 {
<a name="l01724"></a>01724   _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__DBusProtocol.html#gac975525a6ce258a7a70c583c9741b516" title="This value is never a valid message type, see dbus_message_get_type()">DBUS_MESSAGE_TYPE_INVALID</a>);
<a name="l01725"></a>01725 
<a name="l01726"></a>01726   <span class="keywordflow">return</span> <a class="code" href="group__DBusMarshal.html#ga4427247494fc5c988498c5a87d42092d" title="Gets the type of the message.">_dbus_header_get_message_type</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>);
<a name="l01727"></a>01727 }
<a name="l01728"></a>01728 
<a name="l01791"></a>01791 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l01792"></a><a class="code" href="group__DBusMessage.html#ga591f3aab5dd2c87e56e05423c2a671d9">01792</a> <a class="code" href="group__DBusMessage.html#ga591f3aab5dd2c87e56e05423c2a671d9" title="Appends fields to a message given a variable argument list.">dbus_message_append_args</a> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message,
<a name="l01793"></a>01793                           <span class="keywordtype">int</span>          first_arg_type,
<a name="l01794"></a>01794                           ...)
<a name="l01795"></a>01795 {
<a name="l01796"></a>01796   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> retval;
<a name="l01797"></a>01797   va_list var_args;
<a name="l01798"></a>01798 
<a name="l01799"></a>01799   _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="l01800"></a>01800 
<a name="l01801"></a>01801   va_start (var_args, first_arg_type);
<a name="l01802"></a>01802   retval = <a class="code" href="group__DBusMessage.html#ga106e541001d6b884d1c3cea6044693ab" title="Like dbus_message_append_args() but takes a va_list for use by language bindings.">dbus_message_append_args_valist</a> (message,
<a name="l01803"></a>01803                                             first_arg_type,
<a name="l01804"></a>01804                                             var_args);
<a name="l01805"></a>01805   va_end (var_args);
<a name="l01806"></a>01806 
<a name="l01807"></a>01807   <span class="keywordflow">return</span> retval;
<a name="l01808"></a>01808 }
<a name="l01809"></a>01809 
<a name="l01823"></a>01823 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l01824"></a><a class="code" href="group__DBusMessage.html#ga106e541001d6b884d1c3cea6044693ab">01824</a> <a class="code" href="group__DBusMessage.html#ga106e541001d6b884d1c3cea6044693ab" title="Like dbus_message_append_args() but takes a va_list for use by language bindings.">dbus_message_append_args_valist</a> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message,
<a name="l01825"></a>01825                                  <span class="keywordtype">int</span>          first_arg_type,
<a name="l01826"></a>01826                                  va_list      var_args)
<a name="l01827"></a>01827 {
<a name="l01828"></a>01828   <span class="keywordtype">int</span> type;
<a name="l01829"></a>01829   <a class="code" href="structDBusMessageIter.html" title="DBusMessageIter struct; contains no public fields.">DBusMessageIter</a> iter;
<a name="l01830"></a>01830 
<a name="l01831"></a>01831   _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="l01832"></a>01832 
<a name="l01833"></a>01833   type = first_arg_type;
<a name="l01834"></a>01834 
<a name="l01835"></a>01835   <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="l01836"></a>01836 
<a name="l01837"></a>01837   <span class="keywordflow">while</span> (type != <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="l01838"></a>01838     {
<a name="l01839"></a>01839       <span class="keywordflow">if</span> (<a class="code" href="group__DBusSignature.html#ga2d8afef7d754cf15d6b9733f00654c0e" title="A &quot;basic type&quot; is a somewhat arbitrary concept, but the intent is to include those types that are ful...">dbus_type_is_basic</a> (type))
<a name="l01840"></a>01840         {
<a name="l01841"></a>01841           <span class="keyword">const</span> <a class="code" href="unionDBusBasicValue.html" title="A simple value union that lets you access bytes as if they were various types; useful when dealing wi...">DBusBasicValue</a> *value;
<a name="l01842"></a>01842           value = va_arg (var_args, <span class="keyword">const</span> <a class="code" href="unionDBusBasicValue.html" title="A simple value union that lets you access bytes as if they were various types; useful when dealing wi...">DBusBasicValue</a>*);
<a name="l01843"></a>01843 
<a name="l01844"></a>01844           <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="l01845"></a>01845                                                type,
<a name="l01846"></a>01846                                                value))
<a name="l01847"></a>01847             <span class="keywordflow">goto</span> failed;
<a name="l01848"></a>01848         }
<a name="l01849"></a>01849       <span class="keywordflow">else</span> <span class="keywordflow">if</span> (type == <a class="code" href="group__DBusProtocol.html#ga8912f600f81a773066ca03d9163613a9" title="Type code marking a D-Bus array type.">DBUS_TYPE_ARRAY</a>)
<a name="l01850"></a>01850         {
<a name="l01851"></a>01851           <span class="keywordtype">int</span> element_type;
<a name="l01852"></a>01852           <a class="code" href="structDBusMessageIter.html" title="DBusMessageIter struct; contains no public fields.">DBusMessageIter</a> array;
<a name="l01853"></a>01853           <span class="keywordtype">char</span> buf[2];
<a name="l01854"></a>01854 
<a name="l01855"></a>01855           element_type = va_arg (var_args, <span class="keywordtype">int</span>);
<a name="l01856"></a>01856               
<a name="l01857"></a>01857           buf[0] = element_type;
<a name="l01858"></a>01858           buf[1] = <span class="charliteral">&#39;\0&#39;</span>;
<a name="l01859"></a>01859           <span class="keywordflow">if</span> (!<a class="code" href="group__DBusMessage.html#ga943150f4e87fd8507da224d22c266100" title="Appends a container-typed value to the message; you are required to append the contents of the contai...">dbus_message_iter_open_container</a> (&amp;iter,
<a name="l01860"></a>01860                                                  <a class="code" href="group__DBusProtocol.html#ga8912f600f81a773066ca03d9163613a9" title="Type code marking a D-Bus array type.">DBUS_TYPE_ARRAY</a>,
<a name="l01861"></a>01861                                                  buf,
<a name="l01862"></a>01862                                                  &amp;array))
<a name="l01863"></a>01863             <span class="keywordflow">goto</span> failed;
<a name="l01864"></a>01864 
<a name="l01865"></a>01865           <span class="keywordflow">if</span> (<a class="code" href="group__DBusSignature.html#ga2f89962cbd33e4ad843824157bae2093" title="Tells you whether values of this type can change length if you set them to some other value...">dbus_type_is_fixed</a> (element_type) &amp;&amp;
<a name="l01866"></a>01866               element_type != <a class="code" href="group__DBusProtocol.html#ga59f8acaeb207b182982dfb97174b7f16" title="Type code marking a unix file descriptor.">DBUS_TYPE_UNIX_FD</a>)
<a name="l01867"></a>01867             {
<a name="l01868"></a>01868               <span class="keyword">const</span> <a class="code" href="unionDBusBasicValue.html" title="A simple value union that lets you access bytes as if they were various types; useful when dealing wi...">DBusBasicValue</a> **value;
<a name="l01869"></a>01869               <span class="keywordtype">int</span> n_elements;
<a name="l01870"></a>01870 
<a name="l01871"></a>01871               value = va_arg (var_args, <span class="keyword">const</span> <a class="code" href="unionDBusBasicValue.html" title="A simple value union that lets you access bytes as if they were various types; useful when dealing wi...">DBusBasicValue</a>**);
<a name="l01872"></a>01872               n_elements = va_arg (var_args, <span class="keywordtype">int</span>);
<a name="l01873"></a>01873               
<a name="l01874"></a>01874               <span class="keywordflow">if</span> (!<a class="code" href="group__DBusMessage.html#ga6e2d1e936c3c61fe00d80a3f22fd5e76" title="Appends a block of fixed-length values to an array.">dbus_message_iter_append_fixed_array</a> (&amp;array,
<a name="l01875"></a>01875                                                          element_type,
<a name="l01876"></a>01876                                                          value,
<a name="l01877"></a>01877                                                          n_elements)) {
<a name="l01878"></a>01878                 <a class="code" href="group__DBusMessage.html#ga6e62697ca11f0a57dbecc93d5721612c" title="Abandons creation of a contained-typed value and frees resources created by dbus_message_iter_open_co...">dbus_message_iter_abandon_container</a> (&amp;iter, &amp;array);
<a name="l01879"></a>01879                 <span class="keywordflow">goto</span> failed;
<a name="l01880"></a>01880               }
<a name="l01881"></a>01881             }
<a name="l01882"></a>01882           <span class="keywordflow">else</span> <span class="keywordflow">if</span> (_DBUS_TYPE_IS_STRINGLIKE (element_type))
<a name="l01883"></a>01883             {
<a name="l01884"></a>01884               <span class="keyword">const</span> <span class="keywordtype">char</span> ***value_p;
<a name="l01885"></a>01885               <span class="keyword">const</span> <span class="keywordtype">char</span> **value;
<a name="l01886"></a>01886               <span class="keywordtype">int</span> n_elements;
<a name="l01887"></a>01887               <span class="keywordtype">int</span> i;
<a name="l01888"></a>01888               
<a name="l01889"></a>01889               value_p = va_arg (var_args, <span class="keyword">const</span> <span class="keywordtype">char</span>***);
<a name="l01890"></a>01890               n_elements = va_arg (var_args, <span class="keywordtype">int</span>);
<a name="l01891"></a>01891 
<a name="l01892"></a>01892               value = *value_p;
<a name="l01893"></a>01893               
<a name="l01894"></a>01894               i = 0;
<a name="l01895"></a>01895               <span class="keywordflow">while</span> (i &lt; n_elements)
<a name="l01896"></a>01896                 {
<a name="l01897"></a>01897                   <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;array,
<a name="l01898"></a>01898                                                        element_type,
<a name="l01899"></a>01899                                                        &amp;value[i])) {
<a name="l01900"></a>01900                     <a class="code" href="group__DBusMessage.html#ga6e62697ca11f0a57dbecc93d5721612c" title="Abandons creation of a contained-typed value and frees resources created by dbus_message_iter_open_co...">dbus_message_iter_abandon_container</a> (&amp;iter, &amp;array);
<a name="l01901"></a>01901                     <span class="keywordflow">goto</span> failed;
<a name="l01902"></a>01902                   }
<a name="l01903"></a>01903                   ++i;
<a name="l01904"></a>01904                 }
<a name="l01905"></a>01905             }
<a name="l01906"></a>01906           <span class="keywordflow">else</span>
<a name="l01907"></a>01907             {
<a name="l01908"></a>01908               <a class="code" href="group__DBusInternalsUtils.html#gabea2c16d6d3fe7c4eb5b9496fc877f84" title="Prints a warning message to stderr.">_dbus_warn</a> (<span class="stringliteral">&quot;arrays of %s can&#39;t be appended with %s for now\n&quot;</span>,
<a name="l01909"></a>01909                           <a class="code" href="group__DBusMarshal.html#ga48a595c2b26dce6e9c25ce040e5247e5" title="Returns a string describing the given type.">_dbus_type_to_string</a> (element_type),
<a name="l01910"></a>01910                           _DBUS_FUNCTION_NAME);
<a name="l01911"></a>01911               <span class="keywordflow">goto</span> failed;
<a name="l01912"></a>01912             }
<a name="l01913"></a>01913 
<a name="l01914"></a>01914           <span class="keywordflow">if</span> (!<a class="code" href="group__DBusMessage.html#gaf00482f63d4af88b7851621d1f24087a" title="Closes a container-typed value appended to the message; may write out more information to the message...">dbus_message_iter_close_container</a> (&amp;iter, &amp;array))
<a name="l01915"></a>01915             <span class="keywordflow">goto</span> failed;
<a name="l01916"></a>01916         }
<a name="l01917"></a>01917 <span class="preprocessor">#ifndef DBUS_DISABLE_CHECKS</span>
<a name="l01918"></a>01918 <span class="preprocessor"></span>      <span class="keywordflow">else</span>
<a name="l01919"></a>01919         {
<a name="l01920"></a>01920           <a class="code" href="group__DBusInternalsUtils.html#gabea2c16d6d3fe7c4eb5b9496fc877f84" title="Prints a warning message to stderr.">_dbus_warn</a> (<span class="stringliteral">&quot;type %s isn&#39;t supported yet in %s\n&quot;</span>,
<a name="l01921"></a>01921                       <a class="code" href="group__DBusMarshal.html#ga48a595c2b26dce6e9c25ce040e5247e5" title="Returns a string describing the given type.">_dbus_type_to_string</a> (type), _DBUS_FUNCTION_NAME);
<a name="l01922"></a>01922           <span class="keywordflow">goto</span> failed;
<a name="l01923"></a>01923         }
<a name="l01924"></a>01924 <span class="preprocessor">#endif</span>
<a name="l01925"></a>01925 <span class="preprocessor"></span>
<a name="l01926"></a>01926       type = va_arg (var_args, <span class="keywordtype">int</span>);
<a name="l01927"></a>01927     }
<a name="l01928"></a>01928 
<a name="l01929"></a>01929   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l01930"></a>01930 
<a name="l01931"></a>01931  failed:
<a name="l01932"></a>01932   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l01933"></a>01933 }
<a name="l01934"></a>01934 
<a name="l01979"></a>01979 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l01980"></a><a class="code" href="group__DBusMessage.html#gad8953f53ceea7de81cde792e3edd0230">01980</a> <a class="code" href="group__DBusMessage.html#gad8953f53ceea7de81cde792e3edd0230" title="Gets arguments from a message given a variable argument list.">dbus_message_get_args</a> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>     *message,
<a name="l01981"></a>01981                        <a class="code" href="structDBusError.html" title="Object representing an exception.">DBusError</a>       *error,
<a name="l01982"></a>01982                        <span class="keywordtype">int</span>              first_arg_type,
<a name="l01983"></a>01983                        ...)
<a name="l01984"></a>01984 {
<a name="l01985"></a>01985   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> retval;
<a name="l01986"></a>01986   va_list var_args;
<a name="l01987"></a>01987 
<a name="l01988"></a>01988   _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="l01989"></a>01989   _dbus_return_val_if_error_is_set (error, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l01990"></a>01990 
<a name="l01991"></a>01991   va_start (var_args, first_arg_type);
<a name="l01992"></a>01992   retval = <a class="code" href="group__DBusMessage.html#gab0f9bbe4f3d26bc9b5cf4f243c268aaa" title="Like dbus_message_get_args but takes a va_list for use by language bindings.">dbus_message_get_args_valist</a> (message, error, first_arg_type, var_args);
<a name="l01993"></a>01993   va_end (var_args);
<a name="l01994"></a>01994 
<a name="l01995"></a>01995   <span class="keywordflow">return</span> retval;
<a name="l01996"></a>01996 }
<a name="l01997"></a>01997 
<a name="l02008"></a>02008 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l02009"></a><a class="code" href="group__DBusMessage.html#gab0f9bbe4f3d26bc9b5cf4f243c268aaa">02009</a> <a class="code" href="group__DBusMessage.html#gab0f9bbe4f3d26bc9b5cf4f243c268aaa" title="Like dbus_message_get_args but takes a va_list for use by language bindings.">dbus_message_get_args_valist</a> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>     *message,
<a name="l02010"></a>02010                               <a class="code" href="structDBusError.html" title="Object representing an exception.">DBusError</a>       *error,
<a name="l02011"></a>02011                               <span class="keywordtype">int</span>              first_arg_type,
<a name="l02012"></a>02012                               va_list          var_args)
<a name="l02013"></a>02013 {
<a name="l02014"></a>02014   <a class="code" href="structDBusMessageIter.html" title="DBusMessageIter struct; contains no public fields.">DBusMessageIter</a> iter;
<a name="l02015"></a>02015 
<a name="l02016"></a>02016   _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="l02017"></a>02017   _dbus_return_val_if_error_is_set (error, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l02018"></a>02018 
<a name="l02019"></a>02019   <a class="code" href="group__DBusMessage.html#ga9f98b47c84f0e401ea985e681de4e963" title="Initializes a DBusMessageIter for reading the arguments of the message passed in.">dbus_message_iter_init</a> (message, &amp;iter);
<a name="l02020"></a>02020   <span class="keywordflow">return</span> <a class="code" href="group__DBusMessageInternals.html#ga1ae02a435d19c3363e11c74b08c43ab2" title="Implementation of the varargs arg-getting functions.">_dbus_message_iter_get_args_valist</a> (&amp;iter, error, first_arg_type, var_args);
<a name="l02021"></a>02021 }
<a name="l02022"></a>02022 
<a name="l02023"></a>02023 <span class="keyword">static</span> <span class="keywordtype">void</span>
<a name="l02024"></a>02024 _dbus_message_iter_init_common (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>         *message,
<a name="l02025"></a>02025                                 <a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *real,
<a name="l02026"></a>02026                                 <span class="keywordtype">int</span>                  iter_type)
<a name="l02027"></a>02027 {
<a name="l02028"></a>02028   _dbus_assert (<span class="keyword">sizeof</span> (<a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a>) &lt;= <span class="keyword">sizeof</span> (<a class="code" href="structDBusMessageIter.html" title="DBusMessageIter struct; contains no public fields.">DBusMessageIter</a>));
<a name="l02029"></a>02029 
<a name="l02030"></a>02030   <span class="comment">/* Since the iterator will read or write who-knows-what from the</span>
<a name="l02031"></a>02031 <span class="comment">   * message, we need to get in the right byte order</span>
<a name="l02032"></a>02032 <span class="comment">   */</span>
<a name="l02033"></a>02033   <a class="code" href="group__DBusMessageInternals.html#ga1dfae386ef0d4d808584abeafc44e8ca" title="byte-swap the message if it doesn&#39;t match our byte order.">ensure_byte_order</a> (message);
<a name="l02034"></a>02034   
<a name="l02035"></a>02035   real-&gt;<a class="code" href="structDBusMessageRealIter.html#a552cb582c65645ed46d9d1ad38ece3c7" title="Message used.">message</a> = message;
<a name="l02036"></a>02036   real-&gt;<a class="code" href="structDBusMessageRealIter.html#ac10324f74497a5c2288eef8fbcd3ae42" title="stamp to detect invalid iters">changed_stamp</a> = message-&gt;<a class="code" href="structDBusMessage.html#a5d102e908f6ff96a5a0aa6a39b4963a8" title="Incremented when iterators are invalidated.">changed_stamp</a>;
<a name="l02037"></a>02037   real-&gt;<a class="code" href="structDBusMessageRealIter.html#a835b7990b2909beb06fc2dc38b76a089" title="whether this is a reader or writer iter">iter_type</a> = iter_type;
<a name="l02038"></a>02038   real-&gt;<a class="code" href="structDBusMessageRealIter.html#a93789e6f814d55b5952fee34d286f6d6" title="depth of open_signature()">sig_refcount</a> = 0;
<a name="l02039"></a>02039 }
<a name="l02040"></a>02040 
<a name="l02063"></a>02063 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l02064"></a><a class="code" href="group__DBusMessage.html#ga9f98b47c84f0e401ea985e681de4e963">02064</a> <a class="code" href="group__DBusMessage.html#ga9f98b47c84f0e401ea985e681de4e963" title="Initializes a DBusMessageIter for reading the arguments of the message passed in.">dbus_message_iter_init</a> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>     *message,
<a name="l02065"></a>02065                         <a class="code" href="structDBusMessageIter.html" title="DBusMessageIter struct; contains no public fields.">DBusMessageIter</a> *iter)
<a name="l02066"></a>02066 {
<a name="l02067"></a>02067   <a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *real = (<a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *)iter;
<a name="l02068"></a>02068   <span class="keyword">const</span> <a class="code" href="structDBusString.html">DBusString</a> *type_str;
<a name="l02069"></a>02069   <span class="keywordtype">int</span> type_pos;
<a name="l02070"></a>02070 
<a name="l02071"></a>02071   _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="l02072"></a>02072   _dbus_return_val_if_fail (iter != <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="l02073"></a>02073 
<a name="l02074"></a>02074   get_const_signature (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>, &amp;type_str, &amp;type_pos);
<a name="l02075"></a>02075 
<a name="l02076"></a>02076   _dbus_message_iter_init_common (message, real,
<a name="l02077"></a>02077                                   DBUS_MESSAGE_ITER_TYPE_READER);
<a name="l02078"></a>02078 
<a name="l02079"></a>02079   <a class="code" href="group__DBusMarshal.html#ga35d70cf69b1196518367e3e68e9b2dd2" title="Initializes a type reader.">_dbus_type_reader_init</a> (&amp;real-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#ae5c4e45b0a5d6642850144f642d7db67" title="reader">reader</a>,
<a name="l02080"></a>02080                           <a class="code" href="group__DBusMarshal.html#ga65c023673b837c27e8ccda5c2528d806" title="Returns the header&#39;s byte order.">_dbus_header_get_byte_order</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>),
<a name="l02081"></a>02081                           type_str, type_pos,
<a name="l02082"></a>02082                           &amp;message-&gt;<a class="code" href="structDBusMessage.html#a0b9d14d6e0529f0ec2e3c0087fe62a9e" title="Body network data.">body</a>,
<a name="l02083"></a>02083                           0);
<a name="l02084"></a>02084 
<a name="l02085"></a>02085   <span class="keywordflow">return</span> <a class="code" href="group__DBusMarshal.html#gab8e39cb8084247d54d7f272c51622a73" title="Gets the type of the value the reader is currently pointing to; or for a types-only reader gets the t...">_dbus_type_reader_get_current_type</a> (&amp;real-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#ae5c4e45b0a5d6642850144f642d7db67" title="reader">reader</a>) != <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="l02086"></a>02086 }
<a name="l02087"></a>02087 
<a name="l02094"></a>02094 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l02095"></a><a class="code" href="group__DBusMessage.html#gaaffc75a699c96ff6197287f166df2149">02095</a> <a class="code" href="group__DBusMessage.html#gaaffc75a699c96ff6197287f166df2149" title="Checks if an iterator has any more fields.">dbus_message_iter_has_next</a> (<a class="code" href="structDBusMessageIter.html" title="DBusMessageIter struct; contains no public fields.">DBusMessageIter</a> *iter)
<a name="l02096"></a>02096 {
<a name="l02097"></a>02097   <a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *real = (<a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *)iter;
<a name="l02098"></a>02098 
<a name="l02099"></a>02099   _dbus_return_val_if_fail (_dbus_message_iter_check (real), <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l02100"></a>02100   _dbus_return_val_if_fail (real-&gt;<a class="code" href="structDBusMessageRealIter.html#a835b7990b2909beb06fc2dc38b76a089" title="whether this is a reader or writer iter">iter_type</a> == DBUS_MESSAGE_ITER_TYPE_READER, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l02101"></a>02101 
<a name="l02102"></a>02102   <span class="keywordflow">return</span> <a class="code" href="group__DBusMarshal.html#ga97a59dbd1597ef1b267457e809f095de" title="Check whether there&#39;s another value on this &quot;level&quot;.">_dbus_type_reader_has_next</a> (&amp;real-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#ae5c4e45b0a5d6642850144f642d7db67" title="reader">reader</a>);
<a name="l02103"></a>02103 }
<a name="l02104"></a>02104 
<a name="l02113"></a>02113 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l02114"></a><a class="code" href="group__DBusMessage.html#ga554e9fafd4dcc84cebe9da9344846a82">02114</a> <a class="code" href="group__DBusMessage.html#ga554e9fafd4dcc84cebe9da9344846a82" title="Moves the iterator to the next field, if any.">dbus_message_iter_next</a> (<a class="code" href="structDBusMessageIter.html" title="DBusMessageIter struct; contains no public fields.">DBusMessageIter</a> *iter)
<a name="l02115"></a>02115 {
<a name="l02116"></a>02116   <a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *real = (<a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *)iter;
<a name="l02117"></a>02117 
<a name="l02118"></a>02118   _dbus_return_val_if_fail (_dbus_message_iter_check (real), <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l02119"></a>02119   _dbus_return_val_if_fail (real-&gt;<a class="code" href="structDBusMessageRealIter.html#a835b7990b2909beb06fc2dc38b76a089" title="whether this is a reader or writer iter">iter_type</a> == DBUS_MESSAGE_ITER_TYPE_READER, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l02120"></a>02120 
<a name="l02121"></a>02121   <span class="keywordflow">return</span> <a class="code" href="group__DBusMarshal.html#ga746c09512d4905f2d2fac7ed4c3c63c2" title="Skip to the next value on this &quot;level&quot;.">_dbus_type_reader_next</a> (&amp;real-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#ae5c4e45b0a5d6642850144f642d7db67" title="reader">reader</a>);
<a name="l02122"></a>02122 }
<a name="l02123"></a>02123 
<a name="l02138"></a>02138 <span class="keywordtype">int</span>
<a name="l02139"></a><a class="code" href="group__DBusMessage.html#ga5aae3c882a75aed953d8b3d489e9b271">02139</a> <a class="code" href="group__DBusMessage.html#ga5aae3c882a75aed953d8b3d489e9b271" title="Returns the argument type of the argument that the message iterator points to.">dbus_message_iter_get_arg_type</a> (<a class="code" href="structDBusMessageIter.html" title="DBusMessageIter struct; contains no public fields.">DBusMessageIter</a> *iter)
<a name="l02140"></a>02140 {
<a name="l02141"></a>02141   <a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *real = (<a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *)iter;
<a name="l02142"></a>02142 
<a name="l02143"></a>02143   _dbus_return_val_if_fail (_dbus_message_iter_check (real), <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="l02144"></a>02144   _dbus_return_val_if_fail (real-&gt;<a class="code" href="structDBusMessageRealIter.html#a835b7990b2909beb06fc2dc38b76a089" title="whether this is a reader or writer iter">iter_type</a> == DBUS_MESSAGE_ITER_TYPE_READER, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l02145"></a>02145 
<a name="l02146"></a>02146   <span class="keywordflow">return</span> <a class="code" href="group__DBusMarshal.html#gab8e39cb8084247d54d7f272c51622a73" title="Gets the type of the value the reader is currently pointing to; or for a types-only reader gets the t...">_dbus_type_reader_get_current_type</a> (&amp;real-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#ae5c4e45b0a5d6642850144f642d7db67" title="reader">reader</a>);
<a name="l02147"></a>02147 }
<a name="l02148"></a>02148 
<a name="l02157"></a>02157 <span class="keywordtype">int</span>
<a name="l02158"></a><a class="code" href="group__DBusMessage.html#ga868a7aeddb9b54b2805776b512f68cb4">02158</a> <a class="code" href="group__DBusMessage.html#ga868a7aeddb9b54b2805776b512f68cb4" title="Returns the element type of the array that the message iterator points to.">dbus_message_iter_get_element_type</a> (<a class="code" href="structDBusMessageIter.html" title="DBusMessageIter struct; contains no public fields.">DBusMessageIter</a> *iter)
<a name="l02159"></a>02159 {
<a name="l02160"></a>02160   <a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *real = (<a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *)iter;
<a name="l02161"></a>02161 
<a name="l02162"></a>02162   _dbus_return_val_if_fail (_dbus_message_iter_check (real), <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="l02163"></a>02163   _dbus_return_val_if_fail (real-&gt;<a class="code" href="structDBusMessageRealIter.html#a835b7990b2909beb06fc2dc38b76a089" title="whether this is a reader or writer iter">iter_type</a> == DBUS_MESSAGE_ITER_TYPE_READER, <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="l02164"></a>02164   _dbus_return_val_if_fail (<a class="code" href="group__DBusMessage.html#ga5aae3c882a75aed953d8b3d489e9b271" title="Returns the argument type of the argument that the message iterator points to.">dbus_message_iter_get_arg_type</a> (iter) == <a class="code" href="group__DBusProtocol.html#ga8912f600f81a773066ca03d9163613a9" title="Type code marking a D-Bus array type.">DBUS_TYPE_ARRAY</a>, <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="l02165"></a>02165 
<a name="l02166"></a>02166   <span class="keywordflow">return</span> <a class="code" href="group__DBusMarshal.html#ga6e5439f7ca5ee8a1ce943ddab7611d0d" title="Gets the type of an element of the array the reader is currently pointing to.">_dbus_type_reader_get_element_type</a> (&amp;real-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#ae5c4e45b0a5d6642850144f642d7db67" title="reader">reader</a>);
<a name="l02167"></a>02167 }
<a name="l02168"></a>02168 
<a name="l02194"></a>02194 <span class="keywordtype">void</span>
<a name="l02195"></a><a class="code" href="group__DBusMessage.html#ga7652e1208743da5dd4ecc5aef07bf207">02195</a> <a class="code" href="group__DBusMessage.html#ga7652e1208743da5dd4ecc5aef07bf207" title="Recurses into a container value when reading values from a message, initializing a sub-iterator to us...">dbus_message_iter_recurse</a> (<a class="code" href="structDBusMessageIter.html" title="DBusMessageIter struct; contains no public fields.">DBusMessageIter</a>  *iter,
<a name="l02196"></a>02196                            <a class="code" href="structDBusMessageIter.html" title="DBusMessageIter struct; contains no public fields.">DBusMessageIter</a>  *sub)
<a name="l02197"></a>02197 {
<a name="l02198"></a>02198   <a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *real = (<a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *)iter;
<a name="l02199"></a>02199   <a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *real_sub = (<a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *)sub;
<a name="l02200"></a>02200 
<a name="l02201"></a>02201   _dbus_return_if_fail (_dbus_message_iter_check (real));
<a name="l02202"></a>02202   _dbus_return_if_fail (sub != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l02203"></a>02203 
<a name="l02204"></a>02204   *real_sub = *real;
<a name="l02205"></a>02205   <a class="code" href="group__DBusMarshal.html#ga082b410820c74b2a6ca816a8e0c91803" title="Initialize a new reader pointing to the first type and corresponding value that&#39;s a child of the curr...">_dbus_type_reader_recurse</a> (&amp;real-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#ae5c4e45b0a5d6642850144f642d7db67" title="reader">reader</a>, &amp;real_sub-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#ae5c4e45b0a5d6642850144f642d7db67" title="reader">reader</a>);
<a name="l02206"></a>02206 }
<a name="l02207"></a>02207 
<a name="l02219"></a>02219 <span class="keywordtype">char</span> *
<a name="l02220"></a><a class="code" href="group__DBusMessage.html#gab4579a88a1a7eaf648350466f585ef8b">02220</a> <a class="code" href="group__DBusMessage.html#gab4579a88a1a7eaf648350466f585ef8b" title="Returns the current signature of a message iterator.">dbus_message_iter_get_signature</a> (<a class="code" href="structDBusMessageIter.html" title="DBusMessageIter struct; contains no public fields.">DBusMessageIter</a> *iter)
<a name="l02221"></a>02221 {
<a name="l02222"></a>02222   <span class="keyword">const</span> <a class="code" href="structDBusString.html">DBusString</a> *sig;
<a name="l02223"></a>02223   <a class="code" href="structDBusString.html">DBusString</a> retstr;
<a name="l02224"></a>02224   <span class="keywordtype">char</span> *ret;
<a name="l02225"></a>02225   <span class="keywordtype">int</span> start, len;
<a name="l02226"></a>02226   <a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *real = (<a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *)iter;
<a name="l02227"></a>02227 
<a name="l02228"></a>02228   _dbus_return_val_if_fail (_dbus_message_iter_check (real), <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l02229"></a>02229 
<a name="l02230"></a>02230   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusString.html#ga348252317f7bb8ac43529972945830ae" title="Initializes a string.">_dbus_string_init</a> (&amp;retstr))
<a name="l02231"></a>02231     <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="l02232"></a>02232 
<a name="l02233"></a>02233   <a class="code" href="group__DBusMarshal.html#ga4578cc623c8b0978ca780ce0ab950fdb" title="Gets the string and range of said string containing the signature of the current value.">_dbus_type_reader_get_signature</a> (&amp;real-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#ae5c4e45b0a5d6642850144f642d7db67" title="reader">reader</a>, &amp;sig,
<a name="l02234"></a>02234                                    &amp;start, &amp;len);
<a name="l02235"></a>02235   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusString.html#ga724656b7091b910965bd1af42d0b7bab" title="Appends block of bytes with the given length to a DBusString.">_dbus_string_append_len</a> (&amp;retstr,
<a name="l02236"></a>02236                                 <a class="code" href="group__DBusString.html#ga33e20241ae7d784624f97d89b1a0539e" title="Gets the raw character buffer from a const string.">_dbus_string_get_const_data</a> (sig) + start,
<a name="l02237"></a>02237                                 len))
<a name="l02238"></a>02238     <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="l02239"></a>02239   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusString.html#ga556cc30c3ab032dbc63e217119f0d1f5" title="Like _dbus_string_get_data(), but removes the gotten data from the original string.">_dbus_string_steal_data</a> (&amp;retstr, &amp;ret))
<a name="l02240"></a>02240     <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="l02241"></a>02241   <a class="code" href="group__DBusString.html#ga781ca91acda49a834dce7d0ed0eef212" title="Frees a string created by _dbus_string_init().">_dbus_string_free</a> (&amp;retstr);
<a name="l02242"></a>02242   <span class="keywordflow">return</span> ret;
<a name="l02243"></a>02243 }
<a name="l02244"></a>02244 
<a name="l02292"></a>02292 <span class="keywordtype">void</span>
<a name="l02293"></a><a class="code" href="group__DBusMessage.html#ga41c23a05e552d0574d0444d4693d18ab">02293</a> <a class="code" href="group__DBusMessage.html#ga41c23a05e552d0574d0444d4693d18ab" title="Reads a basic-typed value from the message iterator.">dbus_message_iter_get_basic</a> (<a class="code" href="structDBusMessageIter.html" title="DBusMessageIter struct; contains no public fields.">DBusMessageIter</a>  *iter,
<a name="l02294"></a>02294                              <span class="keywordtype">void</span>             *value)
<a name="l02295"></a>02295 {
<a name="l02296"></a>02296   <a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *real = (<a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *)iter;
<a name="l02297"></a>02297 
<a name="l02298"></a>02298   _dbus_return_if_fail (_dbus_message_iter_check (real));
<a name="l02299"></a>02299   _dbus_return_if_fail (value != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l02300"></a>02300 
<a name="l02301"></a>02301   <span class="keywordflow">if</span> (<a class="code" href="group__DBusMessage.html#ga5aae3c882a75aed953d8b3d489e9b271" title="Returns the argument type of the argument that the message iterator points to.">dbus_message_iter_get_arg_type</a> (iter) == <a class="code" href="group__DBusProtocol.html#ga59f8acaeb207b182982dfb97174b7f16" title="Type code marking a unix file descriptor.">DBUS_TYPE_UNIX_FD</a>)
<a name="l02302"></a>02302     {
<a name="l02303"></a>02303 <span class="preprocessor">#ifdef HAVE_UNIX_FD_PASSING</span>
<a name="l02304"></a>02304 <span class="preprocessor"></span>      <a class="code" href="unionDBusBasicValue.html" title="A simple value union that lets you access bytes as if they were various types; useful when dealing wi...">DBusBasicValue</a> idx;
<a name="l02305"></a>02305 
<a name="l02306"></a>02306       <a class="code" href="group__DBusMarshal.html#gaa54355ee98d6721d7a29b5ae7d92eb9a" title="Reads a basic-typed value, as with _dbus_marshal_read_basic().">_dbus_type_reader_read_basic</a>(&amp;real-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#ae5c4e45b0a5d6642850144f642d7db67" title="reader">reader</a>, &amp;idx);
<a name="l02307"></a>02307 
<a name="l02308"></a>02308       <span class="keywordflow">if</span> (idx.<a class="code" href="unionDBusBasicValue.html#a2501e54560ae240442d9d841b96b086b" title="as int32">u32</a> &gt;= real-&gt;<a class="code" href="structDBusMessageRealIter.html#a552cb582c65645ed46d9d1ad38ece3c7" title="Message used.">message</a>-&gt;n_unix_fds) {
<a name="l02309"></a>02309         <span class="comment">/* Hmm, we cannot really signal an error here, so let&#39;s make</span>
<a name="l02310"></a>02310 <span class="comment">           sure to return an invalid fd. */</span>
<a name="l02311"></a>02311         *((<span class="keywordtype">int</span>*) value) = -1;
<a name="l02312"></a>02312         <span class="keywordflow">return</span>;
<a name="l02313"></a>02313       }
<a name="l02314"></a>02314 
<a name="l02315"></a>02315       *((<span class="keywordtype">int</span>*) value) = <a class="code" href="group__DBusSysdepsUnix.html#gad79d20e59fb519233004208988851cf1" title="Duplicates a file descriptor.">_dbus_dup</a>(real-&gt;<a class="code" href="structDBusMessageRealIter.html#a552cb582c65645ed46d9d1ad38ece3c7" title="Message used.">message</a>-&gt;unix_fds[idx.<a class="code" href="unionDBusBasicValue.html#a2501e54560ae240442d9d841b96b086b" title="as int32">u32</a>], <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l02316"></a>02316 <span class="preprocessor">#else</span>
<a name="l02317"></a>02317 <span class="preprocessor"></span>      *((<span class="keywordtype">int</span>*) value) = -1;
<a name="l02318"></a>02318 <span class="preprocessor">#endif</span>
<a name="l02319"></a>02319 <span class="preprocessor"></span>    }
<a name="l02320"></a>02320   <span class="keywordflow">else</span>
<a name="l02321"></a>02321     {
<a name="l02322"></a>02322       <a class="code" href="group__DBusMarshal.html#gaa54355ee98d6721d7a29b5ae7d92eb9a" title="Reads a basic-typed value, as with _dbus_marshal_read_basic().">_dbus_type_reader_read_basic</a> (&amp;real-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#ae5c4e45b0a5d6642850144f642d7db67" title="reader">reader</a>,
<a name="l02323"></a>02323                                     value);
<a name="l02324"></a>02324     }
<a name="l02325"></a>02325 }
<a name="l02326"></a>02326 
<a name="l02345"></a>02345 <span class="keywordtype">int</span>
<a name="l02346"></a><a class="code" href="group__DBusMessage.html#gab8ff47649497b3e0b93a2289f5d3eb23">02346</a> <a class="code" href="group__DBusMessage.html#gab8ff47649497b3e0b93a2289f5d3eb23" title="Returns the number of bytes in the array as marshaled in the wire protocol.">dbus_message_iter_get_array_len</a> (<a class="code" href="structDBusMessageIter.html" title="DBusMessageIter struct; contains no public fields.">DBusMessageIter</a> *iter)
<a name="l02347"></a>02347 {
<a name="l02348"></a>02348   <a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *real = (<a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *)iter;
<a name="l02349"></a>02349 
<a name="l02350"></a>02350   _dbus_return_val_if_fail (_dbus_message_iter_check (real), 0);
<a name="l02351"></a>02351 
<a name="l02352"></a>02352   <span class="keywordflow">return</span> <a class="code" href="group__DBusMarshal.html#ga7def93d676d528c261aa274cea41c29d" title="Returns the number of bytes in the array.">_dbus_type_reader_get_array_length</a> (&amp;real-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#ae5c4e45b0a5d6642850144f642d7db67" title="reader">reader</a>);
<a name="l02353"></a>02353 }
<a name="l02354"></a>02354 
<a name="l02390"></a>02390 <span class="keywordtype">void</span>
<a name="l02391"></a><a class="code" href="group__DBusMessage.html#gae195a3312ae445e7ef0196854f3523f8">02391</a> <a class="code" href="group__DBusMessage.html#gae195a3312ae445e7ef0196854f3523f8" title="Reads a block of fixed-length values from the message iterator.">dbus_message_iter_get_fixed_array</a> (<a class="code" href="structDBusMessageIter.html" title="DBusMessageIter struct; contains no public fields.">DBusMessageIter</a>  *iter,
<a name="l02392"></a>02392                                    <span class="keywordtype">void</span>             *value,
<a name="l02393"></a>02393                                    <span class="keywordtype">int</span>              *n_elements)
<a name="l02394"></a>02394 {
<a name="l02395"></a>02395   <a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *real = (<a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *)iter;
<a name="l02396"></a>02396 <span class="preprocessor">#ifndef DBUS_DISABLE_CHECKS</span>
<a name="l02397"></a>02397 <span class="preprocessor"></span>  <span class="keywordtype">int</span> subtype = <a class="code" href="group__DBusMarshal.html#gab8e39cb8084247d54d7f272c51622a73" title="Gets the type of the value the reader is currently pointing to; or for a types-only reader gets the t...">_dbus_type_reader_get_current_type</a>(&amp;real-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#ae5c4e45b0a5d6642850144f642d7db67" title="reader">reader</a>);
<a name="l02398"></a>02398 
<a name="l02399"></a>02399   _dbus_return_if_fail (_dbus_message_iter_check (real));
<a name="l02400"></a>02400   _dbus_return_if_fail (value != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l02401"></a>02401   _dbus_return_if_fail ((subtype == <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="l02402"></a>02402                         (<a class="code" href="group__DBusSignature.html#ga2f89962cbd33e4ad843824157bae2093" title="Tells you whether values of this type can change length if you set them to some other value...">dbus_type_is_fixed</a> (subtype) &amp;&amp; subtype != <a class="code" href="group__DBusProtocol.html#ga59f8acaeb207b182982dfb97174b7f16" title="Type code marking a unix file descriptor.">DBUS_TYPE_UNIX_FD</a>));
<a name="l02403"></a>02403 <span class="preprocessor">#endif</span>
<a name="l02404"></a>02404 <span class="preprocessor"></span>
<a name="l02405"></a>02405   <a class="code" href="group__DBusMarshal.html#gae9a65c05e58ace9c83352f65af2fe745" title="Reads a block of fixed-length basic values, from the current point in an array to the end of the arra...">_dbus_type_reader_read_fixed_multi</a> (&amp;real-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#ae5c4e45b0a5d6642850144f642d7db67" title="reader">reader</a>,
<a name="l02406"></a>02406                                       value, n_elements);
<a name="l02407"></a>02407 }
<a name="l02408"></a>02408 
<a name="l02420"></a>02420 <span class="keywordtype">void</span>
<a name="l02421"></a><a class="code" href="group__DBusMessage.html#gaf733047c467ce21f4a53b65a388f1e9d">02421</a> <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> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>     *message,
<a name="l02422"></a>02422                                <a class="code" href="structDBusMessageIter.html" title="DBusMessageIter struct; contains no public fields.">DBusMessageIter</a> *iter)
<a name="l02423"></a>02423 {
<a name="l02424"></a>02424   <a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *real = (<a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *)iter;
<a name="l02425"></a>02425 
<a name="l02426"></a>02426   _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="l02427"></a>02427   _dbus_return_if_fail (iter != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l02428"></a>02428 
<a name="l02429"></a>02429   _dbus_message_iter_init_common (message, real,
<a name="l02430"></a>02430                                   DBUS_MESSAGE_ITER_TYPE_WRITER);
<a name="l02431"></a>02431 
<a name="l02432"></a>02432   <span class="comment">/* We create the signature string and point iterators at it &quot;on demand&quot;</span>
<a name="l02433"></a>02433 <span class="comment">   * when a value is actually appended. That means that init() never fails</span>
<a name="l02434"></a>02434 <span class="comment">   * due to OOM.</span>
<a name="l02435"></a>02435 <span class="comment">   */</span>
<a name="l02436"></a>02436   <a class="code" href="group__DBusMarshal.html#gaa9ecf7e96d5323bc1da9cdf0c3f2c1e7" title="Initialize a write iterator, with the signature to be provided later.">_dbus_type_writer_init_types_delayed</a> (&amp;real-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#a93bc11bb1521743170b0b411b32140cf" title="writer">writer</a>,
<a name="l02437"></a>02437                                         <a class="code" href="group__DBusMarshal.html#ga65c023673b837c27e8ccda5c2528d806" title="Returns the header&#39;s byte order.">_dbus_header_get_byte_order</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>),
<a name="l02438"></a>02438                                         &amp;message-&gt;<a class="code" href="structDBusMessage.html#a0b9d14d6e0529f0ec2e3c0087fe62a9e" title="Body network data.">body</a>,
<a name="l02439"></a>02439                                         <a class="code" href="group__DBusString.html#gaa5136e6fd2c5188f4b88de7863369c6d" title="Gets the length of a string (not including nul termination).">_dbus_string_get_length</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a0b9d14d6e0529f0ec2e3c0087fe62a9e" title="Body network data.">body</a>));
<a name="l02440"></a>02440 }
<a name="l02441"></a>02441 
<a name="l02450"></a>02450 <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="l02451"></a>02451 _dbus_message_iter_open_signature (<a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *real)
<a name="l02452"></a>02452 {
<a name="l02453"></a>02453   <a class="code" href="structDBusString.html">DBusString</a> *str;
<a name="l02454"></a>02454   <span class="keyword">const</span> <a class="code" href="structDBusString.html">DBusString</a> *current_sig;
<a name="l02455"></a>02455   <span class="keywordtype">int</span> current_sig_pos;
<a name="l02456"></a>02456 
<a name="l02457"></a>02457   _dbus_assert (real-&gt;<a class="code" href="structDBusMessageRealIter.html#a835b7990b2909beb06fc2dc38b76a089" title="whether this is a reader or writer iter">iter_type</a> == DBUS_MESSAGE_ITER_TYPE_WRITER);
<a name="l02458"></a>02458 
<a name="l02459"></a>02459   <span class="keywordflow">if</span> (real-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#a93bc11bb1521743170b0b411b32140cf" title="writer">writer</a>.<a class="code" href="structDBusTypeWriter.html#a95204ef3a9cf29ee31687032b142b836" title="where to write typecodes (or read type expectations)">type_str</a> != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l02460"></a>02460     {
<a name="l02461"></a>02461       _dbus_assert (real-&gt;<a class="code" href="structDBusMessageRealIter.html#a93789e6f814d55b5952fee34d286f6d6" title="depth of open_signature()">sig_refcount</a> &gt; 0);
<a name="l02462"></a>02462       real-&gt;<a class="code" href="structDBusMessageRealIter.html#a93789e6f814d55b5952fee34d286f6d6" title="depth of open_signature()">sig_refcount</a> += 1;
<a name="l02463"></a>02463       <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l02464"></a>02464     }
<a name="l02465"></a>02465 
<a name="l02466"></a>02466   str = <a class="code" href="group__DBusMemory.html#ga54ccb556e7964112a825a7f46c156ca0" title="Safe macro for using dbus_malloc().">dbus_new</a> (<a class="code" href="structDBusString.html">DBusString</a>, 1);
<a name="l02467"></a>02467   <span class="keywordflow">if</span> (str == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l02468"></a>02468     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l02469"></a>02469 
<a name="l02470"></a>02470   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusMarshal.html#gaf4661ba8e7067f349ba03c9f5776bbb0" title="Gets the raw marshaled data for a field.">_dbus_header_get_field_raw</a> (&amp;real-&gt;<a class="code" href="structDBusMessageRealIter.html#a552cb582c65645ed46d9d1ad38ece3c7" title="Message used.">message</a>-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>,
<a name="l02471"></a>02471                                    <a class="code" href="group__DBusProtocol.html#ga450d63fa110d3cb891082e23291580b4" title="Header field code for the type signature of a message.">DBUS_HEADER_FIELD_SIGNATURE</a>,
<a name="l02472"></a>02472                                    &amp;current_sig, &amp;current_sig_pos))
<a name="l02473"></a>02473     current_sig = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l02474"></a>02474 
<a name="l02475"></a>02475   <span class="keywordflow">if</span> (current_sig)
<a name="l02476"></a>02476     {
<a name="l02477"></a>02477       <span class="keywordtype">int</span> current_len;
<a name="l02478"></a>02478 
<a name="l02479"></a>02479       current_len = <a class="code" href="group__DBusString.html#gac1cb7b207eac3c6527a5d42fbc5449b1" title="Gets the byte at the given position.">_dbus_string_get_byte</a> (current_sig, current_sig_pos);
<a name="l02480"></a>02480       current_sig_pos += 1; <span class="comment">/* move on to sig data */</span>
<a name="l02481"></a>02481 
<a name="l02482"></a>02482       <span class="keywordflow">if</span> (!<a class="code" href="group__DBusString.html#ga569b784beea1b4fa98f05d27e6dd0e72" title="Initializes a string that can be up to the given allocation size before it has to realloc...">_dbus_string_init_preallocated</a> (str, current_len + 4))
<a name="l02483"></a>02483         {
<a name="l02484"></a>02484           <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> (str);
<a name="l02485"></a>02485           <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l02486"></a>02486         }
<a name="l02487"></a>02487 
<a name="l02488"></a>02488       <span class="keywordflow">if</span> (!<a class="code" href="group__DBusString.html#gaf5f13bc7ac7a623516930d26ae2589bf" title="Like _dbus_string_copy(), but can copy a segment from the middle of the source string.">_dbus_string_copy_len</a> (current_sig, current_sig_pos, current_len,
<a name="l02489"></a>02489                                   str, 0))
<a name="l02490"></a>02490         {
<a name="l02491"></a>02491           <a class="code" href="group__DBusString.html#ga781ca91acda49a834dce7d0ed0eef212" title="Frees a string created by _dbus_string_init().">_dbus_string_free</a> (str);
<a name="l02492"></a>02492           <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> (str);
<a name="l02493"></a>02493           <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l02494"></a>02494         }
<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="keywordflow">if</span> (!<a class="code" href="group__DBusString.html#ga569b784beea1b4fa98f05d27e6dd0e72" title="Initializes a string that can be up to the given allocation size before it has to realloc...">_dbus_string_init_preallocated</a> (str, 4))
<a name="l02499"></a>02499         {
<a name="l02500"></a>02500           <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> (str);
<a name="l02501"></a>02501           <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l02502"></a>02502         }
<a name="l02503"></a>02503     }
<a name="l02504"></a>02504 
<a name="l02505"></a>02505   real-&gt;<a class="code" href="structDBusMessageRealIter.html#a93789e6f814d55b5952fee34d286f6d6" title="depth of open_signature()">sig_refcount</a> = 1;
<a name="l02506"></a>02506 
<a name="l02507"></a>02507   <a class="code" href="group__DBusMarshal.html#ga863b2f232a21582f9e6fe1951b09da91" title="Adds type string to the writer, if it had none.">_dbus_type_writer_add_types</a> (&amp;real-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#a93bc11bb1521743170b0b411b32140cf" title="writer">writer</a>,
<a name="l02508"></a>02508                                str, <a class="code" href="group__DBusString.html#gaa5136e6fd2c5188f4b88de7863369c6d" title="Gets the length of a string (not including nul termination).">_dbus_string_get_length</a> (str));
<a name="l02509"></a>02509   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l02510"></a>02510 }
<a name="l02511"></a>02511 
<a name="l02521"></a>02521 <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="l02522"></a>02522 _dbus_message_iter_close_signature (<a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *real)
<a name="l02523"></a>02523 {
<a name="l02524"></a>02524   <a class="code" href="structDBusString.html">DBusString</a> *str;
<a name="l02525"></a>02525   <span class="keyword">const</span> <span class="keywordtype">char</span> *v_STRING;
<a name="l02526"></a>02526   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> retval;
<a name="l02527"></a>02527 
<a name="l02528"></a>02528   _dbus_assert (real-&gt;<a class="code" href="structDBusMessageRealIter.html#a835b7990b2909beb06fc2dc38b76a089" title="whether this is a reader or writer iter">iter_type</a> == DBUS_MESSAGE_ITER_TYPE_WRITER);
<a name="l02529"></a>02529   _dbus_assert (real-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#a93bc11bb1521743170b0b411b32140cf" title="writer">writer</a>.<a class="code" href="structDBusTypeWriter.html#a95204ef3a9cf29ee31687032b142b836" title="where to write typecodes (or read type expectations)">type_str</a> != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l02530"></a>02530   _dbus_assert (real-&gt;<a class="code" href="structDBusMessageRealIter.html#a93789e6f814d55b5952fee34d286f6d6" title="depth of open_signature()">sig_refcount</a> &gt; 0);
<a name="l02531"></a>02531 
<a name="l02532"></a>02532   real-&gt;<a class="code" href="structDBusMessageRealIter.html#a93789e6f814d55b5952fee34d286f6d6" title="depth of open_signature()">sig_refcount</a> -= 1;
<a name="l02533"></a>02533 
<a name="l02534"></a>02534   <span class="keywordflow">if</span> (real-&gt;<a class="code" href="structDBusMessageRealIter.html#a93789e6f814d55b5952fee34d286f6d6" title="depth of open_signature()">sig_refcount</a> &gt; 0)
<a name="l02535"></a>02535     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l02536"></a>02536   _dbus_assert (real-&gt;<a class="code" href="structDBusMessageRealIter.html#a93789e6f814d55b5952fee34d286f6d6" title="depth of open_signature()">sig_refcount</a> == 0);
<a name="l02537"></a>02537 
<a name="l02538"></a>02538   retval = <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l02539"></a>02539 
<a name="l02540"></a>02540   str = real-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#a93bc11bb1521743170b0b411b32140cf" title="writer">writer</a>.<a class="code" href="structDBusTypeWriter.html#a95204ef3a9cf29ee31687032b142b836" title="where to write typecodes (or read type expectations)">type_str</a>;
<a name="l02541"></a>02541 
<a name="l02542"></a>02542   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> (str);
<a name="l02543"></a>02543   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusMarshal.html#ga4349de00b7754a337526e36fda133464" title="Sets the value of a field with basic type.">_dbus_header_set_field_basic</a> (&amp;real-&gt;<a class="code" href="structDBusMessageRealIter.html#a552cb582c65645ed46d9d1ad38ece3c7" title="Message used.">message</a>-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>,
<a name="l02544"></a>02544                                      <a class="code" href="group__DBusProtocol.html#ga450d63fa110d3cb891082e23291580b4" title="Header field code for the type signature of a message.">DBUS_HEADER_FIELD_SIGNATURE</a>,
<a name="l02545"></a>02545                                      <a class="code" href="group__DBusProtocol.html#ga26ed6c20c3d9f0b50ea0a1cf80be3279" title="Type code marking a D-Bus type signature.">DBUS_TYPE_SIGNATURE</a>,
<a name="l02546"></a>02546                                      &amp;v_STRING))
<a name="l02547"></a>02547     retval = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l02548"></a>02548 
<a name="l02549"></a>02549   <a class="code" href="group__DBusMarshal.html#ga34d675b57c7e6569707d22ba76ae010c" title="Removes type string from the writer.">_dbus_type_writer_remove_types</a> (&amp;real-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#a93bc11bb1521743170b0b411b32140cf" title="writer">writer</a>);
<a name="l02550"></a>02550   <a class="code" href="group__DBusString.html#ga781ca91acda49a834dce7d0ed0eef212" title="Frees a string created by _dbus_string_init().">_dbus_string_free</a> (str);
<a name="l02551"></a>02551   <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> (str);
<a name="l02552"></a>02552 
<a name="l02553"></a>02553   <span class="keywordflow">return</span> retval;
<a name="l02554"></a>02554 }
<a name="l02555"></a>02555 
<a name="l02563"></a>02563 <span class="keyword">static</span> <span class="keywordtype">void</span>
<a name="l02564"></a>02564 _dbus_message_iter_abandon_signature (<a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *real)
<a name="l02565"></a>02565 {
<a name="l02566"></a>02566   <a class="code" href="structDBusString.html">DBusString</a> *str;
<a name="l02567"></a>02567 
<a name="l02568"></a>02568   _dbus_assert (real-&gt;<a class="code" href="structDBusMessageRealIter.html#a835b7990b2909beb06fc2dc38b76a089" title="whether this is a reader or writer iter">iter_type</a> == DBUS_MESSAGE_ITER_TYPE_WRITER);
<a name="l02569"></a>02569   _dbus_assert (real-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#a93bc11bb1521743170b0b411b32140cf" title="writer">writer</a>.<a class="code" href="structDBusTypeWriter.html#a95204ef3a9cf29ee31687032b142b836" title="where to write typecodes (or read type expectations)">type_str</a> != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l02570"></a>02570   _dbus_assert (real-&gt;<a class="code" href="structDBusMessageRealIter.html#a93789e6f814d55b5952fee34d286f6d6" title="depth of open_signature()">sig_refcount</a> &gt; 0);
<a name="l02571"></a>02571 
<a name="l02572"></a>02572   real-&gt;<a class="code" href="structDBusMessageRealIter.html#a93789e6f814d55b5952fee34d286f6d6" title="depth of open_signature()">sig_refcount</a> -= 1;
<a name="l02573"></a>02573 
<a name="l02574"></a>02574   <span class="keywordflow">if</span> (real-&gt;<a class="code" href="structDBusMessageRealIter.html#a93789e6f814d55b5952fee34d286f6d6" title="depth of open_signature()">sig_refcount</a> &gt; 0)
<a name="l02575"></a>02575     <span class="keywordflow">return</span>;
<a name="l02576"></a>02576   _dbus_assert (real-&gt;<a class="code" href="structDBusMessageRealIter.html#a93789e6f814d55b5952fee34d286f6d6" title="depth of open_signature()">sig_refcount</a> == 0);
<a name="l02577"></a>02577 
<a name="l02578"></a>02578   str = real-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#a93bc11bb1521743170b0b411b32140cf" title="writer">writer</a>.<a class="code" href="structDBusTypeWriter.html#a95204ef3a9cf29ee31687032b142b836" title="where to write typecodes (or read type expectations)">type_str</a>;
<a name="l02579"></a>02579 
<a name="l02580"></a>02580   <a class="code" href="group__DBusMarshal.html#ga34d675b57c7e6569707d22ba76ae010c" title="Removes type string from the writer.">_dbus_type_writer_remove_types</a> (&amp;real-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#a93bc11bb1521743170b0b411b32140cf" title="writer">writer</a>);
<a name="l02581"></a>02581   <a class="code" href="group__DBusString.html#ga781ca91acda49a834dce7d0ed0eef212" title="Frees a string created by _dbus_string_init().">_dbus_string_free</a> (str);
<a name="l02582"></a>02582   <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> (str);
<a name="l02583"></a>02583 }
<a name="l02584"></a>02584 
<a name="l02585"></a>02585 <span class="preprocessor">#ifndef DBUS_DISABLE_CHECKS</span>
<a name="l02586"></a>02586 <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>
<a name="l02587"></a>02587 _dbus_message_iter_append_check (<a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *iter)
<a name="l02588"></a>02588 {
<a name="l02589"></a>02589   <span class="keywordflow">if</span> (!_dbus_message_iter_check (iter))
<a name="l02590"></a>02590     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l02591"></a>02591 
<a name="l02592"></a>02592   <span class="keywordflow">if</span> (iter-&gt;<a class="code" href="structDBusMessageRealIter.html#a552cb582c65645ed46d9d1ad38ece3c7" title="Message used.">message</a>-&gt;<a class="code" href="structDBusMessage.html#ac926e7027f22608d75a6dfe18680b9e7" title="Message being sent, no modifications allowed.">locked</a>)
<a name="l02593"></a>02593     {
<a name="l02594"></a>02594       <a class="code" href="group__DBusInternalsUtils.html#ga63f2f8a068454b781f214ba596e313b4" title="Prints a &quot;critical&quot; warning to stderr when an assertion fails; differs from _dbus_warn primarily in t...">_dbus_warn_check_failed</a> (<span class="stringliteral">&quot;dbus append iterator can&#39;t be used: message is locked (has already been sent)\n&quot;</span>);
<a name="l02595"></a>02595       <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l02596"></a>02596     }
<a name="l02597"></a>02597 
<a name="l02598"></a>02598   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l02599"></a>02599 }
<a name="l02600"></a>02600 <span class="preprocessor">#endif </span><span class="comment">/* DBUS_DISABLE_CHECKS */</span>
<a name="l02601"></a>02601 
<a name="l02602"></a>02602 <span class="preprocessor">#ifdef HAVE_UNIX_FD_PASSING</span>
<a name="l02603"></a>02603 <span class="preprocessor"></span><span class="keyword">static</span> <span class="keywordtype">int</span> *
<a name="l02604"></a>02604 expand_fd_array(<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *m,
<a name="l02605"></a>02605                 <span class="keywordtype">unsigned</span>     n)
<a name="l02606"></a>02606 {
<a name="l02607"></a>02607   _dbus_assert(m);
<a name="l02608"></a>02608 
<a name="l02609"></a>02609   <span class="comment">/* This makes space for adding n new fds to the array and returns a</span>
<a name="l02610"></a>02610 <span class="comment">     pointer to the place were the first fd should be put. */</span>
<a name="l02611"></a>02611 
<a name="l02612"></a>02612   <span class="keywordflow">if</span> (m-&gt;n_unix_fds + n &gt; m-&gt;n_unix_fds_allocated)
<a name="l02613"></a>02613     {
<a name="l02614"></a>02614       <span class="keywordtype">unsigned</span> k;
<a name="l02615"></a>02615       <span class="keywordtype">int</span> *p;
<a name="l02616"></a>02616 
<a name="l02617"></a>02617       <span class="comment">/* Make twice as much space as necessary */</span>
<a name="l02618"></a>02618       k = (m-&gt;n_unix_fds + n) * 2;
<a name="l02619"></a>02619 
<a name="l02620"></a>02620       <span class="comment">/* Allocate at least four */</span>
<a name="l02621"></a>02621       <span class="keywordflow">if</span> (k &lt; 4)
<a name="l02622"></a>02622         k = 4;
<a name="l02623"></a>02623 
<a name="l02624"></a>02624       p = <a class="code" href="group__DBusMemory.html#ga2d505f2960ccf343042d363170b27f9c" title="Resizes a block of memory previously allocated by dbus_malloc() or dbus_malloc0().">dbus_realloc</a>(m-&gt;unix_fds, k * <span class="keyword">sizeof</span>(<span class="keywordtype">int</span>));
<a name="l02625"></a>02625       <span class="keywordflow">if</span> (p == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l02626"></a>02626         <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="l02627"></a>02627 
<a name="l02628"></a>02628       m-&gt;unix_fds = p;
<a name="l02629"></a>02629       m-&gt;n_unix_fds_allocated = k;
<a name="l02630"></a>02630     }
<a name="l02631"></a>02631 
<a name="l02632"></a>02632   <span class="keywordflow">return</span> m-&gt;unix_fds + m-&gt;n_unix_fds;
<a name="l02633"></a>02633 }
<a name="l02634"></a>02634 <span class="preprocessor">#endif</span>
<a name="l02635"></a>02635 <span class="preprocessor"></span>
<a name="l02655"></a>02655 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l02656"></a><a class="code" href="group__DBusMessage.html#ga17491f3b75b3203f6fc47dcc2e3b221b">02656</a> <a class="code" href="group__DBusMessage.html#ga17491f3b75b3203f6fc47dcc2e3b221b" title="Appends a basic-typed value to the message.">dbus_message_iter_append_basic</a> (<a class="code" href="structDBusMessageIter.html" title="DBusMessageIter struct; contains no public fields.">DBusMessageIter</a> *iter,
<a name="l02657"></a>02657                                 <span class="keywordtype">int</span>              type,
<a name="l02658"></a>02658                                 <span class="keyword">const</span> <span class="keywordtype">void</span>      *value)
<a name="l02659"></a>02659 {
<a name="l02660"></a>02660   <a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *real = (<a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *)iter;
<a name="l02661"></a>02661   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> ret;
<a name="l02662"></a>02662 
<a name="l02663"></a>02663   _dbus_return_val_if_fail (_dbus_message_iter_append_check (real), <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l02664"></a>02664   _dbus_return_val_if_fail (real-&gt;<a class="code" href="structDBusMessageRealIter.html#a835b7990b2909beb06fc2dc38b76a089" title="whether this is a reader or writer iter">iter_type</a> == DBUS_MESSAGE_ITER_TYPE_WRITER, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l02665"></a>02665   _dbus_return_val_if_fail (<a class="code" href="group__DBusSignature.html#ga2d8afef7d754cf15d6b9733f00654c0e" title="A &quot;basic type&quot; is a somewhat arbitrary concept, but the intent is to include those types that are ful...">dbus_type_is_basic</a> (type), <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l02666"></a>02666   _dbus_return_val_if_fail (value != <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="l02667"></a>02667 
<a name="l02668"></a>02668 <span class="preprocessor">#ifndef DBUS_DISABLE_CHECKS</span>
<a name="l02669"></a>02669 <span class="preprocessor"></span>  <span class="keywordflow">switch</span> (type)
<a name="l02670"></a>02670     {
<a name="l02671"></a>02671       <span class="keyword">const</span> <span class="keywordtype">char</span> * <span class="keyword">const</span> *string_p;
<a name="l02672"></a>02672       <span class="keyword">const</span> <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> *bool_p;
<a name="l02673"></a>02673 
<a name="l02674"></a>02674       <span class="keywordflow">case</span> <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="l02675"></a>02675         string_p = value;
<a name="l02676"></a>02676         _dbus_return_val_if_fail (_dbus_check_is_valid_utf8 (*string_p), <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l02677"></a>02677         <span class="keywordflow">break</span>;
<a name="l02678"></a>02678 
<a name="l02679"></a>02679       <span class="keywordflow">case</span> <a class="code" href="group__DBusProtocol.html#ga31cc59c99a6cbbfcef71756e1390dc4c" title="Type code marking a D-Bus object path.">DBUS_TYPE_OBJECT_PATH</a>:
<a name="l02680"></a>02680         string_p = value;
<a name="l02681"></a>02681         _dbus_return_val_if_fail (_dbus_check_is_valid_path (*string_p), <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l02682"></a>02682         <span class="keywordflow">break</span>;
<a name="l02683"></a>02683 
<a name="l02684"></a>02684       <span class="keywordflow">case</span> <a class="code" href="group__DBusProtocol.html#ga26ed6c20c3d9f0b50ea0a1cf80be3279" title="Type code marking a D-Bus type signature.">DBUS_TYPE_SIGNATURE</a>:
<a name="l02685"></a>02685         string_p = value;
<a name="l02686"></a>02686         _dbus_return_val_if_fail (_dbus_check_is_valid_signature (*string_p), <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l02687"></a>02687         <span class="keywordflow">break</span>;
<a name="l02688"></a>02688 
<a name="l02689"></a>02689       <span class="keywordflow">case</span> <a class="code" href="group__DBusProtocol.html#ga624ecee83984330ad89cbf064a2b28e6" title="Type code marking a boolean.">DBUS_TYPE_BOOLEAN</a>:
<a name="l02690"></a>02690         bool_p = value;
<a name="l02691"></a>02691         _dbus_return_val_if_fail (*bool_p == 0 || *bool_p == 1, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l02692"></a>02692         <span class="keywordflow">break</span>;
<a name="l02693"></a>02693 
<a name="l02694"></a>02694       <span class="keywordflow">default</span>:
<a name="l02695"></a>02695           {
<a name="l02696"></a>02696             <span class="comment">/* nothing to check, all possible values are allowed */</span>
<a name="l02697"></a>02697           }
<a name="l02698"></a>02698     }
<a name="l02699"></a>02699 <span class="preprocessor">#endif</span>
<a name="l02700"></a>02700 <span class="preprocessor"></span>
<a name="l02701"></a>02701   <span class="keywordflow">if</span> (!_dbus_message_iter_open_signature (real))
<a name="l02702"></a>02702     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l02703"></a>02703 
<a name="l02704"></a>02704   <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="l02705"></a>02705     {
<a name="l02706"></a>02706 <span class="preprocessor">#ifdef HAVE_UNIX_FD_PASSING</span>
<a name="l02707"></a>02707 <span class="preprocessor"></span>      <span class="keywordtype">int</span> *fds;
<a name="l02708"></a>02708       <a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a> u;
<a name="l02709"></a>02709 
<a name="l02710"></a>02710       <span class="comment">/* First step, include the fd in the fd list of this message */</span>
<a name="l02711"></a>02711       <span class="keywordflow">if</span> (!(fds = expand_fd_array(real-&gt;<a class="code" href="structDBusMessageRealIter.html#a552cb582c65645ed46d9d1ad38ece3c7" title="Message used.">message</a>, 1)))
<a name="l02712"></a>02712         <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l02713"></a>02713 
<a name="l02714"></a>02714       *fds = <a class="code" href="group__DBusSysdepsUnix.html#gad79d20e59fb519233004208988851cf1" title="Duplicates a file descriptor.">_dbus_dup</a>(*(<span class="keywordtype">int</span>*) value, <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l02715"></a>02715       <span class="keywordflow">if</span> (*fds &lt; 0)
<a name="l02716"></a>02716         <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l02717"></a>02717 
<a name="l02718"></a>02718       u = real-&gt;<a class="code" href="structDBusMessageRealIter.html#a552cb582c65645ed46d9d1ad38ece3c7" title="Message used.">message</a>-&gt;n_unix_fds;
<a name="l02719"></a>02719 
<a name="l02720"></a>02720       <span class="comment">/* Second step, write the index to the fd */</span>
<a name="l02721"></a>02721       <span class="keywordflow">if</span> (!(ret = <a class="code" href="group__DBusMarshal.html#ga0103b0214766b0ff1ca05bcc7f1e631b" title="Writes out a basic type.">_dbus_type_writer_write_basic</a> (&amp;real-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#a93bc11bb1521743170b0b411b32140cf" title="writer">writer</a>, <a class="code" href="group__DBusProtocol.html#ga59f8acaeb207b182982dfb97174b7f16" title="Type code marking a unix file descriptor.">DBUS_TYPE_UNIX_FD</a>, &amp;u))) {
<a name="l02722"></a>02722         <a class="code" href="group__DBusSysdepsUnix.html#gac448479a1674e3b86cee9a4bdc7eba03" title="Closes a file descriptor.">_dbus_close</a>(*fds, <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         <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l02724"></a>02724       }
<a name="l02725"></a>02725 
<a name="l02726"></a>02726       real-&gt;<a class="code" href="structDBusMessageRealIter.html#a552cb582c65645ed46d9d1ad38ece3c7" title="Message used.">message</a>-&gt;n_unix_fds += 1;
<a name="l02727"></a>02727       u += 1;
<a name="l02728"></a>02728 
<a name="l02729"></a>02729       <span class="comment">/* Final step, update the header accordingly */</span>
<a name="l02730"></a>02730       ret = <a class="code" href="group__DBusMarshal.html#ga4349de00b7754a337526e36fda133464" title="Sets the value of a field with basic type.">_dbus_header_set_field_basic</a> (&amp;real-&gt;<a class="code" href="structDBusMessageRealIter.html#a552cb582c65645ed46d9d1ad38ece3c7" title="Message used.">message</a>-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>,
<a name="l02731"></a>02731                                           <a class="code" href="group__DBusProtocol.html#ga03b9c24acbfd1e3da19804c739612885" title="Header field code for the number of unix file descriptors associated with this message.">DBUS_HEADER_FIELD_UNIX_FDS</a>,
<a name="l02732"></a>02732                                           <a class="code" href="group__DBusProtocol.html#gaedb1740bd8a9174b98ac593eded25d49" title="Type code marking a 32-bit unsigned integer.">DBUS_TYPE_UINT32</a>,
<a name="l02733"></a>02733                                           &amp;u);
<a name="l02734"></a>02734 
<a name="l02735"></a>02735       <span class="comment">/* If any of these operations fail the message is</span>
<a name="l02736"></a>02736 <span class="comment">         hosed. However, no memory or fds should be leaked since what</span>
<a name="l02737"></a>02737 <span class="comment">         has been added to message has been added to the message, and</span>
<a name="l02738"></a>02738 <span class="comment">         can hence be accounted for when the message is being</span>
<a name="l02739"></a>02739 <span class="comment">         freed. */</span>
<a name="l02740"></a>02740 <span class="preprocessor">#else</span>
<a name="l02741"></a>02741 <span class="preprocessor"></span>      ret = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l02742"></a>02742 <span class="preprocessor">#endif</span>
<a name="l02743"></a>02743 <span class="preprocessor"></span>    }
<a name="l02744"></a>02744   <span class="keywordflow">else</span>
<a name="l02745"></a>02745     {
<a name="l02746"></a>02746       ret = <a class="code" href="group__DBusMarshal.html#ga0103b0214766b0ff1ca05bcc7f1e631b" title="Writes out a basic type.">_dbus_type_writer_write_basic</a> (&amp;real-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#a93bc11bb1521743170b0b411b32140cf" title="writer">writer</a>, type, value);
<a name="l02747"></a>02747     }
<a name="l02748"></a>02748 
<a name="l02749"></a>02749   <span class="keywordflow">if</span> (!_dbus_message_iter_close_signature (real))
<a name="l02750"></a>02750     ret = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l02751"></a>02751 
<a name="l02752"></a>02752   <span class="keywordflow">return</span> ret;
<a name="l02753"></a>02753 }
<a name="l02754"></a>02754 
<a name="l02790"></a>02790 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l02791"></a><a class="code" href="group__DBusMessage.html#ga6e2d1e936c3c61fe00d80a3f22fd5e76">02791</a> <a class="code" href="group__DBusMessage.html#ga6e2d1e936c3c61fe00d80a3f22fd5e76" title="Appends a block of fixed-length values to an array.">dbus_message_iter_append_fixed_array</a> (<a class="code" href="structDBusMessageIter.html" title="DBusMessageIter struct; contains no public fields.">DBusMessageIter</a> *iter,
<a name="l02792"></a>02792                                       <span class="keywordtype">int</span>              element_type,
<a name="l02793"></a>02793                                       <span class="keyword">const</span> <span class="keywordtype">void</span>      *value,
<a name="l02794"></a>02794                                       <span class="keywordtype">int</span>              n_elements)
<a name="l02795"></a>02795 {
<a name="l02796"></a>02796   <a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *real = (<a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *)iter;
<a name="l02797"></a>02797   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> ret;
<a name="l02798"></a>02798 
<a name="l02799"></a>02799   _dbus_return_val_if_fail (_dbus_message_iter_append_check (real), <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l02800"></a>02800   _dbus_return_val_if_fail (real-&gt;<a class="code" href="structDBusMessageRealIter.html#a835b7990b2909beb06fc2dc38b76a089" title="whether this is a reader or writer iter">iter_type</a> == DBUS_MESSAGE_ITER_TYPE_WRITER, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l02801"></a>02801   _dbus_return_val_if_fail (<a class="code" href="group__DBusSignature.html#ga2f89962cbd33e4ad843824157bae2093" title="Tells you whether values of this type can change length if you set them to some other value...">dbus_type_is_fixed</a> (element_type) &amp;&amp; element_type != <a class="code" href="group__DBusProtocol.html#ga59f8acaeb207b182982dfb97174b7f16" title="Type code marking a unix file descriptor.">DBUS_TYPE_UNIX_FD</a>, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l02802"></a>02802   _dbus_return_val_if_fail (real-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#a93bc11bb1521743170b0b411b32140cf" title="writer">writer</a>.<a class="code" href="structDBusTypeWriter.html#ad0953035070c7c7d21b044b7b2f0f491" title="what are we inside? (e.g.">container_type</a> == <a class="code" href="group__DBusProtocol.html#ga8912f600f81a773066ca03d9163613a9" title="Type code marking a D-Bus array type.">DBUS_TYPE_ARRAY</a>, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l02803"></a>02803   _dbus_return_val_if_fail (value != <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="l02804"></a>02804   _dbus_return_val_if_fail (n_elements &gt;= 0, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l02805"></a>02805   _dbus_return_val_if_fail (n_elements &lt;=
<a name="l02806"></a>02806                             <a class="code" href="group__DBusProtocol.html#ga5265afa08a4c8d9f31b287a57e8cb217" title="Max length of a marshaled array in bytes (64M, 2^26) We use signed int for lengths so must be INT_MAX...">DBUS_MAXIMUM_ARRAY_LENGTH</a> / <a class="code" href="group__DBusMarshal.html#ga2ba80f227880e442c140bc67653b0abd" title="Gets the alignment requirement for the given type; will be 1, 4, or 8.">_dbus_type_get_alignment</a> (element_type),
<a name="l02807"></a>02807                             <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l02808"></a>02808 
<a name="l02809"></a>02809 <span class="preprocessor">#ifndef DBUS_DISABLE_CHECKS</span>
<a name="l02810"></a>02810 <span class="preprocessor"></span>  <span class="keywordflow">if</span> (element_type == <a class="code" href="group__DBusProtocol.html#ga624ecee83984330ad89cbf064a2b28e6" title="Type code marking a boolean.">DBUS_TYPE_BOOLEAN</a>)
<a name="l02811"></a>02811     {
<a name="l02812"></a>02812       <span class="keyword">const</span> <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> * <span class="keyword">const</span> *bools = value;
<a name="l02813"></a>02813       <span class="keywordtype">int</span> i;
<a name="l02814"></a>02814 
<a name="l02815"></a>02815       <span class="keywordflow">for</span> (i = 0; i &lt; n_elements; i++)
<a name="l02816"></a>02816         {
<a name="l02817"></a>02817           _dbus_return_val_if_fail ((*bools)[i] == 0 || (*bools)[i] == 1, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l02818"></a>02818         }
<a name="l02819"></a>02819     }
<a name="l02820"></a>02820 <span class="preprocessor">#endif</span>
<a name="l02821"></a>02821 <span class="preprocessor"></span>
<a name="l02822"></a>02822   ret = <a class="code" href="group__DBusMarshal.html#gacf99495cbed7462992b6a231563b4528" title="Writes a block of fixed-length basic values, i.e.">_dbus_type_writer_write_fixed_multi</a> (&amp;real-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#a93bc11bb1521743170b0b411b32140cf" title="writer">writer</a>, element_type, value, n_elements);
<a name="l02823"></a>02823 
<a name="l02824"></a>02824   <span class="keywordflow">return</span> ret;
<a name="l02825"></a>02825 }
<a name="l02826"></a>02826 
<a name="l02848"></a>02848 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l02849"></a><a class="code" href="group__DBusMessage.html#ga943150f4e87fd8507da224d22c266100">02849</a> <a class="code" href="group__DBusMessage.html#ga943150f4e87fd8507da224d22c266100" title="Appends a container-typed value to the message; you are required to append the contents of the contai...">dbus_message_iter_open_container</a> (<a class="code" href="structDBusMessageIter.html" title="DBusMessageIter struct; contains no public fields.">DBusMessageIter</a> *iter,
<a name="l02850"></a>02850                                   <span class="keywordtype">int</span>              type,
<a name="l02851"></a>02851                                   <span class="keyword">const</span> <span class="keywordtype">char</span>      *contained_signature,
<a name="l02852"></a>02852                                   <a class="code" href="structDBusMessageIter.html" title="DBusMessageIter struct; contains no public fields.">DBusMessageIter</a> *sub)
<a name="l02853"></a>02853 {
<a name="l02854"></a>02854   <a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *real = (<a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *)iter;
<a name="l02855"></a>02855   <a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *real_sub = (<a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *)sub;
<a name="l02856"></a>02856   <a class="code" href="structDBusString.html">DBusString</a> contained_str;
<a name="l02857"></a>02857 
<a name="l02858"></a>02858   _dbus_return_val_if_fail (_dbus_message_iter_append_check (real), <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l02859"></a>02859   _dbus_return_val_if_fail (real-&gt;<a class="code" href="structDBusMessageRealIter.html#a835b7990b2909beb06fc2dc38b76a089" title="whether this is a reader or writer iter">iter_type</a> == DBUS_MESSAGE_ITER_TYPE_WRITER, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l02860"></a>02860   _dbus_return_val_if_fail (<a class="code" href="group__DBusSignature.html#gaa0c4c8aa34fa266daa55bd37bdad39b8" title="A &quot;container type&quot; can contain basic types, or nested container types.">dbus_type_is_container</a> (type), <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l02861"></a>02861   _dbus_return_val_if_fail (sub != <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="l02862"></a>02862   _dbus_return_val_if_fail ((type == <a class="code" href="group__DBusProtocol.html#gae4b22a74b9edb0ec0ff6e0294794d3f9" title="STRUCT and DICT_ENTRY are sort of special since their codes can&#39;t appear in a type string...">DBUS_TYPE_STRUCT</a> &amp;&amp;
<a name="l02863"></a>02863                              contained_signature == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>) ||
<a name="l02864"></a>02864                             (type == <a class="code" href="group__DBusProtocol.html#gad2fc8e6c50e0ad927f4249fb9e53ca97" title="Type code used to represent a dict entry; however, this type code does not appear in type signatures...">DBUS_TYPE_DICT_ENTRY</a> &amp;&amp;
<a name="l02865"></a>02865                              contained_signature == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>) ||
<a name="l02866"></a>02866                             (type == <a class="code" href="group__DBusProtocol.html#ga4aa7a463ad2bce4e9aa95e3e397ddcf1" title="Type code marking a D-Bus variant type.">DBUS_TYPE_VARIANT</a> &amp;&amp;
<a name="l02867"></a>02867                              contained_signature != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>) ||
<a name="l02868"></a>02868                             (type == <a class="code" href="group__DBusProtocol.html#ga8912f600f81a773066ca03d9163613a9" title="Type code marking a D-Bus array type.">DBUS_TYPE_ARRAY</a> &amp;&amp;
<a name="l02869"></a>02869                              contained_signature != <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="l02870"></a>02870   
<a name="l02871"></a>02871   <span class="comment">/* this would fail if the contained_signature is a dict entry, since</span>
<a name="l02872"></a>02872 <span class="comment">   * dict entries are invalid signatures standalone (they must be in</span>
<a name="l02873"></a>02873 <span class="comment">   * an array)</span>
<a name="l02874"></a>02874 <span class="comment">   */</span>
<a name="l02875"></a>02875   _dbus_return_val_if_fail ((type == <a class="code" href="group__DBusProtocol.html#ga8912f600f81a773066ca03d9163613a9" title="Type code marking a D-Bus array type.">DBUS_TYPE_ARRAY</a> &amp;&amp; contained_signature &amp;&amp; *contained_signature == <a class="code" href="group__DBusProtocol.html#gad51b5f7a2e6d927295479dd371f6b353" title="Code marking the start of a dict entry type in a type signature.">DBUS_DICT_ENTRY_BEGIN_CHAR</a>) ||
<a name="l02876"></a>02876                             (contained_signature == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a> ||
<a name="l02877"></a>02877                              _dbus_check_is_valid_signature (contained_signature)),
<a name="l02878"></a>02878                             <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l02879"></a>02879 
<a name="l02880"></a>02880   <span class="keywordflow">if</span> (!_dbus_message_iter_open_signature (real))
<a name="l02881"></a>02881     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l02882"></a>02882 
<a name="l02883"></a>02883   *real_sub = *real;
<a name="l02884"></a>02884 
<a name="l02885"></a>02885   <span class="keywordflow">if</span> (contained_signature != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l02886"></a>02886     {
<a name="l02887"></a>02887       <a class="code" href="group__DBusString.html#ga374640ddfa2f0b27a8356e2379ba8043" title="Initializes a constant string.">_dbus_string_init_const</a> (&amp;contained_str, contained_signature);
<a name="l02888"></a>02888 
<a name="l02889"></a>02889       <span class="keywordflow">return</span> <a class="code" href="group__DBusMarshal.html#ga4c0a1036e59dac270141052d951baff2" title="Opens a new container and writes out the initial information for that container.">_dbus_type_writer_recurse</a> (&amp;real-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#a93bc11bb1521743170b0b411b32140cf" title="writer">writer</a>,
<a name="l02890"></a>02890                                         type,
<a name="l02891"></a>02891                                         &amp;contained_str, 0,
<a name="l02892"></a>02892                                         &amp;real_sub-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#a93bc11bb1521743170b0b411b32140cf" title="writer">writer</a>);
<a name="l02893"></a>02893     }
<a name="l02894"></a>02894   <span class="keywordflow">else</span>
<a name="l02895"></a>02895     {
<a name="l02896"></a>02896       <span class="keywordflow">return</span> <a class="code" href="group__DBusMarshal.html#ga4c0a1036e59dac270141052d951baff2" title="Opens a new container and writes out the initial information for that container.">_dbus_type_writer_recurse</a> (&amp;real-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#a93bc11bb1521743170b0b411b32140cf" title="writer">writer</a>,
<a name="l02897"></a>02897                                         type,
<a name="l02898"></a>02898                                         <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>, 0,
<a name="l02899"></a>02899                                         &amp;real_sub-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#a93bc11bb1521743170b0b411b32140cf" title="writer">writer</a>);
<a name="l02900"></a>02900     } 
<a name="l02901"></a>02901 }
<a name="l02902"></a>02902 
<a name="l02903"></a>02903 
<a name="l02917"></a>02917 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l02918"></a><a class="code" href="group__DBusMessage.html#gaf00482f63d4af88b7851621d1f24087a">02918</a> <a class="code" href="group__DBusMessage.html#gaf00482f63d4af88b7851621d1f24087a" title="Closes a container-typed value appended to the message; may write out more information to the message...">dbus_message_iter_close_container</a> (<a class="code" href="structDBusMessageIter.html" title="DBusMessageIter struct; contains no public fields.">DBusMessageIter</a> *iter,
<a name="l02919"></a>02919                                    <a class="code" href="structDBusMessageIter.html" title="DBusMessageIter struct; contains no public fields.">DBusMessageIter</a> *sub)
<a name="l02920"></a>02920 {
<a name="l02921"></a>02921   <a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *real = (<a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *)iter;
<a name="l02922"></a>02922   <a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *real_sub = (<a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *)sub;
<a name="l02923"></a>02923   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> ret;
<a name="l02924"></a>02924 
<a name="l02925"></a>02925   _dbus_return_val_if_fail (_dbus_message_iter_append_check (real), <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l02926"></a>02926   _dbus_return_val_if_fail (real-&gt;<a class="code" href="structDBusMessageRealIter.html#a835b7990b2909beb06fc2dc38b76a089" title="whether this is a reader or writer iter">iter_type</a> == DBUS_MESSAGE_ITER_TYPE_WRITER, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l02927"></a>02927   _dbus_return_val_if_fail (_dbus_message_iter_append_check (real_sub), <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l02928"></a>02928   _dbus_return_val_if_fail (real_sub-&gt;<a class="code" href="structDBusMessageRealIter.html#a835b7990b2909beb06fc2dc38b76a089" title="whether this is a reader or writer iter">iter_type</a> == DBUS_MESSAGE_ITER_TYPE_WRITER, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l02929"></a>02929 
<a name="l02930"></a>02930   ret = <a class="code" href="group__DBusMarshal.html#gacbe7eddf4f9c19da91b742087fcc111a" title="Closes a container created by _dbus_type_writer_recurse() and writes any additional information to th...">_dbus_type_writer_unrecurse</a> (&amp;real-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#a93bc11bb1521743170b0b411b32140cf" title="writer">writer</a>,
<a name="l02931"></a>02931                                      &amp;real_sub-&gt;<a class="code" href="structDBusMessageRealIter.html#ac9c3ce5775bc9f5f0720b65093345ec6" title="the type writer or reader that does all the work">u</a>.<a class="code" href="structDBusMessageRealIter.html#a93bc11bb1521743170b0b411b32140cf" title="writer">writer</a>);
<a name="l02932"></a>02932 
<a name="l02933"></a>02933   <span class="keywordflow">if</span> (!_dbus_message_iter_close_signature (real))
<a name="l02934"></a>02934     ret = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l02935"></a>02935 
<a name="l02936"></a>02936   <span class="keywordflow">return</span> ret;
<a name="l02937"></a>02937 }
<a name="l02938"></a>02938 
<a name="l02950"></a>02950 <span class="keywordtype">void</span>
<a name="l02951"></a><a class="code" href="group__DBusMessage.html#ga6e62697ca11f0a57dbecc93d5721612c">02951</a> <a class="code" href="group__DBusMessage.html#ga6e62697ca11f0a57dbecc93d5721612c" title="Abandons creation of a contained-typed value and frees resources created by dbus_message_iter_open_co...">dbus_message_iter_abandon_container</a> (<a class="code" href="structDBusMessageIter.html" title="DBusMessageIter struct; contains no public fields.">DBusMessageIter</a> *iter,
<a name="l02952"></a>02952                                      <a class="code" href="structDBusMessageIter.html" title="DBusMessageIter struct; contains no public fields.">DBusMessageIter</a> *sub)
<a name="l02953"></a>02953 {
<a name="l02954"></a>02954   <a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *real = (<a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *)iter;
<a name="l02955"></a>02955 <span class="preprocessor">#ifndef DBUS_DISABLE_CHECKS</span>
<a name="l02956"></a>02956 <span class="preprocessor"></span>  <a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *real_sub = (<a class="code" href="structDBusMessageRealIter.html" title="Internals of DBusMessageIter.">DBusMessageRealIter</a> *)sub;
<a name="l02957"></a>02957 
<a name="l02958"></a>02958   _dbus_return_if_fail (_dbus_message_iter_append_check (real));
<a name="l02959"></a>02959   _dbus_return_if_fail (real-&gt;<a class="code" href="structDBusMessageRealIter.html#a835b7990b2909beb06fc2dc38b76a089" title="whether this is a reader or writer iter">iter_type</a> == DBUS_MESSAGE_ITER_TYPE_WRITER);
<a name="l02960"></a>02960   _dbus_return_if_fail (_dbus_message_iter_append_check (real_sub));
<a name="l02961"></a>02961   _dbus_return_if_fail (real_sub-&gt;<a class="code" href="structDBusMessageRealIter.html#a835b7990b2909beb06fc2dc38b76a089" title="whether this is a reader or writer iter">iter_type</a> == DBUS_MESSAGE_ITER_TYPE_WRITER);
<a name="l02962"></a>02962 <span class="preprocessor">#endif</span>
<a name="l02963"></a>02963 <span class="preprocessor"></span>
<a name="l02964"></a>02964   _dbus_message_iter_abandon_signature (real);
<a name="l02965"></a>02965 }
<a name="l02966"></a>02966 
<a name="l02983"></a>02983 <span class="keywordtype">void</span>
<a name="l02984"></a><a class="code" href="group__DBusMessage.html#ga0e86aeb2dc6831ccc9a21fcbf8cc16f7">02984</a> <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> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message,
<a name="l02985"></a>02985                            <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>  no_reply)
<a name="l02986"></a>02986 {
<a name="l02987"></a>02987   _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="l02988"></a>02988   _dbus_return_if_fail (!message-&gt;<a class="code" href="structDBusMessage.html#ac926e7027f22608d75a6dfe18680b9e7" title="Message being sent, no modifications allowed.">locked</a>);
<a name="l02989"></a>02989 
<a name="l02990"></a>02990   <a class="code" href="group__DBusMarshal.html#gad2073f8f2f2ba3b710aa929dced34cc3" title="Toggles a message flag bit, turning on the bit if value = TRUE and flipping it off if value = FALSE...">_dbus_header_toggle_flag</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>,
<a name="l02991"></a>02991                             <a class="code" href="group__DBusProtocol.html#ga0dcac038284250b3b0bff49cb4990626" title="If set, this flag means that the sender of a message does not care about getting a reply...">DBUS_HEADER_FLAG_NO_REPLY_EXPECTED</a>,
<a name="l02992"></a>02992                             no_reply);
<a name="l02993"></a>02993 }
<a name="l02994"></a>02994 
<a name="l03002"></a>03002 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l03003"></a><a class="code" href="group__DBusMessage.html#ga622d051a2e5f578814116a958b240aa4">03003</a> <a class="code" href="group__DBusMessage.html#ga622d051a2e5f578814116a958b240aa4" title="Returns TRUE if the message does not expect a reply.">dbus_message_get_no_reply</a> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message)
<a name="l03004"></a>03004 {
<a name="l03005"></a>03005   _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="l03006"></a>03006 
<a name="l03007"></a>03007   <span class="keywordflow">return</span> <a class="code" href="group__DBusMarshal.html#ga56619efed3088554b8760edd246b4157" title="Gets a message flag bit, returning TRUE if the bit is set.">_dbus_header_get_flag</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>,
<a name="l03008"></a>03008                                 <a class="code" href="group__DBusProtocol.html#ga0dcac038284250b3b0bff49cb4990626" title="If set, this flag means that the sender of a message does not care about getting a reply...">DBUS_HEADER_FLAG_NO_REPLY_EXPECTED</a>);
<a name="l03009"></a>03009 }
<a name="l03010"></a>03010 
<a name="l03025"></a>03025 <span class="keywordtype">void</span>
<a name="l03026"></a><a class="code" href="group__DBusMessage.html#ga1596d92a8d604f954b48c7410263d2f0">03026</a> <a class="code" href="group__DBusMessage.html#ga1596d92a8d604f954b48c7410263d2f0" title="Sets a flag indicating that an owner for the destination name will be automatically started before th...">dbus_message_set_auto_start</a> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message,
<a name="l03027"></a>03027                              <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>  auto_start)
<a name="l03028"></a>03028 {
<a name="l03029"></a>03029   _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="l03030"></a>03030   _dbus_return_if_fail (!message-&gt;<a class="code" href="structDBusMessage.html#ac926e7027f22608d75a6dfe18680b9e7" title="Message being sent, no modifications allowed.">locked</a>);
<a name="l03031"></a>03031 
<a name="l03032"></a>03032   <a class="code" href="group__DBusMarshal.html#gad2073f8f2f2ba3b710aa929dced34cc3" title="Toggles a message flag bit, turning on the bit if value = TRUE and flipping it off if value = FALSE...">_dbus_header_toggle_flag</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>,
<a name="l03033"></a>03033                             <a class="code" href="group__DBusProtocol.html#ga8699fad5ce9ff93fe3f3471ba463dd40" title="If set, this flag means that even if the message bus knows how to start an owner for the destination ...">DBUS_HEADER_FLAG_NO_AUTO_START</a>,
<a name="l03034"></a>03034                             !auto_start);
<a name="l03035"></a>03035 }
<a name="l03036"></a>03036 
<a name="l03044"></a>03044 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l03045"></a><a class="code" href="group__DBusMessage.html#ga85d396a3a774e15c3dbb7704aa173384">03045</a> <a class="code" href="group__DBusMessage.html#ga85d396a3a774e15c3dbb7704aa173384" title="Returns TRUE if the message will cause an owner for destination name to be auto-started.">dbus_message_get_auto_start</a> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message)
<a name="l03046"></a>03046 {
<a name="l03047"></a>03047   _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="l03048"></a>03048 
<a name="l03049"></a>03049   <span class="keywordflow">return</span> !<a class="code" href="group__DBusMarshal.html#ga56619efed3088554b8760edd246b4157" title="Gets a message flag bit, returning TRUE if the bit is set.">_dbus_header_get_flag</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>,
<a name="l03050"></a>03050                                  <a class="code" href="group__DBusProtocol.html#ga8699fad5ce9ff93fe3f3471ba463dd40" title="If set, this flag means that even if the message bus knows how to start an owner for the destination ...">DBUS_HEADER_FLAG_NO_AUTO_START</a>);
<a name="l03051"></a>03051 }
<a name="l03052"></a>03052 
<a name="l03053"></a>03053 
<a name="l03066"></a>03066 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l03067"></a><a class="code" href="group__DBusMessage.html#gaaf25da0ba1482266293d329314c21786">03067</a> <a class="code" href="group__DBusMessage.html#gaaf25da0ba1482266293d329314c21786" title="Sets the object path this message is being sent to (for DBUS_MESSAGE_TYPE_METHOD_CALL) or the one a s...">dbus_message_set_path</a> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>   *message,
<a name="l03068"></a>03068                        <span class="keyword">const</span> <span class="keywordtype">char</span>    *object_path)
<a name="l03069"></a>03069 {
<a name="l03070"></a>03070   _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="l03071"></a>03071   _dbus_return_val_if_fail (!message-&gt;<a class="code" href="structDBusMessage.html#ac926e7027f22608d75a6dfe18680b9e7" title="Message being sent, no modifications allowed.">locked</a>, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l03072"></a>03072   _dbus_return_val_if_fail (object_path == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a> ||
<a name="l03073"></a>03073                             _dbus_check_is_valid_path (object_path),
<a name="l03074"></a>03074                             <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l03075"></a>03075 
<a name="l03076"></a>03076   <span class="keywordflow">return</span> set_or_delete_string_field (message,
<a name="l03077"></a>03077                                      <a class="code" href="group__DBusProtocol.html#ga0cd885e6e808b28ff082a7f8a2c9f579" title="Header field code for the path - the path is the object emitting a signal or the object receiving a m...">DBUS_HEADER_FIELD_PATH</a>,
<a name="l03078"></a>03078                                      <a class="code" href="group__DBusProtocol.html#ga31cc59c99a6cbbfcef71756e1390dc4c" title="Type code marking a D-Bus object path.">DBUS_TYPE_OBJECT_PATH</a>,
<a name="l03079"></a>03079                                      object_path);
<a name="l03080"></a>03080 }
<a name="l03081"></a>03081 
<a name="l03095"></a>03095 <span class="keyword">const</span> <span class="keywordtype">char</span>*
<a name="l03096"></a><a class="code" href="group__DBusMessage.html#ga18adf731bb42d324fe2624407319e4af">03096</a> <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> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>   *message)
<a name="l03097"></a>03097 {
<a name="l03098"></a>03098   <span class="keyword">const</span> <span class="keywordtype">char</span> *v;
<a name="l03099"></a>03099 
<a name="l03100"></a>03100   _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="l03101"></a>03101 
<a name="l03102"></a>03102   v = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>; <span class="comment">/* in case field doesn&#39;t exist */</span>
<a name="l03103"></a>03103   <a class="code" href="group__DBusMarshal.html#ga499973a18dcb17d854eaf14101a66736" title="Gets the value of a field with basic type.">_dbus_header_get_field_basic</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>,
<a name="l03104"></a>03104                                 <a class="code" href="group__DBusProtocol.html#ga0cd885e6e808b28ff082a7f8a2c9f579" title="Header field code for the path - the path is the object emitting a signal or the object receiving a m...">DBUS_HEADER_FIELD_PATH</a>,
<a name="l03105"></a>03105                                 <a class="code" href="group__DBusProtocol.html#ga31cc59c99a6cbbfcef71756e1390dc4c" title="Type code marking a D-Bus object path.">DBUS_TYPE_OBJECT_PATH</a>,
<a name="l03106"></a>03106                                 (<span class="keywordtype">void</span> *) &amp;v);
<a name="l03107"></a>03107   <span class="keywordflow">return</span> v;
<a name="l03108"></a>03108 }
<a name="l03109"></a>03109 
<a name="l03119"></a>03119 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l03120"></a><a class="code" href="group__DBusMessage.html#gad2c87d3472bd3bfa8eca8a97f2db026b">03120</a> <a class="code" href="group__DBusMessage.html#gad2c87d3472bd3bfa8eca8a97f2db026b" title="Checks if the message has a particular object path.">dbus_message_has_path</a> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>   *message,
<a name="l03121"></a>03121                        <span class="keyword">const</span> <span class="keywordtype">char</span>    *path)
<a name="l03122"></a>03122 {
<a name="l03123"></a>03123   <span class="keyword">const</span> <span class="keywordtype">char</span> *msg_path;
<a name="l03124"></a>03124   msg_path = <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="l03125"></a>03125   
<a name="l03126"></a>03126   <span class="keywordflow">if</span> (msg_path == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l03127"></a>03127     {
<a name="l03128"></a>03128       <span class="keywordflow">if</span> (path == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l03129"></a>03129         <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l03130"></a>03130       <span class="keywordflow">else</span>
<a name="l03131"></a>03131         <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l03132"></a>03132     }
<a name="l03133"></a>03133 
<a name="l03134"></a>03134   <span class="keywordflow">if</span> (path == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l03135"></a>03135     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l03136"></a>03136    
<a name="l03137"></a>03137   <span class="keywordflow">if</span> (strcmp (msg_path, path) == 0)
<a name="l03138"></a>03138     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l03139"></a>03139 
<a name="l03140"></a>03140   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l03141"></a>03141 }
<a name="l03142"></a>03142 
<a name="l03163"></a>03163 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l03164"></a><a class="code" href="group__DBusMessage.html#gaf2b5b3319da838b1f1b360c04a33f153">03164</a> <a class="code" href="group__DBusMessage.html#gaf2b5b3319da838b1f1b360c04a33f153" title="Gets the object path this message is being sent to (for DBUS_MESSAGE_TYPE_METHOD_CALL) or being emitt...">dbus_message_get_path_decomposed</a> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>   *message,
<a name="l03165"></a>03165                                   <span class="keywordtype">char</span>        ***path)
<a name="l03166"></a>03166 {
<a name="l03167"></a>03167   <span class="keyword">const</span> <span class="keywordtype">char</span> *v;
<a name="l03168"></a>03168 
<a name="l03169"></a>03169   _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="l03170"></a>03170   _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="l03171"></a>03171 
<a name="l03172"></a>03172   *path = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l03173"></a>03173 
<a name="l03174"></a>03174   v = <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="l03175"></a>03175   <span class="keywordflow">if</span> (v != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l03176"></a>03176     {
<a name="l03177"></a>03177       <span class="keywordflow">if</span> (!<a class="code" href="group__DBusObjectTree.html#gab282b916368cd512842d3aaae31e65c7" title="Decompose an object path.">_dbus_decompose_path</a> (v, strlen (v),
<a name="l03178"></a>03178                                  path, <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>))
<a name="l03179"></a>03179         <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l03180"></a>03180     }
<a name="l03181"></a>03181   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l03182"></a>03182 }
<a name="l03183"></a>03183 
<a name="l03197"></a>03197 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l03198"></a><a class="code" href="group__DBusMessage.html#ga02b754855e4d9a1cade8e4fc17a3f5c7">03198</a> <a class="code" href="group__DBusMessage.html#ga02b754855e4d9a1cade8e4fc17a3f5c7" title="Sets the interface this message is being sent to (for DBUS_MESSAGE_TYPE_METHOD_CALL) or the interface...">dbus_message_set_interface</a> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>  *message,
<a name="l03199"></a>03199                             <span class="keyword">const</span> <span class="keywordtype">char</span>   *iface)
<a name="l03200"></a>03200 {
<a name="l03201"></a>03201   _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="l03202"></a>03202   _dbus_return_val_if_fail (!message-&gt;<a class="code" href="structDBusMessage.html#ac926e7027f22608d75a6dfe18680b9e7" title="Message being sent, no modifications allowed.">locked</a>, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l03203"></a>03203   _dbus_return_val_if_fail (iface == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a> ||
<a name="l03204"></a>03204                             _dbus_check_is_valid_interface (iface),
<a name="l03205"></a>03205                             <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l03206"></a>03206 
<a name="l03207"></a>03207   <span class="keywordflow">return</span> set_or_delete_string_field (message,
<a name="l03208"></a>03208                                      <a class="code" href="group__DBusProtocol.html#ga296b5f099b6c347f65d53ef0a6fa2b0d" title="Header field code for the interface containing a member (method or signal).">DBUS_HEADER_FIELD_INTERFACE</a>,
<a name="l03209"></a>03209                                      <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="l03210"></a>03210                                      iface);
<a name="l03211"></a>03211 }
<a name="l03212"></a>03212 
<a name="l03226"></a>03226 <span class="keyword">const</span> <span class="keywordtype">char</span>*
<a name="l03227"></a><a class="code" href="group__DBusMessage.html#ga1ad192bd4538cae556121a71b4e09d42">03227</a> <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> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message)
<a name="l03228"></a>03228 {
<a name="l03229"></a>03229   <span class="keyword">const</span> <span class="keywordtype">char</span> *v;
<a name="l03230"></a>03230 
<a name="l03231"></a>03231   _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="l03232"></a>03232 
<a name="l03233"></a>03233   v = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>; <span class="comment">/* in case field doesn&#39;t exist */</span>
<a name="l03234"></a>03234   <a class="code" href="group__DBusMarshal.html#ga499973a18dcb17d854eaf14101a66736" title="Gets the value of a field with basic type.">_dbus_header_get_field_basic</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>,
<a name="l03235"></a>03235                                 <a class="code" href="group__DBusProtocol.html#ga296b5f099b6c347f65d53ef0a6fa2b0d" title="Header field code for the interface containing a member (method or signal).">DBUS_HEADER_FIELD_INTERFACE</a>,
<a name="l03236"></a>03236                                 <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="l03237"></a>03237                                 (<span class="keywordtype">void</span> *) &amp;v);
<a name="l03238"></a>03238   <span class="keywordflow">return</span> v;
<a name="l03239"></a>03239 }
<a name="l03240"></a>03240 
<a name="l03248"></a>03248 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l03249"></a><a class="code" href="group__DBusMessage.html#ga0d1debd1c101a80c386d6ec92cdb1d93">03249</a> <a class="code" href="group__DBusMessage.html#ga0d1debd1c101a80c386d6ec92cdb1d93" title="Checks if the message has an interface.">dbus_message_has_interface</a> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>   *message,
<a name="l03250"></a>03250                             <span class="keyword">const</span> <span class="keywordtype">char</span>    *iface)
<a name="l03251"></a>03251 {
<a name="l03252"></a>03252   <span class="keyword">const</span> <span class="keywordtype">char</span> *msg_interface;
<a name="l03253"></a>03253   msg_interface = <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="l03254"></a>03254    
<a name="l03255"></a>03255   <span class="keywordflow">if</span> (msg_interface == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l03256"></a>03256     {
<a name="l03257"></a>03257       <span class="keywordflow">if</span> (iface == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l03258"></a>03258         <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l03259"></a>03259       <span class="keywordflow">else</span>
<a name="l03260"></a>03260         <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l03261"></a>03261     }
<a name="l03262"></a>03262 
<a name="l03263"></a>03263   <span class="keywordflow">if</span> (iface == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l03264"></a>03264     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l03265"></a>03265      
<a name="l03266"></a>03266   <span class="keywordflow">if</span> (strcmp (msg_interface, iface) == 0)
<a name="l03267"></a>03267     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l03268"></a>03268 
<a name="l03269"></a>03269   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l03270"></a>03270 
<a name="l03271"></a>03271 }
<a name="l03272"></a>03272 
<a name="l03285"></a>03285 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l03286"></a><a class="code" href="group__DBusMessage.html#ga3afdda6016816cc70b451d8657065208">03286</a> <a class="code" href="group__DBusMessage.html#ga3afdda6016816cc70b451d8657065208" title="Sets the interface member being invoked (DBUS_MESSAGE_TYPE_METHOD_CALL) or emitted (DBUS_MESSAGE_TYPE...">dbus_message_set_member</a> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>  *message,
<a name="l03287"></a>03287                          <span class="keyword">const</span> <span class="keywordtype">char</span>   *member)
<a name="l03288"></a>03288 {
<a name="l03289"></a>03289   _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="l03290"></a>03290   _dbus_return_val_if_fail (!message-&gt;<a class="code" href="structDBusMessage.html#ac926e7027f22608d75a6dfe18680b9e7" title="Message being sent, no modifications allowed.">locked</a>, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l03291"></a>03291   _dbus_return_val_if_fail (member == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a> ||
<a name="l03292"></a>03292                             _dbus_check_is_valid_member (member),
<a name="l03293"></a>03293                             <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l03294"></a>03294 
<a name="l03295"></a>03295   <span class="keywordflow">return</span> set_or_delete_string_field (message,
<a name="l03296"></a>03296                                      <a class="code" href="group__DBusProtocol.html#ga2aa9d65ef983ac9c08c1d4cb31366818" title="Header field code for a member (method or signal).">DBUS_HEADER_FIELD_MEMBER</a>,
<a name="l03297"></a>03297                                      <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="l03298"></a>03298                                      member);
<a name="l03299"></a>03299 }
<a name="l03300"></a>03300 
<a name="l03312"></a>03312 <span class="keyword">const</span> <span class="keywordtype">char</span>*
<a name="l03313"></a><a class="code" href="group__DBusMessage.html#gaf5c6b705c53db07a5ae2c6b76f230cf9">03313</a> <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> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message)
<a name="l03314"></a>03314 {
<a name="l03315"></a>03315   <span class="keyword">const</span> <span class="keywordtype">char</span> *v;
<a name="l03316"></a>03316 
<a name="l03317"></a>03317   _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="l03318"></a>03318 
<a name="l03319"></a>03319   v = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>; <span class="comment">/* in case field doesn&#39;t exist */</span>
<a name="l03320"></a>03320   <a class="code" href="group__DBusMarshal.html#ga499973a18dcb17d854eaf14101a66736" title="Gets the value of a field with basic type.">_dbus_header_get_field_basic</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>,
<a name="l03321"></a>03321                                 <a class="code" href="group__DBusProtocol.html#ga2aa9d65ef983ac9c08c1d4cb31366818" title="Header field code for a member (method or signal).">DBUS_HEADER_FIELD_MEMBER</a>,
<a name="l03322"></a>03322                                 <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="l03323"></a>03323                                 (<span class="keywordtype">void</span> *) &amp;v);
<a name="l03324"></a>03324   <span class="keywordflow">return</span> v;
<a name="l03325"></a>03325 }
<a name="l03326"></a>03326 
<a name="l03334"></a>03334 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l03335"></a><a class="code" href="group__DBusMessage.html#gad7021a30bf930f8090bc38f862f19adb">03335</a> <a class="code" href="group__DBusMessage.html#gad7021a30bf930f8090bc38f862f19adb" title="Checks if the message has an interface member.">dbus_message_has_member</a> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>   *message,
<a name="l03336"></a>03336                          <span class="keyword">const</span> <span class="keywordtype">char</span>    *member)
<a name="l03337"></a>03337 {
<a name="l03338"></a>03338   <span class="keyword">const</span> <span class="keywordtype">char</span> *msg_member;
<a name="l03339"></a>03339   msg_member = <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="l03340"></a>03340  
<a name="l03341"></a>03341   <span class="keywordflow">if</span> (msg_member == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l03342"></a>03342     {
<a name="l03343"></a>03343       <span class="keywordflow">if</span> (member == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l03344"></a>03344         <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l03345"></a>03345       <span class="keywordflow">else</span>
<a name="l03346"></a>03346         <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l03347"></a>03347     }
<a name="l03348"></a>03348 
<a name="l03349"></a>03349   <span class="keywordflow">if</span> (member == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l03350"></a>03350     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l03351"></a>03351     
<a name="l03352"></a>03352   <span class="keywordflow">if</span> (strcmp (msg_member, member) == 0)
<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   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l03356"></a>03356 
<a name="l03357"></a>03357 }
<a name="l03358"></a>03358 
<a name="l03370"></a>03370 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l03371"></a><a class="code" href="group__DBusMessage.html#ga892f9857707371c2a53cec6b54c843c7">03371</a> <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> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>  *message,
<a name="l03372"></a>03372                              <span class="keyword">const</span> <span class="keywordtype">char</span>   *error_name)
<a name="l03373"></a>03373 {
<a name="l03374"></a>03374   _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="l03375"></a>03375   _dbus_return_val_if_fail (!message-&gt;<a class="code" href="structDBusMessage.html#ac926e7027f22608d75a6dfe18680b9e7" title="Message being sent, no modifications allowed.">locked</a>, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l03376"></a>03376   _dbus_return_val_if_fail (error_name == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a> ||
<a name="l03377"></a>03377                             _dbus_check_is_valid_error_name (error_name),
<a name="l03378"></a>03378                             <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l03379"></a>03379 
<a name="l03380"></a>03380   <span class="keywordflow">return</span> set_or_delete_string_field (message,
<a name="l03381"></a>03381                                      <a class="code" href="group__DBusProtocol.html#gac551be0f921390d01104cce30a814a5e" title="Header field code for an error name (found in DBUS_MESSAGE_TYPE_ERROR messages).">DBUS_HEADER_FIELD_ERROR_NAME</a>,
<a name="l03382"></a>03382                                      <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="l03383"></a>03383                                      error_name);
<a name="l03384"></a>03384 }
<a name="l03385"></a>03385 
<a name="l03396"></a>03396 <span class="keyword">const</span> <span class="keywordtype">char</span>*
<a name="l03397"></a><a class="code" href="group__DBusMessage.html#ga4e98b2283707a8e0313fc7c6fe3b1b5f">03397</a> <a class="code" href="group__DBusMessage.html#ga4e98b2283707a8e0313fc7c6fe3b1b5f" title="Gets the error name (DBUS_MESSAGE_TYPE_ERROR only) or NULL if none.">dbus_message_get_error_name</a> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message)
<a name="l03398"></a>03398 {
<a name="l03399"></a>03399   <span class="keyword">const</span> <span class="keywordtype">char</span> *v;
<a name="l03400"></a>03400 
<a name="l03401"></a>03401   _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="l03402"></a>03402 
<a name="l03403"></a>03403   v = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>; <span class="comment">/* in case field doesn&#39;t exist */</span>
<a name="l03404"></a>03404   <a class="code" href="group__DBusMarshal.html#ga499973a18dcb17d854eaf14101a66736" title="Gets the value of a field with basic type.">_dbus_header_get_field_basic</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>,
<a name="l03405"></a>03405                                 <a class="code" href="group__DBusProtocol.html#gac551be0f921390d01104cce30a814a5e" title="Header field code for an error name (found in DBUS_MESSAGE_TYPE_ERROR messages).">DBUS_HEADER_FIELD_ERROR_NAME</a>,
<a name="l03406"></a>03406                                 <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="l03407"></a>03407                                 (<span class="keywordtype">void</span> *) &amp;v);
<a name="l03408"></a>03408   <span class="keywordflow">return</span> v;
<a name="l03409"></a>03409 }
<a name="l03410"></a>03410 
<a name="l03424"></a>03424 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l03425"></a><a class="code" href="group__DBusMessage.html#gacc47c1af23addfc4198b70084ba068fc">03425</a> <a class="code" href="group__DBusMessage.html#gacc47c1af23addfc4198b70084ba068fc" title="Sets the message&#39;s destination.">dbus_message_set_destination</a> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>  *message,
<a name="l03426"></a>03426                               <span class="keyword">const</span> <span class="keywordtype">char</span>   *destination)
<a name="l03427"></a>03427 {
<a name="l03428"></a>03428   _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="l03429"></a>03429   _dbus_return_val_if_fail (!message-&gt;<a class="code" href="structDBusMessage.html#ac926e7027f22608d75a6dfe18680b9e7" title="Message being sent, no modifications allowed.">locked</a>, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l03430"></a>03430   _dbus_return_val_if_fail (destination == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a> ||
<a name="l03431"></a>03431                             _dbus_check_is_valid_bus_name (destination),
<a name="l03432"></a>03432                             <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l03433"></a>03433 
<a name="l03434"></a>03434   <span class="keywordflow">return</span> set_or_delete_string_field (message,
<a name="l03435"></a>03435                                      <a class="code" href="group__DBusProtocol.html#gade98f71a08a1e0198d095fdb6d46cab9" title="Header field code for the destination bus name of a message.">DBUS_HEADER_FIELD_DESTINATION</a>,
<a name="l03436"></a>03436                                      <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="l03437"></a>03437                                      destination);
<a name="l03438"></a>03438 }
<a name="l03439"></a>03439 
<a name="l03449"></a>03449 <span class="keyword">const</span> <span class="keywordtype">char</span>*
<a name="l03450"></a><a class="code" href="group__DBusMessage.html#gaac65c926e6253e49aa689b4f032fad45">03450</a> <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> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message)
<a name="l03451"></a>03451 {
<a name="l03452"></a>03452   <span class="keyword">const</span> <span class="keywordtype">char</span> *v;
<a name="l03453"></a>03453 
<a name="l03454"></a>03454   _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="l03455"></a>03455 
<a name="l03456"></a>03456   v = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>; <span class="comment">/* in case field doesn&#39;t exist */</span>
<a name="l03457"></a>03457   <a class="code" href="group__DBusMarshal.html#ga499973a18dcb17d854eaf14101a66736" title="Gets the value of a field with basic type.">_dbus_header_get_field_basic</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>,
<a name="l03458"></a>03458                                 <a class="code" href="group__DBusProtocol.html#gade98f71a08a1e0198d095fdb6d46cab9" title="Header field code for the destination bus name of a message.">DBUS_HEADER_FIELD_DESTINATION</a>,
<a name="l03459"></a>03459                                 <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="l03460"></a>03460                                 (<span class="keywordtype">void</span> *) &amp;v);
<a name="l03461"></a>03461   <span class="keywordflow">return</span> v;
<a name="l03462"></a>03462 }
<a name="l03463"></a>03463 
<a name="l03478"></a>03478 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l03479"></a><a class="code" href="group__DBusMessage.html#gaa2170744c2c19217d9df02551f16bc92">03479</a> <a class="code" href="group__DBusMessage.html#gaa2170744c2c19217d9df02551f16bc92" title="Sets the message sender.">dbus_message_set_sender</a> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>  *message,
<a name="l03480"></a>03480                          <span class="keyword">const</span> <span class="keywordtype">char</span>   *sender)
<a name="l03481"></a>03481 {
<a name="l03482"></a>03482   _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="l03483"></a>03483   _dbus_return_val_if_fail (!message-&gt;<a class="code" href="structDBusMessage.html#ac926e7027f22608d75a6dfe18680b9e7" title="Message being sent, no modifications allowed.">locked</a>, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l03484"></a>03484   _dbus_return_val_if_fail (sender == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a> ||
<a name="l03485"></a>03485                             _dbus_check_is_valid_bus_name (sender),
<a name="l03486"></a>03486                             <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l03487"></a>03487 
<a name="l03488"></a>03488   <span class="keywordflow">return</span> set_or_delete_string_field (message,
<a name="l03489"></a>03489                                      <a class="code" href="group__DBusProtocol.html#ga3ba84ae623951832bd73e2796bb13e71" title="Header field code for the sender of a message; usually initialized by the message bus...">DBUS_HEADER_FIELD_SENDER</a>,
<a name="l03490"></a>03490                                      <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="l03491"></a>03491                                      sender);
<a name="l03492"></a>03492 }
<a name="l03493"></a>03493 
<a name="l03509"></a>03509 <span class="keyword">const</span> <span class="keywordtype">char</span>*
<a name="l03510"></a><a class="code" href="group__DBusMessage.html#ga13ce514ceb2d1598751f3a7760cf1375">03510</a> <a class="code" href="group__DBusMessage.html#ga13ce514ceb2d1598751f3a7760cf1375" title="Gets the unique name of the connection which originated this message, or NULL if unknown or inapplica...">dbus_message_get_sender</a> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message)
<a name="l03511"></a>03511 {
<a name="l03512"></a>03512   <span class="keyword">const</span> <span class="keywordtype">char</span> *v;
<a name="l03513"></a>03513 
<a name="l03514"></a>03514   _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="l03515"></a>03515 
<a name="l03516"></a>03516   v = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>; <span class="comment">/* in case field doesn&#39;t exist */</span>
<a name="l03517"></a>03517   <a class="code" href="group__DBusMarshal.html#ga499973a18dcb17d854eaf14101a66736" title="Gets the value of a field with basic type.">_dbus_header_get_field_basic</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>,
<a name="l03518"></a>03518                                 <a class="code" href="group__DBusProtocol.html#ga3ba84ae623951832bd73e2796bb13e71" title="Header field code for the sender of a message; usually initialized by the message bus...">DBUS_HEADER_FIELD_SENDER</a>,
<a name="l03519"></a>03519                                 <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="l03520"></a>03520                                 (<span class="keywordtype">void</span> *) &amp;v);
<a name="l03521"></a>03521   <span class="keywordflow">return</span> v;
<a name="l03522"></a>03522 }
<a name="l03523"></a>03523 
<a name="l03542"></a>03542 <span class="keyword">const</span> <span class="keywordtype">char</span>*
<a name="l03543"></a><a class="code" href="group__DBusMessage.html#gaed63e4c2baaa50d782e8ebb7643def19">03543</a> <a class="code" href="group__DBusMessage.html#gaed63e4c2baaa50d782e8ebb7643def19" title="Gets the type signature of the message, i.e.">dbus_message_get_signature</a> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message)
<a name="l03544"></a>03544 {
<a name="l03545"></a>03545   <span class="keyword">const</span> <a class="code" href="structDBusString.html">DBusString</a> *type_str;
<a name="l03546"></a>03546   <span class="keywordtype">int</span> type_pos;
<a name="l03547"></a>03547 
<a name="l03548"></a>03548   _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="l03549"></a>03549 
<a name="l03550"></a>03550   get_const_signature (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>, &amp;type_str, &amp;type_pos);
<a name="l03551"></a>03551 
<a name="l03552"></a>03552   <span class="keywordflow">return</span> <a class="code" href="group__DBusString.html#ga8c202a65e938f9bdb859fc6705a4f1bb" title="const version of _dbus_string_get_data_len().">_dbus_string_get_const_data_len</a> (type_str, type_pos, 0);
<a name="l03553"></a>03553 }
<a name="l03554"></a>03554 
<a name="l03555"></a>03555 <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="l03556"></a>03556 _dbus_message_has_type_interface_member (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message,
<a name="l03557"></a>03557                                          <span class="keywordtype">int</span>          type,
<a name="l03558"></a>03558                                          <span class="keyword">const</span> <span class="keywordtype">char</span>  *iface,
<a name="l03559"></a>03559                                          <span class="keyword">const</span> <span class="keywordtype">char</span>  *member)
<a name="l03560"></a>03560 {
<a name="l03561"></a>03561   <span class="keyword">const</span> <span class="keywordtype">char</span> *n;
<a name="l03562"></a>03562 
<a name="l03563"></a>03563   _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="l03564"></a>03564   _dbus_assert (iface != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l03565"></a>03565   _dbus_assert (member != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l03566"></a>03566 
<a name="l03567"></a>03567   <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) != type)
<a name="l03568"></a>03568     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l03569"></a>03569 
<a name="l03570"></a>03570   <span class="comment">/* Optimize by checking the short member name first</span>
<a name="l03571"></a>03571 <span class="comment">   * instead of the longer interface name</span>
<a name="l03572"></a>03572 <span class="comment">   */</span>
<a name="l03573"></a>03573 
<a name="l03574"></a>03574   n = <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="l03575"></a>03575 
<a name="l03576"></a>03576   <span class="keywordflow">if</span> (n &amp;&amp; strcmp (n, member) == 0)
<a name="l03577"></a>03577     {
<a name="l03578"></a>03578       n = <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="l03579"></a>03579 
<a name="l03580"></a>03580       <span class="keywordflow">if</span> (n == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a> || strcmp (n, iface) == 0)
<a name="l03581"></a>03581         <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l03582"></a>03582     }
<a name="l03583"></a>03583 
<a name="l03584"></a>03584   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l03585"></a>03585 }
<a name="l03586"></a>03586 
<a name="l03601"></a>03601 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l03602"></a><a class="code" href="group__DBusMessage.html#gad8bd4730941af47d8d0f9c9b00562a44">03602</a> <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> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message,
<a name="l03603"></a>03603                              <span class="keyword">const</span> <span class="keywordtype">char</span>  *iface,
<a name="l03604"></a>03604                              <span class="keyword">const</span> <span class="keywordtype">char</span>  *method)
<a name="l03605"></a>03605 {
<a name="l03606"></a>03606   _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="l03607"></a>03607   _dbus_return_val_if_fail (iface != <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="l03608"></a>03608   _dbus_return_val_if_fail (method != <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="l03609"></a>03609   <span class="comment">/* don&#39;t check that interface/method are valid since it would be</span>
<a name="l03610"></a>03610 <span class="comment">   * expensive, and not catch many common errors</span>
<a name="l03611"></a>03611 <span class="comment">   */</span>
<a name="l03612"></a>03612 
<a name="l03613"></a>03613   <span class="keywordflow">return</span> _dbus_message_has_type_interface_member (message,
<a name="l03614"></a>03614                                                   <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="l03615"></a>03615                                                   iface, method);
<a name="l03616"></a>03616 }
<a name="l03617"></a>03617 
<a name="l03629"></a>03629 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l03630"></a><a class="code" href="group__DBusMessage.html#gaed0e32329f142cc246662227c81d5d1f">03630</a> <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> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message,
<a name="l03631"></a>03631                         <span class="keyword">const</span> <span class="keywordtype">char</span>  *iface,
<a name="l03632"></a>03632                         <span class="keyword">const</span> <span class="keywordtype">char</span>  *signal_name)
<a name="l03633"></a>03633 {
<a name="l03634"></a>03634   _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="l03635"></a>03635   _dbus_return_val_if_fail (iface != <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="l03636"></a>03636   _dbus_return_val_if_fail (signal_name != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l03637"></a>03637   <span class="comment">/* don&#39;t check that interface/name are valid since it would be</span>
<a name="l03638"></a>03638 <span class="comment">   * expensive, and not catch many common errors</span>
<a name="l03639"></a>03639 <span class="comment">   */</span>
<a name="l03640"></a>03640 
<a name="l03641"></a>03641   <span class="keywordflow">return</span> _dbus_message_has_type_interface_member (message,
<a name="l03642"></a>03642                                                   <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="l03643"></a>03643                                                   iface, signal_name);
<a name="l03644"></a>03644 }
<a name="l03645"></a>03645 
<a name="l03656"></a>03656 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l03657"></a><a class="code" href="group__DBusMessage.html#ga70ef9d7fad409666a0b5f3a8d4f0dd92">03657</a> <a class="code" href="group__DBusMessage.html#ga70ef9d7fad409666a0b5f3a8d4f0dd92" title="Checks whether the message is an error reply with the given error name.">dbus_message_is_error</a> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message,
<a name="l03658"></a>03658                        <span class="keyword">const</span> <span class="keywordtype">char</span>  *error_name)
<a name="l03659"></a>03659 {
<a name="l03660"></a>03660   <span class="keyword">const</span> <span class="keywordtype">char</span> *n;
<a name="l03661"></a>03661 
<a name="l03662"></a>03662   _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="l03663"></a>03663   _dbus_return_val_if_fail (error_name != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l03664"></a>03664   <span class="comment">/* don&#39;t check that error_name is valid since it would be expensive,</span>
<a name="l03665"></a>03665 <span class="comment">   * and not catch many common errors</span>
<a name="l03666"></a>03666 <span class="comment">   */</span>
<a name="l03667"></a>03667 
<a name="l03668"></a>03668   <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#ga2b9423d95066313d73eeea8eeaf86812" title="Message type of an error reply message, see dbus_message_get_type()">DBUS_MESSAGE_TYPE_ERROR</a>)
<a name="l03669"></a>03669     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l03670"></a>03670 
<a name="l03671"></a>03671   n = <a class="code" href="group__DBusMessage.html#ga4e98b2283707a8e0313fc7c6fe3b1b5f" title="Gets the error name (DBUS_MESSAGE_TYPE_ERROR only) or NULL if none.">dbus_message_get_error_name</a> (message);
<a name="l03672"></a>03672 
<a name="l03673"></a>03673   <span class="keywordflow">if</span> (n &amp;&amp; strcmp (n, error_name) == 0)
<a name="l03674"></a>03674     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l03675"></a>03675   <span class="keywordflow">else</span>
<a name="l03676"></a>03676     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l03677"></a>03677 }
<a name="l03678"></a>03678 
<a name="l03689"></a>03689 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l03690"></a><a class="code" href="group__DBusMessage.html#ga017cb8d960d4c360cb6b30ded5292509">03690</a> <a class="code" href="group__DBusMessage.html#ga017cb8d960d4c360cb6b30ded5292509" title="Checks whether the message was sent to the given name.">dbus_message_has_destination</a> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>  *message,
<a name="l03691"></a>03691                               <span class="keyword">const</span> <span class="keywordtype">char</span>   *name)
<a name="l03692"></a>03692 {
<a name="l03693"></a>03693   <span class="keyword">const</span> <span class="keywordtype">char</span> *s;
<a name="l03694"></a>03694 
<a name="l03695"></a>03695   _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="l03696"></a>03696   _dbus_return_val_if_fail (name != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l03697"></a>03697   <span class="comment">/* don&#39;t check that name is valid since it would be expensive, and</span>
<a name="l03698"></a>03698 <span class="comment">   * not catch many common errors</span>
<a name="l03699"></a>03699 <span class="comment">   */</span>
<a name="l03700"></a>03700 
<a name="l03701"></a>03701   s = <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="l03702"></a>03702 
<a name="l03703"></a>03703   <span class="keywordflow">if</span> (s &amp;&amp; strcmp (s, name) == 0)
<a name="l03704"></a>03704     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l03705"></a>03705   <span class="keywordflow">else</span>
<a name="l03706"></a>03706     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l03707"></a>03707 }
<a name="l03708"></a>03708 
<a name="l03724"></a>03724 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l03725"></a><a class="code" href="group__DBusMessage.html#ga332fb0c71efcd1e9ef43ebdf2a25350c">03725</a> <a class="code" href="group__DBusMessage.html#ga332fb0c71efcd1e9ef43ebdf2a25350c" title="Checks whether the message has the given unique name as its sender.">dbus_message_has_sender</a> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>  *message,
<a name="l03726"></a>03726                          <span class="keyword">const</span> <span class="keywordtype">char</span>   *name)
<a name="l03727"></a>03727 {
<a name="l03728"></a>03728   <span class="keyword">const</span> <span class="keywordtype">char</span> *s;
<a name="l03729"></a>03729 
<a name="l03730"></a>03730   _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="l03731"></a>03731   _dbus_return_val_if_fail (name != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l03732"></a>03732   <span class="comment">/* don&#39;t check that name is valid since it would be expensive, and</span>
<a name="l03733"></a>03733 <span class="comment">   * not catch many common errors</span>
<a name="l03734"></a>03734 <span class="comment">   */</span>
<a name="l03735"></a>03735 
<a name="l03736"></a>03736   s = <a class="code" href="group__DBusMessage.html#ga13ce514ceb2d1598751f3a7760cf1375" title="Gets the unique name of the connection which originated this message, or NULL if unknown or inapplica...">dbus_message_get_sender</a> (message);
<a name="l03737"></a>03737 
<a name="l03738"></a>03738   <span class="keywordflow">if</span> (s &amp;&amp; strcmp (s, name) == 0)
<a name="l03739"></a>03739     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l03740"></a>03740   <span class="keywordflow">else</span>
<a name="l03741"></a>03741     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l03742"></a>03742 }
<a name="l03743"></a>03743 
<a name="l03753"></a>03753 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l03754"></a><a class="code" href="group__DBusMessage.html#ga8d563a936b6147f12dce7f24df3557b7">03754</a> <a class="code" href="group__DBusMessage.html#ga8d563a936b6147f12dce7f24df3557b7" title="Checks whether the message has the given signature; see dbus_message_get_signature() for more details...">dbus_message_has_signature</a> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>   *message,
<a name="l03755"></a>03755                             <span class="keyword">const</span> <span class="keywordtype">char</span>    *signature)
<a name="l03756"></a>03756 {
<a name="l03757"></a>03757   <span class="keyword">const</span> <span class="keywordtype">char</span> *s;
<a name="l03758"></a>03758 
<a name="l03759"></a>03759   _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="l03760"></a>03760   _dbus_return_val_if_fail (signature != <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="l03761"></a>03761   <span class="comment">/* don&#39;t check that signature is valid since it would be expensive,</span>
<a name="l03762"></a>03762 <span class="comment">   * and not catch many common errors</span>
<a name="l03763"></a>03763 <span class="comment">   */</span>
<a name="l03764"></a>03764 
<a name="l03765"></a>03765   s = <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="l03766"></a>03766 
<a name="l03767"></a>03767   <span class="keywordflow">if</span> (s &amp;&amp; strcmp (s, signature) == 0)
<a name="l03768"></a>03768     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l03769"></a>03769   <span class="keywordflow">else</span>
<a name="l03770"></a>03770     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l03771"></a>03771 }
<a name="l03772"></a>03772 
<a name="l03795"></a>03795 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l03796"></a><a class="code" href="group__DBusMessage.html#gaba5e49e956e6bbd1f857ffd21c289276">03796</a> <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> (<a class="code" href="structDBusError.html" title="Object representing an exception.">DBusError</a>   *error,
<a name="l03797"></a>03797                              <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message)
<a name="l03798"></a>03798 {
<a name="l03799"></a>03799   <span class="keyword">const</span> <span class="keywordtype">char</span> *str;
<a name="l03800"></a>03800 
<a name="l03801"></a>03801   _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="l03802"></a>03802   _dbus_return_val_if_error_is_set (error, <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>);
<a name="l03803"></a>03803 
<a name="l03804"></a>03804   <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#ga2b9423d95066313d73eeea8eeaf86812" title="Message type of an error reply message, see dbus_message_get_type()">DBUS_MESSAGE_TYPE_ERROR</a>)
<a name="l03805"></a>03805     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l03806"></a>03806 
<a name="l03807"></a>03807   str = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l03808"></a>03808   <a class="code" href="group__DBusMessage.html#gad8953f53ceea7de81cde792e3edd0230" title="Gets arguments from a message given a variable argument list.">dbus_message_get_args</a> (message, <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>,
<a name="l03809"></a>03809                          <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;str,
<a name="l03810"></a>03810                          <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="l03811"></a>03811 
<a name="l03812"></a>03812   <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__DBusMessage.html#ga4e98b2283707a8e0313fc7c6fe3b1b5f" title="Gets the error name (DBUS_MESSAGE_TYPE_ERROR only) or NULL if none.">dbus_message_get_error_name</a> (message),
<a name="l03813"></a>03813                   str ? <span class="stringliteral">&quot;%s&quot;</span> : <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>, str);
<a name="l03814"></a>03814 
<a name="l03815"></a>03815   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l03816"></a>03816 }
<a name="l03817"></a>03817 
<a name="l03824"></a>03824 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l03825"></a><a class="code" href="group__DBusMessage.html#ga7436b74471eb3642f81fd456f8f2b69c">03825</a> <a class="code" href="group__DBusMessage.html#ga7436b74471eb3642f81fd456f8f2b69c" title="Checks whether a message contains unix fds.">dbus_message_contains_unix_fds</a>(<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message)
<a name="l03826"></a>03826 {
<a name="l03827"></a>03827 <span class="preprocessor">#ifdef HAVE_UNIX_FD_PASSING</span>
<a name="l03828"></a>03828 <span class="preprocessor"></span>  _dbus_assert(message);
<a name="l03829"></a>03829 
<a name="l03830"></a>03830   <span class="keywordflow">return</span> message-&gt;n_unix_fds &gt; 0;
<a name="l03831"></a>03831 <span class="preprocessor">#else</span>
<a name="l03832"></a>03832 <span class="preprocessor"></span>  <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l03833"></a>03833 <span class="preprocessor">#endif</span>
<a name="l03834"></a>03834 <span class="preprocessor"></span>}
<a name="l03835"></a>03835 
<a name="l03854"></a><a class="code" href="group__DBusMessageInternals.html#gacbe0bfe7a9551ab0489a0ec9aba6e94e">03854</a> <span class="preprocessor">#define INITIAL_LOADER_DATA_LEN 32</span>
<a name="l03855"></a>03855 <span class="preprocessor"></span>
<a name="l03862"></a>03862 <a class="code" href="structDBusMessageLoader.html" title="Implementation details of DBusMessageLoader.">DBusMessageLoader</a>*
<a name="l03863"></a><a class="code" href="group__DBusMessageInternals.html#ga66f1c10cf909ba09ed732bc125ff8671">03863</a> <a class="code" href="group__DBusMessageInternals.html#ga66f1c10cf909ba09ed732bc125ff8671" title="Creates a new message loader.">_dbus_message_loader_new</a> (<span class="keywordtype">void</span>)
<a name="l03864"></a>03864 {
<a name="l03865"></a>03865   <a class="code" href="structDBusMessageLoader.html" title="Implementation details of DBusMessageLoader.">DBusMessageLoader</a> *loader;
<a name="l03866"></a>03866 
<a name="l03867"></a>03867   loader = <a class="code" href="group__DBusMemory.html#gaba9d823abda7f4cadbaf5177d3b8b793" title="Safe macro for using dbus_malloc0().">dbus_new0</a> (<a class="code" href="structDBusMessageLoader.html" title="Implementation details of DBusMessageLoader.">DBusMessageLoader</a>, 1);
<a name="l03868"></a>03868   <span class="keywordflow">if</span> (loader == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l03869"></a>03869     <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="l03870"></a>03870   
<a name="l03871"></a>03871   loader-&gt;<a class="code" href="structDBusMessageLoader.html#af3372b7d574dab49a7435d8f29ea2258" title="Reference count.">refcount</a> = 1;
<a name="l03872"></a>03872 
<a name="l03873"></a>03873   loader-&gt;<a class="code" href="structDBusMessageLoader.html#a7af27694794dc471ed3b251da8d7c62e" title="We got broken data, and are no longer working.">corrupted</a> = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l03874"></a>03874   loader-&gt;<a class="code" href="structDBusMessageLoader.html#ac6116f8620094b8ce348b103483c0035" title="why we were corrupted">corruption_reason</a> = DBUS_VALID;
<a name="l03875"></a>03875 
<a name="l03876"></a>03876   <span class="comment">/* this can be configured by the app, but defaults to the protocol max */</span>
<a name="l03877"></a>03877   loader-&gt;<a class="code" href="structDBusMessageLoader.html#a174d67695b3aca6ee3bb8e1e5e033334" title="Maximum size of a message.">max_message_size</a> = <a class="code" href="group__DBusProtocol.html#ga2874c299e1c87fe745ef09bf231264e9" title="The maximum total message size including header and body; similar rationale to max array size...">DBUS_MAXIMUM_MESSAGE_LENGTH</a>;
<a name="l03878"></a>03878 
<a name="l03879"></a>03879   <span class="comment">/* We set a very relatively conservative default here since due to how</span>
<a name="l03880"></a>03880 <span class="comment">  SCM_RIGHTS works we need to preallocate an fd array of the maximum</span>
<a name="l03881"></a>03881 <span class="comment">  number of unix fds we want to receive in advance. A</span>
<a name="l03882"></a>03882 <span class="comment">  try-and-reallocate loop is not possible. */</span>
<a name="l03883"></a>03883   loader-&gt;<a class="code" href="structDBusMessageLoader.html#a2134a617c0d631d946adee1f08443851" title="Maximum unix fds in a message.">max_message_unix_fds</a> = DBUS_DEFAULT_MESSAGE_UNIX_FDS;
<a name="l03884"></a>03884 
<a name="l03885"></a>03885   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusString.html#ga348252317f7bb8ac43529972945830ae" title="Initializes a string.">_dbus_string_init</a> (&amp;loader-&gt;<a class="code" href="structDBusMessageLoader.html#a33c22d4f64a32a72faefb1df94fcfed1" title="Buffered data.">data</a>))
<a name="l03886"></a>03886     {
<a name="l03887"></a>03887       <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> (loader);
<a name="l03888"></a>03888       <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="l03889"></a>03889     }
<a name="l03890"></a>03890 
<a name="l03891"></a>03891   <span class="comment">/* preallocate the buffer for speed, ignore failure */</span>
<a name="l03892"></a>03892   <a class="code" href="group__DBusString.html#ga08c423b93c28dd746dcb93e0461ab95c" title="Sets the length of a string.">_dbus_string_set_length</a> (&amp;loader-&gt;<a class="code" href="structDBusMessageLoader.html#a33c22d4f64a32a72faefb1df94fcfed1" title="Buffered data.">data</a>, <a class="code" href="group__DBusMessageInternals.html#gacbe0bfe7a9551ab0489a0ec9aba6e94e" title="The initial buffer size of the message loader.">INITIAL_LOADER_DATA_LEN</a>);
<a name="l03893"></a>03893   <a class="code" href="group__DBusString.html#ga08c423b93c28dd746dcb93e0461ab95c" title="Sets the length of a string.">_dbus_string_set_length</a> (&amp;loader-&gt;<a class="code" href="structDBusMessageLoader.html#a33c22d4f64a32a72faefb1df94fcfed1" title="Buffered data.">data</a>, 0);
<a name="l03894"></a>03894 
<a name="l03895"></a>03895 <span class="preprocessor">#ifdef HAVE_UNIX_FD_PASSING</span>
<a name="l03896"></a>03896 <span class="preprocessor"></span>  loader-&gt;unix_fds = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l03897"></a>03897   loader-&gt;n_unix_fds = loader-&gt;n_unix_fds_allocated = 0;
<a name="l03898"></a>03898   loader-&gt;unix_fds_outstanding = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l03899"></a>03899 <span class="preprocessor">#endif</span>
<a name="l03900"></a>03900 <span class="preprocessor"></span>
<a name="l03901"></a>03901   <span class="keywordflow">return</span> loader;
<a name="l03902"></a>03902 }
<a name="l03903"></a>03903 
<a name="l03910"></a>03910 <a class="code" href="structDBusMessageLoader.html" title="Implementation details of DBusMessageLoader.">DBusMessageLoader</a> *
<a name="l03911"></a><a class="code" href="group__DBusMessageInternals.html#gad39efb9ff20c7538f12e164a6920edc4">03911</a> <a class="code" href="group__DBusMessageInternals.html#gad39efb9ff20c7538f12e164a6920edc4" title="Increments the reference count of the loader.">_dbus_message_loader_ref</a> (<a class="code" href="structDBusMessageLoader.html" title="Implementation details of DBusMessageLoader.">DBusMessageLoader</a> *loader)
<a name="l03912"></a>03912 {
<a name="l03913"></a>03913   loader-&gt;<a class="code" href="structDBusMessageLoader.html#af3372b7d574dab49a7435d8f29ea2258" title="Reference count.">refcount</a> += 1;
<a name="l03914"></a>03914 
<a name="l03915"></a>03915   <span class="keywordflow">return</span> loader;
<a name="l03916"></a>03916 }
<a name="l03917"></a>03917 
<a name="l03924"></a>03924 <span class="keywordtype">void</span>
<a name="l03925"></a><a class="code" href="group__DBusMessageInternals.html#ga51299aab1f5e0b2408ab858d3377b20c">03925</a> <a class="code" href="group__DBusMessageInternals.html#ga51299aab1f5e0b2408ab858d3377b20c" title="Decrements the reference count of the loader and finalizes the loader when the count reaches zero...">_dbus_message_loader_unref</a> (<a class="code" href="structDBusMessageLoader.html" title="Implementation details of DBusMessageLoader.">DBusMessageLoader</a> *loader)
<a name="l03926"></a>03926 {
<a name="l03927"></a>03927   loader-&gt;<a class="code" href="structDBusMessageLoader.html#af3372b7d574dab49a7435d8f29ea2258" title="Reference count.">refcount</a> -= 1;
<a name="l03928"></a>03928   <span class="keywordflow">if</span> (loader-&gt;<a class="code" href="structDBusMessageLoader.html#af3372b7d574dab49a7435d8f29ea2258" title="Reference count.">refcount</a> == 0)
<a name="l03929"></a>03929     {
<a name="l03930"></a>03930 <span class="preprocessor">#ifdef HAVE_UNIX_FD_PASSING</span>
<a name="l03931"></a>03931 <span class="preprocessor"></span>      close_unix_fds(loader-&gt;unix_fds, &amp;loader-&gt;n_unix_fds);
<a name="l03932"></a>03932       <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>(loader-&gt;unix_fds);
<a name="l03933"></a>03933 <span class="preprocessor">#endif</span>
<a name="l03934"></a>03934 <span class="preprocessor"></span>      <a class="code" href="group__DBusList.html#ga8dd69084b53361803a765e6d53d5b9d1" title="Calls the given function for each element in the list.">_dbus_list_foreach</a> (&amp;loader-&gt;<a class="code" href="structDBusMessageLoader.html#a5ad667f9a5b58d23f2089e7cea58f6cc" title="Complete messages.">messages</a>,
<a name="l03935"></a>03935                           (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="l03936"></a>03936                           <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l03937"></a>03937       <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;loader-&gt;<a class="code" href="structDBusMessageLoader.html#a5ad667f9a5b58d23f2089e7cea58f6cc" title="Complete messages.">messages</a>);
<a name="l03938"></a>03938       <a class="code" href="group__DBusString.html#ga781ca91acda49a834dce7d0ed0eef212" title="Frees a string created by _dbus_string_init().">_dbus_string_free</a> (&amp;loader-&gt;<a class="code" href="structDBusMessageLoader.html#a33c22d4f64a32a72faefb1df94fcfed1" title="Buffered data.">data</a>);
<a name="l03939"></a>03939       <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> (loader);
<a name="l03940"></a>03940     }
<a name="l03941"></a>03941 }
<a name="l03942"></a>03942 
<a name="l03961"></a>03961 <span class="keywordtype">void</span>
<a name="l03962"></a><a class="code" href="group__DBusMessageInternals.html#gae77f064b8034189a955d5be982d2fbdb">03962</a> <a class="code" href="group__DBusMessageInternals.html#gae77f064b8034189a955d5be982d2fbdb" title="Gets the buffer to use for reading data from the network.">_dbus_message_loader_get_buffer</a> (<a class="code" href="structDBusMessageLoader.html" title="Implementation details of DBusMessageLoader.">DBusMessageLoader</a>  *loader,
<a name="l03963"></a>03963                                  <a class="code" href="structDBusString.html">DBusString</a>        **buffer)
<a name="l03964"></a>03964 {
<a name="l03965"></a>03965   _dbus_assert (!loader-&gt;<a class="code" href="structDBusMessageLoader.html#a7fe926ecd87e9ddb37e7481195bc3d67" title="Someone is using the buffer to read.">buffer_outstanding</a>);
<a name="l03966"></a>03966 
<a name="l03967"></a>03967   *buffer = &amp;loader-&gt;<a class="code" href="structDBusMessageLoader.html#a33c22d4f64a32a72faefb1df94fcfed1" title="Buffered data.">data</a>;
<a name="l03968"></a>03968 
<a name="l03969"></a>03969   loader-&gt;<a class="code" href="structDBusMessageLoader.html#a7fe926ecd87e9ddb37e7481195bc3d67" title="Someone is using the buffer to read.">buffer_outstanding</a> = <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l03970"></a>03970 }
<a name="l03971"></a>03971 
<a name="l03981"></a>03981 <span class="keywordtype">void</span>
<a name="l03982"></a><a class="code" href="group__DBusMessageInternals.html#gaf5cb6398adb9fe39560fe6aef69ebb09">03982</a> <a class="code" href="group__DBusMessageInternals.html#gaf5cb6398adb9fe39560fe6aef69ebb09" title="Returns a buffer obtained from _dbus_message_loader_get_buffer(), indicating to the loader how many b...">_dbus_message_loader_return_buffer</a> (<a class="code" href="structDBusMessageLoader.html" title="Implementation details of DBusMessageLoader.">DBusMessageLoader</a>  *loader,
<a name="l03983"></a>03983                                     <a class="code" href="structDBusString.html">DBusString</a>         *buffer)
<a name="l03984"></a>03984 {
<a name="l03985"></a>03985   _dbus_assert (loader-&gt;<a class="code" href="structDBusMessageLoader.html#a7fe926ecd87e9ddb37e7481195bc3d67" title="Someone is using the buffer to read.">buffer_outstanding</a>);
<a name="l03986"></a>03986   _dbus_assert (buffer == &amp;loader-&gt;<a class="code" href="structDBusMessageLoader.html#a33c22d4f64a32a72faefb1df94fcfed1" title="Buffered data.">data</a>);
<a name="l03987"></a>03987 
<a name="l03988"></a>03988   loader-&gt;<a class="code" href="structDBusMessageLoader.html#a7fe926ecd87e9ddb37e7481195bc3d67" title="Someone is using the buffer to read.">buffer_outstanding</a> = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l03989"></a>03989 }
<a name="l03990"></a>03990 
<a name="l04001"></a>04001 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l04002"></a><a class="code" href="group__DBusMessageInternals.html#ga4ed7327f9dee98711ebd7c9e5b74dec0">04002</a> <a class="code" href="group__DBusMessageInternals.html#ga4ed7327f9dee98711ebd7c9e5b74dec0" title="Gets the buffer to use for reading unix fds from the network.">_dbus_message_loader_get_unix_fds</a>(<a class="code" href="structDBusMessageLoader.html" title="Implementation details of DBusMessageLoader.">DBusMessageLoader</a>  *loader,
<a name="l04003"></a>04003                                   <span class="keywordtype">int</span>               **fds,
<a name="l04004"></a>04004                                   <span class="keywordtype">unsigned</span>           *max_n_fds)
<a name="l04005"></a>04005 {
<a name="l04006"></a>04006 <span class="preprocessor">#ifdef HAVE_UNIX_FD_PASSING</span>
<a name="l04007"></a>04007 <span class="preprocessor"></span>  _dbus_assert (!loader-&gt;unix_fds_outstanding);
<a name="l04008"></a>04008 
<a name="l04009"></a>04009   <span class="comment">/* Allocate space where we can put the fds we read. We allocate</span>
<a name="l04010"></a>04010 <span class="comment">     space for max_message_unix_fds since this is an</span>
<a name="l04011"></a>04011 <span class="comment">     upper limit how many fds can be received within a single</span>
<a name="l04012"></a>04012 <span class="comment">     message. Since SCM_RIGHTS doesn&#39;t allow a reallocate+retry logic</span>
<a name="l04013"></a>04013 <span class="comment">     we are allocating the maximum possible array size right from the</span>
<a name="l04014"></a>04014 <span class="comment">     beginning. This sucks a bit, however unless SCM_RIGHTS is fixed</span>
<a name="l04015"></a>04015 <span class="comment">     there is no better way. */</span>
<a name="l04016"></a>04016 
<a name="l04017"></a>04017   <span class="keywordflow">if</span> (loader-&gt;n_unix_fds_allocated &lt; loader-&gt;<a class="code" href="structDBusMessageLoader.html#a2134a617c0d631d946adee1f08443851" title="Maximum unix fds in a message.">max_message_unix_fds</a>)
<a name="l04018"></a>04018     {
<a name="l04019"></a>04019       <span class="keywordtype">int</span> *a = <a class="code" href="group__DBusMemory.html#ga2d505f2960ccf343042d363170b27f9c" title="Resizes a block of memory previously allocated by dbus_malloc() or dbus_malloc0().">dbus_realloc</a>(loader-&gt;unix_fds,
<a name="l04020"></a>04020                             loader-&gt;<a class="code" href="structDBusMessageLoader.html#a2134a617c0d631d946adee1f08443851" title="Maximum unix fds in a message.">max_message_unix_fds</a> * <span class="keyword">sizeof</span>(loader-&gt;unix_fds[0]));
<a name="l04021"></a>04021 
<a name="l04022"></a>04022       <span class="keywordflow">if</span> (!a)
<a name="l04023"></a>04023         <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l04024"></a>04024 
<a name="l04025"></a>04025       loader-&gt;unix_fds = a;
<a name="l04026"></a>04026       loader-&gt;n_unix_fds_allocated = loader-&gt;<a class="code" href="structDBusMessageLoader.html#a2134a617c0d631d946adee1f08443851" title="Maximum unix fds in a message.">max_message_unix_fds</a>;
<a name="l04027"></a>04027     }
<a name="l04028"></a>04028 
<a name="l04029"></a>04029   *fds = loader-&gt;unix_fds + loader-&gt;n_unix_fds;
<a name="l04030"></a>04030   *max_n_fds = loader-&gt;n_unix_fds_allocated - loader-&gt;n_unix_fds;
<a name="l04031"></a>04031 
<a name="l04032"></a>04032   loader-&gt;unix_fds_outstanding = <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l04033"></a>04033   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l04034"></a>04034 <span class="preprocessor">#else</span>
<a name="l04035"></a>04035 <span class="preprocessor"></span>  _dbus_assert_not_reached(<span class="stringliteral">&quot;Platform doesn&#39;t support unix fd passing&quot;</span>);
<a name="l04036"></a>04036   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l04037"></a>04037 <span class="preprocessor">#endif</span>
<a name="l04038"></a>04038 <span class="preprocessor"></span>}
<a name="l04039"></a>04039 
<a name="l04050"></a>04050 <span class="keywordtype">void</span>
<a name="l04051"></a><a class="code" href="group__DBusMessageInternals.html#ga2bf4dd7eda1a539454486e127b75d7c3">04051</a> <a class="code" href="group__DBusMessageInternals.html#ga2bf4dd7eda1a539454486e127b75d7c3" title="Returns a buffer obtained from _dbus_message_loader_get_unix_fds().">_dbus_message_loader_return_unix_fds</a>(<a class="code" href="structDBusMessageLoader.html" title="Implementation details of DBusMessageLoader.">DBusMessageLoader</a>  *loader,
<a name="l04052"></a>04052                                      <span class="keywordtype">int</span>                *fds,
<a name="l04053"></a>04053                                      <span class="keywordtype">unsigned</span>            n_fds)
<a name="l04054"></a>04054 {
<a name="l04055"></a>04055 <span class="preprocessor">#ifdef HAVE_UNIX_FD_PASSING</span>
<a name="l04056"></a>04056 <span class="preprocessor"></span>  _dbus_assert(loader-&gt;unix_fds_outstanding);
<a name="l04057"></a>04057   _dbus_assert(loader-&gt;unix_fds + loader-&gt;n_unix_fds == fds);
<a name="l04058"></a>04058   _dbus_assert(loader-&gt;n_unix_fds + n_fds &lt;= loader-&gt;n_unix_fds_allocated);
<a name="l04059"></a>04059 
<a name="l04060"></a>04060   loader-&gt;n_unix_fds += n_fds;
<a name="l04061"></a>04061   loader-&gt;unix_fds_outstanding = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l04062"></a>04062 
<a name="l04063"></a>04063   <span class="keywordflow">if</span> (n_fds &amp;&amp; loader-&gt;unix_fds_change)
<a name="l04064"></a>04064     loader-&gt;unix_fds_change (loader-&gt;unix_fds_change_data);
<a name="l04065"></a>04065 <span class="preprocessor">#else</span>
<a name="l04066"></a>04066 <span class="preprocessor"></span>  _dbus_assert_not_reached(<span class="stringliteral">&quot;Platform doesn&#39;t support unix fd passing&quot;</span>);
<a name="l04067"></a>04067 <span class="preprocessor">#endif</span>
<a name="l04068"></a>04068 <span class="preprocessor"></span>}
<a name="l04069"></a>04069 
<a name="l04070"></a>04070 <span class="comment">/*</span>
<a name="l04071"></a>04071 <span class="comment"> * FIXME when we move the header out of the buffer, that memmoves all</span>
<a name="l04072"></a>04072 <span class="comment"> * buffered messages. Kind of crappy.</span>
<a name="l04073"></a>04073 <span class="comment"> *</span>
<a name="l04074"></a>04074 <span class="comment"> * Also we copy the header and body, which is kind of crappy.  To</span>
<a name="l04075"></a>04075 <span class="comment"> * avoid this, we have to allow header and body to be in a single</span>
<a name="l04076"></a>04076 <span class="comment"> * memory block, which is good for messages we read and bad for</span>
<a name="l04077"></a>04077 <span class="comment"> * messages we are creating. But we could move_len() the buffer into</span>
<a name="l04078"></a>04078 <span class="comment"> * this single memory block, and move_len() will just swap the buffers</span>
<a name="l04079"></a>04079 <span class="comment"> * if you&#39;re moving the entire buffer replacing the dest string.</span>
<a name="l04080"></a>04080 <span class="comment"> *</span>
<a name="l04081"></a>04081 <span class="comment"> * We could also have the message loader tell the transport how many</span>
<a name="l04082"></a>04082 <span class="comment"> * bytes to read; so it would first ask for some arbitrary number like</span>
<a name="l04083"></a>04083 <span class="comment"> * 256, then if the message was incomplete it would use the</span>
<a name="l04084"></a>04084 <span class="comment"> * header/body len to ask for exactly the size of the message (or</span>
<a name="l04085"></a>04085 <span class="comment"> * blocks the size of a typical kernel buffer for the socket). That</span>
<a name="l04086"></a>04086 <span class="comment"> * way we don&#39;t get trailing bytes in the buffer that have to be</span>
<a name="l04087"></a>04087 <span class="comment"> * memmoved. Though I suppose we also don&#39;t have a chance of reading a</span>
<a name="l04088"></a>04088 <span class="comment"> * bunch of small messages at once, so the optimization may be stupid.</span>
<a name="l04089"></a>04089 <span class="comment"> *</span>
<a name="l04090"></a>04090 <span class="comment"> * Another approach would be to keep a &quot;start&quot; index into</span>
<a name="l04091"></a>04091 <span class="comment"> * loader-&gt;data and only delete it occasionally, instead of after</span>
<a name="l04092"></a>04092 <span class="comment"> * each message is loaded.</span>
<a name="l04093"></a>04093 <span class="comment"> *</span>
<a name="l04094"></a>04094 <span class="comment"> * load_message() returns FALSE if not enough memory OR the loader was corrupted</span>
<a name="l04095"></a>04095 <span class="comment"> */</span>
<a name="l04096"></a>04096 <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="l04097"></a>04097 load_message (<a class="code" href="structDBusMessageLoader.html" title="Implementation details of DBusMessageLoader.">DBusMessageLoader</a> *loader,
<a name="l04098"></a>04098               <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>       *message,
<a name="l04099"></a>04099               <span class="keywordtype">int</span>                byte_order,
<a name="l04100"></a>04100               <span class="keywordtype">int</span>                fields_array_len,
<a name="l04101"></a>04101               <span class="keywordtype">int</span>                header_len,
<a name="l04102"></a>04102               <span class="keywordtype">int</span>                body_len)
<a name="l04103"></a>04103 {
<a name="l04104"></a>04104   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> oom;
<a name="l04105"></a>04105   <a class="code" href="group__DBusMarshal.html#ga0c4521d30d6650a33673a4d7f9cc007c" title="This is primarily used in unit testing, so we can verify that each invalid message is invalid for the...">DBusValidity</a> validity;
<a name="l04106"></a>04106   <span class="keyword">const</span> <a class="code" href="structDBusString.html">DBusString</a> *type_str;
<a name="l04107"></a>04107   <span class="keywordtype">int</span> type_pos;
<a name="l04108"></a>04108   <a class="code" href="group__DBusMarshal.html#gaf9dce059725fa793c44b219460cbbe6d" title="This is used rather than a bool for high visibility.">DBusValidationMode</a> mode;
<a name="l04109"></a>04109   <a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a> n_unix_fds = 0;
<a name="l04110"></a>04110 
<a name="l04111"></a>04111   mode = DBUS_VALIDATION_MODE_DATA_IS_UNTRUSTED;
<a name="l04112"></a>04112   
<a name="l04113"></a>04113   oom = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l04114"></a>04114 
<a name="l04115"></a>04115 <span class="preprocessor">#if 0</span>
<a name="l04116"></a>04116 <span class="preprocessor"></span>  <a class="code" href="group__DBusMarshal.html#ga3926bb35edf78d114cf0c341fe3258e0" title="Dump the given part of the string to verbose log.">_dbus_verbose_bytes_of_string</a> (&amp;loader-&gt;<a class="code" href="structDBusMessageLoader.html#a33c22d4f64a32a72faefb1df94fcfed1" title="Buffered data.">data</a>, 0, header_len <span class="comment">/* + body_len */</span>);
<a name="l04117"></a>04117 <span class="preprocessor">#endif</span>
<a name="l04118"></a>04118 <span class="preprocessor"></span>
<a name="l04119"></a>04119   <span class="comment">/* 1. VALIDATE AND COPY OVER HEADER */</span>
<a name="l04120"></a>04120   _dbus_assert (<a class="code" href="group__DBusString.html#gaa5136e6fd2c5188f4b88de7863369c6d" title="Gets the length of a string (not including nul termination).">_dbus_string_get_length</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>.<a class="code" href="structDBusHeader.html#a67df8bff43c10e2d4f6ae36b56ee5814" title="Header network data, stored separately from body so we can independently realloc it.">data</a>) == 0);
<a name="l04121"></a>04121   _dbus_assert ((header_len + body_len) &lt;= <a class="code" href="group__DBusString.html#gaa5136e6fd2c5188f4b88de7863369c6d" title="Gets the length of a string (not including nul termination).">_dbus_string_get_length</a> (&amp;loader-&gt;<a class="code" href="structDBusMessageLoader.html#a33c22d4f64a32a72faefb1df94fcfed1" title="Buffered data.">data</a>));
<a name="l04122"></a>04122 
<a name="l04123"></a>04123   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusMarshal.html#ga0c3a3f95d9a53b91a0cd0b260196685b" title="Creates a message header from potentially-untrusted data.">_dbus_header_load</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>,
<a name="l04124"></a>04124                           mode,
<a name="l04125"></a>04125                           &amp;validity,
<a name="l04126"></a>04126                           byte_order,
<a name="l04127"></a>04127                           fields_array_len,
<a name="l04128"></a>04128                           header_len,
<a name="l04129"></a>04129                           body_len,
<a name="l04130"></a>04130                           &amp;loader-&gt;<a class="code" href="structDBusMessageLoader.html#a33c22d4f64a32a72faefb1df94fcfed1" title="Buffered data.">data</a>, 0,
<a name="l04131"></a>04131                           <a class="code" href="group__DBusString.html#gaa5136e6fd2c5188f4b88de7863369c6d" title="Gets the length of a string (not including nul termination).">_dbus_string_get_length</a> (&amp;loader-&gt;<a class="code" href="structDBusMessageLoader.html#a33c22d4f64a32a72faefb1df94fcfed1" title="Buffered data.">data</a>)))
<a name="l04132"></a>04132     {
<a name="l04133"></a>04133       _dbus_verbose (<span class="stringliteral">&quot;Failed to load header for new message code %d\n&quot;</span>, validity);
<a name="l04134"></a>04134 
<a name="l04135"></a>04135       <span class="comment">/* assert here so we can catch any code that still uses DBUS_VALID to indicate</span>
<a name="l04136"></a>04136 <span class="comment">         oom errors.  They should use DBUS_VALIDITY_UNKNOWN_OOM_ERROR instead */</span>
<a name="l04137"></a>04137       _dbus_assert (validity != DBUS_VALID);
<a name="l04138"></a>04138 
<a name="l04139"></a>04139       <span class="keywordflow">if</span> (validity == DBUS_VALIDITY_UNKNOWN_OOM_ERROR)
<a name="l04140"></a>04140         oom = <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l04141"></a>04141       <span class="keywordflow">else</span>
<a name="l04142"></a>04142         {
<a name="l04143"></a>04143           loader-&gt;<a class="code" href="structDBusMessageLoader.html#a7af27694794dc471ed3b251da8d7c62e" title="We got broken data, and are no longer working.">corrupted</a> = <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l04144"></a>04144           loader-&gt;<a class="code" href="structDBusMessageLoader.html#ac6116f8620094b8ce348b103483c0035" title="why we were corrupted">corruption_reason</a> = validity;
<a name="l04145"></a>04145         }
<a name="l04146"></a>04146       <span class="keywordflow">goto</span> failed;
<a name="l04147"></a>04147     }
<a name="l04148"></a>04148 
<a name="l04149"></a>04149   _dbus_assert (validity == DBUS_VALID);
<a name="l04150"></a>04150 
<a name="l04151"></a>04151   <span class="comment">/* 2. VALIDATE BODY */</span>
<a name="l04152"></a>04152   <span class="keywordflow">if</span> (mode != DBUS_VALIDATION_MODE_WE_TRUST_THIS_DATA_ABSOLUTELY)
<a name="l04153"></a>04153     {
<a name="l04154"></a>04154       get_const_signature (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>, &amp;type_str, &amp;type_pos);
<a name="l04155"></a>04155       
<a name="l04156"></a>04156       <span class="comment">/* Because the bytes_remaining arg is NULL, this validates that the</span>
<a name="l04157"></a>04157 <span class="comment">       * body is the right length</span>
<a name="l04158"></a>04158 <span class="comment">       */</span>
<a name="l04159"></a>04159       validity = <a class="code" href="group__DBusMarshal.html#gae997884ec8091aacb5492c2b5a7eaef9" title="Verifies that the range of value_str from value_pos to value_end is a legitimate value of type expect...">_dbus_validate_body_with_reason</a> (type_str,
<a name="l04160"></a>04160                                                   type_pos,
<a name="l04161"></a>04161                                                   byte_order,
<a name="l04162"></a>04162                                                   <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>,
<a name="l04163"></a>04163                                                   &amp;loader-&gt;<a class="code" href="structDBusMessageLoader.html#a33c22d4f64a32a72faefb1df94fcfed1" title="Buffered data.">data</a>,
<a name="l04164"></a>04164                                                   header_len,
<a name="l04165"></a>04165                                                   body_len);
<a name="l04166"></a>04166       <span class="keywordflow">if</span> (validity != DBUS_VALID)
<a name="l04167"></a>04167         {
<a name="l04168"></a>04168           _dbus_verbose (<span class="stringliteral">&quot;Failed to validate message body code %d\n&quot;</span>, validity);
<a name="l04169"></a>04169 
<a name="l04170"></a>04170           loader-&gt;<a class="code" href="structDBusMessageLoader.html#a7af27694794dc471ed3b251da8d7c62e" title="We got broken data, and are no longer working.">corrupted</a> = <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l04171"></a>04171           loader-&gt;<a class="code" href="structDBusMessageLoader.html#ac6116f8620094b8ce348b103483c0035" title="why we were corrupted">corruption_reason</a> = validity;
<a name="l04172"></a>04172           
<a name="l04173"></a>04173           <span class="keywordflow">goto</span> failed;
<a name="l04174"></a>04174         }
<a name="l04175"></a>04175     }
<a name="l04176"></a>04176 
<a name="l04177"></a>04177   <span class="comment">/* 3. COPY OVER UNIX FDS */</span>
<a name="l04178"></a>04178   <a class="code" href="group__DBusMarshal.html#ga499973a18dcb17d854eaf14101a66736" title="Gets the value of a field with basic type.">_dbus_header_get_field_basic</a>(&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>,
<a name="l04179"></a>04179                                <a class="code" href="group__DBusProtocol.html#ga03b9c24acbfd1e3da19804c739612885" title="Header field code for the number of unix file descriptors associated with this message.">DBUS_HEADER_FIELD_UNIX_FDS</a>,
<a name="l04180"></a>04180                                <a class="code" href="group__DBusProtocol.html#gaedb1740bd8a9174b98ac593eded25d49" title="Type code marking a 32-bit unsigned integer.">DBUS_TYPE_UINT32</a>,
<a name="l04181"></a>04181                                &amp;n_unix_fds);
<a name="l04182"></a>04182 
<a name="l04183"></a>04183 <span class="preprocessor">#ifdef HAVE_UNIX_FD_PASSING</span>
<a name="l04184"></a>04184 <span class="preprocessor"></span>
<a name="l04185"></a>04185   <span class="keywordflow">if</span> (n_unix_fds &gt; loader-&gt;n_unix_fds)
<a name="l04186"></a>04186     {
<a name="l04187"></a>04187       _dbus_verbose(<span class="stringliteral">&quot;Message contains references to more unix fds than were sent %u != %u\n&quot;</span>,
<a name="l04188"></a>04188                     n_unix_fds, loader-&gt;n_unix_fds);
<a name="l04189"></a>04189 
<a name="l04190"></a>04190       loader-&gt;<a class="code" href="structDBusMessageLoader.html#a7af27694794dc471ed3b251da8d7c62e" title="We got broken data, and are no longer working.">corrupted</a> = <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l04191"></a>04191       loader-&gt;<a class="code" href="structDBusMessageLoader.html#ac6116f8620094b8ce348b103483c0035" title="why we were corrupted">corruption_reason</a> = DBUS_INVALID_MISSING_UNIX_FDS;
<a name="l04192"></a>04192       <span class="keywordflow">goto</span> failed;
<a name="l04193"></a>04193     }
<a name="l04194"></a>04194 
<a name="l04195"></a>04195   <span class="comment">/* If this was a recycled message there might still be</span>
<a name="l04196"></a>04196 <span class="comment">     some memory allocated for the fds */</span>
<a name="l04197"></a>04197   <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>(message-&gt;unix_fds);
<a name="l04198"></a>04198 
<a name="l04199"></a>04199   <span class="keywordflow">if</span> (n_unix_fds &gt; 0)
<a name="l04200"></a>04200     {
<a name="l04201"></a>04201       message-&gt;unix_fds = <a class="code" href="group__DBusInternalsUtils.html#gaad95864dca5140b730bc143cb2d1b024" title="Duplicates a block of memory.">_dbus_memdup</a>(loader-&gt;unix_fds, n_unix_fds * <span class="keyword">sizeof</span>(message-&gt;unix_fds[0]));
<a name="l04202"></a>04202       <span class="keywordflow">if</span> (message-&gt;unix_fds == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l04203"></a>04203         {
<a name="l04204"></a>04204           _dbus_verbose (<span class="stringliteral">&quot;Failed to allocate file descriptor array\n&quot;</span>);
<a name="l04205"></a>04205           oom = <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l04206"></a>04206           <span class="keywordflow">goto</span> failed;
<a name="l04207"></a>04207         }
<a name="l04208"></a>04208 
<a name="l04209"></a>04209       message-&gt;n_unix_fds_allocated = message-&gt;n_unix_fds = n_unix_fds;
<a name="l04210"></a>04210       loader-&gt;n_unix_fds -= n_unix_fds;
<a name="l04211"></a>04211       memmove (loader-&gt;unix_fds, loader-&gt;unix_fds + n_unix_fds, loader-&gt;n_unix_fds * sizeof (loader-&gt;unix_fds[0]));
<a name="l04212"></a>04212 
<a name="l04213"></a>04213       <span class="keywordflow">if</span> (loader-&gt;unix_fds_change)
<a name="l04214"></a>04214         loader-&gt;unix_fds_change (loader-&gt;unix_fds_change_data);
<a name="l04215"></a>04215     }
<a name="l04216"></a>04216   <span class="keywordflow">else</span>
<a name="l04217"></a>04217     message-&gt;unix_fds = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l04218"></a>04218 
<a name="l04219"></a>04219 <span class="preprocessor">#else</span>
<a name="l04220"></a>04220 <span class="preprocessor"></span>
<a name="l04221"></a>04221   <span class="keywordflow">if</span> (n_unix_fds &gt; 0)
<a name="l04222"></a>04222     {
<a name="l04223"></a>04223       _dbus_verbose (<span class="stringliteral">&quot;Hmm, message claims to come with file descriptors &quot;</span>
<a name="l04224"></a>04224                      <span class="stringliteral">&quot;but that&#39;s not supported on our platform, disconnecting.\n&quot;</span>);
<a name="l04225"></a>04225 
<a name="l04226"></a>04226       loader-&gt;<a class="code" href="structDBusMessageLoader.html#a7af27694794dc471ed3b251da8d7c62e" title="We got broken data, and are no longer working.">corrupted</a> = <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l04227"></a>04227       loader-&gt;<a class="code" href="structDBusMessageLoader.html#ac6116f8620094b8ce348b103483c0035" title="why we were corrupted">corruption_reason</a> = DBUS_INVALID_MISSING_UNIX_FDS;
<a name="l04228"></a>04228       <span class="keywordflow">goto</span> failed;
<a name="l04229"></a>04229     }
<a name="l04230"></a>04230 
<a name="l04231"></a>04231 <span class="preprocessor">#endif</span>
<a name="l04232"></a>04232 <span class="preprocessor"></span>
<a name="l04233"></a>04233   <span class="comment">/* 3. COPY OVER BODY AND QUEUE MESSAGE */</span>
<a name="l04234"></a>04234 
<a name="l04235"></a>04235   <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;loader-&gt;<a class="code" href="structDBusMessageLoader.html#a5ad667f9a5b58d23f2089e7cea58f6cc" title="Complete messages.">messages</a>, message))
<a name="l04236"></a>04236     {
<a name="l04237"></a>04237       _dbus_verbose (<span class="stringliteral">&quot;Failed to append new message to loader queue\n&quot;</span>);
<a name="l04238"></a>04238       oom = <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l04239"></a>04239       <span class="keywordflow">goto</span> failed;
<a name="l04240"></a>04240     }
<a name="l04241"></a>04241 
<a name="l04242"></a>04242   _dbus_assert (<a class="code" href="group__DBusString.html#gaa5136e6fd2c5188f4b88de7863369c6d" title="Gets the length of a string (not including nul termination).">_dbus_string_get_length</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a0b9d14d6e0529f0ec2e3c0087fe62a9e" title="Body network data.">body</a>) == 0);
<a name="l04243"></a>04243   _dbus_assert (<a class="code" href="group__DBusString.html#gaa5136e6fd2c5188f4b88de7863369c6d" title="Gets the length of a string (not including nul termination).">_dbus_string_get_length</a> (&amp;loader-&gt;<a class="code" href="structDBusMessageLoader.html#a33c22d4f64a32a72faefb1df94fcfed1" title="Buffered data.">data</a>) &gt;=
<a name="l04244"></a>04244                 (header_len + body_len));
<a name="l04245"></a>04245 
<a name="l04246"></a>04246   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusString.html#gaf5f13bc7ac7a623516930d26ae2589bf" title="Like _dbus_string_copy(), but can copy a segment from the middle of the source string.">_dbus_string_copy_len</a> (&amp;loader-&gt;<a class="code" href="structDBusMessageLoader.html#a33c22d4f64a32a72faefb1df94fcfed1" title="Buffered data.">data</a>, header_len, body_len, &amp;message-&gt;<a class="code" href="structDBusMessage.html#a0b9d14d6e0529f0ec2e3c0087fe62a9e" title="Body network data.">body</a>, 0))
<a name="l04247"></a>04247     {
<a name="l04248"></a>04248       _dbus_verbose (<span class="stringliteral">&quot;Failed to move body into new message\n&quot;</span>);
<a name="l04249"></a>04249       oom = <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l04250"></a>04250       <span class="keywordflow">goto</span> failed;
<a name="l04251"></a>04251     }
<a name="l04252"></a>04252 
<a name="l04253"></a>04253   <a class="code" href="group__DBusString.html#ga7e0e164ad5bb094e5ccad9edc7ae4235" title="Deletes a segment of a DBusString with length len starting at start.">_dbus_string_delete</a> (&amp;loader-&gt;<a class="code" href="structDBusMessageLoader.html#a33c22d4f64a32a72faefb1df94fcfed1" title="Buffered data.">data</a>, 0, header_len + body_len);
<a name="l04254"></a>04254 
<a name="l04255"></a>04255   <span class="comment">/* don&#39;t waste more than 2k of memory */</span>
<a name="l04256"></a>04256   <a class="code" href="group__DBusString.html#gac49ec5782ca606029c096124b5e43ffc" title="Compacts the string to avoid wasted memory.">_dbus_string_compact</a> (&amp;loader-&gt;<a class="code" href="structDBusMessageLoader.html#a33c22d4f64a32a72faefb1df94fcfed1" title="Buffered data.">data</a>, 2048);
<a name="l04257"></a>04257 
<a name="l04258"></a>04258   _dbus_assert (<a class="code" href="group__DBusString.html#gaa5136e6fd2c5188f4b88de7863369c6d" title="Gets the length of a string (not including nul termination).">_dbus_string_get_length</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>.<a class="code" href="structDBusHeader.html#a67df8bff43c10e2d4f6ae36b56ee5814" title="Header network data, stored separately from body so we can independently realloc it.">data</a>) == header_len);
<a name="l04259"></a>04259   _dbus_assert (<a class="code" href="group__DBusString.html#gaa5136e6fd2c5188f4b88de7863369c6d" title="Gets the length of a string (not including nul termination).">_dbus_string_get_length</a> (&amp;message-&gt;<a class="code" href="structDBusMessage.html#a0b9d14d6e0529f0ec2e3c0087fe62a9e" title="Body network data.">body</a>) == body_len);
<a name="l04260"></a>04260 
<a name="l04261"></a>04261   _dbus_verbose (<span class="stringliteral">&quot;Loaded message %p\n&quot;</span>, message);
<a name="l04262"></a>04262 
<a name="l04263"></a>04263   _dbus_assert (!oom);
<a name="l04264"></a>04264   _dbus_assert (!loader-&gt;<a class="code" href="structDBusMessageLoader.html#a7af27694794dc471ed3b251da8d7c62e" title="We got broken data, and are no longer working.">corrupted</a>);
<a name="l04265"></a>04265   _dbus_assert (loader-&gt;<a class="code" href="structDBusMessageLoader.html#a5ad667f9a5b58d23f2089e7cea58f6cc" title="Complete messages.">messages</a> != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l04266"></a>04266   _dbus_assert (<a class="code" href="group__DBusList.html#ga5929ad5253d2f538158e513e9df3002b" title="Finds a value in the list.">_dbus_list_find_last</a> (&amp;loader-&gt;<a class="code" href="structDBusMessageLoader.html#a5ad667f9a5b58d23f2089e7cea58f6cc" title="Complete messages.">messages</a>, message) != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l04267"></a>04267 
<a name="l04268"></a>04268   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l04269"></a>04269 
<a name="l04270"></a>04270  failed:
<a name="l04271"></a>04271 
<a name="l04272"></a>04272   <span class="comment">/* Clean up */</span>
<a name="l04273"></a>04273 
<a name="l04274"></a>04274   <span class="comment">/* does nothing if the message isn&#39;t in the list */</span>
<a name="l04275"></a>04275   <a class="code" href="group__DBusList.html#gad93f1fc853914144e94fc7a7dc0945aa" title="Removes a value from the list.">_dbus_list_remove_last</a> (&amp;loader-&gt;<a class="code" href="structDBusMessageLoader.html#a5ad667f9a5b58d23f2089e7cea58f6cc" title="Complete messages.">messages</a>, message);
<a name="l04276"></a>04276   
<a name="l04277"></a>04277   <span class="keywordflow">if</span> (oom)
<a name="l04278"></a>04278     _dbus_assert (!loader-&gt;<a class="code" href="structDBusMessageLoader.html#a7af27694794dc471ed3b251da8d7c62e" title="We got broken data, and are no longer working.">corrupted</a>);
<a name="l04279"></a>04279   <span class="keywordflow">else</span>
<a name="l04280"></a>04280     _dbus_assert (loader-&gt;<a class="code" href="structDBusMessageLoader.html#a7af27694794dc471ed3b251da8d7c62e" title="We got broken data, and are no longer working.">corrupted</a>);
<a name="l04281"></a>04281 
<a name="l04282"></a>04282   <a class="code" href="group__DBusMarshal.html#ga3926bb35edf78d114cf0c341fe3258e0" title="Dump the given part of the string to verbose log.">_dbus_verbose_bytes_of_string</a> (&amp;loader-&gt;<a class="code" href="structDBusMessageLoader.html#a33c22d4f64a32a72faefb1df94fcfed1" title="Buffered data.">data</a>, 0, <a class="code" href="group__DBusString.html#gaa5136e6fd2c5188f4b88de7863369c6d" title="Gets the length of a string (not including nul termination).">_dbus_string_get_length</a> (&amp;loader-&gt;<a class="code" href="structDBusMessageLoader.html#a33c22d4f64a32a72faefb1df94fcfed1" title="Buffered data.">data</a>));
<a name="l04283"></a>04283 
<a name="l04284"></a>04284   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l04285"></a>04285 }
<a name="l04286"></a>04286 
<a name="l04301"></a>04301 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l04302"></a><a class="code" href="group__DBusMessageInternals.html#gaf55885371a6d022ec94c79bd7138923f">04302</a> <a class="code" href="group__DBusMessageInternals.html#gaf55885371a6d022ec94c79bd7138923f" title="Converts buffered data into messages, if we have enough data.">_dbus_message_loader_queue_messages</a> (<a class="code" href="structDBusMessageLoader.html" title="Implementation details of DBusMessageLoader.">DBusMessageLoader</a> *loader)
<a name="l04303"></a>04303 {
<a name="l04304"></a>04304   <span class="keywordflow">while</span> (!loader-&gt;<a class="code" href="structDBusMessageLoader.html#a7af27694794dc471ed3b251da8d7c62e" title="We got broken data, and are no longer working.">corrupted</a> &amp;&amp;
<a name="l04305"></a>04305          <a class="code" href="group__DBusString.html#gaa5136e6fd2c5188f4b88de7863369c6d" title="Gets the length of a string (not including nul termination).">_dbus_string_get_length</a> (&amp;loader-&gt;<a class="code" href="structDBusMessageLoader.html#a33c22d4f64a32a72faefb1df94fcfed1" title="Buffered data.">data</a>) &gt;= <a class="code" href="group__DBusProtocol.html#gaf8c13dd883c21b5dea179d77d8ac12e3" title="The smallest header size that can occur.">DBUS_MINIMUM_HEADER_SIZE</a>)
<a name="l04306"></a>04306     {
<a name="l04307"></a>04307       <a class="code" href="group__DBusMarshal.html#ga0c4521d30d6650a33673a4d7f9cc007c" title="This is primarily used in unit testing, so we can verify that each invalid message is invalid for the...">DBusValidity</a> validity;
<a name="l04308"></a>04308       <span class="keywordtype">int</span> byte_order, fields_array_len, header_len, body_len;
<a name="l04309"></a>04309 
<a name="l04310"></a>04310       <span class="keywordflow">if</span> (<a class="code" href="group__DBusMarshal.html#ga674d74081baf6e7531e0d4a286724210" title="Given data long enough to contain the length of the message body and the fields array, check whether the data is long enough to contain the entire message (assuming the claimed lengths are accurate).">_dbus_header_have_message_untrusted</a> (loader-&gt;<a class="code" href="structDBusMessageLoader.html#a174d67695b3aca6ee3bb8e1e5e033334" title="Maximum size of a message.">max_message_size</a>,
<a name="l04311"></a>04311                                                &amp;validity,
<a name="l04312"></a>04312                                                &amp;byte_order,
<a name="l04313"></a>04313                                                &amp;fields_array_len,
<a name="l04314"></a>04314                                                &amp;header_len,
<a name="l04315"></a>04315                                                &amp;body_len,
<a name="l04316"></a>04316                                                &amp;loader-&gt;<a class="code" href="structDBusMessageLoader.html#a33c22d4f64a32a72faefb1df94fcfed1" title="Buffered data.">data</a>, 0,
<a name="l04317"></a>04317                                                <a class="code" href="group__DBusString.html#gaa5136e6fd2c5188f4b88de7863369c6d" title="Gets the length of a string (not including nul termination).">_dbus_string_get_length</a> (&amp;loader-&gt;<a class="code" href="structDBusMessageLoader.html#a33c22d4f64a32a72faefb1df94fcfed1" title="Buffered data.">data</a>)))
<a name="l04318"></a>04318         {
<a name="l04319"></a>04319           <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message;
<a name="l04320"></a>04320 
<a name="l04321"></a>04321           _dbus_assert (validity == DBUS_VALID);
<a name="l04322"></a>04322 
<a name="l04323"></a>04323           message = dbus_message_new_empty_header ();
<a name="l04324"></a>04324           <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="l04325"></a>04325             <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l04326"></a>04326 
<a name="l04327"></a>04327           <span class="keywordflow">if</span> (!load_message (loader, message,
<a name="l04328"></a>04328                              byte_order, fields_array_len,
<a name="l04329"></a>04329                              header_len, body_len))
<a name="l04330"></a>04330             {
<a name="l04331"></a>04331               <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="l04332"></a>04332               <span class="comment">/* load_message() returns false if corrupted or OOM; if</span>
<a name="l04333"></a>04333 <span class="comment">               * corrupted then return TRUE for not OOM</span>
<a name="l04334"></a>04334 <span class="comment">               */</span>
<a name="l04335"></a>04335               <span class="keywordflow">return</span> loader-&gt;<a class="code" href="structDBusMessageLoader.html#a7af27694794dc471ed3b251da8d7c62e" title="We got broken data, and are no longer working.">corrupted</a>;
<a name="l04336"></a>04336             }
<a name="l04337"></a>04337 
<a name="l04338"></a>04338           _dbus_assert (loader-&gt;<a class="code" href="structDBusMessageLoader.html#a5ad667f9a5b58d23f2089e7cea58f6cc" title="Complete messages.">messages</a> != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l04339"></a>04339           _dbus_assert (<a class="code" href="group__DBusList.html#ga5929ad5253d2f538158e513e9df3002b" title="Finds a value in the list.">_dbus_list_find_last</a> (&amp;loader-&gt;<a class="code" href="structDBusMessageLoader.html#a5ad667f9a5b58d23f2089e7cea58f6cc" title="Complete messages.">messages</a>, message) != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l04340"></a>04340         }
<a name="l04341"></a>04341       <span class="keywordflow">else</span>
<a name="l04342"></a>04342         {
<a name="l04343"></a>04343           _dbus_verbose (<span class="stringliteral">&quot;Initial peek at header says we don&#39;t have a whole message yet, or data broken with invalid code %d\n&quot;</span>,
<a name="l04344"></a>04344                          validity);
<a name="l04345"></a>04345           <span class="keywordflow">if</span> (validity != DBUS_VALID)
<a name="l04346"></a>04346             {
<a name="l04347"></a>04347               loader-&gt;<a class="code" href="structDBusMessageLoader.html#a7af27694794dc471ed3b251da8d7c62e" title="We got broken data, and are no longer working.">corrupted</a> = <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l04348"></a>04348               loader-&gt;<a class="code" href="structDBusMessageLoader.html#ac6116f8620094b8ce348b103483c0035" title="why we were corrupted">corruption_reason</a> = validity;
<a name="l04349"></a>04349             }
<a name="l04350"></a>04350           <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l04351"></a>04351         }
<a name="l04352"></a>04352     }
<a name="l04353"></a>04353 
<a name="l04354"></a>04354   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l04355"></a>04355 }
<a name="l04356"></a>04356 
<a name="l04364"></a>04364 <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>*
<a name="l04365"></a><a class="code" href="group__DBusMessageInternals.html#ga66674354acdd09ca6e11d600b34bdd5f">04365</a> <a class="code" href="group__DBusMessageInternals.html#ga66674354acdd09ca6e11d600b34bdd5f" title="Peeks at first loaded message, returns NULL if no messages have been queued.">_dbus_message_loader_peek_message</a> (<a class="code" href="structDBusMessageLoader.html" title="Implementation details of DBusMessageLoader.">DBusMessageLoader</a> *loader)
<a name="l04366"></a>04366 {
<a name="l04367"></a>04367   <span class="keywordflow">if</span> (loader-&gt;<a class="code" href="structDBusMessageLoader.html#a5ad667f9a5b58d23f2089e7cea58f6cc" title="Complete messages.">messages</a>)
<a name="l04368"></a>04368     <span class="keywordflow">return</span> loader-&gt;<a class="code" href="structDBusMessageLoader.html#a5ad667f9a5b58d23f2089e7cea58f6cc" title="Complete messages.">messages</a>-&gt;<a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a>;
<a name="l04369"></a>04369   <span class="keywordflow">else</span>
<a name="l04370"></a>04370     <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="l04371"></a>04371 }
<a name="l04372"></a>04372 
<a name="l04381"></a>04381 <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>*
<a name="l04382"></a><a class="code" href="group__DBusMessageInternals.html#ga9e5e75716d7263d9908d45a60b1b6bdc">04382</a> <a class="code" href="group__DBusMessageInternals.html#ga9e5e75716d7263d9908d45a60b1b6bdc" title="Pops a loaded message (passing ownership of the message to the caller).">_dbus_message_loader_pop_message</a> (<a class="code" href="structDBusMessageLoader.html" title="Implementation details of DBusMessageLoader.">DBusMessageLoader</a> *loader)
<a name="l04383"></a>04383 {
<a name="l04384"></a>04384   <span class="keywordflow">return</span> <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;loader-&gt;<a class="code" href="structDBusMessageLoader.html#a5ad667f9a5b58d23f2089e7cea58f6cc" title="Complete messages.">messages</a>);
<a name="l04385"></a>04385 }
<a name="l04386"></a>04386 
<a name="l04395"></a>04395 <a class="code" href="structDBusList.html" title="A node in a linked list.">DBusList</a>*
<a name="l04396"></a><a class="code" href="group__DBusMessageInternals.html#ga6ec3c1ad57340f717a47d79092122d04">04396</a> <a class="code" href="group__DBusMessageInternals.html#ga6ec3c1ad57340f717a47d79092122d04" title="Pops a loaded message inside a list link (passing ownership of the message and link to the caller)...">_dbus_message_loader_pop_message_link</a> (<a class="code" href="structDBusMessageLoader.html" title="Implementation details of DBusMessageLoader.">DBusMessageLoader</a> *loader)
<a name="l04397"></a>04397 {
<a name="l04398"></a>04398   <span class="keywordflow">return</span> <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;loader-&gt;<a class="code" href="structDBusMessageLoader.html#a5ad667f9a5b58d23f2089e7cea58f6cc" title="Complete messages.">messages</a>);
<a name="l04399"></a>04399 }
<a name="l04400"></a>04400 
<a name="l04407"></a>04407 <span class="keywordtype">void</span>
<a name="l04408"></a><a class="code" href="group__DBusMessageInternals.html#ga71b290eb470a55217971fcd6851fc40c">04408</a> <a class="code" href="group__DBusMessageInternals.html#ga71b290eb470a55217971fcd6851fc40c" title="Returns a popped message link, used to undo a pop.">_dbus_message_loader_putback_message_link</a> (<a class="code" href="structDBusMessageLoader.html" title="Implementation details of DBusMessageLoader.">DBusMessageLoader</a>  *loader,
<a name="l04409"></a>04409                                            <a class="code" href="structDBusList.html" title="A node in a linked list.">DBusList</a>           *link)
<a name="l04410"></a>04410 {
<a name="l04411"></a>04411   <a class="code" href="group__DBusList.html#gab3dd068e3bd8a319c0d12150785050a7" title="Prepends a link to the list.">_dbus_list_prepend_link</a> (&amp;loader-&gt;<a class="code" href="structDBusMessageLoader.html#a5ad667f9a5b58d23f2089e7cea58f6cc" title="Complete messages.">messages</a>, link);
<a name="l04412"></a>04412 }
<a name="l04413"></a>04413 
<a name="l04423"></a>04423 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l04424"></a><a class="code" href="group__DBusMessageInternals.html#ga38da52ac9344b00df530098bdd9a3842">04424</a> <a class="code" href="group__DBusMessageInternals.html#ga38da52ac9344b00df530098bdd9a3842" title="Checks whether the loader is confused due to bad data.">_dbus_message_loader_get_is_corrupted</a> (<a class="code" href="structDBusMessageLoader.html" title="Implementation details of DBusMessageLoader.">DBusMessageLoader</a> *loader)
<a name="l04425"></a>04425 {
<a name="l04426"></a>04426   _dbus_assert ((loader-&gt;<a class="code" href="structDBusMessageLoader.html#a7af27694794dc471ed3b251da8d7c62e" title="We got broken data, and are no longer working.">corrupted</a> &amp;&amp; loader-&gt;<a class="code" href="structDBusMessageLoader.html#ac6116f8620094b8ce348b103483c0035" title="why we were corrupted">corruption_reason</a> != DBUS_VALID) ||
<a name="l04427"></a>04427                 (!loader-&gt;<a class="code" href="structDBusMessageLoader.html#a7af27694794dc471ed3b251da8d7c62e" title="We got broken data, and are no longer working.">corrupted</a> &amp;&amp; loader-&gt;<a class="code" href="structDBusMessageLoader.html#ac6116f8620094b8ce348b103483c0035" title="why we were corrupted">corruption_reason</a> == DBUS_VALID));
<a name="l04428"></a>04428   <span class="keywordflow">return</span> loader-&gt;<a class="code" href="structDBusMessageLoader.html#a7af27694794dc471ed3b251da8d7c62e" title="We got broken data, and are no longer working.">corrupted</a>;
<a name="l04429"></a>04429 }
<a name="l04430"></a>04430 
<a name="l04437"></a>04437 <a class="code" href="group__DBusMarshal.html#ga0c4521d30d6650a33673a4d7f9cc007c" title="This is primarily used in unit testing, so we can verify that each invalid message is invalid for the...">DBusValidity</a>
<a name="l04438"></a><a class="code" href="group__DBusMessageInternals.html#gafb8c42ed5242274586607812ff6fba10">04438</a> <a class="code" href="group__DBusMessageInternals.html#gafb8c42ed5242274586607812ff6fba10" title="Checks what kind of bad data confused the loader.">_dbus_message_loader_get_corruption_reason</a> (<a class="code" href="structDBusMessageLoader.html" title="Implementation details of DBusMessageLoader.">DBusMessageLoader</a> *loader)
<a name="l04439"></a>04439 {
<a name="l04440"></a>04440   _dbus_assert ((loader-&gt;<a class="code" href="structDBusMessageLoader.html#a7af27694794dc471ed3b251da8d7c62e" title="We got broken data, and are no longer working.">corrupted</a> &amp;&amp; loader-&gt;<a class="code" href="structDBusMessageLoader.html#ac6116f8620094b8ce348b103483c0035" title="why we were corrupted">corruption_reason</a> != DBUS_VALID) ||
<a name="l04441"></a>04441                 (!loader-&gt;<a class="code" href="structDBusMessageLoader.html#a7af27694794dc471ed3b251da8d7c62e" title="We got broken data, and are no longer working.">corrupted</a> &amp;&amp; loader-&gt;<a class="code" href="structDBusMessageLoader.html#ac6116f8620094b8ce348b103483c0035" title="why we were corrupted">corruption_reason</a> == DBUS_VALID));
<a name="l04442"></a>04442 
<a name="l04443"></a>04443   <span class="keywordflow">return</span> loader-&gt;<a class="code" href="structDBusMessageLoader.html#ac6116f8620094b8ce348b103483c0035" title="why we were corrupted">corruption_reason</a>;
<a name="l04444"></a>04444 }
<a name="l04445"></a>04445 
<a name="l04452"></a>04452 <span class="keywordtype">void</span>
<a name="l04453"></a><a class="code" href="group__DBusMessageInternals.html#ga031623c6235f98801cab3e53f0a5f757">04453</a> <a class="code" href="group__DBusMessageInternals.html#ga031623c6235f98801cab3e53f0a5f757" title="Sets the maximum size message we allow.">_dbus_message_loader_set_max_message_size</a> (<a class="code" href="structDBusMessageLoader.html" title="Implementation details of DBusMessageLoader.">DBusMessageLoader</a>  *loader,
<a name="l04454"></a>04454                                            <span class="keywordtype">long</span>                size)
<a name="l04455"></a>04455 {
<a name="l04456"></a>04456   <span class="keywordflow">if</span> (size &gt; <a class="code" href="group__DBusProtocol.html#ga2874c299e1c87fe745ef09bf231264e9" title="The maximum total message size including header and body; similar rationale to max array size...">DBUS_MAXIMUM_MESSAGE_LENGTH</a>)
<a name="l04457"></a>04457     {
<a name="l04458"></a>04458       _dbus_verbose (<span class="stringliteral">&quot;clamping requested max message size %ld to %d\n&quot;</span>,
<a name="l04459"></a>04459                      size, <a class="code" href="group__DBusProtocol.html#ga2874c299e1c87fe745ef09bf231264e9" title="The maximum total message size including header and body; similar rationale to max array size...">DBUS_MAXIMUM_MESSAGE_LENGTH</a>);
<a name="l04460"></a>04460       size = <a class="code" href="group__DBusProtocol.html#ga2874c299e1c87fe745ef09bf231264e9" title="The maximum total message size including header and body; similar rationale to max array size...">DBUS_MAXIMUM_MESSAGE_LENGTH</a>;
<a name="l04461"></a>04461     }
<a name="l04462"></a>04462   loader-&gt;<a class="code" href="structDBusMessageLoader.html#a174d67695b3aca6ee3bb8e1e5e033334" title="Maximum size of a message.">max_message_size</a> = size;
<a name="l04463"></a>04463 }
<a name="l04464"></a>04464 
<a name="l04471"></a>04471 <span class="keywordtype">long</span>
<a name="l04472"></a><a class="code" href="group__DBusMessageInternals.html#gadd76a4b7191465f2dcb8e6b56b717961">04472</a> <a class="code" href="group__DBusMessageInternals.html#gadd76a4b7191465f2dcb8e6b56b717961" title="Gets the maximum allowed message size in bytes.">_dbus_message_loader_get_max_message_size</a> (<a class="code" href="structDBusMessageLoader.html" title="Implementation details of DBusMessageLoader.">DBusMessageLoader</a>  *loader)
<a name="l04473"></a>04473 {
<a name="l04474"></a>04474   <span class="keywordflow">return</span> loader-&gt;<a class="code" href="structDBusMessageLoader.html#a174d67695b3aca6ee3bb8e1e5e033334" title="Maximum size of a message.">max_message_size</a>;
<a name="l04475"></a>04475 }
<a name="l04476"></a>04476 
<a name="l04483"></a>04483 <span class="keywordtype">void</span>
<a name="l04484"></a><a class="code" href="group__DBusMessageInternals.html#gadd6c0fa721b4340df936363fbde912dc">04484</a> <a class="code" href="group__DBusMessageInternals.html#gadd6c0fa721b4340df936363fbde912dc" title="Sets the maximum unix fds per message we allow.">_dbus_message_loader_set_max_message_unix_fds</a> (<a class="code" href="structDBusMessageLoader.html" title="Implementation details of DBusMessageLoader.">DBusMessageLoader</a>  *loader,
<a name="l04485"></a>04485                                                <span class="keywordtype">long</span>                n)
<a name="l04486"></a>04486 {
<a name="l04487"></a>04487   <span class="keywordflow">if</span> (n &gt; <a class="code" href="group__DBusProtocol.html#ga2735432928240c083c72a5f5d23ec6a1" title="The maximum total number of unix fds in a message.">DBUS_MAXIMUM_MESSAGE_UNIX_FDS</a>)
<a name="l04488"></a>04488     {
<a name="l04489"></a>04489       _dbus_verbose (<span class="stringliteral">&quot;clamping requested max message unix_fds %ld to %d\n&quot;</span>,
<a name="l04490"></a>04490                      n, <a class="code" href="group__DBusProtocol.html#ga2735432928240c083c72a5f5d23ec6a1" title="The maximum total number of unix fds in a message.">DBUS_MAXIMUM_MESSAGE_UNIX_FDS</a>);
<a name="l04491"></a>04491       n = <a class="code" href="group__DBusProtocol.html#ga2735432928240c083c72a5f5d23ec6a1" title="The maximum total number of unix fds in a message.">DBUS_MAXIMUM_MESSAGE_UNIX_FDS</a>;
<a name="l04492"></a>04492     }
<a name="l04493"></a>04493   loader-&gt;<a class="code" href="structDBusMessageLoader.html#a2134a617c0d631d946adee1f08443851" title="Maximum unix fds in a message.">max_message_unix_fds</a> = n;
<a name="l04494"></a>04494 }
<a name="l04495"></a>04495 
<a name="l04502"></a>04502 <span class="keywordtype">long</span>
<a name="l04503"></a><a class="code" href="group__DBusMessageInternals.html#gaf65867d15c7d8adb91f430c483c180be">04503</a> <a class="code" href="group__DBusMessageInternals.html#gaf65867d15c7d8adb91f430c483c180be" title="Gets the maximum allowed number of unix fds per message.">_dbus_message_loader_get_max_message_unix_fds</a> (<a class="code" href="structDBusMessageLoader.html" title="Implementation details of DBusMessageLoader.">DBusMessageLoader</a>  *loader)
<a name="l04504"></a>04504 {
<a name="l04505"></a>04505   <span class="keywordflow">return</span> loader-&gt;<a class="code" href="structDBusMessageLoader.html#a2134a617c0d631d946adee1f08443851" title="Maximum unix fds in a message.">max_message_unix_fds</a>;
<a name="l04506"></a>04506 }
<a name="l04507"></a>04507 
<a name="l04513"></a>04513 <span class="keywordtype">int</span>
<a name="l04514"></a><a class="code" href="group__DBusMessageInternals.html#ga8e01aad6af940ec4051703f59330da37">04514</a> <a class="code" href="group__DBusMessageInternals.html#ga8e01aad6af940ec4051703f59330da37" title="Return how many file descriptors are pending in the loader.">_dbus_message_loader_get_pending_fds_count</a> (<a class="code" href="structDBusMessageLoader.html" title="Implementation details of DBusMessageLoader.">DBusMessageLoader</a> *loader)
<a name="l04515"></a>04515 {
<a name="l04516"></a>04516 <span class="preprocessor">#ifdef HAVE_UNIX_FD_PASSING</span>
<a name="l04517"></a>04517 <span class="preprocessor"></span>  <span class="keywordflow">return</span> loader-&gt;n_unix_fds;
<a name="l04518"></a>04518 <span class="preprocessor">#else</span>
<a name="l04519"></a>04519 <span class="preprocessor"></span>  <span class="keywordflow">return</span> 0;
<a name="l04520"></a>04520 <span class="preprocessor">#endif</span>
<a name="l04521"></a>04521 <span class="preprocessor"></span>}
<a name="l04522"></a>04522 
<a name="l04531"></a>04531 <span class="keywordtype">void</span>
<a name="l04532"></a><a class="code" href="group__DBusMessageInternals.html#ga658a91d8efc59934016fae6905bfc4bf">04532</a> <a class="code" href="group__DBusMessageInternals.html#ga658a91d8efc59934016fae6905bfc4bf" title="Register a function to be called whenever the number of pending file descriptors in the loader change...">_dbus_message_loader_set_pending_fds_function</a> (<a class="code" href="structDBusMessageLoader.html" title="Implementation details of DBusMessageLoader.">DBusMessageLoader</a> *loader,
<a name="l04533"></a>04533                                                <span class="keywordtype">void</span> (* callback) (<span class="keywordtype">void</span> *),
<a name="l04534"></a>04534                                                <span class="keywordtype">void</span> *data)
<a name="l04535"></a>04535 {
<a name="l04536"></a>04536 <span class="preprocessor">#ifdef HAVE_UNIX_FD_PASSING</span>
<a name="l04537"></a>04537 <span class="preprocessor"></span>  loader-&gt;unix_fds_change = callback;
<a name="l04538"></a>04538   loader-&gt;unix_fds_change_data = data;
<a name="l04539"></a>04539 <span class="preprocessor">#endif</span>
<a name="l04540"></a>04540 <span class="preprocessor"></span>}
<a name="l04541"></a>04541 
<a name="l04542"></a>04542 <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="l04543"></a>04543   _DBUS_DATA_SLOT_ALLOCATOR_INIT (_DBUS_LOCK_NAME (message_slots));
<a name="l04544"></a>04544 
<a name="l04559"></a>04559 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l04560"></a><a class="code" href="group__DBusMessage.html#gafdde8db1152649d37c9f7e316ca59e56">04560</a> <a class="code" href="group__DBusMessageInternals.html#ga537b3456202fdd9f305666504bde98fb" title="Allocates an integer ID to be used for storing application-specific data on any DBusMessage.">dbus_message_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="l04561"></a>04561 {
<a name="l04562"></a>04562   <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="l04563"></a>04563                                           slot_p);
<a name="l04564"></a>04564 }
<a name="l04565"></a>04565 
<a name="l04577"></a>04577 <span class="keywordtype">void</span>
<a name="l04578"></a><a class="code" href="group__DBusMessage.html#ga23227ce2bd5c52d05581d3fe1232ae66">04578</a> <a class="code" href="group__DBusMessageInternals.html#gac7a5ba135e1aec4ad8c7b43752af02e1" title="Deallocates a global ID for message data slots.">dbus_message_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="l04579"></a>04579 {
<a name="l04580"></a>04580   _dbus_return_if_fail (*slot_p &gt;= 0);
<a name="l04581"></a>04581 
<a name="l04582"></a>04582   <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="l04583"></a>04583 }
<a name="l04584"></a>04584 
<a name="l04598"></a>04598 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l04599"></a><a class="code" href="group__DBusMessage.html#ga29331c4e9c2d53cbe60382056f6495a1">04599</a> <a class="code" href="group__DBusMessageInternals.html#ga69d0bc701f9ca935e6de8a3f3e376c0a" title="Stores a pointer on a DBusMessage, along with an optional function to be used for freeing the data wh...">dbus_message_set_data</a> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>     *message,
<a name="l04600"></a>04600                        <a class="code" href="group__DBusTypes.html#gab18afa60e9b17b6e322735bda3d863d8" title="A 32-bit signed integer on all platforms.">dbus_int32_t</a>     slot,
<a name="l04601"></a>04601                        <span class="keywordtype">void</span>            *data,
<a name="l04602"></a>04602                        <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="l04603"></a>04603 {
<a name="l04604"></a>04604   <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="l04605"></a>04605   <span class="keywordtype">void</span> *old_data;
<a name="l04606"></a>04606   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> retval;
<a name="l04607"></a>04607 
<a name="l04608"></a>04608   _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="l04609"></a>04609   _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="l04610"></a>04610 
<a name="l04611"></a>04611   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="l04612"></a>04612                                      &amp;message-&gt;<a class="code" href="structDBusMessage.html#a179c446523c6321e04f88a671363be19" title="Data stored by allocated integer ID.">slot_list</a>,
<a name="l04613"></a>04613                                      slot, data, free_data_func,
<a name="l04614"></a>04614                                      &amp;old_free_func, &amp;old_data);
<a name="l04615"></a>04615 
<a name="l04616"></a>04616   <span class="keywordflow">if</span> (retval)
<a name="l04617"></a>04617     {
<a name="l04618"></a>04618       <span class="comment">/* Do the actual free outside the message lock */</span>
<a name="l04619"></a>04619       <span class="keywordflow">if</span> (old_free_func)
<a name="l04620"></a>04620         (* old_free_func) (old_data);
<a name="l04621"></a>04621     }
<a name="l04622"></a>04622 
<a name="l04623"></a>04623   <span class="keywordflow">return</span> retval;
<a name="l04624"></a>04624 }
<a name="l04625"></a>04625 
<a name="l04634"></a>04634 <span class="keywordtype">void</span>*
<a name="l04635"></a><a class="code" href="group__DBusMessage.html#gabbde522fe2321618ee39df1a028a2ec6">04635</a> <a class="code" href="group__DBusMessageInternals.html#ga62769bfaf8f1b2edc7922c579bc0649d" title="Retrieves data previously set with dbus_message_set_data().">dbus_message_get_data</a> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>   *message,
<a name="l04636"></a>04636                        <a class="code" href="group__DBusTypes.html#gab18afa60e9b17b6e322735bda3d863d8" title="A 32-bit signed integer on all platforms.">dbus_int32_t</a>   slot)
<a name="l04637"></a>04637 {
<a name="l04638"></a>04638   <span class="keywordtype">void</span> *res;
<a name="l04639"></a>04639 
<a name="l04640"></a>04640   _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="l04641"></a>04641 
<a name="l04642"></a>04642   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="l04643"></a>04643                                   &amp;message-&gt;<a class="code" href="structDBusMessage.html#a179c446523c6321e04f88a671363be19" title="Data stored by allocated integer ID.">slot_list</a>,
<a name="l04644"></a>04644                                   slot);
<a name="l04645"></a>04645 
<a name="l04646"></a>04646   <span class="keywordflow">return</span> res;
<a name="l04647"></a>04647 }
<a name="l04648"></a>04648 
<a name="l04662"></a>04662 <span class="keywordtype">int</span>
<a name="l04663"></a><a class="code" href="group__DBusMessage.html#gabc69747028f1e5adedc68f5ffd538c74">04663</a> <a class="code" href="group__DBusMessageInternals.html#ga40412bdfc6ba9cf9e167db4c23df0a7e" title="Utility function to convert a machine-readable (not translated) string into a D-Bus message type...">dbus_message_type_from_string</a> (<span class="keyword">const</span> <span class="keywordtype">char</span> *type_str)
<a name="l04664"></a>04664 {
<a name="l04665"></a>04665   <span class="keywordflow">if</span> (strcmp (type_str, <span class="stringliteral">&quot;method_call&quot;</span>) == 0)
<a name="l04666"></a>04666     <span class="keywordflow">return</span> <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="l04667"></a>04667   <span class="keywordflow">if</span> (strcmp (type_str, <span class="stringliteral">&quot;method_return&quot;</span>) == 0)
<a name="l04668"></a>04668     <span class="keywordflow">return</span> <a class="code" href="group__DBusProtocol.html#ga4a9012edd7f22342f845e98150aeb858" title="Message type of a method return message, see dbus_message_get_type()">DBUS_MESSAGE_TYPE_METHOD_RETURN</a>;
<a name="l04669"></a>04669   <span class="keywordflow">else</span> <span class="keywordflow">if</span> (strcmp (type_str, <span class="stringliteral">&quot;signal&quot;</span>) == 0)
<a name="l04670"></a>04670     <span class="keywordflow">return</span> <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="l04671"></a>04671   <span class="keywordflow">else</span> <span class="keywordflow">if</span> (strcmp (type_str, <span class="stringliteral">&quot;error&quot;</span>) == 0)
<a name="l04672"></a>04672     <span class="keywordflow">return</span> <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="l04673"></a>04673   <span class="keywordflow">else</span>
<a name="l04674"></a>04674     <span class="keywordflow">return</span> <a class="code" href="group__DBusProtocol.html#gac975525a6ce258a7a70c583c9741b516" title="This value is never a valid message type, see dbus_message_get_type()">DBUS_MESSAGE_TYPE_INVALID</a>;
<a name="l04675"></a>04675 }
<a name="l04676"></a>04676 
<a name="l04690"></a>04690 <span class="keyword">const</span> <span class="keywordtype">char</span> *
<a name="l04691"></a><a class="code" href="group__DBusMessage.html#ga13f28b9d8b321baa4536f820a359c092">04691</a> <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> (<span class="keywordtype">int</span> type)
<a name="l04692"></a>04692 {
<a name="l04693"></a>04693   <span class="keywordflow">switch</span> (type)
<a name="l04694"></a>04694     {
<a name="l04695"></a>04695     <span class="keywordflow">case</span> <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="l04696"></a>04696       <span class="keywordflow">return</span> <span class="stringliteral">&quot;method_call&quot;</span>;
<a name="l04697"></a>04697     <span class="keywordflow">case</span> <a class="code" href="group__DBusProtocol.html#ga4a9012edd7f22342f845e98150aeb858" title="Message type of a method return message, see dbus_message_get_type()">DBUS_MESSAGE_TYPE_METHOD_RETURN</a>:
<a name="l04698"></a>04698       <span class="keywordflow">return</span> <span class="stringliteral">&quot;method_return&quot;</span>;
<a name="l04699"></a>04699     <span class="keywordflow">case</span> <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="l04700"></a>04700       <span class="keywordflow">return</span> <span class="stringliteral">&quot;signal&quot;</span>;
<a name="l04701"></a>04701     <span class="keywordflow">case</span> <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="l04702"></a>04702       <span class="keywordflow">return</span> <span class="stringliteral">&quot;error&quot;</span>;
<a name="l04703"></a>04703     <span class="keywordflow">default</span>:
<a name="l04704"></a>04704       <span class="keywordflow">return</span> <span class="stringliteral">&quot;invalid&quot;</span>;
<a name="l04705"></a>04705     }
<a name="l04706"></a>04706 }
<a name="l04707"></a>04707 
<a name="l04720"></a>04720 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l04721"></a><a class="code" href="group__DBusMessage.html#ga3f90a918ada328450fcfe9ac403b8807">04721</a> <a class="code" href="group__DBusMessageInternals.html#gad85c737f9e7d03005d6028d6bbae7e87" title="Turn a DBusMessage into the marshalled form as described in the D-Bus specification.">dbus_message_marshal</a> (<a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a>  *msg,
<a name="l04722"></a>04722                       <span class="keywordtype">char</span>        **marshalled_data_p,
<a name="l04723"></a>04723                       <span class="keywordtype">int</span>          *len_p)
<a name="l04724"></a>04724 {
<a name="l04725"></a>04725   <a class="code" href="structDBusString.html">DBusString</a> tmp;
<a name="l04726"></a>04726   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> was_locked;
<a name="l04727"></a>04727 
<a name="l04728"></a>04728   _dbus_return_val_if_fail (msg != <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="l04729"></a>04729   _dbus_return_val_if_fail (marshalled_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="l04730"></a>04730   _dbus_return_val_if_fail (len_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="l04731"></a>04731   
<a name="l04732"></a>04732   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusString.html#ga348252317f7bb8ac43529972945830ae" title="Initializes a string.">_dbus_string_init</a> (&amp;tmp))
<a name="l04733"></a>04733     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l04734"></a>04734 
<a name="l04735"></a>04735   <span class="comment">/* Ensure the message is locked, to ensure the length header is filled in. */</span>
<a name="l04736"></a>04736   was_locked = msg-&gt;<a class="code" href="structDBusMessage.html#ac926e7027f22608d75a6dfe18680b9e7" title="Message being sent, no modifications allowed.">locked</a>;
<a name="l04737"></a>04737 
<a name="l04738"></a>04738   <span class="keywordflow">if</span> (!was_locked)
<a name="l04739"></a>04739     <a class="code" href="group__DBusMessageInternals.html#ga3ecc9c24381af05289161f477ad6a578" title="Locks a message.">dbus_message_lock</a> (msg);
<a name="l04740"></a>04740 
<a name="l04741"></a>04741   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusString.html#ga3c10f0d1bcaa3b450025b9c6a8b901d7" title="Like _dbus_string_move(), but does not delete the section of the source string that&#39;s copied to the d...">_dbus_string_copy</a> (&amp;(msg-&gt;<a class="code" href="structDBusMessage.html#a00cf6910d9f3bee5d5a82137c8c64a42" title="Header network data and associated cache.">header</a>.<a class="code" href="structDBusHeader.html#a67df8bff43c10e2d4f6ae36b56ee5814" title="Header network data, stored separately from body so we can independently realloc it.">data</a>), 0, &amp;tmp, 0))
<a name="l04742"></a>04742     <span class="keywordflow">goto</span> fail;
<a name="l04743"></a>04743 
<a name="l04744"></a>04744   *len_p = <a class="code" href="group__DBusString.html#gaa5136e6fd2c5188f4b88de7863369c6d" title="Gets the length of a string (not including nul termination).">_dbus_string_get_length</a> (&amp;tmp);
<a name="l04745"></a>04745 
<a name="l04746"></a>04746   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusString.html#ga3c10f0d1bcaa3b450025b9c6a8b901d7" title="Like _dbus_string_move(), but does not delete the section of the source string that&#39;s copied to the d...">_dbus_string_copy</a> (&amp;(msg-&gt;<a class="code" href="structDBusMessage.html#a0b9d14d6e0529f0ec2e3c0087fe62a9e" title="Body network data.">body</a>), 0, &amp;tmp, *len_p))
<a name="l04747"></a>04747     <span class="keywordflow">goto</span> fail;
<a name="l04748"></a>04748 
<a name="l04749"></a>04749   *len_p = <a class="code" href="group__DBusString.html#gaa5136e6fd2c5188f4b88de7863369c6d" title="Gets the length of a string (not including nul termination).">_dbus_string_get_length</a> (&amp;tmp);
<a name="l04750"></a>04750 
<a name="l04751"></a>04751   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusString.html#ga556cc30c3ab032dbc63e217119f0d1f5" title="Like _dbus_string_get_data(), but removes the gotten data from the original string.">_dbus_string_steal_data</a> (&amp;tmp, marshalled_data_p))
<a name="l04752"></a>04752     <span class="keywordflow">goto</span> fail;
<a name="l04753"></a>04753 
<a name="l04754"></a>04754   <a class="code" href="group__DBusString.html#ga781ca91acda49a834dce7d0ed0eef212" title="Frees a string created by _dbus_string_init().">_dbus_string_free</a> (&amp;tmp);
<a name="l04755"></a>04755 
<a name="l04756"></a>04756   <span class="keywordflow">if</span> (!was_locked)
<a name="l04757"></a>04757     msg-&gt;<a class="code" href="structDBusMessage.html#ac926e7027f22608d75a6dfe18680b9e7" title="Message being sent, no modifications allowed.">locked</a> = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l04758"></a>04758 
<a name="l04759"></a>04759   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l04760"></a>04760 
<a name="l04761"></a>04761  fail:
<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;tmp);
<a name="l04763"></a>04763 
<a name="l04764"></a>04764   <span class="keywordflow">if</span> (!was_locked)
<a name="l04765"></a>04765     msg-&gt;<a class="code" href="structDBusMessage.html#ac926e7027f22608d75a6dfe18680b9e7" title="Message being sent, no modifications allowed.">locked</a> = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l04766"></a>04766 
<a name="l04767"></a>04767   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l04768"></a>04768 }
<a name="l04769"></a>04769 
<a name="l04782"></a>04782 <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *
<a name="l04783"></a><a class="code" href="group__DBusMessage.html#ga54242692a860bc712bda120ccee3535f">04783</a> <a class="code" href="group__DBusMessageInternals.html#ga776fe8b5cd935d642875efa1d13a31b3" title="Demarshal a D-Bus message from the format described in the D-Bus specification.">dbus_message_demarshal</a> (<span class="keyword">const</span> <span class="keywordtype">char</span> *str,
<a name="l04784"></a>04784                         <span class="keywordtype">int</span>         len,
<a name="l04785"></a>04785                         <a class="code" href="structDBusError.html" title="Object representing an exception.">DBusError</a>  *error)
<a name="l04786"></a>04786 {
<a name="l04787"></a>04787   <a class="code" href="structDBusMessageLoader.html" title="Implementation details of DBusMessageLoader.">DBusMessageLoader</a> *loader;
<a name="l04788"></a>04788   <a class="code" href="structDBusString.html">DBusString</a> *buffer;
<a name="l04789"></a>04789   <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *msg;
<a name="l04790"></a>04790 
<a name="l04791"></a>04791   _dbus_return_val_if_fail (str != <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="l04792"></a>04792 
<a name="l04793"></a>04793   loader = <a class="code" href="group__DBusMessageInternals.html#ga66f1c10cf909ba09ed732bc125ff8671" title="Creates a new message loader.">_dbus_message_loader_new</a> ();
<a name="l04794"></a>04794 
<a name="l04795"></a>04795   <span class="keywordflow">if</span> (loader == <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="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="l04797"></a>04797 
<a name="l04798"></a>04798   <a class="code" href="group__DBusMessageInternals.html#gae77f064b8034189a955d5be982d2fbdb" title="Gets the buffer to use for reading data from the network.">_dbus_message_loader_get_buffer</a> (loader, &amp;buffer);
<a name="l04799"></a>04799 
<a name="l04800"></a>04800   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusString.html#ga724656b7091b910965bd1af42d0b7bab" title="Appends block of bytes with the given length to a DBusString.">_dbus_string_append_len</a> (buffer, str, len))
<a name="l04801"></a>04801     <span class="keywordflow">goto</span> fail_oom;
<a name="l04802"></a>04802 
<a name="l04803"></a>04803   <a class="code" href="group__DBusMessageInternals.html#gaf5cb6398adb9fe39560fe6aef69ebb09" title="Returns a buffer obtained from _dbus_message_loader_get_buffer(), indicating to the loader how many b...">_dbus_message_loader_return_buffer</a> (loader, buffer);
<a name="l04804"></a>04804 
<a name="l04805"></a>04805   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusMessageInternals.html#gaf55885371a6d022ec94c79bd7138923f" title="Converts buffered data into messages, if we have enough data.">_dbus_message_loader_queue_messages</a> (loader))
<a name="l04806"></a>04806     <span class="keywordflow">goto</span> fail_oom;
<a name="l04807"></a>04807 
<a name="l04808"></a>04808   <span class="keywordflow">if</span> (<a class="code" href="group__DBusMessageInternals.html#ga38da52ac9344b00df530098bdd9a3842" title="Checks whether the loader is confused due to bad data.">_dbus_message_loader_get_is_corrupted</a> (loader))
<a name="l04809"></a>04809     <span class="keywordflow">goto</span> fail_corrupt;
<a name="l04810"></a>04810 
<a name="l04811"></a>04811   msg = <a class="code" href="group__DBusMessageInternals.html#ga9e5e75716d7263d9908d45a60b1b6bdc" title="Pops a loaded message (passing ownership of the message to the caller).">_dbus_message_loader_pop_message</a> (loader);
<a name="l04812"></a>04812 
<a name="l04813"></a>04813   <span class="keywordflow">if</span> (!msg)
<a name="l04814"></a>04814     <span class="keywordflow">goto</span> fail_oom;
<a name="l04815"></a>04815 
<a name="l04816"></a>04816   <a class="code" href="group__DBusMessageInternals.html#ga51299aab1f5e0b2408ab858d3377b20c" title="Decrements the reference count of the loader and finalizes the loader when the count reaches zero...">_dbus_message_loader_unref</a> (loader);
<a name="l04817"></a>04817   <span class="keywordflow">return</span> msg;
<a name="l04818"></a>04818 
<a name="l04819"></a>04819  fail_corrupt:
<a name="l04820"></a>04820   <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#gacf5321b161193ad66d5bdf5c910a9792" title="Invalid arguments passed to a method call.">DBUS_ERROR_INVALID_ARGS</a>, <span class="stringliteral">&quot;Message is corrupted (%s)&quot;</span>,
<a name="l04821"></a>04821                   _dbus_validity_to_error_message (loader-&gt;<a class="code" href="structDBusMessageLoader.html#ac6116f8620094b8ce348b103483c0035" title="why we were corrupted">corruption_reason</a>));
<a name="l04822"></a>04822   <a class="code" href="group__DBusMessageInternals.html#ga51299aab1f5e0b2408ab858d3377b20c" title="Decrements the reference count of the loader and finalizes the loader when the count reaches zero...">_dbus_message_loader_unref</a> (loader);
<a name="l04823"></a>04823   <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="l04824"></a>04824 
<a name="l04825"></a>04825  fail_oom:
<a name="l04826"></a>04826   _DBUS_SET_OOM (error);
<a name="l04827"></a>04827   <a class="code" href="group__DBusMessageInternals.html#ga51299aab1f5e0b2408ab858d3377b20c" title="Decrements the reference count of the loader and finalizes the loader when the count reaches zero...">_dbus_message_loader_unref</a> (loader);
<a name="l04828"></a>04828   <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="l04829"></a>04829 }
<a name="l04830"></a>04830 
<a name="l04843"></a>04843 <span class="keywordtype">int</span> 
<a name="l04844"></a><a class="code" href="group__DBusMessage.html#ga67b26fd2c8e3305f3a467a5f3e36b24a">04844</a> <a class="code" href="group__DBusMessageInternals.html#gab0f8d8a640413e7c9b6c8f154acfbd1a" title="Returns the number of bytes required to be in the buffer to demarshal a D-Bus message.">dbus_message_demarshal_bytes_needed</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *buf, 
<a name="l04845"></a>04845                                     <span class="keywordtype">int</span>         len)
<a name="l04846"></a>04846 {
<a name="l04847"></a>04847   <a class="code" href="structDBusString.html">DBusString</a> str;
<a name="l04848"></a>04848   <span class="keywordtype">int</span> byte_order, fields_array_len, header_len, body_len;
<a name="l04849"></a>04849   <a class="code" href="group__DBusMarshal.html#ga0c4521d30d6650a33673a4d7f9cc007c" title="This is primarily used in unit testing, so we can verify that each invalid message is invalid for the...">DBusValidity</a> validity = DBUS_VALID;
<a name="l04850"></a>04850   <span class="keywordtype">int</span> have_message;
<a name="l04851"></a>04851 
<a name="l04852"></a>04852   <span class="keywordflow">if</span> (!buf || len &lt; <a class="code" href="group__DBusProtocol.html#gaf8c13dd883c21b5dea179d77d8ac12e3" title="The smallest header size that can occur.">DBUS_MINIMUM_HEADER_SIZE</a>)
<a name="l04853"></a>04853     <span class="keywordflow">return</span> 0;
<a name="l04854"></a>04854 
<a name="l04855"></a>04855   <span class="keywordflow">if</span> (len &gt; <a class="code" href="group__DBusProtocol.html#ga2874c299e1c87fe745ef09bf231264e9" title="The maximum total message size including header and body; similar rationale to max array size...">DBUS_MAXIMUM_MESSAGE_LENGTH</a>)
<a name="l04856"></a>04856     len = <a class="code" href="group__DBusProtocol.html#ga2874c299e1c87fe745ef09bf231264e9" title="The maximum total message size including header and body; similar rationale to max array size...">DBUS_MAXIMUM_MESSAGE_LENGTH</a>;
<a name="l04857"></a>04857   <a class="code" href="group__DBusString.html#ga6792a5c1725faa9d635d95f7a3b5bfae" title="Initializes a constant string with a length.">_dbus_string_init_const_len</a> (&amp;str, buf, len);
<a name="l04858"></a>04858   
<a name="l04859"></a>04859   validity = DBUS_VALID;
<a name="l04860"></a>04860   have_message
<a name="l04861"></a>04861     = <a class="code" href="group__DBusMarshal.html#ga674d74081baf6e7531e0d4a286724210" title="Given data long enough to contain the length of the message body and the fields array, check whether the data is long enough to contain the entire message (assuming the claimed lengths are accurate).">_dbus_header_have_message_untrusted</a>(<a class="code" href="group__DBusProtocol.html#ga2874c299e1c87fe745ef09bf231264e9" title="The maximum total message size including header and body; similar rationale to max array size...">DBUS_MAXIMUM_MESSAGE_LENGTH</a>,
<a name="l04862"></a>04862                                           &amp;validity, &amp;byte_order,
<a name="l04863"></a>04863                                           &amp;fields_array_len,
<a name="l04864"></a>04864                                           &amp;header_len,
<a name="l04865"></a>04865                                           &amp;body_len,
<a name="l04866"></a>04866                                           &amp;str, 0,
<a name="l04867"></a>04867                                           len);
<a name="l04868"></a>04868   <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="l04869"></a>04869 
<a name="l04870"></a>04870   <span class="keywordflow">if</span> (validity == DBUS_VALID)
<a name="l04871"></a>04871     {
<a name="l04872"></a>04872       _dbus_assert (have_message || (header_len + body_len) &gt; len);
<a name="l04873"></a>04873       (void) have_message; <span class="comment">/* unused unless asserting */</span>
<a name="l04874"></a>04874       <span class="keywordflow">return</span> header_len + body_len;
<a name="l04875"></a>04875     }
<a name="l04876"></a>04876   <span class="keywordflow">else</span>
<a name="l04877"></a>04877     {
<a name="l04878"></a>04878       <span class="keywordflow">return</span> -1; <span class="comment">/* broken! */</span>
<a name="l04879"></a>04879     }
<a name="l04880"></a>04880 }
<a name="l04881"></a>04881 
<a name="l04884"></a>04884 <span class="comment">/* tests in dbus-message-util.c */</span>
</pre></div></div><!-- contents -->


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