DBusTransport object
D-Bus secret internal implementation details

"Backend" for a DBusConnection. More...

## Typedefs

typedef struct DBusTransport | DBusTransport
| Opaque object representing a way message stream.

## Functions

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.
void | _dbus_transport_finalize_base (DBusTransport *transport)
| Finalizes base class members of DBusTransport.
DBusTransport * | _dbus_transport_open (DBusAddressEntry *entry, DBusError *error)
| Try to open a new transport for the given address entry.
DBusTransport * | _dbus_transport_ref (DBusTransport *transport)
| Increments the reference count for the transport.
void | _dbus_transport_unref (DBusTransport *transport)
| Decrements the reference count for the transport.
void | _dbus_transport_disconnect (DBusTransport *transport)
| Closes our end of the connection to a remote application.
dbus_bool_t | _dbus_transport_get_is_connected (DBusTransport *transport)
| Returns TRUE if the transport has not been disconnected.
dbus_bool_t | _dbus_transport_peek_is_authenticated (DBusTransport *transport)
| Returns TRUE if we have been authenticated.
dbus_bool_t | _dbus_transport_try_to_authenticate (DBusTransport *transport)
| Returns TRUE if we have been authenticated.
dbus_bool_t | _dbus_transport_get_is_anonymous (DBusTransport *transport)
| See dbus_connection_get_is_anonymous().
dbus_bool_t | _dbus_transport_can_pass_unix_fd (DBusTransport *transport)
| Returns TRUE if the transport supports sending unix fds.
const char * | _dbus_transport_get_address (DBusTransport *transport)
| Gets the address of a transport.
const char * | _dbus_transport_get_server_id (DBusTransport *transport)
| Gets the id of the server we are connected to (see dbus_server_get_id()).
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.
dbus_bool_t | _dbus_transport_set_connection (DBusTransport *transport, DBusConnection *connection)
| Sets the connection using this transport.
dbus_bool_t | _dbus_transport_get_socket_fd (DBusTransport *transport, DBusSocket *fd_p)
| Get the socket file descriptor, if any.
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.
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).
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.
void | _dbus_transport_set_max_message_size (DBusTransport *transport, long size)
| See 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().
long | _dbus_transport_get_max_message_size (DBusTransport *transport)
| See dbus_connection_get_max_message_size().
long | _dbus_transport_get_max_message_unix_fds (DBusTransport *transport)
| See dbus_connection_get_max_message_unix_fds().
void | _dbus_transport_set_max_received_size (DBusTransport *transport, long size)
| See 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().
long | _dbus_transport_get_max_received_size (DBusTransport *transport)
| See dbus_connection_get_max_received_size().
long | _dbus_transport_get_max_received_unix_fds (DBusTransport *transport)
| See dbus_connection_set_max_received_unix_fds().
dbus_bool_t | _dbus_transport_get_unix_user (DBusTransport *transport, unsigned long *uid)
| See dbus_connection_get_unix_user().
dbus_bool_t | _dbus_transport_get_unix_process_id (DBusTransport *transport, unsigned long *pid)
| See dbus_connection_get_unix_process_id().
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().
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().
dbus_bool_t | _dbus_transport_get_linux_security_label (DBusTransport *transport, char **label_p)
DBusCredentials * | _dbus_transport_get_credentials (DBusTransport *transport)
| If the transport has already been authenticated, return its credentials.
dbus_bool_t | _dbus_transport_get_windows_user (DBusTransport *transport, char **windows_sid_p)
| See dbus_connection_get_windows_user().
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().
dbus_bool_t | _dbus_transport_set_auth_mechanisms (DBusTransport *transport, const char **mechanisms)
| Sets the SASL authentication mechanisms supported by this transport.
void | _dbus_transport_set_allow_anonymous (DBusTransport *transport, dbus_bool_t value)
| See dbus_connection_set_allow_anonymous().
int | _dbus_transport_get_pending_fds_count (DBusTransport *transport)
| Return how many file descriptors are pending in the loader.
void | _dbus_transport_set_pending_fds_function (DBusTransport *transport, void(*callback)(void *), void *data)
| Register a function to be called whenever the number of pending file descriptors in the loader change.

## Detailed Description

"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.

## Typedef Documentation

## DBusTransport

typedef struct DBusTransport DBusTransport

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 36 of file dbus-transport.h.

## Function Documentation

## _dbus_transport_can_pass_unix_fd()

