Data Structures | |
struct | DBusMessageLoader |
Implementation details of DBusMessageLoader. More... | |
struct | DBusMessage |
Internals of DBusMessage. More... | |
struct | DBusMessageRealIter |
Internals of DBusMessageIter. More... | |
Defines | |
#define | CHANGED_STAMP_BITS 21 |
How many bits are in the changed_stamp used to validate iterators. | |
#define | ensure_byte_order(message) |
#define | INITIAL_LOADER_DATA_LEN 32 |
The initial buffer size of the message loader. | |
Typedefs | |
typedef DBusMessageRealIter | DBusMessageRealIter |
typedef for internals of message iterator | |
typedef DBusMessageLoader | DBusMessageLoader |
The DBusMessageLoader object encapsulates the process of converting a byte stream into a series of DBusMessage. | |
Enumerations | |
enum | { DBUS_MESSAGE_ITER_TYPE_READER = 3, DBUS_MESSAGE_ITER_TYPE_WRITER = 7 } |
Functions | |
dbus_bool_t | _dbus_message_iter_get_args_valist (DBusMessageIter *iter, DBusError *error, int first_arg_type, va_list var_args) |
This function takes a va_list for use by language bindings and is otherwise the same as dbus_message_iter_get_args(). | |
_DBUS_STRING_DEFINE_STATIC (_dbus_empty_signature_str,"") | |
An static string representing an empty signature. | |
void | _dbus_message_get_network_data (DBusMessage *message, const DBusString **header, const DBusString **body) |
Gets the data to be sent over the network for this message. | |
void | _dbus_message_set_serial (DBusMessage *message, dbus_uint32_t serial) |
Sets the serial number of a message. | |
void | _dbus_message_add_size_counter_link (DBusMessage *message, DBusList *link) |
Adds a counter to be incremented immediately with the size of this message, and decremented by the size of this message when this message if finalized. | |
dbus_bool_t | _dbus_message_add_size_counter (DBusMessage *message, DBusCounter *counter) |
Adds a counter to be incremented immediately with the size of this message, and decremented by the size of this message when this message if finalized. | |
void | _dbus_message_remove_size_counter (DBusMessage *message, DBusCounter *counter, DBusList **link_return) |
Removes a counter tracking the size of this message, and decrements the counter by the size of this message. | |
void | _dbus_message_lock (DBusMessage *message) |
Locks a message. | |
DBusMessageLoader * | _dbus_message_loader_new (void) |
Creates a new message loader. | |
DBusMessageLoader * | _dbus_message_loader_ref (DBusMessageLoader *loader) |
Increments the reference count of the loader. | |
void | _dbus_message_loader_unref (DBusMessageLoader *loader) |
Decrements the reference count of the loader and finalizes the loader when the count reaches zero. | |
void | _dbus_message_loader_get_buffer (DBusMessageLoader *loader, DBusString **buffer) |
Gets the buffer to use for reading data from the network. | |
void | _dbus_message_loader_return_buffer (DBusMessageLoader *loader, DBusString *buffer, int bytes_read) |
Returns a buffer obtained from _dbus_message_loader_get_buffer(), indicating to the loader how many bytes of the buffer were filled in. | |
dbus_bool_t | _dbus_message_loader_queue_messages (DBusMessageLoader *loader) |
Converts buffered data into messages, if we have enough data. | |
DBusMessage * | _dbus_message_loader_peek_message (DBusMessageLoader *loader) |
Peeks at first loaded message, returns NULL if no messages have been queued. | |
DBusMessage * | _dbus_message_loader_pop_message (DBusMessageLoader *loader) |
Pops a loaded message (passing ownership of the message to the caller). | |
DBusList * | _dbus_message_loader_pop_message_link (DBusMessageLoader *loader) |
Pops a loaded message inside a list link (passing ownership of the message and link to the caller). | |
void | _dbus_message_loader_putback_message_link (DBusMessageLoader *loader, DBusList *link) |
Returns a popped message link, used to undo a pop. | |
dbus_bool_t | _dbus_message_loader_get_is_corrupted (DBusMessageLoader *loader) |
Checks whether the loader is confused due to bad data. | |
void | _dbus_message_loader_set_max_message_size (DBusMessageLoader *loader, long size) |
Sets the maximum size message we allow. | |
long | _dbus_message_loader_get_max_message_size (DBusMessageLoader *loader) |
Gets the maximum allowed message size in bytes. | |
dbus_bool_t | dbus_message_allocate_data_slot (dbus_int32_t *slot_p) |
Allocates an integer ID to be used for storing application-specific data on any DBusMessage. | |
void | dbus_message_free_data_slot (dbus_int32_t *slot_p) |
Deallocates a global ID for message data slots. | |
dbus_bool_t | dbus_message_set_data (DBusMessage *message, dbus_int32_t slot, void *data, DBusFreeFunction free_data_func) |
Stores a pointer on a DBusMessage, along with an optional function to be used for freeing the data when the data is set again, or when the message is finalized. | |
void * | dbus_message_get_data (DBusMessage *message, dbus_int32_t slot) |
Retrieves data previously set with dbus_message_set_data(). | |
int | dbus_message_type_from_string (const char *type_str) |
Utility function to convert a machine-readable (not translated) string into a D-BUS message type. | |
const char * | dbus_message_type_to_string (int type) |
Utility function to convert a D-BUS message type into a machine-readable string (not translated). |
The guts of DBusMessage and its methods.
|
Value: if (message->byte_order != DBUS_COMPILER_BYTE_ORDER) \
_dbus_message_byteswap (message)
Definition at line 129 of file dbus-message.c. |
|
The initial buffer size of the message loader.
Definition at line 3118 of file dbus-message.c. Referenced by _dbus_message_loader_new(). |
|
The DBusMessageLoader object encapsulates the process of converting a byte stream into a series of DBusMessage. It buffers the incoming bytes as efficiently as possible, and generates a queue of messages. DBusMessageLoader is typically used as part of a DBusTransport implementation. The DBusTransport then hands off the loaded messages to a DBusConnection, making the messages visible to the application.
Definition at line 32 of file dbus-message-internal.h. |
|
Adds a counter to be incremented immediately with the size of this message, and decremented by the size of this message when this message if finalized.
Definition at line 221 of file dbus-message.c. References _dbus_counter_ref(), _dbus_list_alloc_link(), _dbus_message_add_size_counter_link(), FALSE, NULL, and TRUE. Referenced by _dbus_transport_queue_messages(). |
|
Adds a counter to be incremented immediately with the size of this message, and decremented by the size of this message when this message if finalized. The link contains a counter with its refcount already incremented, but the counter itself not incremented. Ownership of link and counter refcount is passed to the message.
Definition at line 185 of file dbus-message.c. References _dbus_counter_adjust(), _dbus_list_append_link(), DBusMessage::body, DBusList::data, DBusHeader::data, DBusMessage::header, NULL, DBusMessage::size_counter_delta, and DBusMessage::size_counters. Referenced by _dbus_message_add_size_counter(). |
|
Gets the data to be sent over the network for this message. The header and then the body should be written out. This function is guaranteed to always return the same data once a message is locked (with _dbus_message_lock()).
Definition at line 144 of file dbus-message.c. References _dbus_assert, DBusMessage::body, DBusHeader::data, DBusMessage::header, and DBusMessage::locked. |
|
This function takes a va_list for use by language bindings and is otherwise the same as dbus_message_iter_get_args(). dbus_message_get_args() is the place to go for complete documentation.
Definition at line 1761 of file dbus-message.c. References _dbus_assert, _dbus_strdup(), _dbus_type_reader_get_current_type(), _dbus_type_reader_get_element_type(), _dbus_type_reader_next(), _dbus_type_reader_read_basic(), _dbus_type_reader_read_fixed_multi(), _dbus_type_reader_recurse(), _dbus_type_to_string(), _dbus_warn(), dbus_free_string_array(), dbus_message_iter_get_arg_type(), dbus_new0, dbus_set_error(), dbus_type_is_basic(), dbus_type_is_fixed(), FALSE, NULL, and TRUE. Referenced by dbus_message_get_args_valist(). |
|
Gets the buffer to use for reading data from the network. Network data is read directly into an allocated buffer, which is then used in the DBusMessage, to avoid as many extra memcpy's as possible. The buffer must always be returned immediately using _dbus_message_loader_return_buffer(), even if no bytes are successfully read.
Definition at line 3210 of file dbus-message.c. References _dbus_assert, DBusMessageLoader::buffer_outstanding, DBusMessageLoader::data, and TRUE. |
|
Checks whether the loader is confused due to bad data. If messages are received that are invalid, the loader gets confused and gives up permanently. This state is called "corrupted."
Definition at line 3537 of file dbus-message.c. References _dbus_assert, DBusMessageLoader::corrupted, and DBusMessageLoader::corruption_reason. Referenced by _dbus_transport_queue_messages(). |
|
Gets the maximum allowed message size in bytes.
Definition at line 3570 of file dbus-message.c. References DBusMessageLoader::max_message_size. Referenced by _dbus_transport_get_max_message_size(). |
|
Creates a new message loader. Returns NULL if memory can't be allocated.
Definition at line 3127 of file dbus-message.c. References _dbus_string_init(), _dbus_string_set_length(), DBusMessageLoader::corrupted, DBusMessageLoader::corruption_reason, DBusMessageLoader::data, dbus_free(), dbus_new0, FALSE, INITIAL_LOADER_DATA_LEN, DBusMessageLoader::max_message_size, NULL, and DBusMessageLoader::refcount. Referenced by _dbus_transport_init_base(). |
|
Peeks at first loaded message, returns NULL if no messages have been queued.
Definition at line 3478 of file dbus-message.c. References DBusList::data, DBusMessageLoader::messages, and NULL. Referenced by _dbus_transport_get_dispatch_status(). |
|
Pops a loaded message (passing ownership of the message to the caller). Returns NULL if no messages have been queued.
Definition at line 3495 of file dbus-message.c. References _dbus_list_pop_first(), and DBusMessageLoader::messages. |
|
Pops a loaded message inside a list link (passing ownership of the message and link to the caller). Returns NULL if no messages have been loaded.
Definition at line 3509 of file dbus-message.c. References _dbus_list_pop_first_link(), and DBusMessageLoader::messages. Referenced by _dbus_transport_queue_messages(). |
|
Returns a popped message link, used to undo a pop.
Definition at line 3521 of file dbus-message.c. References _dbus_list_prepend_link(), and DBusMessageLoader::messages. Referenced by _dbus_transport_queue_messages(). |
|
Converts buffered data into messages, if we have enough data. If we don't have enough data, does nothing.
Definition at line 3415 of file dbus-message.c. References _dbus_assert, _dbus_header_have_message_untrusted(), _dbus_list_find_last(), DBusMessageLoader::corrupted, DBusMessageLoader::corruption_reason, DBusMessageLoader::data, dbus_message_unref(), FALSE, DBusMessageLoader::max_message_size, NULL, and TRUE. Referenced by _dbus_transport_get_dispatch_status(). |
|
Increments the reference count of the loader.
Definition at line 3163 of file dbus-message.c. References DBusMessageLoader::refcount. |
|
Returns a buffer obtained from _dbus_message_loader_get_buffer(), indicating to the loader how many bytes of the buffer were filled in. This function must always be called, even if no bytes were successfully read.
Definition at line 3231 of file dbus-message.c. References _dbus_assert, DBusMessageLoader::buffer_outstanding, DBusMessageLoader::data, and FALSE. |
|
Sets the maximum size message we allow.
Definition at line 3551 of file dbus-message.c. References DBusMessageLoader::max_message_size. Referenced by _dbus_transport_set_max_message_size(). |
|
Decrements the reference count of the loader and finalizes the loader when the count reaches zero.
Definition at line 3177 of file dbus-message.c. References _dbus_list_clear(), _dbus_list_foreach(), _dbus_string_free(), DBusMessageLoader::data, dbus_free(), dbus_message_unref(), DBusMessageLoader::messages, NULL, and DBusMessageLoader::refcount. Referenced by _dbus_transport_finalize_base(), and _dbus_transport_init_base(). |
|
Locks a message. Allows checking that applications don't keep a reference to a message in the outgoing queue and change it underneath us. Messages are locked when they enter the outgoing queue (dbus_connection_send_message()), and the library complains if the message is modified while locked.
Definition at line 277 of file dbus-message.c. References _dbus_assert, _dbus_header_update_lengths(), DBusMessage::body, dbus_message_get_signature(), DBusMessage::header, DBusMessage::locked, NULL, and TRUE. |
|
Removes a counter tracking the size of this message, and decrements the counter by the size of this message.
Definition at line 245 of file dbus-message.c. References _dbus_assert, _dbus_counter_adjust(), _dbus_counter_unref(), _dbus_list_find_last(), _dbus_list_free_link(), _dbus_list_unlink(), NULL, DBusMessage::size_counter_delta, and DBusMessage::size_counters. Referenced by _dbus_connection_message_sent(). |
|
Sets the serial number of a message. This can only be done once on a message.
Definition at line 162 of file dbus-message.c. References _dbus_assert, _dbus_header_set_serial(), dbus_message_get_serial(), DBusMessage::locked, and NULL. Referenced by dbus_connection_send_with_reply(). |
|
Allocates an integer ID to be used for storing application-specific data on any DBusMessage. The allocated ID may then be used with dbus_message_set_data() and dbus_message_get_data(). The passed-in slot must be initialized to -1, and is filled in with the slot ID. If the passed-in slot is not -1, it's assumed to be already allocated, and its refcount is incremented. The allocated slot is global, i.e. all DBusMessage objects will have a slot with the given integer ID reserved.
Definition at line 3593 of file dbus-message.c. References _dbus_data_slot_allocator_alloc(), and _DBUS_LOCK_NAME. |
|
Deallocates a global ID for message data slots. dbus_message_get_data() and dbus_message_set_data() may no longer be used with this slot. Existing data stored on existing DBusMessage objects will be freed when the message is finalized, but may not be retrieved (and may only be replaced if someone else reallocates the slot). When the refcount on the passed-in slot reaches 0, it is set to -1.
Definition at line 3612 of file dbus-message.c. References _dbus_data_slot_allocator_free(). |
|
Retrieves data previously set with dbus_message_set_data(). The slot must still be allocated (must not have been freed).
Definition at line 3669 of file dbus-message.c. References _dbus_data_slot_list_get(), NULL, and DBusMessage::slot_list. |
|
Stores a pointer on a DBusMessage, along with an optional function to be used for freeing the data when the data is set again, or when the message is finalized. The slot number must have been allocated with dbus_message_allocate_data_slot().
Definition at line 3633 of file dbus-message.c. References _dbus_data_slot_list_set(), FALSE, NULL, and DBusMessage::slot_list. |
|
Utility function to convert a machine-readable (not translated) string into a D-BUS message type.
"method_call" -> DBUS_MESSAGE_TYPE_METHOD_CALL "method_return" -> DBUS_MESSAGE_TYPE_METHOD_RETURN "signal" -> DBUS_MESSAGE_TYPE_SIGNAL "error" -> DBUS_MESSAGE_TYPE_ERROR anything else -> DBUS_MESSAGE_TYPE_INVALID Definition at line 3697 of file dbus-message.c. |
|
Utility function to convert a D-BUS message type into a machine-readable string (not translated).
DBUS_MESSAGE_TYPE_METHOD_CALL -> "method_call" DBUS_MESSAGE_TYPE_METHOD_RETURN -> "method_return" DBUS_MESSAGE_TYPE_SIGNAL -> "signal" DBUS_MESSAGE_TYPE_ERROR -> "error" DBUS_MESSAGE_TYPE_INVALID -> "invalid" Definition at line 3725 of file dbus-message.c. |