|
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17 System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 User : nobody ( 99) PHP Version : 5.2.17 Disable Function : NONE Directory : /usr/share/devhelp/books/dbus/api/ |
Upload File : |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>D-Bus: dbus-server.c Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.7 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main Page</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 id="current"><a href="files.html"><span>Files</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
</ul></div>
<h1>dbus-server.c</h1><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-server.c DBusServer object</span>
<a name="l00003"></a>00003 <span class="comment"> *</span>
<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002, 2003, 2004, 2005 Red Hat Inc.</span>
<a name="l00005"></a>00005 <span class="comment"> *</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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 "dbus-server.h"</span>
<a name="l00025"></a>00025 <span class="preprocessor">#include "dbus-server-unix.h"</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include "dbus-server-socket.h"</span>
<a name="l00027"></a>00027 <span class="preprocessor">#include "dbus-string.h"</span>
<a name="l00028"></a>00028 <span class="preprocessor">#ifdef DBUS_BUILD_TESTS</span>
<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include "dbus-server-debug-pipe.h"</span>
<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
<a name="l00031"></a>00031 <span class="preprocessor"></span><span class="preprocessor">#include "dbus-address.h"</span>
<a name="l00032"></a>00032 <span class="preprocessor">#include "dbus-protocol.h"</span>
<a name="l00033"></a>00033
<a name="l00055"></a>00055 <span class="comment">/* this is a little fragile since it assumes the address doesn't</span>
<a name="l00056"></a>00056 <span class="comment"> * already have a guid, but it shouldn't</span>
<a name="l00057"></a>00057 <span class="comment"> */</span>
<a name="l00058"></a>00058 <span class="keyword">static</span> <span class="keywordtype">char</span>*
<a name="l00059"></a>00059 copy_address_with_guid_appended (<span class="keyword">const</span> <a class="code" href="structDBusString.html">DBusString</a> *address,
<a name="l00060"></a>00060 <span class="keyword">const</span> <a class="code" href="structDBusString.html">DBusString</a> *guid_hex)
<a name="l00061"></a>00061 {
<a name="l00062"></a>00062 <a class="code" href="structDBusString.html">DBusString</a> with_guid;
<a name="l00063"></a>00063 <span class="keywordtype">char</span> *retval;
<a name="l00064"></a>00064
<a name="l00065"></a>00065 <span class="keywordflow">if</span> (!<a class="code" href="group__DBusString.html#g348252317f7bb8ac43529972945830ae">_dbus_string_init</a> (&with_guid))
<a name="l00066"></a>00066 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00067"></a>00067
<a name="l00068"></a>00068 <span class="keywordflow">if</span> (!<a class="code" href="group__DBusString.html#g3c10f0d1bcaa3b450025b9c6a8b901d7">_dbus_string_copy</a> (address, 0, &with_guid,
<a name="l00069"></a>00069 _dbus_string_get_length (&with_guid)) ||
<a name="l00070"></a>00070 !<a class="code" href="group__DBusString.html#g100c5ce0696822c5a4cfbdfaba674d96">_dbus_string_append</a> (&with_guid, <span class="stringliteral">",guid="</span>) ||
<a name="l00071"></a>00071 !<a class="code" href="group__DBusString.html#g3c10f0d1bcaa3b450025b9c6a8b901d7">_dbus_string_copy</a> (guid_hex, 0,
<a name="l00072"></a>00072 &with_guid, _dbus_string_get_length (&with_guid)))
<a name="l00073"></a>00073 {
<a name="l00074"></a>00074 <a class="code" href="group__DBusString.html#g781ca91acda49a834dce7d0ed0eef212">_dbus_string_free</a> (&with_guid);
<a name="l00075"></a>00075 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00076"></a>00076 }
<a name="l00077"></a>00077
<a name="l00078"></a>00078 retval = <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00079"></a>00079 <a class="code" href="group__DBusString.html#g556cc30c3ab032dbc63e217119f0d1f5">_dbus_string_steal_data</a> (&with_guid, &retval);
<a name="l00080"></a>00080
<a name="l00081"></a>00081 <a class="code" href="group__DBusString.html#g781ca91acda49a834dce7d0ed0eef212">_dbus_string_free</a> (&with_guid);
<a name="l00082"></a>00082
<a name="l00083"></a>00083 <span class="keywordflow">return</span> retval; <span class="comment">/* may be NULL if steal_data failed */</span>
<a name="l00084"></a>00084 }
<a name="l00085"></a>00085
<a name="l00095"></a>00095 <a class="code" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a>
<a name="l00096"></a><a class="code" href="group__DBusServerInternals.html#gacfb3d29553f205b362c850cfda02fd9">00096</a> <a class="code" href="group__DBusServerInternals.html#gacfb3d29553f205b362c850cfda02fd9">_dbus_server_init_base</a> (<a class="code" href="structDBusServer.html">DBusServer</a> *server,
<a name="l00097"></a>00097 <span class="keyword">const</span> <a class="code" href="structDBusServerVTable.html">DBusServerVTable</a> *vtable,
<a name="l00098"></a>00098 <span class="keyword">const</span> <a class="code" href="structDBusString.html">DBusString</a> *address)
<a name="l00099"></a>00099 {
<a name="l00100"></a>00100 server-><a class="code" href="structDBusServer.html#a5068890fea8c7e7261b600e7256e009">vtable</a> = vtable;
<a name="l00101"></a>00101 server-><a class="code" href="structDBusServer.html#7578bd99fc8aee641cbb5198cb2e7004">refcount</a>.<a class="code" href="structDBusAtomic.html#ef100f17856a635a9d0f3cae7a7f6bf8">value</a> = 1;
<a name="l00102"></a>00102
<a name="l00103"></a>00103 server-><a class="code" href="structDBusServer.html#359852bf33b3051180a9477da4d89acd">address</a> = <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00104"></a>00104 server-><a class="code" href="structDBusServer.html#7955050967aeaf09679f8ba1f2941880">watches</a> = <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00105"></a>00105 server-><a class="code" href="structDBusServer.html#fcaccd00f2392a390616c47e425bae85">timeouts</a> = <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00106"></a>00106
<a name="l00107"></a>00107 <span class="keywordflow">if</span> (!<a class="code" href="group__DBusString.html#g348252317f7bb8ac43529972945830ae">_dbus_string_init</a> (&server-><a class="code" href="structDBusServer.html#79cd5d1b25412d56b7fd41902d575794">guid_hex</a>))
<a name="l00108"></a>00108 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#ga93f0eb578d23995850d61f7d61c55c1">FALSE</a>;
<a name="l00109"></a>00109
<a name="l00110"></a>00110 <a class="code" href="group__DBusInternalsUtils.html#g08c2922335845e5c857e88399436b9ba">_dbus_generate_uuid</a> (&server-><a class="code" href="structDBusServer.html#799a94be0e3078f2e636f322f57d66f9">guid</a>);
<a name="l00111"></a>00111
<a name="l00112"></a>00112 <span class="keywordflow">if</span> (!<a class="code" href="group__DBusInternalsUtils.html#gf08364813376bd2d8f455d435d85323e">_dbus_uuid_encode</a> (&server-><a class="code" href="structDBusServer.html#799a94be0e3078f2e636f322f57d66f9">guid</a>, &server-><a class="code" href="structDBusServer.html#79cd5d1b25412d56b7fd41902d575794">guid_hex</a>))
<a name="l00113"></a>00113 <span class="keywordflow">goto</span> failed;
<a name="l00114"></a>00114
<a name="l00115"></a>00115 server-><a class="code" href="structDBusServer.html#359852bf33b3051180a9477da4d89acd">address</a> = copy_address_with_guid_appended (address,
<a name="l00116"></a>00116 &server-><a class="code" href="structDBusServer.html#79cd5d1b25412d56b7fd41902d575794">guid_hex</a>);
<a name="l00117"></a>00117 <span class="keywordflow">if</span> (server-><a class="code" href="structDBusServer.html#359852bf33b3051180a9477da4d89acd">address</a> == <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>)
<a name="l00118"></a>00118 <span class="keywordflow">goto</span> failed;
<a name="l00119"></a>00119
<a name="l00120"></a>00120 <a class="code" href="group__DBusThreadsInternals.html#g5b22688470ddee6e7b9c9b6eb751fa2e">_dbus_mutex_new_at_location</a> (&server-><a class="code" href="structDBusServer.html#62732ec74cf0293382f588fb1f417470">mutex</a>);
<a name="l00121"></a>00121 <span class="keywordflow">if</span> (server-><a class="code" href="structDBusServer.html#62732ec74cf0293382f588fb1f417470">mutex</a> == <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>)
<a name="l00122"></a>00122 <span class="keywordflow">goto</span> failed;
<a name="l00123"></a>00123
<a name="l00124"></a>00124 server-><a class="code" href="structDBusServer.html#7955050967aeaf09679f8ba1f2941880">watches</a> = <a class="code" href="group__DBusWatchInternals.html#g5d9db5d0af5916a5ec890eb38d5741eb">_dbus_watch_list_new</a> ();
<a name="l00125"></a>00125 <span class="keywordflow">if</span> (server-><a class="code" href="structDBusServer.html#7955050967aeaf09679f8ba1f2941880">watches</a> == <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>)
<a name="l00126"></a>00126 <span class="keywordflow">goto</span> failed;
<a name="l00127"></a>00127
<a name="l00128"></a>00128 server-><a class="code" href="structDBusServer.html#fcaccd00f2392a390616c47e425bae85">timeouts</a> = <a class="code" href="group__DBusTimeoutInternals.html#g5b122b35cdb3926b7dc2d084ddff9d62">_dbus_timeout_list_new</a> ();
<a name="l00129"></a>00129 <span class="keywordflow">if</span> (server-><a class="code" href="structDBusServer.html#fcaccd00f2392a390616c47e425bae85">timeouts</a> == <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>)
<a name="l00130"></a>00130 <span class="keywordflow">goto</span> failed;
<a name="l00131"></a>00131
<a name="l00132"></a>00132 <a class="code" href="group__DBusDataSlot.html#g6de49b3a1210202215d40a5a19806992">_dbus_data_slot_list_init</a> (&server-><a class="code" href="structDBusServer.html#0601cca8307ba17d4a8bcebe48b08362">slot_list</a>);
<a name="l00133"></a>00133
<a name="l00134"></a>00134 _dbus_verbose (<span class="stringliteral">"Initialized server on address %s\n"</span>, server-><a class="code" href="structDBusServer.html#359852bf33b3051180a9477da4d89acd">address</a>);
<a name="l00135"></a>00135
<a name="l00136"></a>00136 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#ga8cecfc5c5c054d2875c03e77b7be15d">TRUE</a>;
<a name="l00137"></a>00137
<a name="l00138"></a>00138 failed:
<a name="l00139"></a>00139 <a class="code" href="group__DBusThreadsInternals.html#gfd7f94bf0c265660749ffa690e76248a">_dbus_mutex_free_at_location</a> (&server-><a class="code" href="structDBusServer.html#62732ec74cf0293382f588fb1f417470">mutex</a>);
<a name="l00140"></a>00140 server-><a class="code" href="structDBusServer.html#62732ec74cf0293382f588fb1f417470">mutex</a> = <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00141"></a>00141 <span class="keywordflow">if</span> (server-><a class="code" href="structDBusServer.html#7955050967aeaf09679f8ba1f2941880">watches</a>)
<a name="l00142"></a>00142 {
<a name="l00143"></a>00143 <a class="code" href="group__DBusWatchInternals.html#gc3f75c0da2c8c51e8708f45dd27f9e2d">_dbus_watch_list_free</a> (server-><a class="code" href="structDBusServer.html#7955050967aeaf09679f8ba1f2941880">watches</a>);
<a name="l00144"></a>00144 server-><a class="code" href="structDBusServer.html#7955050967aeaf09679f8ba1f2941880">watches</a> = <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00145"></a>00145 }
<a name="l00146"></a>00146 <span class="keywordflow">if</span> (server-><a class="code" href="structDBusServer.html#fcaccd00f2392a390616c47e425bae85">timeouts</a>)
<a name="l00147"></a>00147 {
<a name="l00148"></a>00148 <a class="code" href="group__DBusTimeoutInternals.html#g1b399ef2d7f128e59bb32dbb5b590e1b">_dbus_timeout_list_free</a> (server-><a class="code" href="structDBusServer.html#fcaccd00f2392a390616c47e425bae85">timeouts</a>);
<a name="l00149"></a>00149 server-><a class="code" href="structDBusServer.html#fcaccd00f2392a390616c47e425bae85">timeouts</a> = <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00150"></a>00150 }
<a name="l00151"></a>00151 <span class="keywordflow">if</span> (server-><a class="code" href="structDBusServer.html#359852bf33b3051180a9477da4d89acd">address</a>)
<a name="l00152"></a>00152 {
<a name="l00153"></a>00153 <a class="code" href="group__DBusMemory.html#g488c6b08cc8c1ddf0203243c4b27a13c">dbus_free</a> (server-><a class="code" href="structDBusServer.html#359852bf33b3051180a9477da4d89acd">address</a>);
<a name="l00154"></a>00154 server-><a class="code" href="structDBusServer.html#359852bf33b3051180a9477da4d89acd">address</a> = <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00155"></a>00155 }
<a name="l00156"></a>00156 <a class="code" href="group__DBusString.html#g781ca91acda49a834dce7d0ed0eef212">_dbus_string_free</a> (&server-><a class="code" href="structDBusServer.html#79cd5d1b25412d56b7fd41902d575794">guid_hex</a>);
<a name="l00157"></a>00157
<a name="l00158"></a>00158 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#ga93f0eb578d23995850d61f7d61c55c1">FALSE</a>;
<a name="l00159"></a>00159 }
<a name="l00160"></a>00160
<a name="l00167"></a>00167 <span class="keywordtype">void</span>
<a name="l00168"></a><a class="code" href="group__DBusServerInternals.html#g93b5bca90e69122d5acbbeef2b4ca03e">00168</a> <a class="code" href="group__DBusServerInternals.html#g93b5bca90e69122d5acbbeef2b4ca03e">_dbus_server_finalize_base</a> (<a class="code" href="structDBusServer.html">DBusServer</a> *server)
<a name="l00169"></a>00169 {
<a name="l00170"></a>00170 <span class="comment">/* We don't have the lock, but nobody should be accessing</span>
<a name="l00171"></a>00171 <span class="comment"> * concurrently since they don't have a ref</span>
<a name="l00172"></a>00172 <span class="comment"> */</span>
<a name="l00173"></a>00173 <span class="preprocessor">#ifndef DBUS_DISABLE_CHECKS</span>
<a name="l00174"></a>00174 <span class="preprocessor"></span> <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (!server-><a class="code" href="structDBusServer.html#dba8dd016471a800525a42926f9ee061">have_server_lock</a>);
<a name="l00175"></a>00175 <span class="preprocessor">#endif</span>
<a name="l00176"></a>00176 <span class="preprocessor"></span> <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (server-><a class="code" href="structDBusServer.html#7dabb30cdc09d6102810029fb56b8dfe">disconnected</a>);
<a name="l00177"></a>00177
<a name="l00178"></a>00178 <span class="comment">/* calls out to application code... */</span>
<a name="l00179"></a>00179 <a class="code" href="group__DBusDataSlot.html#gbc399733376c462c3010271a2d431e73">_dbus_data_slot_list_free</a> (&server-><a class="code" href="structDBusServer.html#0601cca8307ba17d4a8bcebe48b08362">slot_list</a>);
<a name="l00180"></a>00180
<a name="l00181"></a>00181 <a class="code" href="group__DBusServer.html#gcf6686c9b7d53124b7f2ef1349a30148">dbus_server_set_new_connection_function</a> (server, <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>, <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>, <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>);
<a name="l00182"></a>00182
<a name="l00183"></a>00183 <a class="code" href="group__DBusWatchInternals.html#gc3f75c0da2c8c51e8708f45dd27f9e2d">_dbus_watch_list_free</a> (server-><a class="code" href="structDBusServer.html#7955050967aeaf09679f8ba1f2941880">watches</a>);
<a name="l00184"></a>00184 <a class="code" href="group__DBusTimeoutInternals.html#g1b399ef2d7f128e59bb32dbb5b590e1b">_dbus_timeout_list_free</a> (server-><a class="code" href="structDBusServer.html#fcaccd00f2392a390616c47e425bae85">timeouts</a>);
<a name="l00185"></a>00185
<a name="l00186"></a>00186 <a class="code" href="group__DBusThreadsInternals.html#gfd7f94bf0c265660749ffa690e76248a">_dbus_mutex_free_at_location</a> (&server-><a class="code" href="structDBusServer.html#62732ec74cf0293382f588fb1f417470">mutex</a>);
<a name="l00187"></a>00187
<a name="l00188"></a>00188 <a class="code" href="group__DBusMemory.html#g488c6b08cc8c1ddf0203243c4b27a13c">dbus_free</a> (server-><a class="code" href="structDBusServer.html#359852bf33b3051180a9477da4d89acd">address</a>);
<a name="l00189"></a>00189
<a name="l00190"></a>00190 <a class="code" href="group__DBusMemory.html#g6d4674de64d806d238ffd309a486754e">dbus_free_string_array</a> (server-><a class="code" href="structDBusServer.html#dc1032bbed41413e5d0e01578f2bfffc">auth_mechanisms</a>);
<a name="l00191"></a>00191
<a name="l00192"></a>00192 <a class="code" href="group__DBusString.html#g781ca91acda49a834dce7d0ed0eef212">_dbus_string_free</a> (&server-><a class="code" href="structDBusServer.html#79cd5d1b25412d56b7fd41902d575794">guid_hex</a>);
<a name="l00193"></a>00193 }
<a name="l00194"></a>00194
<a name="l00195"></a>00195
<a name="l00197"></a><a class="code" href="group__DBusServerInternals.html#gc0512dbb099a3cb80f503a647328c369">00197</a> <span class="keyword">typedef</span> <a class="code" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a> (* <a class="code" href="group__DBusConnectionInternals.html#gc0512dbb099a3cb80f503a647328c369">DBusWatchAddFunction</a>) (<a class="code" href="structDBusWatchList.html">DBusWatchList</a> *list,
<a name="l00198"></a>00198 <a class="code" href="structDBusWatch.html">DBusWatch</a> *watch);
<a name="l00200"></a><a class="code" href="group__DBusServerInternals.html#g219d92aa1ad72a99b4b6f610fb9a0cc6">00200</a> <span class="keyword">typedef</span> void (* <a class="code" href="group__DBusConnectionInternals.html#g219d92aa1ad72a99b4b6f610fb9a0cc6">DBusWatchRemoveFunction</a>) (<a class="code" href="structDBusWatchList.html">DBusWatchList</a> *list,
<a name="l00201"></a>00201 <a class="code" href="structDBusWatch.html">DBusWatch</a> *watch);
<a name="l00203"></a><a class="code" href="group__DBusServerInternals.html#ga7518254a3f5a36ee6dc00e4c21e7bff">00203</a> <span class="keyword">typedef</span> void (* <a class="code" href="group__DBusConnectionInternals.html#ga7518254a3f5a36ee6dc00e4c21e7bff">DBusWatchToggleFunction</a>) (<a class="code" href="structDBusWatchList.html">DBusWatchList</a> *list,
<a name="l00204"></a>00204 <a class="code" href="structDBusWatch.html">DBusWatch</a> *watch,
<a name="l00205"></a>00205 <a class="code" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a> enabled);
<a name="l00206"></a>00206
<a name="l00207"></a>00207 <span class="keyword">static</span> <a class="code" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a>
<a name="l00208"></a>00208 protected_change_watch (<a class="code" href="structDBusServer.html">DBusServer</a> *server,
<a name="l00209"></a>00209 <a class="code" href="structDBusWatch.html">DBusWatch</a> *watch,
<a name="l00210"></a>00210 <a class="code" href="group__DBusConnectionInternals.html#gc0512dbb099a3cb80f503a647328c369">DBusWatchAddFunction</a> add_function,
<a name="l00211"></a>00211 <a class="code" href="group__DBusConnectionInternals.html#g219d92aa1ad72a99b4b6f610fb9a0cc6">DBusWatchRemoveFunction</a> remove_function,
<a name="l00212"></a>00212 <a class="code" href="group__DBusConnectionInternals.html#ga7518254a3f5a36ee6dc00e4c21e7bff">DBusWatchToggleFunction</a> toggle_function,
<a name="l00213"></a>00213 <a class="code" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a> enabled)
<a name="l00214"></a>00214 {
<a name="l00215"></a>00215 <a class="code" href="structDBusWatchList.html">DBusWatchList</a> *watches;
<a name="l00216"></a>00216 <a class="code" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a> retval;
<a name="l00217"></a>00217
<a name="l00218"></a>00218 HAVE_LOCK_CHECK (server);
<a name="l00219"></a>00219
<a name="l00220"></a>00220 <span class="comment">/* This isn't really safe or reasonable; a better pattern is the "do</span>
<a name="l00221"></a>00221 <span class="comment"> * everything, then drop lock and call out" one; but it has to be</span>
<a name="l00222"></a>00222 <span class="comment"> * propagated up through all callers</span>
<a name="l00223"></a>00223 <span class="comment"> */</span>
<a name="l00224"></a>00224
<a name="l00225"></a>00225 watches = server-><a class="code" href="structDBusServer.html#7955050967aeaf09679f8ba1f2941880">watches</a>;
<a name="l00226"></a>00226 <span class="keywordflow">if</span> (watches)
<a name="l00227"></a>00227 {
<a name="l00228"></a>00228 server-><a class="code" href="structDBusServer.html#7955050967aeaf09679f8ba1f2941880">watches</a> = <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00229"></a>00229 <a class="code" href="group__DBusServerInternals.html#g987e9bf42ab4e4cededa8e8f65c54e2e">_dbus_server_ref_unlocked</a> (server);
<a name="l00230"></a>00230 SERVER_UNLOCK (server);
<a name="l00231"></a>00231
<a name="l00232"></a>00232 <span class="keywordflow">if</span> (add_function)
<a name="l00233"></a>00233 retval = (* add_function) (watches, watch);
<a name="l00234"></a>00234 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (remove_function)
<a name="l00235"></a>00235 {
<a name="l00236"></a>00236 retval = <a class="code" href="group__DBusMacros.html#ga8cecfc5c5c054d2875c03e77b7be15d">TRUE</a>;
<a name="l00237"></a>00237 (* remove_function) (watches, watch);
<a name="l00238"></a>00238 }
<a name="l00239"></a>00239 <span class="keywordflow">else</span>
<a name="l00240"></a>00240 {
<a name="l00241"></a>00241 retval = <a class="code" href="group__DBusMacros.html#ga8cecfc5c5c054d2875c03e77b7be15d">TRUE</a>;
<a name="l00242"></a>00242 (* toggle_function) (watches, watch, enabled);
<a name="l00243"></a>00243 }
<a name="l00244"></a>00244
<a name="l00245"></a>00245 SERVER_LOCK (server);
<a name="l00246"></a>00246 server-><a class="code" href="structDBusServer.html#7955050967aeaf09679f8ba1f2941880">watches</a> = watches;
<a name="l00247"></a>00247 <a class="code" href="group__DBusServerInternals.html#g6e1d0b379c98b0d59ebd19dc9b8a2dbe">_dbus_server_unref_unlocked</a> (server);
<a name="l00248"></a>00248
<a name="l00249"></a>00249 <span class="keywordflow">return</span> retval;
<a name="l00250"></a>00250 }
<a name="l00251"></a>00251 <span class="keywordflow">else</span>
<a name="l00252"></a>00252 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#ga93f0eb578d23995850d61f7d61c55c1">FALSE</a>;
<a name="l00253"></a>00253 }
<a name="l00254"></a>00254
<a name="l00262"></a>00262 <a class="code" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a>
<a name="l00263"></a><a class="code" href="group__DBusServerInternals.html#g0866e5b205b8a570c77c8ad787b665fd">00263</a> <a class="code" href="group__DBusServerInternals.html#g0866e5b205b8a570c77c8ad787b665fd">_dbus_server_add_watch</a> (<a class="code" href="structDBusServer.html">DBusServer</a> *server,
<a name="l00264"></a>00264 <a class="code" href="structDBusWatch.html">DBusWatch</a> *watch)
<a name="l00265"></a>00265 {
<a name="l00266"></a>00266 HAVE_LOCK_CHECK (server);
<a name="l00267"></a>00267 <span class="keywordflow">return</span> protected_change_watch (server, watch,
<a name="l00268"></a>00268 <a class="code" href="group__DBusWatchInternals.html#gec61655a4bd6186a6a1ec104771d8af5">_dbus_watch_list_add_watch</a>,
<a name="l00269"></a>00269 <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>, <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>, <a class="code" href="group__DBusMacros.html#ga93f0eb578d23995850d61f7d61c55c1">FALSE</a>);
<a name="l00270"></a>00270 }
<a name="l00271"></a>00271
<a name="l00278"></a>00278 <span class="keywordtype">void</span>
<a name="l00279"></a><a class="code" href="group__DBusServerInternals.html#g61cfdbfcc9316d4bae55f83b069f248c">00279</a> <a class="code" href="group__DBusServerInternals.html#g61cfdbfcc9316d4bae55f83b069f248c">_dbus_server_remove_watch</a> (<a class="code" href="structDBusServer.html">DBusServer</a> *server,
<a name="l00280"></a>00280 <a class="code" href="structDBusWatch.html">DBusWatch</a> *watch)
<a name="l00281"></a>00281 {
<a name="l00282"></a>00282 HAVE_LOCK_CHECK (server);
<a name="l00283"></a>00283 protected_change_watch (server, watch,
<a name="l00284"></a>00284 <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>,
<a name="l00285"></a>00285 <a class="code" href="group__DBusWatchInternals.html#g76894d297bc7d7d23cbacdc2b1778884">_dbus_watch_list_remove_watch</a>,
<a name="l00286"></a>00286 <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>, <a class="code" href="group__DBusMacros.html#ga93f0eb578d23995850d61f7d61c55c1">FALSE</a>);
<a name="l00287"></a>00287 }
<a name="l00288"></a>00288
<a name="l00298"></a>00298 <span class="keywordtype">void</span>
<a name="l00299"></a><a class="code" href="group__DBusServerInternals.html#g7bef63b643f53ec984f5da35653689e7">00299</a> <a class="code" href="group__DBusServerInternals.html#g7bef63b643f53ec984f5da35653689e7">_dbus_server_toggle_watch</a> (<a class="code" href="structDBusServer.html">DBusServer</a> *server,
<a name="l00300"></a>00300 <a class="code" href="structDBusWatch.html">DBusWatch</a> *watch,
<a name="l00301"></a>00301 <a class="code" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a> enabled)
<a name="l00302"></a>00302 {
<a name="l00303"></a>00303 <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (watch != <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>);
<a name="l00304"></a>00304
<a name="l00305"></a>00305 HAVE_LOCK_CHECK (server);
<a name="l00306"></a>00306 protected_change_watch (server, watch,
<a name="l00307"></a>00307 <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>, <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>,
<a name="l00308"></a>00308 <a class="code" href="group__DBusWatchInternals.html#g14bb50e8663a1d9d3960b4f73c09c097">_dbus_watch_list_toggle_watch</a>,
<a name="l00309"></a>00309 enabled);
<a name="l00310"></a>00310 }
<a name="l00311"></a>00311
<a name="l00313"></a><a class="code" href="group__DBusServerInternals.html#gdfaf37b40bf7fb9025bcf99400306062">00313</a> <span class="keyword">typedef</span> <a class="code" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a> (* <a class="code" href="group__DBusConnectionInternals.html#gdfaf37b40bf7fb9025bcf99400306062">DBusTimeoutAddFunction</a>) (<a class="code" href="structDBusTimeoutList.html">DBusTimeoutList</a> *list,
<a name="l00314"></a>00314 <a class="code" href="structDBusTimeout.html">DBusTimeout</a> *timeout);
<a name="l00316"></a><a class="code" href="group__DBusServerInternals.html#gd5321323beee432e7d742a13f511eb9f">00316</a> <span class="keyword">typedef</span> void (* <a class="code" href="group__DBusConnectionInternals.html#gd5321323beee432e7d742a13f511eb9f">DBusTimeoutRemoveFunction</a>) (<a class="code" href="structDBusTimeoutList.html">DBusTimeoutList</a> *list,
<a name="l00317"></a>00317 <a class="code" href="structDBusTimeout.html">DBusTimeout</a> *timeout);
<a name="l00319"></a><a class="code" href="group__DBusServerInternals.html#g110617d1769f3ca556737cbeae2f0427">00319</a> <span class="keyword">typedef</span> void (* <a class="code" href="group__DBusConnectionInternals.html#g110617d1769f3ca556737cbeae2f0427">DBusTimeoutToggleFunction</a>) (<a class="code" href="structDBusTimeoutList.html">DBusTimeoutList</a> *list,
<a name="l00320"></a>00320 <a class="code" href="structDBusTimeout.html">DBusTimeout</a> *timeout,
<a name="l00321"></a>00321 <a class="code" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a> enabled);
<a name="l00322"></a>00322
<a name="l00323"></a>00323
<a name="l00324"></a>00324 <span class="keyword">static</span> <a class="code" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a>
<a name="l00325"></a>00325 protected_change_timeout (<a class="code" href="structDBusServer.html">DBusServer</a> *server,
<a name="l00326"></a>00326 <a class="code" href="structDBusTimeout.html">DBusTimeout</a> *timeout,
<a name="l00327"></a>00327 <a class="code" href="group__DBusConnectionInternals.html#gdfaf37b40bf7fb9025bcf99400306062">DBusTimeoutAddFunction</a> add_function,
<a name="l00328"></a>00328 <a class="code" href="group__DBusConnectionInternals.html#gd5321323beee432e7d742a13f511eb9f">DBusTimeoutRemoveFunction</a> remove_function,
<a name="l00329"></a>00329 <a class="code" href="group__DBusConnectionInternals.html#g110617d1769f3ca556737cbeae2f0427">DBusTimeoutToggleFunction</a> toggle_function,
<a name="l00330"></a>00330 <a class="code" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a> enabled)
<a name="l00331"></a>00331 {
<a name="l00332"></a>00332 <a class="code" href="structDBusTimeoutList.html">DBusTimeoutList</a> *timeouts;
<a name="l00333"></a>00333 <a class="code" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a> retval;
<a name="l00334"></a>00334
<a name="l00335"></a>00335 HAVE_LOCK_CHECK (server);
<a name="l00336"></a>00336
<a name="l00337"></a>00337 <span class="comment">/* This isn't really safe or reasonable; a better pattern is the "do everything, then</span>
<a name="l00338"></a>00338 <span class="comment"> * drop lock and call out" one; but it has to be propagated up through all callers</span>
<a name="l00339"></a>00339 <span class="comment"> */</span>
<a name="l00340"></a>00340
<a name="l00341"></a>00341 timeouts = server-><a class="code" href="structDBusServer.html#fcaccd00f2392a390616c47e425bae85">timeouts</a>;
<a name="l00342"></a>00342 <span class="keywordflow">if</span> (timeouts)
<a name="l00343"></a>00343 {
<a name="l00344"></a>00344 server-><a class="code" href="structDBusServer.html#fcaccd00f2392a390616c47e425bae85">timeouts</a> = <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00345"></a>00345 <a class="code" href="group__DBusServerInternals.html#g987e9bf42ab4e4cededa8e8f65c54e2e">_dbus_server_ref_unlocked</a> (server);
<a name="l00346"></a>00346 SERVER_UNLOCK (server);
<a name="l00347"></a>00347
<a name="l00348"></a>00348 <span class="keywordflow">if</span> (add_function)
<a name="l00349"></a>00349 retval = (* add_function) (timeouts, timeout);
<a name="l00350"></a>00350 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (remove_function)
<a name="l00351"></a>00351 {
<a name="l00352"></a>00352 retval = <a class="code" href="group__DBusMacros.html#ga8cecfc5c5c054d2875c03e77b7be15d">TRUE</a>;
<a name="l00353"></a>00353 (* remove_function) (timeouts, timeout);
<a name="l00354"></a>00354 }
<a name="l00355"></a>00355 <span class="keywordflow">else</span>
<a name="l00356"></a>00356 {
<a name="l00357"></a>00357 retval = <a class="code" href="group__DBusMacros.html#ga8cecfc5c5c054d2875c03e77b7be15d">TRUE</a>;
<a name="l00358"></a>00358 (* toggle_function) (timeouts, timeout, enabled);
<a name="l00359"></a>00359 }
<a name="l00360"></a>00360
<a name="l00361"></a>00361 SERVER_LOCK (server);
<a name="l00362"></a>00362 server-><a class="code" href="structDBusServer.html#fcaccd00f2392a390616c47e425bae85">timeouts</a> = timeouts;
<a name="l00363"></a>00363 <a class="code" href="group__DBusServerInternals.html#g6e1d0b379c98b0d59ebd19dc9b8a2dbe">_dbus_server_unref_unlocked</a> (server);
<a name="l00364"></a>00364
<a name="l00365"></a>00365 <span class="keywordflow">return</span> retval;
<a name="l00366"></a>00366 }
<a name="l00367"></a>00367 <span class="keywordflow">else</span>
<a name="l00368"></a>00368 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#ga93f0eb578d23995850d61f7d61c55c1">FALSE</a>;
<a name="l00369"></a>00369 }
<a name="l00370"></a>00370
<a name="l00380"></a>00380 <a class="code" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a>
<a name="l00381"></a><a class="code" href="group__DBusServerInternals.html#g7e10a662386fb7f693e0d168161e395b">00381</a> <a class="code" href="group__DBusServerInternals.html#g7e10a662386fb7f693e0d168161e395b">_dbus_server_add_timeout</a> (<a class="code" href="structDBusServer.html">DBusServer</a> *server,
<a name="l00382"></a>00382 <a class="code" href="structDBusTimeout.html">DBusTimeout</a> *timeout)
<a name="l00383"></a>00383 {
<a name="l00384"></a>00384 <span class="keywordflow">return</span> protected_change_timeout (server, timeout,
<a name="l00385"></a>00385 <a class="code" href="group__DBusTimeoutInternals.html#g14955f061551ece122808b9e6ddc0757">_dbus_timeout_list_add_timeout</a>,
<a name="l00386"></a>00386 <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>, <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>, <a class="code" href="group__DBusMacros.html#ga93f0eb578d23995850d61f7d61c55c1">FALSE</a>);
<a name="l00387"></a>00387 }
<a name="l00388"></a>00388
<a name="l00395"></a>00395 <span class="keywordtype">void</span>
<a name="l00396"></a><a class="code" href="group__DBusServerInternals.html#g69509697f091e354442cedb63886c20e">00396</a> <a class="code" href="group__DBusServerInternals.html#g69509697f091e354442cedb63886c20e">_dbus_server_remove_timeout</a> (<a class="code" href="structDBusServer.html">DBusServer</a> *server,
<a name="l00397"></a>00397 <a class="code" href="structDBusTimeout.html">DBusTimeout</a> *timeout)
<a name="l00398"></a>00398 {
<a name="l00399"></a>00399 protected_change_timeout (server, timeout,
<a name="l00400"></a>00400 <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>,
<a name="l00401"></a>00401 <a class="code" href="group__DBusTimeoutInternals.html#gec0ffafdcac87f23878a2ddded044822">_dbus_timeout_list_remove_timeout</a>,
<a name="l00402"></a>00402 <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>, <a class="code" href="group__DBusMacros.html#ga93f0eb578d23995850d61f7d61c55c1">FALSE</a>);
<a name="l00403"></a>00403 }
<a name="l00404"></a>00404
<a name="l00414"></a>00414 <span class="keywordtype">void</span>
<a name="l00415"></a><a class="code" href="group__DBusServerInternals.html#g74d2714ce80a089d2607a6fc5763d819">00415</a> <a class="code" href="group__DBusServerInternals.html#g74d2714ce80a089d2607a6fc5763d819">_dbus_server_toggle_timeout</a> (<a class="code" href="structDBusServer.html">DBusServer</a> *server,
<a name="l00416"></a>00416 <a class="code" href="structDBusTimeout.html">DBusTimeout</a> *timeout,
<a name="l00417"></a>00417 <a class="code" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a> enabled)
<a name="l00418"></a>00418 {
<a name="l00419"></a>00419 protected_change_timeout (server, timeout,
<a name="l00420"></a>00420 <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>, <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>,
<a name="l00421"></a>00421 <a class="code" href="group__DBusTimeoutInternals.html#g3d1ee0968a47651c5428ebf48711b217">_dbus_timeout_list_toggle_timeout</a>,
<a name="l00422"></a>00422 enabled);
<a name="l00423"></a>00423 }
<a name="l00424"></a>00424
<a name="l00425"></a>00425
<a name="l00431"></a>00431 <span class="keywordtype">void</span>
<a name="l00432"></a><a class="code" href="group__DBusServerInternals.html#g987e9bf42ab4e4cededa8e8f65c54e2e">00432</a> <a class="code" href="group__DBusServerInternals.html#g987e9bf42ab4e4cededa8e8f65c54e2e">_dbus_server_ref_unlocked</a> (<a class="code" href="structDBusServer.html">DBusServer</a> *server)
<a name="l00433"></a>00433 {
<a name="l00434"></a>00434 <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (server != <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>);
<a name="l00435"></a>00435 <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (server-><a class="code" href="structDBusServer.html#7578bd99fc8aee641cbb5198cb2e7004">refcount</a>.<a class="code" href="structDBusAtomic.html#ef100f17856a635a9d0f3cae7a7f6bf8">value</a> > 0);
<a name="l00436"></a>00436
<a name="l00437"></a>00437 HAVE_LOCK_CHECK (server);
<a name="l00438"></a>00438
<a name="l00439"></a>00439 <span class="preprocessor">#ifdef DBUS_HAVE_ATOMIC_INT</span>
<a name="l00440"></a>00440 <span class="preprocessor"></span> <a class="code" href="group__DBusSysdeps.html#ge74c3fcf12acaeccdb152ef907de951c">_dbus_atomic_inc</a> (&server-><a class="code" href="structDBusServer.html#7578bd99fc8aee641cbb5198cb2e7004">refcount</a>);
<a name="l00441"></a>00441 <span class="preprocessor">#else</span>
<a name="l00442"></a>00442 <span class="preprocessor"></span> <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (server-><a class="code" href="structDBusServer.html#7578bd99fc8aee641cbb5198cb2e7004">refcount</a>.<a class="code" href="structDBusAtomic.html#ef100f17856a635a9d0f3cae7a7f6bf8">value</a> > 0);
<a name="l00443"></a>00443
<a name="l00444"></a>00444 server-><a class="code" href="structDBusServer.html#7578bd99fc8aee641cbb5198cb2e7004">refcount</a>.<a class="code" href="structDBusAtomic.html#ef100f17856a635a9d0f3cae7a7f6bf8">value</a> += 1;
<a name="l00445"></a>00445 <span class="preprocessor">#endif</span>
<a name="l00446"></a>00446 <span class="preprocessor"></span>}
<a name="l00447"></a>00447
<a name="l00453"></a>00453 <span class="keywordtype">void</span>
<a name="l00454"></a><a class="code" href="group__DBusServerInternals.html#g6e1d0b379c98b0d59ebd19dc9b8a2dbe">00454</a> <a class="code" href="group__DBusServerInternals.html#g6e1d0b379c98b0d59ebd19dc9b8a2dbe">_dbus_server_unref_unlocked</a> (<a class="code" href="structDBusServer.html">DBusServer</a> *server)
<a name="l00455"></a>00455 {
<a name="l00456"></a>00456 <a class="code" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a> last_unref;
<a name="l00457"></a>00457
<a name="l00458"></a>00458 <span class="comment">/* Keep this in sync with dbus_server_unref */</span>
<a name="l00459"></a>00459
<a name="l00460"></a>00460 <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (server != <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>);
<a name="l00461"></a>00461 <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (server-><a class="code" href="structDBusServer.html#7578bd99fc8aee641cbb5198cb2e7004">refcount</a>.<a class="code" href="structDBusAtomic.html#ef100f17856a635a9d0f3cae7a7f6bf8">value</a> > 0);
<a name="l00462"></a>00462
<a name="l00463"></a>00463 HAVE_LOCK_CHECK (server);
<a name="l00464"></a>00464
<a name="l00465"></a>00465 <span class="preprocessor">#ifdef DBUS_HAVE_ATOMIC_INT</span>
<a name="l00466"></a>00466 <span class="preprocessor"></span> last_unref = (<a class="code" href="group__DBusSysdeps.html#g3c50a069f795dceeb9172fe2b517bbdc">_dbus_atomic_dec</a> (&server-><a class="code" href="structDBusServer.html#7578bd99fc8aee641cbb5198cb2e7004">refcount</a>) == 1);
<a name="l00467"></a>00467 <span class="preprocessor">#else</span>
<a name="l00468"></a>00468 <span class="preprocessor"></span> <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (server-><a class="code" href="structDBusServer.html#7578bd99fc8aee641cbb5198cb2e7004">refcount</a>.<a class="code" href="structDBusAtomic.html#ef100f17856a635a9d0f3cae7a7f6bf8">value</a> > 0);
<a name="l00469"></a>00469
<a name="l00470"></a>00470 server-><a class="code" href="structDBusServer.html#7578bd99fc8aee641cbb5198cb2e7004">refcount</a>.<a class="code" href="structDBusAtomic.html#ef100f17856a635a9d0f3cae7a7f6bf8">value</a> -= 1;
<a name="l00471"></a>00471 last_unref = (server-><a class="code" href="structDBusServer.html#7578bd99fc8aee641cbb5198cb2e7004">refcount</a>.<a class="code" href="structDBusAtomic.html#ef100f17856a635a9d0f3cae7a7f6bf8">value</a> == 0);
<a name="l00472"></a>00472 <span class="preprocessor">#endif</span>
<a name="l00473"></a>00473 <span class="preprocessor"></span>
<a name="l00474"></a>00474 <span class="keywordflow">if</span> (last_unref)
<a name="l00475"></a>00475 {
<a name="l00476"></a>00476 <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (server-><a class="code" href="structDBusServer.html#7dabb30cdc09d6102810029fb56b8dfe">disconnected</a>);
<a name="l00477"></a>00477
<a name="l00478"></a>00478 SERVER_UNLOCK (server);
<a name="l00479"></a>00479
<a name="l00480"></a>00480 <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (server-><a class="code" href="structDBusServer.html#a5068890fea8c7e7261b600e7256e009">vtable</a>-><a class="code" href="structDBusServerVTable.html#cd97315e812352da38449f910775b08d">finalize</a> != <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>);
<a name="l00481"></a>00481
<a name="l00482"></a>00482 (* server-><a class="code" href="structDBusServer.html#a5068890fea8c7e7261b600e7256e009">vtable</a>-><a class="code" href="structDBusServerVTable.html#cd97315e812352da38449f910775b08d">finalize</a>) (server);
<a name="l00483"></a>00483 }
<a name="l00484"></a>00484 }
<a name="l00485"></a>00485
<a name="l00507"></a>00507 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keyword">struct </span>{
<a name="l00508"></a>00508 DBusServerListenResult (* func) (<a class="code" href="structDBusAddressEntry.html">DBusAddressEntry</a> *entry,
<a name="l00509"></a>00509 <a class="code" href="structDBusServer.html">DBusServer</a> **server_p,
<a name="l00510"></a>00510 <a class="code" href="structDBusError.html">DBusError</a> *error);
<a name="l00511"></a>00511 } listen_funcs[] = {
<a name="l00512"></a>00512 { <a class="code" href="group__DBusServerSocket.html#g90a89943c15760592e5ddce31bf0e021">_dbus_server_listen_socket</a> }
<a name="l00513"></a>00513 , { <a class="code" href="group__DBusServerUnix.html#gec00cdf4977b9bd33621df684406a779">_dbus_server_listen_platform_specific</a> }
<a name="l00514"></a>00514 <span class="preprocessor">#ifdef DBUS_BUILD_TESTS</span>
<a name="l00515"></a>00515 <span class="preprocessor"></span> , { _dbus_server_listen_debug_pipe }
<a name="l00516"></a>00516 <span class="preprocessor">#endif</span>
<a name="l00517"></a>00517 <span class="preprocessor"></span>};
<a name="l00518"></a>00518
<a name="l00539"></a>00539 <a class="code" href="structDBusServer.html">DBusServer</a>*
<a name="l00540"></a><a class="code" href="group__DBusServer.html#geb56ec61286bff89fa482fd6138cd13b">00540</a> <a class="code" href="group__DBusServer.html#geb56ec61286bff89fa482fd6138cd13b">dbus_server_listen</a> (<span class="keyword">const</span> <span class="keywordtype">char</span> *address,
<a name="l00541"></a>00541 <a class="code" href="structDBusError.html">DBusError</a> *error)
<a name="l00542"></a>00542 {
<a name="l00543"></a>00543 <a class="code" href="structDBusServer.html">DBusServer</a> *server;
<a name="l00544"></a>00544 <a class="code" href="structDBusAddressEntry.html">DBusAddressEntry</a> **entries;
<a name="l00545"></a>00545 <span class="keywordtype">int</span> len, i;
<a name="l00546"></a>00546 <a class="code" href="structDBusError.html">DBusError</a> first_connect_error;
<a name="l00547"></a>00547 <a class="code" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a> handled_once;
<a name="l00548"></a>00548
<a name="l00549"></a>00549 _dbus_return_val_if_fail (address != <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>, <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>);
<a name="l00550"></a>00550 _dbus_return_val_if_error_is_set (error, <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>);
<a name="l00551"></a>00551
<a name="l00552"></a>00552 <span class="keywordflow">if</span> (!<a class="code" href="group__DBusAddress.html#gba56db98921bbe358d8549339a3cf20d">dbus_parse_address</a> (address, &entries, &len, error))
<a name="l00553"></a>00553 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00554"></a>00554
<a name="l00555"></a>00555 server = <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00556"></a>00556 <a class="code" href="group__DBusErrors.html#g8ce28eae754237703296599967d7ab77">dbus_error_init</a> (&first_connect_error);
<a name="l00557"></a>00557 handled_once = <a class="code" href="group__DBusMacros.html#ga93f0eb578d23995850d61f7d61c55c1">FALSE</a>;
<a name="l00558"></a>00558
<a name="l00559"></a>00559 <span class="keywordflow">for</span> (i = 0; i < len; i++)
<a name="l00560"></a>00560 {
<a name="l00561"></a>00561 <span class="keywordtype">int</span> j;
<a name="l00562"></a>00562
<a name="l00563"></a>00563 <span class="keywordflow">for</span> (j = 0; j < (int) <a class="code" href="group__DBusInternalsUtils.html#gc153abad46f4eb80999a2b340d29d1f0">_DBUS_N_ELEMENTS</a> (listen_funcs); ++j)
<a name="l00564"></a>00564 {
<a name="l00565"></a>00565 DBusServerListenResult result;
<a name="l00566"></a>00566 <a class="code" href="structDBusError.html">DBusError</a> tmp_error;
<a name="l00567"></a>00567
<a name="l00568"></a>00568 <a class="code" href="group__DBusErrors.html#g8ce28eae754237703296599967d7ab77">dbus_error_init</a> (&tmp_error);
<a name="l00569"></a>00569 result = (* listen_funcs[j].func) (entries[i],
<a name="l00570"></a>00570 &server,
<a name="l00571"></a>00571 &tmp_error);
<a name="l00572"></a>00572
<a name="l00573"></a>00573 <span class="keywordflow">if</span> (result == DBUS_SERVER_LISTEN_OK)
<a name="l00574"></a>00574 {
<a name="l00575"></a>00575 <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (server != <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>);
<a name="l00576"></a>00576 _DBUS_ASSERT_ERROR_IS_CLEAR (&tmp_error);
<a name="l00577"></a>00577 handled_once = <a class="code" href="group__DBusMacros.html#ga8cecfc5c5c054d2875c03e77b7be15d">TRUE</a>;
<a name="l00578"></a>00578 <span class="keywordflow">goto</span> out;
<a name="l00579"></a>00579 }
<a name="l00580"></a>00580 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (result == DBUS_SERVER_LISTEN_BAD_ADDRESS)
<a name="l00581"></a>00581 {
<a name="l00582"></a>00582 <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (server == <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>);
<a name="l00583"></a>00583 _DBUS_ASSERT_ERROR_IS_SET (&tmp_error);
<a name="l00584"></a>00584 <a class="code" href="group__DBusErrors.html#g9857517c813b19ef87b12f00558cecda">dbus_move_error</a> (&tmp_error, error);
<a name="l00585"></a>00585 handled_once = <a class="code" href="group__DBusMacros.html#ga8cecfc5c5c054d2875c03e77b7be15d">TRUE</a>;
<a name="l00586"></a>00586 <span class="keywordflow">goto</span> out;
<a name="l00587"></a>00587 }
<a name="l00588"></a>00588 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (result == DBUS_SERVER_LISTEN_NOT_HANDLED)
<a name="l00589"></a>00589 {
<a name="l00590"></a>00590 <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (server == <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>);
<a name="l00591"></a>00591 _DBUS_ASSERT_ERROR_IS_CLEAR (&tmp_error);
<a name="l00592"></a>00592
<a name="l00593"></a>00593 <span class="comment">/* keep trying addresses */</span>
<a name="l00594"></a>00594 }
<a name="l00595"></a>00595 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (result == DBUS_SERVER_LISTEN_DID_NOT_CONNECT)
<a name="l00596"></a>00596 {
<a name="l00597"></a>00597 <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (server == <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>);
<a name="l00598"></a>00598 _DBUS_ASSERT_ERROR_IS_SET (&tmp_error);
<a name="l00599"></a>00599 <span class="keywordflow">if</span> (!<a class="code" href="group__DBusErrors.html#g49c2509c79ae0fa01f5004b17e2ec6be">dbus_error_is_set</a> (&first_connect_error))
<a name="l00600"></a>00600 <a class="code" href="group__DBusErrors.html#g9857517c813b19ef87b12f00558cecda">dbus_move_error</a> (&tmp_error, &first_connect_error);
<a name="l00601"></a>00601 <span class="keywordflow">else</span>
<a name="l00602"></a>00602 <a class="code" href="group__DBusErrors.html#gd192d53cf930b1b12e1ce91bc0963709">dbus_error_free</a> (&tmp_error);
<a name="l00603"></a>00603
<a name="l00604"></a>00604 handled_once = <a class="code" href="group__DBusMacros.html#ga8cecfc5c5c054d2875c03e77b7be15d">TRUE</a>;
<a name="l00605"></a>00605
<a name="l00606"></a>00606 <span class="comment">/* keep trying addresses */</span>
<a name="l00607"></a>00607 }
<a name="l00608"></a>00608 }
<a name="l00609"></a>00609
<a name="l00610"></a>00610 <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (server == <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>);
<a name="l00611"></a>00611 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
<a name="l00612"></a>00612 }
<a name="l00613"></a>00613
<a name="l00614"></a>00614 out:
<a name="l00615"></a>00615
<a name="l00616"></a>00616 <span class="keywordflow">if</span> (!handled_once)
<a name="l00617"></a>00617 {
<a name="l00618"></a>00618 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
<a name="l00619"></a>00619 <span class="keywordflow">if</span> (len > 0)
<a name="l00620"></a>00620 <a class="code" href="group__DBusErrors.html#g4e1b4b297468006781a957129ad9cf00">dbus_set_error</a> (error,
<a name="l00621"></a>00621 <a class="code" href="group__DBusProtocol.html#g3fa04eb600edda4afc2dd9fe2e0f8b02">DBUS_ERROR_BAD_ADDRESS</a>,
<a name="l00622"></a>00622 <span class="stringliteral">"Unknown address type '%s'"</span>,
<a name="l00623"></a>00623 <a class="code" href="group__DBusAddress.html#g0905615382af3a8525b8a884d31b3f1c">dbus_address_entry_get_method</a> (entries[0]));
<a name="l00624"></a>00624 <span class="keywordflow">else</span>
<a name="l00625"></a>00625 <a class="code" href="group__DBusErrors.html#g4e1b4b297468006781a957129ad9cf00">dbus_set_error</a> (error,
<a name="l00626"></a>00626 <a class="code" href="group__DBusProtocol.html#g3fa04eb600edda4afc2dd9fe2e0f8b02">DBUS_ERROR_BAD_ADDRESS</a>,
<a name="l00627"></a>00627 <span class="stringliteral">"Empty address '%s'"</span>,
<a name="l00628"></a>00628 address);
<a name="l00629"></a>00629 }
<a name="l00630"></a>00630
<a name="l00631"></a>00631 <a class="code" href="group__DBusAddress.html#geec9b8bf0e25269d7b3e9922b01968c1">dbus_address_entries_free</a> (entries);
<a name="l00632"></a>00632
<a name="l00633"></a>00633 <span class="keywordflow">if</span> (server == <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>)
<a name="l00634"></a>00634 {
<a name="l00635"></a>00635 <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (error == <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a> || <a class="code" href="group__DBusErrors.html#g49c2509c79ae0fa01f5004b17e2ec6be">dbus_error_is_set</a> (&first_connect_error) ||
<a name="l00636"></a>00636 <a class="code" href="group__DBusErrors.html#g49c2509c79ae0fa01f5004b17e2ec6be">dbus_error_is_set</a> (error));
<a name="l00637"></a>00637
<a name="l00638"></a>00638 <span class="keywordflow">if</span> (error && <a class="code" href="group__DBusErrors.html#g49c2509c79ae0fa01f5004b17e2ec6be">dbus_error_is_set</a> (error))
<a name="l00639"></a>00639 {
<a name="l00640"></a>00640 <span class="comment">/* already set the error */</span>
<a name="l00641"></a>00641 }
<a name="l00642"></a>00642 <span class="keywordflow">else</span>
<a name="l00643"></a>00643 {
<a name="l00644"></a>00644 <span class="comment">/* didn't set the error but either error should be</span>
<a name="l00645"></a>00645 <span class="comment"> * NULL or first_connect_error should be set.</span>
<a name="l00646"></a>00646 <span class="comment"> */</span>
<a name="l00647"></a>00647 <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (error == <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a> || <a class="code" href="group__DBusErrors.html#g49c2509c79ae0fa01f5004b17e2ec6be">dbus_error_is_set</a> (&first_connect_error));
<a name="l00648"></a>00648 <a class="code" href="group__DBusErrors.html#g9857517c813b19ef87b12f00558cecda">dbus_move_error</a> (&first_connect_error, error);
<a name="l00649"></a>00649 }
<a name="l00650"></a>00650
<a name="l00651"></a>00651 _DBUS_ASSERT_ERROR_IS_CLEAR (&first_connect_error); <span class="comment">/* be sure we freed it */</span>
<a name="l00652"></a>00652 _DBUS_ASSERT_ERROR_IS_SET (error);
<a name="l00653"></a>00653
<a name="l00654"></a>00654 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00655"></a>00655 }
<a name="l00656"></a>00656 <span class="keywordflow">else</span>
<a name="l00657"></a>00657 {
<a name="l00658"></a>00658 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
<a name="l00659"></a>00659 <span class="keywordflow">return</span> server;
<a name="l00660"></a>00660 }
<a name="l00661"></a>00661 }
<a name="l00662"></a>00662
<a name="l00669"></a>00669 <a class="code" href="structDBusServer.html">DBusServer</a> *
<a name="l00670"></a><a class="code" href="group__DBusServer.html#g5c4406913d2a92093ce50e0521b37b5b">00670</a> <a class="code" href="group__DBusServer.html#g5c4406913d2a92093ce50e0521b37b5b">dbus_server_ref</a> (<a class="code" href="structDBusServer.html">DBusServer</a> *server)
<a name="l00671"></a>00671 {
<a name="l00672"></a>00672 _dbus_return_val_if_fail (server != <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>, <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>);
<a name="l00673"></a>00673 _dbus_return_val_if_fail (server-><a class="code" href="structDBusServer.html#7578bd99fc8aee641cbb5198cb2e7004">refcount</a>.<a class="code" href="structDBusAtomic.html#ef100f17856a635a9d0f3cae7a7f6bf8">value</a> > 0, <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>);
<a name="l00674"></a>00674
<a name="l00675"></a>00675 <span class="preprocessor">#ifdef DBUS_HAVE_ATOMIC_INT</span>
<a name="l00676"></a>00676 <span class="preprocessor"></span> <a class="code" href="group__DBusSysdeps.html#ge74c3fcf12acaeccdb152ef907de951c">_dbus_atomic_inc</a> (&server-><a class="code" href="structDBusServer.html#7578bd99fc8aee641cbb5198cb2e7004">refcount</a>);
<a name="l00677"></a>00677 <span class="preprocessor">#else</span>
<a name="l00678"></a>00678 <span class="preprocessor"></span> SERVER_LOCK (server);
<a name="l00679"></a>00679 <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (server-><a class="code" href="structDBusServer.html#7578bd99fc8aee641cbb5198cb2e7004">refcount</a>.<a class="code" href="structDBusAtomic.html#ef100f17856a635a9d0f3cae7a7f6bf8">value</a> > 0);
<a name="l00680"></a>00680
<a name="l00681"></a>00681 server-><a class="code" href="structDBusServer.html#7578bd99fc8aee641cbb5198cb2e7004">refcount</a>.<a class="code" href="structDBusAtomic.html#ef100f17856a635a9d0f3cae7a7f6bf8">value</a> += 1;
<a name="l00682"></a>00682 SERVER_UNLOCK (server);
<a name="l00683"></a>00683 <span class="preprocessor">#endif</span>
<a name="l00684"></a>00684 <span class="preprocessor"></span>
<a name="l00685"></a>00685 <span class="keywordflow">return</span> server;
<a name="l00686"></a>00686 }
<a name="l00687"></a>00687
<a name="l00696"></a>00696 <span class="keywordtype">void</span>
<a name="l00697"></a><a class="code" href="group__DBusServer.html#g8cd88699638aafda3512802b551fe87b">00697</a> <a class="code" href="group__DBusServer.html#g8cd88699638aafda3512802b551fe87b">dbus_server_unref</a> (<a class="code" href="structDBusServer.html">DBusServer</a> *server)
<a name="l00698"></a>00698 {
<a name="l00699"></a>00699 <a class="code" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a> last_unref;
<a name="l00700"></a>00700
<a name="l00701"></a>00701 <span class="comment">/* keep this in sync with unref_unlocked */</span>
<a name="l00702"></a>00702
<a name="l00703"></a>00703 _dbus_return_if_fail (server != <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>);
<a name="l00704"></a>00704 _dbus_return_if_fail (server-><a class="code" href="structDBusServer.html#7578bd99fc8aee641cbb5198cb2e7004">refcount</a>.<a class="code" href="structDBusAtomic.html#ef100f17856a635a9d0f3cae7a7f6bf8">value</a> > 0);
<a name="l00705"></a>00705
<a name="l00706"></a>00706 <span class="preprocessor">#ifdef DBUS_HAVE_ATOMIC_INT</span>
<a name="l00707"></a>00707 <span class="preprocessor"></span> last_unref = (<a class="code" href="group__DBusSysdeps.html#g3c50a069f795dceeb9172fe2b517bbdc">_dbus_atomic_dec</a> (&server-><a class="code" href="structDBusServer.html#7578bd99fc8aee641cbb5198cb2e7004">refcount</a>) == 1);
<a name="l00708"></a>00708 <span class="preprocessor">#else</span>
<a name="l00709"></a>00709 <span class="preprocessor"></span> SERVER_LOCK (server);
<a name="l00710"></a>00710
<a name="l00711"></a>00711 <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (server-><a class="code" href="structDBusServer.html#7578bd99fc8aee641cbb5198cb2e7004">refcount</a>.<a class="code" href="structDBusAtomic.html#ef100f17856a635a9d0f3cae7a7f6bf8">value</a> > 0);
<a name="l00712"></a>00712
<a name="l00713"></a>00713 server-><a class="code" href="structDBusServer.html#7578bd99fc8aee641cbb5198cb2e7004">refcount</a>.<a class="code" href="structDBusAtomic.html#ef100f17856a635a9d0f3cae7a7f6bf8">value</a> -= 1;
<a name="l00714"></a>00714 last_unref = (server-><a class="code" href="structDBusServer.html#7578bd99fc8aee641cbb5198cb2e7004">refcount</a>.<a class="code" href="structDBusAtomic.html#ef100f17856a635a9d0f3cae7a7f6bf8">value</a> == 0);
<a name="l00715"></a>00715
<a name="l00716"></a>00716 SERVER_UNLOCK (server);
<a name="l00717"></a>00717 <span class="preprocessor">#endif</span>
<a name="l00718"></a>00718 <span class="preprocessor"></span>
<a name="l00719"></a>00719 <span class="keywordflow">if</span> (last_unref)
<a name="l00720"></a>00720 {
<a name="l00721"></a>00721 <span class="comment">/* lock not held! */</span>
<a name="l00722"></a>00722 <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (server-><a class="code" href="structDBusServer.html#7dabb30cdc09d6102810029fb56b8dfe">disconnected</a>);
<a name="l00723"></a>00723
<a name="l00724"></a>00724 <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (server-><a class="code" href="structDBusServer.html#a5068890fea8c7e7261b600e7256e009">vtable</a>-><a class="code" href="structDBusServerVTable.html#cd97315e812352da38449f910775b08d">finalize</a> != <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>);
<a name="l00725"></a>00725
<a name="l00726"></a>00726 (* server-><a class="code" href="structDBusServer.html#a5068890fea8c7e7261b600e7256e009">vtable</a>-><a class="code" href="structDBusServerVTable.html#cd97315e812352da38449f910775b08d">finalize</a>) (server);
<a name="l00727"></a>00727 }
<a name="l00728"></a>00728 }
<a name="l00729"></a>00729
<a name="l00738"></a>00738 <span class="keywordtype">void</span>
<a name="l00739"></a><a class="code" href="group__DBusServer.html#g3833573bd7b5dd61e77610edbcb49297">00739</a> <a class="code" href="group__DBusServer.html#g3833573bd7b5dd61e77610edbcb49297">dbus_server_disconnect</a> (<a class="code" href="structDBusServer.html">DBusServer</a> *server)
<a name="l00740"></a>00740 {
<a name="l00741"></a>00741 _dbus_return_if_fail (server != <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>);
<a name="l00742"></a>00742 _dbus_return_if_fail (server-><a class="code" href="structDBusServer.html#7578bd99fc8aee641cbb5198cb2e7004">refcount</a>.<a class="code" href="structDBusAtomic.html#ef100f17856a635a9d0f3cae7a7f6bf8">value</a> > 0);
<a name="l00743"></a>00743
<a name="l00744"></a>00744 SERVER_LOCK (server);
<a name="l00745"></a>00745 <a class="code" href="group__DBusServerInternals.html#g987e9bf42ab4e4cededa8e8f65c54e2e">_dbus_server_ref_unlocked</a> (server);
<a name="l00746"></a>00746
<a name="l00747"></a>00747 <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (server-><a class="code" href="structDBusServer.html#a5068890fea8c7e7261b600e7256e009">vtable</a>-><a class="code" href="structDBusServerVTable.html#148b105ac0a3a5ae8efbba29bf7fe676">disconnect</a> != <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>);
<a name="l00748"></a>00748
<a name="l00749"></a>00749 <span class="keywordflow">if</span> (!server-><a class="code" href="structDBusServer.html#7dabb30cdc09d6102810029fb56b8dfe">disconnected</a>)
<a name="l00750"></a>00750 {
<a name="l00751"></a>00751 <span class="comment">/* this has to be first so recursive calls to disconnect don't happen */</span>
<a name="l00752"></a>00752 server-><a class="code" href="structDBusServer.html#7dabb30cdc09d6102810029fb56b8dfe">disconnected</a> = <a class="code" href="group__DBusMacros.html#ga8cecfc5c5c054d2875c03e77b7be15d">TRUE</a>;
<a name="l00753"></a>00753
<a name="l00754"></a>00754 (* server-><a class="code" href="structDBusServer.html#a5068890fea8c7e7261b600e7256e009">vtable</a>-><a class="code" href="structDBusServerVTable.html#148b105ac0a3a5ae8efbba29bf7fe676">disconnect</a>) (server);
<a name="l00755"></a>00755 }
<a name="l00756"></a>00756
<a name="l00757"></a>00757 SERVER_UNLOCK (server);
<a name="l00758"></a>00758 <a class="code" href="group__DBusServer.html#g8cd88699638aafda3512802b551fe87b">dbus_server_unref</a> (server);
<a name="l00759"></a>00759 }
<a name="l00760"></a>00760
<a name="l00766"></a>00766 <a class="code" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a>
<a name="l00767"></a><a class="code" href="group__DBusServer.html#g07c657d8e980c3ffc38c4293fa34ab09">00767</a> <a class="code" href="group__DBusServer.html#g07c657d8e980c3ffc38c4293fa34ab09">dbus_server_get_is_connected</a> (<a class="code" href="structDBusServer.html">DBusServer</a> *server)
<a name="l00768"></a>00768 {
<a name="l00769"></a>00769 <a class="code" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a> retval;
<a name="l00770"></a>00770
<a name="l00771"></a>00771 _dbus_return_val_if_fail (server != <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>, <a class="code" href="group__DBusMacros.html#ga93f0eb578d23995850d61f7d61c55c1">FALSE</a>);
<a name="l00772"></a>00772
<a name="l00773"></a>00773 SERVER_LOCK (server);
<a name="l00774"></a>00774 retval = !server-><a class="code" href="structDBusServer.html#7dabb30cdc09d6102810029fb56b8dfe">disconnected</a>;
<a name="l00775"></a>00775 SERVER_UNLOCK (server);
<a name="l00776"></a>00776
<a name="l00777"></a>00777 <span class="keywordflow">return</span> retval;
<a name="l00778"></a>00778 }
<a name="l00779"></a>00779
<a name="l00787"></a>00787 <span class="keywordtype">char</span>*
<a name="l00788"></a><a class="code" href="group__DBusServer.html#g369647e80a931ea4bc53a859d43ac36a">00788</a> <a class="code" href="group__DBusServer.html#g369647e80a931ea4bc53a859d43ac36a">dbus_server_get_address</a> (<a class="code" href="structDBusServer.html">DBusServer</a> *server)
<a name="l00789"></a>00789 {
<a name="l00790"></a>00790 <span class="keywordtype">char</span> *retval;
<a name="l00791"></a>00791
<a name="l00792"></a>00792 _dbus_return_val_if_fail (server != <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>, <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>);
<a name="l00793"></a>00793
<a name="l00794"></a>00794 SERVER_LOCK (server);
<a name="l00795"></a>00795 retval = <a class="code" href="group__DBusInternalsUtils.html#g9d00d77f6595b9d7ac1baf59d44bf58c">_dbus_strdup</a> (server-><a class="code" href="structDBusServer.html#359852bf33b3051180a9477da4d89acd">address</a>);
<a name="l00796"></a>00796 SERVER_UNLOCK (server);
<a name="l00797"></a>00797
<a name="l00798"></a>00798 <span class="keywordflow">return</span> retval;
<a name="l00799"></a>00799 }
<a name="l00800"></a>00800
<a name="l00823"></a>00823 <span class="keywordtype">char</span>*
<a name="l00824"></a><a class="code" href="group__DBusServer.html#g895b1c025268911584f4d15dd7c96512">00824</a> <a class="code" href="group__DBusServer.html#g895b1c025268911584f4d15dd7c96512">dbus_server_get_id</a> (<a class="code" href="structDBusServer.html">DBusServer</a> *server)
<a name="l00825"></a>00825 {
<a name="l00826"></a>00826 <span class="keywordtype">char</span> *retval;
<a name="l00827"></a>00827
<a name="l00828"></a>00828 _dbus_return_val_if_fail (server != <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>, <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>);
<a name="l00829"></a>00829
<a name="l00830"></a>00830 SERVER_LOCK (server);
<a name="l00831"></a>00831 retval = <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00832"></a>00832 <a class="code" href="group__DBusString.html#g7e509d4f959d19d96f83250e62287b06">_dbus_string_copy_data</a> (&server-><a class="code" href="structDBusServer.html#79cd5d1b25412d56b7fd41902d575794">guid_hex</a>, &retval);
<a name="l00833"></a>00833 SERVER_UNLOCK (server);
<a name="l00834"></a>00834
<a name="l00835"></a>00835 <span class="keywordflow">return</span> retval;
<a name="l00836"></a>00836 }
<a name="l00837"></a>00837
<a name="l00858"></a>00858 <span class="keywordtype">void</span>
<a name="l00859"></a><a class="code" href="group__DBusServer.html#gcf6686c9b7d53124b7f2ef1349a30148">00859</a> <a class="code" href="group__DBusServer.html#gcf6686c9b7d53124b7f2ef1349a30148">dbus_server_set_new_connection_function</a> (<a class="code" href="structDBusServer.html">DBusServer</a> *server,
<a name="l00860"></a>00860 <a class="code" href="group__DBusServer.html#g86c64a45e0834df26a8feae3079f6fbf">DBusNewConnectionFunction</a> function,
<a name="l00861"></a>00861 <span class="keywordtype">void</span> *data,
<a name="l00862"></a>00862 <a class="code" href="group__DBusMemory.html#g8792ec2b2b8626ca28022faf51ec415a">DBusFreeFunction</a> free_data_function)
<a name="l00863"></a>00863 {
<a name="l00864"></a>00864 <a class="code" href="group__DBusMemory.html#g8792ec2b2b8626ca28022faf51ec415a">DBusFreeFunction</a> old_free_function;
<a name="l00865"></a>00865 <span class="keywordtype">void</span> *old_data;
<a name="l00866"></a>00866
<a name="l00867"></a>00867 _dbus_return_if_fail (server != <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>);
<a name="l00868"></a>00868
<a name="l00869"></a>00869 SERVER_LOCK (server);
<a name="l00870"></a>00870 old_free_function = server-><a class="code" href="structDBusServer.html#5d5b68a92cf47a3eb50e5e6ec7d2ca3a">new_connection_free_data_function</a>;
<a name="l00871"></a>00871 old_data = server-><a class="code" href="structDBusServer.html#cfba406ae6f288887feaccc3d621d094">new_connection_data</a>;
<a name="l00872"></a>00872
<a name="l00873"></a>00873 server-><a class="code" href="structDBusServer.html#964ff125a29a7dac02f81e1a26233ff6">new_connection_function</a> = function;
<a name="l00874"></a>00874 server-><a class="code" href="structDBusServer.html#cfba406ae6f288887feaccc3d621d094">new_connection_data</a> = data;
<a name="l00875"></a>00875 server-><a class="code" href="structDBusServer.html#5d5b68a92cf47a3eb50e5e6ec7d2ca3a">new_connection_free_data_function</a> = free_data_function;
<a name="l00876"></a>00876 SERVER_UNLOCK (server);
<a name="l00877"></a>00877
<a name="l00878"></a>00878 <span class="keywordflow">if</span> (old_free_function != <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>)
<a name="l00879"></a>00879 (* old_free_function) (old_data);
<a name="l00880"></a>00880 }
<a name="l00881"></a>00881
<a name="l00898"></a>00898 <a class="code" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a>
<a name="l00899"></a><a class="code" href="group__DBusServer.html#g60ed22313c5fbe06c06924acd62959a2">00899</a> <a class="code" href="group__DBusServer.html#g60ed22313c5fbe06c06924acd62959a2">dbus_server_set_watch_functions</a> (<a class="code" href="structDBusServer.html">DBusServer</a> *server,
<a name="l00900"></a>00900 <a class="code" href="group__DBusConnection.html#g985b712fc165afa66e5901859b68b9de">DBusAddWatchFunction</a> add_function,
<a name="l00901"></a>00901 <a class="code" href="group__DBusConnection.html#g6a48c42c4bde24911cae7fda0d1f1589">DBusRemoveWatchFunction</a> remove_function,
<a name="l00902"></a>00902 <a class="code" href="group__DBusConnection.html#gfa7e0f7856f8ebbe66475979ef54ed9e">DBusWatchToggledFunction</a> toggled_function,
<a name="l00903"></a>00903 <span class="keywordtype">void</span> *data,
<a name="l00904"></a>00904 <a class="code" href="group__DBusMemory.html#g8792ec2b2b8626ca28022faf51ec415a">DBusFreeFunction</a> free_data_function)
<a name="l00905"></a>00905 {
<a name="l00906"></a>00906 <a class="code" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a> result;
<a name="l00907"></a>00907 <a class="code" href="structDBusWatchList.html">DBusWatchList</a> *watches;
<a name="l00908"></a>00908
<a name="l00909"></a>00909 _dbus_return_val_if_fail (server != <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>, <a class="code" href="group__DBusMacros.html#ga93f0eb578d23995850d61f7d61c55c1">FALSE</a>);
<a name="l00910"></a>00910
<a name="l00911"></a>00911 SERVER_LOCK (server);
<a name="l00912"></a>00912 watches = server-><a class="code" href="structDBusServer.html#7955050967aeaf09679f8ba1f2941880">watches</a>;
<a name="l00913"></a>00913 server-><a class="code" href="structDBusServer.html#7955050967aeaf09679f8ba1f2941880">watches</a> = <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00914"></a>00914 <span class="keywordflow">if</span> (watches)
<a name="l00915"></a>00915 {
<a name="l00916"></a>00916 SERVER_UNLOCK (server);
<a name="l00917"></a>00917 result = <a class="code" href="group__DBusWatchInternals.html#ge9ab8cf14f4191191e94183be9a031d9">_dbus_watch_list_set_functions</a> (watches,
<a name="l00918"></a>00918 add_function,
<a name="l00919"></a>00919 remove_function,
<a name="l00920"></a>00920 toggled_function,
<a name="l00921"></a>00921 data,
<a name="l00922"></a>00922 free_data_function);
<a name="l00923"></a>00923 SERVER_LOCK (server);
<a name="l00924"></a>00924 }
<a name="l00925"></a>00925 <span class="keywordflow">else</span>
<a name="l00926"></a>00926 {
<a name="l00927"></a>00927 <a class="code" href="group__DBusInternalsUtils.html#g63f2f8a068454b781f214ba596e313b4">_dbus_warn_check_failed</a> (<span class="stringliteral">"Re-entrant call to %s\n"</span>, _DBUS_FUNCTION_NAME);
<a name="l00928"></a>00928 result = <a class="code" href="group__DBusMacros.html#ga93f0eb578d23995850d61f7d61c55c1">FALSE</a>;
<a name="l00929"></a>00929 }
<a name="l00930"></a>00930 server-><a class="code" href="structDBusServer.html#7955050967aeaf09679f8ba1f2941880">watches</a> = watches;
<a name="l00931"></a>00931 SERVER_UNLOCK (server);
<a name="l00932"></a>00932
<a name="l00933"></a>00933 <span class="keywordflow">return</span> result;
<a name="l00934"></a>00934 }
<a name="l00935"></a>00935
<a name="l00951"></a>00951 <a class="code" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a>
<a name="l00952"></a><a class="code" href="group__DBusServer.html#gb5767a964cd2049c985434ad64ae1169">00952</a> <a class="code" href="group__DBusServer.html#gb5767a964cd2049c985434ad64ae1169">dbus_server_set_timeout_functions</a> (<a class="code" href="structDBusServer.html">DBusServer</a> *server,
<a name="l00953"></a>00953 <a class="code" href="group__DBusConnection.html#g0f4e9f850546dfbe3a27edea05e5e590">DBusAddTimeoutFunction</a> add_function,
<a name="l00954"></a>00954 <a class="code" href="group__DBusConnection.html#gb11e8c56bd8637deca1439be635f6ca7">DBusRemoveTimeoutFunction</a> remove_function,
<a name="l00955"></a>00955 <a class="code" href="group__DBusConnection.html#g1e98eb88ce848204d419495be5e1d228">DBusTimeoutToggledFunction</a> toggled_function,
<a name="l00956"></a>00956 <span class="keywordtype">void</span> *data,
<a name="l00957"></a>00957 <a class="code" href="group__DBusMemory.html#g8792ec2b2b8626ca28022faf51ec415a">DBusFreeFunction</a> free_data_function)
<a name="l00958"></a>00958 {
<a name="l00959"></a>00959 <a class="code" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a> result;
<a name="l00960"></a>00960 <a class="code" href="structDBusTimeoutList.html">DBusTimeoutList</a> *timeouts;
<a name="l00961"></a>00961
<a name="l00962"></a>00962 _dbus_return_val_if_fail (server != <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>, <a class="code" href="group__DBusMacros.html#ga93f0eb578d23995850d61f7d61c55c1">FALSE</a>);
<a name="l00963"></a>00963
<a name="l00964"></a>00964 SERVER_LOCK (server);
<a name="l00965"></a>00965 timeouts = server-><a class="code" href="structDBusServer.html#fcaccd00f2392a390616c47e425bae85">timeouts</a>;
<a name="l00966"></a>00966 server-><a class="code" href="structDBusServer.html#fcaccd00f2392a390616c47e425bae85">timeouts</a> = <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00967"></a>00967 <span class="keywordflow">if</span> (timeouts)
<a name="l00968"></a>00968 {
<a name="l00969"></a>00969 SERVER_UNLOCK (server);
<a name="l00970"></a>00970 result = <a class="code" href="group__DBusTimeoutInternals.html#g6760d1963b870b45f855501e38b49fd9">_dbus_timeout_list_set_functions</a> (timeouts,
<a name="l00971"></a>00971 add_function,
<a name="l00972"></a>00972 remove_function,
<a name="l00973"></a>00973 toggled_function,
<a name="l00974"></a>00974 data,
<a name="l00975"></a>00975 free_data_function);
<a name="l00976"></a>00976 SERVER_LOCK (server);
<a name="l00977"></a>00977 }
<a name="l00978"></a>00978 <span class="keywordflow">else</span>
<a name="l00979"></a>00979 {
<a name="l00980"></a>00980 <a class="code" href="group__DBusInternalsUtils.html#g63f2f8a068454b781f214ba596e313b4">_dbus_warn_check_failed</a> (<span class="stringliteral">"Re-entrant call to %s\n"</span>, _DBUS_FUNCTION_NAME);
<a name="l00981"></a>00981 result = <a class="code" href="group__DBusMacros.html#ga93f0eb578d23995850d61f7d61c55c1">FALSE</a>;
<a name="l00982"></a>00982 }
<a name="l00983"></a>00983 server-><a class="code" href="structDBusServer.html#fcaccd00f2392a390616c47e425bae85">timeouts</a> = timeouts;
<a name="l00984"></a>00984 SERVER_UNLOCK (server);
<a name="l00985"></a>00985
<a name="l00986"></a>00986 <span class="keywordflow">return</span> result;
<a name="l00987"></a>00987 }
<a name="l00988"></a>00988
<a name="l01002"></a>01002 <a class="code" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a>
<a name="l01003"></a><a class="code" href="group__DBusServer.html#g516ec5f045cf0ddd05a52b2a8bf3f641">01003</a> <a class="code" href="group__DBusServer.html#g516ec5f045cf0ddd05a52b2a8bf3f641">dbus_server_set_auth_mechanisms</a> (<a class="code" href="structDBusServer.html">DBusServer</a> *server,
<a name="l01004"></a>01004 <span class="keyword">const</span> <span class="keywordtype">char</span> **mechanisms)
<a name="l01005"></a>01005 {
<a name="l01006"></a>01006 <span class="keywordtype">char</span> **copy;
<a name="l01007"></a>01007
<a name="l01008"></a>01008 _dbus_return_val_if_fail (server != <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>, <a class="code" href="group__DBusMacros.html#ga93f0eb578d23995850d61f7d61c55c1">FALSE</a>);
<a name="l01009"></a>01009
<a name="l01010"></a>01010 SERVER_LOCK (server);
<a name="l01011"></a>01011
<a name="l01012"></a>01012 <span class="keywordflow">if</span> (mechanisms != <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>)
<a name="l01013"></a>01013 {
<a name="l01014"></a>01014 copy = <a class="code" href="group__DBusInternalsUtils.html#g53bbcbbd0b564c14c599813dde535443">_dbus_dup_string_array</a> (mechanisms);
<a name="l01015"></a>01015 <span class="keywordflow">if</span> (copy == <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>)
<a name="l01016"></a>01016 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#ga93f0eb578d23995850d61f7d61c55c1">FALSE</a>;
<a name="l01017"></a>01017 }
<a name="l01018"></a>01018 <span class="keywordflow">else</span>
<a name="l01019"></a>01019 copy = <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l01020"></a>01020
<a name="l01021"></a>01021 <a class="code" href="group__DBusMemory.html#g6d4674de64d806d238ffd309a486754e">dbus_free_string_array</a> (server-><a class="code" href="structDBusServer.html#dc1032bbed41413e5d0e01578f2bfffc">auth_mechanisms</a>);
<a name="l01022"></a>01022 server-><a class="code" href="structDBusServer.html#dc1032bbed41413e5d0e01578f2bfffc">auth_mechanisms</a> = copy;
<a name="l01023"></a>01023
<a name="l01024"></a>01024 SERVER_UNLOCK (server);
<a name="l01025"></a>01025
<a name="l01026"></a>01026 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#ga8cecfc5c5c054d2875c03e77b7be15d">TRUE</a>;
<a name="l01027"></a>01027 }
<a name="l01028"></a>01028
<a name="l01029"></a>01029
<a name="l01030"></a>01030 <span class="keyword">static</span> <a class="code" href="structDBusDataSlotAllocator.html">DBusDataSlotAllocator</a> slot_allocator;
<a name="l01031"></a>01031 <a class="code" href="group__DBusInternalsUtils.html#gc8d22e9846ecc2845959082076de899b">_DBUS_DEFINE_GLOBAL_LOCK</a> (server_slots);
<a name="l01032"></a>01032
<a name="l01047"></a>01047 <a class="code" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a>
<a name="l01048"></a><a class="code" href="group__DBusServer.html#ge9d33d128e7563bff6a902ebd443ef5e">01048</a> <a class="code" href="group__DBusServer.html#ge9d33d128e7563bff6a902ebd443ef5e">dbus_server_allocate_data_slot</a> (<a class="code" href="group__DBusTypes.html#gb18afa60e9b17b6e322735bda3d863d8">dbus_int32_t</a> *slot_p)
<a name="l01049"></a>01049 {
<a name="l01050"></a>01050 <span class="keywordflow">return</span> <a class="code" href="group__DBusDataSlot.html#g941a12182e69c185bd27f6efbfbd0f86">_dbus_data_slot_allocator_alloc</a> (&slot_allocator,
<a name="l01051"></a>01051 (<a class="code" href="group__DBusThreads.html#g4eb021cd6cd0830423eac2738e0ddc40">DBusMutex</a> **)&<a class="code" href="group__DBusInternalsUtils.html#gde571435b55fae64217f5142aa78ee8d">_DBUS_LOCK_NAME</a> (server_slots),
<a name="l01052"></a>01052 slot_p);
<a name="l01053"></a>01053 }
<a name="l01054"></a>01054
<a name="l01066"></a>01066 <span class="keywordtype">void</span>
<a name="l01067"></a><a class="code" href="group__DBusServer.html#g9065202df7477e5cbf1ae084c59a9ecc">01067</a> <a class="code" href="group__DBusServer.html#g9065202df7477e5cbf1ae084c59a9ecc">dbus_server_free_data_slot</a> (<a class="code" href="group__DBusTypes.html#gb18afa60e9b17b6e322735bda3d863d8">dbus_int32_t</a> *slot_p)
<a name="l01068"></a>01068 {
<a name="l01069"></a>01069 _dbus_return_if_fail (*slot_p >= 0);
<a name="l01070"></a>01070
<a name="l01071"></a>01071 <a class="code" href="group__DBusDataSlot.html#g059c50a24cd9fc984e918e6159841633">_dbus_data_slot_allocator_free</a> (&slot_allocator, slot_p);
<a name="l01072"></a>01072 }
<a name="l01073"></a>01073
<a name="l01087"></a>01087 <a class="code" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a>
<a name="l01088"></a><a class="code" href="group__DBusServer.html#g7309ea0b3e3b75dffb9ad8bb9d2fc2b7">01088</a> <a class="code" href="group__DBusServer.html#g7309ea0b3e3b75dffb9ad8bb9d2fc2b7">dbus_server_set_data</a> (<a class="code" href="structDBusServer.html">DBusServer</a> *server,
<a name="l01089"></a>01089 <span class="keywordtype">int</span> slot,
<a name="l01090"></a>01090 <span class="keywordtype">void</span> *data,
<a name="l01091"></a>01091 <a class="code" href="group__DBusMemory.html#g8792ec2b2b8626ca28022faf51ec415a">DBusFreeFunction</a> free_data_func)
<a name="l01092"></a>01092 {
<a name="l01093"></a>01093 <a class="code" href="group__DBusMemory.html#g8792ec2b2b8626ca28022faf51ec415a">DBusFreeFunction</a> old_free_func;
<a name="l01094"></a>01094 <span class="keywordtype">void</span> *old_data;
<a name="l01095"></a>01095 <a class="code" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a> retval;
<a name="l01096"></a>01096
<a name="l01097"></a>01097 _dbus_return_val_if_fail (server != <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>, <a class="code" href="group__DBusMacros.html#ga93f0eb578d23995850d61f7d61c55c1">FALSE</a>);
<a name="l01098"></a>01098
<a name="l01099"></a>01099 SERVER_LOCK (server);
<a name="l01100"></a>01100
<a name="l01101"></a>01101 retval = <a class="code" href="group__DBusDataSlot.html#gd2952f9f686d96e7114fc49ab7452e1a">_dbus_data_slot_list_set</a> (&slot_allocator,
<a name="l01102"></a>01102 &server-><a class="code" href="structDBusServer.html#0601cca8307ba17d4a8bcebe48b08362">slot_list</a>,
<a name="l01103"></a>01103 slot, data, free_data_func,
<a name="l01104"></a>01104 &old_free_func, &old_data);
<a name="l01105"></a>01105
<a name="l01106"></a>01106
<a name="l01107"></a>01107 SERVER_UNLOCK (server);
<a name="l01108"></a>01108
<a name="l01109"></a>01109 <span class="keywordflow">if</span> (retval)
<a name="l01110"></a>01110 {
<a name="l01111"></a>01111 <span class="comment">/* Do the actual free outside the server lock */</span>
<a name="l01112"></a>01112 <span class="keywordflow">if</span> (old_free_func)
<a name="l01113"></a>01113 (* old_free_func) (old_data);
<a name="l01114"></a>01114 }
<a name="l01115"></a>01115
<a name="l01116"></a>01116 <span class="keywordflow">return</span> retval;
<a name="l01117"></a>01117 }
<a name="l01118"></a>01118
<a name="l01127"></a>01127 <span class="keywordtype">void</span>*
<a name="l01128"></a><a class="code" href="group__DBusServer.html#gd56f156ff7a60fb1306a82f80e1b0877">01128</a> <a class="code" href="group__DBusServer.html#gd56f156ff7a60fb1306a82f80e1b0877">dbus_server_get_data</a> (<a class="code" href="structDBusServer.html">DBusServer</a> *server,
<a name="l01129"></a>01129 <span class="keywordtype">int</span> slot)
<a name="l01130"></a>01130 {
<a name="l01131"></a>01131 <span class="keywordtype">void</span> *res;
<a name="l01132"></a>01132
<a name="l01133"></a>01133 _dbus_return_val_if_fail (server != <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>, <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>);
<a name="l01134"></a>01134
<a name="l01135"></a>01135 SERVER_LOCK (server);
<a name="l01136"></a>01136
<a name="l01137"></a>01137 res = <a class="code" href="group__DBusDataSlot.html#g43f741229f0c38788442601e2750ec66">_dbus_data_slot_list_get</a> (&slot_allocator,
<a name="l01138"></a>01138 &server-><a class="code" href="structDBusServer.html#0601cca8307ba17d4a8bcebe48b08362">slot_list</a>,
<a name="l01139"></a>01139 slot);
<a name="l01140"></a>01140
<a name="l01141"></a>01141 SERVER_UNLOCK (server);
<a name="l01142"></a>01142
<a name="l01143"></a>01143 <span class="keywordflow">return</span> res;
<a name="l01144"></a>01144 }
<a name="l01145"></a>01145
<a name="l01148"></a>01148 <span class="preprocessor">#ifdef DBUS_BUILD_TESTS</span>
<a name="l01149"></a>01149 <span class="preprocessor"></span><span class="preprocessor">#include "dbus-test.h"</span>
<a name="l01150"></a>01150 <span class="preprocessor">#include <string.h></span>
<a name="l01151"></a>01151
<a name="l01152"></a>01152 <a class="code" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a>
<a name="l01153"></a>01153 _dbus_server_test (<span class="keywordtype">void</span>)
<a name="l01154"></a>01154 {
<a name="l01155"></a>01155 <span class="keyword">const</span> <span class="keywordtype">char</span> *valid_addresses[] = {
<a name="l01156"></a>01156 <span class="stringliteral">"tcp:port=1234"</span>,
<a name="l01157"></a>01157 <span class="stringliteral">"tcp:host=localhost,port=1234"</span>,
<a name="l01158"></a>01158 <span class="stringliteral">"tcp:host=localhost,port=1234;tcp:port=5678"</span>,
<a name="l01159"></a>01159 <span class="preprocessor">#ifdef DBUS_UNIX</span>
<a name="l01160"></a>01160 <span class="preprocessor"></span> <span class="stringliteral">"unix:path=./boogie"</span>,
<a name="l01161"></a>01161 <span class="stringliteral">"tcp:port=1234;unix:path=./boogie"</span>,
<a name="l01162"></a>01162 <span class="preprocessor">#endif</span>
<a name="l01163"></a>01163 <span class="preprocessor"></span> };
<a name="l01164"></a>01164
<a name="l01165"></a>01165 <a class="code" href="structDBusServer.html">DBusServer</a> *server;
<a name="l01166"></a>01166 <span class="keywordtype">int</span> i;
<a name="l01167"></a>01167
<a name="l01168"></a>01168 <span class="keywordflow">for</span> (i = 0; i < <a class="code" href="group__DBusInternalsUtils.html#gc153abad46f4eb80999a2b340d29d1f0">_DBUS_N_ELEMENTS</a> (valid_addresses); i++)
<a name="l01169"></a>01169 {
<a name="l01170"></a>01170 <a class="code" href="structDBusError.html">DBusError</a> error;
<a name="l01171"></a>01171 <span class="keywordtype">char</span> *address;
<a name="l01172"></a>01172 <span class="keywordtype">char</span> *id;
<a name="l01173"></a>01173
<a name="l01174"></a>01174 <a class="code" href="group__DBusErrors.html#g8ce28eae754237703296599967d7ab77">dbus_error_init</a> (&error);
<a name="l01175"></a>01175 server = <a class="code" href="group__DBusServer.html#geb56ec61286bff89fa482fd6138cd13b">dbus_server_listen</a> (valid_addresses[i], &error);
<a name="l01176"></a>01176 <span class="keywordflow">if</span> (server == <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>)
<a name="l01177"></a>01177 {
<a name="l01178"></a>01178 <a class="code" href="group__DBusInternalsUtils.html#gbea2c16d6d3fe7c4eb5b9496fc877f84">_dbus_warn</a> (<span class="stringliteral">"server listen error: %s: %s\n"</span>, error.name, error.message);
<a name="l01179"></a>01179 <a class="code" href="group__DBusErrors.html#gd192d53cf930b1b12e1ce91bc0963709">dbus_error_free</a> (&error);
<a name="l01180"></a>01180 <a class="code" href="group__DBusInternalsUtils.html#g0c4961ec784874f1b1f3aeccea8d3da1">_dbus_assert_not_reached</a> (<span class="stringliteral">"Failed to listen for valid address."</span>);
<a name="l01181"></a>01181 }
<a name="l01182"></a>01182
<a name="l01183"></a>01183 <span class="keywordtype">id</span> = <a class="code" href="group__DBusServer.html#g895b1c025268911584f4d15dd7c96512">dbus_server_get_id</a> (server);
<a name="l01184"></a>01184 <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (<span class="keywordtype">id</span> != <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>);
<a name="l01185"></a>01185 address = <a class="code" href="group__DBusServer.html#g369647e80a931ea4bc53a859d43ac36a">dbus_server_get_address</a> (server);
<a name="l01186"></a>01186 <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (address != <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>);
<a name="l01187"></a>01187
<a name="l01188"></a>01188 <span class="keywordflow">if</span> (strstr (address, <span class="keywordtype">id</span>) == <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>)
<a name="l01189"></a>01189 {
<a name="l01190"></a>01190 <a class="code" href="group__DBusInternalsUtils.html#gbea2c16d6d3fe7c4eb5b9496fc877f84">_dbus_warn</a> (<span class="stringliteral">"server id '%s' is not in the server address '%s'\n"</span>,
<a name="l01191"></a>01191 <span class="keywordtype">id</span>, address);
<a name="l01192"></a>01192 <a class="code" href="group__DBusInternalsUtils.html#g0c4961ec784874f1b1f3aeccea8d3da1">_dbus_assert_not_reached</a> (<span class="stringliteral">"bad server id or address"</span>);
<a name="l01193"></a>01193 }
<a name="l01194"></a>01194
<a name="l01195"></a>01195 <a class="code" href="group__DBusMemory.html#g488c6b08cc8c1ddf0203243c4b27a13c">dbus_free</a> (<span class="keywordtype">id</span>);
<a name="l01196"></a>01196 <a class="code" href="group__DBusMemory.html#g488c6b08cc8c1ddf0203243c4b27a13c">dbus_free</a> (address);
<a name="l01197"></a>01197
<a name="l01198"></a>01198 <a class="code" href="group__DBusServer.html#g3833573bd7b5dd61e77610edbcb49297">dbus_server_disconnect</a> (server);
<a name="l01199"></a>01199 <a class="code" href="group__DBusServer.html#g8cd88699638aafda3512802b551fe87b">dbus_server_unref</a> (server);
<a name="l01200"></a>01200 }
<a name="l01201"></a>01201
<a name="l01202"></a>01202 <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#ga8cecfc5c5c054d2875c03e77b7be15d">TRUE</a>;
<a name="l01203"></a>01203 }
<a name="l01204"></a>01204
<a name="l01205"></a>01205 <span class="preprocessor">#endif </span><span class="comment">/* DBUS_BUILD_TESTS */</span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Mon Dec 14 22:26:12 2009 for D-Bus by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address>
</body>
</html>