dbus_bool_t _dbus_transport_can_pass_unix_fd | ( | DBusTransport * | transport | ) |

Returns TRUE if the transport supports sending unix fds.

Parameters

  transport | the transport

Returns
  TRUE if TRUE it is possible to send unix fds across the transport.

Definition at line 861 of file dbus-transport.c.

Referenced by dbus_connection_can_send_type(), dbus_connection_send(), dbus_connection_send_preallocated(), dbus_connection_send_with_reply(), and dbus_connection_send_with_reply_and_block().

## _dbus_transport_disconnect()

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.

Parameters

  transport | the transport.

Definition at line 511 of file dbus-transport.c.

References _dbus_assert, DBusTransportVTable::disconnect, DBusTransport::disconnected, NULL, TRUE, and DBusTransport::vtable.

Referenced by _dbus_transport_finalize_base(), _dbus_transport_queue_messages(), and _dbus_transport_try_to_authenticate().

## _dbus_transport_do_iteration()

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.

Parameters

  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 1002 of file dbus-transport.c.

References _dbus_assert, _dbus_transport_ref(), _dbus_transport_unref(), DBusTransport::disconnected, DBusTransportVTable::do_iteration, NULL, and DBusTransport::vtable.

Referenced by _dbus_connection_do_iteration_unlocked().

## _dbus_transport_finalize_base()

void _dbus_transport_finalize_base | ( | DBusTransport * | transport | ) |

Finalizes base class members of DBusTransport.

Chained up to from subclass finalizers.

Parameters

  transport | the transport.

Definition at line 218 of file dbus-transport.c.

References _dbus_auth_unref(), _dbus_counter_set_notify(), _dbus_counter_unref(), _dbus_credentials_unref(), _dbus_message_loader_unref(), _dbus_transport_disconnect(), DBusTransport::address, DBusTransport::auth, DBusTransport::credentials, dbus_free(), DBusTransport::disconnected, DBusTransport::expected_guid, DBusTransport::free_unix_user_data, DBusTransport::free_windows_user_data, DBusTransport::live_messages, DBusTransport::loader, NULL, DBusTransport::unix_user_data, and DBusTransport::windows_user_data.

## _dbus_transport_get_address()

const char * _dbus_transport_get_address | ( | DBusTransport * | transport | ) |

Gets the address of a transport.

It will be NULL for a server-side transport.

Parameters

  transport | the transport

Returns
  transport's address

Definition at line 874 of file dbus-transport.c.

References DBusTransport::address.

## _dbus_transport_get_adt_audit_session_data()

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().

Parameters

  transport | the transport
  data | return location for the ADT audit data
  data_size | return length of audit data

Returns
  TRUE if audit data is filled in with a valid ucred

Definition at line 1403 of file dbus-transport.c.

References _dbus_auth_get_identity(), _dbus_credentials_get_adt_audit_data(), _dbus_credentials_get_adt_audit_data_size(), _dbus_credentials_include(), DBusTransport::auth, DBusTransport::authenticated, FALSE, NULL, and TRUE.

Referenced by dbus_connection_get_adt_audit_session_data().

## _dbus_transport_get_credentials()

DBusCredentials * _dbus_transport_get_credentials | ( | DBusTransport * | transport | ) |

If the transport has already been authenticated, return its credentials.

If not, return NULL.

The caller must ref the returned credentials object if it wants to keep it.

Definition at line 1489 of file dbus-transport.c.

References _dbus_auth_get_identity(), DBusTransport::auth, DBusTransport::authenticated, and FALSE.

## _dbus_transport_get_dispatch_status()

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).

Parameters

  transport | the transport

Returns
  current status

Definition at line 1127 of file dbus-transport.c.

References _dbus_auth_do_work(), _dbus_counter_get_size_value(), _dbus_counter_get_unix_fd_value(), _dbus_message_loader_peek_message(), _dbus_message_loader_queue_messages(), _dbus_transport_try_to_authenticate(), DBusTransport::auth, DBUS_DISPATCH_COMPLETE, DBUS_DISPATCH_DATA_REMAINS, DBUS_DISPATCH_NEED_MEMORY, DBusTransport::live_messages, DBusTransport::loader, DBusTransport::max_live_messages_size, DBusTransport::max_live_messages_unix_fds, NULL, TRUE, and DBusTransport::unused_bytes_recovered.

Referenced by _dbus_transport_queue_messages().

## _dbus_transport_get_is_anonymous()

