diff options
author | Havoc Pennington <hp@redhat.com> | 2003-01-31 23:28:09 +0000 |
---|---|---|
committer | Havoc Pennington <hp@redhat.com> | 2003-01-31 23:28:09 +0000 |
commit | 0ff552a2c5c542a1be9a1c73597c298e6ece358f (patch) | |
tree | 96633d71acfbab9572818afd185406074142836a /dbus | |
parent | 8ab042b9571dda44a5afcfe50e0d29dc9b58ecae (diff) |
2003-01-31 Havoc Pennington <hp@pobox.com>
* dbus/dbus-message.c (dbus_message_set_is_error_reply): rename
just set_is_error/get_is_error as this is a commonly-used
function, and write docs.
Diffstat (limited to 'dbus')
-rw-r--r-- | dbus/dbus-message.c | 29 | ||||
-rw-r--r-- | dbus/dbus-message.h | 4 | ||||
-rw-r--r-- | dbus/dbus-protocol.h | 2 |
3 files changed, 24 insertions, 11 deletions
diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c index be76caa6..7875d90e 100644 --- a/dbus/dbus-message.c +++ b/dbus/dbus-message.c @@ -1635,9 +1635,16 @@ dbus_message_set_sender (DBusMessage *message, } } +/** + * Sets a flag indicating that the message is an error reply + * message, i.e. an "exception" rather than a normal response. + * + * @param message the message + * @param is_error_reply #TRUE if this is an error message. + */ void -dbus_message_set_is_error_reply (DBusMessage *message, - dbus_bool_t is_error_reply) +dbus_message_set_is_error (DBusMessage *message, + dbus_bool_t is_error_reply) { char *header; @@ -1646,20 +1653,26 @@ dbus_message_set_is_error_reply (DBusMessage *message, _dbus_string_get_data_len (&message->header, &header, 1, 1); if (is_error_reply) - *header |= DBUS_HEADER_FLAG_IS_ERROR_REPLY; + *header |= DBUS_HEADER_FLAG_ERROR; else - *header &= ~DBUS_HEADER_FLAG_IS_ERROR_REPLY; - + *header &= ~DBUS_HEADER_FLAG_ERROR; } +/** + * Returns #TRUE if the message is an error + * reply to some previous message we sent. + * + * @param message the message + * @returns #TRUE if the message is an error + */ dbus_bool_t -dbus_message_get_is_error_reply (DBusMessage *message) +dbus_message_get_is_error (DBusMessage *message) { const char *header; - _dbus_string_get_data_len (&message->header, &header, 1, 1); + _dbus_string_get_const_data_len (&message->header, &header, 1, 1); - return (*header & DBUS_HEADER_FLAG_IS_ERROR_REPLY) != 0; + return (*header & DBUS_HEADER_FLAG_ERROR) != 0; } /** diff --git a/dbus/dbus-message.h b/dbus/dbus-message.h index 0d6b533e..3bec8666 100644 --- a/dbus/dbus-message.h +++ b/dbus/dbus-message.h @@ -50,9 +50,9 @@ const char* dbus_message_get_service (DBusMessage *message); dbus_bool_t dbus_message_set_sender (DBusMessage *message, const char *sender); const char* dbus_message_get_sender (DBusMessage *message); -void dbus_message_set_is_error_reply (DBusMessage *message, +void dbus_message_set_is_error (DBusMessage *message, dbus_bool_t is_error_reply); -dbus_bool_t dbus_message_get_is_error_reply (DBusMessage *message); +dbus_bool_t dbus_message_get_is_error (DBusMessage *message); dbus_bool_t dbus_message_append_fields (DBusMessage *message, diff --git a/dbus/dbus-protocol.h b/dbus/dbus-protocol.h index a3450267..5ff6d580 100644 --- a/dbus/dbus-protocol.h +++ b/dbus/dbus-protocol.h @@ -53,7 +53,7 @@ extern "C" { #define DBUS_TYPE_STRING_ARRAY 10 /* Header flags */ -#define DBUS_HEADER_FLAG_IS_ERROR_REPLY 0x1 +#define DBUS_HEADER_FLAG_ERROR 0x1 /* Header fields */ #define DBUS_HEADER_FIELD_NAME "name" |