D-Bus
1.4.10
|
"Backend" for a DBusConnection. More...
"Backend" for a DBusConnection.
Types and functions related to DBusTransport. A transport is an abstraction that can send and receive data via various kinds of network connections or other IPC mechanisms.
Opaque object representing a way message stream.
DBusTransport abstracts various kinds of actual transport mechanism, such as different network protocols, or encryption schemes.
Definition at line 33 of file dbus-transport.h.
dbus_bool_t _dbus_transport_can_pass_unix_fd | ( | DBusTransport * | transport | ) |
Returns TRUE if the transport supports sending unix fds.
transport | the transport |
Definition at line 816 of file dbus-transport.c.
Referenced by dbus_connection_can_send_type(), dbus_connection_send_preallocated(), dbus_connection_send(), dbus_connection_send_with_reply(), and dbus_connection_send_with_reply_and_block().
void _dbus_transport_disconnect | ( | DBusTransport * | transport | ) |
Closes our end of the connection to a remote application.
Further attempts to use this transport will fail. Only the first call to _dbus_transport_disconnect() will have an effect.
transport | the transport. |
Definition at line 498 of file dbus-transport.c.
References _dbus_assert, vtable, DBusTransportVTable::disconnect, NULL, disconnected, and TRUE.
Referenced by _dbus_transport_finalize_base(), _dbus_transport_get_is_authenticated(), and _dbus_transport_queue_messages().
void _dbus_transport_do_iteration | ( | DBusTransport * | transport, |
unsigned int | flags, | ||
int | timeout_milliseconds | ||
) |
Performs a single poll()/select() on the transport's file descriptors and then reads/writes data as appropriate, queueing incoming messages and sending outgoing messages.
This is the backend for _dbus_connection_do_iteration(). See _dbus_connection_do_iteration() for full details.
transport | the transport. |
flags | indicates whether to read or write, and whether to block. |
timeout_milliseconds | if blocking, timeout or -1 for no timeout. |
Definition at line 957 of file dbus-transport.c.
References _dbus_assert, vtable, DBusTransportVTable::do_iteration, NULL, disconnected, _dbus_transport_ref(), and _dbus_transport_unref().
Referenced by _dbus_connection_do_iteration_unlocked().
void _dbus_transport_finalize_base | ( | DBusTransport * | transport | ) |
Finalizes base class members of DBusTransport.
Chained up to from subclass finalizers.
transport | the transport. |
Definition at line 213 of file dbus-transport.c.
References disconnected, _dbus_transport_disconnect(), free_unix_user_data, NULL, unix_user_data, free_windows_user_data, windows_user_data, _dbus_message_loader_unref(), loader, _dbus_auth_unref(), auth, _dbus_counter_set_notify(), live_messages, _dbus_counter_unref(), dbus_free(), address, expected_guid, credentials, and _dbus_credentials_unref().
const char* _dbus_transport_get_address | ( | DBusTransport * | transport | ) |
Gets the address of a transport.
It will be NULL for a server-side transport.
transport | the transport |
Definition at line 829 of file dbus-transport.c.
References address.
dbus_bool_t _dbus_transport_get_adt_audit_session_data | ( | DBusTransport * | transport, |
void ** | data, | ||
int * | data_size | ||
) |
See dbus_connection_get_adt_audit_session_data().
transport | the transport |
data | return location for the ADT audit data |
data_size | return length of audit data |
Definition at line 1347 of file dbus-transport.c.
References NULL, authenticated, FALSE, _dbus_auth_get_identity(), auth, _dbus_credentials_include(), _dbus_credentials_get_adt_audit_data(), _dbus_credentials_get_adt_audit_data_size(), and TRUE.
Referenced by dbus_connection_get_adt_audit_session_data().
DBusDispatchStatus _dbus_transport_get_dispatch_status | ( | DBusTransport * | transport | ) |
Reports our current dispatch status (whether there's buffered data to be queued as messages, or not, or we need memory).
transport | the transport |
Definition at line 1078 of file dbus-transport.c.
References _dbus_counter_get_size_value(), live_messages, max_live_messages_size, _dbus_counter_get_unix_fd_value(), max_live_messages_unix_fds, DBUS_DISPATCH_COMPLETE, _dbus_transport_get_is_authenticated(), _dbus_auth_do_work(), auth, DBUS_DISPATCH_NEED_MEMORY, unused_bytes_recovered, TRUE, _dbus_message_loader_queue_messages(), loader, _dbus_message_loader_peek_message(), NULL, and DBUS_DISPATCH_DATA_REMAINS.
Referenced by _dbus_transport_queue_messages().
dbus_bool_t _dbus_transport_get_is_anonymous | ( | DBusTransport * | transport | ) |
See dbus_connection_get_is_anonymous().
transport | the transport |
Definition at line 794 of file dbus-transport.c.
References authenticated, TRUE, _dbus_auth_get_identity(), auth, _dbus_credentials_are_anonymous(), and FALSE.
Referenced by dbus_connection_get_is_anonymous().
dbus_bool_t _dbus_transport_get_is_authenticated | ( | DBusTransport * | transport | ) |
Returns TRUE if we have been authenticated.
Will return TRUE even if the transport is disconnected.
transport | the transport |
Definition at line 697 of file dbus-transport.c.
References authenticated, TRUE, disconnected, FALSE, _dbus_connection_ref_unlocked(), connection, send_credentials_pending, receive_credentials_pending, _dbus_auth_do_work(), auth, is_server, _dbus_auth_get_guid_from_server(), _dbus_assert, NULL, expected_guid, _dbus_transport_disconnect(), _dbus_connection_unref_unlocked(), _dbus_auth_get_identity(), unix_user_function, _dbus_credentials_include(), and windows_user_function.
Referenced by _dbus_connection_queue_received_message_link(), dbus_connection_get_is_authenticated(), dbus_connection_get_unix_user(), dbus_connection_get_unix_process_id(), dbus_connection_get_adt_audit_session_data(), dbus_connection_get_windows_user(), and _dbus_transport_get_dispatch_status().
dbus_bool_t _dbus_transport_get_is_connected | ( | DBusTransport * | transport | ) |
Returns TRUE if the transport has not been disconnected.
Disconnection can result from _dbus_transport_disconnect() or because the server drops its end of the connection.
transport | the transport. |
Definition at line 523 of file dbus-transport.c.
References disconnected.
Referenced by dbus_connection_unref().
long _dbus_transport_get_max_message_size | ( | DBusTransport * | transport | ) |
See dbus_connection_get_max_message_size().
transport | the transport |
Definition at line 1195 of file dbus-transport.c.
References _dbus_message_loader_get_max_message_size(), and loader.
Referenced by dbus_connection_get_max_message_size().
long _dbus_transport_get_max_message_unix_fds | ( | DBusTransport * | transport | ) |
See dbus_connection_get_max_message_unix_fds().
transport | the transport |
Definition at line 1207 of file dbus-transport.c.
References _dbus_message_loader_get_max_message_unix_fds(), and loader.
Referenced by dbus_connection_get_max_message_unix_fds().
long _dbus_transport_get_max_received_size | ( | DBusTransport * | transport | ) |
See dbus_connection_get_max_received_size().
transport | the transport |
Definition at line 1255 of file dbus-transport.c.
References max_live_messages_size.
Referenced by dbus_connection_get_max_received_size().
long _dbus_transport_get_max_received_unix_fds | ( | DBusTransport * | transport | ) |
See dbus_connection_set_max_received_unix_fds().
transport | the transport |
Definition at line 1267 of file dbus-transport.c.
References max_live_messages_unix_fds.
Referenced by dbus_connection_get_max_received_unix_fds().
const char* _dbus_transport_get_server_id | ( | DBusTransport * | transport | ) |
Gets the id of the server we are connected to (see dbus_server_get_id()).
Only works on client side.
transport | the transport |
Definition at line 842 of file dbus-transport.c.
References is_server, NULL, authenticated, _dbus_auth_get_guid_from_server(), auth, and expected_guid.
Referenced by dbus_connection_get_server_id().
dbus_bool_t _dbus_transport_get_socket_fd | ( | DBusTransport * | transport, |
int * | fd_p | ||
) |
Get the socket file descriptor, if any.
transport | the transport |
fd_p | pointer to fill in with the descriptor |
Definition at line 924 of file dbus-transport.c.
References vtable, DBusTransportVTable::get_socket_fd, NULL, FALSE, disconnected, _dbus_transport_ref(), and _dbus_transport_unref().
Referenced by dbus_connection_get_socket().
dbus_bool_t _dbus_transport_get_unix_process_id | ( | DBusTransport * | transport, |
unsigned long * | pid | ||
) |
See dbus_connection_get_unix_process_id().
transport | the transport |
pid | return location for the process ID |
Definition at line 1313 of file dbus-transport.c.
References DBUS_PID_UNSET, authenticated, FALSE, _dbus_auth_get_identity(), auth, _dbus_credentials_include(), _dbus_credentials_get_unix_pid(), and TRUE.
Referenced by dbus_connection_get_unix_process_id().
dbus_bool_t _dbus_transport_get_unix_user | ( | DBusTransport * | transport, |
unsigned long * | uid | ||
) |
See dbus_connection_get_unix_user().
transport | the transport |
uid | return location for the user ID |
Definition at line 1280 of file dbus-transport.c.
References _DBUS_INT32_MAX, authenticated, FALSE, _dbus_auth_get_identity(), auth, _dbus_credentials_include(), _dbus_credentials_get_unix_uid(), and TRUE.
Referenced by dbus_connection_get_unix_user().
dbus_bool_t _dbus_transport_get_windows_user | ( | DBusTransport * | transport, |
char ** | windows_sid_p | ||
) |
See dbus_connection_get_windows_user().
transport | the transport |
windows_sid_p | return location for the user ID |
Definition at line 1406 of file dbus-transport.c.
References NULL, authenticated, FALSE, _dbus_auth_get_identity(), auth, _dbus_credentials_include(), _dbus_strdup(), _dbus_credentials_get_windows_sid(), and TRUE.
Referenced by dbus_connection_get_windows_user().
dbus_bool_t _dbus_transport_handle_watch | ( | DBusTransport * | transport, |
DBusWatch * | watch, | ||
unsigned int | condition | ||
) |
Handles a watch by reading data, writing data, or disconnecting the transport, as appropriate for the given condition.
transport | the transport. |
watch | the watch. |
condition | the current state of the watched file descriptor. |
Definition at line 862 of file dbus-transport.c.
References _dbus_assert, vtable, DBusTransportVTable::handle_watch, NULL, disconnected, TRUE, dbus_watch_get_socket(), _dbus_warn_check_failed(), _dbus_watch_sanitize_condition(), _dbus_transport_ref(), _dbus_watch_ref(), _dbus_watch_unref(), and _dbus_transport_unref().
Referenced by _dbus_connection_handle_watch().
dbus_bool_t _dbus_transport_init_base | ( | DBusTransport * | transport, |
const DBusTransportVTable * | vtable, | ||
const DBusString * | server_guid, | ||
const DBusString * | address | ||
) |
Initializes the base class members of DBusTransport.
Chained up to by subclasses in their constructor. The server GUID is the globally unique ID for the server creating this connection and will be NULL for the client side of a connection. The GUID is in hex format.
transport | the transport being created. |
vtable | the subclass vtable. |
server_guid | non-NULL if this transport is on the server side of a connection |
address | the address of the transport |
Definition at line 99 of file dbus-transport.c.
References _dbus_message_loader_new(), NULL, FALSE, _dbus_auth_server_new(), _dbus_auth_client_new(), _dbus_message_loader_unref(), _dbus_counter_new(), _dbus_auth_unref(), _dbus_credentials_new(), _dbus_counter_unref(), _dbus_assert, _dbus_string_copy_data(), _dbus_credentials_unref(), refcount, vtable, loader, auth, live_messages, authenticated, disconnected, is_server, send_credentials_pending, receive_credentials_pending, address, unix_user_function, unix_user_data, free_unix_user_data, windows_user_function, windows_user_data, free_windows_user_data, expected_guid, max_live_messages_size, max_live_messages_unix_fds, credentials, _dbus_counter_set_notify(), and TRUE.
Referenced by _dbus_transport_new_for_socket().
DBusTransport* _dbus_transport_open | ( | DBusAddressEntry * | entry, |
DBusError * | error | ||
) |
Try to open a new transport for the given address entry.
(This opens a client-side-of-the-connection transport.)
entry | the address entry |
error | location to store reason for failure. |
Definition at line 363 of file dbus-transport.c.
References DBUS_ERROR_INIT, NULL, dbus_address_entry_get_value(), _dbus_strdup(), _DBUS_N_ELEMENTS, dbus_error_is_set(), _dbus_set_bad_address(), dbus_move_error(), dbus_free(), and expected_guid.
dbus_bool_t _dbus_transport_queue_messages | ( | DBusTransport * | transport | ) |
Processes data we've read while handling a watch, potentially converting some of it to messages and queueing those messages on the connection.
transport | the transport |
Definition at line 1117 of file dbus-transport.c.
References _dbus_transport_get_dispatch_status(), DBUS_DISPATCH_DATA_REMAINS, _dbus_message_loader_pop_message_link(), loader, _dbus_assert, NULL, DBusList::data, _dbus_message_add_counter(), live_messages, _dbus_message_loader_putback_message_link(), DBUS_DISPATCH_NEED_MEMORY, _dbus_connection_queue_received_message_link(), connection, _dbus_message_loader_get_is_corrupted(), and _dbus_transport_disconnect().
DBusTransport* _dbus_transport_ref | ( | DBusTransport * | transport | ) |
Increments the reference count for the transport.
transport | the transport. |
Definition at line 456 of file dbus-transport.c.
References _dbus_assert, and refcount.
Referenced by _dbus_connection_new_for_transport(), _dbus_transport_handle_watch(), _dbus_transport_set_connection(), _dbus_transport_get_socket_fd(), and _dbus_transport_do_iteration().
void _dbus_transport_set_allow_anonymous | ( | DBusTransport * | transport, |
dbus_bool_t | value | ||
) |
See dbus_connection_set_allow_anonymous()
transport | the transport |
value | TRUE to allow anonymous connection |
Definition at line 1479 of file dbus-transport.c.
References allow_anonymous, and FALSE.
Referenced by dbus_connection_set_allow_anonymous().
dbus_bool_t _dbus_transport_set_auth_mechanisms | ( | DBusTransport * | transport, |
const char ** | mechanisms | ||
) |
Sets the SASL authentication mechanisms supported by this transport.
transport | the transport |
mechanisms | the NULL-terminated array of mechanisms |
Definition at line 1466 of file dbus-transport.c.
References _dbus_auth_set_mechanisms(), and auth.
dbus_bool_t _dbus_transport_set_connection | ( | DBusTransport * | transport, |
DBusConnection * | connection | ||
) |
Sets the connection using this transport.
Allows the transport to add watches to the connection, queue incoming messages, and pull outgoing messages.
transport | the transport. |
connection | the connection. |
Definition at line 900 of file dbus-transport.c.
References _dbus_assert, vtable, DBusTransportVTable::connection_set, NULL, connection, _dbus_transport_ref(), and _dbus_transport_unref().
Referenced by _dbus_connection_new_for_transport().
void _dbus_transport_set_max_message_size | ( | DBusTransport * | transport, |
long | size | ||
) |
See dbus_connection_set_max_message_size().
transport | the transport |
size | the max size of a single message |
Definition at line 1169 of file dbus-transport.c.
References _dbus_message_loader_set_max_message_size(), and loader.
Referenced by dbus_connection_set_max_message_size().
void _dbus_transport_set_max_message_unix_fds | ( | DBusTransport * | transport, |
long | n | ||
) |
See dbus_connection_set_max_message_unix_fds().
transport | the transport |
n | the max number of unix fds of a single message |
Definition at line 1182 of file dbus-transport.c.
References _dbus_message_loader_set_max_message_unix_fds(), and loader.
Referenced by dbus_connection_set_max_message_unix_fds().
void _dbus_transport_set_max_received_size | ( | DBusTransport * | transport, |
long | size | ||
) |
See dbus_connection_set_max_received_size().
transport | the transport |
size | the max size of all incoming messages |
Definition at line 1219 of file dbus-transport.c.
References max_live_messages_size, _dbus_counter_set_notify(), live_messages, and max_live_messages_unix_fds.
Referenced by dbus_connection_set_max_received_size().
void _dbus_transport_set_max_received_unix_fds | ( | DBusTransport * | transport, |
long | n | ||
) |
See dbus_connection_set_max_received_unix_fds().
transport | the transport |
n | the max unix fds of all incoming messages |
Definition at line 1237 of file dbus-transport.c.
References max_live_messages_unix_fds, _dbus_counter_set_notify(), live_messages, and max_live_messages_size.
Referenced by dbus_connection_set_max_received_unix_fds().
void _dbus_transport_set_unix_user_function | ( | DBusTransport * | transport, |
DBusAllowUnixUserFunction | function, | ||
void * | data, | ||
DBusFreeFunction | free_data_function, | ||
void ** | old_data, | ||
DBusFreeFunction * | old_free_data_function | ||
) |
See dbus_connection_set_unix_user_function().
transport | the transport |
function | the predicate |
data | data to pass to the predicate |
free_data_function | function to free the data |
old_data | the old user data to be freed |
old_free_data_function | old free data function to free it with |
Definition at line 1383 of file dbus-transport.c.
References unix_user_data, free_unix_user_data, and unix_user_function.
Referenced by dbus_connection_set_unix_user_function().
void _dbus_transport_set_windows_user_function | ( | DBusTransport * | transport, |
DBusAllowWindowsUserFunction | function, | ||
void * | data, | ||
DBusFreeFunction | free_data_function, | ||
void ** | old_data, | ||
DBusFreeFunction * | old_free_data_function | ||
) |
See dbus_connection_set_windows_user_function().
transport | the transport |
function | the predicate |
data | data to pass to the predicate |
free_data_function | function to free the data |
old_data | the old user data to be freed |
old_free_data_function | old free data function to free it with |
Definition at line 1442 of file dbus-transport.c.
References windows_user_data, free_windows_user_data, and windows_user_function.
Referenced by dbus_connection_set_windows_user_function().
void _dbus_transport_unref | ( | DBusTransport * | transport | ) |
Decrements the reference count for the transport.
Disconnects and finalizes the transport if the reference count reaches zero.
transport | the transport. |
Definition at line 473 of file dbus-transport.c.
References _dbus_assert, NULL, refcount, vtable, and DBusTransportVTable::finalize.
Referenced by _dbus_transport_handle_watch(), _dbus_transport_set_connection(), _dbus_transport_get_socket_fd(), and _dbus_transport_do_iteration().