dbus_bool_t _dbus_transport_get_is_anonymous | ( | DBusTransport * | transport | ) |

See dbus_connection_get_is_anonymous().

Parameters

  transport | the transport

Returns
  TRUE if not authenticated or authenticated as anonymous

Definition at line 839 of file dbus-transport.c.

References _dbus_auth_get_identity(), _dbus_credentials_are_anonymous(), DBusTransport::auth, DBusTransport::authenticated, FALSE, and TRUE.

Referenced by dbus_connection_get_is_anonymous().

## _dbus_transport_get_is_connected()

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.

Parameters

  transport | the transport.

Returns
  whether we're connected

Definition at line 536 of file dbus-transport.c.

References DBusTransport::disconnected.

Referenced by dbus_connection_unref().

## _dbus_transport_get_linux_security_label()

dbus_bool_t _dbus_transport_get_linux_security_label | ( | DBusTransport * | transport,
|  | char ** | label_p )

Definition at line 1455 of file dbus-transport.c.

## _dbus_transport_get_max_message_size()

long _dbus_transport_get_max_message_size | ( | DBusTransport * | transport | ) |

See dbus_connection_get_max_message_size().

Parameters

  transport | the transport

Returns
  max message size

Definition at line 1251 of file dbus-transport.c.

References _dbus_message_loader_get_max_message_size(), and DBusTransport::loader.

Referenced by dbus_connection_get_max_message_size().

## _dbus_transport_get_max_message_unix_fds()

long _dbus_transport_get_max_message_unix_fds | ( | DBusTransport * | transport | ) |

See dbus_connection_get_max_message_unix_fds().

Parameters

  transport | the transport

Returns
  max message unix fds

Definition at line 1263 of file dbus-transport.c.

References _dbus_message_loader_get_max_message_unix_fds(), and DBusTransport::loader.

Referenced by dbus_connection_get_max_message_unix_fds().

## _dbus_transport_get_max_received_size()

long _dbus_transport_get_max_received_size | ( | DBusTransport * | transport | ) |

See dbus_connection_get_max_received_size().

Parameters

  transport | the transport

Returns
  max bytes for all live messages

Definition at line 1311 of file dbus-transport.c.

References DBusTransport::max_live_messages_size.

Referenced by dbus_connection_get_max_received_size().

## _dbus_transport_get_max_received_unix_fds()

long _dbus_transport_get_max_received_unix_fds | ( | DBusTransport * | transport | ) |

See dbus_connection_set_max_received_unix_fds().

Parameters

  transport | the transport

Returns
  max unix fds for all live messages

Definition at line 1323 of file dbus-transport.c.

References DBusTransport::max_live_messages_unix_fds.

Referenced by dbus_connection_get_max_received_unix_fds().

## _dbus_transport_get_pending_fds_count()

int _dbus_transport_get_pending_fds_count | ( | DBusTransport * | transport | ) |

Return how many file descriptors are pending in the loader.

Parameters

  transport | the transport

Definition at line 1590 of file dbus-transport.c.

References _dbus_message_loader_get_pending_fds_count(), and DBusTransport::loader.

Referenced by _dbus_connection_get_pending_fds_count().

## _dbus_transport_get_server_id()

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.

Parameters

  transport | the transport

Returns
  transport's server's id or NULL if we are the server side

Definition at line 887 of file dbus-transport.c.

References _dbus_auth_get_guid_from_server(), DBusTransport::auth, DBusTransport::authenticated, DBusTransport::expected_guid, DBusTransport::is_server, and NULL.

Referenced by dbus_connection_get_server_id().

## _dbus_transport_get_socket_fd()

dbus_bool_t _dbus_transport_get_socket_fd | ( | DBusTransport * | transport,
|  | DBusSocket * | fd_p )

Get the socket file descriptor, if any.

Parameters

  transport | the transport
  fd_p | pointer to fill in with the descriptor

Returns
  TRUE if a descriptor was available

Definition at line 969 of file dbus-transport.c.

References _dbus_transport_ref(), _dbus_transport_unref(), DBusTransport::disconnected, FALSE, DBusTransportVTable::get_socket_fd, NULL, and DBusTransport::vtable.

Referenced by dbus_connection_get_socket().

## _dbus_transport_get_unix_process_id()

dbus_bool_t _dbus_transport_get_unix_process_id | ( | DBusTransport * | transport,
|  | unsigned long * | pid )

