index.html
Main Page
|
modules.html
Modules
|
namespaces.html
Namespace List
|
hierarchy.html
Class Hierarchy
|
annotated.html
Data Structures
|
dirs.html
Directories
|
files.html
File List
|
namespacemembers.html
Namespace Members
|
functions.html
Data Fields
|
pages.html
Related Pages
dir_000004.html
dbus
dbus-connection.c
00001
/* -*- mode: C; c-file-style: "gnu" -*- */
00002
/* dbus-connection.c DBusConnection object
00003
*
00004
* Copyright (C) 2002, 2003, 2004, 2005  Red Hat Inc.
00005
*
00006
* Licensed under the Academic Free License version 2.1
00007
*
00008
* This program is free software; you can redistribute it and/or modify
00009
* it under the terms of the GNU General Public License as published by
00010
* the Free Software Foundation; either version 2 of the License, or
00011
* (at your option) any later version.
00012
*
00013
* This program is distributed in the hope that it will be useful,
00014
* but WITHOUT ANY WARRANTY; without even the implied warranty of
00015
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016
* GNU General Public License for more details.
00017
*
00018
* You should have received a copy of the GNU General Public License
00019
* along with this program; if not, write to the Free Software
00020
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021
*
00022
*/
00023
00024
#include <config.h>
00025
#include "dbus-shared.h"
00026
#include "dbus-connection.h"
00027
#include "dbus-list.h"
00028
#include "dbus-timeout.h"
00029
#include "dbus-transport.h"
00030
#include "dbus-watch.h"
00031
#include "dbus-connection-internal.h"
00032
#include "dbus-list.h"
00033
#include "dbus-hash.h"
00034
#include "dbus-message-internal.h"
00035
#include "dbus-threads.h"
00036
#include "dbus-protocol.h"
00037
#include "dbus-dataslot.h"
00038
#include "dbus-string.h"
00039
#include "dbus-pending-call.h"
00040
#include "dbus-object-tree.h"
00041
#include "dbus-threads-internal.h"
00042
00043
#ifdef DBUS_DISABLE_CHECKS
00044
#define TOOK_LOCK_CHECK(connection)
00045
#define RELEASING_LOCK_CHECK(connection)
00046
#define HAVE_LOCK_CHECK(connection)
00047
#else
00048
#define TOOK_LOCK_CHECK(connection) do {                \
00049
_dbus_assert (!(connection)->have_connection_lock); \
00050
(connection)->have_connection_lock = TRUE;          \
00051
} while (0)
00052
#define RELEASING_LOCK_CHECK(connection) do {            \
00053
_dbus_assert ((connection)->have_connection_lock);   \
00054
(connection)->have_connection_lock = FALSE;          \
00055
} while (0)
00056
#define HAVE_LOCK_CHECK(connection)        _dbus_assert ((connection)->have_connection_lock)
00057
/* A "DO_NOT_HAVE_LOCK_CHECK" is impossible since we need the lock to check the flag */
00058
#endif
00059
00060
#define TRACE_LOCKS 1
00061
00062
#define CONNECTION_LOCK(connection)   do {                                      \
00063
if (TRACE_LOCKS) { _dbus_verbose ("  LOCK: %s\n", _DBUS_FUNCTION_NAME); }   \
00064
_dbus_mutex_lock ((connection)->mutex);                                      \
00065
TOOK_LOCK_CHECK (connection);                                               \
00066
} while (0)
00067
00068
#define CONNECTION_UNLOCK(connection) do {                                              \
00069
if (TRACE_LOCKS) { _dbus_verbose ("  UNLOCK: %s\n", _DBUS_FUNCTION_NAME);  }        \
00070
RELEASING_LOCK_CHECK (connection);                                                  \
00071
_dbus_mutex_unlock ((connection)->mutex);                                            \
00072
} while (0)
00073
00074
#define DISPATCH_STATUS_NAME(s)                                            \
00075
((s) == DBUS_DISPATCH_COMPLETE ? "complete" :         \
00076
(s) == DBUS_DISPATCH_DATA_REMAINS ? "data remains" : \
00077
(s) == DBUS_DISPATCH_NEED_MEMORY ? "need memory" :   \
00078
"???")
00079
group__DBusConnectionInternals.html#ga0
00157
typedef
struct
structDBusMessageFilter.html
DBusMessageFilter
DBusMessageFilter;
00158
structDBusMessageFilter.html
00162
struct
DBusMessageFilter
00163 {
structDBusMessageFilter.html#o0
00164
structDBusAtomic.html
DBusAtomic
structDBusMessageFilter.html#o0
refcount
;
structDBusMessageFilter.html#o1
00165
DBusHandleMessageFunction
structDBusMessageFilter.html#o1
function
;
structDBusMessageFilter.html#o2
00166
void
*
structDBusMessageFilter.html#o2
user_data
;
structDBusMessageFilter.html#o3
00167
group__DBusMemory.html#ga8
DBusFreeFunction
structDBusMessageFilter.html#o3
free_user_data_function
;
00168 };
00169
00170
structDBusPreallocatedSend.html
00174
struct
structDBusPreallocatedSend.html
DBusPreallocatedSend
00175 {
structDBusPreallocatedSend.html#o0
00176
structDBusConnection.html
DBusConnection
*
structDBusPreallocatedSend.html#o0
connection
;
structDBusPreallocatedSend.html#o1
00177
structDBusList.html
DBusList
*
structDBusPreallocatedSend.html#o1
queue_link
;
structDBusPreallocatedSend.html#o2
00178
structDBusList.html
DBusList
*
structDBusPreallocatedSend.html#o2
counter_link
;
00179 };
00180
00181
static
group__DBusTypes.html#ga2
dbus_bool_t
_dbus_modify_sigpipe =
group__DBusMacros.html#ga2
TRUE
;
00182
structDBusConnection.html
00186
struct
structDBusConnection.html
DBusConnection
00187 {
structDBusConnection.html#o0
00188
structDBusAtomic.html
DBusAtomic
structDBusConnection.html#o0
refcount
;
structDBusConnection.html#o1
00190
DBusMutex *
structDBusConnection.html#o1
mutex
;
structDBusConnection.html#o2
00192
DBusMutex *
structDBusConnection.html#o2
dispatch_mutex
;
structDBusConnection.html#o3
00193
DBusCondVar *
structDBusConnection.html#o3
dispatch_cond
;
structDBusConnection.html#o4
00194
DBusMutex *
structDBusConnection.html#o4
io_path_mutex
;
structDBusConnection.html#o5
00195
DBusCondVar *
structDBusConnection.html#o5
io_path_cond
;
structDBusConnection.html#o6
00197
structDBusList.html
DBusList
*
structDBusConnection.html#o6
outgoing_messages
;
structDBusConnection.html#o7
00198
structDBusList.html
DBusList
*
structDBusConnection.html#o7
incoming_messages
;
structDBusConnection.html#o8
00200
structDBusMessage.html
DBusMessage
*
structDBusConnection.html#o8
message_borrowed
;
structDBusConnection.html#o9
00204
int
structDBusConnection.html#o9
n_outgoing
;
structDBusConnection.html#o10
00205
int
structDBusConnection.html#o10
n_incoming
;
structDBusConnection.html#o11
00207
structDBusCounter.html
DBusCounter
*
structDBusConnection.html#o11
outgoing_counter
;
structDBusConnection.html#o12
00209
structDBusTransport.html
DBusTransport
*
structDBusConnection.html#o12
transport
;
structDBusConnection.html#o13
00210
structDBusWatchList.html
DBusWatchList
*
structDBusConnection.html#o13
watches
;
structDBusConnection.html#o14
00211
structDBusTimeoutList.html
DBusTimeoutList
*
structDBusConnection.html#o14
timeouts
;
structDBusConnection.html#o15
00213
structDBusList.html
DBusList
*
structDBusConnection.html#o15
filter_list
;
structDBusConnection.html#o16
00215
structDBusDataSlotList.html
DBusDataSlotList
structDBusConnection.html#o16
slot_list
;
structDBusConnection.html#o17
00217
structDBusHashTable.html
DBusHashTable
*
structDBusConnection.html#o17
pending_replies
;
structDBusConnection.html#o18
00219
group__DBusTypes.html#ga3
dbus_uint32_t
structDBusConnection.html#o18
client_serial
;
structDBusConnection.html#o19
00220
structDBusList.html
DBusList
*
structDBusConnection.html#o19
disconnect_message_link
;
structDBusConnection.html#o20
00222
DBusWakeupMainFunction
structDBusConnection.html#o20
wakeup_main_function
;
structDBusConnection.html#o21
00223
void
*
structDBusConnection.html#o21
wakeup_main_data
;
structDBusConnection.html#o22
00224
group__DBusMemory.html#ga8
DBusFreeFunction
structDBusConnection.html#o22
free_wakeup_main_data
;
structDBusConnection.html#o23
00226
DBusDispatchStatusFunction
structDBusConnection.html#o23
dispatch_status_function
;
structDBusConnection.html#o24
00227
void
*
structDBusConnection.html#o24
dispatch_status_data
;
structDBusConnection.html#o25
00228
group__DBusMemory.html#ga8
DBusFreeFunction
structDBusConnection.html#o25
free_dispatch_status_data
;
structDBusConnection.html#o26
00230
DBusDispatchStatus
structDBusConnection.html#o26
last_dispatch_status
;
structDBusConnection.html#o27
00232
structDBusList.html
DBusList
*
structDBusConnection.html#o27
link_cache
;
structDBusConnection.html#o28
00235
structDBusObjectTree.html
DBusObjectTree
*
structDBusConnection.html#o28
objects
;
structDBusConnection.html#o29
00237
char
*
structDBusConnection.html#o29
server_guid
;
structDBusConnection.html#o30
00239
unsigned
int
structDBusConnection.html#o30
shareable
: 1;
structDBusConnection.html#o31
00241
unsigned
int
structDBusConnection.html#o31
dispatch_acquired
: 1;
structDBusConnection.html#o32
00242
unsigned
int
structDBusConnection.html#o32
io_path_acquired
: 1;
structDBusConnection.html#o33
00244
unsigned
int
structDBusConnection.html#o33
exit_on_disconnect
: 1;
00246
#ifndef DBUS_DISABLE_CHECKS
structDBusConnection.html#o34
00247
unsigned
int
structDBusConnection.html#o34
have_connection_lock
: 1;
00248
#endif
00249
00250
#ifndef DBUS_DISABLE_CHECKS
structDBusConnection.html#o35
00251
int
structDBusConnection.html#o35
generation
;
00252
#endif
00253
};
00254
00255
static
DBusDispatchStatus _dbus_connection_get_dispatch_status_unlocked      (
structDBusConnection.html
DBusConnection
*connection);
00256
static
void
_dbus_connection_update_dispatch_status_and_unlock (
structDBusConnection.html
DBusConnection
*connection,
00257                                                                               DBusDispatchStatus  new_status);
00258
static
void
_dbus_connection_last_unref                        (
structDBusConnection.html
DBusConnection
*connection);
00259
static
void
_dbus_connection_acquire_dispatch                  (
structDBusConnection.html
DBusConnection
*connection);
00260
static
void
_dbus_connection_release_dispatch                  (
structDBusConnection.html
DBusConnection
*connection);
00261
00262
static
DBusMessageFilter *
00263 _dbus_message_filter_ref (DBusMessageFilter *filter)
00264 {
00265
group__DBusInternalsUtils.html#ga130
_dbus_assert
(filter->
structDBusMessageFilter.html#o0
refcount
.
structDBusAtomic.html#o0
value
> 0);
00266
group__DBusInternalsUtils.html#ga80
_dbus_atomic_inc
(&filter->
structDBusMessageFilter.html#o0
refcount
);
00267
00268
return
filter;
00269 }
00270
00271
static
void
00272 _dbus_message_filter_unref (DBusMessageFilter *filter)
00273 {
00274
group__DBusInternalsUtils.html#ga130
_dbus_assert
(filter->
structDBusMessageFilter.html#o0
refcount
.
structDBusAtomic.html#o0
value
> 0);
00275
00276
if
(
group__DBusInternalsUtils.html#ga81
_dbus_atomic_dec
(&filter->
structDBusMessageFilter.html#o0
refcount
) == 1)
00277     {
00278
if
(filter->
structDBusMessageFilter.html#o3
free_user_data_function
)
00279         (* filter->
structDBusMessageFilter.html#o3
free_user_data_function
) (filter->
structDBusMessageFilter.html#o2
user_data
);
00280
00281
group__DBusMemory.html#ga3
dbus_free
(filter);
00282     }
00283 }
00284
00290
void
group__DBusConnectionInternals.html#ga16
00291
group__DBusConnectionInternals.html#ga16
_dbus_connection_lock
(
structDBusConnection.html
DBusConnection
*connection)
00292 {
00293   CONNECTION_LOCK (connection);
00294 }
00295
00301
void
group__DBusConnectionInternals.html#ga17
00302
group__DBusConnectionInternals.html#ga17
_dbus_connection_unlock
(
structDBusConnection.html
DBusConnection
*connection)
00303 {
00304   CONNECTION_UNLOCK (connection);
00305 }
00306
00314
static
void
00315 _dbus_connection_wakeup_mainloop (
structDBusConnection.html
DBusConnection
*connection)
00316 {
00317
if
(connection->
structDBusConnection.html#o20
wakeup_main_function
)
00318     (*connection->
structDBusConnection.html#o20
wakeup_main_function
) (connection->
structDBusConnection.html#o21
wakeup_main_data
);
00319 }
00320
00321
#ifdef DBUS_BUILD_TESTS
00322
/* For now this function isn't used */
00332
group__DBusTypes.html#ga2
dbus_bool_t
00333 _dbus_connection_queue_received_message (
structDBusConnection.html
DBusConnection
*connection,
00334
structDBusMessage.html
DBusMessage
*message)
00335 {
00336
structDBusList.html
DBusList
*link;
00337
00338   link =
group__DBusList.html#ga0
_dbus_list_alloc_link
(message);
00339
if
(link ==
group__DBusMacros.html#ga4
NULL
)
00340
return
group__DBusMacros.html#ga3
FALSE
;
00341
00342
group__DBusMessage.html#ga19
dbus_message_ref
(message);
00343
group__DBusConnectionInternals.html#ga19
_dbus_connection_queue_received_message_link
(connection, link);
00344
00345
return
group__DBusMacros.html#ga2
TRUE
;
00346 }
00347
#endif
00348
00357
void
group__DBusConnectionInternals.html#ga19
00358
group__DBusConnectionInternals.html#ga19
_dbus_connection_queue_received_message_link
(
structDBusConnection.html
DBusConnection
*connection,
00359
structDBusList.html
DBusList
*link)
00360 {
00361
structDBusPendingCall.html
DBusPendingCall
*pending;
00362
group__DBusTypes.html#ga4
dbus_int32_t
reply_serial;
00363
structDBusMessage.html
DBusMessage
*message;
00364
00365
group__DBusInternalsUtils.html#ga130
_dbus_assert
(
group__DBusTransport.html#ga8
_dbus_transport_get_is_authenticated
(connection->
structDBusConnection.html#o12
transport
));
00366
00367
group__DBusList.html#ga4
_dbus_list_append_link
(&connection->
structDBusConnection.html#o7
incoming_messages
,
00368                           link);
00369   message = link->
structDBusList.html#o2
data
;
00370
00371
/* If this is a reply we're waiting on, remove timeout for it */
00372   reply_serial =
group__DBusMessage.html#ga5
dbus_message_get_reply_serial
(message);
00373
if
(reply_serial != -1)
00374     {
00375       pending =
group__DBusHashTable.html#ga17
_dbus_hash_table_lookup_int
(connection->
structDBusConnection.html#o17
pending_replies
,
00376                                              reply_serial);
00377
if
(pending !=
group__DBusMacros.html#ga4
NULL
)
00378         {
00379
if
(pending->
structDBusPendingCall.html#o9
timeout_added
)
00380
group__DBusConnectionInternals.html#ga31
_dbus_connection_remove_timeout
(connection,
00381                                              pending->
structDBusPendingCall.html#o5
timeout
);
00382
00383           pending->
structDBusPendingCall.html#o9
timeout_added
=
group__DBusMacros.html#ga3
FALSE
;
00384         }
00385     }
00386
00387   connection->
structDBusConnection.html#o10
n_incoming
+= 1;
00388
00389   _dbus_connection_wakeup_mainloop (connection);
00390
00391   _dbus_verbose (
"Message %p (%d %s %s %s '%s' reply to %u) added to incoming queue %p, %d incoming\n"
,
00392                  message,
00393
group__DBusMessage.html#ga21
dbus_message_get_type
(message),
00394
group__DBusMessage.html#ga52
dbus_message_get_path
(message),
00395
group__DBusMessage.html#ga56
dbus_message_get_interface
(message) ?
00396
group__DBusMessage.html#ga56
dbus_message_get_interface
(message) :
00397
"no interface"
,
00398
group__DBusMessage.html#ga59
dbus_message_get_member
(message) ?
00399
group__DBusMessage.html#ga59
dbus_message_get_member
(message) :
00400
"no member"
,
00401
group__DBusMessage.html#ga67
dbus_message_get_signature
(message),
00402
group__DBusMessage.html#ga5
dbus_message_get_reply_serial
(message),
00403                  connection,
00404                  connection->
structDBusConnection.html#o10
n_incoming
);
00405 }
00406
00417
static
void
00418 _dbus_connection_queue_synthesized_message_link (
structDBusConnection.html
DBusConnection
*connection,
00419
structDBusList.html
DBusList
*link)
00420 {
00421   HAVE_LOCK_CHECK (connection);
00422
00423
group__DBusList.html#ga4
_dbus_list_append_link
(&connection->
structDBusConnection.html#o7
incoming_messages
, link);
00424
00425   connection->
structDBusConnection.html#o10
n_incoming
+= 1;
00426
00427   _dbus_connection_wakeup_mainloop (connection);
00428
00429   _dbus_verbose (
"Synthesized message %p added to incoming queue %p, %d incoming\n"
,
00430                  link->
structDBusList.html#o2
data
, connection, connection->
structDBusConnection.html#o10
n_incoming
);
00431 }
00432
00433
00441
group__DBusTypes.html#ga2
dbus_bool_t
group__DBusConnectionInternals.html#ga21
00442
group__DBusConnectionInternals.html#ga21
_dbus_connection_has_messages_to_send_unlocked
(
structDBusConnection.html
DBusConnection
*connection)
00443 {
00444   HAVE_LOCK_CHECK (connection);
00445
return
connection->
structDBusConnection.html#o6
outgoing_messages
!=
group__DBusMacros.html#ga4
NULL
;
00446 }
00447
00454
group__DBusTypes.html#ga2
dbus_bool_t
group__DBusConnectionInternals.html#ga22
00455
group__DBusConnectionInternals.html#ga22
dbus_connection_has_messages_to_send
(
structDBusConnection.html
DBusConnection
*connection)
00456 {
00457
group__DBusTypes.html#ga2
dbus_bool_t
v;
00458
00459   _dbus_return_val_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga3
FALSE
);
00460
00461   CONNECTION_LOCK (connection);
00462   v =
group__DBusConnectionInternals.html#ga21
_dbus_connection_has_messages_to_send_unlocked
(connection);
00463   CONNECTION_UNLOCK (connection);
00464
00465
return
v;
00466 }
00467
00475
structDBusMessage.html
DBusMessage
*
group__DBusConnectionInternals.html#ga23
00476
group__DBusConnectionInternals.html#ga23
_dbus_connection_get_message_to_send
(
structDBusConnection.html
DBusConnection
*connection)
00477 {
00478   HAVE_LOCK_CHECK (connection);
00479
00480
return
group__DBusList.html#ga15
_dbus_list_get_last
(&connection->
structDBusConnection.html#o6
outgoing_messages
);
00481 }
00482
00491
void
group__DBusConnectionInternals.html#ga24
00492
group__DBusConnectionInternals.html#ga24
_dbus_connection_message_sent
(
structDBusConnection.html
DBusConnection
*connection,
00493
structDBusMessage.html
DBusMessage
*message)
00494 {
00495
structDBusList.html
DBusList
*link;
00496
00497   HAVE_LOCK_CHECK (connection);
00498
00499
/* This can be called before we even complete authentication, since
00500
* it's called on disconnect to clean up the outgoing queue.
00501
* It's also called as we successfully send each message.
00502
*/
00503
00504   link =
group__DBusList.html#ga14
_dbus_list_get_last_link
(&connection->
structDBusConnection.html#o6
outgoing_messages
);
00505
group__DBusInternalsUtils.html#ga130
_dbus_assert
(link !=
group__DBusMacros.html#ga4
NULL
);
00506
group__DBusInternalsUtils.html#ga130
_dbus_assert
(link->
structDBusList.html#o2
data
== message);
00507
00508
/* Save this link in the link cache */
00509
group__DBusList.html#ga10
_dbus_list_unlink
(&connection->
structDBusConnection.html#o6
outgoing_messages
,
00510                      link);
00511
group__DBusList.html#ga5
_dbus_list_prepend_link
(&connection->
structDBusConnection.html#o27
link_cache
, link);
00512
00513   connection->
structDBusConnection.html#o9
n_outgoing
-= 1;
00514
00515   _dbus_verbose (
"Message %p (%d %s %s %s '%s') removed from outgoing queue %p, %d left to send\n"
,
00516                  message,
00517
group__DBusMessage.html#ga21
dbus_message_get_type
(message),
00518
group__DBusMessage.html#ga52
dbus_message_get_path
(message),
00519
group__DBusMessage.html#ga56
dbus_message_get_interface
(message) ?
00520
group__DBusMessage.html#ga56
dbus_message_get_interface
(message) :
00521
"no interface"
,
00522
group__DBusMessage.html#ga59
dbus_message_get_member
(message) ?
00523
group__DBusMessage.html#ga59
dbus_message_get_member
(message) :
00524
"no member"
,
00525
group__DBusMessage.html#ga67
dbus_message_get_signature
(message),
00526                  connection, connection->
structDBusConnection.html#o9
n_outgoing
);
00527
00528
/* Save this link in the link cache also */
00529
group__DBusMessageInternals.html#ga10
_dbus_message_remove_size_counter
(message, connection->
structDBusConnection.html#o11
outgoing_counter
,
00530                                      &link);
00531
group__DBusList.html#ga5
_dbus_list_prepend_link
(&connection->
structDBusConnection.html#o27
link_cache
, link);
00532
00533
group__DBusMessage.html#ga20
dbus_message_unref
(message);
00534 }
00535
group__DBusConnectionInternals.html#ga2
00536
typedef
group__DBusTypes.html#ga2
dbus_bool_t
(*
group__DBusConnectionInternals.html#ga2
DBusWatchAddFunction
)     (
structDBusWatchList.html
DBusWatchList
*list,
00537
structDBusWatch.html
DBusWatch
*watch);
group__DBusConnectionInternals.html#ga3
00538
typedef
void        (*
group__DBusConnectionInternals.html#ga3
DBusWatchRemoveFunction
)  (
structDBusWatchList.html
DBusWatchList
*list,
00539
structDBusWatch.html
DBusWatch
*watch);
group__DBusConnectionInternals.html#ga4
00540
typedef
void        (*
group__DBusConnectionInternals.html#ga4
DBusWatchToggleFunction
)  (
structDBusWatchList.html
DBusWatchList
*list,
00541
structDBusWatch.html
DBusWatch
*watch,
00542
group__DBusTypes.html#ga2
dbus_bool_t
enabled);
00543
00544
static
group__DBusTypes.html#ga2
dbus_bool_t
00545 protected_change_watch (
structDBusConnection.html
DBusConnection
*connection,
00546
structDBusWatch.html
DBusWatch
*watch,
00547
group__DBusConnectionInternals.html#ga2
DBusWatchAddFunction
add_function,
00548
group__DBusConnectionInternals.html#ga3
DBusWatchRemoveFunction
remove_function,
00549
group__DBusConnectionInternals.html#ga4
DBusWatchToggleFunction
toggle_function,
00550
group__DBusTypes.html#ga2
dbus_bool_t
enabled)
00551 {
00552
structDBusWatchList.html
DBusWatchList
*watches;
00553
group__DBusTypes.html#ga2
dbus_bool_t
retval;
00554
00555   HAVE_LOCK_CHECK (connection);
00556
00557
/* This isn't really safe or reasonable; a better pattern is the "do everything, then
00558
* drop lock and call out" one; but it has to be propagated up through all callers
00559
*/
00560
00561   watches = connection->
structDBusConnection.html#o13
watches
;
00562
if
(watches)
00563     {
00564       connection->
structDBusConnection.html#o13
watches
=
group__DBusMacros.html#ga4
NULL
;
00565
group__DBusConnectionInternals.html#ga43
_dbus_connection_ref_unlocked
(connection);
00566       CONNECTION_UNLOCK (connection);
00567
00568
if
(add_function)
00569         retval = (* add_function) (watches, watch);
00570
else
if
(remove_function)
00571         {
00572           retval =
group__DBusMacros.html#ga2
TRUE
;
00573           (* remove_function) (watches, watch);
00574         }
00575
else
00576         {
00577           retval =
group__DBusMacros.html#ga2
TRUE
;
00578           (* toggle_function) (watches, watch, enabled);
00579         }
00580
00581       CONNECTION_LOCK (connection);
00582       connection->
structDBusConnection.html#o13
watches
= watches;
00583
group__DBusConnectionInternals.html#ga44
_dbus_connection_unref_unlocked
(connection);
00584
00585
return
retval;
00586     }
00587
else
00588
return
group__DBusMacros.html#ga3
FALSE
;
00589 }
00590
00591
00602
group__DBusTypes.html#ga2
dbus_bool_t
group__DBusConnectionInternals.html#ga26
00603
group__DBusConnectionInternals.html#ga26
_dbus_connection_add_watch
(
structDBusConnection.html
DBusConnection
*connection,
00604
structDBusWatch.html
DBusWatch
*watch)
00605 {
00606
return
protected_change_watch (connection, watch,
00607
group__DBusWatchInternals.html#ga8
_dbus_watch_list_add_watch
,
00608
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga3
FALSE
);
00609 }
00610
00619
void
group__DBusConnectionInternals.html#ga27
00620
group__DBusConnectionInternals.html#ga27
_dbus_connection_remove_watch
(
structDBusConnection.html
DBusConnection
*connection,
00621
structDBusWatch.html
DBusWatch
*watch)
00622 {
00623   protected_change_watch (connection, watch,
00624
group__DBusMacros.html#ga4
NULL
,
00625
group__DBusWatchInternals.html#ga9
_dbus_watch_list_remove_watch
,
00626
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga3
FALSE
);
00627 }
00628
00639
void
group__DBusConnectionInternals.html#ga28
00640
group__DBusConnectionInternals.html#ga28
_dbus_connection_toggle_watch
(
structDBusConnection.html
DBusConnection
*connection,
00641
structDBusWatch.html
DBusWatch
*watch,
00642
group__DBusTypes.html#ga2
dbus_bool_t
enabled)
00643 {
00644
group__DBusInternalsUtils.html#ga130
_dbus_assert
(watch !=
group__DBusMacros.html#ga4
NULL
);
00645
00646   protected_change_watch (connection, watch,
00647
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga4
NULL
,
00648
group__DBusWatchInternals.html#ga10
_dbus_watch_list_toggle_watch
,
00649                           enabled);
00650 }
00651
group__DBusConnectionInternals.html#ga5
00652
typedef
group__DBusTypes.html#ga2
dbus_bool_t
(*
group__DBusConnectionInternals.html#ga5
DBusTimeoutAddFunction
)    (
structDBusTimeoutList.html
DBusTimeoutList
*list,
00653
structDBusTimeout.html
DBusTimeout
*timeout);
group__DBusConnectionInternals.html#ga6
00654
typedef
void        (*
group__DBusConnectionInternals.html#ga6
DBusTimeoutRemoveFunction
) (
structDBusTimeoutList.html
DBusTimeoutList
*list,
00655
structDBusTimeout.html
DBusTimeout
*timeout);
group__DBusConnectionInternals.html#ga7
00656
typedef
void        (*
group__DBusConnectionInternals.html#ga7
DBusTimeoutToggleFunction
) (
structDBusTimeoutList.html
DBusTimeoutList
*list,
00657
structDBusTimeout.html
DBusTimeout
*timeout,
00658
group__DBusTypes.html#ga2
dbus_bool_t
enabled);
00659
00660
static
group__DBusTypes.html#ga2
dbus_bool_t
00661 protected_change_timeout (
structDBusConnection.html
DBusConnection
*connection,
00662
structDBusTimeout.html
DBusTimeout
*timeout,
00663
group__DBusConnectionInternals.html#ga5
DBusTimeoutAddFunction
add_function,
00664
group__DBusConnectionInternals.html#ga6
DBusTimeoutRemoveFunction
remove_function,
00665
group__DBusConnectionInternals.html#ga7
DBusTimeoutToggleFunction
toggle_function,
00666
group__DBusTypes.html#ga2
dbus_bool_t
enabled)
00667 {
00668
structDBusTimeoutList.html
DBusTimeoutList
*timeouts;
00669
group__DBusTypes.html#ga2
dbus_bool_t
retval;
00670
00671   HAVE_LOCK_CHECK (connection);
00672
00673
/* This isn't really safe or reasonable; a better pattern is the "do everything, then
00674
* drop lock and call out" one; but it has to be propagated up through all callers
00675
*/
00676
00677   timeouts = connection->
structDBusConnection.html#o14
timeouts
;
00678
if
(timeouts)
00679     {
00680       connection->
structDBusConnection.html#o14
timeouts
=
group__DBusMacros.html#ga4
NULL
;
00681
group__DBusConnectionInternals.html#ga43
_dbus_connection_ref_unlocked
(connection);
00682       CONNECTION_UNLOCK (connection);
00683
00684
if
(add_function)
00685         retval = (* add_function) (timeouts, timeout);
00686
else
if
(remove_function)
00687         {
00688           retval =
group__DBusMacros.html#ga2
TRUE
;
00689           (* remove_function) (timeouts, timeout);
00690         }
00691
else
00692         {
00693           retval =
group__DBusMacros.html#ga2
TRUE
;
00694           (* toggle_function) (timeouts, timeout, enabled);
00695         }
00696
00697       CONNECTION_LOCK (connection);
00698       connection->
structDBusConnection.html#o14
timeouts
= timeouts;
00699
group__DBusConnectionInternals.html#ga44
_dbus_connection_unref_unlocked
(connection);
00700
00701
return
retval;
00702     }
00703
else
00704
return
group__DBusMacros.html#ga3
FALSE
;
00705 }
00706
00718
group__DBusTypes.html#ga2
dbus_bool_t
group__DBusConnectionInternals.html#ga30
00719
group__DBusConnectionInternals.html#ga30
_dbus_connection_add_timeout
(
structDBusConnection.html
DBusConnection
*connection,
00720
structDBusTimeout.html
DBusTimeout
*timeout)
00721 {
00722
return
protected_change_timeout (connection, timeout,
00723
group__DBusTimeoutInternals.html#ga8
_dbus_timeout_list_add_timeout
,
00724
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga3
FALSE
);
00725 }
00726
00735
void
group__DBusConnectionInternals.html#ga31
00736
group__DBusConnectionInternals.html#ga31
_dbus_connection_remove_timeout
(
structDBusConnection.html
DBusConnection
*connection,
00737
structDBusTimeout.html
DBusTimeout
*timeout)
00738 {
00739   protected_change_timeout (connection, timeout,
00740
group__DBusMacros.html#ga4
NULL
,
00741
group__DBusTimeoutInternals.html#ga9
_dbus_timeout_list_remove_timeout
,
00742
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga3
FALSE
);
00743 }
00744
00754
void
group__DBusConnectionInternals.html#ga32
00755
group__DBusConnectionInternals.html#ga32
_dbus_connection_toggle_timeout
(
structDBusConnection.html
DBusConnection
*connection,
00756
structDBusTimeout.html
DBusTimeout
*timeout,
00757
group__DBusTypes.html#ga2
dbus_bool_t
enabled)
00758 {
00759   protected_change_timeout (connection, timeout,
00760
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga4
NULL
,
00761
group__DBusTimeoutInternals.html#ga10
_dbus_timeout_list_toggle_timeout
,
00762                             enabled);
00763 }
00764
00765
static
group__DBusTypes.html#ga2
dbus_bool_t
00766 _dbus_connection_attach_pending_call_unlocked (
structDBusConnection.html
DBusConnection
*connection,
00767
structDBusPendingCall.html
DBusPendingCall
*pending)
00768 {
00769   HAVE_LOCK_CHECK (connection);
00770
00771
group__DBusInternalsUtils.html#ga130
_dbus_assert
(pending->
structDBusPendingCall.html#o7
reply_serial
!= 0);
00772
00773
if
(!
group__DBusConnectionInternals.html#ga30
_dbus_connection_add_timeout
(connection, pending->
structDBusPendingCall.html#o5
timeout
))
00774
return
group__DBusMacros.html#ga3
FALSE
;
00775
00776
if
(!
group__DBusHashTable.html#ga23
_dbus_hash_table_insert_int
(connection->pending_replies,
00777                                     pending->
structDBusPendingCall.html#o7
reply_serial
,
00778                                     pending))
00779     {
00780
group__DBusConnectionInternals.html#ga31
_dbus_connection_remove_timeout
(connection, pending->
structDBusPendingCall.html#o5
timeout
);
00781
00782       HAVE_LOCK_CHECK (connection);
00783
return
group__DBusMacros.html#ga3
FALSE
;
00784     }
00785
00786   pending->
structDBusPendingCall.html#o9
timeout_added
=
group__DBusMacros.html#ga2
TRUE
;
00787   pending->
structDBusPendingCall.html#o3
connection
= connection;
00788
00789
group__DBusPendingCall.html#ga1
dbus_pending_call_ref
(pending);
00790
00791   HAVE_LOCK_CHECK (connection);
00792
00793
return
group__DBusMacros.html#ga2
TRUE
;
00794 }
00795
00796
static
void
00797 free_pending_call_on_hash_removal (
void
*data)
00798 {
00799
structDBusPendingCall.html
DBusPendingCall
*pending;
00800
00801
if
(data ==
group__DBusMacros.html#ga4
NULL
)
00802
return
;
00803
00804   pending = data;
00805
00806
if
(pending->
structDBusPendingCall.html#o3
connection
)
00807     {
00808
if
(pending->
structDBusPendingCall.html#o9
timeout_added
)
00809         {
00810
group__DBusConnectionInternals.html#ga31
_dbus_connection_remove_timeout
(pending->
structDBusPendingCall.html#o3
connection
,
00811                                            pending->
structDBusPendingCall.html#o5
timeout
);
00812           pending->
structDBusPendingCall.html#o9
timeout_added
=
group__DBusMacros.html#ga3
FALSE
;
00813         }
00814
00815       pending->
structDBusPendingCall.html#o3
connection
=
group__DBusMacros.html#ga4
NULL
;
00816
00817
group__DBusPendingCall.html#ga2
dbus_pending_call_unref
(pending);
00818     }
00819 }
00820
00821
static
void
00822 _dbus_connection_detach_pending_call_unlocked (
structDBusConnection.html
DBusConnection
*connection,
00823
structDBusPendingCall.html
DBusPendingCall
*pending)
00824 {
00825
/* Can't have a destroy notifier on the pending call if we're going to do this */
00826
00827
group__DBusPendingCall.html#ga1
dbus_pending_call_ref
(pending);
00828
group__DBusHashTable.html#ga20
_dbus_hash_table_remove_int
(connection->
structDBusConnection.html#o17
pending_replies
,
00829                                pending->
structDBusPendingCall.html#o7
reply_serial
);
00830
group__DBusInternalsUtils.html#ga130
_dbus_assert
(pending->
structDBusPendingCall.html#o3
connection
==
group__DBusMacros.html#ga4
NULL
);
00831
group__DBusPendingCall.html#ga2
dbus_pending_call_unref
(pending);
00832 }
00833
00834
static
void
00835 _dbus_connection_detach_pending_call_and_unlock (
structDBusConnection.html
DBusConnection
*connection,
00836
structDBusPendingCall.html
DBusPendingCall
*pending)
00837 {
00838
/* The idea here is to avoid finalizing the pending call
00839
* with the lock held, since there's a destroy notifier
00840
* in pending call that goes out to application code.
00841
*/
00842
group__DBusPendingCall.html#ga1
dbus_pending_call_ref
(pending);
00843
group__DBusHashTable.html#ga20
_dbus_hash_table_remove_int
(connection->
structDBusConnection.html#o17
pending_replies
,
00844                                pending->
structDBusPendingCall.html#o7
reply_serial
);
00845
group__DBusInternalsUtils.html#ga130
_dbus_assert
(pending->
structDBusPendingCall.html#o3
connection
==
group__DBusMacros.html#ga4
NULL
);
00846   CONNECTION_UNLOCK (connection);
00847
group__DBusPendingCall.html#ga2
dbus_pending_call_unref
(pending);
00848 }
00849
00858
void
group__DBusConnectionInternals.html#ga37
00859
group__DBusConnectionInternals.html#ga37
_dbus_connection_remove_pending_call
(
structDBusConnection.html
DBusConnection
*connection,
00860
structDBusPendingCall.html
DBusPendingCall
*pending)
00861 {
00862   CONNECTION_LOCK (connection);
00863   _dbus_connection_detach_pending_call_and_unlock (connection, pending);
00864 }
00865
00874
void
group__DBusConnectionInternals.html#ga38
00875
group__DBusConnectionInternals.html#ga38
_dbus_pending_call_complete_and_unlock
(
structDBusPendingCall.html
DBusPendingCall
*pending,
00876
structDBusMessage.html
DBusMessage
*message)
00877 {
00878
if
(message ==
group__DBusMacros.html#ga4
NULL
)
00879     {
00880       message = pending->
structDBusPendingCall.html#o6
timeout_link
->
structDBusList.html#o2
data
;
00881
group__DBusList.html#ga12
_dbus_list_clear
(&pending->
structDBusPendingCall.html#o6
timeout_link
);
00882     }
00883
else
00884
group__DBusMessage.html#ga19
dbus_message_ref
(message);
00885
00886   _dbus_verbose (
"  handing message %p (%s) to pending call serial %u\n"
,
00887                  message,
00888
group__DBusMessage.html#ga21
dbus_message_get_type
(message) == DBUS_MESSAGE_TYPE_METHOD_RETURN ?
00889
"method return"
:
00890
group__DBusMessage.html#ga21
dbus_message_get_type
(message) == DBUS_MESSAGE_TYPE_ERROR ?
00891
"error"
:
"other type"
,
00892                  pending->
structDBusPendingCall.html#o7
reply_serial
);
00893
00894
group__DBusInternalsUtils.html#ga130
_dbus_assert
(pending->
structDBusPendingCall.html#o4
reply
==
group__DBusMacros.html#ga4
NULL
);
00895
group__DBusInternalsUtils.html#ga130
_dbus_assert
(pending->
structDBusPendingCall.html#o7
reply_serial
==
group__DBusMessage.html#ga5
dbus_message_get_reply_serial
(message));
00896   pending->
structDBusPendingCall.html#o4
reply
= message;
00897
00898
group__DBusPendingCall.html#ga1
dbus_pending_call_ref
(pending);
/* in case there's no app with a ref held */
00899   _dbus_connection_detach_pending_call_and_unlock (pending->
structDBusPendingCall.html#o3
connection
, pending);
00900
00901
/* Must be called unlocked since it invokes app callback */
00902
group__DBusPendingCallInternals.html#ga2
_dbus_pending_call_notify
(pending);
00903
group__DBusPendingCall.html#ga2
dbus_pending_call_unref
(pending);
00904 }
00905
00915
static
group__DBusTypes.html#ga2
dbus_bool_t
00916 _dbus_connection_acquire_io_path (
structDBusConnection.html
DBusConnection
*connection,
00917
int
timeout_milliseconds)
00918 {
00919
group__DBusTypes.html#ga2
dbus_bool_t
we_acquired;
00920
00921   HAVE_LOCK_CHECK (connection);
00922
00923
/* We don't want the connection to vanish */
00924
group__DBusConnectionInternals.html#ga43
_dbus_connection_ref_unlocked
(connection);
00925
00926
/* We will only touch io_path_acquired which is protected by our mutex */
00927   CONNECTION_UNLOCK (connection);
00928
00929   _dbus_verbose (
"%s locking io_path_mutex\n"
, _DBUS_FUNCTION_NAME);
00930
group__DBusThreadsInternals.html#ga2
_dbus_mutex_lock
(connection->
structDBusConnection.html#o4
io_path_mutex
);
00931
00932   _dbus_verbose (
"%s start connection->io_path_acquired = %d timeout = %d\n"
,
00933                  _DBUS_FUNCTION_NAME, connection->
structDBusConnection.html#o32
io_path_acquired
, timeout_milliseconds);
00934
00935   we_acquired =
group__DBusMacros.html#ga3
FALSE
;
00936
00937
if
(connection->
structDBusConnection.html#o32
io_path_acquired
)
00938     {
00939
if
(timeout_milliseconds != -1)
00940         {
00941           _dbus_verbose (
"%s waiting %d for IO path to be acquirable\n"
,
00942                          _DBUS_FUNCTION_NAME, timeout_milliseconds);
00943
group__DBusThreadsInternals.html#ga7
_dbus_condvar_wait_timeout
(connection->
structDBusConnection.html#o5
io_path_cond
,
00944                                       connection->
structDBusConnection.html#o4
io_path_mutex
,
00945                                       timeout_milliseconds);
00946         }
00947
else
00948         {
00949
while
(connection->
structDBusConnection.html#o32
io_path_acquired
)
00950             {
00951               _dbus_verbose (
"%s waiting for IO path to be acquirable\n"
, _DBUS_FUNCTION_NAME);
00952
group__DBusThreadsInternals.html#ga6
_dbus_condvar_wait
(connection->
structDBusConnection.html#o5
io_path_cond
, connection->
structDBusConnection.html#o4
io_path_mutex
);
00953             }
00954         }
00955     }
00956
00957
if
(!connection->
structDBusConnection.html#o32
io_path_acquired
)
00958     {
00959       we_acquired =
group__DBusMacros.html#ga2
TRUE
;
00960       connection->
structDBusConnection.html#o32
io_path_acquired
=
group__DBusMacros.html#ga2
TRUE
;
00961     }
00962
00963   _dbus_verbose (
"%s end connection->io_path_acquired = %d we_acquired = %d\n"
,
00964                  _DBUS_FUNCTION_NAME, connection->
structDBusConnection.html#o32
io_path_acquired
, we_acquired);
00965
00966   _dbus_verbose (
"%s unlocking io_path_mutex\n"
, _DBUS_FUNCTION_NAME);
00967
group__DBusThreadsInternals.html#ga3
_dbus_mutex_unlock
(connection->
structDBusConnection.html#o4
io_path_mutex
);
00968
00969   CONNECTION_LOCK (connection);
00970
00971   HAVE_LOCK_CHECK (connection);
00972
00973
group__DBusConnectionInternals.html#ga44
_dbus_connection_unref_unlocked
(connection);
00974
00975
return
we_acquired;
00976 }
00977
00985
static
void
00986 _dbus_connection_release_io_path (
structDBusConnection.html
DBusConnection
*connection)
00987 {
00988   HAVE_LOCK_CHECK (connection);
00989
00990   _dbus_verbose (
"%s locking io_path_mutex\n"
, _DBUS_FUNCTION_NAME);
00991
group__DBusThreadsInternals.html#ga2
_dbus_mutex_lock
(connection->
structDBusConnection.html#o4
io_path_mutex
);
00992
00993
group__DBusInternalsUtils.html#ga130
_dbus_assert
(connection->
structDBusConnection.html#o32
io_path_acquired
);
00994
00995   _dbus_verbose (
"%s start connection->io_path_acquired = %d\n"
,
00996                  _DBUS_FUNCTION_NAME, connection->
structDBusConnection.html#o32
io_path_acquired
);
00997
00998   connection->
structDBusConnection.html#o32
io_path_acquired
=
group__DBusMacros.html#ga3
FALSE
;
00999
group__DBusThreadsInternals.html#ga8
_dbus_condvar_wake_one
(connection->
structDBusConnection.html#o5
io_path_cond
);
01000
01001   _dbus_verbose (
"%s unlocking io_path_mutex\n"
, _DBUS_FUNCTION_NAME);
01002
group__DBusThreadsInternals.html#ga3
_dbus_mutex_unlock
(connection->
structDBusConnection.html#o4
io_path_mutex
);
01003 }
01004
01033
void
group__DBusConnectionInternals.html#ga41
01034
group__DBusConnectionInternals.html#ga41
_dbus_connection_do_iteration_unlocked
(
structDBusConnection.html
DBusConnection
*connection,
01035
unsigned
int
flags,
01036
int
timeout_milliseconds)
01037 {
01038   _dbus_verbose (
"%s start\n"
, _DBUS_FUNCTION_NAME);
01039
01040   HAVE_LOCK_CHECK (connection);
01041
01042
if
(connection->
structDBusConnection.html#o9
n_outgoing
== 0)
01043     flags &= ~DBUS_ITERATION_DO_WRITING;
01044
01045
if
(_dbus_connection_acquire_io_path (connection,
01046                                         (flags & DBUS_ITERATION_BLOCK) ? timeout_milliseconds : 0))
01047     {
01048       HAVE_LOCK_CHECK (connection);
01049
01050
group__DBusTransport.html#ga13
_dbus_transport_do_iteration
(connection->transport,
01051                                     flags, timeout_milliseconds);
01052       _dbus_connection_release_io_path (connection);
01053     }
01054
01055   HAVE_LOCK_CHECK (connection);
01056
01057   _dbus_verbose (
"%s end\n"
, _DBUS_FUNCTION_NAME);
01058 }
01059
01069
structDBusConnection.html
DBusConnection
*
group__DBusConnectionInternals.html#ga42
01070
group__DBusConnectionInternals.html#ga42
_dbus_connection_new_for_transport
(
structDBusTransport.html
DBusTransport
*transport)
01071 {
01072
structDBusConnection.html
DBusConnection
*connection;
01073
structDBusWatchList.html
DBusWatchList
*watch_list;
01074
structDBusTimeoutList.html
DBusTimeoutList
*timeout_list;
01075
structDBusHashTable.html
DBusHashTable
*pending_replies;
01076   DBusMutex *mutex;
01077   DBusMutex *io_path_mutex;
01078   DBusMutex *dispatch_mutex;
01079   DBusCondVar *message_returned_cond;
01080   DBusCondVar *dispatch_cond;
01081   DBusCondVar *io_path_cond;
01082
structDBusList.html
DBusList
*disconnect_link;
01083
structDBusMessage.html
DBusMessage
*disconnect_message;
01084
structDBusCounter.html
DBusCounter
*outgoing_counter;
01085
structDBusObjectTree.html
DBusObjectTree
*objects;
01086
01087   watch_list =
group__DBusMacros.html#ga4
NULL
;
01088   connection =
group__DBusMacros.html#ga4
NULL
;
01089   pending_replies =
group__DBusMacros.html#ga4
NULL
;
01090   timeout_list =
group__DBusMacros.html#ga4
NULL
;
01091   mutex =
group__DBusMacros.html#ga4
NULL
;
01092   io_path_mutex =
group__DBusMacros.html#ga4
NULL
;
01093   dispatch_mutex =
group__DBusMacros.html#ga4
NULL
;
01094   message_returned_cond =
group__DBusMacros.html#ga4
NULL
;
01095   dispatch_cond =
group__DBusMacros.html#ga4
NULL
;
01096   io_path_cond =
group__DBusMacros.html#ga4
NULL
;
01097   disconnect_link =
group__DBusMacros.html#ga4
NULL
;
01098   disconnect_message =
group__DBusMacros.html#ga4
NULL
;
01099   outgoing_counter =
group__DBusMacros.html#ga4
NULL
;
01100   objects =
group__DBusMacros.html#ga4
NULL
;
01101
01102   watch_list =
group__DBusWatchInternals.html#ga5
_dbus_watch_list_new
();
01103
if
(watch_list ==
group__DBusMacros.html#ga4
NULL
)
01104
goto
error;
01105
01106   timeout_list =
group__DBusTimeoutInternals.html#ga5
_dbus_timeout_list_new
();
01107
if
(timeout_list ==
group__DBusMacros.html#ga4
NULL
)
01108
goto
error;
01109
01110   pending_replies =
01111
group__DBusHashTable.html#ga1
_dbus_hash_table_new
(DBUS_HASH_INT,
01112
group__DBusMacros.html#ga4
NULL
,
01113                           (
group__DBusMemory.html#ga8
DBusFreeFunction
)free_pending_call_on_hash_removal);
01114
if
(pending_replies ==
group__DBusMacros.html#ga4
NULL
)
01115
goto
error;
01116
01117   connection =
group__DBusMemory.html#ga7
dbus_new0
(
structDBusConnection.html
DBusConnection
, 1);
01118
if
(connection ==
group__DBusMacros.html#ga4
NULL
)
01119
goto
error;
01120
01121   mutex =
group__DBusThreadsInternals.html#ga0
_dbus_mutex_new
();
01122
if
(mutex ==
group__DBusMacros.html#ga4
NULL
)
01123
goto
error;
01124
01125   io_path_mutex =
group__DBusThreadsInternals.html#ga0
_dbus_mutex_new
();
01126
if
(io_path_mutex ==
group__DBusMacros.html#ga4
NULL
)
01127
goto
error;
01128
01129   dispatch_mutex =
group__DBusThreadsInternals.html#ga0
_dbus_mutex_new
();
01130
if
(dispatch_mutex ==
group__DBusMacros.html#ga4
NULL
)
01131
goto
error;
01132
01133   message_returned_cond =
group__DBusThreadsInternals.html#ga4
_dbus_condvar_new
();
01134
if
(message_returned_cond ==
group__DBusMacros.html#ga4
NULL
)
01135
goto
error;
01136
01137   dispatch_cond =
group__DBusThreadsInternals.html#ga4
_dbus_condvar_new
();
01138
if
(dispatch_cond ==
group__DBusMacros.html#ga4
NULL
)
01139
goto
error;
01140
01141   io_path_cond =
group__DBusThreadsInternals.html#ga4
_dbus_condvar_new
();
01142
if
(io_path_cond ==
group__DBusMacros.html#ga4
NULL
)
01143
goto
error;
01144
01145   disconnect_message =
group__DBusMessage.html#ga15
dbus_message_new_signal
(DBUS_PATH_LOCAL,
01146                                                 DBUS_INTERFACE_LOCAL,
01147
"Disconnected"
);
01148
01149
if
(disconnect_message ==
group__DBusMacros.html#ga4
NULL
)
01150
goto
error;
01151
01152   disconnect_link =
group__DBusList.html#ga0
_dbus_list_alloc_link
(disconnect_message);
01153
if
(disconnect_link ==
group__DBusMacros.html#ga4
NULL
)
01154
goto
error;
01155
01156   outgoing_counter =
group__DBusResources.html#ga0
_dbus_counter_new
();
01157
if
(outgoing_counter ==
group__DBusMacros.html#ga4
NULL
)
01158
goto
error;
01159
01160   objects =
group__DBusObjectTree.html#ga4
_dbus_object_tree_new
(connection);
01161
if
(objects ==
group__DBusMacros.html#ga4
NULL
)
01162
goto
error;
01163
01164
if
(_dbus_modify_sigpipe)
01165
group__DBusInternalsUtils.html#ga97
_dbus_disable_sigpipe
();
01166
01167   connection->
structDBusConnection.html#o0
refcount
.
structDBusAtomic.html#o0
value
= 1;
01168   connection->
structDBusConnection.html#o1
mutex
= mutex;
01169   connection->
structDBusConnection.html#o3
dispatch_cond
= dispatch_cond;
01170   connection->
structDBusConnection.html#o2
dispatch_mutex
= dispatch_mutex;
01171   connection->
structDBusConnection.html#o5
io_path_cond
= io_path_cond;
01172   connection->
structDBusConnection.html#o4
io_path_mutex
= io_path_mutex;
01173   connection->
structDBusConnection.html#o12
transport
= transport;
01174   connection->
structDBusConnection.html#o13
watches
= watch_list;
01175   connection->
structDBusConnection.html#o14
timeouts
= timeout_list;
01176   connection->
structDBusConnection.html#o17
pending_replies
= pending_replies;
01177   connection->
structDBusConnection.html#o11
outgoing_counter
= outgoing_counter;
01178   connection->
structDBusConnection.html#o15
filter_list
=
group__DBusMacros.html#ga4
NULL
;
01179   connection->
structDBusConnection.html#o26
last_dispatch_status
= DBUS_DISPATCH_COMPLETE;
/* so we're notified first time there's data */
01180   connection->
structDBusConnection.html#o28
objects
= objects;
01181   connection->
structDBusConnection.html#o33
exit_on_disconnect
=
group__DBusMacros.html#ga3
FALSE
;
01182   connection->
structDBusConnection.html#o30
shareable
=
group__DBusMacros.html#ga3
FALSE
;
01183
#ifndef DBUS_DISABLE_CHECKS
01184
connection->
structDBusConnection.html#o35
generation
=
group__DBusMemoryInternals.html#ga0
_dbus_current_generation
;
01185
#endif
01186
01187
group__DBusDataSlot.html#ga3
_dbus_data_slot_list_init
(&connection->
structDBusConnection.html#o16
slot_list
);
01188
01189   connection->
structDBusConnection.html#o18
client_serial
= 1;
01190
01191   connection->
structDBusConnection.html#o19
disconnect_message_link
= disconnect_link;
01192
01193   CONNECTION_LOCK (connection);
01194
01195
if
(!
group__DBusTransport.html#ga11
_dbus_transport_set_connection
(transport, connection))
01196
goto
error;
01197
01198
group__DBusTransport.html#ga4
_dbus_transport_ref
(transport);
01199
01200   CONNECTION_UNLOCK (connection);
01201
01202
return
connection;
01203
01204  error:
01205
if
(disconnect_message !=
group__DBusMacros.html#ga4
NULL
)
01206
group__DBusMessage.html#ga20
dbus_message_unref
(disconnect_message);
01207
01208
if
(disconnect_link !=
group__DBusMacros.html#ga4
NULL
)
01209
group__DBusList.html#ga1
_dbus_list_free_link
(disconnect_link);
01210
01211
if
(io_path_cond !=
group__DBusMacros.html#ga4
NULL
)
01212
group__DBusThreadsInternals.html#ga5
_dbus_condvar_free
(io_path_cond);
01213
01214
if
(dispatch_cond !=
group__DBusMacros.html#ga4
NULL
)
01215
group__DBusThreadsInternals.html#ga5
_dbus_condvar_free
(dispatch_cond);
01216
01217
if
(message_returned_cond !=
group__DBusMacros.html#ga4
NULL
)
01218
group__DBusThreadsInternals.html#ga5
_dbus_condvar_free
(message_returned_cond);
01219
01220
if
(mutex !=
group__DBusMacros.html#ga4
NULL
)
01221
group__DBusThreadsInternals.html#ga1
_dbus_mutex_free
(mutex);
01222
01223
if
(io_path_mutex !=
group__DBusMacros.html#ga4
NULL
)
01224
group__DBusThreadsInternals.html#ga1
_dbus_mutex_free
(io_path_mutex);
01225
01226
if
(dispatch_mutex !=
group__DBusMacros.html#ga4
NULL
)
01227
group__DBusThreadsInternals.html#ga1
_dbus_mutex_free
(dispatch_mutex);
01228
01229
if
(connection !=
group__DBusMacros.html#ga4
NULL
)
01230
group__DBusMemory.html#ga3
dbus_free
(connection);
01231
01232
if
(pending_replies)
01233
group__DBusHashTable.html#ga3
_dbus_hash_table_unref
(pending_replies);
01234
01235
if
(watch_list)
01236
group__DBusWatchInternals.html#ga6
_dbus_watch_list_free
(watch_list);
01237
01238
if
(timeout_list)
01239
group__DBusTimeoutInternals.html#ga6
_dbus_timeout_list_free
(timeout_list);
01240
01241
if
(outgoing_counter)
01242
group__DBusResources.html#ga2
_dbus_counter_unref
(outgoing_counter);
01243
01244
if
(objects)
01245
group__DBusObjectTree.html#ga6
_dbus_object_tree_unref
(objects);
01246
01247
return
group__DBusMacros.html#ga4
NULL
;
01248 }
01249
01257
structDBusConnection.html
DBusConnection
*
group__DBusConnectionInternals.html#ga43
01258
group__DBusConnectionInternals.html#ga43
_dbus_connection_ref_unlocked
(
structDBusConnection.html
DBusConnection
*connection)
01259 {
01260
group__DBusInternalsUtils.html#ga130
_dbus_assert
(connection !=
group__DBusMacros.html#ga4
NULL
);
01261
group__DBusInternalsUtils.html#ga130
_dbus_assert
(connection->
structDBusConnection.html#o35
generation
==
group__DBusMemoryInternals.html#ga0
_dbus_current_generation
);
01262
01263   HAVE_LOCK_CHECK (connection);
01264
01265
#ifdef DBUS_HAVE_ATOMIC_INT
01266
group__DBusInternalsUtils.html#ga80
_dbus_atomic_inc
(&connection->
structDBusConnection.html#o0
refcount
);
01267
#else
01268
group__DBusInternalsUtils.html#ga130
_dbus_assert
(connection->
structDBusConnection.html#o0
refcount
.
structDBusAtomic.html#o0
value
> 0);
01269   connection->
structDBusConnection.html#o0
refcount
.
structDBusAtomic.html#o0
value
+= 1;
01270
#endif
01271
01272
return
connection;
01273 }
01274
01281
void
group__DBusConnectionInternals.html#ga44
01282
group__DBusConnectionInternals.html#ga44
_dbus_connection_unref_unlocked
(
structDBusConnection.html
DBusConnection
*connection)
01283 {
01284
group__DBusTypes.html#ga2
dbus_bool_t
last_unref;
01285
01286   HAVE_LOCK_CHECK (connection);
01287
01288
group__DBusInternalsUtils.html#ga130
_dbus_assert
(connection !=
group__DBusMacros.html#ga4
NULL
);
01289
01290
/* The connection lock is better than the global
01291
* lock in the atomic increment fallback
01292
*/
01293
01294
#ifdef DBUS_HAVE_ATOMIC_INT
01295
last_unref = (
group__DBusInternalsUtils.html#ga81
_dbus_atomic_dec
(&connection->
structDBusConnection.html#o0
refcount
) == 1);
01296
#else
01297
group__DBusInternalsUtils.html#ga130
_dbus_assert
(connection->
structDBusConnection.html#o0
refcount
.
structDBusAtomic.html#o0
value
> 0);
01298
01299   connection->
structDBusConnection.html#o0
refcount
.
structDBusAtomic.html#o0
value
-= 1;
01300   last_unref = (connection->
structDBusConnection.html#o0
refcount
.
structDBusAtomic.html#o0
value
== 0);
01301
#if 0
01302
printf (
"unref_unlocked() connection %p count = %d\n"
, connection, connection->
structDBusConnection.html#o0
refcount
.
structDBusAtomic.html#o0
value
);
01303
#endif
01304
#endif
01305
01306
if
(last_unref)
01307     _dbus_connection_last_unref (connection);
01308 }
01309
01310
static
group__DBusTypes.html#ga3
dbus_uint32_t
01311 _dbus_connection_get_next_client_serial (
structDBusConnection.html
DBusConnection
*connection)
01312 {
01313
int
serial;
01314
01315   serial = connection->
structDBusConnection.html#o18
client_serial
++;
01316
01317
if
(connection->
structDBusConnection.html#o18
client_serial
< 0)
01318     connection->
structDBusConnection.html#o18
client_serial
= 1;
01319
01320
return
serial;
01321 }
01322
01336
group__DBusTypes.html#ga2
dbus_bool_t
group__DBusConnectionInternals.html#ga46
01337
group__DBusConnectionInternals.html#ga46
_dbus_connection_handle_watch
(
structDBusWatch.html
DBusWatch
*watch,
01338
unsigned
int
condition,
01339
void
*data)
01340 {
01341
structDBusConnection.html
DBusConnection
*connection;
01342
group__DBusTypes.html#ga2
dbus_bool_t
retval;
01343   DBusDispatchStatus status;
01344
01345   connection = data;
01346
01347   _dbus_verbose (
"%s start\n"
, _DBUS_FUNCTION_NAME);
01348
01349   CONNECTION_LOCK (connection);
01350   _dbus_connection_acquire_io_path (connection, -1);
01351   HAVE_LOCK_CHECK (connection);
01352   retval =
group__DBusTransport.html#ga10
_dbus_transport_handle_watch
(connection->
structDBusConnection.html#o12
transport
,
01353                                          watch, condition);
01354
01355   _dbus_connection_release_io_path (connection);
01356
01357   HAVE_LOCK_CHECK (connection);
01358
01359   _dbus_verbose (
"%s middle\n"
, _DBUS_FUNCTION_NAME);
01360
01361   status = _dbus_connection_get_dispatch_status_unlocked (connection);
01362
01363
/* this calls out to user code */
01364   _dbus_connection_update_dispatch_status_and_unlock (connection, status);
01365
01366   _dbus_verbose (
"%s end\n"
, _DBUS_FUNCTION_NAME);
01367
01368
return
retval;
01369 }
01370
01371
group__DBusInternalsUtils.html#ga146
_DBUS_DEFINE_GLOBAL_LOCK
(shared_connections);
01372
static
structDBusHashTable.html
DBusHashTable
*shared_connections =
group__DBusMacros.html#ga4
NULL
;
01373
01374
static
void
01375 shared_connections_shutdown (
void
*data)
01376 {
01377
group__DBusInternalsUtils.html#ga148
_DBUS_LOCK
(shared_connections);
01378
01379
group__DBusInternalsUtils.html#ga130
_dbus_assert
(
group__DBusHashTable.html#ga28
_dbus_hash_table_get_n_entries
(shared_connections) == 0);
01380
group__DBusHashTable.html#ga3
_dbus_hash_table_unref
(shared_connections);
01381   shared_connections =
group__DBusMacros.html#ga4
NULL
;
01382
01383
group__DBusInternalsUtils.html#ga149
_DBUS_UNLOCK
(shared_connections);
01384 }
01385
01386
static
group__DBusTypes.html#ga2
dbus_bool_t
01387 connection_lookup_shared (
structDBusAddressEntry.html
DBusAddressEntry
*entry,
01388
structDBusConnection.html
DBusConnection
**result)
01389 {
01390   _dbus_verbose (
"checking for existing connection\n"
);
01391
01392   *result =
group__DBusMacros.html#ga4
NULL
;
01393
01394
group__DBusInternalsUtils.html#ga148
_DBUS_LOCK
(shared_connections);
01395
01396
if
(shared_connections ==
group__DBusMacros.html#ga4
NULL
)
01397     {
01398       _dbus_verbose (
"creating shared_connections hash table\n"
);
01399
01400       shared_connections =
group__DBusHashTable.html#ga1
_dbus_hash_table_new
(DBUS_HASH_STRING,
01401
group__DBusMemory.html#ga3
dbus_free
,
01402
group__DBusMacros.html#ga4
NULL
);
01403
if
(shared_connections ==
group__DBusMacros.html#ga4
NULL
)
01404         {
01405
group__DBusInternalsUtils.html#ga149
_DBUS_UNLOCK
(shared_connections);
01406
return
group__DBusMacros.html#ga3
FALSE
;
01407         }
01408
01409
if
(!
group__DBusMemoryInternals.html#ga3
_dbus_register_shutdown_func
(shared_connections_shutdown,
group__DBusMacros.html#ga4
NULL
))
01410         {
01411
group__DBusHashTable.html#ga3
_dbus_hash_table_unref
(shared_connections);
01412           shared_connections =
group__DBusMacros.html#ga4
NULL
;
01413
group__DBusInternalsUtils.html#ga149
_DBUS_UNLOCK
(shared_connections);
01414
return
group__DBusMacros.html#ga3
FALSE
;
01415         }
01416
01417       _dbus_verbose (
"  successfully created shared_connections\n"
);
01418
01419
group__DBusInternalsUtils.html#ga149
_DBUS_UNLOCK
(shared_connections);
01420
return
group__DBusMacros.html#ga2
TRUE
;
/* no point looking up in the hash we just made */
01421     }
01422
else
01423     {
01424
const
char
*guid;
01425
01426       guid =
group__DBusAddress.html#ga3
dbus_address_entry_get_value
(entry,
"guid"
);
01427
01428
if
(guid !=
group__DBusMacros.html#ga4
NULL
)
01429         {
01430           *result =
group__DBusHashTable.html#ga16
_dbus_hash_table_lookup_string
(shared_connections,
01431                                                     guid);
01432
01433
if
(*result)
01434             {
01435
/* The DBusConnection can't have been disconnected
01436
* between the lookup and this code, because the
01437
* disconnection will take the shared_connections lock to
01438
* remove the connection. It can't have been finalized
01439
* since you have to disconnect prior to finalize.
01440
*
01441
* Thus it's safe to ref the connection.
01442
*/
01443
group__DBusConnection.html#ga3
dbus_connection_ref
(*result);
01444
01445               _dbus_verbose (
"looked up existing connection to server guid %s\n"
,
01446                              guid);
01447             }
01448         }
01449
01450
group__DBusInternalsUtils.html#ga149
_DBUS_UNLOCK
(shared_connections);
01451
return
group__DBusMacros.html#ga2
TRUE
;
01452     }
01453 }
01454
01455
static
group__DBusTypes.html#ga2
dbus_bool_t
01456 connection_record_shared_unlocked (
structDBusConnection.html
DBusConnection
*connection,
01457
const
char
*guid)
01458 {
01459
char
*guid_key;
01460
char
*guid_in_connection;
01461
01462
/* A separate copy of the key is required in the hash table, because
01463
* we don't have a lock on the connection when we are doing a hash
01464
* lookup.
01465
*/
01466
01467
group__DBusInternalsUtils.html#ga130
_dbus_assert
(connection->
structDBusConnection.html#o29
server_guid
==
group__DBusMacros.html#ga4
NULL
);
01468
group__DBusInternalsUtils.html#ga130
_dbus_assert
(connection->
structDBusConnection.html#o30
shareable
);
01469
01470   guid_key =
group__DBusInternalsUtils.html#ga8
_dbus_strdup
(guid);
01471
if
(guid_key ==
group__DBusMacros.html#ga4
NULL
)
01472
return
group__DBusMacros.html#ga3
FALSE
;
01473
01474   guid_in_connection =
group__DBusInternalsUtils.html#ga8
_dbus_strdup
(guid);
01475
if
(guid_in_connection ==
group__DBusMacros.html#ga4
NULL
)
01476     {
01477
group__DBusMemory.html#ga3
dbus_free
(guid_key);
01478
return
group__DBusMacros.html#ga3
FALSE
;
01479     }
01480
01481
group__DBusInternalsUtils.html#ga148
_DBUS_LOCK
(shared_connections);
01482
group__DBusInternalsUtils.html#ga130
_dbus_assert
(shared_connections !=
group__DBusMacros.html#ga4
NULL
);
01483
01484
if
(!
group__DBusHashTable.html#ga22
_dbus_hash_table_insert_string
(shared_connections,
01485                                        guid_key, connection))
01486     {
01487
group__DBusMemory.html#ga3
dbus_free
(guid_key);
01488
group__DBusMemory.html#ga3
dbus_free
(guid_in_connection);
01489
group__DBusInternalsUtils.html#ga149
_DBUS_UNLOCK
(shared_connections);
01490
return
group__DBusMacros.html#ga3
FALSE
;
01491     }
01492
01493   connection->
structDBusConnection.html#o29
server_guid
= guid_in_connection;
01494
01495   _dbus_verbose (
"stored connection to %s to be shared\n"
,
01496                  connection->
structDBusConnection.html#o29
server_guid
);
01497
01498
group__DBusInternalsUtils.html#ga149
_DBUS_UNLOCK
(shared_connections);
01499
01500
group__DBusInternalsUtils.html#ga130
_dbus_assert
(connection->
structDBusConnection.html#o29
server_guid
!=
group__DBusMacros.html#ga4
NULL
);
01501
01502
return
group__DBusMacros.html#ga2
TRUE
;
01503 }
01504
01505
static
void
01506 connection_forget_shared_unlocked (
structDBusConnection.html
DBusConnection
*connection)
01507 {
01508   HAVE_LOCK_CHECK (connection);
01509
01510
if
(connection->
structDBusConnection.html#o29
server_guid
==
group__DBusMacros.html#ga4
NULL
)
01511
return
;
01512
01513   _dbus_verbose (
"dropping connection to %s out of the shared table\n"
,
01514                  connection->
structDBusConnection.html#o29
server_guid
);
01515
01516
group__DBusInternalsUtils.html#ga148
_DBUS_LOCK
(shared_connections);
01517
01518
if
(!
group__DBusHashTable.html#ga19
_dbus_hash_table_remove_string
(shared_connections,
01519                                        connection->
structDBusConnection.html#o29
server_guid
))
01520
group__DBusInternalsUtils.html#ga131
_dbus_assert_not_reached
(
"connection was not in the shared table"
);
01521
01522
group__DBusMemory.html#ga3
dbus_free
(connection->
structDBusConnection.html#o29
server_guid
);
01523   connection->
structDBusConnection.html#o29
server_guid
=
group__DBusMacros.html#ga4
NULL
;
01524
01525
group__DBusInternalsUtils.html#ga149
_DBUS_UNLOCK
(shared_connections);
01526 }
01527
01528
static
structDBusConnection.html
DBusConnection
*
01529 connection_try_from_address_entry (
structDBusAddressEntry.html
DBusAddressEntry
*entry,
01530
structDBusError.html
DBusError
*error)
01531 {
01532
structDBusTransport.html
DBusTransport
*transport;
01533
structDBusConnection.html
DBusConnection
*connection;
01534
01535   transport =
group__DBusTransport.html#ga3
_dbus_transport_open
(entry, error);
01536
01537
if
(transport ==
group__DBusMacros.html#ga4
NULL
)
01538     {
01539       _DBUS_ASSERT_ERROR_IS_SET (error);
01540
return
group__DBusMacros.html#ga4
NULL
;
01541     }
01542
01543   connection =
group__DBusConnectionInternals.html#ga42
_dbus_connection_new_for_transport
(transport);
01544
01545
group__DBusTransport.html#ga5
_dbus_transport_unref
(transport);
01546
01547
if
(connection ==
group__DBusMacros.html#ga4
NULL
)
01548     {
01549       _DBUS_SET_OOM (error);
01550
return
group__DBusMacros.html#ga4
NULL
;
01551     }
01552
01553
#ifndef DBUS_DISABLE_CHECKS
01554
group__DBusInternalsUtils.html#ga130
_dbus_assert
(!connection->
structDBusConnection.html#o34
have_connection_lock
);
01555
#endif
01556
return
connection;
01557 }
01558
01559
/*
01560
* If the shared parameter is true, then any existing connection will
01561
* be used (and if a new connection is created, it will be available
01562
* for use by others). If the shared parameter is false, a new
01563
* connection will always be created, and the new connection will
01564
* never be returned to other callers.
01565
*
01566
* @param address the address
01567
* @param shared whether the connection is shared or private
01568
* @param error error return
01569
* @returns the connection or #NULL on error
01570
*/
01571
static
structDBusConnection.html
DBusConnection
*
01572 _dbus_connection_open_internal (
const
char
*address,
01573
group__DBusTypes.html#ga2
dbus_bool_t
shared,
01574
structDBusError.html
DBusError
*error)
01575 {
01576
structDBusConnection.html
DBusConnection
*connection;
01577
structDBusAddressEntry.html
DBusAddressEntry
**entries;
01578
structDBusError.html
DBusError
tmp_error;
01579
structDBusError.html
DBusError
first_error;
01580
int
len, i;
01581
01582   _DBUS_ASSERT_ERROR_IS_CLEAR (error);
01583
01584   _dbus_verbose (
"opening %s connection to: %s\n"
,
01585                  shared ?
"shared"
:
"private"
, address);
01586
01587
if
(!
group__DBusAddress.html#ga6
dbus_parse_address
(address, &entries, &len, error))
01588
return
group__DBusMacros.html#ga4
NULL
;
01589
01590   _DBUS_ASSERT_ERROR_IS_CLEAR (error);
01591
01592   connection =
group__DBusMacros.html#ga4
NULL
;
01593
01594
group__DBusErrors.html#ga0
dbus_error_init
(&tmp_error);
01595
group__DBusErrors.html#ga0
dbus_error_init
(&first_error);
01596
for
(i = 0; i < len; i++)
01597     {
01598
if
(shared)
01599         {
01600
if
(!connection_lookup_shared (entries[i], &connection))
01601             _DBUS_SET_OOM (&tmp_error);
01602         }
01603
01604
if
(connection ==
group__DBusMacros.html#ga4
NULL
)
01605         {
01606           connection = connection_try_from_address_entry (entries[i],
01607                                                           &tmp_error);
01608
01609
if
(connection !=
group__DBusMacros.html#ga4
NULL
&& shared)
01610             {
01611
const
char
*guid;
01612
01613               connection->
structDBusConnection.html#o30
shareable
=
group__DBusMacros.html#ga2
TRUE
;
01614
01615               guid =
group__DBusAddress.html#ga3
dbus_address_entry_get_value
(entries[i],
"guid"
);
01616
01617
/* we don't have a connection lock but we know nobody
01618
* else has a handle to the connection
01619
*/
01620
01621
if
(guid &&
01622                   !connection_record_shared_unlocked (connection, guid))
01623                 {
01624                   _DBUS_SET_OOM (&tmp_error);
01625
group__DBusConnection.html#ga6
dbus_connection_close
(connection);
01626
group__DBusConnection.html#ga5
dbus_connection_unref
(connection);
01627                   connection =
group__DBusMacros.html#ga4
NULL
;
01628                 }
01629
01630
/* but as of now the connection is possibly shared
01631
* since another thread could have pulled it from the table
01632
*/
01633             }
01634         }
01635
01636
if
(connection)
01637
break
;
01638
01639       _DBUS_ASSERT_ERROR_IS_SET (&tmp_error);
01640
01641
if
(i == 0)
01642
group__DBusErrors.html#ga3
dbus_move_error
(&tmp_error, &first_error);
01643
else
01644
group__DBusErrors.html#ga1
dbus_error_free
(&tmp_error);
01645     }
01646
01647
/* NOTE we don't have a lock on a possibly-shared connection object */
01648
01649   _DBUS_ASSERT_ERROR_IS_CLEAR (error);
01650   _DBUS_ASSERT_ERROR_IS_CLEAR (&tmp_error);
01651
01652
if
(connection ==
group__DBusMacros.html#ga4
NULL
)
01653     {
01654       _DBUS_ASSERT_ERROR_IS_SET (&first_error);
01655
group__DBusErrors.html#ga3
dbus_move_error
(&first_error, error);
01656     }
01657
else
01658     {
01659
group__DBusErrors.html#ga1
dbus_error_free
(&first_error);
01660     }
01661
01662
group__DBusAddress.html#ga0
dbus_address_entries_free
(entries);
01663
return
connection;
01664 }
01665
01693
structDBusConnection.html
DBusConnection
*
group__DBusConnection.html#ga1
01694
group__DBusConnection.html#ga1
dbus_connection_open
(
const
char
*address,
01695
structDBusError.html
DBusError
*error)
01696 {
01697
structDBusConnection.html
DBusConnection
*connection;
01698
01699   _dbus_return_val_if_fail (address !=
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga4
NULL
);
01700   _dbus_return_val_if_error_is_set (error,
group__DBusMacros.html#ga4
NULL
);
01701
01702   connection = _dbus_connection_open_internal (address,
01703
group__DBusMacros.html#ga2
TRUE
,
01704                                                error);
01705
01706
return
connection;
01707 }
01708
01723
structDBusConnection.html
DBusConnection
*
group__DBusConnection.html#ga2
01724
group__DBusConnection.html#ga2
dbus_connection_open_private
(
const
char
*address,
01725
structDBusError.html
DBusError
*error)
01726 {
01727
structDBusConnection.html
DBusConnection
*connection;
01728
01729   _dbus_return_val_if_fail (address !=
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga4
NULL
);
01730   _dbus_return_val_if_error_is_set (error,
group__DBusMacros.html#ga4
NULL
);
01731
01732   connection = _dbus_connection_open_internal (address,
01733
group__DBusMacros.html#ga3
FALSE
,
01734                                                error);
01735
01736
return
connection;
01737 }
01738
01745
structDBusConnection.html
DBusConnection
*
group__DBusConnection.html#ga3
01746
group__DBusConnection.html#ga3
dbus_connection_ref
(
structDBusConnection.html
DBusConnection
*connection)
01747 {
01748   _dbus_return_val_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga4
NULL
);
01749   _dbus_return_val_if_fail (connection->
structDBusConnection.html#o35
generation
==
group__DBusMemoryInternals.html#ga0
_dbus_current_generation
,
group__DBusMacros.html#ga4
NULL
);
01750
01751
/* The connection lock is better than the global
01752
* lock in the atomic increment fallback
01753
*/
01754
01755
#ifdef DBUS_HAVE_ATOMIC_INT
01756
group__DBusInternalsUtils.html#ga80
_dbus_atomic_inc
(&connection->
structDBusConnection.html#o0
refcount
);
01757
#else
01758
CONNECTION_LOCK (connection);
01759
group__DBusInternalsUtils.html#ga130
_dbus_assert
(connection->
structDBusConnection.html#o0
refcount
.
structDBusAtomic.html#o0
value
> 0);
01760
01761   connection->
structDBusConnection.html#o0
refcount
.
structDBusAtomic.html#o0
value
+= 1;
01762   CONNECTION_UNLOCK (connection);
01763
#endif
01764
01765
return
connection;
01766 }
01767
01768
static
void
01769 free_outgoing_message (
void
*element,
01770
void
*data)
01771 {
01772
structDBusMessage.html
DBusMessage
*message = element;
01773
structDBusConnection.html
DBusConnection
*connection = data;
01774
01775
group__DBusMessageInternals.html#ga10
_dbus_message_remove_size_counter
(message,
01776                                      connection->
structDBusConnection.html#o11
outgoing_counter
,
01777
group__DBusMacros.html#ga4
NULL
);
01778
group__DBusMessage.html#ga20
dbus_message_unref
(message);
01779 }
01780
01781
/* This is run without the mutex held, but after the last reference
01782
* to the connection has been dropped we should have no thread-related
01783
* problems
01784
*/
01785
static
void
01786 _dbus_connection_last_unref (
structDBusConnection.html
DBusConnection
*connection)
01787 {
01788
structDBusList.html
DBusList
*link;
01789
01790   _dbus_verbose (
"Finalizing connection %p\n"
, connection);
01791
01792
group__DBusInternalsUtils.html#ga130
_dbus_assert
(connection->
structDBusConnection.html#o0
refcount
.
structDBusAtomic.html#o0
value
== 0);
01793
01794
/* You have to disconnect the connection before unref:ing it. Otherwise
01795
* you won't get the disconnected message.
01796
*/
01797
group__DBusInternalsUtils.html#ga130
_dbus_assert
(!
group__DBusTransport.html#ga7
_dbus_transport_get_is_connected
(connection->
structDBusConnection.html#o12
transport
));
01798
group__DBusInternalsUtils.html#ga130
_dbus_assert
(connection->
structDBusConnection.html#o29
server_guid
==
group__DBusMacros.html#ga4
NULL
);
01799
01800
/* ---- We're going to call various application callbacks here, hope it doesn't break anything... */
01801
group__DBusObjectTree.html#ga18
_dbus_object_tree_free_all_unlocked
(connection->
structDBusConnection.html#o28
objects
);
01802
01803
group__DBusConnection.html#ga44
dbus_connection_set_dispatch_status_function
(connection,
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga4
NULL
);
01804
group__DBusConnection.html#ga43
dbus_connection_set_wakeup_main_function
(connection,
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga4
NULL
);
01805
group__DBusConnection.html#ga48
dbus_connection_set_unix_user_function
(connection,
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga4
NULL
);
01806
01807
group__DBusWatchInternals.html#ga6
_dbus_watch_list_free
(connection->
structDBusConnection.html#o13
watches
);
01808   connection->
structDBusConnection.html#o13
watches
=
group__DBusMacros.html#ga4
NULL
;
01809
01810
group__DBusTimeoutInternals.html#ga6
_dbus_timeout_list_free
(connection->
structDBusConnection.html#o14
timeouts
);
01811   connection->
structDBusConnection.html#o14
timeouts
=
group__DBusMacros.html#ga4
NULL
;
01812
01813
group__DBusDataSlot.html#ga7
_dbus_data_slot_list_free
(&connection->
structDBusConnection.html#o16
slot_list
);
01814
01815   link =
group__DBusList.html#ga13
_dbus_list_get_first_link
(&connection->
structDBusConnection.html#o15
filter_list
);
01816
while
(link !=
group__DBusMacros.html#ga4
NULL
)
01817     {
01818       DBusMessageFilter *filter = link->
structDBusList.html#o2
data
;
01819
structDBusList.html
DBusList
*next =
group__DBusList.html#ga24
_dbus_list_get_next_link
(&connection->
structDBusConnection.html#o15
filter_list
, link);
01820
01821       filter->
structDBusMessageFilter.html#o1
function
=
group__DBusMacros.html#ga4
NULL
;
01822       _dbus_message_filter_unref (filter);
/* calls app callback */
01823       link->
structDBusList.html#o2
data
=
group__DBusMacros.html#ga4
NULL
;
01824
01825       link = next;
01826     }
01827
group__DBusList.html#ga12
_dbus_list_clear
(&connection->
structDBusConnection.html#o15
filter_list
);
01828
01829
/* ---- Done with stuff that invokes application callbacks */
01830
01831
group__DBusObjectTree.html#ga6
_dbus_object_tree_unref
(connection->
structDBusConnection.html#o28
objects
);
01832
01833
group__DBusHashTable.html#ga3
_dbus_hash_table_unref
(connection->
structDBusConnection.html#o17
pending_replies
);
01834   connection->
structDBusConnection.html#o17
pending_replies
=
group__DBusMacros.html#ga4
NULL
;
01835
01836
group__DBusList.html#ga12
_dbus_list_clear
(&connection->
structDBusConnection.html#o15
filter_list
);
01837
01838
group__DBusList.html#ga22
_dbus_list_foreach
(&connection->
structDBusConnection.html#o6
outgoing_messages
,
01839                       free_outgoing_message,
01840                       connection);
01841
group__DBusList.html#ga12
_dbus_list_clear
(&connection->
structDBusConnection.html#o6
outgoing_messages
);
01842
01843
group__DBusList.html#ga22
_dbus_list_foreach
(&connection->
structDBusConnection.html#o7
incoming_messages
,
01844                       (
group__DBusInternalsUtils.html#ga161
DBusForeachFunction
)
group__DBusMessage.html#ga20
dbus_message_unref
,
01845
group__DBusMacros.html#ga4
NULL
);
01846
group__DBusList.html#ga12
_dbus_list_clear
(&connection->
structDBusConnection.html#o7
incoming_messages
);
01847
01848
group__DBusResources.html#ga2
_dbus_counter_unref
(connection->
structDBusConnection.html#o11
outgoing_counter
);
01849
01850
group__DBusTransport.html#ga5
_dbus_transport_unref
(connection->
structDBusConnection.html#o12
transport
);
01851
01852
if
(connection->
structDBusConnection.html#o19
disconnect_message_link
)
01853     {
01854
structDBusMessage.html
DBusMessage
*message = connection->
structDBusConnection.html#o19
disconnect_message_link
->
structDBusList.html#o2
data
;
01855
group__DBusMessage.html#ga20
dbus_message_unref
(message);
01856
group__DBusList.html#ga1
_dbus_list_free_link
(connection->
structDBusConnection.html#o19
disconnect_message_link
);
01857     }
01858
01859
group__DBusList.html#ga12
_dbus_list_clear
(&connection->
structDBusConnection.html#o27
link_cache
);
01860
01861
group__DBusThreadsInternals.html#ga5
_dbus_condvar_free
(connection->
structDBusConnection.html#o3
dispatch_cond
);
01862
group__DBusThreadsInternals.html#ga5
_dbus_condvar_free
(connection->
structDBusConnection.html#o5
io_path_cond
);
01863
01864
group__DBusThreadsInternals.html#ga1
_dbus_mutex_free
(connection->
structDBusConnection.html#o4
io_path_mutex
);
01865
group__DBusThreadsInternals.html#ga1
_dbus_mutex_free
(connection->
structDBusConnection.html#o2
dispatch_mutex
);
01866
01867
group__DBusThreadsInternals.html#ga1
_dbus_mutex_free
(connection->
structDBusConnection.html#o1
mutex
);
01868
01869
group__DBusMemory.html#ga3
dbus_free
(connection);
01870 }
01871
01883
void
group__DBusConnection.html#ga5
01884
group__DBusConnection.html#ga5
dbus_connection_unref
(
structDBusConnection.html
DBusConnection
*connection)
01885 {
01886
group__DBusTypes.html#ga2
dbus_bool_t
last_unref;
01887
01888   _dbus_return_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
);
01889   _dbus_return_if_fail (connection->
structDBusConnection.html#o35
generation
==
group__DBusMemoryInternals.html#ga0
_dbus_current_generation
);
01890
01891
/* The connection lock is better than the global
01892
* lock in the atomic increment fallback
01893
*/
01894
01895
#ifdef DBUS_HAVE_ATOMIC_INT
01896
last_unref = (
group__DBusInternalsUtils.html#ga81
_dbus_atomic_dec
(&connection->
structDBusConnection.html#o0
refcount
) == 1);
01897
#else
01898
CONNECTION_LOCK (connection);
01899
01900
group__DBusInternalsUtils.html#ga130
_dbus_assert
(connection->
structDBusConnection.html#o0
refcount
.
structDBusAtomic.html#o0
value
> 0);
01901
01902   connection->
structDBusConnection.html#o0
refcount
.
structDBusAtomic.html#o0
value
-= 1;
01903   last_unref = (connection->
structDBusConnection.html#o0
refcount
.
structDBusAtomic.html#o0
value
== 0);
01904
01905
#if 0
01906
printf (
"unref() connection %p count = %d\n"
, connection, connection->
structDBusConnection.html#o0
refcount
.
structDBusAtomic.html#o0
value
);
01907
#endif
01908
01909   CONNECTION_UNLOCK (connection);
01910
#endif
01911
01912
if
(last_unref)
01913     _dbus_connection_last_unref (connection);
01914 }
01915
01929
void
group__DBusConnection.html#ga6
01930
group__DBusConnection.html#ga6
dbus_connection_close
(
structDBusConnection.html
DBusConnection
*connection)
01931 {
01932   DBusDispatchStatus status;
01933
01934   _dbus_return_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
);
01935   _dbus_return_if_fail (connection->
structDBusConnection.html#o35
generation
==
group__DBusMemoryInternals.html#ga0
_dbus_current_generation
);
01936
01937   _dbus_verbose (
"Disconnecting %p\n"
, connection);
01938
01939   CONNECTION_LOCK (connection);
01940
01941
group__DBusTransport.html#ga6
_dbus_transport_disconnect
(connection->
structDBusConnection.html#o12
transport
);
01942
01943   _dbus_verbose (
"%s middle\n"
, _DBUS_FUNCTION_NAME);
01944   status = _dbus_connection_get_dispatch_status_unlocked (connection);
01945
01946
/* this calls out to user code */
01947   _dbus_connection_update_dispatch_status_and_unlock (connection, status);
01948 }
01949
01956
void
group__DBusConnection.html#ga7
01957
group__DBusConnection.html#ga7
dbus_connection_disconnect
(
structDBusConnection.html
DBusConnection
*connection)
01958 {
01959
group__DBusConnection.html#ga6
dbus_connection_close
(connection);
01960 }
01961
01962
static
group__DBusTypes.html#ga2
dbus_bool_t
01963 _dbus_connection_get_is_connected_unlocked (
structDBusConnection.html
DBusConnection
*connection)
01964 {
01965   HAVE_LOCK_CHECK (connection);
01966
return
group__DBusTransport.html#ga7
_dbus_transport_get_is_connected
(connection->
structDBusConnection.html#o12
transport
);
01967 }
01968
01979
group__DBusTypes.html#ga2
dbus_bool_t
group__DBusConnection.html#ga9
01980
group__DBusConnection.html#ga9
dbus_connection_get_is_connected
(
structDBusConnection.html
DBusConnection
*connection)
01981 {
01982
group__DBusTypes.html#ga2
dbus_bool_t
res;
01983
01984   _dbus_return_val_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga3
FALSE
);
01985
01986   CONNECTION_LOCK (connection);
01987   res = _dbus_connection_get_is_connected_unlocked (connection);
01988   CONNECTION_UNLOCK (connection);
01989
01990
return
res;
01991 }
01992
02001
group__DBusTypes.html#ga2
dbus_bool_t
group__DBusConnection.html#ga10
02002
group__DBusConnection.html#ga10
dbus_connection_get_is_authenticated
(
structDBusConnection.html
DBusConnection
*connection)
02003 {
02004
group__DBusTypes.html#ga2
dbus_bool_t
res;
02005
02006   _dbus_return_val_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga3
FALSE
);
02007
02008   CONNECTION_LOCK (connection);
02009   res =
group__DBusTransport.html#ga8
_dbus_transport_get_is_authenticated
(connection->
structDBusConnection.html#o12
transport
);
02010   CONNECTION_UNLOCK (connection);
02011
02012
return
res;
02013 }
02014
02028
void
group__DBusConnection.html#ga11
02029
group__DBusConnection.html#ga11
dbus_connection_set_exit_on_disconnect
(
structDBusConnection.html
DBusConnection
*connection,
02030
group__DBusTypes.html#ga2
dbus_bool_t
exit_on_disconnect)
02031 {
02032   _dbus_return_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
);
02033
02034   CONNECTION_LOCK (connection);
02035   connection->
structDBusConnection.html#o33
exit_on_disconnect
= exit_on_disconnect !=
group__DBusMacros.html#ga3
FALSE
;
02036   CONNECTION_UNLOCK (connection);
02037 }
02038
02039
static
structDBusPreallocatedSend.html
DBusPreallocatedSend
*
02040 _dbus_connection_preallocate_send_unlocked (
structDBusConnection.html
DBusConnection
*connection)
02041 {
02042
structDBusPreallocatedSend.html
DBusPreallocatedSend
*preallocated;
02043
02044   HAVE_LOCK_CHECK (connection);
02045
02046
group__DBusInternalsUtils.html#ga130
_dbus_assert
(connection !=
group__DBusMacros.html#ga4
NULL
);
02047
02048   preallocated =
group__DBusMemory.html#ga6
dbus_new
(
structDBusPreallocatedSend.html
DBusPreallocatedSend
, 1);
02049
if
(preallocated ==
group__DBusMacros.html#ga4
NULL
)
02050
return
group__DBusMacros.html#ga4
NULL
;
02051
02052
if
(connection->
structDBusConnection.html#o27
link_cache
!=
group__DBusMacros.html#ga4
NULL
)
02053     {
02054       preallocated->
structDBusPreallocatedSend.html#o1
queue_link
=
02055
group__DBusList.html#ga17
_dbus_list_pop_first_link
(&connection->
structDBusConnection.html#o27
link_cache
);
02056       preallocated->
structDBusPreallocatedSend.html#o1
queue_link
->
structDBusList.html#o2
data
=
group__DBusMacros.html#ga4
NULL
;
02057     }
02058
else
02059     {
02060       preallocated->
structDBusPreallocatedSend.html#o1
queue_link
=
group__DBusList.html#ga0
_dbus_list_alloc_link
(
group__DBusMacros.html#ga4
NULL
);
02061
if
(preallocated->
structDBusPreallocatedSend.html#o1
queue_link
==
group__DBusMacros.html#ga4
NULL
)
02062
goto
failed_0;
02063     }
02064
02065
if
(connection->
structDBusConnection.html#o27
link_cache
!=
group__DBusMacros.html#ga4
NULL
)
02066     {
02067       preallocated->
structDBusPreallocatedSend.html#o2
counter_link
=
02068
group__DBusList.html#ga17
_dbus_list_pop_first_link
(&connection->
structDBusConnection.html#o27
link_cache
);
02069       preallocated->
structDBusPreallocatedSend.html#o2
counter_link
->
structDBusList.html#o2
data
= connection->
structDBusConnection.html#o11
outgoing_counter
;
02070     }
02071
else
02072     {
02073       preallocated->
structDBusPreallocatedSend.html#o2
counter_link
=
group__DBusList.html#ga0
_dbus_list_alloc_link
(connection->
structDBusConnection.html#o11
outgoing_counter
);
02074
if
(preallocated->
structDBusPreallocatedSend.html#o2
counter_link
==
group__DBusMacros.html#ga4
NULL
)
02075
goto
failed_1;
02076     }
02077
02078
group__DBusResources.html#ga1
_dbus_counter_ref
(preallocated->
structDBusPreallocatedSend.html#o2
counter_link
->
structDBusList.html#o2
data
);
02079
02080   preallocated->
structDBusPreallocatedSend.html#o0
connection
= connection;
02081
02082
return
preallocated;
02083
02084  failed_1:
02085
group__DBusList.html#ga1
_dbus_list_free_link
(preallocated->
structDBusPreallocatedSend.html#o1
queue_link
);
02086  failed_0:
02087
group__DBusMemory.html#ga3
dbus_free
(preallocated);
02088
02089
return
group__DBusMacros.html#ga4
NULL
;
02090 }
02091
02101
structDBusPreallocatedSend.html
DBusPreallocatedSend
*
group__DBusConnection.html#ga13
02102
group__DBusConnection.html#ga13
dbus_connection_preallocate_send
(
structDBusConnection.html
DBusConnection
*connection)
02103 {
02104
structDBusPreallocatedSend.html
DBusPreallocatedSend
*preallocated;
02105
02106   _dbus_return_val_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga4
NULL
);
02107
02108   CONNECTION_LOCK (connection);
02109
02110   preallocated =
02111     _dbus_connection_preallocate_send_unlocked (connection);
02112
02113   CONNECTION_UNLOCK (connection);
02114
02115
return
preallocated;
02116 }
02117
02127
void
group__DBusConnection.html#ga14
02128
group__DBusConnection.html#ga14
dbus_connection_free_preallocated_send
(
structDBusConnection.html
DBusConnection
*connection,
02129
structDBusPreallocatedSend.html
DBusPreallocatedSend
*preallocated)
02130 {
02131   _dbus_return_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
);
02132   _dbus_return_if_fail (preallocated !=
group__DBusMacros.html#ga4
NULL
);
02133   _dbus_return_if_fail (connection == preallocated->
structDBusPreallocatedSend.html#o0
connection
);
02134
02135
group__DBusList.html#ga1
_dbus_list_free_link
(preallocated->
structDBusPreallocatedSend.html#o1
queue_link
);
02136
group__DBusResources.html#ga2
_dbus_counter_unref
(preallocated->
structDBusPreallocatedSend.html#o2
counter_link
->
structDBusList.html#o2
data
);
02137
group__DBusList.html#ga1
_dbus_list_free_link
(preallocated->
structDBusPreallocatedSend.html#o2
counter_link
);
02138
group__DBusMemory.html#ga3
dbus_free
(preallocated);
02139 }
02140
02141
/* Called with lock held, does not update dispatch status */
02142
static
void
02143 _dbus_connection_send_preallocated_unlocked_no_update (
structDBusConnection.html
DBusConnection
*connection,
02144
structDBusPreallocatedSend.html
DBusPreallocatedSend
*preallocated,
02145
structDBusMessage.html
DBusMessage
*message,
02146
group__DBusTypes.html#ga3
dbus_uint32_t
*client_serial)
02147 {
02148
group__DBusTypes.html#ga3
dbus_uint32_t
serial;
02149
const
char
*sig;
02150
02151   preallocated->
structDBusPreallocatedSend.html#o1
queue_link
->
structDBusList.html#o2
data
= message;
02152
group__DBusList.html#ga5
_dbus_list_prepend_link
(&connection->
structDBusConnection.html#o6
outgoing_messages
,
02153                            preallocated->
structDBusPreallocatedSend.html#o1
queue_link
);
02154
02155
group__DBusMessageInternals.html#ga8
_dbus_message_add_size_counter_link
(message,
02156                                        preallocated->
structDBusPreallocatedSend.html#o2
counter_link
);
02157
02158
group__DBusMemory.html#ga3
dbus_free
(preallocated);
02159   preallocated =
group__DBusMacros.html#ga4
NULL
;
02160
02161
group__DBusMessage.html#ga19
dbus_message_ref
(message);
02162
02163   connection->
structDBusConnection.html#o9
n_outgoing
+= 1;
02164
02165   sig =
group__DBusMessage.html#ga67
dbus_message_get_signature
(message);
02166
02167   _dbus_verbose (
"Message %p (%d %s %s %s '%s') for %s added to outgoing queue %p, %d pending to send\n"
,
02168                  message,
02169
group__DBusMessage.html#ga21
dbus_message_get_type
(message),
02170
group__DBusMessage.html#ga52
dbus_message_get_path
(message),
02171
group__DBusMessage.html#ga56
dbus_message_get_interface
(message) ?
02172
group__DBusMessage.html#ga56
dbus_message_get_interface
(message) :
02173
"no interface"
,
02174
group__DBusMessage.html#ga59
dbus_message_get_member
(message) ?
02175
group__DBusMessage.html#ga59
dbus_message_get_member
(message) :
02176
"no member"
,
02177                  sig,
02178
group__DBusMessage.html#ga64
dbus_message_get_destination
(message) ?
02179
group__DBusMessage.html#ga64
dbus_message_get_destination
(message) :
02180
"null"
,
02181                  connection,
02182                  connection->
structDBusConnection.html#o9
n_outgoing
);
02183
02184
if
(
group__DBusMessage.html#ga3
dbus_message_get_serial
(message) == 0)
02185     {
02186       serial = _dbus_connection_get_next_client_serial (connection);
02187
group__DBusMessageInternals.html#ga7
_dbus_message_set_serial
(message, serial);
02188
if
(client_serial)
02189         *client_serial = serial;
02190     }
02191
else
02192     {
02193
if
(client_serial)
02194         *client_serial =
group__DBusMessage.html#ga3
dbus_message_get_serial
(message);
02195     }
02196
02197   _dbus_verbose (
"Message %p serial is %u\n"
,
02198                  message,
group__DBusMessage.html#ga3
dbus_message_get_serial
(message));
02199
02200
group__DBusMessageInternals.html#ga11
_dbus_message_lock
(message);
02201
02202
/* Now we need to run an iteration to hopefully just write the messages
02203
* out immediately, and otherwise get them queued up
02204
*/
02205
group__DBusConnectionInternals.html#ga41
_dbus_connection_do_iteration_unlocked
(connection,
02206                                           DBUS_ITERATION_DO_WRITING,
02207                                           -1);
02208
02209
/* If stuff is still queued up, be sure we wake up the main loop */
02210
if
(connection->
structDBusConnection.html#o9
n_outgoing
> 0)
02211     _dbus_connection_wakeup_mainloop (connection);
02212 }
02213
02214
static
void
02215 _dbus_connection_send_preallocated_and_unlock (
structDBusConnection.html
DBusConnection
*connection,
02216
structDBusPreallocatedSend.html
DBusPreallocatedSend
*preallocated,
02217
structDBusMessage.html
DBusMessage
*message,
02218
group__DBusTypes.html#ga3
dbus_uint32_t
*client_serial)
02219 {
02220   DBusDispatchStatus status;
02221
02222   HAVE_LOCK_CHECK (connection);
02223
02224   _dbus_connection_send_preallocated_unlocked_no_update (connection,
02225                                                          preallocated,
02226                                                          message, client_serial);
02227
02228   _dbus_verbose (
"%s middle\n"
, _DBUS_FUNCTION_NAME);
02229   status = _dbus_connection_get_dispatch_status_unlocked (connection);
02230
02231
/* this calls out to user code */
02232   _dbus_connection_update_dispatch_status_and_unlock (connection, status);
02233 }
02234
02247
void
group__DBusConnection.html#ga17
02248
group__DBusConnection.html#ga17
dbus_connection_send_preallocated
(
structDBusConnection.html
DBusConnection
*connection,
02249
structDBusPreallocatedSend.html
DBusPreallocatedSend
*preallocated,
02250
structDBusMessage.html
DBusMessage
*message,
02251
group__DBusTypes.html#ga3
dbus_uint32_t
*client_serial)
02252 {
02253   _dbus_return_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
);
02254   _dbus_return_if_fail (preallocated !=
group__DBusMacros.html#ga4
NULL
);
02255   _dbus_return_if_fail (message !=
group__DBusMacros.html#ga4
NULL
);
02256   _dbus_return_if_fail (preallocated->
structDBusPreallocatedSend.html#o0
connection
== connection);
02257   _dbus_return_if_fail (
group__DBusMessage.html#ga21
dbus_message_get_type
(message) != DBUS_MESSAGE_TYPE_METHOD_CALL ||
02258                         (
group__DBusMessage.html#ga56
dbus_message_get_interface
(message) !=
group__DBusMacros.html#ga4
NULL
&&
02259
group__DBusMessage.html#ga59
dbus_message_get_member
(message) !=
group__DBusMacros.html#ga4
NULL
));
02260   _dbus_return_if_fail (
group__DBusMessage.html#ga21
dbus_message_get_type
(message) != DBUS_MESSAGE_TYPE_SIGNAL ||
02261                         (
group__DBusMessage.html#ga56
dbus_message_get_interface
(message) !=
group__DBusMacros.html#ga4
NULL
&&
02262
group__DBusMessage.html#ga59
dbus_message_get_member
(message) !=
group__DBusMacros.html#ga4
NULL
));
02263
02264   CONNECTION_LOCK (connection);
02265   _dbus_connection_send_preallocated_and_unlock (connection,
02266                                                  preallocated,
02267                                                  message, client_serial);
02268 }
02269
02270
static
group__DBusTypes.html#ga2
dbus_bool_t
02271 _dbus_connection_send_unlocked_no_update (
structDBusConnection.html
DBusConnection
*connection,
02272
structDBusMessage.html
DBusMessage
*message,
02273
group__DBusTypes.html#ga3
dbus_uint32_t
*client_serial)
02274 {
02275
structDBusPreallocatedSend.html
DBusPreallocatedSend
*preallocated;
02276
02277
group__DBusInternalsUtils.html#ga130
_dbus_assert
(connection !=
group__DBusMacros.html#ga4
NULL
);
02278
group__DBusInternalsUtils.html#ga130
_dbus_assert
(message !=
group__DBusMacros.html#ga4
NULL
);
02279
02280   preallocated = _dbus_connection_preallocate_send_unlocked (connection);
02281
if
(preallocated ==
group__DBusMacros.html#ga4
NULL
)
02282
return
group__DBusMacros.html#ga3
FALSE
;
02283
02284   _dbus_connection_send_preallocated_unlocked_no_update (connection,
02285                                                          preallocated,
02286                                                          message,
02287                                                          client_serial);
02288
return
group__DBusMacros.html#ga2
TRUE
;
02289 }
02290
02291
group__DBusTypes.html#ga2
dbus_bool_t
group__DBusConnection.html#ga19
02292
group__DBusConnection.html#ga19
_dbus_connection_send_and_unlock
(
structDBusConnection.html
DBusConnection
*connection,
02293
structDBusMessage.html
DBusMessage
*message,
02294
group__DBusTypes.html#ga3
dbus_uint32_t
*client_serial)
02295 {
02296
structDBusPreallocatedSend.html
DBusPreallocatedSend
*preallocated;
02297
02298
group__DBusInternalsUtils.html#ga130
_dbus_assert
(connection !=
group__DBusMacros.html#ga4
NULL
);
02299
group__DBusInternalsUtils.html#ga130
_dbus_assert
(message !=
group__DBusMacros.html#ga4
NULL
);
02300
02301   preallocated = _dbus_connection_preallocate_send_unlocked (connection);
02302
if
(preallocated ==
group__DBusMacros.html#ga4
NULL
)
02303     {
02304       CONNECTION_UNLOCK (connection);
02305
return
group__DBusMacros.html#ga3
FALSE
;
02306     }
02307
02308   _dbus_connection_send_preallocated_and_unlock (connection,
02309                                                  preallocated,
02310                                                  message,
02311                                                  client_serial);
02312
return
group__DBusMacros.html#ga2
TRUE
;
02313 }
02314
02333
group__DBusTypes.html#ga2
dbus_bool_t
group__DBusConnection.html#ga20
02334
group__DBusConnection.html#ga20
dbus_connection_send
(
structDBusConnection.html
DBusConnection
*connection,
02335
structDBusMessage.html
DBusMessage
*message,
02336
group__DBusTypes.html#ga3
dbus_uint32_t
*client_serial)
02337 {
02338   _dbus_return_val_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga3
FALSE
);
02339   _dbus_return_val_if_fail (message !=
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga3
FALSE
);
02340
02341   CONNECTION_LOCK (connection);
02342
02343
return
group__DBusConnection.html#ga19
_dbus_connection_send_and_unlock
(connection,
02344                                            message,
02345                                            client_serial);
02346 }
02347
02348
static
group__DBusTypes.html#ga2
dbus_bool_t
02349 reply_handler_timeout (
void
*data)
02350 {
02351
structDBusConnection.html
DBusConnection
*connection;
02352   DBusDispatchStatus status;
02353
structDBusPendingCall.html
DBusPendingCall
*pending = data;
02354
02355   connection = pending->
structDBusPendingCall.html#o3
connection
;
02356
02357   CONNECTION_LOCK (connection);
02358
if
(pending->
structDBusPendingCall.html#o6
timeout_link
)
02359     {
02360       _dbus_connection_queue_synthesized_message_link (connection,
02361                                                        pending->
structDBusPendingCall.html#o6
timeout_link
);
02362       pending->
structDBusPendingCall.html#o6
timeout_link
=
group__DBusMacros.html#ga4
NULL
;
02363     }
02364
02365
group__DBusConnectionInternals.html#ga31
_dbus_connection_remove_timeout
(connection,
02366                                    pending->
structDBusPendingCall.html#o5
timeout
);
02367   pending->
structDBusPendingCall.html#o9
timeout_added
=
group__DBusMacros.html#ga3
FALSE
;
02368
02369   _dbus_verbose (
"%s middle\n"
, _DBUS_FUNCTION_NAME);
02370   status = _dbus_connection_get_dispatch_status_unlocked (connection);
02371
02372
/* Unlocks, and calls out to user code */
02373   _dbus_connection_update_dispatch_status_and_unlock (connection, status);
02374
02375
return
group__DBusMacros.html#ga2
TRUE
;
02376 }
02377
02415
group__DBusTypes.html#ga2
dbus_bool_t
group__DBusConnection.html#ga22
02416
group__DBusConnection.html#ga22
dbus_connection_send_with_reply
(
structDBusConnection.html
DBusConnection
*connection,
02417
structDBusMessage.html
DBusMessage
*message,
02418
structDBusPendingCall.html
DBusPendingCall
**pending_return,
02419
int
timeout_milliseconds)
02420 {
02421
structDBusPendingCall.html
DBusPendingCall
*pending;
02422
structDBusMessage.html
DBusMessage
*reply;
02423
structDBusList.html
DBusList
*reply_link;
02424
group__DBusTypes.html#ga4
dbus_int32_t
serial = -1;
02425   DBusDispatchStatus status;
02426
02427   _dbus_return_val_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga3
FALSE
);
02428   _dbus_return_val_if_fail (message !=
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga3
FALSE
);
02429   _dbus_return_val_if_fail (timeout_milliseconds >= 0 || timeout_milliseconds == -1,
group__DBusMacros.html#ga3
FALSE
);
02430
02431
if
(pending_return)
02432     *pending_return =
group__DBusMacros.html#ga4
NULL
;
02433
02434   pending =
group__DBusPendingCallInternals.html#ga1
_dbus_pending_call_new
(connection,
02435                                     timeout_milliseconds,
02436                                     reply_handler_timeout);
02437
02438
if
(pending ==
group__DBusMacros.html#ga4
NULL
)
02439
return
group__DBusMacros.html#ga3
FALSE
;
02440
02441   CONNECTION_LOCK (connection);
02442
02443
/* Assign a serial to the message */
02444
if
(
group__DBusMessage.html#ga3
dbus_message_get_serial
(message) == 0)
02445     {
02446       serial = _dbus_connection_get_next_client_serial (connection);
02447
group__DBusMessageInternals.html#ga7
_dbus_message_set_serial
(message, serial);
02448     }
02449
02450   pending->
structDBusPendingCall.html#o7
reply_serial
= serial;
02451
02452   reply =
group__DBusMessage.html#ga16
dbus_message_new_error
(message, DBUS_ERROR_NO_REPLY,
02453
"No reply within specified time"
);
02454
if
(reply ==
group__DBusMacros.html#ga4
NULL
)
02455
goto
error;
02456
02457   reply_link =
group__DBusList.html#ga0
_dbus_list_alloc_link
(reply);
02458
if
(reply_link ==
group__DBusMacros.html#ga4
NULL
)
02459     {
02460       CONNECTION_UNLOCK (connection);
02461
group__DBusMessage.html#ga20
dbus_message_unref
(reply);
02462
goto
error_unlocked;
02463     }
02464
02465   pending->
structDBusPendingCall.html#o6
timeout_link
= reply_link;
02466
02467
/* Insert the serial in the pending replies hash;
02468
* hash takes a refcount on DBusPendingCall.
02469
* Also, add the timeout.
02470
*/
02471
if
(!_dbus_connection_attach_pending_call_unlocked (connection,
02472                                                       pending))
02473
goto
error;
02474
02475
if
(!_dbus_connection_send_unlocked_no_update (connection, message,
group__DBusMacros.html#ga4
NULL
))
02476     {
02477       _dbus_connection_detach_pending_call_and_unlock (connection,
02478                                                        pending);
02479
goto
error_unlocked;
02480     }
02481
02482
if
(pending_return)
02483     *pending_return = pending;
02484
else
02485     {
02486       _dbus_connection_detach_pending_call_unlocked (connection, pending);
02487
group__DBusPendingCall.html#ga2
dbus_pending_call_unref
(pending);
02488     }
02489
02490   _dbus_verbose (
"%s middle\n"
, _DBUS_FUNCTION_NAME);
02491   status = _dbus_connection_get_dispatch_status_unlocked (connection);
02492
02493
/* this calls out to user code */
02494   _dbus_connection_update_dispatch_status_and_unlock (connection, status);
02495
02496
return
group__DBusMacros.html#ga2
TRUE
;
02497
02498  error:
02499   CONNECTION_UNLOCK (connection);
02500  error_unlocked:
02501
group__DBusPendingCall.html#ga2
dbus_pending_call_unref
(pending);
02502
return
group__DBusMacros.html#ga3
FALSE
;
02503 }
02504
02505
/* This is slightly strange since we can pop a message here without
02506
* the dispatch lock.
02507
*/
02508
static
structDBusMessage.html
DBusMessage
*
02509 check_for_reply_unlocked (
structDBusConnection.html
DBusConnection
*connection,
02510
group__DBusTypes.html#ga3
dbus_uint32_t
client_serial)
02511 {
02512
structDBusList.html
DBusList
*link;
02513
02514   HAVE_LOCK_CHECK (connection);
02515
02516   link =
group__DBusList.html#ga13
_dbus_list_get_first_link
(&connection->
structDBusConnection.html#o7
incoming_messages
);
02517
02518
while
(link !=
group__DBusMacros.html#ga4
NULL
)
02519     {
02520
structDBusMessage.html
DBusMessage
*reply = link->
structDBusList.html#o2
data
;
02521
02522
if
(
group__DBusMessage.html#ga5
dbus_message_get_reply_serial
(reply) == client_serial)
02523         {
02524
group__DBusList.html#ga11
_dbus_list_remove_link
(&connection->
structDBusConnection.html#o7
incoming_messages
, link);
02525           connection->
structDBusConnection.html#o10
n_incoming
-= 1;
02526
return
reply;
02527         }
02528       link =
group__DBusList.html#ga24
_dbus_list_get_next_link
(&connection->
structDBusConnection.html#o7
incoming_messages
, link);
02529     }
02530
02531
return
group__DBusMacros.html#ga4
NULL
;
02532 }
02533
02543
static
void
02544 _dbus_memory_pause_based_on_timeout (
int
timeout_milliseconds)
02545 {
02546
if
(timeout_milliseconds == -1)
02547
group__DBusInternalsUtils.html#ga83
_dbus_sleep_milliseconds
(1000);
02548
else
if
(timeout_milliseconds < 100)
02549     ;
/* just busy loop */
02550
else
if
(timeout_milliseconds <= 1000)
02551
group__DBusInternalsUtils.html#ga83
_dbus_sleep_milliseconds
(timeout_milliseconds / 3);
02552
else
02553
group__DBusInternalsUtils.html#ga83
_dbus_sleep_milliseconds
(1000);
02554 }
02555
02570
void
group__DBusConnection.html#ga25
02571
group__DBusConnection.html#ga25
_dbus_connection_block_pending_call
(
structDBusPendingCall.html
DBusPendingCall
*pending)
02572 {
02573
long
start_tv_sec, start_tv_usec;
02574
long
end_tv_sec, end_tv_usec;
02575
long
tv_sec, tv_usec;
02576   DBusDispatchStatus status;
02577
structDBusConnection.html
DBusConnection
*connection;
02578
group__DBusTypes.html#ga3
dbus_uint32_t
client_serial;
02579
int
timeout_milliseconds;
02580
02581
group__DBusInternalsUtils.html#ga130
_dbus_assert
(pending !=
group__DBusMacros.html#ga4
NULL
);
02582
02583
if
(
group__DBusPendingCall.html#ga5
dbus_pending_call_get_completed
(pending))
02584
return
;
02585
02586
if
(pending->connection ==
group__DBusMacros.html#ga4
NULL
)
02587
return
;
/* call already detached */
02588
02589
group__DBusPendingCall.html#ga1
dbus_pending_call_ref
(pending);
/* necessary because the call could be canceled */
02590
02591   connection = pending->connection;
02592   client_serial = pending->reply_serial;
02593
02594
/* note that timeout_milliseconds is limited to a smallish value
02595
* in _dbus_pending_call_new() so overflows aren't possible
02596
* below
02597
*/
02598   timeout_milliseconds =
group__DBusTimeout.html#ga0
dbus_timeout_get_interval
(pending->timeout);
02599
02600
/* Flush message queue */
02601
group__DBusConnection.html#ga27
dbus_connection_flush
(connection);
02602
02603   CONNECTION_LOCK (connection);
02604
02605
group__DBusInternalsUtils.html#ga84
_dbus_get_current_time
(&start_tv_sec, &start_tv_usec);
02606   end_tv_sec = start_tv_sec + timeout_milliseconds / 1000;
02607   end_tv_usec = start_tv_usec + (timeout_milliseconds % 1000) * 1000;
02608   end_tv_sec += end_tv_usec / _DBUS_USEC_PER_SECOND;
02609   end_tv_usec = end_tv_usec % _DBUS_USEC_PER_SECOND;
02610
02611   _dbus_verbose (
"dbus_connection_send_with_reply_and_block(): will block %d milliseconds for reply serial %u from %ld sec %ld usec to %ld sec %ld usec\n"
,
02612                  timeout_milliseconds,
02613                  client_serial,
02614                  start_tv_sec, start_tv_usec,
02615                  end_tv_sec, end_tv_usec);
02616
02617
/* Now we wait... */
02618
/* always block at least once as we know we don't have the reply yet */
02619
group__DBusConnectionInternals.html#ga41
_dbus_connection_do_iteration_unlocked
(connection,
02620                                           DBUS_ITERATION_DO_READING |
02621                                           DBUS_ITERATION_BLOCK,
02622                                           timeout_milliseconds);
02623
02624  recheck_status:
02625
02626   _dbus_verbose (
"%s top of recheck\n"
, _DBUS_FUNCTION_NAME);
02627
02628   HAVE_LOCK_CHECK (connection);
02629
02630
/* queue messages and get status */
02631
02632   status = _dbus_connection_get_dispatch_status_unlocked (connection);
02633
02634
/* the get_completed() is in case a dispatch() while we were blocking
02635
* got the reply instead of us.
02636
*/
02637
if
(
group__DBusPendingCall.html#ga5
dbus_pending_call_get_completed
(pending))
02638     {
02639       _dbus_verbose (
"Pending call completed by dispatch in %s\n"
, _DBUS_FUNCTION_NAME);
02640       _dbus_connection_update_dispatch_status_and_unlock (connection, status);
02641
group__DBusPendingCall.html#ga2
dbus_pending_call_unref
(pending);
02642
return
;
02643     }
02644
02645
if
(status == DBUS_DISPATCH_DATA_REMAINS)
02646     {
02647
structDBusMessage.html
DBusMessage
*reply;
02648
02649       reply = check_for_reply_unlocked (connection, client_serial);
02650
if
(reply !=
group__DBusMacros.html#ga4
NULL
)
02651         {
02652           _dbus_verbose (
"%s checked for reply\n"
, _DBUS_FUNCTION_NAME);
02653
02654           _dbus_verbose (
"dbus_connection_send_with_reply_and_block(): got reply\n"
);
02655
02656
group__DBusConnectionInternals.html#ga38
_dbus_pending_call_complete_and_unlock
(pending, reply);
02657
group__DBusMessage.html#ga20
dbus_message_unref
(reply);
02658
02659           CONNECTION_LOCK (connection);
02660           status = _dbus_connection_get_dispatch_status_unlocked (connection);
02661           _dbus_connection_update_dispatch_status_and_unlock (connection, status);
02662
group__DBusPendingCall.html#ga2
dbus_pending_call_unref
(pending);
02663
02664
return
;
02665         }
02666     }
02667
02668
group__DBusInternalsUtils.html#ga84
_dbus_get_current_time
(&tv_sec, &tv_usec);
02669
02670
if
(!_dbus_connection_get_is_connected_unlocked (connection))
02671     {
02672
/* FIXME send a "DBUS_ERROR_DISCONNECTED" instead, just to help
02673
* programmers understand what went wrong since the timeout is
02674
* confusing
02675
*/
02676
02677
group__DBusConnectionInternals.html#ga38
_dbus_pending_call_complete_and_unlock
(pending,
group__DBusMacros.html#ga4
NULL
);
02678
group__DBusPendingCall.html#ga2
dbus_pending_call_unref
(pending);
02679
return
;
02680     }
02681
else
if
(tv_sec < start_tv_sec)
02682     _dbus_verbose (
"dbus_connection_send_with_reply_and_block(): clock set backward\n"
);
02683
else
if
(connection->disconnect_message_link ==
group__DBusMacros.html#ga4
NULL
)
02684     _dbus_verbose (
"dbus_connection_send_with_reply_and_block(): disconnected\n"
);
02685
else
if
(tv_sec < end_tv_sec ||
02686            (tv_sec == end_tv_sec && tv_usec < end_tv_usec))
02687     {
02688       timeout_milliseconds = (end_tv_sec - tv_sec) * 1000 +
02689         (end_tv_usec - tv_usec) / 1000;
02690       _dbus_verbose (
"dbus_connection_send_with_reply_and_block(): %d milliseconds remain\n"
, timeout_milliseconds);
02691
group__DBusInternalsUtils.html#ga130
_dbus_assert
(timeout_milliseconds >= 0);
02692
02693
if
(status == DBUS_DISPATCH_NEED_MEMORY)
02694         {
02695
/* Try sleeping a bit, as we aren't sure we need to block for reading,
02696
* we may already have a reply in the buffer and just can't process
02697
* it.
02698
*/
02699           _dbus_verbose (
"dbus_connection_send_with_reply_and_block() waiting for more memory\n"
);
02700
02701           _dbus_memory_pause_based_on_timeout (timeout_milliseconds);
02702         }
02703
else
02704         {
02705
/* block again, we don't have the reply buffered yet. */
02706
group__DBusConnectionInternals.html#ga41
_dbus_connection_do_iteration_unlocked
(connection,
02707                                                   DBUS_ITERATION_DO_READING |
02708                                                   DBUS_ITERATION_BLOCK,
02709                                                   timeout_milliseconds);
02710         }
02711
02712
goto
recheck_status;
02713     }
02714
02715   _dbus_verbose (
"dbus_connection_send_with_reply_and_block(): Waited %ld milliseconds and got no reply\n"
,
02716                  (tv_sec - start_tv_sec) * 1000 + (tv_usec - start_tv_usec) / 1000);
02717
02718
group__DBusInternalsUtils.html#ga130
_dbus_assert
(!
group__DBusPendingCall.html#ga5
dbus_pending_call_get_completed
(pending));
02719
02720
/* unlock and call user code */
02721
group__DBusConnectionInternals.html#ga38
_dbus_pending_call_complete_and_unlock
(pending,
group__DBusMacros.html#ga4
NULL
);
02722
02723
/* update user code on dispatch status */
02724   CONNECTION_LOCK (connection);
02725   status = _dbus_connection_get_dispatch_status_unlocked (connection);
02726   _dbus_connection_update_dispatch_status_and_unlock (connection, status);
02727
group__DBusPendingCall.html#ga2
dbus_pending_call_unref
(pending);
02728 }
02729
02752
structDBusMessage.html
DBusMessage
*
group__DBusConnection.html#ga26
02753
group__DBusConnection.html#ga26
dbus_connection_send_with_reply_and_block
(
structDBusConnection.html
DBusConnection
*connection,
02754
structDBusMessage.html
DBusMessage
*message,
02755
int
timeout_milliseconds,
02756
structDBusError.html
DBusError
*error)
02757 {
02758
structDBusMessage.html
DBusMessage
*reply;
02759
structDBusPendingCall.html
DBusPendingCall
*pending;
02760
02761   _dbus_return_val_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga4
NULL
);
02762   _dbus_return_val_if_fail (message !=
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga4
NULL
);
02763   _dbus_return_val_if_fail (timeout_milliseconds >= 0 || timeout_milliseconds == -1,
group__DBusMacros.html#ga3
FALSE
);
02764   _dbus_return_val_if_error_is_set (error,
group__DBusMacros.html#ga4
NULL
);
02765
02766
if
(!
group__DBusConnection.html#ga22
dbus_connection_send_with_reply
(connection, message,
02767                                         &pending, timeout_milliseconds))
02768     {
02769       _DBUS_SET_OOM (error);
02770
return
group__DBusMacros.html#ga4
NULL
;
02771     }
02772
02773
group__DBusInternalsUtils.html#ga130
_dbus_assert
(pending !=
group__DBusMacros.html#ga4
NULL
);
02774
02775
group__DBusPendingCall.html#ga7
dbus_pending_call_block
(pending);
02776
02777   reply =
group__DBusPendingCall.html#ga6
dbus_pending_call_steal_reply
(pending);
02778
group__DBusPendingCall.html#ga2
dbus_pending_call_unref
(pending);
02779
02780
/* call_complete_and_unlock() called from pending_call_block() should
02781
* always fill this in.
02782
*/
02783
group__DBusInternalsUtils.html#ga130
_dbus_assert
(reply !=
group__DBusMacros.html#ga4
NULL
);
02784
02785
if
(
group__DBusMessage.html#ga75
dbus_set_error_from_message
(error, reply))
02786     {
02787
group__DBusMessage.html#ga20
dbus_message_unref
(reply);
02788
return
group__DBusMacros.html#ga4
NULL
;
02789     }
02790
else
02791
return
reply;
02792 }
02793
02799
void
group__DBusConnection.html#ga27
02800
group__DBusConnection.html#ga27
dbus_connection_flush
(
structDBusConnection.html
DBusConnection
*connection)
02801 {
02802
/* We have to specify DBUS_ITERATION_DO_READING here because
02803
* otherwise we could have two apps deadlock if they are both doing
02804
* a flush(), and the kernel buffers fill up. This could change the
02805
* dispatch status.
02806
*/
02807   DBusDispatchStatus status;
02808
02809   _dbus_return_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
);
02810
02811   CONNECTION_LOCK (connection);
02812
while
(connection->
structDBusConnection.html#o9
n_outgoing
> 0 &&
02813          _dbus_connection_get_is_connected_unlocked (connection))
02814     {
02815       _dbus_verbose (
"doing iteration in %s\n"
, _DBUS_FUNCTION_NAME);
02816       HAVE_LOCK_CHECK (connection);
02817
group__DBusConnectionInternals.html#ga41
_dbus_connection_do_iteration_unlocked
(connection,
02818                                               DBUS_ITERATION_DO_READING |
02819                                               DBUS_ITERATION_DO_WRITING |
02820                                               DBUS_ITERATION_BLOCK,
02821                                               -1);
02822     }
02823
02824   HAVE_LOCK_CHECK (connection);
02825   _dbus_verbose (
"%s middle\n"
, _DBUS_FUNCTION_NAME);
02826   status = _dbus_connection_get_dispatch_status_unlocked (connection);
02827
02828   HAVE_LOCK_CHECK (connection);
02829
/* Unlocks and calls out to user code */
02830   _dbus_connection_update_dispatch_status_and_unlock (connection, status);
02831
02832   _dbus_verbose (
"%s end\n"
, _DBUS_FUNCTION_NAME);
02833 }
02834
02866
group__DBusTypes.html#ga2
dbus_bool_t
group__DBusConnection.html#ga28
02867
group__DBusConnection.html#ga28
dbus_connection_read_write_dispatch
(
structDBusConnection.html
DBusConnection
*connection,
02868
int
timeout_milliseconds)
02869 {
02870   DBusDispatchStatus dstatus;
02871
group__DBusTypes.html#ga2
dbus_bool_t
dispatched_disconnected;
02872
02873   _dbus_return_val_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga3
FALSE
);
02874   _dbus_return_val_if_fail (timeout_milliseconds >= 0 || timeout_milliseconds == -1,
group__DBusMacros.html#ga3
FALSE
);
02875   dstatus =
group__DBusConnection.html#ga37
dbus_connection_get_dispatch_status
(connection);
02876
02877
if
(dstatus == DBUS_DISPATCH_DATA_REMAINS)
02878     {
02879       _dbus_verbose (
"doing dispatch in %s\n"
, _DBUS_FUNCTION_NAME);
02880
group__DBusConnection.html#ga40
dbus_connection_dispatch
(connection);
02881       CONNECTION_LOCK (connection);
02882     }
02883
else
if
(dstatus == DBUS_DISPATCH_NEED_MEMORY)
02884     {
02885       _dbus_verbose (
"pausing for memory in %s\n"
, _DBUS_FUNCTION_NAME);
02886       _dbus_memory_pause_based_on_timeout (timeout_milliseconds);
02887       CONNECTION_LOCK (connection);
02888     }
02889
else
02890     {
02891       CONNECTION_LOCK (connection);
02892
if
(_dbus_connection_get_is_connected_unlocked (connection))
02893         {
02894           _dbus_verbose (
"doing iteration in %s\n"
, _DBUS_FUNCTION_NAME);
02895
group__DBusConnectionInternals.html#ga41
_dbus_connection_do_iteration_unlocked
(connection,
02896                                                   DBUS_ITERATION_DO_READING |
02897                                                   DBUS_ITERATION_DO_WRITING |
02898                                                   DBUS_ITERATION_BLOCK,
02899                                                   timeout_milliseconds);
02900         }
02901     }
02902
02903   HAVE_LOCK_CHECK (connection);
02904   dispatched_disconnected = connection->
structDBusConnection.html#o10
n_incoming
== 0 &&
02905     connection->
structDBusConnection.html#o19
disconnect_message_link
==
group__DBusMacros.html#ga4
NULL
;
02906   CONNECTION_UNLOCK (connection);
02907
return
!dispatched_disconnected;
/* TRUE if we have not processed disconnected */
02908 }
02909
02929
structDBusMessage.html
DBusMessage
*
group__DBusConnection.html#ga29
02930
group__DBusConnection.html#ga29
dbus_connection_borrow_message
(
structDBusConnection.html
DBusConnection
*connection)
02931 {
02932   DBusDispatchStatus status;
02933
structDBusMessage.html
DBusMessage
*message;
02934
02935   _dbus_return_val_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga4
NULL
);
02936
02937   _dbus_verbose (
"%s start\n"
, _DBUS_FUNCTION_NAME);
02938
02939
/* this is called for the side effect that it queues
02940
* up any messages from the transport
02941
*/
02942   status =
group__DBusConnection.html#ga37
dbus_connection_get_dispatch_status
(connection);
02943
if
(status != DBUS_DISPATCH_DATA_REMAINS)
02944
return
group__DBusMacros.html#ga4
NULL
;
02945
02946   CONNECTION_LOCK (connection);
02947
02948   _dbus_connection_acquire_dispatch (connection);
02949
02950
/* While a message is outstanding, the dispatch lock is held */
02951
group__DBusInternalsUtils.html#ga130
_dbus_assert
(connection->
structDBusConnection.html#o8
message_borrowed
==
group__DBusMacros.html#ga4
NULL
);
02952
02953   connection->
structDBusConnection.html#o8
message_borrowed
=
group__DBusList.html#ga16
_dbus_list_get_first
(&connection->
structDBusConnection.html#o7
incoming_messages
);
02954
02955   message = connection->
structDBusConnection.html#o8
message_borrowed
;
02956
02957
/* Note that we KEEP the dispatch lock until the message is returned */
02958
if
(message ==
group__DBusMacros.html#ga4
NULL
)
02959     _dbus_connection_release_dispatch (connection);
02960
02961   CONNECTION_UNLOCK (connection);
02962
02963
return
message;
02964 }
02965
02974
void
group__DBusConnection.html#ga30
02975
group__DBusConnection.html#ga30
dbus_connection_return_message
(
structDBusConnection.html
DBusConnection
*connection,
02976
structDBusMessage.html
DBusMessage
*message)
02977 {
02978   _dbus_return_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
);
02979   _dbus_return_if_fail (message !=
group__DBusMacros.html#ga4
NULL
);
02980   _dbus_return_if_fail (message == connection->
structDBusConnection.html#o8
message_borrowed
);
02981   _dbus_return_if_fail (connection->
structDBusConnection.html#o31
dispatch_acquired
);
02982
02983   CONNECTION_LOCK (connection);
02984
02985
group__DBusInternalsUtils.html#ga130
_dbus_assert
(message == connection->
structDBusConnection.html#o8
message_borrowed
);
02986
02987   connection->
structDBusConnection.html#o8
message_borrowed
=
group__DBusMacros.html#ga4
NULL
;
02988
02989   _dbus_connection_release_dispatch (connection);
02990
02991   CONNECTION_UNLOCK (connection);
02992 }
02993
03003
void
group__DBusConnection.html#ga31
03004
group__DBusConnection.html#ga31
dbus_connection_steal_borrowed_message
(
structDBusConnection.html
DBusConnection
*connection,
03005
structDBusMessage.html
DBusMessage
*message)
03006 {
03007
structDBusMessage.html
DBusMessage
*pop_message;
03008
03009   _dbus_return_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
);
03010   _dbus_return_if_fail (message !=
group__DBusMacros.html#ga4
NULL
);
03011   _dbus_return_if_fail (message == connection->
structDBusConnection.html#o8
message_borrowed
);
03012   _dbus_return_if_fail (connection->
structDBusConnection.html#o31
dispatch_acquired
);
03013
03014   CONNECTION_LOCK (connection);
03015
03016
group__DBusInternalsUtils.html#ga130
_dbus_assert
(message == connection->
structDBusConnection.html#o8
message_borrowed
);
03017
03018   pop_message =
group__DBusList.html#ga18
_dbus_list_pop_first
(&connection->
structDBusConnection.html#o7
incoming_messages
);
03019
group__DBusInternalsUtils.html#ga130
_dbus_assert
(message == pop_message);
03020
03021   connection->
structDBusConnection.html#o10
n_incoming
-= 1;
03022
03023   _dbus_verbose (
"Incoming message %p stolen from queue, %d incoming\n"
,
03024                  message, connection->
structDBusConnection.html#o10
n_incoming
);
03025
03026   connection->
structDBusConnection.html#o8
message_borrowed
=
group__DBusMacros.html#ga4
NULL
;
03027
03028   _dbus_connection_release_dispatch (connection);
03029
03030   CONNECTION_UNLOCK (connection);
03031 }
03032
03033
/* See dbus_connection_pop_message, but requires the caller to own
03034
* the lock before calling. May drop the lock while running.
03035
*/
03036
static
structDBusList.html
DBusList
*
03037 _dbus_connection_pop_message_link_unlocked (
structDBusConnection.html
DBusConnection
*connection)
03038 {
03039   HAVE_LOCK_CHECK (connection);
03040
03041
group__DBusInternalsUtils.html#ga130
_dbus_assert
(connection->
structDBusConnection.html#o8
message_borrowed
==
group__DBusMacros.html#ga4
NULL
);
03042
03043
if
(connection->
structDBusConnection.html#o10
n_incoming
> 0)
03044     {
03045
structDBusList.html
DBusList
*link;
03046
03047       link =
group__DBusList.html#ga17
_dbus_list_pop_first_link
(&connection->
structDBusConnection.html#o7
incoming_messages
);
03048       connection->
structDBusConnection.html#o10
n_incoming
-= 1;
03049
03050       _dbus_verbose (
"Message %p (%d %s %s %s '%s') removed from incoming queue %p, %d incoming\n"
,
03051                      link->
structDBusList.html#o2
data
,
03052
group__DBusMessage.html#ga21
dbus_message_get_type
(link->
structDBusList.html#o2
data
),
03053
group__DBusMessage.html#ga52
dbus_message_get_path
(link->
structDBusList.html#o2
data
),
03054
group__DBusMessage.html#ga56
dbus_message_get_interface
(link->
structDBusList.html#o2
data
) ?
03055
group__DBusMessage.html#ga56
dbus_message_get_interface
(link->
structDBusList.html#o2
data
) :
03056
"no interface"
,
03057
group__DBusMessage.html#ga59
dbus_message_get_member
(link->
structDBusList.html#o2
data
) ?
03058
group__DBusMessage.html#ga59
dbus_message_get_member
(link->
structDBusList.html#o2
data
) :
03059
"no member"
,
03060
group__DBusMessage.html#ga67
dbus_message_get_signature
(link->
structDBusList.html#o2
data
),
03061                      connection, connection->
structDBusConnection.html#o10
n_incoming
);
03062
03063
return
link;
03064     }
03065
else
03066
return
group__DBusMacros.html#ga4
NULL
;
03067 }
03068
03069
/* See dbus_connection_pop_message, but requires the caller to own
03070
* the lock before calling. May drop the lock while running.
03071
*/
03072
static
structDBusMessage.html
DBusMessage
*
03073 _dbus_connection_pop_message_unlocked (
structDBusConnection.html
DBusConnection
*connection)
03074 {
03075
structDBusList.html
DBusList
*link;
03076
03077   HAVE_LOCK_CHECK (connection);
03078
03079   link = _dbus_connection_pop_message_link_unlocked (connection);
03080
03081
if
(link !=
group__DBusMacros.html#ga4
NULL
)
03082     {
03083
structDBusMessage.html
DBusMessage
*message;
03084
03085       message = link->
structDBusList.html#o2
data
;
03086
03087
group__DBusList.html#ga1
_dbus_list_free_link
(link);
03088
03089
return
message;
03090     }
03091
else
03092
return
group__DBusMacros.html#ga4
NULL
;
03093 }
03094
03095
static
void
03096 _dbus_connection_putback_message_link_unlocked (
structDBusConnection.html
DBusConnection
*connection,
03097
structDBusList.html
DBusList
*message_link)
03098 {
03099   HAVE_LOCK_CHECK (connection);
03100
03101
group__DBusInternalsUtils.html#ga130
_dbus_assert
(message_link !=
group__DBusMacros.html#ga4
NULL
);
03102
/* You can't borrow a message while a link is outstanding */
03103
group__DBusInternalsUtils.html#ga130
_dbus_assert
(connection->
structDBusConnection.html#o8
message_borrowed
==
group__DBusMacros.html#ga4
NULL
);
03104
/* We had to have the dispatch lock across the pop/putback */
03105
group__DBusInternalsUtils.html#ga130
_dbus_assert
(connection->
structDBusConnection.html#o31
dispatch_acquired
);
03106
03107
group__DBusList.html#ga5
_dbus_list_prepend_link
(&connection->
structDBusConnection.html#o7
incoming_messages
,
03108                            message_link);
03109   connection->
structDBusConnection.html#o10
n_incoming
+= 1;
03110
03111   _dbus_verbose (
"Message %p (%d %s %s '%s') put back into queue %p, %d incoming\n"
,
03112                  message_link->
structDBusList.html#o2
data
,
03113
group__DBusMessage.html#ga21
dbus_message_get_type
(message_link->
structDBusList.html#o2
data
),
03114
group__DBusMessage.html#ga56
dbus_message_get_interface
(message_link->
structDBusList.html#o2
data
) ?
03115
group__DBusMessage.html#ga56
dbus_message_get_interface
(message_link->
structDBusList.html#o2
data
) :
03116
"no interface"
,
03117
group__DBusMessage.html#ga59
dbus_message_get_member
(message_link->
structDBusList.html#o2
data
) ?
03118
group__DBusMessage.html#ga59
dbus_message_get_member
(message_link->
structDBusList.html#o2
data
) :
03119
"no member"
,
03120
group__DBusMessage.html#ga67
dbus_message_get_signature
(message_link->
structDBusList.html#o2
data
),
03121                  connection, connection->
structDBusConnection.html#o10
n_incoming
);
03122 }
03123
03143
structDBusMessage.html
DBusMessage
*
group__DBusConnection.html#ga35
03144
group__DBusConnection.html#ga35
dbus_connection_pop_message
(
structDBusConnection.html
DBusConnection
*connection)
03145 {
03146
structDBusMessage.html
DBusMessage
*message;
03147   DBusDispatchStatus status;
03148
03149   _dbus_verbose (
"%s start\n"
, _DBUS_FUNCTION_NAME);
03150
03151
/* this is called for the side effect that it queues
03152
* up any messages from the transport
03153
*/
03154   status =
group__DBusConnection.html#ga37
dbus_connection_get_dispatch_status
(connection);
03155
if
(status != DBUS_DISPATCH_DATA_REMAINS)
03156
return
group__DBusMacros.html#ga4
NULL
;
03157
03158   CONNECTION_LOCK (connection);
03159   _dbus_connection_acquire_dispatch (connection);
03160   HAVE_LOCK_CHECK (connection);
03161
03162   message = _dbus_connection_pop_message_unlocked (connection);
03163
03164   _dbus_verbose (
"Returning popped message %p\n"
, message);
03165
03166   _dbus_connection_release_dispatch (connection);
03167   CONNECTION_UNLOCK (connection);
03168
03169
return
message;
03170 }
03171
03179
static
void
03180 _dbus_connection_acquire_dispatch (
structDBusConnection.html
DBusConnection
*connection)
03181 {
03182   HAVE_LOCK_CHECK (connection);
03183
03184
group__DBusConnectionInternals.html#ga43
_dbus_connection_ref_unlocked
(connection);
03185   CONNECTION_UNLOCK (connection);
03186
03187   _dbus_verbose (
"%s locking dispatch_mutex\n"
, _DBUS_FUNCTION_NAME);
03188
group__DBusThreadsInternals.html#ga2
_dbus_mutex_lock
(connection->
structDBusConnection.html#o2
dispatch_mutex
);
03189
03190
while
(connection->
structDBusConnection.html#o31
dispatch_acquired
)
03191     {
03192       _dbus_verbose (
"%s waiting for dispatch to be acquirable\n"
, _DBUS_FUNCTION_NAME);
03193
group__DBusThreadsInternals.html#ga6
_dbus_condvar_wait
(connection->
structDBusConnection.html#o3
dispatch_cond
, connection->
structDBusConnection.html#o2
dispatch_mutex
);
03194     }
03195
03196
group__DBusInternalsUtils.html#ga130
_dbus_assert
(!connection->
structDBusConnection.html#o31
dispatch_acquired
);
03197
03198   connection->
structDBusConnection.html#o31
dispatch_acquired
=
group__DBusMacros.html#ga2
TRUE
;
03199
03200   _dbus_verbose (
"%s unlocking dispatch_mutex\n"
, _DBUS_FUNCTION_NAME);
03201
group__DBusThreadsInternals.html#ga3
_dbus_mutex_unlock
(connection->
structDBusConnection.html#o2
dispatch_mutex
);
03202
03203   CONNECTION_LOCK (connection);
03204
group__DBusConnectionInternals.html#ga44
_dbus_connection_unref_unlocked
(connection);
03205 }
03206
03214
static
void
03215 _dbus_connection_release_dispatch (
structDBusConnection.html
DBusConnection
*connection)
03216 {
03217   HAVE_LOCK_CHECK (connection);
03218
03219   _dbus_verbose (
"%s locking dispatch_mutex\n"
, _DBUS_FUNCTION_NAME);
03220
group__DBusThreadsInternals.html#ga2
_dbus_mutex_lock
(connection->
structDBusConnection.html#o2
dispatch_mutex
);
03221
03222
group__DBusInternalsUtils.html#ga130
_dbus_assert
(connection->
structDBusConnection.html#o31
dispatch_acquired
);
03223
03224   connection->
structDBusConnection.html#o31
dispatch_acquired
=
group__DBusMacros.html#ga3
FALSE
;
03225
group__DBusThreadsInternals.html#ga8
_dbus_condvar_wake_one
(connection->
structDBusConnection.html#o3
dispatch_cond
);
03226
03227   _dbus_verbose (
"%s unlocking dispatch_mutex\n"
, _DBUS_FUNCTION_NAME);
03228
group__DBusThreadsInternals.html#ga3
_dbus_mutex_unlock
(connection->
structDBusConnection.html#o2
dispatch_mutex
);
03229 }
03230
03231
static
void
03232 _dbus_connection_failed_pop (
structDBusConnection.html
DBusConnection
*connection,
03233
structDBusList.html
DBusList
*message_link)
03234 {
03235
group__DBusList.html#ga5
_dbus_list_prepend_link
(&connection->
structDBusConnection.html#o7
incoming_messages
,
03236                            message_link);
03237   connection->
structDBusConnection.html#o10
n_incoming
+= 1;
03238 }
03239
03240
static
DBusDispatchStatus
03241 _dbus_connection_get_dispatch_status_unlocked (
structDBusConnection.html
DBusConnection
*connection)
03242 {
03243   HAVE_LOCK_CHECK (connection);
03244
03245
if
(connection->
structDBusConnection.html#o10
n_incoming
> 0)
03246
return
DBUS_DISPATCH_DATA_REMAINS;
03247
else
if
(!
group__DBusTransport.html#ga16
_dbus_transport_queue_messages
(connection->
structDBusConnection.html#o12
transport
))
03248
return
DBUS_DISPATCH_NEED_MEMORY;
03249
else
03250     {
03251       DBusDispatchStatus status;
03252
group__DBusTypes.html#ga2
dbus_bool_t
is_connected;
03253
03254       status =
group__DBusTransport.html#ga15
_dbus_transport_get_dispatch_status
(connection->
structDBusConnection.html#o12
transport
);
03255       is_connected =
group__DBusTransport.html#ga7
_dbus_transport_get_is_connected
(connection->
structDBusConnection.html#o12
transport
);
03256
03257       _dbus_verbose (
"dispatch status = %s is_connected = %d\n"
,
03258                      DISPATCH_STATUS_NAME (status), is_connected);
03259
03260
if
(!is_connected)
03261         {
03262
if
(status == DBUS_DISPATCH_COMPLETE &&
03263               connection->
structDBusConnection.html#o19
disconnect_message_link
)
03264             {
03265               _dbus_verbose (
"Sending disconnect message from %s\n"
,
03266                              _DBUS_FUNCTION_NAME);
03267
03268               connection_forget_shared_unlocked (connection);
03269
03270
/* We haven't sent the disconnect message already,
03271
* and all real messages have been queued up.
03272
*/
03273               _dbus_connection_queue_synthesized_message_link (connection,
03274                                                                connection->
structDBusConnection.html#o19
disconnect_message_link
);
03275               connection->
structDBusConnection.html#o19
disconnect_message_link
=
group__DBusMacros.html#ga4
NULL
;
03276             }
03277
03278
/* Dump the outgoing queue, we aren't going to be able to
03279
* send it now, and we'd like accessors like
03280
* dbus_connection_get_outgoing_size() to be accurate.
03281
*/
03282
if
(connection->
structDBusConnection.html#o9
n_outgoing
> 0)
03283             {
03284
structDBusList.html
DBusList
*link;
03285
03286               _dbus_verbose (
"Dropping %d outgoing messages since we're disconnected\n"
,
03287                              connection->
structDBusConnection.html#o9
n_outgoing
);
03288
03289
while
((link =
group__DBusList.html#ga14
_dbus_list_get_last_link
(&connection->
structDBusConnection.html#o6
outgoing_messages
)))
03290                 {
03291
group__DBusConnectionInternals.html#ga24
_dbus_connection_message_sent
(connection, link->
structDBusList.html#o2
data
);
03292                 }
03293             }
03294         }
03295
03296
if
(status != DBUS_DISPATCH_COMPLETE)
03297
return
status;
03298
else
if
(connection->
structDBusConnection.html#o10
n_incoming
> 0)
03299
return
DBUS_DISPATCH_DATA_REMAINS;
03300
else
03301
return
DBUS_DISPATCH_COMPLETE;
03302     }
03303 }
03304
03305
static
void
03306 _dbus_connection_update_dispatch_status_and_unlock (
structDBusConnection.html
DBusConnection
*connection,
03307                                                     DBusDispatchStatus new_status)
03308 {
03309
group__DBusTypes.html#ga2
dbus_bool_t
changed;
03310   DBusDispatchStatusFunction function;
03311
void
*data;
03312
03313   HAVE_LOCK_CHECK (connection);
03314
03315
group__DBusConnectionInternals.html#ga43
_dbus_connection_ref_unlocked
(connection);
03316
03317   changed = new_status != connection->
structDBusConnection.html#o26
last_dispatch_status
;
03318
03319   connection->
structDBusConnection.html#o26
last_dispatch_status
= new_status;
03320
03321   function = connection->
structDBusConnection.html#o23
dispatch_status_function
;
03322   data = connection->
structDBusConnection.html#o24
dispatch_status_data
;
03323
03324
/* We drop the lock */
03325   CONNECTION_UNLOCK (connection);
03326
03327
if
(changed && function)
03328     {
03329       _dbus_verbose (
"Notifying of change to dispatch status of %p now %d (%s)\n"
,
03330                      connection, new_status,
03331                      DISPATCH_STATUS_NAME (new_status));
03332       (* function) (connection, new_status, data);
03333     }
03334
03335
group__DBusConnection.html#ga5
dbus_connection_unref
(connection);
03336 }
03337
03346 DBusDispatchStatus
group__DBusConnection.html#ga37
03347
group__DBusConnection.html#ga37
dbus_connection_get_dispatch_status
(
structDBusConnection.html
DBusConnection
*connection)
03348 {
03349   DBusDispatchStatus status;
03350
03351   _dbus_return_val_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
, DBUS_DISPATCH_COMPLETE);
03352
03353   _dbus_verbose (
"%s start\n"
, _DBUS_FUNCTION_NAME);
03354
03355   CONNECTION_LOCK (connection);
03356
03357   status = _dbus_connection_get_dispatch_status_unlocked (connection);
03358
03359   CONNECTION_UNLOCK (connection);
03360
03361
return
status;
03362 }
03363
03367
static
DBusHandlerResult
03368 _dbus_connection_peer_filter (
structDBusConnection.html
DBusConnection
*connection,
03369
structDBusMessage.html
DBusMessage
*message)
03370 {
03371
if
(
group__DBusMessage.html#ga69
dbus_message_is_method_call
(message,
03372                                    DBUS_INTERFACE_PEER,
03373
"Ping"
))
03374     {
03375
structDBusMessage.html
DBusMessage
*ret;
03376
group__DBusTypes.html#ga2
dbus_bool_t
sent;
03377
03378       ret =
group__DBusMessage.html#ga14
dbus_message_new_method_return
(message);
03379
if
(ret ==
group__DBusMacros.html#ga4
NULL
)
03380
return
DBUS_HANDLER_RESULT_NEED_MEMORY;
03381
03382       sent =
group__DBusConnection.html#ga20
dbus_connection_send
(connection, ret,
group__DBusMacros.html#ga4
NULL
);
03383
group__DBusMessage.html#ga20
dbus_message_unref
(ret);
03384
03385
if
(!sent)
03386
return
DBUS_HANDLER_RESULT_NEED_MEMORY;
03387
03388
return
DBUS_HANDLER_RESULT_HANDLED;
03389     }
03390
03391
03392
return
DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
03393 }
03394
03401
static
DBusHandlerResult
03402 _dbus_connection_run_builtin_filters (
structDBusConnection.html
DBusConnection
*connection,
03403
structDBusMessage.html
DBusMessage
*message)
03404 {
03405
/* We just run one filter for now but have the option to run more
03406
if the spec calls for it in the future */
03407
03408
return
_dbus_connection_peer_filter (connection, message);
03409 }
03410
03434 DBusDispatchStatus
group__DBusConnection.html#ga40
03435
group__DBusConnection.html#ga40
dbus_connection_dispatch
(
structDBusConnection.html
DBusConnection
*connection)
03436 {
03437
structDBusMessage.html
DBusMessage
*message;
03438
structDBusList.html
DBusList
*link, *filter_list_copy, *message_link;
03439   DBusHandlerResult result;
03440
structDBusPendingCall.html
DBusPendingCall
*pending;
03441
group__DBusTypes.html#ga4
dbus_int32_t
reply_serial;
03442   DBusDispatchStatus status;
03443
03444   _dbus_return_val_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
, DBUS_DISPATCH_COMPLETE);
03445
03446   _dbus_verbose (
"%s\n"
, _DBUS_FUNCTION_NAME);
03447
03448   CONNECTION_LOCK (connection);
03449   status = _dbus_connection_get_dispatch_status_unlocked (connection);
03450
if
(status != DBUS_DISPATCH_DATA_REMAINS)
03451     {
03452
/* unlocks and calls out to user code */
03453       _dbus_connection_update_dispatch_status_and_unlock (connection, status);
03454
return
status;
03455     }
03456
03457
/* We need to ref the connection since the callback could potentially
03458
* drop the last ref to it
03459
*/
03460
group__DBusConnectionInternals.html#ga43
_dbus_connection_ref_unlocked
(connection);
03461
03462   _dbus_connection_acquire_dispatch (connection);
03463   HAVE_LOCK_CHECK (connection);
03464
03465   message_link = _dbus_connection_pop_message_link_unlocked (connection);
03466
if
(message_link ==
group__DBusMacros.html#ga4
NULL
)
03467     {
03468
/* another thread dispatched our stuff */
03469
03470       _dbus_verbose (
"another thread dispatched message (during acquire_dispatch above)\n"
);
03471
03472       _dbus_connection_release_dispatch (connection);
03473
03474       status = _dbus_connection_get_dispatch_status_unlocked (connection);
03475
03476       _dbus_connection_update_dispatch_status_and_unlock (connection, status);
03477
03478
group__DBusConnection.html#ga5
dbus_connection_unref
(connection);
03479
03480
return
status;
03481     }
03482
03483   message = message_link->
structDBusList.html#o2
data
;
03484
03485   _dbus_verbose (
" dispatching message %p (%d %s %s '%s')\n"
,
03486                  message,
03487
group__DBusMessage.html#ga21
dbus_message_get_type
(message),
03488
group__DBusMessage.html#ga56
dbus_message_get_interface
(message) ?
03489
group__DBusMessage.html#ga56
dbus_message_get_interface
(message) :
03490
"no interface"
,
03491
group__DBusMessage.html#ga59
dbus_message_get_member
(message) ?
03492
group__DBusMessage.html#ga59
dbus_message_get_member
(message) :
03493
"no member"
,
03494
group__DBusMessage.html#ga67
dbus_message_get_signature
(message));
03495
03496   result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
03497
03498
/* Pending call handling must be first, because if you do
03499
* dbus_connection_send_with_reply_and_block() or
03500
* dbus_pending_call_block() then no handlers/filters will be run on
03501
* the reply. We want consistent semantics in the case where we
03502
* dbus_connection_dispatch() the reply.
03503
*/
03504
03505   reply_serial =
group__DBusMessage.html#ga5
dbus_message_get_reply_serial
(message);
03506   pending =
group__DBusHashTable.html#ga17
_dbus_hash_table_lookup_int
(connection->
structDBusConnection.html#o17
pending_replies
,
03507                                          reply_serial);
03508
if
(pending)
03509     {
03510       _dbus_verbose (
"Dispatching a pending reply\n"
);
03511
group__DBusConnectionInternals.html#ga38
_dbus_pending_call_complete_and_unlock
(pending, message);
03512       pending =
group__DBusMacros.html#ga4
NULL
;
/* it's probably unref'd */
03513
03514       CONNECTION_LOCK (connection);
03515       _dbus_verbose (
"pending call completed in dispatch\n"
);
03516       result = DBUS_HANDLER_RESULT_HANDLED;
03517
goto
out;
03518     }
03519
03520   result = _dbus_connection_run_builtin_filters (connection, message);
03521
if
(result != DBUS_HANDLER_RESULT_NOT_YET_HANDLED)
03522
goto
out;
03523
03524
if
(!
group__DBusList.html#ga20
_dbus_list_copy
(&connection->
structDBusConnection.html#o15
filter_list
, &filter_list_copy))
03525     {
03526       _dbus_connection_release_dispatch (connection);
03527       HAVE_LOCK_CHECK (connection);
03528
03529       _dbus_connection_failed_pop (connection, message_link);
03530
03531
/* unlocks and calls user code */
03532       _dbus_connection_update_dispatch_status_and_unlock (connection,
03533                                                           DBUS_DISPATCH_NEED_MEMORY);
03534
03535
if
(pending)
03536
group__DBusPendingCall.html#ga2
dbus_pending_call_unref
(pending);
03537
group__DBusConnection.html#ga5
dbus_connection_unref
(connection);
03538
03539
return
DBUS_DISPATCH_NEED_MEMORY;
03540     }
03541
03542
group__DBusList.html#ga22
_dbus_list_foreach
(&filter_list_copy,
03543                       (
group__DBusInternalsUtils.html#ga161
DBusForeachFunction
)_dbus_message_filter_ref,
03544
group__DBusMacros.html#ga4
NULL
);
03545
03546
/* We're still protected from dispatch() reentrancy here
03547
* since we acquired the dispatcher
03548
*/
03549   CONNECTION_UNLOCK (connection);
03550
03551   link =
group__DBusList.html#ga13
_dbus_list_get_first_link
(&filter_list_copy);
03552
while
(link !=
group__DBusMacros.html#ga4
NULL
)
03553     {
03554       DBusMessageFilter *filter = link->
structDBusList.html#o2
data
;
03555
structDBusList.html
DBusList
*next =
group__DBusList.html#ga24
_dbus_list_get_next_link
(&filter_list_copy, link);
03556
03557       _dbus_verbose (
"  running filter on message %p\n"
, message);
03558       result = (* filter->
structDBusMessageFilter.html#o1
function
) (connection, message, filter->
structDBusMessageFilter.html#o2
user_data
);
03559
03560
if
(result != DBUS_HANDLER_RESULT_NOT_YET_HANDLED)
03561
break
;
03562
03563       link = next;
03564     }
03565
03566
group__DBusList.html#ga22
_dbus_list_foreach
(&filter_list_copy,
03567                       (
group__DBusInternalsUtils.html#ga161
DBusForeachFunction
)_dbus_message_filter_unref,
03568
group__DBusMacros.html#ga4
NULL
);
03569
group__DBusList.html#ga12
_dbus_list_clear
(&filter_list_copy);
03570
03571   CONNECTION_LOCK (connection);
03572
03573
if
(result == DBUS_HANDLER_RESULT_NEED_MEMORY)
03574     {
03575       _dbus_verbose (
"No memory in %s\n"
, _DBUS_FUNCTION_NAME);
03576
goto
out;
03577     }
03578
else
if
(result == DBUS_HANDLER_RESULT_HANDLED)
03579     {
03580       _dbus_verbose (
"filter handled message in dispatch\n"
);
03581
goto
out;
03582     }
03583
03584
/* We're still protected from dispatch() reentrancy here
03585
* since we acquired the dispatcher
03586
*/
03587   _dbus_verbose (
"  running object path dispatch on message %p (%d %s %s '%s')\n"
,
03588                  message,
03589
group__DBusMessage.html#ga21
dbus_message_get_type
(message),
03590
group__DBusMessage.html#ga56
dbus_message_get_interface
(message) ?
03591
group__DBusMessage.html#ga56
dbus_message_get_interface
(message) :
03592
"no interface"
,
03593
group__DBusMessage.html#ga59
dbus_message_get_member
(message) ?
03594
group__DBusMessage.html#ga59
dbus_message_get_member
(message) :
03595
"no member"
,
03596
group__DBusMessage.html#ga67
dbus_message_get_signature
(message));
03597
03598   HAVE_LOCK_CHECK (connection);
03599   result =
group__DBusObjectTree.html#ga21
_dbus_object_tree_dispatch_and_unlock
(connection->
structDBusConnection.html#o28
objects
,
03600                                                   message);
03601
03602   CONNECTION_LOCK (connection);
03603
03604
if
(result != DBUS_HANDLER_RESULT_NOT_YET_HANDLED)
03605     {
03606       _dbus_verbose (
"object tree handled message in dispatch\n"
);
03607
goto
out;
03608     }
03609
03610
if
(
group__DBusMessage.html#ga21
dbus_message_get_type
(message) == DBUS_MESSAGE_TYPE_METHOD_CALL)
03611     {
03612
structDBusMessage.html
DBusMessage
*reply;
03613
structDBusString.html
DBusString
str;
03614
structDBusPreallocatedSend.html
DBusPreallocatedSend
*preallocated;
03615
03616       _dbus_verbose (
"  sending error %s\n"
,
03617                      DBUS_ERROR_UNKNOWN_METHOD);
03618
03619
if
(!
group__DBusString.html#ga6
_dbus_string_init
(&str))
03620         {
03621           result = DBUS_HANDLER_RESULT_NEED_MEMORY;
03622           _dbus_verbose (
"no memory for error string in dispatch\n"
);
03623
goto
out;
03624         }
03625
03626
if
(!
group__DBusString.html#ga33
_dbus_string_append_printf
(&str,
03627
"Method \"%s\" with signature \"%s\" on interface \"%s\" doesn't exist\n"
,
03628
group__DBusMessage.html#ga59
dbus_message_get_member
(message),
03629
group__DBusMessage.html#ga67
dbus_message_get_signature
(message),
03630
group__DBusMessage.html#ga56
dbus_message_get_interface
(message)))
03631         {
03632
group__DBusString.html#ga9
_dbus_string_free
(&str);
03633           result = DBUS_HANDLER_RESULT_NEED_MEMORY;
03634           _dbus_verbose (
"no memory for error string in dispatch\n"
);
03635
goto
out;
03636         }
03637
03638       reply =
group__DBusMessage.html#ga16
dbus_message_new_error
(message,
03639                                       DBUS_ERROR_UNKNOWN_METHOD,
03640                                       _dbus_string_get_const_data (&str));
03641
group__DBusString.html#ga9
_dbus_string_free
(&str);
03642
03643
if
(reply ==
group__DBusMacros.html#ga4
NULL
)
03644         {
03645           result = DBUS_HANDLER_RESULT_NEED_MEMORY;
03646           _dbus_verbose (
"no memory for error reply in dispatch\n"
);
03647
goto
out;
03648         }
03649
03650       preallocated = _dbus_connection_preallocate_send_unlocked (connection);
03651
03652
if
(preallocated ==
group__DBusMacros.html#ga4
NULL
)
03653         {
03654
group__DBusMessage.html#ga20
dbus_message_unref
(reply);
03655           result = DBUS_HANDLER_RESULT_NEED_MEMORY;
03656           _dbus_verbose (
"no memory for error send in dispatch\n"
);
03657
goto
out;
03658         }
03659
03660       _dbus_connection_send_preallocated_unlocked_no_update (connection, preallocated,
03661                                                              reply,
group__DBusMacros.html#ga4
NULL
);
03662
03663
group__DBusMessage.html#ga20
dbus_message_unref
(reply);
03664
03665       result = DBUS_HANDLER_RESULT_HANDLED;
03666     }
03667
03668   _dbus_verbose (
"  done dispatching %p (%d %s %s '%s') on connection %p\n"
, message,
03669
group__DBusMessage.html#ga21
dbus_message_get_type
(message),
03670
group__DBusMessage.html#ga56
dbus_message_get_interface
(message) ?
03671
group__DBusMessage.html#ga56
dbus_message_get_interface
(message) :
03672
"no interface"
,
03673
group__DBusMessage.html#ga59
dbus_message_get_member
(message) ?
03674
group__DBusMessage.html#ga59
dbus_message_get_member
(message) :
03675
"no member"
,
03676
group__DBusMessage.html#ga67
dbus_message_get_signature
(message),
03677                  connection);
03678
03679  out:
03680
if
(result == DBUS_HANDLER_RESULT_NEED_MEMORY)
03681     {
03682       _dbus_verbose (
"out of memory in %s\n"
, _DBUS_FUNCTION_NAME);
03683
03684
/* Put message back, and we'll start over.
03685
* Yes this means handlers must be idempotent if they
03686
* don't return HANDLED; c'est la vie.
03687
*/
03688       _dbus_connection_putback_message_link_unlocked (connection,
03689                                                       message_link);
03690     }
03691
else
03692     {
03693       _dbus_verbose (
" ... done dispatching in %s\n"
, _DBUS_FUNCTION_NAME);
03694
03695
if
(connection->
structDBusConnection.html#o33
exit_on_disconnect
&&
03696
group__DBusMessage.html#ga70
dbus_message_is_signal
(message,
03697                                   DBUS_INTERFACE_LOCAL,
03698
"Disconnected"
))
03699         {
03700           _dbus_verbose (
"Exiting on Disconnected signal\n"
);
03701           CONNECTION_UNLOCK (connection);
03702
group__DBusInternalsUtils.html#ga100
_dbus_exit
(1);
03703
group__DBusInternalsUtils.html#ga131
_dbus_assert_not_reached
(
"Call to exit() returned"
);
03704         }
03705
03706
group__DBusList.html#ga1
_dbus_list_free_link
(message_link);
03707
group__DBusMessage.html#ga20
dbus_message_unref
(message);
/* don't want the message to count in max message limits
03708
* in computing dispatch status below
03709
*/
03710     }
03711
03712   _dbus_connection_release_dispatch (connection);
03713   HAVE_LOCK_CHECK (connection);
03714
03715   _dbus_verbose (
"%s before final status update\n"
, _DBUS_FUNCTION_NAME);
03716   status = _dbus_connection_get_dispatch_status_unlocked (connection);
03717
03718
/* unlocks and calls user code */
03719   _dbus_connection_update_dispatch_status_and_unlock (connection, status);
03720
03721
group__DBusConnection.html#ga5
dbus_connection_unref
(connection);
03722
03723
return
status;
03724 }
03725
03784
group__DBusTypes.html#ga2
dbus_bool_t
group__DBusConnection.html#ga41
03785
group__DBusConnection.html#ga41
dbus_connection_set_watch_functions
(
structDBusConnection.html
DBusConnection
*connection,
03786                                      DBusAddWatchFunction         add_function,
03787                                      DBusRemoveWatchFunction      remove_function,
03788                                      DBusWatchToggledFunction     toggled_function,
03789
void
*data,
03790
group__DBusMemory.html#ga8
DBusFreeFunction
free_data_function)
03791 {
03792
group__DBusTypes.html#ga2
dbus_bool_t
retval;
03793
structDBusWatchList.html
DBusWatchList
*watches;
03794
03795   _dbus_return_val_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga3
FALSE
);
03796
03797   CONNECTION_LOCK (connection);
03798
03799
#ifndef DBUS_DISABLE_CHECKS
03800
if
(connection->
structDBusConnection.html#o13
watches
==
group__DBusMacros.html#ga4
NULL
)
03801     {
03802
group__DBusInternalsUtils.html#ga7
_dbus_warn
(
"Re-entrant call to %s is not allowed\n"
,
03803                   _DBUS_FUNCTION_NAME);
03804
return
group__DBusMacros.html#ga3
FALSE
;
03805     }
03806
#endif
03807
03808
/* ref connection for slightly better reentrancy */
03809
group__DBusConnectionInternals.html#ga43
_dbus_connection_ref_unlocked
(connection);
03810
03811
/* This can call back into user code, and we need to drop the
03812
* connection lock when it does. This is kind of a lame
03813
* way to do it.
03814
*/
03815   watches = connection->
structDBusConnection.html#o13
watches
;
03816   connection->
structDBusConnection.html#o13
watches
=
group__DBusMacros.html#ga4
NULL
;
03817   CONNECTION_UNLOCK (connection);
03818
03819   retval =
group__DBusWatchInternals.html#ga7
_dbus_watch_list_set_functions
(watches,
03820                                            add_function, remove_function,
03821                                            toggled_function,
03822                                            data, free_data_function);
03823   CONNECTION_LOCK (connection);
03824   connection->
structDBusConnection.html#o13
watches
= watches;
03825
03826   CONNECTION_UNLOCK (connection);
03827
/* drop our paranoid refcount */
03828
group__DBusConnection.html#ga5
dbus_connection_unref
(connection);
03829
03830
return
retval;
03831 }
03832
03866
group__DBusTypes.html#ga2
dbus_bool_t
group__DBusConnection.html#ga42
03867
group__DBusConnection.html#ga42
dbus_connection_set_timeout_functions
(
structDBusConnection.html
DBusConnection
*connection,
03868                                          DBusAddTimeoutFunction     add_function,
03869                                          DBusRemoveTimeoutFunction  remove_function,
03870                                          DBusTimeoutToggledFunction toggled_function,
03871
void
*data,
03872
group__DBusMemory.html#ga8
DBusFreeFunction
free_data_function)
03873 {
03874
group__DBusTypes.html#ga2
dbus_bool_t
retval;
03875
structDBusTimeoutList.html
DBusTimeoutList
*timeouts;
03876
03877   _dbus_return_val_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga3
FALSE
);
03878
03879   CONNECTION_LOCK (connection);
03880
03881
#ifndef DBUS_DISABLE_CHECKS
03882
if
(connection->
structDBusConnection.html#o14
timeouts
==
group__DBusMacros.html#ga4
NULL
)
03883     {
03884
group__DBusInternalsUtils.html#ga7
_dbus_warn
(
"Re-entrant call to %s is not allowed\n"
,
03885                   _DBUS_FUNCTION_NAME);
03886
return
group__DBusMacros.html#ga3
FALSE
;
03887     }
03888
#endif
03889
03890
/* ref connection for slightly better reentrancy */
03891
group__DBusConnectionInternals.html#ga43
_dbus_connection_ref_unlocked
(connection);
03892
03893   timeouts = connection->
structDBusConnection.html#o14
timeouts
;
03894   connection->
structDBusConnection.html#o14
timeouts
=
group__DBusMacros.html#ga4
NULL
;
03895   CONNECTION_UNLOCK (connection);
03896
03897   retval =
group__DBusTimeoutInternals.html#ga7
_dbus_timeout_list_set_functions
(timeouts,
03898                                              add_function, remove_function,
03899                                              toggled_function,
03900                                              data, free_data_function);
03901   CONNECTION_LOCK (connection);
03902   connection->
structDBusConnection.html#o14
timeouts
= timeouts;
03903
03904   CONNECTION_UNLOCK (connection);
03905
/* drop our paranoid refcount */
03906
group__DBusConnection.html#ga5
dbus_connection_unref
(connection);
03907
03908
return
retval;
03909 }
03910
03925
void
group__DBusConnection.html#ga43
03926
group__DBusConnection.html#ga43
dbus_connection_set_wakeup_main_function
(
structDBusConnection.html
DBusConnection
*connection,
03927                                           DBusWakeupMainFunction     wakeup_main_function,
03928
void
*data,
03929
group__DBusMemory.html#ga8
DBusFreeFunction
free_data_function)
03930 {
03931
void
*old_data;
03932
group__DBusMemory.html#ga8
DBusFreeFunction
old_free_data;
03933
03934   _dbus_return_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
);
03935
03936   CONNECTION_LOCK (connection);
03937   old_data = connection->
structDBusConnection.html#o21
wakeup_main_data
;
03938   old_free_data = connection->
structDBusConnection.html#o22
free_wakeup_main_data
;
03939
03940   connection->
structDBusConnection.html#o20
wakeup_main_function
= wakeup_main_function;
03941   connection->
structDBusConnection.html#o21
wakeup_main_data
= data;
03942   connection->
structDBusConnection.html#o22
free_wakeup_main_data
= free_data_function;
03943
03944   CONNECTION_UNLOCK (connection);
03945
03946
/* Callback outside the lock */
03947
if
(old_free_data)
03948     (*old_free_data) (old_data);
03949 }
03950
03967
void
group__DBusConnection.html#ga44
03968
group__DBusConnection.html#ga44
dbus_connection_set_dispatch_status_function
(
structDBusConnection.html
DBusConnection
*connection,
03969                                               DBusDispatchStatusFunction  function,
03970
void
*data,
03971
group__DBusMemory.html#ga8
DBusFreeFunction
free_data_function)
03972 {
03973
void
*old_data;
03974
group__DBusMemory.html#ga8
DBusFreeFunction
old_free_data;
03975
03976   _dbus_return_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
);
03977
03978   CONNECTION_LOCK (connection);
03979   old_data = connection->
structDBusConnection.html#o24
dispatch_status_data
;
03980   old_free_data = connection->
structDBusConnection.html#o25
free_dispatch_status_data
;
03981
03982   connection->
structDBusConnection.html#o23
dispatch_status_function
= function;
03983   connection->
structDBusConnection.html#o24
dispatch_status_data
= data;
03984   connection->
structDBusConnection.html#o25
free_dispatch_status_data
= free_data_function;
03985
03986   CONNECTION_UNLOCK (connection);
03987
03988
/* Callback outside the lock */
03989
if
(old_free_data)
03990     (*old_free_data) (old_data);
03991 }
03992
04005
group__DBusTypes.html#ga2
dbus_bool_t
group__DBusConnection.html#ga45
04006
group__DBusConnection.html#ga45
dbus_connection_get_unix_fd
(
structDBusConnection.html
DBusConnection
*connection,
04007
int
*fd)
04008 {
04009
group__DBusTypes.html#ga2
dbus_bool_t
retval;
04010
04011   _dbus_return_val_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga3
FALSE
);
04012   _dbus_return_val_if_fail (connection->
structDBusConnection.html#o12
transport
!=
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga3
FALSE
);
04013
04014   CONNECTION_LOCK (connection);
04015
04016   retval =
group__DBusTransport.html#ga12
_dbus_transport_get_unix_fd
(connection->
structDBusConnection.html#o12
transport
,
04017                                         fd);
04018
04019   CONNECTION_UNLOCK (connection);
04020
04021
return
retval;
04022 }
04023
04035
group__DBusTypes.html#ga2
dbus_bool_t
group__DBusConnection.html#ga46
04036
group__DBusConnection.html#ga46
dbus_connection_get_unix_user
(
structDBusConnection.html
DBusConnection
*connection,
04037
unsigned
long
*uid)
04038 {
04039
group__DBusTypes.html#ga2
dbus_bool_t
result;
04040
04041   _dbus_return_val_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga3
FALSE
);
04042   _dbus_return_val_if_fail (uid !=
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga3
FALSE
);
04043
04044   CONNECTION_LOCK (connection);
04045
04046
if
(!
group__DBusTransport.html#ga8
_dbus_transport_get_is_authenticated
(connection->
structDBusConnection.html#o12
transport
))
04047     result =
group__DBusMacros.html#ga3
FALSE
;
04048
else
04049     result =
group__DBusTransport.html#ga21
_dbus_transport_get_unix_user
(connection->
structDBusConnection.html#o12
transport
,
04050                                             uid);
04051   CONNECTION_UNLOCK (connection);
04052
04053
return
result;
04054 }
04055
04066
group__DBusTypes.html#ga2
dbus_bool_t
group__DBusConnection.html#ga47
04067
group__DBusConnection.html#ga47
dbus_connection_get_unix_process_id
(
structDBusConnection.html
DBusConnection
*connection,
04068
unsigned
long
*pid)
04069 {
04070
group__DBusTypes.html#ga2
dbus_bool_t
result;
04071
04072   _dbus_return_val_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga3
FALSE
);
04073   _dbus_return_val_if_fail (pid !=
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga3
FALSE
);
04074
04075   CONNECTION_LOCK (connection);
04076
04077
if
(!
group__DBusTransport.html#ga8
_dbus_transport_get_is_authenticated
(connection->
structDBusConnection.html#o12
transport
))
04078     result =
group__DBusMacros.html#ga3
FALSE
;
04079
else
04080     result =
group__DBusTransport.html#ga22
_dbus_transport_get_unix_process_id
(connection->
structDBusConnection.html#o12
transport
,
04081                                                   pid);
04082   CONNECTION_UNLOCK (connection);
04083
04084
return
result;
04085 }
04086
04103
void
group__DBusConnection.html#ga48
04104
group__DBusConnection.html#ga48
dbus_connection_set_unix_user_function
(
structDBusConnection.html
DBusConnection
*connection,
04105                                         DBusAllowUnixUserFunction   function,
04106
void
*data,
04107
group__DBusMemory.html#ga8
DBusFreeFunction
free_data_function)
04108 {
04109
void
*old_data =
group__DBusMacros.html#ga4
NULL
;
04110
group__DBusMemory.html#ga8
DBusFreeFunction
old_free_function =
group__DBusMacros.html#ga4
NULL
;
04111
04112   _dbus_return_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
);
04113
04114   CONNECTION_LOCK (connection);
04115
group__DBusTransport.html#ga23
_dbus_transport_set_unix_user_function
(connection->
structDBusConnection.html#o12
transport
,
04116                                           function, data, free_data_function,
04117                                           &old_data, &old_free_function);
04118   CONNECTION_UNLOCK (connection);
04119
04120
if
(old_free_function !=
group__DBusMacros.html#ga4
NULL
)
04121     (* old_free_function) (old_data);
04122 }
04123
04145
group__DBusTypes.html#ga2
dbus_bool_t
group__DBusConnection.html#ga49
04146
group__DBusConnection.html#ga49
dbus_connection_add_filter
(
structDBusConnection.html
DBusConnection
*connection,
04147                             DBusHandleMessageFunction  function,
04148
void
*user_data,
04149
group__DBusMemory.html#ga8
DBusFreeFunction
free_data_function)
04150 {
04151   DBusMessageFilter *filter;
04152
04153   _dbus_return_val_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga3
FALSE
);
04154   _dbus_return_val_if_fail (function !=
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga3
FALSE
);
04155
04156   filter =
group__DBusMemory.html#ga7
dbus_new0
(DBusMessageFilter, 1);
04157
if
(filter ==
group__DBusMacros.html#ga4
NULL
)
04158
return
group__DBusMacros.html#ga3
FALSE
;
04159
04160   filter->
structDBusMessageFilter.html#o0
refcount
.
structDBusAtomic.html#o0
value
= 1;
04161
04162   CONNECTION_LOCK (connection);
04163
04164
if
(!
group__DBusList.html#ga2
_dbus_list_append
(&connection->
structDBusConnection.html#o15
filter_list
,
04165                           filter))
04166     {
04167       _dbus_message_filter_unref (filter);
04168       CONNECTION_UNLOCK (connection);
04169
return
group__DBusMacros.html#ga3
FALSE
;
04170     }
04171
04172
/* Fill in filter after all memory allocated,
04173
* so we don't run the free_user_data_function
04174
* if the add_filter() fails
04175
*/
04176
04177   filter->
structDBusMessageFilter.html#o1
function
= function;
04178   filter->
structDBusMessageFilter.html#o2
user_data
= user_data;
04179   filter->
structDBusMessageFilter.html#o3
free_user_data_function
= free_data_function;
04180
04181   CONNECTION_UNLOCK (connection);
04182
return
group__DBusMacros.html#ga2
TRUE
;
04183 }
04184
04197
void
group__DBusConnection.html#ga50
04198
group__DBusConnection.html#ga50
dbus_connection_remove_filter
(
structDBusConnection.html
DBusConnection
*connection,
04199                                DBusHandleMessageFunction  function,
04200
void
*user_data)
04201 {
04202
structDBusList.html
DBusList
*link;
04203   DBusMessageFilter *filter;
04204
04205   _dbus_return_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
);
04206   _dbus_return_if_fail (function !=
group__DBusMacros.html#ga4
NULL
);
04207
04208   CONNECTION_LOCK (connection);
04209
04210   filter =
group__DBusMacros.html#ga4
NULL
;
04211
04212   link =
group__DBusList.html#ga14
_dbus_list_get_last_link
(&connection->
structDBusConnection.html#o15
filter_list
);
04213
while
(link !=
group__DBusMacros.html#ga4
NULL
)
04214     {
04215       filter = link->
structDBusList.html#o2
data
;
04216
04217
if
(filter->
structDBusMessageFilter.html#o1
function
== function &&
04218           filter->
structDBusMessageFilter.html#o2
user_data
== user_data)
04219         {
04220
group__DBusList.html#ga11
_dbus_list_remove_link
(&connection->
structDBusConnection.html#o15
filter_list
, link);
04221           filter->
structDBusMessageFilter.html#o1
function
=
group__DBusMacros.html#ga4
NULL
;
04222
04223
break
;
04224         }
04225
04226       link =
group__DBusList.html#ga25
_dbus_list_get_prev_link
(&connection->
structDBusConnection.html#o15
filter_list
, link);
04227     }
04228
04229   CONNECTION_UNLOCK (connection);
04230
04231
#ifndef DBUS_DISABLE_CHECKS
04232
if
(filter ==
group__DBusMacros.html#ga4
NULL
)
04233     {
04234
group__DBusInternalsUtils.html#ga7
_dbus_warn
(
"Attempt to remove filter function %p user data %p, but no such filter has been added\n"
,
04235                   function, user_data);
04236
return
;
04237     }
04238
#endif
04239
04240
/* Call application code */
04241
if
(filter->
structDBusMessageFilter.html#o3
free_user_data_function
)
04242     (* filter->
structDBusMessageFilter.html#o3
free_user_data_function
) (filter->
structDBusMessageFilter.html#o2
user_data
);
04243
04244   filter->
structDBusMessageFilter.html#o3
free_user_data_function
=
group__DBusMacros.html#ga4
NULL
;
04245   filter->
structDBusMessageFilter.html#o2
user_data
=
group__DBusMacros.html#ga4
NULL
;
04246
04247   _dbus_message_filter_unref (filter);
04248 }
04249
04261
group__DBusTypes.html#ga2
dbus_bool_t
group__DBusConnection.html#ga51
04262
group__DBusConnection.html#ga51
dbus_connection_register_object_path
(
structDBusConnection.html
DBusConnection
*connection,
04263
const
char
*path,
04264
const
structDBusObjectPathVTable.html
DBusObjectPathVTable
*vtable,
04265
void
*user_data)
04266 {
04267
char
**decomposed_path;
04268
group__DBusTypes.html#ga2
dbus_bool_t
retval;
04269
04270   _dbus_return_val_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga3
FALSE
);
04271   _dbus_return_val_if_fail (path !=
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga3
FALSE
);
04272   _dbus_return_val_if_fail (path[0] ==
'/'
,
group__DBusMacros.html#ga3
FALSE
);
04273   _dbus_return_val_if_fail (vtable !=
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga3
FALSE
);
04274
04275
if
(!
group__DBusObjectTree.html#ga25
_dbus_decompose_path
(path, strlen (path), &decomposed_path,
group__DBusMacros.html#ga4
NULL
))
04276
return
group__DBusMacros.html#ga3
FALSE
;
04277
04278   CONNECTION_LOCK (connection);
04279
04280   retval =
group__DBusObjectTree.html#ga15
_dbus_object_tree_register
(connection->
structDBusConnection.html#o28
objects
,
04281
group__DBusMacros.html#ga3
FALSE
,
04282                                        (
const
char
**) decomposed_path, vtable,
04283                                        user_data);
04284
04285   CONNECTION_UNLOCK (connection);
04286
04287
group__DBusMemory.html#ga4
dbus_free_string_array
(decomposed_path);
04288
04289
return
retval;
04290 }
04291
04304
group__DBusTypes.html#ga2
dbus_bool_t
group__DBusConnection.html#ga52
04305
group__DBusConnection.html#ga52
dbus_connection_register_fallback
(
structDBusConnection.html
DBusConnection
*connection,
04306
const
char
*path,
04307
const
structDBusObjectPathVTable.html
DBusObjectPathVTable
*vtable,
04308
void
*user_data)
04309 {
04310
char
**decomposed_path;
04311
group__DBusTypes.html#ga2
dbus_bool_t
retval;
04312
04313   _dbus_return_val_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga3
FALSE
);
04314   _dbus_return_val_if_fail (path !=
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga3
FALSE
);
04315   _dbus_return_val_if_fail (path[0] ==
'/'
,
group__DBusMacros.html#ga3
FALSE
);
04316   _dbus_return_val_if_fail (vtable !=
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga3
FALSE
);
04317
04318
if
(!
group__DBusObjectTree.html#ga25
_dbus_decompose_path
(path, strlen (path), &decomposed_path,
group__DBusMacros.html#ga4
NULL
))
04319
return
group__DBusMacros.html#ga3
FALSE
;
04320
04321   CONNECTION_LOCK (connection);
04322
04323   retval =
group__DBusObjectTree.html#ga15
_dbus_object_tree_register
(connection->
structDBusConnection.html#o28
objects
,
04324
group__DBusMacros.html#ga2
TRUE
,
04325                                        (
const
char
**) decomposed_path, vtable,
04326                                        user_data);
04327
04328   CONNECTION_UNLOCK (connection);
04329
04330
group__DBusMemory.html#ga4
dbus_free_string_array
(decomposed_path);
04331
04332
return
retval;
04333 }
04334
04344
group__DBusTypes.html#ga2
dbus_bool_t
group__DBusConnection.html#ga53
04345
group__DBusConnection.html#ga53
dbus_connection_unregister_object_path
(
structDBusConnection.html
DBusConnection
*connection,
04346
const
char
*path)
04347 {
04348
char
**decomposed_path;
04349
04350   _dbus_return_val_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga3
FALSE
);
04351   _dbus_return_val_if_fail (path !=
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga3
FALSE
);
04352   _dbus_return_val_if_fail (path[0] ==
'/'
,
group__DBusMacros.html#ga3
FALSE
);
04353
04354
if
(!
group__DBusObjectTree.html#ga25
_dbus_decompose_path
(path, strlen (path), &decomposed_path,
group__DBusMacros.html#ga4
NULL
))
04355
return
group__DBusMacros.html#ga3
FALSE
;
04356
04357   CONNECTION_LOCK (connection);
04358
04359
group__DBusObjectTree.html#ga16
_dbus_object_tree_unregister_and_unlock
(connection->
structDBusConnection.html#o28
objects
, (
const
char
**) decomposed_path);
04360
04361
group__DBusMemory.html#ga4
dbus_free_string_array
(decomposed_path);
04362
04363
return
group__DBusMacros.html#ga2
TRUE
;
04364 }
04365
04376
group__DBusTypes.html#ga2
dbus_bool_t
group__DBusConnection.html#ga54
04377
group__DBusConnection.html#ga54
dbus_connection_get_object_path_data
(
structDBusConnection.html
DBusConnection
*connection,
04378
const
char
*path,
04379
void
**data_p)
04380 {
04381
char
**decomposed_path;
04382
04383   _dbus_return_val_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga3
FALSE
);
04384   _dbus_return_val_if_fail (path !=
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga3
FALSE
);
04385   _dbus_return_val_if_fail (data_p !=
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga3
FALSE
);
04386
04387   *data_p =
group__DBusMacros.html#ga4
NULL
;
04388
04389
if
(!
group__DBusObjectTree.html#ga25
_dbus_decompose_path
(path, strlen (path), &decomposed_path,
group__DBusMacros.html#ga4
NULL
))
04390
return
group__DBusMacros.html#ga3
FALSE
;
04391
04392   CONNECTION_LOCK (connection);
04393
04394   *data_p =
group__DBusObjectTree.html#ga22
_dbus_object_tree_get_user_data_unlocked
(connection->
structDBusConnection.html#o28
objects
, (
const
char
**) decomposed_path);
04395
04396   CONNECTION_UNLOCK (connection);
04397
04398
group__DBusMemory.html#ga4
dbus_free_string_array
(decomposed_path);
04399
04400
return
group__DBusMacros.html#ga2
TRUE
;
04401 }
04402
04413
group__DBusTypes.html#ga2
dbus_bool_t
group__DBusConnection.html#ga55
04414
group__DBusConnection.html#ga55
dbus_connection_list_registered
(
structDBusConnection.html
DBusConnection
*connection,
04415
const
char
*parent_path,
04416
char
***child_entries)
04417 {
04418
char
**decomposed_path;
04419
group__DBusTypes.html#ga2
dbus_bool_t
retval;
04420   _dbus_return_val_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga3
FALSE
);
04421   _dbus_return_val_if_fail (parent_path !=
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga3
FALSE
);
04422   _dbus_return_val_if_fail (parent_path[0] ==
'/'
,
group__DBusMacros.html#ga3
FALSE
);
04423   _dbus_return_val_if_fail (child_entries !=
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga3
FALSE
);
04424
04425
if
(!
group__DBusObjectTree.html#ga25
_dbus_decompose_path
(parent_path, strlen (parent_path), &decomposed_path,
group__DBusMacros.html#ga4
NULL
))
04426
return
group__DBusMacros.html#ga3
FALSE
;
04427
04428   CONNECTION_LOCK (connection);
04429
04430   retval =
group__DBusObjectTree.html#ga24
_dbus_object_tree_list_registered_and_unlock
(connection->
structDBusConnection.html#o28
objects
,
04431                                                          (
const
char
**) decomposed_path,
04432                                                          child_entries);
04433
group__DBusMemory.html#ga4
dbus_free_string_array
(decomposed_path);
04434
04435
return
retval;
04436 }
04437
04438
static
structDBusDataSlotAllocator.html
DBusDataSlotAllocator
slot_allocator;
04439
group__DBusInternalsUtils.html#ga146
_DBUS_DEFINE_GLOBAL_LOCK
(connection_slots);
04440
04455
group__DBusTypes.html#ga2
dbus_bool_t
group__DBusConnection.html#ga56
04456
group__DBusConnection.html#ga56
dbus_connection_allocate_data_slot
(
group__DBusTypes.html#ga4
dbus_int32_t
*slot_p)
04457 {
04458
return
group__DBusDataSlot.html#ga1
_dbus_data_slot_allocator_alloc
(&slot_allocator,
04459
group__DBusInternalsUtils.html#ga145
_DBUS_LOCK_NAME
(connection_slots),
04460                                           slot_p);
04461 }
04462
04474
void
group__DBusConnection.html#ga57
04475
group__DBusConnection.html#ga57
dbus_connection_free_data_slot
(
group__DBusTypes.html#ga4
dbus_int32_t
*slot_p)
04476 {
04477   _dbus_return_if_fail (*slot_p >= 0);
04478
04479
group__DBusDataSlot.html#ga2
_dbus_data_slot_allocator_free
(&slot_allocator, slot_p);
04480 }
04481
04495
group__DBusTypes.html#ga2
dbus_bool_t
group__DBusConnection.html#ga58
04496
group__DBusConnection.html#ga58
dbus_connection_set_data
(
structDBusConnection.html
DBusConnection
*connection,
04497
group__DBusTypes.html#ga4
dbus_int32_t
slot,
04498
void
*data,
04499
group__DBusMemory.html#ga8
DBusFreeFunction
free_data_func)
04500 {
04501
group__DBusMemory.html#ga8
DBusFreeFunction
old_free_func;
04502
void
*old_data;
04503
group__DBusTypes.html#ga2
dbus_bool_t
retval;
04504
04505   _dbus_return_val_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga3
FALSE
);
04506   _dbus_return_val_if_fail (slot >= 0,
group__DBusMacros.html#ga3
FALSE
);
04507
04508   CONNECTION_LOCK (connection);
04509
04510   retval =
group__DBusDataSlot.html#ga4
_dbus_data_slot_list_set
(&slot_allocator,
04511                                      &connection->
structDBusConnection.html#o16
slot_list
,
04512                                      slot, data, free_data_func,
04513                                      &old_free_func, &old_data);
04514
04515   CONNECTION_UNLOCK (connection);
04516
04517
if
(retval)
04518     {
04519
/* Do the actual free outside the connection lock */
04520
if
(old_free_func)
04521         (* old_free_func) (old_data);
04522     }
04523
04524
return
retval;
04525 }
04526
04535
void
*
group__DBusConnection.html#ga59
04536
group__DBusConnection.html#ga59
dbus_connection_get_data
(
structDBusConnection.html
DBusConnection
*connection,
04537
group__DBusTypes.html#ga4
dbus_int32_t
slot)
04538 {
04539
void
*res;
04540
04541   _dbus_return_val_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
,
group__DBusMacros.html#ga4
NULL
);
04542
04543   CONNECTION_LOCK (connection);
04544
04545   res =
group__DBusDataSlot.html#ga5
_dbus_data_slot_list_get
(&slot_allocator,
04546                                   &connection->
structDBusConnection.html#o16
slot_list
,
04547                                   slot);
04548
04549   CONNECTION_UNLOCK (connection);
04550
04551
return
res;
04552 }
04553
04560
void
group__DBusConnection.html#ga60
04561
group__DBusConnection.html#ga60
dbus_connection_set_change_sigpipe
(
group__DBusTypes.html#ga2
dbus_bool_t
will_modify_sigpipe)
04562 {
04563   _dbus_modify_sigpipe = will_modify_sigpipe !=
group__DBusMacros.html#ga3
FALSE
;
04564 }
04565
04574
void
group__DBusConnection.html#ga61
04575
group__DBusConnection.html#ga61
dbus_connection_set_max_message_size
(
structDBusConnection.html
DBusConnection
*connection,
04576
long
size)
04577 {
04578   _dbus_return_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
);
04579
04580   CONNECTION_LOCK (connection);
04581
group__DBusTransport.html#ga17
_dbus_transport_set_max_message_size
(connection->
structDBusConnection.html#o12
transport
,
04582                                         size);
04583   CONNECTION_UNLOCK (connection);
04584 }
04585
04592
long
group__DBusConnection.html#ga62
04593
group__DBusConnection.html#ga62
dbus_connection_get_max_message_size
(
structDBusConnection.html
DBusConnection
*connection)
04594 {
04595
long
res;
04596
04597   _dbus_return_val_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
, 0);
04598
04599   CONNECTION_LOCK (connection);
04600   res =
group__DBusTransport.html#ga18
_dbus_transport_get_max_message_size
(connection->
structDBusConnection.html#o12
transport
);
04601   CONNECTION_UNLOCK (connection);
04602
return
res;
04603 }
04604
04630
void
group__DBusConnection.html#ga63
04631
group__DBusConnection.html#ga63
dbus_connection_set_max_received_size
(
structDBusConnection.html
DBusConnection
*connection,
04632
long
size)
04633 {
04634   _dbus_return_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
);
04635
04636   CONNECTION_LOCK (connection);
04637
group__DBusTransport.html#ga19
_dbus_transport_set_max_received_size
(connection->
structDBusConnection.html#o12
transport
,
04638                                          size);
04639   CONNECTION_UNLOCK (connection);
04640 }
04641
04648
long
group__DBusConnection.html#ga64
04649
group__DBusConnection.html#ga64
dbus_connection_get_max_received_size
(
structDBusConnection.html
DBusConnection
*connection)
04650 {
04651
long
res;
04652
04653   _dbus_return_val_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
, 0);
04654
04655   CONNECTION_LOCK (connection);
04656   res =
group__DBusTransport.html#ga20
_dbus_transport_get_max_received_size
(connection->
structDBusConnection.html#o12
transport
);
04657   CONNECTION_UNLOCK (connection);
04658
return
res;
04659 }
04660
04671
long
group__DBusConnection.html#ga65
04672
group__DBusConnection.html#ga65
dbus_connection_get_outgoing_size
(
structDBusConnection.html
DBusConnection
*connection)
04673 {
04674
long
res;
04675
04676   _dbus_return_val_if_fail (connection !=
group__DBusMacros.html#ga4
NULL
, 0);
04677
04678   CONNECTION_LOCK (connection);
04679   res =
group__DBusResources.html#ga4
_dbus_counter_get_value
(connection->
structDBusConnection.html#o11
outgoing_counter
);
04680   CONNECTION_UNLOCK (connection);
04681
return
res;
04682 }
04683
Generated on Tue Sep 13 01:28:06 2005 for D-BUS by
http://www.doxygen.org/index.html
doxygen
1.4.4
