summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog36
-rw-r--r--dbus/dbus-internals.c32
-rw-r--r--dbus/dbus-internals.h3
-rw-r--r--dbus/dbus-message-builder.c46
-rw-r--r--dbus/dbus-message.c525
-rw-r--r--dbus/dbus-protocol.h17
-rw-r--r--doc/TODO3
-rw-r--r--doc/dbus-specification.sgml86
-rw-r--r--test/data/incomplete-messages/missing-body.message6
-rw-r--r--test/data/invalid-messages/array-of-nil.message7
-rw-r--r--test/data/invalid-messages/array-with-mixed-types.message7
-rw-r--r--test/data/invalid-messages/bad-boolean-array.message5
-rw-r--r--test/data/invalid-messages/bad-boolean.message5
-rw-r--r--test/data/invalid-messages/bad-endian.message5
-rw-r--r--test/data/invalid-messages/local-namespace.message5
-rw-r--r--test/data/invalid-messages/no-dot-in-name.message4
-rw-r--r--test/data/invalid-messages/not-nul-header-padding.message6
-rw-r--r--test/data/invalid-messages/overlong-name.message4
-rw-r--r--test/data/invalid-messages/too-little-header-padding.message6
-rw-r--r--test/data/invalid-messages/too-much-header-padding-by-far.message6
-rw-r--r--test/data/invalid-messages/too-much-header-padding.message6
-rw-r--r--test/data/invalid-messages/too-short-dict.message4
-rw-r--r--test/data/valid-messages/array-of-array-of-uint32.message2
-rw-r--r--test/data/valid-messages/dict-simple.message2
-rw-r--r--test/data/valid-messages/emptiness.message2
-rw-r--r--test/data/valid-messages/lots-of-arguments.message2
-rw-r--r--test/data/valid-messages/no-padding.message2
-rw-r--r--test/data/valid-messages/opposite-endian.message2
-rw-r--r--test/data/valid-messages/recursive-types.message1
-rw-r--r--test/data/valid-messages/simplest-manual.message6
-rw-r--r--test/data/valid-messages/standard-acquire-service.message8
-rw-r--r--test/data/valid-messages/standard-hello.message8
-rw-r--r--test/data/valid-messages/standard-list-services.message8
-rw-r--r--test/data/valid-messages/standard-service-exists.message8
-rw-r--r--test/data/valid-messages/unknown-header-field.message2
35 files changed, 460 insertions, 417 deletions
diff --git a/ChangeLog b/ChangeLog
index caa4a754..64d29e8d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,39 @@
+2003-09-21 Mark McLoughlin <mark@skynet.ie>
+
+ * doc/dbus-specification.sgml: Change the header field name
+ to be an enum and update the rest of the spec to reference
+ the fields using the conventinal name.
+
+ * dbus/dbus-protocol.h: update to reflect the spec.
+
+ * doc/TODO: add item to remove the 4 byte alignment requirement.
+
+ * dbus/dbus-message.c: Remove the code to generalise the
+ header/body length and serial number header fields as named
+ header fields so we can reference field names using the
+ protocol values.
+ (append_int_field), (append_uint_field), (append_string_field):
+ Append the field name as a byte rather than four chars.
+ (delete_int_or_uint_field), (delete_string_field): reflect the
+ fact that the field name and typecode now occupy 4 bytes instead
+ of 8.
+ (decode_string_field), (decode_header_data): update to reflect
+ protocol changes and move the field specific encoding from
+ decode_string_field() back into decode_header_data().
+
+ * dbus/dbus-internals.[ch]: (_dbus_header_field_to_string):
+ Add utility to aid debugging.
+
+ * dbus/dbus-message-builder.c:
+ (append_string_field), (_dbus_message_data_load): Update to
+ reflect protocol changes; Change the FIELD_NAME directive
+ to HEADER_FIELD and allow it to take the field's conventional
+ name rather than the actual value.
+
+ * test/data/*/*.message: Update to use HEADER_FIELD instead
+ of FIELD_NAME; Always align the header on an 8 byte boundary
+ *before* updating the header length.
+
2003-09-15 Havoc Pennington <hp@pobox.com>
* dbus/dbus-pending-call.c: add the get/set object data
diff --git a/dbus/dbus-internals.c b/dbus/dbus-internals.c
index 463e62e1..cf1cc391 100644
--- a/dbus/dbus-internals.c
+++ b/dbus/dbus-internals.c
@@ -389,6 +389,38 @@ _dbus_type_to_string (int type)
}
}
+/**
+ * Returns a string describing the given name.
+ *
+ * @param header_field the field to describe
+ * @returns a constant string describing the field
+ */
+const char *
+_dbus_header_field_to_string (int header_field)
+{
+ switch (header_field)
+ {
+ case DBUS_HEADER_FIELD_INVALID:
+ return "invalid";
+ case DBUS_HEADER_FIELD_PATH:
+ return "path";
+ case DBUS_HEADER_FIELD_INTERFACE:
+ return "interface";
+ case DBUS_HEADER_FIELD_MEMBER:
+ return "member";
+ case DBUS_HEADER_FIELD_ERROR_NAME:
+ return "error-name";
+ case DBUS_HEADER_FIELD_REPLY_SERIAL:
+ return "reply-serial";
+ case DBUS_HEADER_FIELD_SERVICE:
+ return "service";
+ case DBUS_HEADER_FIELD_SENDER_SERVICE:
+ return "sender-service";
+ default:
+ return "unknown";
+ }
+}
+
#ifndef DBUS_DISABLE_CHECKS
/** String used in _dbus_return_if_fail macro */
const char _dbus_return_if_fail_warning_format[] =
diff --git a/dbus/dbus-internals.h b/dbus/dbus-internals.h
index b3010355..fa1ad19c 100644
--- a/dbus/dbus-internals.h
+++ b/dbus/dbus-internals.h
@@ -184,7 +184,8 @@ void _dbus_verbose_bytes_of_string (const DBusString *str,
int len);
-const char* _dbus_type_to_string (int type);
+const char* _dbus_type_to_string (int type);
+const char* _dbus_header_field_to_string (int header_field);
extern const char _dbus_no_memory_message[];
#define _DBUS_SET_OOM(error) dbus_set_error ((error), DBUS_ERROR_NO_MEMORY, _dbus_no_memory_message)
diff --git a/dbus/dbus-message-builder.c b/dbus/dbus-message-builder.c
index 52c78227..7e2dff0d 100644
--- a/dbus/dbus-message-builder.c
+++ b/dbus/dbus-message-builder.c
@@ -294,7 +294,7 @@ message_type_from_string (const DBusString *str,
static dbus_bool_t
append_string_field (DBusString *dest,
int endian,
- const char *field_name,
+ int field,
int type,
const char *value)
{
@@ -306,9 +306,9 @@ append_string_field (DBusString *dest,
return FALSE;
}
- if (!_dbus_string_append (dest, field_name))
+ if (!_dbus_string_append_byte (dest, field))
{
- _dbus_warn ("couldn't append field name\n");
+ _dbus_warn ("couldn't append field name byte\n");
return FALSE;
}
@@ -363,7 +363,7 @@ append_string_field (DBusString *dest,
* (or if no START_LENGTH, absolute length)
* LENGTH <name> inserts the saved length of the same name
* CHOP <N> chops last N bytes off the data
- * FIELD_NAME <abcd> inserts 4-byte field name
+ * HEADER_FIELD <fieldname> inserts a header field name byte
* TYPE <typename> inserts a typecode byte
* @endcode
*
@@ -679,14 +679,34 @@ _dbus_message_data_load (DBusString *dest,
PERFORM_UNALIGN (dest);
}
else if (_dbus_string_starts_with_c_str (&line,
- "FIELD_NAME"))
+ "HEADER_FIELD"))
{
+ int field;
+
_dbus_string_delete_first_word (&line);
- if (_dbus_string_get_length (&line) != 4)
+ if (_dbus_string_starts_with_c_str (&line, "INVALID"))
+ field = DBUS_HEADER_FIELD_INVALID;
+ else if (_dbus_string_starts_with_c_str (&line, "PATH"))
+ field = DBUS_HEADER_FIELD_PATH;
+ else if (_dbus_string_starts_with_c_str (&line, "INTERFACE"))
+ field = DBUS_HEADER_FIELD_INTERFACE;
+ else if (_dbus_string_starts_with_c_str (&line, "MEMBER"))
+ field = DBUS_HEADER_FIELD_MEMBER;
+ else if (_dbus_string_starts_with_c_str (&line, "ERROR_NAME"))
+ field = DBUS_HEADER_FIELD_ERROR_NAME;
+ else if (_dbus_string_starts_with_c_str (&line, "REPLY_SERIAL"))
+ field = DBUS_HEADER_FIELD_REPLY_SERIAL;
+ else if (_dbus_string_starts_with_c_str (&line, "SERVICE"))
+ field = DBUS_HEADER_FIELD_SERVICE;
+ else if (_dbus_string_starts_with_c_str (&line, "SENDER_SERVICE"))
+ field = DBUS_HEADER_FIELD_SENDER_SERVICE;
+ else if (_dbus_string_starts_with_c_str (&line, "UNKNOWN"))
+ field = 22; /* random unknown header field */
+ else
{
- _dbus_warn ("Field name must be four characters not \"%s\"\n",
- _dbus_string_get_const_data (&line));
+ _dbus_warn ("%s is not a valid header field name\n",
+ _dbus_string_get_const_data (&line));
goto parse_failed;
}
@@ -694,10 +714,12 @@ _dbus_message_data_load (DBusString *dest,
unalign = FALSE;
else
_dbus_string_align_length (dest, 4);
-
- if (!_dbus_string_copy (&line, 0, dest,
- _dbus_string_get_length (dest)))
- goto parse_failed;
+
+ if (!_dbus_string_append_byte (dest, field))
+ {
+ _dbus_warn ("could not append header field name byte\n");
+ goto parse_failed;
+ }
}
else if (_dbus_string_starts_with_c_str (&line,
"TYPE"))
diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c
index d62cbf4f..2ed421d7 100644
--- a/dbus/dbus-message.c
+++ b/dbus/dbus-message.c
@@ -42,36 +42,6 @@
* @{
*/
-enum
-{
- FIELD_HEADER_LENGTH,
- FIELD_BODY_LENGTH,
- FIELD_CLIENT_SERIAL,
- FIELD_PATH,
- FIELD_INTERFACE,
- FIELD_MEMBER,
- FIELD_ERROR_NAME,
- FIELD_SERVICE,
- FIELD_SENDER_SERVICE,
- FIELD_REPLY_SERIAL,
-
- FIELD_LAST
-};
-
-static dbus_bool_t field_is_named[FIELD_LAST] =
-{
- FALSE, /* FIELD_HEADER_LENGTH */
- FALSE, /* FIELD_BODY_LENGTH */
- FALSE, /* FIELD_CLIENT_SERIAL */
- TRUE, /* FIELD_PATH */
- TRUE, /* FIELD_INTERFACE */
- TRUE, /* FIELD_MEMBER */
- TRUE, /* FIELD_ERROR_NAME */
- TRUE, /* FIELD_SERVICE */
- TRUE, /* FIELD_SENDER_SERVICE */
- TRUE /* FIELD_REPLY_SERIAL */
-};
-
/**
* Cached information about a header field in the message
*/
@@ -83,13 +53,20 @@ typedef struct
} HeaderField;
/** Offset to byte order from start of header */
-#define BYTE_ORDER_OFFSET 0
+#define BYTE_ORDER_OFFSET 0
/** Offset to type from start of header */
-#define TYPE_OFFSET 1
+#define TYPE_OFFSET 1
/** Offset to flags from start of header */
-#define FLAGS_OFFSET 2
+#define FLAGS_OFFSET 2
/** Offset to version from start of header */
-#define VERSION_OFFSET 3
+#define VERSION_OFFSET 3
+/** Offset to header length from start of header */
+#define HEADER_LENGTH_OFFSET 4
+/** Offset to body length from start of header */
+#define BODY_LENGTH_OFFSET 8
+/** Offset to client serial from start of header */
+#define CLIENT_SERIAL_OFFSET 12
+
/**
* @brief Internals of DBusMessage
@@ -107,9 +84,9 @@ struct DBusMessage
* independently realloc it.
*/
- HeaderField header_fields[FIELD_LAST]; /**< Track the location
- * of each field in "header"
- */
+ HeaderField header_fields[DBUS_HEADER_FIELD_LAST + 1]; /**< Track the location
+ * of each field in "header"
+ */
dbus_uint32_t client_serial; /**< Cached client serial value for speed */
dbus_uint32_t reply_serial; /**< Cached reply serial value for speed */
@@ -217,7 +194,7 @@ adjust_field_offsets (DBusMessage *message,
return;
i = 0;
- while (i < FIELD_LAST)
+ while (i <= DBUS_HEADER_FIELD_LAST)
{
if (message->header_fields[i].offset > offsets_after)
message->header_fields[i].offset += delta;
@@ -234,7 +211,7 @@ get_int_field (DBusMessage *message,
{
int offset;
- _dbus_assert (field < FIELD_LAST);
+ _dbus_assert (field <= DBUS_HEADER_FIELD_LAST);
offset = message->header_fields[field].offset;
@@ -254,7 +231,7 @@ get_uint_field (DBusMessage *message,
{
int offset;
- _dbus_assert (field < FIELD_LAST);
+ _dbus_assert (field <= DBUS_HEADER_FIELD_LAST);
offset = message->header_fields[field].offset;
@@ -277,7 +254,7 @@ get_string_field (DBusMessage *message,
offset = message->header_fields[field].offset;
- _dbus_assert (field < FIELD_LAST);
+ _dbus_assert (field <= DBUS_HEADER_FIELD_LAST);
if (offset < 0)
return NULL;
@@ -308,7 +285,7 @@ get_path_field_decomposed (DBusMessage *message,
offset = message->header_fields[field].offset;
- _dbus_assert (field < FIELD_LAST);
+ _dbus_assert (field <= DBUS_HEADER_FIELD_LAST);
if (offset < 0)
{
@@ -327,7 +304,6 @@ get_path_field_decomposed (DBusMessage *message,
static dbus_bool_t
append_int_field (DBusMessage *message,
int field,
- const char *name,
int value)
{
int orig_len;
@@ -341,7 +317,7 @@ append_int_field (DBusMessage *message,
if (!_dbus_string_align_length (&message->header, 4))
goto failed;
- if (!_dbus_string_append_len (&message->header, name, 4))
+ if (!_dbus_string_append_byte (&message->header, field))
goto failed;
if (!_dbus_string_append_byte (&message->header, DBUS_TYPE_INT32))
@@ -378,8 +354,7 @@ append_int_field (DBusMessage *message,
static dbus_bool_t
append_uint_field (DBusMessage *message,
int field,
- const char *name,
- int value)
+ int value)
{
int orig_len;
@@ -392,7 +367,7 @@ append_uint_field (DBusMessage *message,
if (!_dbus_string_align_length (&message->header, 4))
goto failed;
- if (!_dbus_string_append_len (&message->header, name, 4))
+ if (!_dbus_string_append_byte (&message->header, field))
goto failed;
if (!_dbus_string_append_byte (&message->header, DBUS_TYPE_UINT32))
@@ -429,7 +404,6 @@ static dbus_bool_t
append_string_field (DBusMessage *message,
int field,
int type,
- const char *name,
const char *value)
{
int orig_len;
@@ -443,7 +417,7 @@ append_string_field (DBusMessage *message,
if (!_dbus_string_align_length (&message->header, 4))
goto failed;
- if (!_dbus_string_append_len (&message->header, name, 4))
+ if (!_dbus_string_append_byte (&message->header, field))
goto failed;
if (!_dbus_string_append_byte (&message->header, type))
@@ -488,23 +462,22 @@ delete_int_or_uint_field (DBusMessage *message,
int offset = message->header_fields[field].offset;
_dbus_assert (!message->locked);
- _dbus_assert (field_is_named[field]);
if (offset < 0)
return;
clear_header_padding (message);
- /* The field typecode and name take up 8 bytes */
+ /* The field typecode and name take up 4 bytes */
_dbus_string_delete (&message->header,
- offset - 8,
- 12);
+ offset - 4,
+ 8);
message->header_fields[field].offset = -1;
adjust_field_offsets (message,
- offset - 8,
- - 12);
+ offset - 4,
+ - 8);
append_header_padding (message);
}
@@ -519,7 +492,6 @@ delete_string_field (DBusMessage *message,
int delete_len;
_dbus_assert (!message->locked);
- _dbus_assert (field_is_named[field]);
if (offset < 0)
return;
@@ -528,19 +500,19 @@ delete_string_field (DBusMessage *message,
get_string_field (message, field, &len);
- /* The field typecode and name take up 8 bytes, and the nul
+ /* The field typecode and name take up 4 bytes, and the nul
* termination is 1 bytes, string length integer is 4 bytes
*/
- delete_len = 8 + 4 + 1 + len;
+ delete_len = 4 + 4 + 1 + len;
_dbus_string_delete (&message->header,
- offset - 8,
+ offset - 4,
delete_len);
message->header_fields[field].offset = -1;
adjust_field_offsets (message,
- offset - 8,
+ offset - 4,
- delete_len);
append_header_padding (message);
@@ -593,10 +565,9 @@ set_uint_field (DBusMessage *message,
switch (field)
{
- case FIELD_REPLY_SERIAL:
- return append_uint_field (message, field,
- DBUS_HEADER_FIELD_REPLY,
- value);
+ case DBUS_HEADER_FIELD_REPLY_SERIAL:
+ return append_uint_field (message, field, value);
+
default:
_dbus_assert_not_reached ("appending a uint field we don't support appending");
return FALSE;
@@ -629,30 +600,14 @@ set_string_field (DBusMessage *message,
switch (field)
{
- case FIELD_PATH:
- return append_string_field (message, field, type,
- DBUS_HEADER_FIELD_PATH,
- value);
- case FIELD_SENDER_SERVICE:
- return append_string_field (message, field, type,
- DBUS_HEADER_FIELD_SENDER_SERVICE,
- value);
- case FIELD_INTERFACE:
- return append_string_field (message, field, type,
- DBUS_HEADER_FIELD_INTERFACE,
- value);
- case FIELD_MEMBER:
- return append_string_field (message, field, type,
- DBUS_HEADER_FIELD_MEMBER,
- value);
- case FIELD_ERROR_NAME:
- return append_string_field (message, field, type,
- DBUS_HEADER_FIELD_ERROR_NAME,
- value);
- case FIELD_SERVICE:
- return append_string_field (message, field, type,
- DBUS_HEADER_FIELD_SERVICE,
- value);
+ case DBUS_HEADER_FIELD_PATH:
+ case DBUS_HEADER_FIELD_SENDER_SERVICE:
+ case DBUS_HEADER_FIELD_INTERFACE:
+ case DBUS_HEADER_FIELD_MEMBER:
+ case DBUS_HEADER_FIELD_ERROR_NAME:
+ case DBUS_HEADER_FIELD_SERVICE:
+ return append_string_field (message, field, type, value);
+
default:
_dbus_assert_not_reached ("appending a string field we don't support appending");
return FALSE;
@@ -714,9 +669,12 @@ _dbus_message_set_serial (DBusMessage *message,
{
_dbus_assert (!message->locked);
_dbus_assert (dbus_message_get_serial (message) == 0);
-
- set_uint_field (message, FIELD_CLIENT_SERIAL,
- serial);
+
+ _dbus_marshal_set_uint32 (&message->header,
+ message->byte_order,
+ CLIENT_SERIAL_OFFSET,
+ serial);
+
message->client_serial = serial;
}
@@ -734,7 +692,8 @@ dbus_message_set_reply_serial (DBusMessage *message,
{
_dbus_assert (!message->locked);
- if (set_uint_field (message, FIELD_REPLY_SERIAL,
+ if (set_uint_field (message,
+ DBUS_HEADER_FIELD_REPLY_SERIAL,
reply_serial))
{
message->reply_serial = reply_serial;
@@ -894,15 +853,12 @@ dbus_message_create_header (DBusMessage *message,
if (!_dbus_string_append_byte (&message->header, DBUS_MAJOR_PROTOCOL_VERSION))
return FALSE;
- message->header_fields[FIELD_HEADER_LENGTH].offset = 4;
if (!_dbus_marshal_uint32 (&message->header, message->byte_order, 0))
return FALSE;
- message->header_fields[FIELD_BODY_LENGTH].offset = 8;
if (!_dbus_marshal_uint32 (&message->header, message->byte_order, 0))
return FALSE;
- message->header_fields[FIELD_CLIENT_SERIAL].offset = 12;
if (!_dbus_marshal_int32 (&message->header, message->byte_order, -1))
return FALSE;
@@ -911,8 +867,8 @@ dbus_message_create_header (DBusMessage *message,
if (path != NULL)
{
if (!append_string_field (message,
- FIELD_PATH, DBUS_TYPE_OBJECT_PATH,
DBUS_HEADER_FIELD_PATH,
+ DBUS_TYPE_OBJECT_PATH,
path))
return FALSE;
}
@@ -920,8 +876,8 @@ dbus_message_create_header (DBusMessage *message,
if (service != NULL)
{
if (!append_string_field (message,
- FIELD_SERVICE, DBUS_TYPE_STRING,
DBUS_HEADER_FIELD_SERVICE,
+ DBUS_TYPE_STRING,
service))
return FALSE;
}
@@ -929,8 +885,8 @@ dbus_message_create_header (DBusMessage *message,
if (interface != NULL)
{
if (!append_string_field (message,
- FIELD_INTERFACE, DBUS_TYPE_STRING,
DBUS_HEADER_FIELD_INTERFACE,
+ DBUS_TYPE_STRING,
interface))
return FALSE;
}
@@ -938,8 +894,8 @@ dbus_message_create_header (DBusMessage *message,
if (member != NULL)
{
if (!append_string_field (message,
- FIELD_MEMBER, DBUS_TYPE_STRING,
DBUS_HEADER_FIELD_MEMBER,
+ DBUS_TYPE_STRING,
member))
return FALSE;
}
@@ -947,8 +903,8 @@ dbus_message_create_header (DBusMessage *message,
if (error_name != NULL)
{
if (!append_string_field (message,
- FIELD_ERROR_NAME, DBUS_TYPE_STRING,
DBUS_HEADER_FIELD_ERROR_NAME,
+ DBUS_TYPE_STRING,
error_name))
return FALSE;
}
@@ -971,13 +927,15 @@ _dbus_message_lock (DBusMessage *message)
if (!message->locked)
{
/* Fill in our lengths */
- set_uint_field (message,
- FIELD_HEADER_LENGTH,
- _dbus_string_get_length (&message->header));
+ _dbus_marshal_set_uint32 (&message->header,
+ message->byte_order,
+ HEADER_LENGTH_OFFSET,
+ _dbus_string_get_length (&message->header));
- set_uint_field (message,
- FIELD_BODY_LENGTH,
- _dbus_string_get_length (&message->body));
+ _dbus_marshal_set_uint32 (&message->header,
+ message->byte_order,
+ BODY_LENGTH_OFFSET,
+ _dbus_string_get_length (&message->body));
message->locked = TRUE;
}
@@ -1023,7 +981,7 @@ dbus_message_new_empty_header (void)
_dbus_data_slot_list_init (&message->slot_list);
i = 0;
- while (i < FIELD_LAST)
+ while (i <= DBUS_HEADER_FIELD_LAST)
{
message->header_fields[i].offset = -1;
++i;
@@ -1136,7 +1094,8 @@ dbus_message_new_method_return (DBusMessage *method_call)
_dbus_return_val_if_fail (method_call != NULL, NULL);
sender = get_string_field (method_call,
- FIELD_SENDER_SERVICE, NULL);
+ DBUS_HEADER_FIELD_SENDER_SERVICE,
+ NULL);
/* sender is allowed to be null here in peer-to-peer case */
@@ -1222,7 +1181,8 @@ dbus_message_new_error (DBusMessage *reply_to,
_dbus_return_val_if_fail (error_name != NULL, NULL);
sender = get_string_field (reply_to,
- FIELD_SENDER_SERVICE, NULL);
+ DBUS_HEADER_FIELD_SENDER_SERVICE,
+ NULL);
/* sender may be NULL for non-message-bus case or
* when the message bus is dealing with an unregistered
@@ -1319,7 +1279,7 @@ dbus_message_copy (const DBusMessage *message)
return NULL;
}
- for (i = 0; i < FIELD_LAST; i++)
+ for (i = 0; i <= DBUS_HEADER_FIELD_LAST; i++)
{
retval->header_fields[i].offset = message->header_fields[i].offset;
}
@@ -1430,13 +1390,13 @@ dbus_message_set_path (DBusMessage *message,
if (object_path == NULL)
{
- delete_string_field (message, FIELD_PATH);
+ delete_string_field (message, DBUS_HEADER_FIELD_PATH);
return TRUE;
}
else
{
return set_string_field (message,
- FIELD_PATH,
+ DBUS_HEADER_FIELD_PATH,
DBUS_TYPE_OBJECT_PATH,
object_path);
}
@@ -1455,7 +1415,7 @@ dbus_message_get_path (DBusMessage *message)
{
_dbus_return_val_if_fail (message != NULL, NULL);
- return get_string_field (message, FIELD_PATH, NULL);
+ return get_string_field (message, DBUS_HEADER_FIELD_PATH, NULL);
}
/**
@@ -1480,7 +1440,8 @@ dbus_message_get_path_decomposed (DBusMessage *message,
_dbus_return_val_if_fail (message != NULL, FALSE);
_dbus_return_val_if_fail (path != NULL, FALSE);
- return get_path_field_decomposed (message, FIELD_PATH,
+ return get_path_field_decomposed (message,
+ DBUS_HEADER_FIELD_PATH,
path);
}
@@ -1503,13 +1464,13 @@ dbus_message_set_interface (DBusMessage *message,
if (interface == NULL)
{
- delete_string_field (message, FIELD_INTERFACE);
+ delete_string_field (message, DBUS_HEADER_FIELD_INTERFACE);
return TRUE;
}
else
{
return set_string_field (message,
- FIELD_INTERFACE,
+ DBUS_HEADER_FIELD_INTERFACE,
DBUS_TYPE_STRING,
interface);
}
@@ -1529,7 +1490,7 @@ dbus_message_get_interface (DBusMessage *message)
{
_dbus_return_val_if_fail (message != NULL, NULL);
- return get_string_field (message, FIELD_INTERFACE, NULL);
+ return get_string_field (message, DBUS_HEADER_FIELD_INTERFACE, NULL);
}
/**
@@ -1551,13 +1512,13 @@ dbus_message_set_member (DBusMessage *message,
if (member == NULL)
{
- delete_string_field (message, FIELD_MEMBER);
+ delete_string_field (message, DBUS_HEADER_FIELD_MEMBER);
return TRUE;
}
else
{
return set_string_field (message,
- FIELD_MEMBER,
+ DBUS_HEADER_FIELD_MEMBER,
DBUS_TYPE_STRING,
member);
}
@@ -1576,7 +1537,9 @@ dbus_message_get_member (DBusMessage *message)
{
_dbus_return_val_if_fail (message != NULL, NULL);
- return get_string_field (message, FIELD_MEMBER, NULL);
+ return get_string_field (message,
+ DBUS_HEADER_FIELD_MEMBER,
+ NULL);
}
/**
@@ -1596,13 +1559,14 @@ dbus_message_set_error_name (DBusMessage *message,
if (error_name == NULL)
{
- delete_string_field (message, FIELD_ERROR_NAME);
+ delete_string_field (message,
+ DBUS_HEADER_FIELD_ERROR_NAME);
return TRUE;
}
else
{
return set_string_field (message,
- FIELD_ERROR_NAME,
+ DBUS_HEADER_FIELD_ERROR_NAME,
DBUS_TYPE_STRING,
error_name);
}
@@ -1619,7 +1583,9 @@ dbus_message_get_error_name (DBusMessage *message)
{
_dbus_return_val_if_fail (message != NULL, NULL);
- return get_string_field (message, FIELD_ERROR_NAME, NULL);
+ return get_string_field (message,
+ DBUS_HEADER_FIELD_ERROR_NAME,
+ NULL);
}
/**
@@ -1638,13 +1604,13 @@ dbus_message_set_destination (DBusMessage *message,
if (destination == NULL)
{
- delete_string_field (message, FIELD_SERVICE);
+ delete_string_field (message, DBUS_HEADER_FIELD_SERVICE);
return TRUE;
}
else
{
return set_string_field (message,
- FIELD_SERVICE,
+ DBUS_HEADER_FIELD_SERVICE,
DBUS_TYPE_STRING,
destination);
}
@@ -1661,7 +1627,9 @@ dbus_message_get_destination (DBusMessage *message)
{
_dbus_return_val_if_fail (message != NULL, NULL);
- return get_string_field (message, FIELD_SERVICE, NULL);
+ return get_string_field (message,
+ DBUS_HEADER_FIELD_SERVICE,
+ NULL);
}
/**
@@ -4113,13 +4081,14 @@ dbus_message_set_sender (DBusMessage *message,
if (sender == NULL)
{
- delete_string_field (message, FIELD_SENDER_SERVICE);
+ delete_string_field (message,
+ DBUS_HEADER_FIELD_SENDER_SERVICE);
return TRUE;
}
else
{
return set_string_field (message,
- FIELD_SENDER_SERVICE,
+ DBUS_HEADER_FIELD_SENDER_SERVICE,
DBUS_TYPE_STRING,
sender);
}
@@ -4183,7 +4152,9 @@ dbus_message_get_sender (DBusMessage *message)
{
_dbus_return_val_if_fail (message != NULL, NULL);
- return get_string_field (message, FIELD_SENDER_SERVICE, NULL);
+ return get_string_field (message,
+ DBUS_HEADER_FIELD_SENDER_SERVICE,
+ NULL);
}
static dbus_bool_t
@@ -4566,63 +4537,31 @@ _dbus_message_loader_get_buffer (DBusMessageLoader *loader,
*/
#define DBUS_MINIMUM_HEADER_SIZE 16
-/** Pack four characters as in "abcd" into a uint32 */
-#define FOUR_CHARS_TO_UINT32(a, b, c, d) \
- ((((dbus_uint32_t)a) << 24) | \
- (((dbus_uint32_t)b) << 16) | \
- (((dbus_uint32_t)c) << 8) | \
- ((dbus_uint32_t)d))
-
-/** DBUS_HEADER_FIELD_PATH packed into a dbus_uint32_t */
-#define DBUS_HEADER_FIELD_PATH_AS_UINT32 \
- FOUR_CHARS_TO_UINT32 ('p', 'a', 't', 'h')
-
-/** DBUS_HEADER_FIELD_INTERFACE packed into a dbus_uint32_t */
-#define DBUS_HEADER_FIELD_INTERFACE_AS_UINT32 \
- FOUR_CHARS_TO_UINT32 ('i', 'f', 'c', 'e')
-
-/** DBUS_HEADER_FIELD_MEMBER packed into a dbus_uint32_t */
-#define DBUS_HEADER_FIELD_MEMBER_AS_UINT32 \
- FOUR_CHARS_TO_UINT32 ('m', 'e', 'b', 'r')
-
-/** DBUS_HEADER_FIELD_ERROR_NAME packed into a dbus_uint32_t */
-#define DBUS_HEADER_FIELD_ERROR_NAME_AS_UINT32 \
- FOUR_CHARS_TO_UINT32 ('e', 'r', 'n', 'm')
-
-/** DBUS_HEADER_FIELD_SERVICE packed into a dbus_uint32_t */
-#define DBUS_HEADER_FIELD_SERVICE_AS_UINT32 \
- FOUR_CHARS_TO_UINT32 ('s', 'r', 'v', 'c')
-
-/** DBUS_HEADER_FIELD_REPLY packed into a dbus_uint32_t */
-#define DBUS_HEADER_FIELD_REPLY_AS_UINT32 \
- FOUR_CHARS_TO_UINT32 ('r', 'p', 'l', 'y')
-
-/** DBUS_HEADER_FIELD_SENDER_SERVICE Packed into a dbus_uint32_t */
-#define DBUS_HEADER_FIELD_SENDER_SERVICE_AS_UINT32 \
- FOUR_CHARS_TO_UINT32 ('s', 'd', 'r', 's')
-
static dbus_bool_t
decode_string_field (const DBusString *data,
- HeaderField fields[FIELD_LAST],
+ int field,
+ HeaderField *header_field,
+ DBusString *field_data,
int pos,
- int type,
- int field,
- const char *field_name)
+ int type)
{
- DBusString tmp;
int string_data_pos;
+
+ _dbus_assert (header_field != NULL);
+ _dbus_assert (field_data != NULL);
- if (fields[field].offset >= 0)
+ if (header_field->offset >= 0)
{
_dbus_verbose ("%s field provided twice\n",
- field_name);
+ _dbus_header_field_to_string (field));
return FALSE;
}
if (type != DBUS_TYPE_STRING)
{
_dbus_verbose ("%s field has wrong type %s\n",
- field_name, _dbus_type_to_string (type));
+ _dbus_header_field_to_string (field),
+ _dbus_type_to_string (type));
return FALSE;
}
@@ -4633,63 +4572,15 @@ decode_string_field (const DBusString *data,
string_data_pos = _DBUS_ALIGN_VALUE (pos, 4) + 4;
_dbus_assert (string_data_pos < _dbus_string_get_length (data));
- _dbus_string_init_const (&tmp,
+ _dbus_string_init_const (field_data,
_dbus_string_get_const_data (data) + string_data_pos);
- if (field == FIELD_INTERFACE)
- {
- if (!_dbus_string_validate_interface (&tmp, 0, _dbus_string_get_length (&tmp)))
- {
- _dbus_verbose ("%s field has invalid content \"%s\"\n",
- field_name, _dbus_string_get_const_data (&tmp));
- return FALSE;
- }
-
- if (_dbus_string_equal_c_str (&tmp,
- DBUS_INTERFACE_ORG_FREEDESKTOP_LOCAL))
- {
- _dbus_verbose ("Message is on the local interface\n");
- return FALSE;
- }
- }
- else if (field == FIELD_MEMBER)
- {
- if (!_dbus_string_validate_member (&tmp, 0, _dbus_string_get_length (&tmp)))
- {
- _dbus_verbose ("%s field has invalid content \"%s\"\n",
- field_name, _dbus_string_get_const_data (&tmp));
- return FALSE;
- }
- }
- else if (field == FIELD_ERROR_NAME)
- {
- if (!_dbus_string_validate_error_name (&tmp, 0, _dbus_string_get_length (&tmp)))
- {
- _dbus_verbose ("%s field has invalid content \"%s\"\n",
- field_name, _dbus_string_get_const_data (&tmp));
- return FALSE;
- }
- }
- else if (field == FIELD_SERVICE ||
- field == FIELD_SENDER_SERVICE)
- {
- if (!_dbus_string_validate_service (&tmp, 0, _dbus_string_get_length (&tmp)))
- {
- _dbus_verbose ("%s field has invalid content \"%s\"\n",
- field_name, _dbus_string_get_const_data (&tmp));
- return FALSE;
- }
- }
- else
- {
- _dbus_assert_not_reached ("Unknown field\n");
- }
-
- fields[field].offset = _DBUS_ALIGN_VALUE (pos, 4);
+ header_field->offset = _DBUS_ALIGN_VALUE (pos, 4);
#if 0
- _dbus_verbose ("Found field %s name at offset %d\n",
- field_name, fields[field].offset);
+ _dbus_verbose ("Found field %s at offset %d\n",
+ _dbus_header_field_to_string (field),
+ header_field->offset);
#endif
return TRUE;
@@ -4700,12 +4591,13 @@ decode_header_data (const DBusString *data,
int header_len,
int byte_order,
int message_type,
- HeaderField fields[FIELD_LAST],
+ HeaderField fields[DBUS_HEADER_FIELD_LAST + 1],
int *message_padding)
{
- const char *field;
+ DBusString field_data;
int pos, new_pos;
int i;
+ int field;
int type;
if (header_len < 16)
@@ -4715,38 +4607,32 @@ decode_header_data (const DBusString *data,
}
i = 0;
- while (i < FIELD_LAST)
+ while (i <= DBUS_HEADER_FIELD_LAST)
{
fields[i].offset = -1;
++i;
}
- fields[FIELD_HEADER_LENGTH].offset = 4;
- fields[FIELD_BODY_LENGTH].offset = 8;
- fields[FIELD_CLIENT_SERIAL].offset = 12;
-
- /* Now handle the named fields. A real named field is at least 4
- * bytes for the name, plus a type code (1 byte) plus padding. So
- * if we have less than 8 bytes left, it must be alignment padding,
- * not a field. While >= 8 bytes can't be entirely alignment
- * padding.
+ /* Now handle the named fields. A real named field is at least 1
+ * byte for the name, plus a type code (1 byte) plus padding, plus
+ * the field value. So if we have less than 8 bytes left, it must
+ * be alignment padding, not a field. While >= 8 bytes can't be
+ * entirely alignment padding.
*/
pos = 16;
while ((pos + 7) < header_len)
{
pos = _DBUS_ALIGN_VALUE (pos, 4);
- if ((pos + 4) > header_len)
+ if ((pos + 1) > header_len)
{
_dbus_verbose ("not enough space remains in header for header field value\n");
return FALSE;
}
- field = _dbus_string_get_const_data_len (data, pos, 4);
- pos += 4;
+ field = _dbus_string_get_byte (data, pos);
+ pos += 1;
- _dbus_assert (_DBUS_ALIGN_ADDRESS (field, 4) == field);
-
if (!_dbus_marshal_validate_type (data, pos, &type, &pos))
{
_dbus_verbose ("Failed to validate type of named header field\n");
@@ -4765,71 +4651,112 @@ decode_header_data (const DBusString *data,
return FALSE;
}
- switch (DBUS_UINT32_FROM_BE (*(int*)field))
+ switch (field)
{
- case DBUS_HEADER_FIELD_SERVICE_AS_UINT32:
- if (!decode_string_field (data, fields, pos, type,
- FIELD_SERVICE,
- DBUS_HEADER_FIELD_SERVICE))
+ case DBUS_HEADER_FIELD_SERVICE:
+ if (!decode_string_field (data, field, &fields[field],
+ &field_data, pos, type))
return FALSE;
+
+ if (!_dbus_string_validate_service (&field_data, 0,
+ _dbus_string_get_length (&field_data)))
+ {
+ _dbus_verbose ("service field has invalid content \"%s\"\n",
+ _dbus_string_get_const_data (&field_data));
+ return FALSE;
+ }
break;
- case DBUS_HEADER_FIELD_INTERFACE_AS_UINT32:
- if (!decode_string_field (data, fields, pos, type,
- FIELD_INTERFACE,
- DBUS_HEADER_FIELD_INTERFACE))
+ case DBUS_HEADER_FIELD_INTERFACE:
+ if (!decode_string_field (data, field, &fields[field],
+ &field_data, pos, type))
return FALSE;
+
+ if (!_dbus_string_validate_interface (&field_data, 0,
+ _dbus_string_get_length (&field_data)))
+ {
+ _dbus_verbose ("interface field has invalid content \"%s\"\n",
+ _dbus_string_get_const_data (&field_data));
+ return FALSE;
+ }
+
+ if (_dbus_string_equal_c_str (&field_data,
+ DBUS_INTERFACE_ORG_FREEDESKTOP_LOCAL))
+ {
+ _dbus_verbose ("Message is on the local interface\n");
+ return FALSE;
+ }
break;
- case DBUS_HEADER_FIELD_MEMBER_AS_UINT32:
- if (!decode_string_field (data, fields, pos, type,
- FIELD_MEMBER,
- DBUS_HEADER_FIELD_MEMBER))
+ case DBUS_HEADER_FIELD_MEMBER:
+ if (!decode_string_field (data, field, &fields[field],
+ &field_data, pos, type))
return FALSE;
+
+ if (!_dbus_string_validate_member (&field_data, 0,
+ _dbus_string_get_length (&field_data)))
+ {
+ _dbus_verbose ("member field has invalid content \"%s\"\n",
+ _dbus_string_get_const_data (&field_data));
+ return FALSE;
+ }
break;
- case DBUS_HEADER_FIELD_ERROR_NAME_AS_UINT32:
- if (!decode_string_field (data, fields, pos, type,
- FIELD_ERROR_NAME,
- DBUS_HEADER_FIELD_ERROR_NAME))
+ case DBUS_HEADER_FIELD_ERROR_NAME:
+ if (!decode_string_field (data, field, &fields[field],
+ &field_data, pos, type))
return FALSE;
+
+ if (!_dbus_string_validate_error_name (&field_data, 0,
+ _dbus_string_get_length (&field_data)))
+ {
+ _dbus_verbose ("error-name field has invalid content \"%s\"\n",
+ _dbus_string_get_const_data (&field_data));
+ return FALSE;
+ }
break;
- case DBUS_HEADER_FIELD_SENDER_SERVICE_AS_UINT32:
- if (!decode_string_field (data, fields, pos, type,
- FIELD_SENDER_SERVICE,
- DBUS_HEADER_FIELD_SENDER_SERVICE))
+ case DBUS_HEADER_FIELD_SENDER_SERVICE:
+ if (!decode_string_field (data, field, &fields[field],
+ &field_data, pos, type))
return FALSE;
+
+ if (!_dbus_string_validate_service (&field_data, 0,
+ _dbus_string_get_length (&field_data)))
+ {
+ _dbus_verbose ("sender-service field has invalid content \"%s\"\n",
+ _dbus_string_get_const_data (&field_data));
+ return FALSE;
+ }
break;
- case DBUS_HEADER_FIELD_PATH_AS_UINT32:
+ case DBUS_HEADER_FIELD_PATH:
/* Path was already validated as part of standard
* type validation, since there's an OBJECT_PATH
* type.
*/
- if (fields[FIELD_PATH].offset >= 0)
+ if (fields[field].offset >= 0)
{
- _dbus_verbose ("%s field provided twice\n",
- DBUS_HEADER_FIELD_PATH);
+ _dbus_verbose ("path field provided twice\n");
return FALSE;
}
if (type != DBUS_TYPE_OBJECT_PATH)
{
- _dbus_verbose ("%s field has wrong type\n", DBUS_HEADER_FIELD_PATH);
+ _dbus_verbose ("path field has wrong type\n");
return FALSE;
}
- fields[FIELD_PATH].offset = _DBUS_ALIGN_VALUE (pos, 4);
+ fields[field].offset = _DBUS_ALIGN_VALUE (pos, 4);
/* No forging signals from the local path */
{
const char *s;
s = _dbus_string_get_const_data_len (data,
- fields[FIELD_PATH].offset,
+ fields[field].offset,
_dbus_string_get_length (data) -
- fields[FIELD_PATH].offset);
+ fields[field].offset);
if (strcmp (s, DBUS_PATH_ORG_FREEDESKTOP_LOCAL) == 0)
{
_dbus_verbose ("Message is on the local path\n");
@@ -4838,31 +4765,30 @@ decode_header_data (const DBusString *data,
}
_dbus_verbose ("Found path at offset %d\n",
- fields[FIELD_PATH].offset);
+ fields[field].offset);
break;
- case DBUS_HEADER_FIELD_REPLY_AS_UINT32:
- if (fields[FIELD_REPLY_SERIAL].offset >= 0)
+ case DBUS_HEADER_FIELD_REPLY_SERIAL:
+ if (fields[field].offset >= 0)
{
- _dbus_verbose ("%s field provided twice\n",
- DBUS_HEADER_FIELD_REPLY);
+ _dbus_verbose ("reply field provided twice\n");
return FALSE;
}
if (type != DBUS_TYPE_UINT32)
{
- _dbus_verbose ("%s field has wrong type\n", DBUS_HEADER_FIELD_REPLY);
+ _dbus_verbose ("reply field has wrong type\n");
return FALSE;
}
- fields[FIELD_REPLY_SERIAL].offset = _DBUS_ALIGN_VALUE (pos, 4);
+ fields[field].offset = _DBUS_ALIGN_VALUE (pos, 4);
_dbus_verbose ("Found reply serial at offset %d\n",
- fields[FIELD_REPLY_SERIAL].offset);
+ fields[field].offset);
break;
default:
- _dbus_verbose ("Ignoring an unknown header field: %.4s at offset %d\n",
+ _dbus_verbose ("Ignoring an unknown header field: %d at offset %d\n",
field, pos);
}
@@ -4887,31 +4813,27 @@ decode_header_data (const DBusString *data,
{
case DBUS_MESSAGE_TYPE_SIGNAL:
case DBUS_MESSAGE_TYPE_METHOD_CALL:
- if (fields[FIELD_PATH].offset < 0)
+ if (fields[DBUS_HEADER_FIELD_PATH].offset < 0)
{
- _dbus_verbose ("No %s field provided\n",
- DBUS_HEADER_FIELD_PATH);
+ _dbus_verbose ("No path field provided\n");
return FALSE;
}
/* FIXME make this optional, at least for method calls */
- if (fields[FIELD_INTERFACE].offset < 0)
+ if (fields[DBUS_HEADER_FIELD_INTERFACE].offset < 0)
{
- _dbus_verbose ("No %s field provided\n",
- DBUS_HEADER_FIELD_INTERFACE);
+ _dbus_verbose ("No interface field provided\n");
return FALSE;
}
- if (fields[FIELD_MEMBER].offset < 0)
+ if (fields[DBUS_HEADER_FIELD_MEMBER].offset < 0)
{
- _dbus_verbose ("No %s field provided\n",
- DBUS_HEADER_FIELD_MEMBER);
+ _dbus_verbose ("No member field provided\n");
return FALSE;
}
break;
case DBUS_MESSAGE_TYPE_ERROR:
- if (fields[FIELD_ERROR_NAME].offset < 0)
+ if (fields[DBUS_HEADER_FIELD_ERROR_NAME].offset < 0)
{
- _dbus_verbose ("No %s field provided\n",
- DBUS_HEADER_FIELD_ERROR_NAME);
+ _dbus_verbose ("No error-name field provided\n");
return FALSE;
}
break;
@@ -5056,7 +4978,7 @@ _dbus_message_loader_queue_messages (DBusMessageLoader *loader)
if (_dbus_string_get_length (&loader->data) >= (header_len + body_len))
{
- HeaderField fields[FIELD_LAST];
+ HeaderField fields[DBUS_HEADER_FIELD_LAST + 1];
int i;
int next_arg;
@@ -5123,7 +5045,7 @@ _dbus_message_loader_queue_messages (DBusMessageLoader *loader)
/* Copy in the offsets we found */
i = 0;
- while (i < FIELD_LAST)
+ while (i <= DBUS_HEADER_FIELD_LAST)
{
message->header_fields[i] = fields[i];
++i;
@@ -5173,9 +5095,12 @@ _dbus_message_loader_queue_messages (DBusMessageLoader *loader)
* earlier)
*/
message->reply_serial = get_uint_field (message,
- FIELD_REPLY_SERIAL);
- message->client_serial = get_uint_field (message,
- FIELD_CLIENT_SERIAL);
+ DBUS_HEADER_FIELD_REPLY_SERIAL);
+
+ message->client_serial = _dbus_demarshal_uint32 (&message->header,
+ message->byte_order,
+ CLIENT_SERIAL_OFFSET,
+ NULL);
_dbus_verbose ("Loaded message %p\n", message);
}
@@ -5751,8 +5676,10 @@ check_message_handling (DBusMessage *message)
client_serial = dbus_message_get_serial (message);
/* can't use set_serial due to the assertions at the start of it */
- set_uint_field (message, FIELD_CLIENT_SERIAL,
- client_serial);
+ _dbus_marshal_set_uint32 (&message->header,
+ message->byte_order,
+ CLIENT_SERIAL_OFFSET,
+ client_serial);
if (client_serial != dbus_message_get_serial (message))
{
diff --git a/dbus/dbus-protocol.h b/dbus/dbus-protocol.h
index 473a1051..329609dc 100644
--- a/dbus/dbus-protocol.h
+++ b/dbus/dbus-protocol.h
@@ -71,14 +71,17 @@ extern "C" {
#define DBUS_HEADER_FLAG_NO_REPLY_EXPECTED 0x1
/* Header fields */
-#define DBUS_HEADER_FIELD_PATH "path"
-#define DBUS_HEADER_FIELD_INTERFACE "ifce"
-#define DBUS_HEADER_FIELD_MEMBER "mebr"
-#define DBUS_HEADER_FIELD_ERROR_NAME "ernm"
-#define DBUS_HEADER_FIELD_SERVICE "srvc"
-#define DBUS_HEADER_FIELD_REPLY "rply"
-#define DBUS_HEADER_FIELD_SENDER_SERVICE "sdrs"
+#define DBUS_HEADER_FIELD_INVALID 0
+#define DBUS_HEADER_FIELD_PATH 1
+#define DBUS_HEADER_FIELD_INTERFACE 2
+#define DBUS_HEADER_FIELD_MEMBER 3
+#define DBUS_HEADER_FIELD_ERROR_NAME 4
+#define DBUS_HEADER_FIELD_REPLY_SERIAL 5
+#define DBUS_HEADER_FIELD_SERVICE 6
+#define DBUS_HEADER_FIELD_SENDER_SERVICE 7
+#define DBUS_HEADER_FIELD_LAST DBUS_HEADER_FIELD_SENDER_SERVICE
+
/* Services */
#define DBUS_SERVICE_ORG_FREEDESKTOP_DBUS "org.freedesktop.DBus"
#define DBUS_SERVICE_ORG_FREEDESKTOP_BROADCAST "org.freedesktop.Broadcast"
diff --git a/doc/TODO b/doc/TODO
index 5c2b149c..caa8856f 100644
--- a/doc/TODO
+++ b/doc/TODO
@@ -86,3 +86,6 @@
- I don't want to introduce DBusObject, but refcounting and object
data could still be factored out into an internal "base class"
perhaps.
+
+ - Header fields names are required to be aligned on a 4 byte boundary
+ at the moment. No alignment should be neccessary.
diff --git a/doc/dbus-specification.sgml b/doc/dbus-specification.sgml
index 5d2982fc..a2dd1b13 100644
--- a/doc/dbus-specification.sgml
+++ b/doc/dbus-specification.sgml
@@ -257,22 +257,22 @@
In addition to the required header information mentioned
in <xref linkend="message-protocol-header-encoding">,
the header may contain zero or more named
- header fields. These fields are named to allow
- future versions of this protocol specification to
- add new fields; implementations must ignore fields
- they do not understand. Implementations must not
- invent their own header fields; only changes to
+ header fields. Future versions of this protocol
+ specification may add new fields. Implementations must
+ ignore fields they do not understand. Implementations
+ must not invent their own header fields; only changes to
this specification may introduce new header fields.
</para>
<para>
- Header field names MUST consist of 4 non-nul bytes. The field name is
- NOT nul terminated; it occupies exactly 4 bytes. Following the name, the
- field MUST have a type code represented as a single unsigned byte, and
- then a properly-aligned value of that type. See <xref
- linkend="message-protocol-arguments"> for a description of how each type
- is encoded. If an implementation sees a header field name that it does
- not understand, it MUST ignore that field.
+ Header fields MUST be aligned to a 4-byte boundary. Header field
+ names MUST consist of a single byte, possible values of which are
+ defined below. Following the name, the field MUST have a type code
+ represented as a single unsigned byte, and then a properly-aligned
+ value of that type. See <xref
+ linkend="message-protocol-arguments"> for a description of how each
+ type is encoded. If an implementation sees a header field name that
+ it does not understand, it MUST ignore that field.
</para>
<para>
@@ -281,51 +281,65 @@
<tgroup cols=3>
<thead>
<row>
- <entry>Name</entry>
+ <entry>Conventional Name</entry>
+ <entry>Decimal Value</entry>
<entry>Type</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
- <entry>path</entry>
+ <entry>INVALID</entry>
+ <entry>0</entry>
+ <entry>INVALID</entry>
+ <entry>Not a valid field name (error if it appears in a message)</entry>
+ </row>
+ <row>
+ <entry>PATH</entry>
+ <entry>1</entry>
<entry>STRING</entry>
<entry>The object to send the message to; objects are identified by
a path, "/foo/bar"</entry>
</row>
<row>
- <entry>ifce</entry>
+ <entry>INTERFACE</entry>
+ <entry>2</entry>
<entry>STRING</entry>
<entry>The interface to invoke a method call on, or
that a signal is emitted from. e.g. "org.freedesktop.Introspectable"</entry>
</row>
<row>
- <entry>mebr</entry>
+ <entry>MEMBER</entry>
+ <entry>3</entry>
<entry>STRING</entry>
<entry>The member, either the method name or signal name.
e.g. "Frobate"</entry>
</row>
<row>
- <entry>ernm</entry>
+ <entry>ERROR_NAME</entry>
+ <entry>4</entry>
<entry>STRING</entry>
<entry>The name of the error that occurred, for errors</entry>
</row>
<row>
- <entry>rply</entry>
+ <entry>REPLY_SERIAL</entry>
+ <entry>5</entry>
<entry>UINT32</entry>
<entry>The serial number of the message this message is a reply
to. (The serial number is one of the mandatory header fields,
see <xref linkend="message-protocol-header-encoding">.)</entry>
</row>
<row>
- <entry>srvc</entry>
+ <entry>SERVICE</entry>
+ <entry>6</entry>
<entry>STRING</entry>
<entry>The name of the service this message should be routed to.
Only used in combination with the message bus, see
<xref linkend="message-bus">.</entry>
</row>
<row>
- <entry>sdrs</entry>
+ <entry>SENDER_SERVICE</entry>
+ <entry>7</entry>
<entry>STRING</entry>
<entry>Sender service. The name of the base service that sent
this message. The message bus fills in this field; the field is
@@ -595,24 +609,24 @@
messages map naturally to methods on objects in a typical program.
</para>
<para>
- A method call message is expected to have a 'mebr' header field
+ A method call message is expected to have a MEMBER header field
indicating the name of the method. Optionally, the message has an
- 'ifce' field giving the interface the method is a part of. In the
- absence of an 'ifce' field, if two interfaces on the same object have
+ INTERFACE field giving the interface the method is a part of. In the
+ absence of an INTERFACE field, if two interfaces on the same object have
a method with the same name, it is undefined which of the two methods
will be invoked. Implementations may also choose to return an error in
this ambiguous case. However, if a method name is unique
implementations should not require an interface field.
</para>
<para>
- Method call messages also include a 'path' field indicating the
+ Method call messages also include a PATH field indicating the
object to invoke the method on. If the call is passing through
- a message bus, the message will also have a 'srvc' field giving
+ a message bus, the message will also have a SERVICE field giving
the service to receive the message.
</para>
<para>
When an application handles a method call message, it is expected to
- return a reply. The reply is identified by a 'rply' header field
+ return a reply. The reply is identified by a REPLY_SERIAL header field
indicating the serial number of the METHOD_CALL being replied to. The
reply can have one of two types; either METHOD_RETURN or ERROR.
</para>
@@ -673,9 +687,9 @@
<para>
Unlike method calls, signal emissions have no replies.
A signal emission is simply a single message of type SIGNAL.
- It must have three header fields: 'path' giving the object
- the signal was emitted from, plus 'ifce' and 'mebr' giving the
- fully-qualified name of the signal.
+ It must have three header fields: PATH giving the object
+ the signal was emitted from, plus INTERFACE and MEMBER giving
+ the fully-qualified name of the signal.
</para>
</sect3>
@@ -688,9 +702,9 @@
org.freedesktop.DBus.ActivateService (in STRING service_name, in UINT32 flags,
out UINT32 resultcode)
</programlisting>
- This means ifce = org.freedesktop.DBus, mebr = ActivateService,
+ This means INTERFACE = org.freedesktop.DBus, MEMBER = ActivateService,
METHOD_CALL arguments are STRING and UINT32, METHOD_RETURN argument
- is UINT32. Remember that the 'mebr' field can't contain any '.' (period)
+ is UINT32. Remember that the MEMBER field can't contain any '.' (period)
characters so it's known that the last part of the name in
the "IDL" is the member name.
</para>
@@ -1270,18 +1284,18 @@
the new owner of the service.
</para>
<para>
- Messages may have a <literal>srvc</literal> field (see <xref
+ Messages may have a <literal>SERVICE</literal> field (see <xref
linkend="message-protocol-header-fields">). When the message bus
- receives a message, if the <literal>srvc</literal> field is absent, the
+ receives a message, if the <literal>SERVICE</literal> field is absent, the
message is taken to be a standard peer-to-peer message and interpreted
by the message bus itself. For example, sending
an <literal>org.freedesktop.Peer.Ping</literal> message with no
- <literal>srvc</literal> will cause the message bus itself to reply
+ <literal>SERVICE</literal> will cause the message bus itself to reply
to the ping immediately; the message bus would never make
this message visible to other applications.
</para>
<para>
- If the <literal>srvc</literal> field is present, then it indicates a
+ If the <literal>SERVICE</literal> field is present, then it indicates a
request for the message bus to route the message. In the usual case,
messages are routed to the owner of the named service.
Messages may also be <firstterm>broadcast</firstterm>
@@ -1292,7 +1306,7 @@
</para>
<para>
Continuing the <literal>org.freedesktop.Peer.Ping</literal> example, if
- the ping message were sent with a <literal>srvc</literal> name of
+ the ping message were sent with a <literal>SERVICE</literal> name of
<literal>com.yoyodyne.Screensaver</literal>, then the ping would be
forwarded, and the Yoyodyne Corporation screensaver application would be
expected to reply to the ping. If
diff --git a/test/data/incomplete-messages/missing-body.message b/test/data/incomplete-messages/missing-body.message
index 69e371e0..138e9ea5 100644
--- a/test/data/incomplete-messages/missing-body.message
+++ b/test/data/incomplete-messages/missing-body.message
@@ -1,14 +1,14 @@
## message that's missing an expected body
VALID_HEADER method_call
-FIELD_NAME ifce
+HEADER_FIELD INTERFACE
TYPE STRING
STRING 'org.freedesktop.Foo'
-FIELD_NAME mebr
+HEADER_FIELD MEMBER
TYPE STRING
STRING 'Bar'
-END_LENGTH Header
ALIGN 8
+END_LENGTH Header
## create the body, then chop it off
START_LENGTH Body
diff --git a/test/data/invalid-messages/array-of-nil.message b/test/data/invalid-messages/array-of-nil.message
index 4810d318..7f0ac718 100644
--- a/test/data/invalid-messages/array-of-nil.message
+++ b/test/data/invalid-messages/array-of-nil.message
@@ -2,15 +2,16 @@
VALID_HEADER method_call
-FIELD_NAME ifce
+HEADER_FIELD INTERFACE
TYPE STRING
STRING 'org.freedesktop.Foo'
-FIELD_NAME mebr
+HEADER_FIELD MEMBER
TYPE STRING
STRING 'Bar'
-END_LENGTH Header
ALIGN 8
+END_LENGTH Header
+
START_LENGTH Body
TYPE ARRAY
TYPE NIL
diff --git a/test/data/invalid-messages/array-with-mixed-types.message b/test/data/invalid-messages/array-with-mixed-types.message
index 1bdd549b..4455c898 100644
--- a/test/data/invalid-messages/array-with-mixed-types.message
+++ b/test/data/invalid-messages/array-with-mixed-types.message
@@ -3,15 +3,16 @@
VALID_HEADER method_call
-FIELD_NAME ifce
+HEADER_FIELD INTERFACE
TYPE STRING
STRING 'org.freedesktop.Foo'
-FIELD_NAME mebr
+HEADER_FIELD MEMBER
TYPE STRING
STRING 'Bar'
-END_LENGTH Header
ALIGN 8
+END_LENGTH Header
+
START_LENGTH Body
TYPE ARRAY
diff --git a/test/data/invalid-messages/bad-boolean-array.message b/test/data/invalid-messages/bad-boolean-array.message
index e4df1903..91ad5ef1 100644
--- a/test/data/invalid-messages/bad-boolean-array.message
+++ b/test/data/invalid-messages/bad-boolean-array.message
@@ -3,15 +3,16 @@
## VALID_HEADER includes a LENGTH Header and LENGTH Body
VALID_HEADER method_call
-FIELD_NAME ifce
+HEADER_FIELD INTERFACE
TYPE STRING
STRING 'org.freedesktop.Foo'
-FIELD_NAME mebr
+HEADER_FIELD MEMBER
TYPE STRING
STRING 'Bar'
ALIGN 8
END_LENGTH Header
+
START_LENGTH Body
TYPE ARRAY
TYPE BOOLEAN
diff --git a/test/data/invalid-messages/bad-boolean.message b/test/data/invalid-messages/bad-boolean.message
index 7b518d57..cd588ad8 100644
--- a/test/data/invalid-messages/bad-boolean.message
+++ b/test/data/invalid-messages/bad-boolean.message
@@ -3,15 +3,16 @@
## VALID_HEADER includes a LENGTH Header and LENGTH Body
VALID_HEADER method_call
-FIELD_NAME ifce
+HEADER_FIELD INTERFACE
TYPE STRING
STRING 'org.freedesktop.Foo'
-FIELD_NAME mebr
+HEADER_FIELD MEMBER
TYPE STRING
STRING 'Bar'
ALIGN 8
END_LENGTH Header
+
START_LENGTH Body
TYPE BOOLEAN
BYTE 3
diff --git a/test/data/invalid-messages/bad-endian.message b/test/data/invalid-messages/bad-endian.message
index c08f0188..8d609244 100644
--- a/test/data/invalid-messages/bad-endian.message
+++ b/test/data/invalid-messages/bad-endian.message
@@ -8,15 +8,14 @@ BYTE 0
LENGTH Header
LENGTH Body
-FIELD_NAME ifce
+HEADER_FIELD INTERFACE
TYPE STRING
STRING 'org.freedesktop.Foo'
-FIELD_NAME mebr
+HEADER_FIELD MEMBER
TYPE STRING
STRING 'Bar'
ALIGN 8
-
END_LENGTH Header
START_LENGTH Body
diff --git a/test/data/invalid-messages/local-namespace.message b/test/data/invalid-messages/local-namespace.message
index f485d70c..dad98a77 100644
--- a/test/data/invalid-messages/local-namespace.message
+++ b/test/data/invalid-messages/local-namespace.message
@@ -4,14 +4,15 @@
## VALID_HEADER includes a LENGTH Header and LENGTH Body
VALID_HEADER method_call
-FIELD_NAME ifce
+HEADER_FIELD INTERFACE
TYPE STRING
STRING 'org.freedesktop.Local'
-FIELD_NAME mebr
+HEADER_FIELD MEMBER
TYPE STRING
STRING 'Disconnected'
ALIGN 8
END_LENGTH Header
+
START_LENGTH Body
END_LENGTH Body
diff --git a/test/data/invalid-messages/no-dot-in-name.message b/test/data/invalid-messages/no-dot-in-name.message
index 53e288d0..131be05d 100644
--- a/test/data/invalid-messages/no-dot-in-name.message
+++ b/test/data/invalid-messages/no-dot-in-name.message
@@ -3,10 +3,10 @@
## VALID_HEADER includes a LENGTH Header and LENGTH Body
VALID_HEADER method_call
-FIELD_NAME ifce
+HEADER_FIELD INTERFACE
TYPE STRING
STRING 'NoDotInHere'
-FIELD_NAME mebr
+HEADER_FIELD MEMBER
TYPE STRING
STRING 'Bar'
diff --git a/test/data/invalid-messages/not-nul-header-padding.message b/test/data/invalid-messages/not-nul-header-padding.message
index f98812c2..a12c0fa7 100644
--- a/test/data/invalid-messages/not-nul-header-padding.message
+++ b/test/data/invalid-messages/not-nul-header-padding.message
@@ -3,14 +3,14 @@
## VALID_HEADER includes a LENGTH Header and LENGTH Body
VALID_HEADER method_call
-FIELD_NAME ifce
+HEADER_FIELD INTERFACE
TYPE STRING
STRING 'org.freedesktop.Foo'
-FIELD_NAME mebr
+HEADER_FIELD MEMBER
TYPE STRING
STRING 'Bar'
-FIELD_NAME unkn
+HEADER_FIELD UNKNOWN
TYPE STRING
STRING 'a'
ALIGN 8
diff --git a/test/data/invalid-messages/overlong-name.message b/test/data/invalid-messages/overlong-name.message
index 4108a037..4fd7025e 100644
--- a/test/data/invalid-messages/overlong-name.message
+++ b/test/data/invalid-messages/overlong-name.message
@@ -2,11 +2,11 @@
## VALID_HEADER includes a LENGTH Header and LENGTH Body
VALID_HEADER method_call
-FIELD_NAME ifce
+HEADER_FIELD INTERFACE
TYPE STRING
STRING 'org.foo.bar.this.is.really.long 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200'
-FIELD_NAME mebr
+HEADER_FIELD MEMBER
TYPE STRING
STRING 'Bar'
diff --git a/test/data/invalid-messages/too-little-header-padding.message b/test/data/invalid-messages/too-little-header-padding.message
index f6e7af4b..894e4c3e 100644
--- a/test/data/invalid-messages/too-little-header-padding.message
+++ b/test/data/invalid-messages/too-little-header-padding.message
@@ -3,14 +3,14 @@
## VALID_HEADER includes a LENGTH Header and LENGTH Body
VALID_HEADER method_call
-FIELD_NAME ifce
+HEADER_FIELD INTERFACE
TYPE STRING
STRING 'org.freedesktop.Foo'
-FIELD_NAME mebr
+HEADER_FIELD MEMBER
TYPE STRING
STRING 'Bar'
-FIELD_NAME unkn
+HEADER_FIELD UNKNOWN
TYPE STRING
STRING 'a'
ALIGN 8
diff --git a/test/data/invalid-messages/too-much-header-padding-by-far.message b/test/data/invalid-messages/too-much-header-padding-by-far.message
index 6cc5b391..b74f559b 100644
--- a/test/data/invalid-messages/too-much-header-padding-by-far.message
+++ b/test/data/invalid-messages/too-much-header-padding-by-far.message
@@ -3,14 +3,14 @@
## VALID_HEADER includes a LENGTH Header and LENGTH Body
VALID_HEADER method_call
-FIELD_NAME ifce
+HEADER_FIELD INTERFACE
TYPE STRING
STRING 'org.freedesktop.Foo'
-FIELD_NAME mebr
+HEADER_FIELD MEMBER
TYPE STRING
STRING 'Bar'
-FIELD_NAME unkn
+HEADER_FIELD UNKNOWN
TYPE STRING
STRING 'a'
ALIGN 8
diff --git a/test/data/invalid-messages/too-much-header-padding.message b/test/data/invalid-messages/too-much-header-padding.message
index 6cf004b9..01111b63 100644
--- a/test/data/invalid-messages/too-much-header-padding.message
+++ b/test/data/invalid-messages/too-much-header-padding.message
@@ -3,14 +3,14 @@
## VALID_HEADER includes a LENGTH Header and LENGTH Body
VALID_HEADER method_call
-FIELD_NAME ifce
+HEADER_FIELD INTERFACE
TYPE STRING
STRING 'org.freedesktop.Foo'
-FIELD_NAME mebr
+HEADER_FIELD MEMBER
TYPE STRING
STRING 'Bar'
-FIELD_NAME unkn
+HEADER_FIELD UNKNOWN
TYPE STRING
STRING 'a'
ALIGN 8
diff --git a/test/data/invalid-messages/too-short-dict.message b/test/data/invalid-messages/too-short-dict.message
index 59621126..fde88850 100644
--- a/test/data/invalid-messages/too-short-dict.message
+++ b/test/data/invalid-messages/too-short-dict.message
@@ -2,10 +2,10 @@
VALID_HEADER method_call
-FIELD_NAME ifce
+HEADER_FIELD INTERFACE
TYPE STRING
STRING 'org.freedesktop.Foo'
-FIELD_NAME mebr
+HEADER_FIELD MEMBER
TYPE STRING
STRING 'Bar'
diff --git a/test/data/valid-messages/array-of-array-of-uint32.message b/test/data/valid-messages/array-of-array-of-uint32.message
index 692eca06..e12186b1 100644
--- a/test/data/valid-messages/array-of-array-of-uint32.message
+++ b/test/data/valid-messages/array-of-array-of-uint32.message
@@ -2,8 +2,8 @@
VALID_HEADER method_call
REQUIRED_FIELDS
-END_LENGTH Header
ALIGN 8
+END_LENGTH Header
START_LENGTH Body
TYPE ARRAY
diff --git a/test/data/valid-messages/dict-simple.message b/test/data/valid-messages/dict-simple.message
index 6986d439..fa6927df 100644
--- a/test/data/valid-messages/dict-simple.message
+++ b/test/data/valid-messages/dict-simple.message
@@ -2,8 +2,8 @@
VALID_HEADER method_call
REQUIRED_FIELDS
-END_LENGTH Header
ALIGN 8
+END_LENGTH Header
START_LENGTH Body
TYPE DICT
LENGTH Dict
diff --git a/test/data/valid-messages/emptiness.message b/test/data/valid-messages/emptiness.message
index dbf531ca..32042c01 100644
--- a/test/data/valid-messages/emptiness.message
+++ b/test/data/valid-messages/emptiness.message
@@ -2,8 +2,8 @@
VALID_HEADER method_call
REQUIRED_FIELDS
-END_LENGTH Header
ALIGN 8
+END_LENGTH Header
START_LENGTH Body
TYPE STRING
INT32 0
diff --git a/test/data/valid-messages/lots-of-arguments.message b/test/data/valid-messages/lots-of-arguments.message
index 993755ab..d3f6a4ee 100644
--- a/test/data/valid-messages/lots-of-arguments.message
+++ b/test/data/valid-messages/lots-of-arguments.message
@@ -2,8 +2,8 @@
VALID_HEADER method_call
REQUIRED_FIELDS
-END_LENGTH Header
ALIGN 8
+END_LENGTH Header
START_LENGTH Body
TYPE NIL
TYPE BYTE
diff --git a/test/data/valid-messages/no-padding.message b/test/data/valid-messages/no-padding.message
index e6d27d9d..94df4d45 100644
--- a/test/data/valid-messages/no-padding.message
+++ b/test/data/valid-messages/no-padding.message
@@ -7,7 +7,7 @@ REQUIRED_FIELDS
## this byte array is filled with zeros to the natural length
## of the header
-FIELD_NAME unkn
+HEADER_FIELD UNKNOWN
TYPE ARRAY
TYPE BYTE
ALIGN 4
diff --git a/test/data/valid-messages/opposite-endian.message b/test/data/valid-messages/opposite-endian.message
index c638b7b0..90949dd2 100644
--- a/test/data/valid-messages/opposite-endian.message
+++ b/test/data/valid-messages/opposite-endian.message
@@ -7,7 +7,7 @@ VALID_HEADER method_call
REQUIRED_FIELDS
-FIELD_NAME unkn
+HEADER_FIELD UNKNOWN
TYPE INT32
INT32 0xfeeb
diff --git a/test/data/valid-messages/recursive-types.message b/test/data/valid-messages/recursive-types.message
index 192fd9b7..e306fd1f 100644
--- a/test/data/valid-messages/recursive-types.message
+++ b/test/data/valid-messages/recursive-types.message
@@ -5,6 +5,7 @@ VALID_HEADER method_call
REQUIRED_FIELDS
+ALIGN 8
END_LENGTH Header
START_LENGTH Body
diff --git a/test/data/valid-messages/simplest-manual.message b/test/data/valid-messages/simplest-manual.message
index 9779234b..5a5b4105 100644
--- a/test/data/valid-messages/simplest-manual.message
+++ b/test/data/valid-messages/simplest-manual.message
@@ -11,13 +11,13 @@ LENGTH Body
## client serial
INT32 7
-FIELD_NAME path
+HEADER_FIELD PATH
TYPE OBJECT_PATH
OBJECT_PATH '/foo'
-FIELD_NAME ifce
+HEADER_FIELD INTERFACE
TYPE STRING
STRING 'org.freedesktop.Foo'
-FIELD_NAME mebr
+HEADER_FIELD MEMBER
TYPE STRING
STRING 'Bar'
diff --git a/test/data/valid-messages/standard-acquire-service.message b/test/data/valid-messages/standard-acquire-service.message
index f313061f..a42a639c 100644
--- a/test/data/valid-messages/standard-acquire-service.message
+++ b/test/data/valid-messages/standard-acquire-service.message
@@ -1,16 +1,16 @@
# Standard org.freedesktop.DBus.AcquireService message
VALID_HEADER method_call
-FIELD_NAME path
+HEADER_FIELD PATH
TYPE OBJECT_PATH
OBJECT_PATH '/org/freedesktop/DBus'
-FIELD_NAME ifce
+HEADER_FIELD INTERFACE
TYPE STRING
STRING 'org.freedesktop.DBus'
-FIELD_NAME mebr
+HEADER_FIELD MEMBER
TYPE STRING
STRING 'AcquireService'
-FIELD_NAME srvc
+HEADER_FIELD SERVICE
TYPE STRING
STRING 'org.freedesktop.DBus'
ALIGN 8
diff --git a/test/data/valid-messages/standard-hello.message b/test/data/valid-messages/standard-hello.message
index 795ede74..50d4e0ff 100644
--- a/test/data/valid-messages/standard-hello.message
+++ b/test/data/valid-messages/standard-hello.message
@@ -1,16 +1,16 @@
# Standard org.freedesktop.DBus.Hello message
VALID_HEADER method_call
-FIELD_NAME path
+HEADER_FIELD PATH
TYPE OBJECT_PATH
OBJECT_PATH '/org/freedesktop/DBus'
-FIELD_NAME ifce
+HEADER_FIELD INTERFACE
TYPE STRING
STRING 'org.freedesktop.DBus'
-FIELD_NAME mebr
+HEADER_FIELD MEMBER
TYPE STRING
STRING 'Hello'
-FIELD_NAME srvc
+HEADER_FIELD SERVICE
TYPE STRING
STRING 'org.freedesktop.DBus'
ALIGN 8
diff --git a/test/data/valid-messages/standard-list-services.message b/test/data/valid-messages/standard-list-services.message
index 4c9c7c66..10c9a2f7 100644
--- a/test/data/valid-messages/standard-list-services.message
+++ b/test/data/valid-messages/standard-list-services.message
@@ -1,16 +1,16 @@
# Standard org.freedesktop.DBus.ListServices message
VALID_HEADER method_call
-FIELD_NAME path
+HEADER_FIELD PATH
TYPE OBJECT_PATH
OBJECT_PATH '/org/freedesktop/DBus'
-FIELD_NAME ifce
+HEADER_FIELD INTERFACE
TYPE STRING
STRING 'org.freedesktop.DBus'
-FIELD_NAME mebr
+HEADER_FIELD MEMBER
TYPE STRING
STRING 'ListServices'
-FIELD_NAME srvc
+HEADER_FIELD SERVICES
TYPE STRING
STRING 'org.freedesktop.DBus'
ALIGN 8
diff --git a/test/data/valid-messages/standard-service-exists.message b/test/data/valid-messages/standard-service-exists.message
index ce14811a..c3b715bc 100644
--- a/test/data/valid-messages/standard-service-exists.message
+++ b/test/data/valid-messages/standard-service-exists.message
@@ -1,16 +1,16 @@
# Standard org.freedesktop.DBus.ServiceExists message
VALID_HEADER method_call
-FIELD_NAME path
+HEADER_FIELD PATH
TYPE OBJECT_PATH
OBJECT_PATH '/org/freedesktop/DBus'
-FIELD_NAME ifce
+HEADER_FIELD INTERFACE
TYPE STRING
STRING 'org.freedesktop.DBus'
-FIELD_NAME mebr
+HEADER_FIELD MEMBER
TYPE STRING
STRING 'ServiceExists'
-FIELD_NAME srvc
+HEADER_FIELD SERVICE
TYPE STRING
STRING 'org.freedesktop.DBus'
ALIGN 8
diff --git a/test/data/valid-messages/unknown-header-field.message b/test/data/valid-messages/unknown-header-field.message
index 5d95f812..973def68 100644
--- a/test/data/valid-messages/unknown-header-field.message
+++ b/test/data/valid-messages/unknown-header-field.message
@@ -3,7 +3,7 @@
## VALID_HEADER includes a LENGTH Header and LENGTH Body
VALID_HEADER method_call
REQUIRED_FIELDS
-FIELD_NAME unkn
+HEADER_FIELD UNKNOWN
TYPE INT32
INT32 0xfeeb
ALIGN 8