See dbus_connection_get_unix_process_id().

Parameters

  transport | the transport
  pid | return location for the process ID

Returns
  TRUE if uid is filled in with a valid process ID

Definition at line 1369 of file dbus-transport.c.

References _dbus_auth_get_identity(), _dbus_credentials_get_pid(), _dbus_credentials_include(), DBusTransport::auth, DBusTransport::authenticated, DBUS_PID_UNSET, FALSE, and TRUE.

Referenced by dbus_connection_get_unix_process_id().

## _dbus_transport_get_unix_user()

dbus_bool_t _dbus_transport_get_unix_user | ( | DBusTransport * | transport,
|  | unsigned long * | uid )

See dbus_connection_get_unix_user().

Parameters

  transport | the transport
  uid | return location for the user ID

Returns
  TRUE if uid is filled in with a valid user ID

Definition at line 1336 of file dbus-transport.c.

References _dbus_auth_get_identity(), _dbus_credentials_get_unix_uid(), _dbus_credentials_include(), _DBUS_INT32_MAX, DBusTransport::auth, DBusTransport::authenticated, FALSE, and TRUE.

Referenced by dbus_connection_get_unix_user().

## _dbus_transport_get_windows_user()

dbus_bool_t _dbus_transport_get_windows_user | ( | DBusTransport * | transport,
|  | char ** | windows_sid_p )

See dbus_connection_get_windows_user().

Parameters

  transport | the transport
  windows_sid_p | return location for the user ID

Returns
  TRUE if user is available; the returned value may still be NULL if no memory to copy it

Definition at line 1505 of file dbus-transport.c.

References _dbus_auth_get_identity(), _dbus_credentials_get_windows_sid(), _dbus_credentials_include(), _dbus_strdup(), DBusTransport::auth, DBusTransport::authenticated, FALSE, NULL, and TRUE.

Referenced by dbus_connection_get_windows_user().

## _dbus_transport_handle_watch()

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.

Parameters

  transport | the transport.
  watch | the watch.
  condition | the current state of the watched file descriptor.

Returns
  FALSE if not enough memory to fully handle the watch

Definition at line 907 of file dbus-transport.c.

References _dbus_assert, _dbus_transport_ref(), _dbus_transport_unref(), _dbus_warn_check_failed(), _dbus_watch_ref(), _dbus_watch_sanitize_condition(), _dbus_watch_unref(), dbus_watch_get_socket(), DBusTransport::disconnected, DBusTransportVTable::handle_watch, NULL, TRUE, and DBusTransport::vtable.

Referenced by _dbus_connection_handle_watch().

## _dbus_transport_init_base()

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.

Parameters

  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

Returns
  TRUE on success.

Definition at line 104 of file dbus-transport.c.

References _dbus_assert, _dbus_auth_client_new(), _dbus_auth_server_new(), _dbus_auth_unref(), _dbus_counter_new(), _dbus_counter_set_notify(), _dbus_counter_unref(), _dbus_credentials_new(), _dbus_credentials_unref(), _dbus_message_loader_new(), _dbus_message_loader_unref(), _dbus_string_copy_data(), DBusTransport::address, DBusTransport::auth, DBusTransport::authenticated, DBusTransport::credentials, DBusTransport::disconnected, DBusTransport::expected_guid, FALSE, DBusTransport::free_unix_user_data, DBusTransport::free_windows_user_data, DBusTransport::is_server, DBusTransport::live_messages, DBusTransport::loader, DBusTransport::max_live_messages_size, DBusTransport::max_live_messages_unix_fds, NULL, DBusTransport::receive_credentials_pending, DBusTransport::refcount, DBusTransport::send_credentials_pending, TRUE, DBusTransport::unix_user_data, DBusTransport::unix_user_function, DBusTransport::vtable, DBusTransport::windows_user_data, and DBusTransport::windows_user_function.

Referenced by _dbus_transport_new_for_socket().

## _dbus_transport_open()

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.)

Parameters

  entry | the address entry
  error | location to store reason for failure.

Returns
  new transport of NULL on failure.

Definition at line 373 of file dbus-transport.c.

References _dbus_assert_not_reached, _DBUS_N_ELEMENTS, _dbus_set_bad_address(), _dbus_strdup(), dbus_address_entry_get_value(), DBUS_ERROR_INIT, dbus_error_is_set(), dbus_free(), dbus_move_error(), DBusTransport::expected_guid, and NULL.

