Typedefs | |
typedef DBusServer | DBusServer |
An opaque object representing a server that listens for connections from other applications. | |
Functions | |
DBusServer * | dbus_server_listen (const char *address, DBusError *error) |
Listens for new connections on the given address. | |
DBusServer * | dbus_server_ref (DBusServer *server) |
Increments the reference count of a DBusServer. | |
void | dbus_server_unref (DBusServer *server) |
Decrements the reference count of a DBusServer. | |
void | _dbus_server_ref_unlocked (DBusServer *server) |
Like dbus_server_ref() but does not acquire the lock (must already be held). | |
void | dbus_server_disconnect (DBusServer *server) |
Releases the server's address and stops listening for new clients. | |
dbus_bool_t | dbus_server_get_is_connected (DBusServer *server) |
Returns TRUE if the server is still listening for new connections. | |
char * | dbus_server_get_address (DBusServer *server) |
Returns the address of the server, as a newly-allocated string which must be freed by the caller. | |
void | dbus_server_set_new_connection_function (DBusServer *server, DBusNewConnectionFunction function, void *data, DBusFreeFunction free_data_function) |
Sets a function to be used for handling new connections. | |
dbus_bool_t | dbus_server_set_watch_functions (DBusServer *server, DBusAddWatchFunction add_function, DBusRemoveWatchFunction remove_function, DBusWatchToggledFunction toggled_function, void *data, DBusFreeFunction free_data_function) |
Sets the watch functions for the connection. | |
dbus_bool_t | dbus_server_set_timeout_functions (DBusServer *server, DBusAddTimeoutFunction add_function, DBusRemoveTimeoutFunction remove_function, DBusTimeoutToggledFunction toggled_function, void *data, DBusFreeFunction free_data_function) |
Sets the timeout functions for the connection. | |
dbus_bool_t | dbus_server_set_auth_mechanisms (DBusServer *server, const char **mechanisms) |
Sets the authentication mechanisms that this server offers to clients, as a list of SASL mechanisms. | |
dbus_bool_t | dbus_server_allocate_data_slot (dbus_int32_t *slot_p) |
Allocates an integer ID to be used for storing application-specific data on any DBusServer. | |
void | dbus_server_free_data_slot (dbus_int32_t *slot_p) |
Deallocates a global ID for server data slots. | |
dbus_bool_t | dbus_server_set_data (DBusServer *server, int slot, void *data, DBusFreeFunction free_data_func) |
Stores a pointer on a DBusServer, along with an optional function to be used for freeing the data when the data is set again, or when the server is finalized. | |
void * | dbus_server_get_data (DBusServer *server, int slot) |
Retrieves data previously set with dbus_server_set_data(). |
Types and functions related to DBusServer. A DBusServer represents a server that other applications can connect to. Each connection from another application is represented by a DBusConnection.
|
An opaque object representing a server that listens for connections from other applications. Each time a connection is made, a new DBusConnection is created and made available via an application-provided DBusNewConnectionFunction. The DBusNewConnectionFunction is provided with dbus_server_set_new_connection_function(). Definition at line 37 of file dbus-server.h. |
|
Like dbus_server_ref() but does not acquire the lock (must already be held).
Definition at line 537 of file dbus-server.c. References _dbus_assert, _dbus_atomic_inc(), and DBusAtomic::value. |
|
Allocates an integer ID to be used for storing application-specific data on any DBusServer. The allocated ID may then be used with dbus_server_set_data() and dbus_server_get_data(). The slot must be initialized with -1. If a nonnegative slot is passed in, the refcount is incremented on that slot, rather than creating a new slot. The allocated slot is global, i.e. all DBusServer objects will have a slot with the given integer ID reserved.
Definition at line 815 of file dbus-server.c. References _dbus_data_slot_allocator_alloc(), and _DBUS_LOCK_NAME. Referenced by dbus_server_setup_with_g_main(). |
|
Releases the server's address and stops listening for new clients. If called more than once, only the first call has an effect. Does not modify the server's reference count.
Definition at line 559 of file dbus-server.c. References _dbus_assert, NULL, and TRUE. Referenced by _dbus_server_finalize_base(). |
|
Deallocates a global ID for server data slots. dbus_server_get_data() and dbus_server_set_data() may no longer be used with this slot. Existing data stored on existing DBusServer objects will be freed when the server is finalized, but may not be retrieved (and may only be replaced if someone else reallocates the slot).
Definition at line 834 of file dbus-server.c. References _dbus_data_slot_allocator_free(). |
|
Returns the address of the server, as a newly-allocated string which must be freed by the caller.
Definition at line 603 of file dbus-server.c. References _dbus_strdup(), and NULL. |
|
Retrieves data previously set with dbus_server_set_data(). The slot must still be allocated (must not have been freed).
Definition at line 895 of file dbus-server.c. References _dbus_data_slot_list_get(), and NULL. Referenced by dbus_server_setup_with_g_main(). |
|
Returns TRUE if the server is still listening for new connections.
Definition at line 582 of file dbus-server.c. |
|
Listens for new connections on the given address. Returns NULL if listening fails for any reason. Otherwise returns a new DBusServer. dbus_server_set_new_connection_function() and dbus_server_set_watch_functions() should be called immediately to render the server fully functional.
Definition at line 292 of file dbus-server.c. References _dbus_concat_dir_and_file(), _dbus_generate_random_ascii(), _dbus_server_new_for_domain_socket(), _dbus_server_new_for_tcp_socket(), _dbus_string_append(), _dbus_string_free(), _dbus_string_init(), _dbus_string_init_const(), _dbus_string_parse_int(), dbus_address_entries_free(), dbus_address_entry_get_method(), dbus_address_entry_get_value(), dbus_parse_address(), dbus_set_error(), FALSE, NULL, and TRUE. |
|
Increments the reference count of a DBusServer.
Definition at line 478 of file dbus-server.c. References _dbus_assert, _dbus_atomic_inc(), NULL, refcount, and DBusAtomic::value. |
|
Sets the authentication mechanisms that this server offers to clients, as a list of SASL mechanisms. This function only affects connections created *after* it is called. Pass NULL instead of an array to use all available mechanisms.
Definition at line 770 of file dbus-server.c. References _dbus_dup_string_array(), dbus_free_string_array(), FALSE, NULL, and TRUE. |
|
Stores a pointer on a DBusServer, along with an optional function to be used for freeing the data when the data is set again, or when the server is finalized. The slot number must have been allocated with dbus_server_allocate_data_slot().
Definition at line 855 of file dbus-server.c. References _dbus_data_slot_list_set(), FALSE, and NULL. Referenced by dbus_server_setup_with_g_main(). |
|
Sets a function to be used for handling new connections. The given function is passed each new connection as the connection is created. If the new connection function increments the connection's reference count, the connection will stay alive. Otherwise, the connection will be unreferenced and closed.
Definition at line 629 of file dbus-server.c. References NULL. Referenced by _dbus_server_finalize_base(). |
|
Sets the timeout functions for the connection. These functions are responsible for making the application's main loop aware of timeouts. This function behaves exactly like dbus_connection_set_timeout_functions(); see the documentation for that routine.
Definition at line 722 of file dbus-server.c. References _dbus_timeout_list_set_functions(), _dbus_warn(), FALSE, NULL, and DBusTimeoutList::timeouts. Referenced by dbus_server_setup_with_g_main(). |
|
Sets the watch functions for the connection. These functions are responsible for making the application's main loop aware of file descriptors that need to be monitored for events. This function behaves exactly like dbus_connection_set_watch_functions(); see the documentation for that routine.
Definition at line 669 of file dbus-server.c. References _dbus_warn(), _dbus_watch_list_set_functions(), FALSE, NULL, and DBusWatchList::watches. Referenced by dbus_server_setup_with_g_main(). |
|
Decrements the reference count of a DBusServer. Finalizes the server if the reference count reaches zero. The server connection will be closed as with dbus_server_disconnect() when the server is finalized.
Definition at line 504 of file dbus-server.c. References _dbus_assert, _dbus_atomic_dec(), NULL, and DBusAtomic::value. |