| Current File : //usr/share/doc/dbus/api/dbus-transport_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-transport.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
 <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 Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="annotated.html"><span>Data 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 List</span></a></li>
</ul>
</div>
</div>
<div class="header">
<div class="headertitle">
<div class="title">dbus-transport.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: "gnu"; indent-tabs-mode: nil; -*- */</span>
<a name="l00002"></a>00002 <span class="comment">/* dbus-transport.c DBusTransport object (internal to D-Bus implementation)</span>
<a name="l00003"></a>00003 <span class="comment"> *</span>
<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002, 2003 Red Hat Inc.</span>
<a name="l00005"></a>00005 <span class="comment"> *</span>
<a name="l00006"></a>00006 <span class="comment"> * Licensed under the Academic Free License version 2.1</span>
<a name="l00007"></a>00007 <span class="comment"> * </span>
<a name="l00008"></a>00008 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
<a name="l00009"></a>00009 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
<a name="l00010"></a>00010 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
<a name="l00011"></a>00011 <span class="comment"> * (at your option) any later version.</span>
<a name="l00012"></a>00012 <span class="comment"> *</span>
<a name="l00013"></a>00013 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
<a name="l00014"></a>00014 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00015"></a>00015 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
<a name="l00016"></a>00016 <span class="comment"> * GNU General Public License for more details.</span>
<a name="l00017"></a>00017 <span class="comment"> * </span>
<a name="l00018"></a>00018 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
<a name="l00019"></a>00019 <span class="comment"> * along with this program; if not, write to the Free Software</span>
<a name="l00020"></a>00020 <span class="comment"> * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA</span>
<a name="l00021"></a>00021 <span class="comment"> *</span>
<a name="l00022"></a>00022 <span class="comment"> */</span>
<a name="l00023"></a>00023
<a name="l00024"></a>00024 <span class="preprocessor">#include <config.h></span>
<a name="l00025"></a>00025 <span class="preprocessor">#include "dbus-transport-protected.h"</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include "dbus-transport-unix.h"</span>
<a name="l00027"></a>00027 <span class="preprocessor">#include "dbus-transport-socket.h"</span>
<a name="l00028"></a>00028 <span class="preprocessor">#include "dbus-connection-internal.h"</span>
<a name="l00029"></a>00029 <span class="preprocessor">#include "dbus-watch.h"</span>
<a name="l00030"></a>00030 <span class="preprocessor">#include "dbus-auth.h"</span>
<a name="l00031"></a>00031 <span class="preprocessor">#include "dbus-address.h"</span>
<a name="l00032"></a>00032 <span class="preprocessor">#include "dbus-credentials.h"</span>
<a name="l00033"></a>00033 <span class="preprocessor">#include "dbus-mainloop.h"</span>
<a name="l00034"></a>00034 <span class="preprocessor">#include "dbus-message.h"</span>
<a name="l00035"></a>00035 <span class="preprocessor">#ifdef DBUS_ENABLE_EMBEDDED_TESTS</span>
<a name="l00036"></a>00036 <span class="preprocessor"></span><span class="preprocessor">#include "dbus-server-debug-pipe.h"</span>
<a name="l00037"></a>00037 <span class="preprocessor">#endif</span>
<a name="l00038"></a>00038 <span class="preprocessor"></span>
<a name="l00060"></a>00060 <span class="keyword">static</span> <span class="keywordtype">void</span>
<a name="l00061"></a>00061 live_messages_notify (<a class="code" href="structDBusCounter.html" title="Internals of DBusCounter.">DBusCounter</a> *counter,
<a name="l00062"></a>00062 <span class="keywordtype">void</span> *user_data)
<a name="l00063"></a>00063 {
<a name="l00064"></a>00064 <a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport = user_data;
<a name="l00065"></a>00065
<a name="l00066"></a>00066 <a class="code" href="group__DBusConnectionInternals.html#ga4fe0c8f7b72dc89b9e1a3110db2f778e" title="Acquires the connection lock.">_dbus_connection_lock</a> (transport-><a class="code" href="structDBusTransport.html#a8abdfc9327aa30550982c83b45354651" title="Connection owning this transport.">connection</a>);
<a name="l00067"></a>00067 <a class="code" href="group__DBusTransport.html#ga31d6dbc864c9ea643d72521bbb1b7c56" title="Increments the reference count for the transport.">_dbus_transport_ref</a> (transport);
<a name="l00068"></a>00068
<a name="l00069"></a>00069 <span class="preprocessor">#if 0</span>
<a name="l00070"></a>00070 <span class="preprocessor"></span> _dbus_verbose (<span class="stringliteral">"Size counter value is now %d\n"</span>,
<a name="l00071"></a>00071 (<span class="keywordtype">int</span>) <a class="code" href="group__DBusResources.html#ga49de078fb626aff30f273933ad5c8b2a" title="Gets the current value of the size counter.">_dbus_counter_get_size_value</a> (counter));
<a name="l00072"></a>00072 _dbus_verbose (<span class="stringliteral">"Unix FD counter value is now %d\n"</span>,
<a name="l00073"></a>00073 (<span class="keywordtype">int</span>) <a class="code" href="group__DBusResources.html#ga25b2d12b9dc4d3525df2b8401f4ce56d" title="Gets the current value of the unix fd counter.">_dbus_counter_get_unix_fd_value</a> (counter));
<a name="l00074"></a>00074 <span class="preprocessor">#endif</span>
<a name="l00075"></a>00075 <span class="preprocessor"></span>
<a name="l00076"></a>00076 <span class="comment">/* disable or re-enable the read watch for the transport if</span>
<a name="l00077"></a>00077 <span class="comment"> * required.</span>
<a name="l00078"></a>00078 <span class="comment"> */</span>
<a name="l00079"></a>00079 <span class="keywordflow">if</span> (transport-><a class="code" href="structDBusTransport.html#a7350850a4e02a7eaa4036eb47d4778e5" title="Virtual methods for this instance.">vtable</a>-><a class="code" href="structDBusTransportVTable.html#af28ab32fb4f7332a245f48a7d2823dfc" title="Outstanding messages counter changed.">live_messages_changed</a>)
<a name="l00080"></a>00080 {
<a name="l00081"></a>00081 (* transport-><a class="code" href="structDBusTransport.html#a7350850a4e02a7eaa4036eb47d4778e5" title="Virtual methods for this instance.">vtable</a>-><a class="code" href="structDBusTransportVTable.html#af28ab32fb4f7332a245f48a7d2823dfc" title="Outstanding messages counter changed.">live_messages_changed</a>) (transport);
<a name="l00082"></a>00082 }
<a name="l00083"></a>00083
<a name="l00084"></a>00084 <a class="code" href="group__DBusTransport.html#gab7c53c32a2320c81aae8ce4345762e73" title="Decrements the reference count for the transport.">_dbus_transport_unref</a> (transport);
<a name="l00085"></a>00085 <a class="code" href="group__DBusConnectionInternals.html#ga3db10d48ec16e485d5a638aacebd4ad2" title="Releases the connection lock.">_dbus_connection_unlock</a> (transport-><a class="code" href="structDBusTransport.html#a8abdfc9327aa30550982c83b45354651" title="Connection owning this transport.">connection</a>);
<a name="l00086"></a>00086 }
<a name="l00087"></a>00087
<a name="l00101"></a>00101 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l00102"></a><a class="code" href="group__DBusTransport.html#gaa5ece78ea671fe9d9ed17fc6920c9d09">00102</a> <a class="code" href="group__DBusTransport.html#gaa5ece78ea671fe9d9ed17fc6920c9d09" title="Initializes the base class members of DBusTransport.">_dbus_transport_init_base</a> (<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport,
<a name="l00103"></a>00103 <span class="keyword">const</span> <a class="code" href="structDBusTransportVTable.html" title="The virtual table that must be implemented to create a new kind of transport.">DBusTransportVTable</a> *vtable,
<a name="l00104"></a>00104 <span class="keyword">const</span> <a class="code" href="structDBusString.html">DBusString</a> *server_guid,
<a name="l00105"></a>00105 <span class="keyword">const</span> <a class="code" href="structDBusString.html">DBusString</a> *address)
<a name="l00106"></a>00106 {
<a name="l00107"></a>00107 <a class="code" href="structDBusMessageLoader.html" title="Implementation details of DBusMessageLoader.">DBusMessageLoader</a> *loader;
<a name="l00108"></a>00108 <a class="code" href="structDBusAuth.html" title="Internal members of DBusAuth.">DBusAuth</a> *auth;
<a name="l00109"></a>00109 <a class="code" href="structDBusCounter.html" title="Internals of DBusCounter.">DBusCounter</a> *counter;
<a name="l00110"></a>00110 <span class="keywordtype">char</span> *address_copy;
<a name="l00111"></a>00111 <a class="code" href="structDBusCredentials.html">DBusCredentials</a> *creds;
<a name="l00112"></a>00112
<a name="l00113"></a>00113 loader = <a class="code" href="group__DBusMessageInternals.html#ga66f1c10cf909ba09ed732bc125ff8671" title="Creates a new message loader.">_dbus_message_loader_new</a> ();
<a name="l00114"></a>00114 <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="l00115"></a>00115 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to "0".">FALSE</a>;
<a name="l00116"></a>00116
<a name="l00117"></a>00117 <span class="keywordflow">if</span> (server_guid)
<a name="l00118"></a>00118 auth = <a class="code" href="group__DBusAuth.html#ga302e454600ae0e1aa27193d4b0a86385" title="Creates a new auth conversation object for the server side.">_dbus_auth_server_new</a> (server_guid);
<a name="l00119"></a>00119 <span class="keywordflow">else</span>
<a name="l00120"></a>00120 auth = <a class="code" href="group__DBusAuth.html#gaee76dbcdada8bcafe131f5a2de151ac3" title="Creates a new auth conversation object for the client side.">_dbus_auth_client_new</a> ();
<a name="l00121"></a>00121 <span class="keywordflow">if</span> (auth == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00122"></a>00122 {
<a name="l00123"></a>00123 <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="l00124"></a>00124 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to "0".">FALSE</a>;
<a name="l00125"></a>00125 }
<a name="l00126"></a>00126
<a name="l00127"></a>00127 counter = <a class="code" href="group__DBusResources.html#ga9911dd8fa020299a2b517251ea0be399" title="Creates a new DBusCounter.">_dbus_counter_new</a> ();
<a name="l00128"></a>00128 <span class="keywordflow">if</span> (counter == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00129"></a>00129 {
<a name="l00130"></a>00130 <a class="code" href="group__DBusAuth.html#ga7fb648be9d6d451917195a0e43eeece0" title="Decrements the refcount of an auth object.">_dbus_auth_unref</a> (auth);
<a name="l00131"></a>00131 <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="l00132"></a>00132 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to "0".">FALSE</a>;
<a name="l00133"></a>00133 }
<a name="l00134"></a>00134
<a name="l00135"></a>00135 creds = <a class="code" href="group__DBusCredentials.html#ga749dd398d725f37a7943d60074785844" title="Creates a new credentials object.">_dbus_credentials_new</a> ();
<a name="l00136"></a>00136 <span class="keywordflow">if</span> (creds == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00137"></a>00137 {
<a name="l00138"></a>00138 <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="l00139"></a>00139 <a class="code" href="group__DBusAuth.html#ga7fb648be9d6d451917195a0e43eeece0" title="Decrements the refcount of an auth object.">_dbus_auth_unref</a> (auth);
<a name="l00140"></a>00140 <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="l00141"></a>00141 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to "0".">FALSE</a>;
<a name="l00142"></a>00142 }
<a name="l00143"></a>00143
<a name="l00144"></a>00144 <span class="keywordflow">if</span> (server_guid)
<a name="l00145"></a>00145 {
<a name="l00146"></a>00146 _dbus_assert (address == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l00147"></a>00147 address_copy = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00148"></a>00148 }
<a name="l00149"></a>00149 <span class="keywordflow">else</span>
<a name="l00150"></a>00150 {
<a name="l00151"></a>00151 _dbus_assert (address != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l00152"></a>00152
<a name="l00153"></a>00153 <span class="keywordflow">if</span> (!<a class="code" href="group__DBusString.html#ga7e509d4f959d19d96f83250e62287b06" title="Copies the data from the string into a char*.">_dbus_string_copy_data</a> (address, &address_copy))
<a name="l00154"></a>00154 {
<a name="l00155"></a>00155 <a class="code" href="group__DBusCredentials.html#ga89913c830c3627cd006a50ca693af580" title="Decrement refcount on credentials.">_dbus_credentials_unref</a> (creds);
<a name="l00156"></a>00156 <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="l00157"></a>00157 <a class="code" href="group__DBusAuth.html#ga7fb648be9d6d451917195a0e43eeece0" title="Decrements the refcount of an auth object.">_dbus_auth_unref</a> (auth);
<a name="l00158"></a>00158 <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="l00159"></a>00159 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to "0".">FALSE</a>;
<a name="l00160"></a>00160 }
<a name="l00161"></a>00161 }
<a name="l00162"></a>00162
<a name="l00163"></a>00163 transport-><a class="code" href="structDBusTransport.html#a1a6554a692a353f8402c1419cd94e904" title="Reference count.">refcount</a> = 1;
<a name="l00164"></a>00164 transport-><a class="code" href="structDBusTransport.html#a7350850a4e02a7eaa4036eb47d4778e5" title="Virtual methods for this instance.">vtable</a> = vtable;
<a name="l00165"></a>00165 transport-><a class="code" href="structDBusTransport.html#aaaba590c281236d176600016b7edab48" title="Message-loading buffer.">loader</a> = loader;
<a name="l00166"></a>00166 transport-><a class="code" href="structDBusTransport.html#acf71c91312f325be13ce6c09298b1eb8" title="Authentication conversation.">auth</a> = auth;
<a name="l00167"></a>00167 transport-><a class="code" href="structDBusTransport.html#afb19bae6f7cfe595f3f1ae0ce53ccab0" title="Counter for size/unix fds of all live messages.">live_messages</a> = counter;
<a name="l00168"></a>00168 transport-><a class="code" href="structDBusTransport.html#a12d3052e51b2f0bf398d48e31e5f9da8" title="Cache of auth state; use _dbus_transport_peek_is_authenticated() to query value.">authenticated</a> = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to "0".">FALSE</a>;
<a name="l00169"></a>00169 transport-><a class="code" href="structDBusTransport.html#a487a7375e94efba850f8344a252cfa63" title="TRUE if we are disconnected.">disconnected</a> = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to "0".">FALSE</a>;
<a name="l00170"></a>00170 transport-><a class="code" href="structDBusTransport.html#a38fa70b1473eb08a6c871c7791b46d6e" title="TRUE if on the server side">is_server</a> = (server_guid != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l00171"></a>00171 transport-><a class="code" href="structDBusTransport.html#a7d91848b94203022be1090d93dd2cd04" title="TRUE if we need to send credentials">send_credentials_pending</a> = !transport-><a class="code" href="structDBusTransport.html#a38fa70b1473eb08a6c871c7791b46d6e" title="TRUE if on the server side">is_server</a>;
<a name="l00172"></a>00172 transport-><a class="code" href="structDBusTransport.html#aaa29089fbb1fbdb5b412b3ed18c84b2d" title="TRUE if we need to receive credentials">receive_credentials_pending</a> = transport-><a class="code" href="structDBusTransport.html#a38fa70b1473eb08a6c871c7791b46d6e" title="TRUE if on the server side">is_server</a>;
<a name="l00173"></a>00173 transport-><a class="code" href="structDBusTransport.html#a586180e57d80c428fc81e579d9159cb2" title="Address of the server we are connecting to (NULL for the server side of a transport)">address</a> = address_copy;
<a name="l00174"></a>00174
<a name="l00175"></a>00175 transport-><a class="code" href="structDBusTransport.html#ac83be11f3497da6a21aed51782cd68d0" title="Function for checking whether a user is authorized.">unix_user_function</a> = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00176"></a>00176 transport-><a class="code" href="structDBusTransport.html#a7df35abee6aeef69eff659d65dd430f4" title="Data for unix_user_function.">unix_user_data</a> = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00177"></a>00177 transport-><a class="code" href="structDBusTransport.html#a754f10d16c06f373464fe6bf88a15cdd" title="Function to free unix_user_data.">free_unix_user_data</a> = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00178"></a>00178
<a name="l00179"></a>00179 transport-><a class="code" href="structDBusTransport.html#a17403591c2a1d936be5ed13a36e6416a" title="Function for checking whether a user is authorized.">windows_user_function</a> = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00180"></a>00180 transport-><a class="code" href="structDBusTransport.html#a333c4300fe345d25e9dcb828d20baff7" title="Data for windows_user_function.">windows_user_data</a> = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00181"></a>00181 transport-><a class="code" href="structDBusTransport.html#aab0e5248bd01f31ac4dcdab3c3b7b570" title="Function to free windows_user_data.">free_windows_user_data</a> = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00182"></a>00182
<a name="l00183"></a>00183 transport-><a class="code" href="structDBusTransport.html#aaad7cb51a3e4ff2dd900ac971cc52b36" title="GUID we expect the server to have, NULL on server side or if we don't have an expectation.">expected_guid</a> = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00184"></a>00184
<a name="l00185"></a>00185 <span class="comment">/* Try to default to something that won't totally hose the system,</span>
<a name="l00186"></a>00186 <span class="comment"> * but doesn't impose too much of a limitation.</span>
<a name="l00187"></a>00187 <span class="comment"> */</span>
<a name="l00188"></a>00188 transport-><a class="code" href="structDBusTransport.html#a23e0925741fc1c4ba3a369bac4bca4b6" title="Max total size of received messages.">max_live_messages_size</a> = _DBUS_ONE_MEGABYTE * 63;
<a name="l00189"></a>00189
<a name="l00190"></a>00190 <span class="comment">/* On Linux RLIMIT_NOFILE defaults to 1024, so allowing 4096 fds live</span>
<a name="l00191"></a>00191 <span class="comment"> should be more than enough */</span>
<a name="l00192"></a>00192 transport-><a class="code" href="structDBusTransport.html#a2d96972bbc56b78360cb0cfaa3f30266" title="Max total unix fds of received messages.">max_live_messages_unix_fds</a> = 4096;
<a name="l00193"></a>00193
<a name="l00194"></a>00194 <span class="comment">/* credentials read from socket if any */</span>
<a name="l00195"></a>00195 transport-><a class="code" href="structDBusTransport.html#acb3d5fe913d4c281f3495e95cd450c57" title="Credentials of other end read from the socket.">credentials</a> = creds;
<a name="l00196"></a>00196
<a name="l00197"></a>00197 <a class="code" href="group__DBusResources.html#ga240bddfe384b32a8703a328a638219e1" title="Sets the notify function for this counter; the notify function is called whenever the counter's value...">_dbus_counter_set_notify</a> (transport-><a class="code" href="structDBusTransport.html#afb19bae6f7cfe595f3f1ae0ce53ccab0" title="Counter for size/unix fds of all live messages.">live_messages</a>,
<a name="l00198"></a>00198 transport-><a class="code" href="structDBusTransport.html#a23e0925741fc1c4ba3a369bac4bca4b6" title="Max total size of received messages.">max_live_messages_size</a>,
<a name="l00199"></a>00199 transport-><a class="code" href="structDBusTransport.html#a2d96972bbc56b78360cb0cfaa3f30266" title="Max total unix fds of received messages.">max_live_messages_unix_fds</a>,
<a name="l00200"></a>00200 live_messages_notify,
<a name="l00201"></a>00201 transport);
<a name="l00202"></a>00202
<a name="l00203"></a>00203 <span class="keywordflow">if</span> (transport-><a class="code" href="structDBusTransport.html#a586180e57d80c428fc81e579d9159cb2" title="Address of the server we are connecting to (NULL for the server side of a transport)">address</a>)
<a name="l00204"></a>00204 _dbus_verbose (<span class="stringliteral">"Initialized transport on address %s\n"</span>, transport-><a class="code" href="structDBusTransport.html#a586180e57d80c428fc81e579d9159cb2" title="Address of the server we are connecting to (NULL for the server side of a transport)">address</a>);
<a name="l00205"></a>00205
<a name="l00206"></a>00206 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to "1".">TRUE</a>;
<a name="l00207"></a>00207 }
<a name="l00208"></a>00208
<a name="l00215"></a>00215 <span class="keywordtype">void</span>
<a name="l00216"></a><a class="code" href="group__DBusTransport.html#gaf27a2aceb062921f3915acb1491a646a">00216</a> <a class="code" href="group__DBusTransport.html#gaf27a2aceb062921f3915acb1491a646a" title="Finalizes base class members of DBusTransport.">_dbus_transport_finalize_base</a> (<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport)
<a name="l00217"></a>00217 {
<a name="l00218"></a>00218 <span class="keywordflow">if</span> (!transport-><a class="code" href="structDBusTransport.html#a487a7375e94efba850f8344a252cfa63" title="TRUE if we are disconnected.">disconnected</a>)
<a name="l00219"></a>00219 <a class="code" href="group__DBusTransport.html#ga78444dd8f6c6d6b429433ad81c3e318a" title="Closes our end of the connection to a remote application.">_dbus_transport_disconnect</a> (transport);
<a name="l00220"></a>00220
<a name="l00221"></a>00221 <span class="keywordflow">if</span> (transport-><a class="code" href="structDBusTransport.html#a754f10d16c06f373464fe6bf88a15cdd" title="Function to free unix_user_data.">free_unix_user_data</a> != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00222"></a>00222 (* transport-><a class="code" href="structDBusTransport.html#a754f10d16c06f373464fe6bf88a15cdd" title="Function to free unix_user_data.">free_unix_user_data</a>) (transport-><a class="code" href="structDBusTransport.html#a7df35abee6aeef69eff659d65dd430f4" title="Data for unix_user_function.">unix_user_data</a>);
<a name="l00223"></a>00223
<a name="l00224"></a>00224 <span class="keywordflow">if</span> (transport-><a class="code" href="structDBusTransport.html#aab0e5248bd01f31ac4dcdab3c3b7b570" title="Function to free windows_user_data.">free_windows_user_data</a> != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00225"></a>00225 (* transport-><a class="code" href="structDBusTransport.html#aab0e5248bd01f31ac4dcdab3c3b7b570" title="Function to free windows_user_data.">free_windows_user_data</a>) (transport-><a class="code" href="structDBusTransport.html#a333c4300fe345d25e9dcb828d20baff7" title="Data for windows_user_function.">windows_user_data</a>);
<a name="l00226"></a>00226
<a name="l00227"></a>00227 <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> (transport-><a class="code" href="structDBusTransport.html#aaaba590c281236d176600016b7edab48" title="Message-loading buffer.">loader</a>);
<a name="l00228"></a>00228 <a class="code" href="group__DBusAuth.html#ga7fb648be9d6d451917195a0e43eeece0" title="Decrements the refcount of an auth object.">_dbus_auth_unref</a> (transport-><a class="code" href="structDBusTransport.html#acf71c91312f325be13ce6c09298b1eb8" title="Authentication conversation.">auth</a>);
<a name="l00229"></a>00229 <a class="code" href="group__DBusResources.html#ga240bddfe384b32a8703a328a638219e1" title="Sets the notify function for this counter; the notify function is called whenever the counter's value...">_dbus_counter_set_notify</a> (transport-><a class="code" href="structDBusTransport.html#afb19bae6f7cfe595f3f1ae0ce53ccab0" title="Counter for size/unix fds of all live messages.">live_messages</a>,
<a name="l00230"></a>00230 0, 0, <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="l00231"></a>00231 <a class="code" href="group__DBusResources.html#ga48d9b53d1a395ab3c4f1846ca569ef3f" title="Decrements refcount of the counter and possibly finalizes the counter.">_dbus_counter_unref</a> (transport-><a class="code" href="structDBusTransport.html#afb19bae6f7cfe595f3f1ae0ce53ccab0" title="Counter for size/unix fds of all live messages.">live_messages</a>);
<a name="l00232"></a>00232 <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> (transport-><a class="code" href="structDBusTransport.html#a586180e57d80c428fc81e579d9159cb2" title="Address of the server we are connecting to (NULL for the server side of a transport)">address</a>);
<a name="l00233"></a>00233 <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> (transport-><a class="code" href="structDBusTransport.html#aaad7cb51a3e4ff2dd900ac971cc52b36" title="GUID we expect the server to have, NULL on server side or if we don't have an expectation.">expected_guid</a>);
<a name="l00234"></a>00234 <span class="keywordflow">if</span> (transport-><a class="code" href="structDBusTransport.html#acb3d5fe913d4c281f3495e95cd450c57" title="Credentials of other end read from the socket.">credentials</a>)
<a name="l00235"></a>00235 <a class="code" href="group__DBusCredentials.html#ga89913c830c3627cd006a50ca693af580" title="Decrement refcount on credentials.">_dbus_credentials_unref</a> (transport-><a class="code" href="structDBusTransport.html#acb3d5fe913d4c281f3495e95cd450c57" title="Credentials of other end read from the socket.">credentials</a>);
<a name="l00236"></a>00236 }
<a name="l00237"></a>00237
<a name="l00238"></a>00238
<a name="l00249"></a>00249 <span class="keyword">static</span> <a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a>*
<a name="l00250"></a>00250 check_address (<span class="keyword">const</span> <span class="keywordtype">char</span> *address, <a class="code" href="structDBusError.html" title="Object representing an exception.">DBusError</a> *error)
<a name="l00251"></a>00251 {
<a name="l00252"></a>00252 <a class="code" href="structDBusAddressEntry.html" title="Internals of DBusAddressEntry.">DBusAddressEntry</a> **entries;
<a name="l00253"></a>00253 <a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00254"></a>00254 <span class="keywordtype">int</span> len, i;
<a name="l00255"></a>00255
<a name="l00256"></a>00256 _dbus_assert (address != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l00257"></a>00257
<a name="l00258"></a>00258 <span class="keywordflow">if</span> (!<a class="code" href="group__DBusAddress.html#ga3cbf5947262b79601598276c720e2098" title="Parses an address string of the form:">dbus_parse_address</a> (address, &entries, &len, error))
<a name="l00259"></a>00259 <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>; <span class="comment">/* not a valid address */</span>
<a name="l00260"></a>00260
<a name="l00261"></a>00261 <span class="keywordflow">for</span> (i = 0; i < len; i++)
<a name="l00262"></a>00262 {
<a name="l00263"></a>00263 transport = <a class="code" href="group__DBusTransport.html#ga0893897223056c89f33b2641a7b21cf8" title="Try to open a new transport for the given address entry.">_dbus_transport_open</a> (entries[i], error);
<a name="l00264"></a>00264 <span class="keywordflow">if</span> (transport != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00265"></a>00265 <span class="keywordflow">break</span>;
<a name="l00266"></a>00266 }
<a name="l00267"></a>00267
<a name="l00268"></a>00268 <a class="code" href="group__DBusAddress.html#ga37a7009b07cf991ff07f3e86d71bf352" title="Frees a NULL-terminated array of address entries.">dbus_address_entries_free</a> (entries);
<a name="l00269"></a>00269 <span class="keywordflow">return</span> transport;
<a name="l00270"></a>00270 }
<a name="l00271"></a>00271
<a name="l00280"></a>00280 <span class="keyword">static</span> <a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a>*
<a name="l00281"></a>00281 _dbus_transport_new_for_autolaunch (<span class="keyword">const</span> <span class="keywordtype">char</span> *scope, <a class="code" href="structDBusError.html" title="Object representing an exception.">DBusError</a> *error)
<a name="l00282"></a>00282 {
<a name="l00283"></a>00283 <a class="code" href="structDBusString.html">DBusString</a> address;
<a name="l00284"></a>00284 <a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *result = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00285"></a>00285
<a name="l00286"></a>00286 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
<a name="l00287"></a>00287
<a name="l00288"></a>00288 <span class="keywordflow">if</span> (!<a class="code" href="group__DBusString.html#ga348252317f7bb8ac43529972945830ae" title="Initializes a string.">_dbus_string_init</a> (&address))
<a name="l00289"></a>00289 {
<a name="l00290"></a>00290 <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#gac32eaf0b92f798307853cd4fe0cf11c2" title="There was not enough memory to complete an operation.">DBUS_ERROR_NO_MEMORY</a>, <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l00291"></a>00291 <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="l00292"></a>00292 }
<a name="l00293"></a>00293
<a name="l00294"></a>00294 <span class="keywordflow">if</span> (!<a class="code" href="group__DBusSysdeps.html#gabc4712c0db91f11854cdd933027355af" title="Returns the address of a new session bus.">_dbus_get_autolaunch_address</a> (scope, &address, error))
<a name="l00295"></a>00295 {
<a name="l00296"></a>00296 _DBUS_ASSERT_ERROR_IS_SET (error);
<a name="l00297"></a>00297 <span class="keywordflow">goto</span> out;
<a name="l00298"></a>00298 }
<a name="l00299"></a>00299
<a name="l00300"></a>00300 result = check_address (<a class="code" href="group__DBusString.html#ga33e20241ae7d784624f97d89b1a0539e" title="Gets the raw character buffer from a const string.">_dbus_string_get_const_data</a> (&address), error);
<a name="l00301"></a>00301 <span class="keywordflow">if</span> (result == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00302"></a>00302 _DBUS_ASSERT_ERROR_IS_SET (error);
<a name="l00303"></a>00303 <span class="keywordflow">else</span>
<a name="l00304"></a>00304 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
<a name="l00305"></a>00305
<a name="l00306"></a>00306 out:
<a name="l00307"></a>00307 <a class="code" href="group__DBusString.html#ga781ca91acda49a834dce7d0ed0eef212" title="Frees a string created by _dbus_string_init().">_dbus_string_free</a> (&address);
<a name="l00308"></a>00308 <span class="keywordflow">return</span> result;
<a name="l00309"></a>00309 }
<a name="l00310"></a>00310
<a name="l00311"></a>00311 <span class="keyword">static</span> DBusTransportOpenResult
<a name="l00312"></a>00312 _dbus_transport_open_autolaunch (<a class="code" href="structDBusAddressEntry.html" title="Internals of DBusAddressEntry.">DBusAddressEntry</a> *entry,
<a name="l00313"></a>00313 <a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> **transport_p,
<a name="l00314"></a>00314 <a class="code" href="structDBusError.html" title="Object representing an exception.">DBusError</a> *error)
<a name="l00315"></a>00315 {
<a name="l00316"></a>00316 <span class="keyword">const</span> <span class="keywordtype">char</span> *method;
<a name="l00317"></a>00317
<a name="l00318"></a>00318 method = <a class="code" href="group__DBusAddress.html#ga7e6b2572d6e637826acada01377b5487" title="Returns the method string of an address entry.">dbus_address_entry_get_method</a> (entry);
<a name="l00319"></a>00319 _dbus_assert (method != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l00320"></a>00320
<a name="l00321"></a>00321 <span class="keywordflow">if</span> (strcmp (method, <span class="stringliteral">"autolaunch"</span>) == 0)
<a name="l00322"></a>00322 {
<a name="l00323"></a>00323 <span class="keyword">const</span> <span class="keywordtype">char</span> *scope = <a class="code" href="group__DBusAddress.html#gae6f014689b49099e835b1f97d032034e" title="Returns a value from a key of an entry.">dbus_address_entry_get_value</a> (entry, <span class="stringliteral">"scope"</span>);
<a name="l00324"></a>00324
<a name="l00325"></a>00325 *transport_p = _dbus_transport_new_for_autolaunch (scope, error);
<a name="l00326"></a>00326
<a name="l00327"></a>00327 <span class="keywordflow">if</span> (*transport_p == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00328"></a>00328 {
<a name="l00329"></a>00329 _DBUS_ASSERT_ERROR_IS_SET (error);
<a name="l00330"></a>00330 <span class="keywordflow">return</span> DBUS_TRANSPORT_OPEN_DID_NOT_CONNECT;
<a name="l00331"></a>00331 }
<a name="l00332"></a>00332 <span class="keywordflow">else</span>
<a name="l00333"></a>00333 {
<a name="l00334"></a>00334 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
<a name="l00335"></a>00335 <span class="keywordflow">return</span> DBUS_TRANSPORT_OPEN_OK;
<a name="l00336"></a>00336 }
<a name="l00337"></a>00337 }
<a name="l00338"></a>00338 <span class="keywordflow">else</span>
<a name="l00339"></a>00339 {
<a name="l00340"></a>00340 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
<a name="l00341"></a>00341 <span class="keywordflow">return</span> DBUS_TRANSPORT_OPEN_NOT_HANDLED;
<a name="l00342"></a>00342 }
<a name="l00343"></a>00343 }
<a name="l00344"></a>00344
<a name="l00345"></a>00345 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keyword">struct </span>{
<a name="l00346"></a>00346 DBusTransportOpenResult (* func) (<a class="code" href="structDBusAddressEntry.html" title="Internals of DBusAddressEntry.">DBusAddressEntry</a> *entry,
<a name="l00347"></a>00347 <a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> **transport_p,
<a name="l00348"></a>00348 <a class="code" href="structDBusError.html" title="Object representing an exception.">DBusError</a> *error);
<a name="l00349"></a>00349 } open_funcs[] = {
<a name="l00350"></a>00350 { <a class="code" href="group__DBusTransportSocket.html#ga1bb28d9c6b0aa2b7efdf63f97116bb85" title="Opens a TCP socket transport.">_dbus_transport_open_socket</a> },
<a name="l00351"></a>00351 { <a class="code" href="group__DBusTransportUnix.html#gafd694944860033155276df9162bdf72e" title="Opens platform specific transport types.">_dbus_transport_open_platform_specific</a> },
<a name="l00352"></a>00352 { _dbus_transport_open_autolaunch }
<a name="l00353"></a>00353 <span class="preprocessor">#ifdef DBUS_ENABLE_EMBEDDED_TESTS</span>
<a name="l00354"></a>00354 <span class="preprocessor"></span> , { _dbus_transport_open_debug_pipe }
<a name="l00355"></a>00355 <span class="preprocessor">#endif</span>
<a name="l00356"></a>00356 <span class="preprocessor"></span>};
<a name="l00357"></a>00357
<a name="l00366"></a>00366 <a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a>*
<a name="l00367"></a><a class="code" href="group__DBusTransport.html#ga0893897223056c89f33b2641a7b21cf8">00367</a> <a class="code" href="group__DBusTransport.html#ga0893897223056c89f33b2641a7b21cf8" title="Try to open a new transport for the given address entry.">_dbus_transport_open</a> (<a class="code" href="structDBusAddressEntry.html" title="Internals of DBusAddressEntry.">DBusAddressEntry</a> *entry,
<a name="l00368"></a>00368 <a class="code" href="structDBusError.html" title="Object representing an exception.">DBusError</a> *error)
<a name="l00369"></a>00369 {
<a name="l00370"></a>00370 <a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport;
<a name="l00371"></a>00371 <span class="keyword">const</span> <span class="keywordtype">char</span> *expected_guid_orig;
<a name="l00372"></a>00372 <span class="keywordtype">char</span> *expected_guid;
<a name="l00373"></a>00373 <span class="keywordtype">int</span> i;
<a name="l00374"></a>00374 <a class="code" href="structDBusError.html" title="Object representing an exception.">DBusError</a> tmp_error = <a class="code" href="group__DBusErrorInternals.html#ga961cc70e3891282a65205c4c8418d88e" title="Expands to a suitable initializer for a DBusError on the stack.">DBUS_ERROR_INIT</a>;
<a name="l00375"></a>00375
<a name="l00376"></a>00376 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
<a name="l00377"></a>00377
<a name="l00378"></a>00378 transport = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00379"></a>00379 expected_guid_orig = <a class="code" href="group__DBusAddress.html#gae6f014689b49099e835b1f97d032034e" title="Returns a value from a key of an entry.">dbus_address_entry_get_value</a> (entry, <span class="stringliteral">"guid"</span>);
<a name="l00380"></a>00380 expected_guid = <a class="code" href="group__DBusInternalsUtils.html#ga9d00d77f6595b9d7ac1baf59d44bf58c" title="Duplicates a string.">_dbus_strdup</a> (expected_guid_orig);
<a name="l00381"></a>00381
<a name="l00382"></a>00382 <span class="keywordflow">if</span> (expected_guid_orig != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a> && expected_guid == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00383"></a>00383 {
<a name="l00384"></a>00384 _DBUS_SET_OOM (error);
<a name="l00385"></a>00385 <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="l00386"></a>00386 }
<a name="l00387"></a>00387
<a name="l00388"></a>00388 <span class="keywordflow">for</span> (i = 0; i < (int) _DBUS_N_ELEMENTS (open_funcs); ++i)
<a name="l00389"></a>00389 {
<a name="l00390"></a>00390 DBusTransportOpenResult result;
<a name="l00391"></a>00391
<a name="l00392"></a>00392 _DBUS_ASSERT_ERROR_IS_CLEAR (&tmp_error);
<a name="l00393"></a>00393 result = (* open_funcs[i].func) (entry, &transport, &tmp_error);
<a name="l00394"></a>00394
<a name="l00395"></a>00395 <span class="keywordflow">switch</span> (result)
<a name="l00396"></a>00396 {
<a name="l00397"></a>00397 <span class="keywordflow">case</span> DBUS_TRANSPORT_OPEN_OK:
<a name="l00398"></a>00398 _DBUS_ASSERT_ERROR_IS_CLEAR (&tmp_error);
<a name="l00399"></a>00399 <span class="keywordflow">goto</span> out;
<a name="l00400"></a>00400 <span class="keywordflow">break</span>;
<a name="l00401"></a>00401 <span class="keywordflow">case</span> DBUS_TRANSPORT_OPEN_NOT_HANDLED:
<a name="l00402"></a>00402 _DBUS_ASSERT_ERROR_IS_CLEAR (&tmp_error);
<a name="l00403"></a>00403 <span class="comment">/* keep going through the loop of open funcs */</span>
<a name="l00404"></a>00404 <span class="keywordflow">break</span>;
<a name="l00405"></a>00405 <span class="keywordflow">case</span> DBUS_TRANSPORT_OPEN_BAD_ADDRESS:
<a name="l00406"></a>00406 _DBUS_ASSERT_ERROR_IS_SET (&tmp_error);
<a name="l00407"></a>00407 <span class="keywordflow">goto</span> out;
<a name="l00408"></a>00408 <span class="keywordflow">break</span>;
<a name="l00409"></a>00409 <span class="keywordflow">case</span> DBUS_TRANSPORT_OPEN_DID_NOT_CONNECT:
<a name="l00410"></a>00410 _DBUS_ASSERT_ERROR_IS_SET (&tmp_error);
<a name="l00411"></a>00411 <span class="keywordflow">goto</span> out;
<a name="l00412"></a>00412 <span class="keywordflow">break</span>;
<a name="l00413"></a>00413 }
<a name="l00414"></a>00414 }
<a name="l00415"></a>00415
<a name="l00416"></a>00416 out:
<a name="l00417"></a>00417
<a name="l00418"></a>00418 <span class="keywordflow">if</span> (transport == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00419"></a>00419 {
<a name="l00420"></a>00420 <span class="keywordflow">if</span> (!<a class="code" href="group__DBusErrors.html#gab0ed62e9fc2685897eb2d41467c89405" title="Checks whether an error occurred (the error is set).">dbus_error_is_set</a> (&tmp_error))
<a name="l00421"></a>00421 <a class="code" href="group__DBusAddressInternals.html#ga5b6409826263c7d62570c56889f7ddb2" title="Sets DBUS_ERROR_BAD_ADDRESS.">_dbus_set_bad_address</a> (&tmp_error,
<a name="l00422"></a>00422 <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="l00423"></a>00423 <span class="stringliteral">"Unknown address type (examples of valid types are \"tcp\" and on UNIX \"unix\")"</span>);
<a name="l00424"></a>00424
<a name="l00425"></a>00425 _DBUS_ASSERT_ERROR_IS_SET (&tmp_error);
<a name="l00426"></a>00426 <a class="code" href="group__DBusErrors.html#ga0a27fb9f1af0c2bfd105d7e8622b93f4" title="Moves an error src into dest, freeing src and overwriting dest.">dbus_move_error</a>(&tmp_error, error);
<a name="l00427"></a>00427 <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> (expected_guid);
<a name="l00428"></a>00428 }
<a name="l00429"></a>00429 <span class="keywordflow">else</span>
<a name="l00430"></a>00430 {
<a name="l00431"></a>00431 _DBUS_ASSERT_ERROR_IS_CLEAR (&tmp_error);
<a name="l00432"></a>00432
<a name="l00433"></a>00433 <span class="comment">/* In the case of autostart the initial guid is NULL</span>
<a name="l00434"></a>00434 <span class="comment"> * and the autostart transport recursively calls</span>
<a name="l00435"></a>00435 <span class="comment"> * _dbus_open_transport wich returns a transport</span>
<a name="l00436"></a>00436 <span class="comment"> * with a guid. That guid is the definitive one.</span>
<a name="l00437"></a>00437 <span class="comment"> *</span>
<a name="l00438"></a>00438 <span class="comment"> * FIXME: if more transports are added they may have</span>
<a name="l00439"></a>00439 <span class="comment"> * an effect on the expected_guid semantics (i.e. </span>
<a name="l00440"></a>00440 <span class="comment"> * expected_guid and transport->expected_guid may</span>
<a name="l00441"></a>00441 <span class="comment"> * both have values). This is very unlikely though</span>
<a name="l00442"></a>00442 <span class="comment"> * we should either throw asserts here for those </span>
<a name="l00443"></a>00443 <span class="comment"> * corner cases or refactor the code so it is </span>
<a name="l00444"></a>00444 <span class="comment"> * clearer on what is expected and what is not</span>
<a name="l00445"></a>00445 <span class="comment"> */</span>
<a name="l00446"></a>00446 <span class="keywordflow">if</span>(expected_guid)
<a name="l00447"></a>00447 transport-><a class="code" href="structDBusTransport.html#aaad7cb51a3e4ff2dd900ac971cc52b36" title="GUID we expect the server to have, NULL on server side or if we don't have an expectation.">expected_guid</a> = expected_guid;
<a name="l00448"></a>00448 }
<a name="l00449"></a>00449
<a name="l00450"></a>00450 <span class="keywordflow">return</span> transport;
<a name="l00451"></a>00451 }
<a name="l00452"></a>00452
<a name="l00459"></a>00459 <a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *
<a name="l00460"></a><a class="code" href="group__DBusTransport.html#ga31d6dbc864c9ea643d72521bbb1b7c56">00460</a> <a class="code" href="group__DBusTransport.html#ga31d6dbc864c9ea643d72521bbb1b7c56" title="Increments the reference count for the transport.">_dbus_transport_ref</a> (<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport)
<a name="l00461"></a>00461 {
<a name="l00462"></a>00462 _dbus_assert (transport-><a class="code" href="structDBusTransport.html#a1a6554a692a353f8402c1419cd94e904" title="Reference count.">refcount</a> > 0);
<a name="l00463"></a>00463
<a name="l00464"></a>00464 transport-><a class="code" href="structDBusTransport.html#a1a6554a692a353f8402c1419cd94e904" title="Reference count.">refcount</a> += 1;
<a name="l00465"></a>00465
<a name="l00466"></a>00466 <span class="keywordflow">return</span> transport;
<a name="l00467"></a>00467 }
<a name="l00468"></a>00468
<a name="l00476"></a>00476 <span class="keywordtype">void</span>
<a name="l00477"></a><a class="code" href="group__DBusTransport.html#gab7c53c32a2320c81aae8ce4345762e73">00477</a> <a class="code" href="group__DBusTransport.html#gab7c53c32a2320c81aae8ce4345762e73" title="Decrements the reference count for the transport.">_dbus_transport_unref</a> (<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport)
<a name="l00478"></a>00478 {
<a name="l00479"></a>00479 _dbus_assert (transport != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l00480"></a>00480 _dbus_assert (transport-><a class="code" href="structDBusTransport.html#a1a6554a692a353f8402c1419cd94e904" title="Reference count.">refcount</a> > 0);
<a name="l00481"></a>00481
<a name="l00482"></a>00482 transport-><a class="code" href="structDBusTransport.html#a1a6554a692a353f8402c1419cd94e904" title="Reference count.">refcount</a> -= 1;
<a name="l00483"></a>00483 <span class="keywordflow">if</span> (transport-><a class="code" href="structDBusTransport.html#a1a6554a692a353f8402c1419cd94e904" title="Reference count.">refcount</a> == 0)
<a name="l00484"></a>00484 {
<a name="l00485"></a>00485 _dbus_verbose (<span class="stringliteral">"finalizing\n"</span>);
<a name="l00486"></a>00486
<a name="l00487"></a>00487 _dbus_assert (transport-><a class="code" href="structDBusTransport.html#a7350850a4e02a7eaa4036eb47d4778e5" title="Virtual methods for this instance.">vtable</a>-><a class="code" href="structDBusTransportVTable.html#a85adba17e1ea7e9a687146908c735dfc" title="The finalize method must free the transport.">finalize</a> != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l00488"></a>00488
<a name="l00489"></a>00489 (* transport-><a class="code" href="structDBusTransport.html#a7350850a4e02a7eaa4036eb47d4778e5" title="Virtual methods for this instance.">vtable</a>-><a class="code" href="structDBusTransportVTable.html#a85adba17e1ea7e9a687146908c735dfc" title="The finalize method must free the transport.">finalize</a>) (transport);
<a name="l00490"></a>00490 }
<a name="l00491"></a>00491 }
<a name="l00492"></a>00492
<a name="l00501"></a>00501 <span class="keywordtype">void</span>
<a name="l00502"></a><a class="code" href="group__DBusTransport.html#ga78444dd8f6c6d6b429433ad81c3e318a">00502</a> <a class="code" href="group__DBusTransport.html#ga78444dd8f6c6d6b429433ad81c3e318a" title="Closes our end of the connection to a remote application.">_dbus_transport_disconnect</a> (<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport)
<a name="l00503"></a>00503 {
<a name="l00504"></a>00504 _dbus_verbose (<span class="stringliteral">"start\n"</span>);
<a name="l00505"></a>00505
<a name="l00506"></a>00506 _dbus_assert (transport-><a class="code" href="structDBusTransport.html#a7350850a4e02a7eaa4036eb47d4778e5" title="Virtual methods for this instance.">vtable</a>-><a class="code" href="structDBusTransportVTable.html#addf39f9f35702bc66dd33c0fd1dcb62c" title="Disconnect this transport.">disconnect</a> != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l00507"></a>00507
<a name="l00508"></a>00508 <span class="keywordflow">if</span> (transport-><a class="code" href="structDBusTransport.html#a487a7375e94efba850f8344a252cfa63" title="TRUE if we are disconnected.">disconnected</a>)
<a name="l00509"></a>00509 <span class="keywordflow">return</span>;
<a name="l00510"></a>00510
<a name="l00511"></a>00511 (* transport-><a class="code" href="structDBusTransport.html#a7350850a4e02a7eaa4036eb47d4778e5" title="Virtual methods for this instance.">vtable</a>-><a class="code" href="structDBusTransportVTable.html#addf39f9f35702bc66dd33c0fd1dcb62c" title="Disconnect this transport.">disconnect</a>) (transport);
<a name="l00512"></a>00512
<a name="l00513"></a>00513 transport-><a class="code" href="structDBusTransport.html#a487a7375e94efba850f8344a252cfa63" title="TRUE if we are disconnected.">disconnected</a> = <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to "1".">TRUE</a>;
<a name="l00514"></a>00514
<a name="l00515"></a>00515 _dbus_verbose (<span class="stringliteral">"end\n"</span>);
<a name="l00516"></a>00516 }
<a name="l00517"></a>00517
<a name="l00526"></a>00526 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l00527"></a><a class="code" href="group__DBusTransport.html#gaceee4b098b0177870ad934daad90a9c6">00527</a> <a class="code" href="group__DBusTransport.html#gaceee4b098b0177870ad934daad90a9c6" title="Returns TRUE if the transport has not been disconnected.">_dbus_transport_get_is_connected</a> (<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport)
<a name="l00528"></a>00528 {
<a name="l00529"></a>00529 <span class="keywordflow">return</span> !transport-><a class="code" href="structDBusTransport.html#a487a7375e94efba850f8344a252cfa63" title="TRUE if we are disconnected.">disconnected</a>;
<a name="l00530"></a>00530 }
<a name="l00531"></a>00531
<a name="l00532"></a>00532 <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="l00533"></a>00533 auth_via_unix_user_function (<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport)
<a name="l00534"></a>00534 {
<a name="l00535"></a>00535 <a class="code" href="structDBusCredentials.html">DBusCredentials</a> *auth_identity;
<a name="l00536"></a>00536 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> allow;
<a name="l00537"></a>00537 <a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection;
<a name="l00538"></a>00538 <a class="code" href="group__DBusConnection.html#ga36419a145848f3b234b3ba5640b0a3d0" title="Called during authentication to check whether the given UNIX user ID is allowed to connect...">DBusAllowUnixUserFunction</a> unix_user_function;
<a name="l00539"></a>00539 <span class="keywordtype">void</span> *unix_user_data;
<a name="l00540"></a>00540 <a class="code" href="group__DBusSysdeps.html#ga186e987b700f9ddc6cea8aa0db82b151" title="A user ID.">dbus_uid_t</a> uid;
<a name="l00541"></a>00541
<a name="l00542"></a>00542 <span class="comment">/* Dropping the lock here probably isn't that safe. */</span>
<a name="l00543"></a>00543
<a name="l00544"></a>00544 auth_identity = <a class="code" href="group__DBusAuth.html#gabfa5450530b999bcb0fabf37c414a80e" title="Gets the identity we authorized the client as.">_dbus_auth_get_identity</a> (transport-><a class="code" href="structDBusTransport.html#acf71c91312f325be13ce6c09298b1eb8" title="Authentication conversation.">auth</a>);
<a name="l00545"></a>00545 _dbus_assert (auth_identity != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l00546"></a>00546
<a name="l00547"></a>00547 connection = transport-><a class="code" href="structDBusTransport.html#a8abdfc9327aa30550982c83b45354651" title="Connection owning this transport.">connection</a>;
<a name="l00548"></a>00548 unix_user_function = transport-><a class="code" href="structDBusTransport.html#ac83be11f3497da6a21aed51782cd68d0" title="Function for checking whether a user is authorized.">unix_user_function</a>;
<a name="l00549"></a>00549 unix_user_data = transport-><a class="code" href="structDBusTransport.html#a7df35abee6aeef69eff659d65dd430f4" title="Data for unix_user_function.">unix_user_data</a>;
<a name="l00550"></a>00550 uid = <a class="code" href="group__DBusCredentials.html#ga462892f995f2932bf0eb3b843407e6d5" title="Gets the UNIX user ID in the credentials, or DBUS_UID_UNSET if the credentials object doesn't contain...">_dbus_credentials_get_unix_uid</a> (auth_identity);
<a name="l00551"></a>00551
<a name="l00552"></a>00552 _dbus_verbose (<span class="stringliteral">"unlock\n"</span>);
<a name="l00553"></a>00553 <a class="code" href="group__DBusConnectionInternals.html#ga3db10d48ec16e485d5a638aacebd4ad2" title="Releases the connection lock.">_dbus_connection_unlock</a> (connection);
<a name="l00554"></a>00554
<a name="l00555"></a>00555 allow = (* unix_user_function) (connection,
<a name="l00556"></a>00556 uid,
<a name="l00557"></a>00557 unix_user_data);
<a name="l00558"></a>00558
<a name="l00559"></a>00559 _dbus_verbose (<span class="stringliteral">"lock post unix user function\n"</span>);
<a name="l00560"></a>00560 <a class="code" href="group__DBusConnectionInternals.html#ga4fe0c8f7b72dc89b9e1a3110db2f778e" title="Acquires the connection lock.">_dbus_connection_lock</a> (connection);
<a name="l00561"></a>00561
<a name="l00562"></a>00562 <span class="keywordflow">if</span> (allow)
<a name="l00563"></a>00563 {
<a name="l00564"></a>00564 _dbus_verbose (<span class="stringliteral">"Client UID "</span><a class="code" href="group__DBusSysdeps.html#gab657f0434f01b463891942f373f7b4a1" title="an appropriate printf format for dbus_uid_t">DBUS_UID_FORMAT</a><span class="stringliteral">" authorized\n"</span>, uid);
<a name="l00565"></a>00565 }
<a name="l00566"></a>00566 <span class="keywordflow">else</span>
<a name="l00567"></a>00567 {
<a name="l00568"></a>00568 _dbus_verbose (<span class="stringliteral">"Client UID "</span><a class="code" href="group__DBusSysdeps.html#gab657f0434f01b463891942f373f7b4a1" title="an appropriate printf format for dbus_uid_t">DBUS_UID_FORMAT</a>
<a name="l00569"></a>00569 <span class="stringliteral">" was rejected, disconnecting\n"</span>,
<a name="l00570"></a>00570 <a class="code" href="group__DBusCredentials.html#ga462892f995f2932bf0eb3b843407e6d5" title="Gets the UNIX user ID in the credentials, or DBUS_UID_UNSET if the credentials object doesn't contain...">_dbus_credentials_get_unix_uid</a> (auth_identity));
<a name="l00571"></a>00571 <a class="code" href="group__DBusTransport.html#ga78444dd8f6c6d6b429433ad81c3e318a" title="Closes our end of the connection to a remote application.">_dbus_transport_disconnect</a> (transport);
<a name="l00572"></a>00572 }
<a name="l00573"></a>00573
<a name="l00574"></a>00574 <span class="keywordflow">return</span> allow;
<a name="l00575"></a>00575 }
<a name="l00576"></a>00576
<a name="l00577"></a>00577 <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="l00578"></a>00578 auth_via_windows_user_function (<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport)
<a name="l00579"></a>00579 {
<a name="l00580"></a>00580 <a class="code" href="structDBusCredentials.html">DBusCredentials</a> *auth_identity;
<a name="l00581"></a>00581 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> allow;
<a name="l00582"></a>00582 <a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection;
<a name="l00583"></a>00583 <a class="code" href="group__DBusConnection.html#ga47436366726762688036c600d651bab6" title="Called during authentication to check whether the given Windows user ID is allowed to connect...">DBusAllowWindowsUserFunction</a> windows_user_function;
<a name="l00584"></a>00584 <span class="keywordtype">void</span> *windows_user_data;
<a name="l00585"></a>00585 <span class="keywordtype">char</span> *windows_sid;
<a name="l00586"></a>00586
<a name="l00587"></a>00587 <span class="comment">/* Dropping the lock here probably isn't that safe. */</span>
<a name="l00588"></a>00588
<a name="l00589"></a>00589 auth_identity = <a class="code" href="group__DBusAuth.html#gabfa5450530b999bcb0fabf37c414a80e" title="Gets the identity we authorized the client as.">_dbus_auth_get_identity</a> (transport-><a class="code" href="structDBusTransport.html#acf71c91312f325be13ce6c09298b1eb8" title="Authentication conversation.">auth</a>);
<a name="l00590"></a>00590 _dbus_assert (auth_identity != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l00591"></a>00591
<a name="l00592"></a>00592 connection = transport-><a class="code" href="structDBusTransport.html#a8abdfc9327aa30550982c83b45354651" title="Connection owning this transport.">connection</a>;
<a name="l00593"></a>00593 windows_user_function = transport-><a class="code" href="structDBusTransport.html#a17403591c2a1d936be5ed13a36e6416a" title="Function for checking whether a user is authorized.">windows_user_function</a>;
<a name="l00594"></a>00594 windows_user_data = transport-><a class="code" href="structDBusTransport.html#a7df35abee6aeef69eff659d65dd430f4" title="Data for unix_user_function.">unix_user_data</a>;
<a name="l00595"></a>00595 windows_sid = <a class="code" href="group__DBusInternalsUtils.html#ga9d00d77f6595b9d7ac1baf59d44bf58c" title="Duplicates a string.">_dbus_strdup</a> (<a class="code" href="group__DBusCredentials.html#ga53680e02140559fb36efeec68d398ac0" title="Gets the Windows user SID in the credentials, or NULL if the credentials object doesn't contain a Win...">_dbus_credentials_get_windows_sid</a> (auth_identity));
<a name="l00596"></a>00596
<a name="l00597"></a>00597 <span class="keywordflow">if</span> (windows_sid == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00598"></a>00598 {
<a name="l00599"></a>00599 <span class="comment">/* OOM */</span>
<a name="l00600"></a>00600 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to "0".">FALSE</a>;
<a name="l00601"></a>00601 }
<a name="l00602"></a>00602
<a name="l00603"></a>00603 _dbus_verbose (<span class="stringliteral">"unlock\n"</span>);
<a name="l00604"></a>00604 <a class="code" href="group__DBusConnectionInternals.html#ga3db10d48ec16e485d5a638aacebd4ad2" title="Releases the connection lock.">_dbus_connection_unlock</a> (connection);
<a name="l00605"></a>00605
<a name="l00606"></a>00606 allow = (* windows_user_function) (connection,
<a name="l00607"></a>00607 windows_sid,
<a name="l00608"></a>00608 windows_user_data);
<a name="l00609"></a>00609
<a name="l00610"></a>00610 _dbus_verbose (<span class="stringliteral">"lock post windows user function\n"</span>);
<a name="l00611"></a>00611 <a class="code" href="group__DBusConnectionInternals.html#ga4fe0c8f7b72dc89b9e1a3110db2f778e" title="Acquires the connection lock.">_dbus_connection_lock</a> (connection);
<a name="l00612"></a>00612
<a name="l00613"></a>00613 <span class="keywordflow">if</span> (allow)
<a name="l00614"></a>00614 {
<a name="l00615"></a>00615 _dbus_verbose (<span class="stringliteral">"Client SID '%s' authorized\n"</span>, windows_sid);
<a name="l00616"></a>00616 }
<a name="l00617"></a>00617 <span class="keywordflow">else</span>
<a name="l00618"></a>00618 {
<a name="l00619"></a>00619 _dbus_verbose (<span class="stringliteral">"Client SID '%s' was rejected, disconnecting\n"</span>,
<a name="l00620"></a>00620 <a class="code" href="group__DBusCredentials.html#ga53680e02140559fb36efeec68d398ac0" title="Gets the Windows user SID in the credentials, or NULL if the credentials object doesn't contain a Win...">_dbus_credentials_get_windows_sid</a> (auth_identity));
<a name="l00621"></a>00621 <a class="code" href="group__DBusTransport.html#ga78444dd8f6c6d6b429433ad81c3e318a" title="Closes our end of the connection to a remote application.">_dbus_transport_disconnect</a> (transport);
<a name="l00622"></a>00622 }
<a name="l00623"></a>00623
<a name="l00624"></a>00624 <span class="keywordflow">return</span> allow;
<a name="l00625"></a>00625 }
<a name="l00626"></a>00626
<a name="l00627"></a>00627 <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="l00628"></a>00628 auth_via_default_rules (<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport)
<a name="l00629"></a>00629 {
<a name="l00630"></a>00630 <a class="code" href="structDBusCredentials.html">DBusCredentials</a> *auth_identity;
<a name="l00631"></a>00631 <a class="code" href="structDBusCredentials.html">DBusCredentials</a> *our_identity;
<a name="l00632"></a>00632 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> allow;
<a name="l00633"></a>00633
<a name="l00634"></a>00634 auth_identity = <a class="code" href="group__DBusAuth.html#gabfa5450530b999bcb0fabf37c414a80e" title="Gets the identity we authorized the client as.">_dbus_auth_get_identity</a> (transport-><a class="code" href="structDBusTransport.html#acf71c91312f325be13ce6c09298b1eb8" title="Authentication conversation.">auth</a>);
<a name="l00635"></a>00635 _dbus_assert (auth_identity != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l00636"></a>00636
<a name="l00637"></a>00637 <span class="comment">/* By default, connection is allowed if the client is 1) root or 2)</span>
<a name="l00638"></a>00638 <span class="comment"> * has the same UID as us or 3) anonymous is allowed.</span>
<a name="l00639"></a>00639 <span class="comment"> */</span>
<a name="l00640"></a>00640
<a name="l00641"></a>00641 our_identity = <a class="code" href="group__DBusCredentials.html#ga63b2f88e91962510ed947bae98270818" title="Creates a new object with credentials (user ID and process ID) from the current process.">_dbus_credentials_new_from_current_process</a> ();
<a name="l00642"></a>00642 <span class="keywordflow">if</span> (our_identity == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00643"></a>00643 {
<a name="l00644"></a>00644 <span class="comment">/* OOM */</span>
<a name="l00645"></a>00645 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to "0".">FALSE</a>;
<a name="l00646"></a>00646 }
<a name="l00647"></a>00647
<a name="l00648"></a>00648 <span class="keywordflow">if</span> (transport-><a class="code" href="structDBusTransport.html#a30a82ca7826ef4735a5caa4c921ec014" title="TRUE if an anonymous client can connect">allow_anonymous</a> ||
<a name="l00649"></a>00649 <a class="code" href="group__DBusCredentials.html#ga462892f995f2932bf0eb3b843407e6d5" title="Gets the UNIX user ID in the credentials, or DBUS_UID_UNSET if the credentials object doesn't contain...">_dbus_credentials_get_unix_uid</a> (auth_identity) == 0 ||
<a name="l00650"></a>00650 <a class="code" href="group__DBusCredentials.html#ga2f10263b80ff6611c15a78e8f6823dfa" title="Check whether the user-identifying credentials in two credentials objects are identical.">_dbus_credentials_same_user</a> (our_identity,
<a name="l00651"></a>00651 auth_identity))
<a name="l00652"></a>00652 {
<a name="l00653"></a>00653 <span class="keywordflow">if</span> (<a class="code" href="group__DBusCredentials.html#ga0fb8d13878e126ccc243c4a30fd8598c" title="Checks whether the given credential is present.">_dbus_credentials_include</a>(our_identity,DBUS_CREDENTIAL_WINDOWS_SID))
<a name="l00654"></a>00654 _dbus_verbose (<span class="stringliteral">"Client authorized as SID '%s'"</span>
<a name="l00655"></a>00655 <span class="stringliteral">"matching our SID '%s'\n"</span>,
<a name="l00656"></a>00656 <a class="code" href="group__DBusCredentials.html#ga53680e02140559fb36efeec68d398ac0" title="Gets the Windows user SID in the credentials, or NULL if the credentials object doesn't contain a Win...">_dbus_credentials_get_windows_sid</a>(auth_identity),
<a name="l00657"></a>00657 <a class="code" href="group__DBusCredentials.html#ga53680e02140559fb36efeec68d398ac0" title="Gets the Windows user SID in the credentials, or NULL if the credentials object doesn't contain a Win...">_dbus_credentials_get_windows_sid</a>(our_identity));
<a name="l00658"></a>00658 <span class="keywordflow">else</span>
<a name="l00659"></a>00659 _dbus_verbose (<span class="stringliteral">"Client authorized as UID "</span><a class="code" href="group__DBusSysdeps.html#gab657f0434f01b463891942f373f7b4a1" title="an appropriate printf format for dbus_uid_t">DBUS_UID_FORMAT</a>
<a name="l00660"></a>00660 <span class="stringliteral">" matching our UID "</span><a class="code" href="group__DBusSysdeps.html#gab657f0434f01b463891942f373f7b4a1" title="an appropriate printf format for dbus_uid_t">DBUS_UID_FORMAT</a><span class="stringliteral">"\n"</span>,
<a name="l00661"></a>00661 <a class="code" href="group__DBusCredentials.html#ga462892f995f2932bf0eb3b843407e6d5" title="Gets the UNIX user ID in the credentials, or DBUS_UID_UNSET if the credentials object doesn't contain...">_dbus_credentials_get_unix_uid</a>(auth_identity),
<a name="l00662"></a>00662 <a class="code" href="group__DBusCredentials.html#ga462892f995f2932bf0eb3b843407e6d5" title="Gets the UNIX user ID in the credentials, or DBUS_UID_UNSET if the credentials object doesn't contain...">_dbus_credentials_get_unix_uid</a>(our_identity));
<a name="l00663"></a>00663 <span class="comment">/* We have authenticated! */</span>
<a name="l00664"></a>00664 allow = <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to "1".">TRUE</a>;
<a name="l00665"></a>00665 }
<a name="l00666"></a>00666 <span class="keywordflow">else</span>
<a name="l00667"></a>00667 {
<a name="l00668"></a>00668 <span class="keywordflow">if</span> (<a class="code" href="group__DBusCredentials.html#ga0fb8d13878e126ccc243c4a30fd8598c" title="Checks whether the given credential is present.">_dbus_credentials_include</a>(our_identity,DBUS_CREDENTIAL_WINDOWS_SID))
<a name="l00669"></a>00669 _dbus_verbose (<span class="stringliteral">"Client authorized as SID '%s'"</span>
<a name="l00670"></a>00670 <span class="stringliteral">" but our SID is '%s', disconnecting\n"</span>,
<a name="l00671"></a>00671 (<a class="code" href="group__DBusCredentials.html#ga53680e02140559fb36efeec68d398ac0" title="Gets the Windows user SID in the credentials, or NULL if the credentials object doesn't contain a Win...">_dbus_credentials_get_windows_sid</a>(auth_identity) ?
<a name="l00672"></a>00672 <a class="code" href="group__DBusCredentials.html#ga53680e02140559fb36efeec68d398ac0" title="Gets the Windows user SID in the credentials, or NULL if the credentials object doesn't contain a Win...">_dbus_credentials_get_windows_sid</a>(auth_identity) : <span class="stringliteral">"<null>"</span>),
<a name="l00673"></a>00673 (<a class="code" href="group__DBusCredentials.html#ga53680e02140559fb36efeec68d398ac0" title="Gets the Windows user SID in the credentials, or NULL if the credentials object doesn't contain a Win...">_dbus_credentials_get_windows_sid</a>(our_identity) ?
<a name="l00674"></a>00674 <a class="code" href="group__DBusCredentials.html#ga53680e02140559fb36efeec68d398ac0" title="Gets the Windows user SID in the credentials, or NULL if the credentials object doesn't contain a Win...">_dbus_credentials_get_windows_sid</a>(our_identity) : <span class="stringliteral">"<null>"</span>));
<a name="l00675"></a>00675 <span class="keywordflow">else</span>
<a name="l00676"></a>00676 _dbus_verbose (<span class="stringliteral">"Client authorized as UID "</span>DBUS_UID_FORMAT
<a name="l00677"></a>00677 <span class="stringliteral">" but our UID is "</span>DBUS_UID_FORMAT<span class="stringliteral">", disconnecting\n"</span>,
<a name="l00678"></a>00678 <a class="code" href="group__DBusCredentials.html#ga462892f995f2932bf0eb3b843407e6d5" title="Gets the UNIX user ID in the credentials, or DBUS_UID_UNSET if the credentials object doesn't contain...">_dbus_credentials_get_unix_uid</a>(auth_identity),
<a name="l00679"></a>00679 <a class="code" href="group__DBusCredentials.html#ga462892f995f2932bf0eb3b843407e6d5" title="Gets the UNIX user ID in the credentials, or DBUS_UID_UNSET if the credentials object doesn't contain...">_dbus_credentials_get_unix_uid</a>(our_identity));
<a name="l00680"></a>00680 <a class="code" href="group__DBusTransport.html#ga78444dd8f6c6d6b429433ad81c3e318a" title="Closes our end of the connection to a remote application.">_dbus_transport_disconnect</a> (transport);
<a name="l00681"></a>00681 allow = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to "0".">FALSE</a>;
<a name="l00682"></a>00682 }
<a name="l00683"></a>00683
<a name="l00684"></a>00684 <a class="code" href="group__DBusCredentials.html#ga89913c830c3627cd006a50ca693af580" title="Decrement refcount on credentials.">_dbus_credentials_unref</a> (our_identity);
<a name="l00685"></a>00685
<a name="l00686"></a>00686 <span class="keywordflow">return</span> allow;
<a name="l00687"></a>00687 }
<a name="l00688"></a>00688
<a name="l00700"></a>00700 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l00701"></a><a class="code" href="group__DBusTransport.html#ga59ed246ec0ef9c64bc4684fc17726c1d">00701</a> <a class="code" href="group__DBusTransport.html#ga59ed246ec0ef9c64bc4684fc17726c1d" title="Returns TRUE if we have been authenticated.">_dbus_transport_peek_is_authenticated</a> (<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport)
<a name="l00702"></a>00702 {
<a name="l00703"></a>00703 <span class="keywordflow">return</span> transport-><a class="code" href="structDBusTransport.html#a12d3052e51b2f0bf398d48e31e5f9da8" title="Cache of auth state; use _dbus_transport_peek_is_authenticated() to query value.">authenticated</a>;
<a name="l00704"></a>00704 }
<a name="l00705"></a>00705
<a name="l00723"></a>00723 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l00724"></a><a class="code" href="group__DBusTransport.html#gabe774b134a4bf8c8fc09e6186470874f">00724</a> <a class="code" href="group__DBusTransport.html#gabe774b134a4bf8c8fc09e6186470874f" title="Returns TRUE if we have been authenticated.">_dbus_transport_try_to_authenticate</a> (<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport)
<a name="l00725"></a>00725 {
<a name="l00726"></a>00726 <span class="keywordflow">if</span> (transport-><a class="code" href="structDBusTransport.html#a12d3052e51b2f0bf398d48e31e5f9da8" title="Cache of auth state; use _dbus_transport_peek_is_authenticated() to query value.">authenticated</a>)
<a name="l00727"></a>00727 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to "1".">TRUE</a>;
<a name="l00728"></a>00728 <span class="keywordflow">else</span>
<a name="l00729"></a>00729 {
<a name="l00730"></a>00730 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> maybe_authenticated;
<a name="l00731"></a>00731
<a name="l00732"></a>00732 <span class="keywordflow">if</span> (transport-><a class="code" href="structDBusTransport.html#a487a7375e94efba850f8344a252cfa63" title="TRUE if we are disconnected.">disconnected</a>)
<a name="l00733"></a>00733 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to "0".">FALSE</a>;
<a name="l00734"></a>00734
<a name="l00735"></a>00735 <span class="comment">/* paranoia ref since we call user callbacks sometimes */</span>
<a name="l00736"></a>00736 <a class="code" href="group__DBusConnectionInternals.html#ga7151f75b5d2308ec80cfe893aba72aa1" title="Increments the reference count of a DBusConnection.">_dbus_connection_ref_unlocked</a> (transport-><a class="code" href="structDBusTransport.html#a8abdfc9327aa30550982c83b45354651" title="Connection owning this transport.">connection</a>);
<a name="l00737"></a>00737
<a name="l00738"></a>00738 maybe_authenticated =
<a name="l00739"></a>00739 (!(transport-><a class="code" href="structDBusTransport.html#a7d91848b94203022be1090d93dd2cd04" title="TRUE if we need to send credentials">send_credentials_pending</a> ||
<a name="l00740"></a>00740 transport-><a class="code" href="structDBusTransport.html#aaa29089fbb1fbdb5b412b3ed18c84b2d" title="TRUE if we need to receive credentials">receive_credentials_pending</a>));
<a name="l00741"></a>00741
<a name="l00742"></a>00742 <span class="keywordflow">if</span> (maybe_authenticated)
<a name="l00743"></a>00743 {
<a name="l00744"></a>00744 <span class="keywordflow">switch</span> (<a class="code" href="group__DBusAuth.html#ga097c71f7f20b749275c6b31cd98623f5" title="Analyzes buffered input and moves the auth conversation forward, returning the new state of the auth ...">_dbus_auth_do_work</a> (transport-><a class="code" href="structDBusTransport.html#acf71c91312f325be13ce6c09298b1eb8" title="Authentication conversation.">auth</a>))
<a name="l00745"></a>00745 {
<a name="l00746"></a>00746 <span class="keywordflow">case</span> DBUS_AUTH_STATE_AUTHENTICATED:
<a name="l00747"></a>00747 <span class="comment">/* leave as maybe_authenticated */</span>
<a name="l00748"></a>00748 <span class="keywordflow">break</span>;
<a name="l00749"></a>00749 <span class="keywordflow">default</span>:
<a name="l00750"></a>00750 maybe_authenticated = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to "0".">FALSE</a>;
<a name="l00751"></a>00751 }
<a name="l00752"></a>00752 }
<a name="l00753"></a>00753
<a name="l00754"></a>00754 <span class="comment">/* If we're the client, verify the GUID</span>
<a name="l00755"></a>00755 <span class="comment"> */</span>
<a name="l00756"></a>00756 <span class="keywordflow">if</span> (maybe_authenticated && !transport-><a class="code" href="structDBusTransport.html#a38fa70b1473eb08a6c871c7791b46d6e" title="TRUE if on the server side">is_server</a>)
<a name="l00757"></a>00757 {
<a name="l00758"></a>00758 <span class="keyword">const</span> <span class="keywordtype">char</span> *server_guid;
<a name="l00759"></a>00759
<a name="l00760"></a>00760 server_guid = <a class="code" href="group__DBusAuth.html#gad0bf394093dd9ac43ebf71a5f35a4f3f" title="Gets the GUID from the server if we've authenticated; gets NULL otherwise.">_dbus_auth_get_guid_from_server</a> (transport-><a class="code" href="structDBusTransport.html#acf71c91312f325be13ce6c09298b1eb8" title="Authentication conversation.">auth</a>);
<a name="l00761"></a>00761 _dbus_assert (server_guid != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l00762"></a>00762
<a name="l00763"></a>00763 <span class="keywordflow">if</span> (transport-><a class="code" href="structDBusTransport.html#aaad7cb51a3e4ff2dd900ac971cc52b36" title="GUID we expect the server to have, NULL on server side or if we don't have an expectation.">expected_guid</a> &&
<a name="l00764"></a>00764 strcmp (transport-><a class="code" href="structDBusTransport.html#aaad7cb51a3e4ff2dd900ac971cc52b36" title="GUID we expect the server to have, NULL on server side or if we don't have an expectation.">expected_guid</a>, server_guid) != 0)
<a name="l00765"></a>00765 {
<a name="l00766"></a>00766 _dbus_verbose (<span class="stringliteral">"Client expected GUID '%s' and we got '%s' from the server\n"</span>,
<a name="l00767"></a>00767 transport-><a class="code" href="structDBusTransport.html#aaad7cb51a3e4ff2dd900ac971cc52b36" title="GUID we expect the server to have, NULL on server side or if we don't have an expectation.">expected_guid</a>, server_guid);
<a name="l00768"></a>00768 <a class="code" href="group__DBusTransport.html#ga78444dd8f6c6d6b429433ad81c3e318a" title="Closes our end of the connection to a remote application.">_dbus_transport_disconnect</a> (transport);
<a name="l00769"></a>00769 <a class="code" href="group__DBusConnectionInternals.html#ga9ffbd9aa4f07cb30d92887e956a9fd43" title="Decrements the reference count of a DBusConnection.">_dbus_connection_unref_unlocked</a> (transport-><a class="code" href="structDBusTransport.html#a8abdfc9327aa30550982c83b45354651" title="Connection owning this transport.">connection</a>);
<a name="l00770"></a>00770 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to "0".">FALSE</a>;
<a name="l00771"></a>00771 }
<a name="l00772"></a>00772 }
<a name="l00773"></a>00773
<a name="l00774"></a>00774 <span class="comment">/* If we're the server, see if we want to allow this identity to proceed.</span>
<a name="l00775"></a>00775 <span class="comment"> */</span>
<a name="l00776"></a>00776 <span class="keywordflow">if</span> (maybe_authenticated && transport-><a class="code" href="structDBusTransport.html#a38fa70b1473eb08a6c871c7791b46d6e" title="TRUE if on the server side">is_server</a>)
<a name="l00777"></a>00777 {
<a name="l00778"></a>00778 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> allow;
<a name="l00779"></a>00779 <a class="code" href="structDBusCredentials.html">DBusCredentials</a> *auth_identity;
<a name="l00780"></a>00780
<a name="l00781"></a>00781 auth_identity = <a class="code" href="group__DBusAuth.html#gabfa5450530b999bcb0fabf37c414a80e" title="Gets the identity we authorized the client as.">_dbus_auth_get_identity</a> (transport-><a class="code" href="structDBusTransport.html#acf71c91312f325be13ce6c09298b1eb8" title="Authentication conversation.">auth</a>);
<a name="l00782"></a>00782 _dbus_assert (auth_identity != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l00783"></a>00783
<a name="l00784"></a>00784 <span class="comment">/* If we have an auth'd user and a user function, delegate</span>
<a name="l00785"></a>00785 <span class="comment"> * deciding whether auth credentials are good enough to the</span>
<a name="l00786"></a>00786 <span class="comment"> * app; otherwise, use our default decision process.</span>
<a name="l00787"></a>00787 <span class="comment"> */</span>
<a name="l00788"></a>00788 <span class="keywordflow">if</span> (transport-><a class="code" href="structDBusTransport.html#ac83be11f3497da6a21aed51782cd68d0" title="Function for checking whether a user is authorized.">unix_user_function</a> != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a> &&
<a name="l00789"></a>00789 <a class="code" href="group__DBusCredentials.html#ga0fb8d13878e126ccc243c4a30fd8598c" title="Checks whether the given credential is present.">_dbus_credentials_include</a> (auth_identity, DBUS_CREDENTIAL_UNIX_USER_ID))
<a name="l00790"></a>00790 {
<a name="l00791"></a>00791 allow = auth_via_unix_user_function (transport);
<a name="l00792"></a>00792 }
<a name="l00793"></a>00793 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (transport-><a class="code" href="structDBusTransport.html#a17403591c2a1d936be5ed13a36e6416a" title="Function for checking whether a user is authorized.">windows_user_function</a> != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a> &&
<a name="l00794"></a>00794 <a class="code" href="group__DBusCredentials.html#ga0fb8d13878e126ccc243c4a30fd8598c" title="Checks whether the given credential is present.">_dbus_credentials_include</a> (auth_identity, DBUS_CREDENTIAL_WINDOWS_SID))
<a name="l00795"></a>00795 {
<a name="l00796"></a>00796 allow = auth_via_windows_user_function (transport);
<a name="l00797"></a>00797 }
<a name="l00798"></a>00798 <span class="keywordflow">else</span>
<a name="l00799"></a>00799 {
<a name="l00800"></a>00800 allow = auth_via_default_rules (transport);
<a name="l00801"></a>00801 }
<a name="l00802"></a>00802
<a name="l00803"></a>00803 <span class="keywordflow">if</span> (!allow)
<a name="l00804"></a>00804 maybe_authenticated = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to "0".">FALSE</a>;
<a name="l00805"></a>00805 }
<a name="l00806"></a>00806
<a name="l00807"></a>00807 transport-><a class="code" href="structDBusTransport.html#a12d3052e51b2f0bf398d48e31e5f9da8" title="Cache of auth state; use _dbus_transport_peek_is_authenticated() to query value.">authenticated</a> = maybe_authenticated;
<a name="l00808"></a>00808
<a name="l00809"></a>00809 <a class="code" href="group__DBusConnectionInternals.html#ga9ffbd9aa4f07cb30d92887e956a9fd43" title="Decrements the reference count of a DBusConnection.">_dbus_connection_unref_unlocked</a> (transport-><a class="code" href="structDBusTransport.html#a8abdfc9327aa30550982c83b45354651" title="Connection owning this transport.">connection</a>);
<a name="l00810"></a>00810 <span class="keywordflow">return</span> maybe_authenticated;
<a name="l00811"></a>00811 }
<a name="l00812"></a>00812 }
<a name="l00813"></a>00813
<a name="l00820"></a>00820 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l00821"></a><a class="code" href="group__DBusTransport.html#gaf0588dd4a6d1c556dd885d4c67622399">00821</a> <a class="code" href="group__DBusTransport.html#gaf0588dd4a6d1c556dd885d4c67622399" title="See dbus_connection_get_is_anonymous().">_dbus_transport_get_is_anonymous</a> (<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport)
<a name="l00822"></a>00822 {
<a name="l00823"></a>00823 <a class="code" href="structDBusCredentials.html">DBusCredentials</a> *auth_identity;
<a name="l00824"></a>00824
<a name="l00825"></a>00825 <span class="keywordflow">if</span> (!transport-><a class="code" href="structDBusTransport.html#a12d3052e51b2f0bf398d48e31e5f9da8" title="Cache of auth state; use _dbus_transport_peek_is_authenticated() to query value.">authenticated</a>)
<a name="l00826"></a>00826 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to "1".">TRUE</a>;
<a name="l00827"></a>00827
<a name="l00828"></a>00828 auth_identity = <a class="code" href="group__DBusAuth.html#gabfa5450530b999bcb0fabf37c414a80e" title="Gets the identity we authorized the client as.">_dbus_auth_get_identity</a> (transport-><a class="code" href="structDBusTransport.html#acf71c91312f325be13ce6c09298b1eb8" title="Authentication conversation.">auth</a>);
<a name="l00829"></a>00829
<a name="l00830"></a>00830 <span class="keywordflow">if</span> (<a class="code" href="group__DBusCredentials.html#gabfd7a1f681a91b45ba2f4e7461131827" title="Checks whether a credentials object contains a user identity.">_dbus_credentials_are_anonymous</a> (auth_identity))
<a name="l00831"></a>00831 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to "1".">TRUE</a>;
<a name="l00832"></a>00832 <span class="keywordflow">else</span>
<a name="l00833"></a>00833 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to "0".">FALSE</a>;
<a name="l00834"></a>00834 }
<a name="l00835"></a>00835
<a name="l00842"></a>00842 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l00843"></a><a class="code" href="group__DBusTransport.html#gab98dc7cad59472a4513489628f1393f1">00843</a> <a class="code" href="group__DBusTransport.html#gab98dc7cad59472a4513489628f1393f1" title="Returns TRUE if the transport supports sending unix fds.">_dbus_transport_can_pass_unix_fd</a>(<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport)
<a name="l00844"></a>00844 {
<a name="l00845"></a>00845 <span class="keywordflow">return</span> DBUS_TRANSPORT_CAN_SEND_UNIX_FD(transport);
<a name="l00846"></a>00846 }
<a name="l00847"></a>00847
<a name="l00855"></a>00855 <span class="keyword">const</span> <span class="keywordtype">char</span>*
<a name="l00856"></a><a class="code" href="group__DBusTransport.html#gac7e53868392b5e550454f47a1bc0a737">00856</a> <a class="code" href="group__DBusTransport.html#gac7e53868392b5e550454f47a1bc0a737" title="Gets the address of a transport.">_dbus_transport_get_address</a> (<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport)
<a name="l00857"></a>00857 {
<a name="l00858"></a>00858 <span class="keywordflow">return</span> transport-><a class="code" href="structDBusTransport.html#a586180e57d80c428fc81e579d9159cb2" title="Address of the server we are connecting to (NULL for the server side of a transport)">address</a>;
<a name="l00859"></a>00859 }
<a name="l00860"></a>00860
<a name="l00868"></a>00868 <span class="keyword">const</span> <span class="keywordtype">char</span>*
<a name="l00869"></a><a class="code" href="group__DBusTransport.html#ga920abde00e77a970330fa3fc552fe7ea">00869</a> <a class="code" href="group__DBusTransport.html#ga920abde00e77a970330fa3fc552fe7ea" title="Gets the id of the server we are connected to (see dbus_server_get_id()).">_dbus_transport_get_server_id</a> (<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport)
<a name="l00870"></a>00870 {
<a name="l00871"></a>00871 <span class="keywordflow">if</span> (transport-><a class="code" href="structDBusTransport.html#a38fa70b1473eb08a6c871c7791b46d6e" title="TRUE if on the server side">is_server</a>)
<a name="l00872"></a>00872 <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="l00873"></a>00873 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (transport-><a class="code" href="structDBusTransport.html#a12d3052e51b2f0bf398d48e31e5f9da8" title="Cache of auth state; use _dbus_transport_peek_is_authenticated() to query value.">authenticated</a>)
<a name="l00874"></a>00874 <span class="keywordflow">return</span> <a class="code" href="group__DBusAuth.html#gad0bf394093dd9ac43ebf71a5f35a4f3f" title="Gets the GUID from the server if we've authenticated; gets NULL otherwise.">_dbus_auth_get_guid_from_server</a> (transport-><a class="code" href="structDBusTransport.html#acf71c91312f325be13ce6c09298b1eb8" title="Authentication conversation.">auth</a>);
<a name="l00875"></a>00875 <span class="keywordflow">else</span>
<a name="l00876"></a>00876 <span class="keywordflow">return</span> transport-><a class="code" href="structDBusTransport.html#aaad7cb51a3e4ff2dd900ac971cc52b36" title="GUID we expect the server to have, NULL on server side or if we don't have an expectation.">expected_guid</a>;
<a name="l00877"></a>00877 }
<a name="l00878"></a>00878
<a name="l00888"></a>00888 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l00889"></a><a class="code" href="group__DBusTransport.html#ga4a010098fe079eb6f201ff034d15fdff">00889</a> <a class="code" href="group__DBusTransport.html#ga4a010098fe079eb6f201ff034d15fdff" title="Handles a watch by reading data, writing data, or disconnecting the transport, as appropriate for the...">_dbus_transport_handle_watch</a> (<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport,
<a name="l00890"></a>00890 <a class="code" href="structDBusWatch.html" title="Implementation of DBusWatch.">DBusWatch</a> *watch,
<a name="l00891"></a>00891 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> condition)
<a name="l00892"></a>00892 {
<a name="l00893"></a>00893 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> retval;
<a name="l00894"></a>00894
<a name="l00895"></a>00895 _dbus_assert (transport-><a class="code" href="structDBusTransport.html#a7350850a4e02a7eaa4036eb47d4778e5" title="Virtual methods for this instance.">vtable</a>-><a class="code" href="structDBusTransportVTable.html#ad7e364d129b6921b0c7b554e29d395f5" title="The handle_watch method handles reading/writing data as indicated by the flags.">handle_watch</a> != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l00896"></a>00896
<a name="l00897"></a>00897 <span class="keywordflow">if</span> (transport-><a class="code" href="structDBusTransport.html#a487a7375e94efba850f8344a252cfa63" title="TRUE if we are disconnected.">disconnected</a>)
<a name="l00898"></a>00898 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to "1".">TRUE</a>;
<a name="l00899"></a>00899
<a name="l00900"></a>00900 <span class="keywordflow">if</span> (<a class="code" href="group__DBusWatch.html#ga91308f393d41b31babda17c83833517f" title="Returns a socket to be watched, on UNIX this will return -1 if our transport is not socket-based so d...">dbus_watch_get_socket</a> (watch) < 0)
<a name="l00901"></a>00901 {
<a name="l00902"></a>00902 <a class="code" href="group__DBusInternalsUtils.html#ga63f2f8a068454b781f214ba596e313b4" title="Prints a "critical" warning to stderr when an assertion fails; differs from _dbus_warn primarily in t...">_dbus_warn_check_failed</a> (<span class="stringliteral">"Tried to handle an invalidated watch; this watch should have been removed\n"</span>);
<a name="l00903"></a>00903 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to "1".">TRUE</a>;
<a name="l00904"></a>00904 }
<a name="l00905"></a>00905
<a name="l00906"></a>00906 <a class="code" href="group__DBusWatchInternals.html#gab8f49926fe9ee56cb4ae7c1c8071cca3" title="Sanitizes the given condition so that it only contains flags that the DBusWatch requested.">_dbus_watch_sanitize_condition</a> (watch, &condition);
<a name="l00907"></a>00907
<a name="l00908"></a>00908 <a class="code" href="group__DBusTransport.html#ga31d6dbc864c9ea643d72521bbb1b7c56" title="Increments the reference count for the transport.">_dbus_transport_ref</a> (transport);
<a name="l00909"></a>00909 <a class="code" href="group__DBusWatchInternals.html#ga0db8530cc53589589d67dfb35d03db61" title="Increments the reference count of a DBusWatch object.">_dbus_watch_ref</a> (watch);
<a name="l00910"></a>00910 retval = (* transport-><a class="code" href="structDBusTransport.html#a7350850a4e02a7eaa4036eb47d4778e5" title="Virtual methods for this instance.">vtable</a>-><a class="code" href="structDBusTransportVTable.html#ad7e364d129b6921b0c7b554e29d395f5" title="The handle_watch method handles reading/writing data as indicated by the flags.">handle_watch</a>) (transport, watch, condition);
<a name="l00911"></a>00911 <a class="code" href="group__DBusWatchInternals.html#ga7d27dfc13a3ccfbaa99ceab331bb46f0" title="Decrements the reference count of a DBusWatch object and finalizes the object if the count reaches ze...">_dbus_watch_unref</a> (watch);
<a name="l00912"></a>00912 <a class="code" href="group__DBusTransport.html#gab7c53c32a2320c81aae8ce4345762e73" title="Decrements the reference count for the transport.">_dbus_transport_unref</a> (transport);
<a name="l00913"></a>00913
<a name="l00914"></a>00914 <span class="keywordflow">return</span> retval;
<a name="l00915"></a>00915 }
<a name="l00916"></a>00916
<a name="l00926"></a>00926 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l00927"></a><a class="code" href="group__DBusTransport.html#ga9aaa3f8bf429c94d4ed180dff36c503c">00927</a> <a class="code" href="group__DBusTransport.html#ga9aaa3f8bf429c94d4ed180dff36c503c" title="Sets the connection using this transport.">_dbus_transport_set_connection</a> (<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport,
<a name="l00928"></a>00928 <a class="code" href="structDBusConnection.html" title="Implementation details of DBusConnection.">DBusConnection</a> *connection)
<a name="l00929"></a>00929 {
<a name="l00930"></a>00930 _dbus_assert (transport-><a class="code" href="structDBusTransport.html#a7350850a4e02a7eaa4036eb47d4778e5" title="Virtual methods for this instance.">vtable</a>-><a class="code" href="structDBusTransportVTable.html#a039019c6859c75e7b9c3b05a38043f64" title="Called when transport->connection has been filled in.">connection_set</a> != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l00931"></a>00931 _dbus_assert (transport-><a class="code" href="structDBusTransport.html#a8abdfc9327aa30550982c83b45354651" title="Connection owning this transport.">connection</a> == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l00932"></a>00932
<a name="l00933"></a>00933 transport-><a class="code" href="structDBusTransport.html#a8abdfc9327aa30550982c83b45354651" title="Connection owning this transport.">connection</a> = connection;
<a name="l00934"></a>00934
<a name="l00935"></a>00935 <a class="code" href="group__DBusTransport.html#ga31d6dbc864c9ea643d72521bbb1b7c56" title="Increments the reference count for the transport.">_dbus_transport_ref</a> (transport);
<a name="l00936"></a>00936 <span class="keywordflow">if</span> (!(* transport-><a class="code" href="structDBusTransport.html#a7350850a4e02a7eaa4036eb47d4778e5" title="Virtual methods for this instance.">vtable</a>-><a class="code" href="structDBusTransportVTable.html#a039019c6859c75e7b9c3b05a38043f64" title="Called when transport->connection has been filled in.">connection_set</a>) (transport))
<a name="l00937"></a>00937 transport-><a class="code" href="structDBusTransport.html#a8abdfc9327aa30550982c83b45354651" title="Connection owning this transport.">connection</a> = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00938"></a>00938 <a class="code" href="group__DBusTransport.html#gab7c53c32a2320c81aae8ce4345762e73" title="Decrements the reference count for the transport.">_dbus_transport_unref</a> (transport);
<a name="l00939"></a>00939
<a name="l00940"></a>00940 <span class="keywordflow">return</span> transport-><a class="code" href="structDBusTransport.html#a8abdfc9327aa30550982c83b45354651" title="Connection owning this transport.">connection</a> != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00941"></a>00941 }
<a name="l00942"></a>00942
<a name="l00950"></a>00950 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l00951"></a><a class="code" href="group__DBusTransport.html#gac58d38eb19b39774f89271fc6472e087">00951</a> <a class="code" href="group__DBusTransport.html#gac58d38eb19b39774f89271fc6472e087" title="Get the socket file descriptor, if any.">_dbus_transport_get_socket_fd</a> (<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport,
<a name="l00952"></a>00952 <span class="keywordtype">int</span> *fd_p)
<a name="l00953"></a>00953 {
<a name="l00954"></a>00954 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> retval;
<a name="l00955"></a>00955
<a name="l00956"></a>00956 <span class="keywordflow">if</span> (transport-><a class="code" href="structDBusTransport.html#a7350850a4e02a7eaa4036eb47d4778e5" title="Virtual methods for this instance.">vtable</a>-><a class="code" href="structDBusTransportVTable.html#ab11f6388cdbd7f5e44e52c884670bee5" title="Get socket file descriptor.">get_socket_fd</a> == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00957"></a>00957 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to "0".">FALSE</a>;
<a name="l00958"></a>00958
<a name="l00959"></a>00959 <span class="keywordflow">if</span> (transport-><a class="code" href="structDBusTransport.html#a487a7375e94efba850f8344a252cfa63" title="TRUE if we are disconnected.">disconnected</a>)
<a name="l00960"></a>00960 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to "0".">FALSE</a>;
<a name="l00961"></a>00961
<a name="l00962"></a>00962 <a class="code" href="group__DBusTransport.html#ga31d6dbc864c9ea643d72521bbb1b7c56" title="Increments the reference count for the transport.">_dbus_transport_ref</a> (transport);
<a name="l00963"></a>00963
<a name="l00964"></a>00964 retval = (* transport-><a class="code" href="structDBusTransport.html#a7350850a4e02a7eaa4036eb47d4778e5" title="Virtual methods for this instance.">vtable</a>-><a class="code" href="structDBusTransportVTable.html#ab11f6388cdbd7f5e44e52c884670bee5" title="Get socket file descriptor.">get_socket_fd</a>) (transport,
<a name="l00965"></a>00965 fd_p);
<a name="l00966"></a>00966
<a name="l00967"></a>00967 <a class="code" href="group__DBusTransport.html#gab7c53c32a2320c81aae8ce4345762e73" title="Decrements the reference count for the transport.">_dbus_transport_unref</a> (transport);
<a name="l00968"></a>00968
<a name="l00969"></a>00969 <span class="keywordflow">return</span> retval;
<a name="l00970"></a>00970 }
<a name="l00971"></a>00971
<a name="l00983"></a>00983 <span class="keywordtype">void</span>
<a name="l00984"></a><a class="code" href="group__DBusTransport.html#gac5e6d7a01debcf852b8d5a2fbc666fde">00984</a> <a class="code" href="group__DBusTransport.html#gac5e6d7a01debcf852b8d5a2fbc666fde" title="Performs a single poll()/select() on the transport's file descriptors and then reads/writes data as a...">_dbus_transport_do_iteration</a> (<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport,
<a name="l00985"></a>00985 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> flags,
<a name="l00986"></a>00986 <span class="keywordtype">int</span> timeout_milliseconds)
<a name="l00987"></a>00987 {
<a name="l00988"></a>00988 _dbus_assert (transport-><a class="code" href="structDBusTransport.html#a7350850a4e02a7eaa4036eb47d4778e5" title="Virtual methods for this instance.">vtable</a>-><a class="code" href="structDBusTransportVTable.html#addbd055aef5a4d243b3e7e89513d2c38" title="Called to do a single "iteration" (block on select/poll followed by reading or writing data)...">do_iteration</a> != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l00989"></a>00989
<a name="l00990"></a>00990 _dbus_verbose (<span class="stringliteral">"Transport iteration flags 0x%x timeout %d connected = %d\n"</span>,
<a name="l00991"></a>00991 flags, timeout_milliseconds, !transport-><a class="code" href="structDBusTransport.html#a487a7375e94efba850f8344a252cfa63" title="TRUE if we are disconnected.">disconnected</a>);
<a name="l00992"></a>00992
<a name="l00993"></a>00993 <span class="keywordflow">if</span> ((flags & (DBUS_ITERATION_DO_WRITING |
<a name="l00994"></a>00994 DBUS_ITERATION_DO_READING)) == 0)
<a name="l00995"></a>00995 <span class="keywordflow">return</span>; <span class="comment">/* Nothing to do */</span>
<a name="l00996"></a>00996
<a name="l00997"></a>00997 <span class="keywordflow">if</span> (transport-><a class="code" href="structDBusTransport.html#a487a7375e94efba850f8344a252cfa63" title="TRUE if we are disconnected.">disconnected</a>)
<a name="l00998"></a>00998 <span class="keywordflow">return</span>;
<a name="l00999"></a>00999
<a name="l01000"></a>01000 <a class="code" href="group__DBusTransport.html#ga31d6dbc864c9ea643d72521bbb1b7c56" title="Increments the reference count for the transport.">_dbus_transport_ref</a> (transport);
<a name="l01001"></a>01001 (* transport-><a class="code" href="structDBusTransport.html#a7350850a4e02a7eaa4036eb47d4778e5" title="Virtual methods for this instance.">vtable</a>-><a class="code" href="structDBusTransportVTable.html#addbd055aef5a4d243b3e7e89513d2c38" title="Called to do a single "iteration" (block on select/poll followed by reading or writing data)...">do_iteration</a>) (transport, flags,
<a name="l01002"></a>01002 timeout_milliseconds);
<a name="l01003"></a>01003 <a class="code" href="group__DBusTransport.html#gab7c53c32a2320c81aae8ce4345762e73" title="Decrements the reference count for the transport.">_dbus_transport_unref</a> (transport);
<a name="l01004"></a>01004
<a name="l01005"></a>01005 _dbus_verbose (<span class="stringliteral">"end\n"</span>);
<a name="l01006"></a>01006 }
<a name="l01007"></a>01007
<a name="l01008"></a>01008 <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="l01009"></a>01009 recover_unused_bytes (<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport)
<a name="l01010"></a>01010 {
<a name="l01011"></a>01011 <span class="keywordflow">if</span> (<a class="code" href="group__DBusAuth.html#gac6e9dc07335a6291842374d834e95ad2" title="Called post-authentication, indicates whether we need to decode the message stream with _dbus_auth_de...">_dbus_auth_needs_decoding</a> (transport-><a class="code" href="structDBusTransport.html#acf71c91312f325be13ce6c09298b1eb8" title="Authentication conversation.">auth</a>))
<a name="l01012"></a>01012 {
<a name="l01013"></a>01013 <a class="code" href="structDBusString.html">DBusString</a> plaintext;
<a name="l01014"></a>01014 <span class="keyword">const</span> <a class="code" href="structDBusString.html">DBusString</a> *encoded;
<a name="l01015"></a>01015 <a class="code" href="structDBusString.html">DBusString</a> *buffer;
<a name="l01016"></a>01016 <span class="keywordtype">int</span> orig_len;
<a name="l01017"></a>01017
<a name="l01018"></a>01018 <span class="keywordflow">if</span> (!<a class="code" href="group__DBusString.html#ga348252317f7bb8ac43529972945830ae" title="Initializes a string.">_dbus_string_init</a> (&plaintext))
<a name="l01019"></a>01019 <span class="keywordflow">goto</span> nomem;
<a name="l01020"></a>01020
<a name="l01021"></a>01021 <a class="code" href="group__DBusAuth.html#gaf9e2ab67f2ddd26eeb7deeb8b0af7817" title="Returns leftover bytes that were not used as part of the auth conversation.">_dbus_auth_get_unused_bytes</a> (transport-><a class="code" href="structDBusTransport.html#acf71c91312f325be13ce6c09298b1eb8" title="Authentication conversation.">auth</a>,
<a name="l01022"></a>01022 &encoded);
<a name="l01023"></a>01023
<a name="l01024"></a>01024 <span class="keywordflow">if</span> (!<a class="code" href="group__DBusAuth.html#ga7eb40f71c0ede79f954bcb2c001c8502" title="Called post-authentication, decodes a block of bytes received from the peer.">_dbus_auth_decode_data</a> (transport-><a class="code" href="structDBusTransport.html#acf71c91312f325be13ce6c09298b1eb8" title="Authentication conversation.">auth</a>,
<a name="l01025"></a>01025 encoded, &plaintext))
<a name="l01026"></a>01026 {
<a name="l01027"></a>01027 <a class="code" href="group__DBusString.html#ga781ca91acda49a834dce7d0ed0eef212" title="Frees a string created by _dbus_string_init().">_dbus_string_free</a> (&plaintext);
<a name="l01028"></a>01028 <span class="keywordflow">goto</span> nomem;
<a name="l01029"></a>01029 }
<a name="l01030"></a>01030
<a name="l01031"></a>01031 <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> (transport-><a class="code" href="structDBusTransport.html#aaaba590c281236d176600016b7edab48" title="Message-loading buffer.">loader</a>,
<a name="l01032"></a>01032 &buffer);
<a name="l01033"></a>01033
<a name="l01034"></a>01034 orig_len = <a class="code" href="group__DBusString.html#gaa5136e6fd2c5188f4b88de7863369c6d" title="Gets the length of a string (not including nul termination).">_dbus_string_get_length</a> (buffer);
<a name="l01035"></a>01035
<a name="l01036"></a>01036 <span class="keywordflow">if</span> (!<a class="code" href="group__DBusString.html#gad379fce8d4ef4f7e28f81f50b46ee4c9" title="Moves the end of one string into another string.">_dbus_string_move</a> (&plaintext, 0, buffer,
<a name="l01037"></a>01037 orig_len))
<a name="l01038"></a>01038 {
<a name="l01039"></a>01039 <a class="code" href="group__DBusString.html#ga781ca91acda49a834dce7d0ed0eef212" title="Frees a string created by _dbus_string_init().">_dbus_string_free</a> (&plaintext);
<a name="l01040"></a>01040 <span class="keywordflow">goto</span> nomem;
<a name="l01041"></a>01041 }
<a name="l01042"></a>01042
<a name="l01043"></a>01043 _dbus_verbose (<span class="stringliteral">" %d unused bytes sent to message loader\n"</span>,
<a name="l01044"></a>01044 <a class="code" href="group__DBusString.html#gaa5136e6fd2c5188f4b88de7863369c6d" title="Gets the length of a string (not including nul termination).">_dbus_string_get_length</a> (buffer) -
<a name="l01045"></a>01045 orig_len);
<a name="l01046"></a>01046
<a name="l01047"></a>01047 <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> (transport-><a class="code" href="structDBusTransport.html#aaaba590c281236d176600016b7edab48" title="Message-loading buffer.">loader</a>,
<a name="l01048"></a>01048 buffer);
<a name="l01049"></a>01049
<a name="l01050"></a>01050 <a class="code" href="group__DBusAuth.html#gabbe8cf9e5958357c49a190ca259aa9b3" title="Gets rid of unused bytes returned by _dbus_auth_get_unused_bytes() after we've gotten them and succes...">_dbus_auth_delete_unused_bytes</a> (transport-><a class="code" href="structDBusTransport.html#acf71c91312f325be13ce6c09298b1eb8" title="Authentication conversation.">auth</a>);
<a name="l01051"></a>01051
<a name="l01052"></a>01052 <a class="code" href="group__DBusString.html#ga781ca91acda49a834dce7d0ed0eef212" title="Frees a string created by _dbus_string_init().">_dbus_string_free</a> (&plaintext);
<a name="l01053"></a>01053 }
<a name="l01054"></a>01054 <span class="keywordflow">else</span>
<a name="l01055"></a>01055 {
<a name="l01056"></a>01056 <span class="keyword">const</span> <a class="code" href="structDBusString.html">DBusString</a> *bytes;
<a name="l01057"></a>01057 <a class="code" href="structDBusString.html">DBusString</a> *buffer;
<a name="l01058"></a>01058 <span class="keywordtype">int</span> orig_len;
<a name="l01059"></a>01059 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> succeeded;
<a name="l01060"></a>01060
<a name="l01061"></a>01061 <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> (transport-><a class="code" href="structDBusTransport.html#aaaba590c281236d176600016b7edab48" title="Message-loading buffer.">loader</a>,
<a name="l01062"></a>01062 &buffer);
<a name="l01063"></a>01063
<a name="l01064"></a>01064 orig_len = <a class="code" href="group__DBusString.html#gaa5136e6fd2c5188f4b88de7863369c6d" title="Gets the length of a string (not including nul termination).">_dbus_string_get_length</a> (buffer);
<a name="l01065"></a>01065
<a name="l01066"></a>01066 <a class="code" href="group__DBusAuth.html#gaf9e2ab67f2ddd26eeb7deeb8b0af7817" title="Returns leftover bytes that were not used as part of the auth conversation.">_dbus_auth_get_unused_bytes</a> (transport-><a class="code" href="structDBusTransport.html#acf71c91312f325be13ce6c09298b1eb8" title="Authentication conversation.">auth</a>,
<a name="l01067"></a>01067 &bytes);
<a name="l01068"></a>01068
<a name="l01069"></a>01069 succeeded = <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to "1".">TRUE</a>;
<a name="l01070"></a>01070 <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's copied to the d...">_dbus_string_copy</a> (bytes, 0, buffer, <a class="code" href="group__DBusString.html#gaa5136e6fd2c5188f4b88de7863369c6d" title="Gets the length of a string (not including nul termination).">_dbus_string_get_length</a> (buffer)))
<a name="l01071"></a>01071 succeeded = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to "0".">FALSE</a>;
<a name="l01072"></a>01072
<a name="l01073"></a>01073 _dbus_verbose (<span class="stringliteral">" %d unused bytes sent to message loader\n"</span>,
<a name="l01074"></a>01074 <a class="code" href="group__DBusString.html#gaa5136e6fd2c5188f4b88de7863369c6d" title="Gets the length of a string (not including nul termination).">_dbus_string_get_length</a> (buffer) -
<a name="l01075"></a>01075 orig_len);
<a name="l01076"></a>01076
<a name="l01077"></a>01077 <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> (transport-><a class="code" href="structDBusTransport.html#aaaba590c281236d176600016b7edab48" title="Message-loading buffer.">loader</a>,
<a name="l01078"></a>01078 buffer);
<a name="l01079"></a>01079
<a name="l01080"></a>01080 <span class="keywordflow">if</span> (succeeded)
<a name="l01081"></a>01081 <a class="code" href="group__DBusAuth.html#gabbe8cf9e5958357c49a190ca259aa9b3" title="Gets rid of unused bytes returned by _dbus_auth_get_unused_bytes() after we've gotten them and succes...">_dbus_auth_delete_unused_bytes</a> (transport-><a class="code" href="structDBusTransport.html#acf71c91312f325be13ce6c09298b1eb8" title="Authentication conversation.">auth</a>);
<a name="l01082"></a>01082 <span class="keywordflow">else</span>
<a name="l01083"></a>01083 <span class="keywordflow">goto</span> nomem;
<a name="l01084"></a>01084 }
<a name="l01085"></a>01085
<a name="l01086"></a>01086 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to "1".">TRUE</a>;
<a name="l01087"></a>01087
<a name="l01088"></a>01088 nomem:
<a name="l01089"></a>01089 _dbus_verbose (<span class="stringliteral">"Not enough memory to transfer unused bytes from auth conversation\n"</span>);
<a name="l01090"></a>01090 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to "0".">FALSE</a>;
<a name="l01091"></a>01091 }
<a name="l01092"></a>01092
<a name="l01100"></a>01100 <a class="code" href="group__DBusConnection.html#gabf250a32ff740b2a8c99136e0142d8d2" title="Indicates the status of incoming data on a DBusConnection.">DBusDispatchStatus</a>
<a name="l01101"></a><a class="code" href="group__DBusTransport.html#ga32153a834758b5a88d7bde8f7a205c71">01101</a> <a class="code" href="group__DBusTransport.html#ga32153a834758b5a88d7bde8f7a205c71" title="Reports our current dispatch status (whether there's buffered data to be queued as messages...">_dbus_transport_get_dispatch_status</a> (<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport)
<a name="l01102"></a>01102 {
<a name="l01103"></a>01103 <span class="keywordflow">if</span> (<a class="code" href="group__DBusResources.html#ga49de078fb626aff30f273933ad5c8b2a" title="Gets the current value of the size counter.">_dbus_counter_get_size_value</a> (transport-><a class="code" href="structDBusTransport.html#afb19bae6f7cfe595f3f1ae0ce53ccab0" title="Counter for size/unix fds of all live messages.">live_messages</a>) >= transport-><a class="code" href="structDBusTransport.html#a23e0925741fc1c4ba3a369bac4bca4b6" title="Max total size of received messages.">max_live_messages_size</a> ||
<a name="l01104"></a>01104 <a class="code" href="group__DBusResources.html#ga25b2d12b9dc4d3525df2b8401f4ce56d" title="Gets the current value of the unix fd counter.">_dbus_counter_get_unix_fd_value</a> (transport-><a class="code" href="structDBusTransport.html#afb19bae6f7cfe595f3f1ae0ce53ccab0" title="Counter for size/unix fds of all live messages.">live_messages</a>) >= transport-><a class="code" href="structDBusTransport.html#a2d96972bbc56b78360cb0cfaa3f30266" title="Max total unix fds of received messages.">max_live_messages_unix_fds</a>)
<a name="l01105"></a>01105 <span class="keywordflow">return</span> <a class="code" href="group__DBusConnection.html#ggabf250a32ff740b2a8c99136e0142d8d2acb9bb9daa90f520d5fc9e84de3c5f017" title="All currently available data has been processed.">DBUS_DISPATCH_COMPLETE</a>; <span class="comment">/* complete for now */</span>
<a name="l01106"></a>01106
<a name="l01107"></a>01107 <span class="keywordflow">if</span> (!<a class="code" href="group__DBusTransport.html#gabe774b134a4bf8c8fc09e6186470874f" title="Returns TRUE if we have been authenticated.">_dbus_transport_try_to_authenticate</a> (transport))
<a name="l01108"></a>01108 {
<a name="l01109"></a>01109 <span class="keywordflow">if</span> (<a class="code" href="group__DBusAuth.html#ga097c71f7f20b749275c6b31cd98623f5" title="Analyzes buffered input and moves the auth conversation forward, returning the new state of the auth ...">_dbus_auth_do_work</a> (transport-><a class="code" href="structDBusTransport.html#acf71c91312f325be13ce6c09298b1eb8" title="Authentication conversation.">auth</a>) ==
<a name="l01110"></a>01110 DBUS_AUTH_STATE_WAITING_FOR_MEMORY)
<a name="l01111"></a>01111 <span class="keywordflow">return</span> <a class="code" href="group__DBusConnection.html#ggabf250a32ff740b2a8c99136e0142d8d2a5af20a035f29cfa67fb8d69fb693b685" title="More memory is needed to continue.">DBUS_DISPATCH_NEED_MEMORY</a>;
<a name="l01112"></a>01112 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (!<a class="code" href="group__DBusTransport.html#gabe774b134a4bf8c8fc09e6186470874f" title="Returns TRUE if we have been authenticated.">_dbus_transport_try_to_authenticate</a> (transport))
<a name="l01113"></a>01113 <span class="keywordflow">return</span> <a class="code" href="group__DBusConnection.html#ggabf250a32ff740b2a8c99136e0142d8d2acb9bb9daa90f520d5fc9e84de3c5f017" title="All currently available data has been processed.">DBUS_DISPATCH_COMPLETE</a>;
<a name="l01114"></a>01114 }
<a name="l01115"></a>01115
<a name="l01116"></a>01116 <span class="keywordflow">if</span> (!transport-><a class="code" href="structDBusTransport.html#a6a546ecc2f6467a51973681d0b816809" title="TRUE if we've recovered unused bytes from auth">unused_bytes_recovered</a> &&
<a name="l01117"></a>01117 !recover_unused_bytes (transport))
<a name="l01118"></a>01118 <span class="keywordflow">return</span> <a class="code" href="group__DBusConnection.html#ggabf250a32ff740b2a8c99136e0142d8d2a5af20a035f29cfa67fb8d69fb693b685" title="More memory is needed to continue.">DBUS_DISPATCH_NEED_MEMORY</a>;
<a name="l01119"></a>01119
<a name="l01120"></a>01120 transport-><a class="code" href="structDBusTransport.html#a6a546ecc2f6467a51973681d0b816809" title="TRUE if we've recovered unused bytes from auth">unused_bytes_recovered</a> = <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to "1".">TRUE</a>;
<a name="l01121"></a>01121
<a name="l01122"></a>01122 <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> (transport-><a class="code" href="structDBusTransport.html#aaaba590c281236d176600016b7edab48" title="Message-loading buffer.">loader</a>))
<a name="l01123"></a>01123 <span class="keywordflow">return</span> <a class="code" href="group__DBusConnection.html#ggabf250a32ff740b2a8c99136e0142d8d2a5af20a035f29cfa67fb8d69fb693b685" title="More memory is needed to continue.">DBUS_DISPATCH_NEED_MEMORY</a>;
<a name="l01124"></a>01124
<a name="l01125"></a>01125 <span class="keywordflow">if</span> (<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> (transport-><a class="code" href="structDBusTransport.html#aaaba590c281236d176600016b7edab48" title="Message-loading buffer.">loader</a>) != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01126"></a>01126 <span class="keywordflow">return</span> <a class="code" href="group__DBusConnection.html#ggabf250a32ff740b2a8c99136e0142d8d2adf8e8a594ab338cb9cf7855b19e37e93" title="There is more data to potentially convert to messages.">DBUS_DISPATCH_DATA_REMAINS</a>;
<a name="l01127"></a>01127 <span class="keywordflow">else</span>
<a name="l01128"></a>01128 <span class="keywordflow">return</span> <a class="code" href="group__DBusConnection.html#ggabf250a32ff740b2a8c99136e0142d8d2acb9bb9daa90f520d5fc9e84de3c5f017" title="All currently available data has been processed.">DBUS_DISPATCH_COMPLETE</a>;
<a name="l01129"></a>01129 }
<a name="l01130"></a>01130
<a name="l01139"></a>01139 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l01140"></a><a class="code" href="group__DBusTransport.html#ga4046f36ecbdb75219f2b667f92e75a2b">01140</a> <a class="code" href="group__DBusTransport.html#ga4046f36ecbdb75219f2b667f92e75a2b" title="Processes data we've read while handling a watch, potentially converting some of it to messages and q...">_dbus_transport_queue_messages</a> (<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport)
<a name="l01141"></a>01141 {
<a name="l01142"></a>01142 <a class="code" href="group__DBusConnection.html#gabf250a32ff740b2a8c99136e0142d8d2" title="Indicates the status of incoming data on a DBusConnection.">DBusDispatchStatus</a> status;
<a name="l01143"></a>01143
<a name="l01144"></a>01144 <span class="preprocessor">#if 0</span>
<a name="l01145"></a>01145 <span class="preprocessor"></span> _dbus_verbose (<span class="stringliteral">"_dbus_transport_queue_messages()\n"</span>);
<a name="l01146"></a>01146 <span class="preprocessor">#endif</span>
<a name="l01147"></a>01147 <span class="preprocessor"></span>
<a name="l01148"></a>01148 <span class="comment">/* Queue any messages */</span>
<a name="l01149"></a>01149 <span class="keywordflow">while</span> ((status = <a class="code" href="group__DBusTransport.html#ga32153a834758b5a88d7bde8f7a205c71" title="Reports our current dispatch status (whether there's buffered data to be queued as messages...">_dbus_transport_get_dispatch_status</a> (transport)) == <a class="code" href="group__DBusConnection.html#ggabf250a32ff740b2a8c99136e0142d8d2adf8e8a594ab338cb9cf7855b19e37e93" title="There is more data to potentially convert to messages.">DBUS_DISPATCH_DATA_REMAINS</a>)
<a name="l01150"></a>01150 {
<a name="l01151"></a>01151 <a class="code" href="structDBusMessage.html" title="Internals of DBusMessage.">DBusMessage</a> *message;
<a name="l01152"></a>01152 <a class="code" href="structDBusList.html" title="A node in a linked list.">DBusList</a> *link;
<a name="l01153"></a>01153
<a name="l01154"></a>01154 link = <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> (transport-><a class="code" href="structDBusTransport.html#aaaba590c281236d176600016b7edab48" title="Message-loading buffer.">loader</a>);
<a name="l01155"></a>01155 _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="l01156"></a>01156
<a name="l01157"></a>01157 message = link-><a class="code" href="structDBusList.html#a29ab457bcf9092252bb0c4282c727055" title="Data stored at this element.">data</a>;
<a name="l01158"></a>01158
<a name="l01159"></a>01159 _dbus_verbose (<span class="stringliteral">"queueing received message %p\n"</span>, message);
<a name="l01160"></a>01160
<a name="l01161"></a>01161 <span class="keywordflow">if</span> (!<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> (message, transport-><a class="code" href="structDBusTransport.html#afb19bae6f7cfe595f3f1ae0ce53ccab0" title="Counter for size/unix fds of all live messages.">live_messages</a>))
<a name="l01162"></a>01162 {
<a name="l01163"></a>01163 <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> (transport-><a class="code" href="structDBusTransport.html#aaaba590c281236d176600016b7edab48" title="Message-loading buffer.">loader</a>,
<a name="l01164"></a>01164 link);
<a name="l01165"></a>01165 status = <a class="code" href="group__DBusConnection.html#ggabf250a32ff740b2a8c99136e0142d8d2a5af20a035f29cfa67fb8d69fb693b685" title="More memory is needed to continue.">DBUS_DISPATCH_NEED_MEMORY</a>;
<a name="l01166"></a>01166 <span class="keywordflow">break</span>;
<a name="l01167"></a>01167 }
<a name="l01168"></a>01168 <span class="keywordflow">else</span>
<a name="l01169"></a>01169 {
<a name="l01170"></a>01170 <span class="comment">/* We didn't call the notify function when we added the counter, so</span>
<a name="l01171"></a>01171 <span class="comment"> * catch up now. Since we have the connection's lock, it's desirable</span>
<a name="l01172"></a>01172 <span class="comment"> * that we bypass the notify function and call this virtual method</span>
<a name="l01173"></a>01173 <span class="comment"> * directly. */</span>
<a name="l01174"></a>01174 <span class="keywordflow">if</span> (transport-><a class="code" href="structDBusTransport.html#a7350850a4e02a7eaa4036eb47d4778e5" title="Virtual methods for this instance.">vtable</a>-><a class="code" href="structDBusTransportVTable.html#af28ab32fb4f7332a245f48a7d2823dfc" title="Outstanding messages counter changed.">live_messages_changed</a>)
<a name="l01175"></a>01175 (* transport-><a class="code" href="structDBusTransport.html#a7350850a4e02a7eaa4036eb47d4778e5" title="Virtual methods for this instance.">vtable</a>-><a class="code" href="structDBusTransportVTable.html#af28ab32fb4f7332a245f48a7d2823dfc" title="Outstanding messages counter changed.">live_messages_changed</a>) (transport);
<a name="l01176"></a>01176
<a name="l01177"></a>01177 <span class="comment">/* pass ownership of link and message ref to connection */</span>
<a name="l01178"></a>01178 <a class="code" href="group__DBusConnectionInternals.html#gac1b92eba0aeee294dc28fcc260c9b749" title="Adds a message-containing list link to the incoming message queue, taking ownership of the link and t...">_dbus_connection_queue_received_message_link</a> (transport-><a class="code" href="structDBusTransport.html#a8abdfc9327aa30550982c83b45354651" title="Connection owning this transport.">connection</a>,
<a name="l01179"></a>01179 link);
<a name="l01180"></a>01180 }
<a name="l01181"></a>01181 }
<a name="l01182"></a>01182
<a name="l01183"></a>01183 <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> (transport-><a class="code" href="structDBusTransport.html#aaaba590c281236d176600016b7edab48" title="Message-loading buffer.">loader</a>))
<a name="l01184"></a>01184 {
<a name="l01185"></a>01185 _dbus_verbose (<span class="stringliteral">"Corrupted message stream, disconnecting\n"</span>);
<a name="l01186"></a>01186 <a class="code" href="group__DBusTransport.html#ga78444dd8f6c6d6b429433ad81c3e318a" title="Closes our end of the connection to a remote application.">_dbus_transport_disconnect</a> (transport);
<a name="l01187"></a>01187 }
<a name="l01188"></a>01188
<a name="l01189"></a>01189 <span class="keywordflow">return</span> status != <a class="code" href="group__DBusConnection.html#ggabf250a32ff740b2a8c99136e0142d8d2a5af20a035f29cfa67fb8d69fb693b685" title="More memory is needed to continue.">DBUS_DISPATCH_NEED_MEMORY</a>;
<a name="l01190"></a>01190 }
<a name="l01191"></a>01191
<a name="l01198"></a>01198 <span class="keywordtype">void</span>
<a name="l01199"></a><a class="code" href="group__DBusTransport.html#ga03ea875260e71f59af708146cabf95ab">01199</a> <a class="code" href="group__DBusTransport.html#ga03ea875260e71f59af708146cabf95ab" title="See dbus_connection_set_max_message_size().">_dbus_transport_set_max_message_size</a> (<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport,
<a name="l01200"></a>01200 <span class="keywordtype">long</span> size)
<a name="l01201"></a>01201 {
<a name="l01202"></a>01202 <a class="code" href="group__DBusMessageInternals.html#ga031623c6235f98801cab3e53f0a5f757" title="Sets the maximum size message we allow.">_dbus_message_loader_set_max_message_size</a> (transport-><a class="code" href="structDBusTransport.html#aaaba590c281236d176600016b7edab48" title="Message-loading buffer.">loader</a>, size);
<a name="l01203"></a>01203 }
<a name="l01204"></a>01204
<a name="l01211"></a>01211 <span class="keywordtype">void</span>
<a name="l01212"></a><a class="code" href="group__DBusTransport.html#gad005fffd646202e74a789765ae82a40f">01212</a> <a class="code" href="group__DBusTransport.html#gad005fffd646202e74a789765ae82a40f" title="See dbus_connection_set_max_message_unix_fds().">_dbus_transport_set_max_message_unix_fds</a> (<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport,
<a name="l01213"></a>01213 <span class="keywordtype">long</span> n)
<a name="l01214"></a>01214 {
<a name="l01215"></a>01215 <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> (transport-><a class="code" href="structDBusTransport.html#aaaba590c281236d176600016b7edab48" title="Message-loading buffer.">loader</a>, n);
<a name="l01216"></a>01216 }
<a name="l01217"></a>01217
<a name="l01224"></a>01224 <span class="keywordtype">long</span>
<a name="l01225"></a><a class="code" href="group__DBusTransport.html#gae36d2a90bad6ef13c0379fa9864ff68e">01225</a> <a class="code" href="group__DBusTransport.html#gae36d2a90bad6ef13c0379fa9864ff68e" title="See dbus_connection_get_max_message_size().">_dbus_transport_get_max_message_size</a> (<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport)
<a name="l01226"></a>01226 {
<a name="l01227"></a>01227 <span class="keywordflow">return</span> <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> (transport-><a class="code" href="structDBusTransport.html#aaaba590c281236d176600016b7edab48" title="Message-loading buffer.">loader</a>);
<a name="l01228"></a>01228 }
<a name="l01229"></a>01229
<a name="l01236"></a>01236 <span class="keywordtype">long</span>
<a name="l01237"></a><a class="code" href="group__DBusTransport.html#gaa28e8edd4d849108b158d95eb7da812d">01237</a> <a class="code" href="group__DBusTransport.html#gaa28e8edd4d849108b158d95eb7da812d" title="See dbus_connection_get_max_message_unix_fds().">_dbus_transport_get_max_message_unix_fds</a> (<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport)
<a name="l01238"></a>01238 {
<a name="l01239"></a>01239 <span class="keywordflow">return</span> <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> (transport-><a class="code" href="structDBusTransport.html#aaaba590c281236d176600016b7edab48" title="Message-loading buffer.">loader</a>);
<a name="l01240"></a>01240 }
<a name="l01241"></a>01241
<a name="l01248"></a>01248 <span class="keywordtype">void</span>
<a name="l01249"></a><a class="code" href="group__DBusTransport.html#ga08e0368732df5f4e58a2c838fe4484f6">01249</a> <a class="code" href="group__DBusTransport.html#ga08e0368732df5f4e58a2c838fe4484f6" title="See dbus_connection_set_max_received_size().">_dbus_transport_set_max_received_size</a> (<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport,
<a name="l01250"></a>01250 <span class="keywordtype">long</span> size)
<a name="l01251"></a>01251 {
<a name="l01252"></a>01252 transport-><a class="code" href="structDBusTransport.html#a23e0925741fc1c4ba3a369bac4bca4b6" title="Max total size of received messages.">max_live_messages_size</a> = size;
<a name="l01253"></a>01253 <a class="code" href="group__DBusResources.html#ga240bddfe384b32a8703a328a638219e1" title="Sets the notify function for this counter; the notify function is called whenever the counter's value...">_dbus_counter_set_notify</a> (transport-><a class="code" href="structDBusTransport.html#afb19bae6f7cfe595f3f1ae0ce53ccab0" title="Counter for size/unix fds of all live messages.">live_messages</a>,
<a name="l01254"></a>01254 transport-><a class="code" href="structDBusTransport.html#a23e0925741fc1c4ba3a369bac4bca4b6" title="Max total size of received messages.">max_live_messages_size</a>,
<a name="l01255"></a>01255 transport-><a class="code" href="structDBusTransport.html#a2d96972bbc56b78360cb0cfaa3f30266" title="Max total unix fds of received messages.">max_live_messages_unix_fds</a>,
<a name="l01256"></a>01256 live_messages_notify,
<a name="l01257"></a>01257 transport);
<a name="l01258"></a>01258 }
<a name="l01259"></a>01259
<a name="l01266"></a>01266 <span class="keywordtype">void</span>
<a name="l01267"></a><a class="code" href="group__DBusTransport.html#gaae297c86eb0b79b6cef4a1f7e4b50356">01267</a> <a class="code" href="group__DBusTransport.html#gaae297c86eb0b79b6cef4a1f7e4b50356" title="See dbus_connection_set_max_received_unix_fds().">_dbus_transport_set_max_received_unix_fds</a> (<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport,
<a name="l01268"></a>01268 <span class="keywordtype">long</span> n)
<a name="l01269"></a>01269 {
<a name="l01270"></a>01270 transport-><a class="code" href="structDBusTransport.html#a2d96972bbc56b78360cb0cfaa3f30266" title="Max total unix fds of received messages.">max_live_messages_unix_fds</a> = n;
<a name="l01271"></a>01271 <a class="code" href="group__DBusResources.html#ga240bddfe384b32a8703a328a638219e1" title="Sets the notify function for this counter; the notify function is called whenever the counter's value...">_dbus_counter_set_notify</a> (transport-><a class="code" href="structDBusTransport.html#afb19bae6f7cfe595f3f1ae0ce53ccab0" title="Counter for size/unix fds of all live messages.">live_messages</a>,
<a name="l01272"></a>01272 transport-><a class="code" href="structDBusTransport.html#a23e0925741fc1c4ba3a369bac4bca4b6" title="Max total size of received messages.">max_live_messages_size</a>,
<a name="l01273"></a>01273 transport-><a class="code" href="structDBusTransport.html#a2d96972bbc56b78360cb0cfaa3f30266" title="Max total unix fds of received messages.">max_live_messages_unix_fds</a>,
<a name="l01274"></a>01274 live_messages_notify,
<a name="l01275"></a>01275 transport);
<a name="l01276"></a>01276 }
<a name="l01277"></a>01277
<a name="l01284"></a>01284 <span class="keywordtype">long</span>
<a name="l01285"></a><a class="code" href="group__DBusTransport.html#ga8992b33d9060a103bd38705462a0ea96">01285</a> <a class="code" href="group__DBusTransport.html#ga8992b33d9060a103bd38705462a0ea96" title="See dbus_connection_get_max_received_size().">_dbus_transport_get_max_received_size</a> (<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport)
<a name="l01286"></a>01286 {
<a name="l01287"></a>01287 <span class="keywordflow">return</span> transport-><a class="code" href="structDBusTransport.html#a23e0925741fc1c4ba3a369bac4bca4b6" title="Max total size of received messages.">max_live_messages_size</a>;
<a name="l01288"></a>01288 }
<a name="l01289"></a>01289
<a name="l01296"></a>01296 <span class="keywordtype">long</span>
<a name="l01297"></a><a class="code" href="group__DBusTransport.html#gacd0b2e68c65dc3b0c1cfdf3fb8358a44">01297</a> <a class="code" href="group__DBusTransport.html#gacd0b2e68c65dc3b0c1cfdf3fb8358a44" title="See dbus_connection_set_max_received_unix_fds().">_dbus_transport_get_max_received_unix_fds</a> (<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport)
<a name="l01298"></a>01298 {
<a name="l01299"></a>01299 <span class="keywordflow">return</span> transport-><a class="code" href="structDBusTransport.html#a2d96972bbc56b78360cb0cfaa3f30266" title="Max total unix fds of received messages.">max_live_messages_unix_fds</a>;
<a name="l01300"></a>01300 }
<a name="l01301"></a>01301
<a name="l01309"></a>01309 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l01310"></a><a class="code" href="group__DBusTransport.html#gaf3c4a47f73bd584a9fda1e5e7a825da9">01310</a> <a class="code" href="group__DBusTransport.html#gaf3c4a47f73bd584a9fda1e5e7a825da9" title="See dbus_connection_get_unix_user().">_dbus_transport_get_unix_user</a> (<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport,
<a name="l01311"></a>01311 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> *uid)
<a name="l01312"></a>01312 {
<a name="l01313"></a>01313 <a class="code" href="structDBusCredentials.html">DBusCredentials</a> *auth_identity;
<a name="l01314"></a>01314
<a name="l01315"></a>01315 *uid = _DBUS_INT32_MAX; <span class="comment">/* better than some root or system user in</span>
<a name="l01316"></a>01316 <span class="comment"> * case of bugs in the caller. Caller should</span>
<a name="l01317"></a>01317 <span class="comment"> * never use this value on purpose, however.</span>
<a name="l01318"></a>01318 <span class="comment"> */</span>
<a name="l01319"></a>01319
<a name="l01320"></a>01320 <span class="keywordflow">if</span> (!transport-><a class="code" href="structDBusTransport.html#a12d3052e51b2f0bf398d48e31e5f9da8" title="Cache of auth state; use _dbus_transport_peek_is_authenticated() to query value.">authenticated</a>)
<a name="l01321"></a>01321 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to "0".">FALSE</a>;
<a name="l01322"></a>01322
<a name="l01323"></a>01323 auth_identity = <a class="code" href="group__DBusAuth.html#gabfa5450530b999bcb0fabf37c414a80e" title="Gets the identity we authorized the client as.">_dbus_auth_get_identity</a> (transport-><a class="code" href="structDBusTransport.html#acf71c91312f325be13ce6c09298b1eb8" title="Authentication conversation.">auth</a>);
<a name="l01324"></a>01324
<a name="l01325"></a>01325 <span class="keywordflow">if</span> (<a class="code" href="group__DBusCredentials.html#ga0fb8d13878e126ccc243c4a30fd8598c" title="Checks whether the given credential is present.">_dbus_credentials_include</a> (auth_identity,
<a name="l01326"></a>01326 DBUS_CREDENTIAL_UNIX_USER_ID))
<a name="l01327"></a>01327 {
<a name="l01328"></a>01328 *uid = <a class="code" href="group__DBusCredentials.html#ga462892f995f2932bf0eb3b843407e6d5" title="Gets the UNIX user ID in the credentials, or DBUS_UID_UNSET if the credentials object doesn't contain...">_dbus_credentials_get_unix_uid</a> (auth_identity);
<a name="l01329"></a>01329 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to "1".">TRUE</a>;
<a name="l01330"></a>01330 }
<a name="l01331"></a>01331 <span class="keywordflow">else</span>
<a name="l01332"></a>01332 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to "0".">FALSE</a>;
<a name="l01333"></a>01333 }
<a name="l01334"></a>01334
<a name="l01342"></a>01342 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l01343"></a><a class="code" href="group__DBusTransport.html#gae66bc81abe904a4b3ab32d8920c8fe1e">01343</a> <a class="code" href="group__DBusTransport.html#gae66bc81abe904a4b3ab32d8920c8fe1e" title="See dbus_connection_get_unix_process_id().">_dbus_transport_get_unix_process_id</a> (<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport,
<a name="l01344"></a>01344 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> *pid)
<a name="l01345"></a>01345 {
<a name="l01346"></a>01346 <a class="code" href="structDBusCredentials.html">DBusCredentials</a> *auth_identity;
<a name="l01347"></a>01347
<a name="l01348"></a>01348 *pid = <a class="code" href="group__DBusSysdeps.html#ga4eb5f05dd6ad89caa4b0340e1cf0b8d9" title="an invalid PID used to represent an uninitialized dbus_pid_t field">DBUS_PID_UNSET</a>; <span class="comment">/* Caller should never use this value on purpose,</span>
<a name="l01349"></a>01349 <span class="comment"> * but we set it to a safe number, INT_MAX,</span>
<a name="l01350"></a>01350 <span class="comment"> * just to root out possible bugs in bad callers.</span>
<a name="l01351"></a>01351 <span class="comment"> */</span>
<a name="l01352"></a>01352
<a name="l01353"></a>01353 <span class="keywordflow">if</span> (!transport-><a class="code" href="structDBusTransport.html#a12d3052e51b2f0bf398d48e31e5f9da8" title="Cache of auth state; use _dbus_transport_peek_is_authenticated() to query value.">authenticated</a>)
<a name="l01354"></a>01354 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to "0".">FALSE</a>;
<a name="l01355"></a>01355
<a name="l01356"></a>01356 auth_identity = <a class="code" href="group__DBusAuth.html#gabfa5450530b999bcb0fabf37c414a80e" title="Gets the identity we authorized the client as.">_dbus_auth_get_identity</a> (transport-><a class="code" href="structDBusTransport.html#acf71c91312f325be13ce6c09298b1eb8" title="Authentication conversation.">auth</a>);
<a name="l01357"></a>01357
<a name="l01358"></a>01358 <span class="keywordflow">if</span> (<a class="code" href="group__DBusCredentials.html#ga0fb8d13878e126ccc243c4a30fd8598c" title="Checks whether the given credential is present.">_dbus_credentials_include</a> (auth_identity,
<a name="l01359"></a>01359 DBUS_CREDENTIAL_UNIX_PROCESS_ID))
<a name="l01360"></a>01360 {
<a name="l01361"></a>01361 *pid = <a class="code" href="group__DBusCredentials.html#gaafde142353288854a8a3969949d2e548" title="Gets the UNIX process ID in the credentials, or DBUS_PID_UNSET if the credentials object doesn't cont...">_dbus_credentials_get_pid</a> (auth_identity);
<a name="l01362"></a>01362 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to "1".">TRUE</a>;
<a name="l01363"></a>01363 }
<a name="l01364"></a>01364 <span class="keywordflow">else</span>
<a name="l01365"></a>01365 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to "0".">FALSE</a>;
<a name="l01366"></a>01366 }
<a name="l01367"></a>01367
<a name="l01376"></a>01376 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l01377"></a><a class="code" href="group__DBusTransport.html#ga36ccd8321491895ca632e744028eea42">01377</a> <a class="code" href="group__DBusTransport.html#ga36ccd8321491895ca632e744028eea42" title="See dbus_connection_get_adt_audit_session_data().">_dbus_transport_get_adt_audit_session_data</a> (<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport,
<a name="l01378"></a>01378 <span class="keywordtype">void</span> **data,
<a name="l01379"></a>01379 <span class="keywordtype">int</span> *data_size)
<a name="l01380"></a>01380 {
<a name="l01381"></a>01381 <a class="code" href="structDBusCredentials.html">DBusCredentials</a> *auth_identity;
<a name="l01382"></a>01382
<a name="l01383"></a>01383 *data = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l01384"></a>01384 *data_size = 0;
<a name="l01385"></a>01385
<a name="l01386"></a>01386 <span class="keywordflow">if</span> (!transport-><a class="code" href="structDBusTransport.html#a12d3052e51b2f0bf398d48e31e5f9da8" title="Cache of auth state; use _dbus_transport_peek_is_authenticated() to query value.">authenticated</a>)
<a name="l01387"></a>01387 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to "0".">FALSE</a>;
<a name="l01388"></a>01388
<a name="l01389"></a>01389 auth_identity = <a class="code" href="group__DBusAuth.html#gabfa5450530b999bcb0fabf37c414a80e" title="Gets the identity we authorized the client as.">_dbus_auth_get_identity</a> (transport-><a class="code" href="structDBusTransport.html#acf71c91312f325be13ce6c09298b1eb8" title="Authentication conversation.">auth</a>);
<a name="l01390"></a>01390
<a name="l01391"></a>01391 <span class="keywordflow">if</span> (<a class="code" href="group__DBusCredentials.html#ga0fb8d13878e126ccc243c4a30fd8598c" title="Checks whether the given credential is present.">_dbus_credentials_include</a> (auth_identity,
<a name="l01392"></a>01392 DBUS_CREDENTIAL_ADT_AUDIT_DATA_ID))
<a name="l01393"></a>01393 {
<a name="l01394"></a>01394 *data = (<span class="keywordtype">void</span> *) <a class="code" href="group__DBusCredentials.html#ga7a8e112e8ff3938e99ded65dd992ba05" title="Gets the ADT audit data in the credentials, or NULL if the credentials object doesn't contain ADT aud...">_dbus_credentials_get_adt_audit_data</a> (auth_identity);
<a name="l01395"></a>01395 *data_size = <a class="code" href="group__DBusCredentials.html#gab3f338ba37ed9bfa1531e00b3a8a10ce" title="Gets the ADT audit data size in the credentials, or 0 if the credentials object doesn't contain ADT a...">_dbus_credentials_get_adt_audit_data_size</a> (auth_identity);
<a name="l01396"></a>01396 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to "1".">TRUE</a>;
<a name="l01397"></a>01397 }
<a name="l01398"></a>01398 <span class="keywordflow">else</span>
<a name="l01399"></a>01399 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to "0".">FALSE</a>;
<a name="l01400"></a>01400 }
<a name="l01401"></a>01401
<a name="l01412"></a>01412 <span class="keywordtype">void</span>
<a name="l01413"></a><a class="code" href="group__DBusTransport.html#ga9f0ab472678a107c2ebe7f1da0754c44">01413</a> <a class="code" href="group__DBusTransport.html#ga9f0ab472678a107c2ebe7f1da0754c44" title="See dbus_connection_set_unix_user_function().">_dbus_transport_set_unix_user_function</a> (<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport,
<a name="l01414"></a>01414 <a class="code" href="group__DBusConnection.html#ga36419a145848f3b234b3ba5640b0a3d0" title="Called during authentication to check whether the given UNIX user ID is allowed to connect...">DBusAllowUnixUserFunction</a> <span class="keyword">function</span>,
<a name="l01415"></a>01415 <span class="keywordtype">void</span> *data,
<a name="l01416"></a>01416 <a class="code" href="group__DBusMemory.html#ga061bcded226d76c7d7de35beaa165cb5" title="The type of a function which frees a block of memory.">DBusFreeFunction</a> free_data_function,
<a name="l01417"></a>01417 <span class="keywordtype">void</span> **old_data,
<a name="l01418"></a>01418 <a class="code" href="group__DBusMemory.html#ga061bcded226d76c7d7de35beaa165cb5" title="The type of a function which frees a block of memory.">DBusFreeFunction</a> *old_free_data_function)
<a name="l01419"></a>01419 {
<a name="l01420"></a>01420 *old_data = transport-><a class="code" href="structDBusTransport.html#a7df35abee6aeef69eff659d65dd430f4" title="Data for unix_user_function.">unix_user_data</a>;
<a name="l01421"></a>01421 *old_free_data_function = transport-><a class="code" href="structDBusTransport.html#a754f10d16c06f373464fe6bf88a15cdd" title="Function to free unix_user_data.">free_unix_user_data</a>;
<a name="l01422"></a>01422
<a name="l01423"></a>01423 transport-><a class="code" href="structDBusTransport.html#ac83be11f3497da6a21aed51782cd68d0" title="Function for checking whether a user is authorized.">unix_user_function</a> = <span class="keyword">function</span>;
<a name="l01424"></a>01424 transport-><a class="code" href="structDBusTransport.html#a7df35abee6aeef69eff659d65dd430f4" title="Data for unix_user_function.">unix_user_data</a> = data;
<a name="l01425"></a>01425 transport-><a class="code" href="structDBusTransport.html#a754f10d16c06f373464fe6bf88a15cdd" title="Function to free unix_user_data.">free_unix_user_data</a> = free_data_function;
<a name="l01426"></a>01426 }
<a name="l01427"></a>01427
<a name="l01435"></a>01435 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l01436"></a><a class="code" href="group__DBusTransport.html#ga3f4f4ce9eaef18567fd21f5c6a1fde99">01436</a> <a class="code" href="group__DBusTransport.html#ga3f4f4ce9eaef18567fd21f5c6a1fde99" title="See dbus_connection_get_windows_user().">_dbus_transport_get_windows_user</a> (<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport,
<a name="l01437"></a>01437 <span class="keywordtype">char</span> **windows_sid_p)
<a name="l01438"></a>01438 {
<a name="l01439"></a>01439 <a class="code" href="structDBusCredentials.html">DBusCredentials</a> *auth_identity;
<a name="l01440"></a>01440
<a name="l01441"></a>01441 *windows_sid_p = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l01442"></a>01442
<a name="l01443"></a>01443 <span class="keywordflow">if</span> (!transport-><a class="code" href="structDBusTransport.html#a12d3052e51b2f0bf398d48e31e5f9da8" title="Cache of auth state; use _dbus_transport_peek_is_authenticated() to query value.">authenticated</a>)
<a name="l01444"></a>01444 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to "0".">FALSE</a>;
<a name="l01445"></a>01445
<a name="l01446"></a>01446 auth_identity = <a class="code" href="group__DBusAuth.html#gabfa5450530b999bcb0fabf37c414a80e" title="Gets the identity we authorized the client as.">_dbus_auth_get_identity</a> (transport-><a class="code" href="structDBusTransport.html#acf71c91312f325be13ce6c09298b1eb8" title="Authentication conversation.">auth</a>);
<a name="l01447"></a>01447
<a name="l01448"></a>01448 <span class="keywordflow">if</span> (<a class="code" href="group__DBusCredentials.html#ga0fb8d13878e126ccc243c4a30fd8598c" title="Checks whether the given credential is present.">_dbus_credentials_include</a> (auth_identity,
<a name="l01449"></a>01449 DBUS_CREDENTIAL_WINDOWS_SID))
<a name="l01450"></a>01450 {
<a name="l01451"></a>01451 <span class="comment">/* If no memory, we are supposed to return TRUE and set NULL */</span>
<a name="l01452"></a>01452 *windows_sid_p = <a class="code" href="group__DBusInternalsUtils.html#ga9d00d77f6595b9d7ac1baf59d44bf58c" title="Duplicates a string.">_dbus_strdup</a> (<a class="code" href="group__DBusCredentials.html#ga53680e02140559fb36efeec68d398ac0" title="Gets the Windows user SID in the credentials, or NULL if the credentials object doesn't contain a Win...">_dbus_credentials_get_windows_sid</a> (auth_identity));
<a name="l01453"></a>01453
<a name="l01454"></a>01454 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to "1".">TRUE</a>;
<a name="l01455"></a>01455 }
<a name="l01456"></a>01456 <span class="keywordflow">else</span>
<a name="l01457"></a>01457 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to "0".">FALSE</a>;
<a name="l01458"></a>01458 }
<a name="l01459"></a>01459
<a name="l01471"></a>01471 <span class="keywordtype">void</span>
<a name="l01472"></a><a class="code" href="group__DBusTransport.html#gadbf528ef41efde73d0bc386d10b7f5b1">01472</a> <a class="code" href="group__DBusTransport.html#gadbf528ef41efde73d0bc386d10b7f5b1" title="See dbus_connection_set_windows_user_function().">_dbus_transport_set_windows_user_function</a> (<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport,
<a name="l01473"></a>01473 <a class="code" href="group__DBusConnection.html#ga47436366726762688036c600d651bab6" title="Called during authentication to check whether the given Windows user ID is allowed to connect...">DBusAllowWindowsUserFunction</a> <span class="keyword">function</span>,
<a name="l01474"></a>01474 <span class="keywordtype">void</span> *data,
<a name="l01475"></a>01475 <a class="code" href="group__DBusMemory.html#ga061bcded226d76c7d7de35beaa165cb5" title="The type of a function which frees a block of memory.">DBusFreeFunction</a> free_data_function,
<a name="l01476"></a>01476 <span class="keywordtype">void</span> **old_data,
<a name="l01477"></a>01477 <a class="code" href="group__DBusMemory.html#ga061bcded226d76c7d7de35beaa165cb5" title="The type of a function which frees a block of memory.">DBusFreeFunction</a> *old_free_data_function)
<a name="l01478"></a>01478 {
<a name="l01479"></a>01479 *old_data = transport-><a class="code" href="structDBusTransport.html#a333c4300fe345d25e9dcb828d20baff7" title="Data for windows_user_function.">windows_user_data</a>;
<a name="l01480"></a>01480 *old_free_data_function = transport-><a class="code" href="structDBusTransport.html#aab0e5248bd01f31ac4dcdab3c3b7b570" title="Function to free windows_user_data.">free_windows_user_data</a>;
<a name="l01481"></a>01481
<a name="l01482"></a>01482 transport-><a class="code" href="structDBusTransport.html#a17403591c2a1d936be5ed13a36e6416a" title="Function for checking whether a user is authorized.">windows_user_function</a> = <span class="keyword">function</span>;
<a name="l01483"></a>01483 transport-><a class="code" href="structDBusTransport.html#a333c4300fe345d25e9dcb828d20baff7" title="Data for windows_user_function.">windows_user_data</a> = data;
<a name="l01484"></a>01484 transport-><a class="code" href="structDBusTransport.html#aab0e5248bd01f31ac4dcdab3c3b7b570" title="Function to free windows_user_data.">free_windows_user_data</a> = free_data_function;
<a name="l01485"></a>01485 }
<a name="l01486"></a>01486
<a name="l01495"></a>01495 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l01496"></a><a class="code" href="group__DBusTransport.html#ga345827326824547201e8c517474af135">01496</a> <a class="code" href="group__DBusTransport.html#ga345827326824547201e8c517474af135" title="Sets the SASL authentication mechanisms supported by this transport.">_dbus_transport_set_auth_mechanisms</a> (<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport,
<a name="l01497"></a>01497 <span class="keyword">const</span> <span class="keywordtype">char</span> **mechanisms)
<a name="l01498"></a>01498 {
<a name="l01499"></a>01499 <span class="keywordflow">return</span> <a class="code" href="group__DBusAuth.html#ga9454e2c512b4e2ea54d47cff6acaa4db" title="Sets an array of authentication mechanism names that we are willing to use.">_dbus_auth_set_mechanisms</a> (transport-><a class="code" href="structDBusTransport.html#acf71c91312f325be13ce6c09298b1eb8" title="Authentication conversation.">auth</a>, mechanisms);
<a name="l01500"></a>01500 }
<a name="l01501"></a>01501
<a name="l01508"></a>01508 <span class="keywordtype">void</span>
<a name="l01509"></a><a class="code" href="group__DBusTransport.html#ga5f4bd7eb5621003595b75cb8033463cd">01509</a> <a class="code" href="group__DBusTransport.html#ga5f4bd7eb5621003595b75cb8033463cd" title="See dbus_connection_set_allow_anonymous()">_dbus_transport_set_allow_anonymous</a> (<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport,
<a name="l01510"></a>01510 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> value)
<a name="l01511"></a>01511 {
<a name="l01512"></a>01512 transport-><a class="code" href="structDBusTransport.html#a30a82ca7826ef4735a5caa4c921ec014" title="TRUE if an anonymous client can connect">allow_anonymous</a> = value != <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to "0".">FALSE</a>;
<a name="l01513"></a>01513 }
<a name="l01514"></a>01514
<a name="l01520"></a>01520 <span class="keywordtype">int</span>
<a name="l01521"></a><a class="code" href="group__DBusTransport.html#ga3545c064545957f73f583bf63d07c40c">01521</a> <a class="code" href="group__DBusTransport.html#ga3545c064545957f73f583bf63d07c40c" title="Return how many file descriptors are pending in the loader.">_dbus_transport_get_pending_fds_count</a> (<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport)
<a name="l01522"></a>01522 {
<a name="l01523"></a>01523 <span class="keywordflow">return</span> <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> (transport-><a class="code" href="structDBusTransport.html#aaaba590c281236d176600016b7edab48" title="Message-loading buffer.">loader</a>);
<a name="l01524"></a>01524 }
<a name="l01525"></a>01525
<a name="l01533"></a>01533 <span class="keywordtype">void</span>
<a name="l01534"></a><a class="code" href="group__DBusTransport.html#gad6dccbcdc149e3305101db4b2ebae6d6">01534</a> <a class="code" href="group__DBusTransport.html#gad6dccbcdc149e3305101db4b2ebae6d6" title="Register a function to be called whenever the number of pending file descriptors in the loader change...">_dbus_transport_set_pending_fds_function</a> (<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport,
<a name="l01535"></a>01535 <span class="keywordtype">void</span> (* callback) (<span class="keywordtype">void</span> *),
<a name="l01536"></a>01536 <span class="keywordtype">void</span> *data)
<a name="l01537"></a>01537 {
<a name="l01538"></a>01538 <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> (transport-><a class="code" href="structDBusTransport.html#aaaba590c281236d176600016b7edab48" title="Message-loading buffer.">loader</a>,
<a name="l01539"></a>01539 callback, data);
<a name="l01540"></a>01540 }
<a name="l01541"></a>01541
<a name="l01542"></a>01542 <span class="preprocessor">#ifdef DBUS_ENABLE_STATS</span>
<a name="l01543"></a>01543 <span class="preprocessor"></span><span class="keywordtype">void</span>
<a name="l01544"></a>01544 _dbus_transport_get_stats (<a class="code" href="structDBusTransport.html" title="Object representing a transport such as a socket.">DBusTransport</a> *transport,
<a name="l01545"></a>01545 <a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a> *queue_bytes,
<a name="l01546"></a>01546 <a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a> *queue_fds,
<a name="l01547"></a>01547 <a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a> *peak_queue_bytes,
<a name="l01548"></a>01548 <a class="code" href="group__DBusTypes.html#gaf513803b030613a669cc7ef199f90a8b" title="A 32-bit unsigned integer on all platforms.">dbus_uint32_t</a> *peak_queue_fds)
<a name="l01549"></a>01549 {
<a name="l01550"></a>01550 <span class="keywordflow">if</span> (queue_bytes != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01551"></a>01551 *queue_bytes = <a class="code" href="group__DBusResources.html#ga49de078fb626aff30f273933ad5c8b2a" title="Gets the current value of the size counter.">_dbus_counter_get_size_value</a> (transport-><a class="code" href="structDBusTransport.html#afb19bae6f7cfe595f3f1ae0ce53ccab0" title="Counter for size/unix fds of all live messages.">live_messages</a>);
<a name="l01552"></a>01552
<a name="l01553"></a>01553 <span class="keywordflow">if</span> (queue_fds != <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 *queue_fds = <a class="code" href="group__DBusResources.html#ga25b2d12b9dc4d3525df2b8401f4ce56d" title="Gets the current value of the unix fd counter.">_dbus_counter_get_unix_fd_value</a> (transport-><a class="code" href="structDBusTransport.html#afb19bae6f7cfe595f3f1ae0ce53ccab0" title="Counter for size/unix fds of all live messages.">live_messages</a>);
<a name="l01555"></a>01555
<a name="l01556"></a>01556 <span class="keywordflow">if</span> (peak_queue_bytes != <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 *peak_queue_bytes = _dbus_counter_get_peak_size_value (transport-><a class="code" href="structDBusTransport.html#afb19bae6f7cfe595f3f1ae0ce53ccab0" title="Counter for size/unix fds of all live messages.">live_messages</a>);
<a name="l01558"></a>01558
<a name="l01559"></a>01559 <span class="keywordflow">if</span> (peak_queue_fds != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l01560"></a>01560 *peak_queue_fds = _dbus_counter_get_peak_unix_fd_value (transport-><a class="code" href="structDBusTransport.html#afb19bae6f7cfe595f3f1ae0ce53ccab0" title="Counter for size/unix fds of all live messages.">live_messages</a>);
<a name="l01561"></a>01561 }
<a name="l01562"></a>01562 <span class="preprocessor">#endif </span><span class="comment">/* DBUS_ENABLE_STATS */</span>
<a name="l01563"></a>01563
</pre></div></div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated on Thu Mar 3 2016 17:50:32 for D-Bus by  <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>