## _dbus_transport_peek_is_authenticated()

dbus_bool_t _dbus_transport_peek_is_authenticated | ( | DBusTransport * | transport | ) |

Returns TRUE if we have been authenticated.

It will return TRUE even if the transport is now disconnected, but was ever authenticated before disconnecting.

This replaces the older _dbus_transport_get_is_authenticated() which had side-effects.

Parameters

  transport | the transport

Returns
  whether we're authenticated

Definition at line 710 of file dbus-transport.c.

References DBusTransport::authenticated.

Referenced by _dbus_connection_queue_received_message_link().

## _dbus_transport_queue_messages()

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.

Parameters

  transport | the transport

Returns
  TRUE if we had enough memory to queue all messages

Definition at line 1166 of file dbus-transport.c.

References _dbus_assert, _dbus_connection_queue_received_message_link(), _dbus_message_add_counter(), _dbus_message_loader_get_is_corrupted(), _dbus_message_loader_pop_message_link(), _dbus_message_loader_putback_message_link(), _dbus_transport_disconnect(), _dbus_transport_get_dispatch_status(), DBusTransport::connection, DBusList::data, DBUS_DISPATCH_DATA_REMAINS, DBUS_DISPATCH_NEED_MEMORY, DBusTransport::live_messages, DBusTransportVTable::live_messages_changed, DBusTransport::loader, NULL, and DBusTransport::vtable.

## _dbus_transport_ref()

DBusTransport * _dbus_transport_ref | ( | DBusTransport * | transport | ) |

Increments the reference count for the transport.

Parameters

  transport | the transport.

Returns
  the transport.

Definition at line 469 of file dbus-transport.c.

References _dbus_assert, and DBusTransport::refcount.

Referenced by _dbus_connection_new_for_transport(), _dbus_transport_do_iteration(), _dbus_transport_get_socket_fd(), _dbus_transport_handle_watch(), and _dbus_transport_set_connection().

## _dbus_transport_set_allow_anonymous()

void _dbus_transport_set_allow_anonymous | ( | DBusTransport * | transport,
|  | dbus_bool_t | value )

See dbus_connection_set_allow_anonymous().

Parameters

  transport | the transport
  value | TRUE to allow anonymous connection

Definition at line 1578 of file dbus-transport.c.

References DBusTransport::allow_anonymous, and FALSE.

Referenced by dbus_connection_set_allow_anonymous().

## _dbus_transport_set_auth_mechanisms()

dbus_bool_t _dbus_transport_set_auth_mechanisms | ( | DBusTransport * | transport,
|  | const char ** | mechanisms )

Sets the SASL authentication mechanisms supported by this transport.

Parameters

  transport | the transport
  mechanisms | the NULL-terminated array of mechanisms

Returns
  FALSE if no memory

Definition at line 1565 of file dbus-transport.c.

References _dbus_auth_set_mechanisms(), and DBusTransport::auth.

## _dbus_transport_set_connection()

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.

Parameters

  transport | the transport.
  connection | the connection.

Returns
  FALSE if not enough memory

Definition at line 945 of file dbus-transport.c.

References _dbus_assert, _dbus_transport_ref(), _dbus_transport_unref(), DBusTransport::connection, DBusTransportVTable::connection_set, NULL, and DBusTransport::vtable.

Referenced by _dbus_connection_new_for_transport().

## _dbus_transport_set_max_message_size()

void _dbus_transport_set_max_message_size | ( | DBusTransport * | transport,
|  | long | size )

See dbus_connection_set_max_message_size().

Parameters

  transport | the transport
  size | the max size of a single message

Definition at line 1225 of file dbus-transport.c.

References _dbus_message_loader_set_max_message_size(), and DBusTransport::loader.

Referenced by dbus_connection_set_max_message_size().

## _dbus_transport_set_max_message_unix_fds()

void _dbus_transport_set_max_message_unix_fds | ( | DBusTransport * | transport,
|  | long | n )

See dbus_connection_set_max_message_unix_fds().

Parameters

  transport | the transport
  n | the max number of unix fds of a single message

Definition at line 1238 of file dbus-transport.c.

References _dbus_message_loader_set_max_message_unix_fds(), and DBusTransport::loader.

Referenced by dbus_connection_set_max_message_unix_fds().

## _dbus_transport_set_max_received_size()

void _dbus_transport_set_max_received_size | ( | DBusTransport * | transport,
|  | long | size )

