+2003-01-31 Anders Carlsson <andersca@codefactory.se>
+
+ * dbus/dbus-address.c: (dbus_address_entry_free):
+ Free key and value lists.
+
+ * dbus/dbus-internals.c: (_dbus_type_to_string):
+ Add the types we didn't have.
+
+ * dbus/dbus-marshal.c: (_dbus_marshal_get_arg_end_pos),
+ (_dbus_marshal_validate_arg):
+ Add NIL types.
+
+ * dbus/dbus-message.c: (dbus_message_set_sender):
+ Remove todo about being able to set sender to NULL.
+
+ (dbus_message_set_is_error_reply),
+ (dbus_message_get_is_error_reply):
+ * dbus/dbus-message.h:
+ New functions.
+
+ * dbus/dbus-protocol.h:
+ Add error reply flag.
+
+ * test/data/valid-messages/opposite-endian.message:
+ Add NIL type to test.
+
2003-01-31 Havoc Pennington <hp@pobox.com>
* doc/dbus-specification.sgml: fully specify the header. Add
link = _dbus_list_get_next_link (&entry->keys, link);
}
-
+ _dbus_list_clear (&entry->keys);
+
link = _dbus_list_get_first_link (&entry->values);
while (link != NULL)
{
link = _dbus_list_get_next_link (&entry->values, link);
}
+ _dbus_list_clear (&entry->values);
dbus_free (entry);
}
/**
* Frees a #NULL-terminated array of address entries.
*
- * @todo dbus_address_entry_free() seems to leak list nodes
- *
* @param entries the array.
*/
void
{
case DBUS_TYPE_INVALID:
return "invalid";
+ case DBUS_TYPE_NIL:
+ return "nil";
case DBUS_TYPE_INT32:
return "int32";
case DBUS_TYPE_UINT32:
return "double";
case DBUS_TYPE_STRING:
return "string";
+ case DBUS_TYPE_INT32_ARRAY:
+ return "int32 array";
+ case DBUS_TYPE_UINT32_ARRAY:
+ return "uint32 array";
+ case DBUS_TYPE_DOUBLE_ARRAY:
+ return "double array";
case DBUS_TYPE_BYTE_ARRAY:
return "byte array";
+ case DBUS_TYPE_STRING_ARRAY:
+ return "string array";
default:
return "unknown";
}
return FALSE;
break;
+ case DBUS_TYPE_NIL:
+ *end_pos = pos + 1;
+
case DBUS_TYPE_INT32:
*end_pos = _DBUS_ALIGN_VALUE (pos + 1, sizeof (dbus_int32_t)) + sizeof (dbus_int32_t);
* @param str the string
* @param byte_order the byte order
* @param pos the unaligned string position (snap to next aligned)
+ * @param new_pos return location for new position.
*/
static int
demarshal_and_validate_len (const DBusString *str,
case DBUS_TYPE_INVALID:
return FALSE;
break;
+
+ case DBUS_TYPE_NIL:
+ *end_pos = pos + 1;
+ break;
case DBUS_TYPE_INT32:
case DBUS_TYPE_UINT32:
/**
* Sets the message sender.
*
- * @todo implement #NULL sender to unset
- *
* @param message the message
* @param sender the sender
* @returns #FALSE if not enough memory
}
}
+void
+dbus_message_set_is_error_reply (DBusMessage *message,
+ dbus_bool_t is_error_reply)
+{
+ char *header;
+
+ _dbus_assert (!message->locked);
+
+ _dbus_string_get_data_len (&message->header, &header, 1, 1);
+
+ if (is_error_reply)
+ *header |= DBUS_HEADER_FLAG_IS_ERROR_REPLY;
+ else
+ *header &= ~DBUS_HEADER_FLAG_IS_ERROR_REPLY;
+
+}
+
+dbus_bool_t
+dbus_message_get_is_error_reply (DBusMessage *message)
+{
+ const char *header;
+
+ _dbus_string_get_data_len (&message->header, &header, 1, 1);
+
+ return (*header & DBUS_HEADER_FLAG_IS_ERROR_REPLY) != 0;
+}
+
/**
* Gets the service which originated this message,
* or #NULL if unknown or inapplicable.
void dbus_message_ref (DBusMessage *message);
void dbus_message_unref (DBusMessage *message);
-const char* dbus_message_get_name (DBusMessage *message);
-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);
+const char* dbus_message_get_name (DBusMessage *message);
+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,
+ dbus_bool_t is_error_reply);
+dbus_bool_t dbus_message_get_is_error_reply (DBusMessage *message);
+
dbus_bool_t dbus_message_append_fields (DBusMessage *message,
int first_field_type,
#define DBUS_TYPE_BYTE_ARRAY 9
#define DBUS_TYPE_STRING_ARRAY 10
-#
+/* Header flags */
+#define DBUS_HEADER_FLAG_IS_ERROR_REPLY 0x1
+
/* Header fields */
#define DBUS_HEADER_FIELD_NAME "name"
#define DBUS_HEADER_FIELD_SERVICE "srvc"
TYPE DOUBLE
DOUBLE 3.14159
+TYPE NIL
+
END_LENGTH Body