Main Page   Modules   Data Structures   File List   Data Fields   Related Pages  

DBusTransport object
[D-BUS internal implementation details]

"Backend" for a DBusConnection. More...

Typedefs

typedef DBusTransport DBusTransport
 Opaque object representing a way message stream. More...


Functions

dbus_bool_t _dbus_transport_init_base (DBusTransport *transport, const DBusTransportVTable *vtable, dbus_bool_t server, const DBusString *address)
 Initializes the base class members of DBusTransport. More...

void _dbus_transport_finalize_base (DBusTransport *transport)
 Finalizes base class members of DBusTransport. More...

DBusTransport * _dbus_transport_open (const char *address, DBusError *error)
 Opens a new transport for the given address. More...

DBusTransport * _dbus_transport_ref (DBusTransport *transport)
 Increments the reference count for the transport. More...

void _dbus_transport_unref (DBusTransport *transport)
 Decrements the reference count for the transport. More...

void _dbus_transport_disconnect (DBusTransport *transport)
 Closes our end of the connection to a remote application. More...

dbus_bool_t _dbus_transport_get_is_connected (DBusTransport *transport)
 Returns TRUE if the transport has not been disconnected. More...

dbus_bool_t _dbus_transport_get_is_authenticated (DBusTransport *transport)
 Returns TRUE if we have been authenticated. More...

const char * _dbus_transport_get_address (DBusTransport *transport)
 Gets the address of a transport. More...

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

dbus_bool_t _dbus_transport_set_connection (DBusTransport *transport, DBusConnection *connection)
 Sets the connection using this transport. More...

void _dbus_transport_messages_pending (DBusTransport *transport, int queue_length)
 Notifies the transport when the outgoing message queue goes from empty to non-empty or vice versa. More...

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

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

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

void _dbus_transport_set_max_message_size (DBusTransport *transport, long size)
 See dbus_connection_set_max_message_size(). More...

long _dbus_transport_get_max_message_size (DBusTransport *transport)
 See dbus_connection_get_max_message_size(). More...

void _dbus_transport_set_max_received_size (DBusTransport *transport, long size)
 See dbus_connection_set_max_received_size(). More...

long _dbus_transport_get_max_received_size (DBusTransport *transport)
 See dbus_connection_get_max_received_size(). More...

dbus_bool_t _dbus_transport_get_unix_user (DBusTransport *transport, unsigned long *uid)
 See dbus_connection_get_unix_user(). More...

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

dbus_bool_t _dbus_transport_set_auth_mechanisms (DBusTransport *transport, const char **mechanisms)
 Sets the SASL authentication mechanisms supported by this transport. More...


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
 

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


Function Documentation

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

References DBusTransportVTable::disconnect, disconnected, and vtable.

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

References disconnected, DBusTransportVTable::do_iteration, and vtable.

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

References address, auth, disconnected, free_unix_user_data, live_messages_size, loader, and unix_user_data.

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

References address.

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

References auth, live_messages_size, loader, max_live_messages_size, and unused_bytes_recovered.

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.

Todo:
needs to drop connection->mutex when calling the unix_user_function
Parameters:
transport  the transport
Returns:
whether we're authenticated

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

References auth, authenticated, connection, disconnected, is_server, receive_credentials_pending, send_credentials_pending, DBusCredentials::uid, unix_user_data, and unix_user_function.

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

References disconnected.

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

References loader.

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

References max_live_messages_size.

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

References auth, authenticated, and DBusCredentials::uid.

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

References disconnected, DBusTransportVTable::handle_watch, and vtable.

dbus_bool_t _dbus_transport_init_base DBusTransport   transport,
const DBusTransportVTable   vtable,
dbus_bool_t    server,
const DBusString   address
 

Initializes the base class members of DBusTransport.

Chained up to by subclasses in their constructor.

Parameters:
transport  the transport being created.
vtable  the subclass vtable.
server  TRUE if this transport is on the server side of a connection
address  the address of the transport
Returns:
TRUE on success.

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

References address, auth, authenticated, credentials, disconnected, free_unix_user_data, DBusCredentials::gid, is_server, live_messages_size, loader, max_live_messages_size, messages_need_sending, DBusCredentials::pid, receive_credentials_pending, refcount, send_credentials_pending, DBusCredentials::uid, unix_user_data, unix_user_function, and vtable.

void _dbus_transport_messages_pending DBusTransport   transport,
int    queue_length
 

Notifies the transport when the outgoing message queue goes from empty to non-empty or vice versa.

Typically causes the transport to add or remove its DBUS_WATCH_WRITABLE watch.

Parameters:
transport  the transport.
queue_length  the length of the outgoing message queue.

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

References disconnected, messages_need_sending, DBusTransportVTable::messages_pending, and vtable.

DBusTransport* _dbus_transport_open const char *    address,
DBusError   error
 

Opens a new transport for the given address.

(This opens a client-side-of-the-connection transport.)

Todo:
error messages on bad address could really be better. DBusResultCode is a bit limiting here.
Parameters:
address  the address.
error  location to store reason for failure.
Returns:
new transport of NULL on failure.

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

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

References connection, DBusList::data, live_messages_size, and loader.

DBusTransport* _dbus_transport_ref DBusTransport   transport
 

Increments the reference count for the transport.

Parameters:
transport  the transport.
Returns:
the transport.

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

References refcount.

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

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

Parameters:
transport  the transport.
connection  the connection.
Returns:
FALSE if not enough memory

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

References connection, DBusTransportVTable::connection_set, and vtable.

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

References loader.

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

References live_messages_size, and max_live_messages_size.

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

References free_unix_user_data, unix_user_data, and unix_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.

Parameters:
transport  the transport.

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

References DBusTransportVTable::finalize, refcount, and vtable.


Generated on Wed Jun 9 05:01:28 2004 for D-BUS by doxygen1.2.15