See dbus_connection_set_max_received_size().

Parameters

  transport | the transport
  size | the max size of all incoming messages

Definition at line 1275 of file dbus-transport.c.

References _dbus_counter_set_notify(), DBusTransport::live_messages, DBusTransport::max_live_messages_size, and DBusTransport::max_live_messages_unix_fds.

Referenced by dbus_connection_set_max_received_size().

## _dbus_transport_set_max_received_unix_fds()

void _dbus_transport_set_max_received_unix_fds | ( | DBusTransport * | transport,
|  | long | n )

See dbus_connection_set_max_received_unix_fds().

Parameters

  transport | the transport
  n | the max unix fds of all incoming messages

Definition at line 1293 of file dbus-transport.c.

References _dbus_counter_set_notify(), DBusTransport::live_messages, DBusTransport::max_live_messages_size, and DBusTransport::max_live_messages_unix_fds.

Referenced by dbus_connection_set_max_received_unix_fds().

## _dbus_transport_set_pending_fds_function()

void _dbus_transport_set_pending_fds_function | ( | DBusTransport * | transport,
|  | void(* | callback )(void *),
|  | void * | data )

Register a function to be called whenever the number of pending file descriptors in the loader change.

Parameters

  transport | the transport
  callback | the callback

Definition at line 1603 of file dbus-transport.c.

References _dbus_message_loader_set_pending_fds_function(), and DBusTransport::loader.

Referenced by _dbus_connection_set_pending_fds_function().

## _dbus_transport_set_unix_user_function()

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().

Parameters

  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 1439 of file dbus-transport.c.

References DBusTransport::free_unix_user_data, DBusTransport::unix_user_data, and DBusTransport::unix_user_function.

Referenced by dbus_connection_set_unix_user_function().

## _dbus_transport_set_windows_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().

Parameters

  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 1541 of file dbus-transport.c.

References DBusTransport::free_windows_user_data, DBusTransport::windows_user_data, and DBusTransport::windows_user_function.

Referenced by dbus_connection_set_windows_user_function().

## _dbus_transport_try_to_authenticate()

dbus_bool_t _dbus_transport_try_to_authenticate | ( | DBusTransport * | transport | ) |

Returns TRUE if we have been authenticated.

It will return TRUE even if the transport is now disconnected, but was ever authenticated before disconnecting.

If we have not finished authenticating, but we have enough buffered input to finish the job, then this function will do so before it returns.

This used to be called _dbus_transport_get_is_authenticated(), but that name seems inappropriate for a function with side-effects.

Parameters

  transport | the transport

Returns
  whether we're authenticated

Definition at line 733 of file dbus-transport.c.

References _dbus_assert, _dbus_assert_not_reached, _dbus_auth_do_work(), _dbus_auth_get_guid_from_server(), _dbus_auth_get_identity(), _dbus_connection_ref_unlocked(), _dbus_connection_unref_unlocked(), _dbus_credentials_include(), _dbus_transport_disconnect(), DBusTransport::auth, DBusTransport::authenticated, DBusTransport::connection, DBusTransport::disconnected, DBusTransport::expected_guid, FALSE, DBusTransport::is_server, NULL, DBusTransport::receive_credentials_pending, DBusTransport::send_credentials_pending, TRUE, DBusTransport::unix_user_function, and DBusTransport::windows_user_function.

Referenced by _dbus_transport_get_dispatch_status(), dbus_connection_get_adt_audit_session_data(), dbus_connection_get_is_authenticated(), dbus_connection_get_unix_process_id(), dbus_connection_get_unix_user(), and dbus_connection_get_windows_user().

## _dbus_transport_unref()

void _dbus_transport_unref | ( | DBusTransport * | transport | ) |

Decrements the reference count for the transport.

Disconnects and finalizes the transport if the reference count reaches zero.

Parameters

  transport | the transport.

Definition at line 486 of file dbus-transport.c.

References _dbus_assert, DBusTransportVTable::finalize, NULL, DBusTransport::refcount, and DBusTransport::vtable.

Referenced by _dbus_transport_do_iteration(), _dbus_transport_get_socket_fd(), _dbus_transport_handle_watch(), and _dbus_transport_set_connection().

## Variable Documentation

## []

DBusTransportOpenResult(* { ... } ::func) (DBusAddressEntry *entry, DBusTransport **transport_p, DBusError *error)

Definition at line 348 of file dbus-transport.c.