diff options
-rw-r--r-- | ChangeLog | 28 | ||||
-rw-r--r-- | bus/driver.c | 78 | ||||
-rw-r--r-- | dbus/dbus-bus.c | 32 | ||||
-rw-r--r-- | dbus/dbus-errors.c | 4 | ||||
-rw-r--r-- | dbus/dbus-errors.h | 2 | ||||
-rw-r--r-- | dbus/dbus-message.c | 148 | ||||
-rw-r--r-- | dbus/dbus-message.h | 88 | ||||
-rw-r--r-- | test/bus-test.c | 6 |
8 files changed, 204 insertions, 182 deletions
@@ -1,5 +1,33 @@ 2003-02-13 Anders Carlsson <andersca@codefactory.se> + * bus/driver.c: (bus_driver_send_service_deleted), + (bus_driver_send_service_created), (bus_driver_send_service_lost), + (bus_driver_send_service_acquired), (bus_driver_handle_hello), + (bus_driver_send_welcome_message), + (bus_driver_handle_list_services), + (bus_driver_handle_acquire_service), + (bus_driver_handle_service_exists): + * dbus/dbus-bus.c: (dbus_bus_register_client), + (dbus_bus_acquire_service), (dbus_bus_service_exists): + * dbus/dbus-errors.c: (dbus_result_to_string): + * dbus/dbus-errors.h: + * dbus/dbus-message.c: (dbus_message_append_args), + (dbus_message_append_args_valist), (dbus_message_get_args), + (dbus_message_get_args_valist), (dbus_message_get_args_iter), + (dbus_message_iter_get_arg_type), (dbus_message_iter_get_string), + (dbus_message_iter_get_byte_array), + (dbus_message_iter_get_string_array), (message_iter_test), + (check_message_handling), (_dbus_message_test): + * dbus/dbus-message.h: + * test/bus-test.c: (main): + Change fields to arguments in messages, so that they won't be + confused with header fields. + + * glib/test-dbus-glib.c: (main): + Remove append_fields from hello message. + +2003-02-13 Anders Carlsson <andersca@codefactory.se> + * dbus/dbus-errors.c: * dbus/dbus-message.c: * dbus/dbus-string.c: diff --git a/bus/driver.c b/bus/driver.c index 3b79ea56..25d6d263 100644 --- a/bus/driver.c +++ b/bus/driver.c @@ -45,9 +45,9 @@ bus_driver_send_service_deleted (const char *service_name) BUS_HANDLE_OOM (dbus_message_set_sender (message, DBUS_SERVICE_DBUS)); - BUS_HANDLE_OOM (dbus_message_append_fields (message, - DBUS_TYPE_STRING, service_name, - 0)); + BUS_HANDLE_OOM (dbus_message_append_args (message, + DBUS_TYPE_STRING, service_name, + 0)); bus_dispatch_broadcast_message (message); dbus_message_unref (message); } @@ -62,9 +62,9 @@ bus_driver_send_service_created (const char *service_name) BUS_HANDLE_OOM (dbus_message_set_sender (message, DBUS_SERVICE_DBUS)); - BUS_HANDLE_OOM (dbus_message_append_fields (message, - DBUS_TYPE_STRING, service_name, - 0)); + BUS_HANDLE_OOM (dbus_message_append_args (message, + DBUS_TYPE_STRING, service_name, + 0)); bus_dispatch_broadcast_message (message); dbus_message_unref (message); } @@ -79,9 +79,9 @@ bus_driver_send_service_lost (DBusConnection *connection, DBUS_MESSAGE_SERVICE_LOST)); BUS_HANDLE_OOM (dbus_message_set_sender (message, DBUS_SERVICE_DBUS)); - BUS_HANDLE_OOM (dbus_message_append_fields (message, - DBUS_TYPE_STRING, service_name, - 0)); + BUS_HANDLE_OOM (dbus_message_append_args (message, + DBUS_TYPE_STRING, service_name, + 0)); BUS_HANDLE_OOM (dbus_connection_send_message (connection, message, NULL, NULL)); dbus_message_unref (message); @@ -97,9 +97,9 @@ bus_driver_send_service_acquired (DBusConnection *connection, DBUS_MESSAGE_SERVICE_ACQUIRED)); BUS_HANDLE_OOM (dbus_message_set_sender (message, DBUS_SERVICE_DBUS)); - BUS_HANDLE_OOM (dbus_message_append_fields (message, - DBUS_TYPE_STRING, service_name, - 0)); + BUS_HANDLE_OOM (dbus_message_append_args (message, + DBUS_TYPE_STRING, service_name, + 0)); BUS_HANDLE_OOM (dbus_connection_send_message (connection, message, NULL, NULL)); dbus_message_unref (message); @@ -182,7 +182,7 @@ bus_driver_handle_hello (DBusConnection *connection, BUS_HANDLE_OOM (bus_connection_set_name (connection, &unique_name)); BUS_HANDLE_OOM (dbus_message_set_sender (message, - bus_connection_get_name (connection))); + bus_connection_get_name (connection))); _dbus_string_free (&unique_name); @@ -206,9 +206,9 @@ bus_driver_send_welcome_message (DBusConnection *connection, BUS_HANDLE_OOM (dbus_message_set_sender (welcome, DBUS_SERVICE_DBUS)); - BUS_HANDLE_OOM (dbus_message_append_fields (welcome, - DBUS_TYPE_STRING, name, - NULL)); + BUS_HANDLE_OOM (dbus_message_append_args (welcome, + DBUS_TYPE_STRING, name, + NULL)); BUS_HANDLE_OOM (dbus_connection_send_message (connection, welcome, NULL, NULL)); @@ -227,9 +227,9 @@ bus_driver_handle_list_services (DBusConnection *connection, BUS_HANDLE_OOM (services = bus_services_list (&len)); - BUS_HANDLE_OOM (dbus_message_append_fields (reply, - DBUS_TYPE_STRING_ARRAY, services, len, - 0)); + BUS_HANDLE_OOM (dbus_message_append_args (reply, + DBUS_TYPE_STRING_ARRAY, services, len, + 0)); BUS_HANDLE_OOM (dbus_connection_send_message (connection, reply, NULL, NULL)); @@ -255,10 +255,10 @@ bus_driver_handle_acquire_service (DBusConnection *connection, int service_reply; int flags; - BUS_HANDLE_OOM ((result = dbus_message_get_fields (message, - DBUS_TYPE_STRING, &name, - DBUS_TYPE_UINT32, &flags, - 0)) != DBUS_RESULT_NO_MEMORY); + BUS_HANDLE_OOM ((result = dbus_message_get_args (message, + DBUS_TYPE_STRING, &name, + DBUS_TYPE_UINT32, &flags, + 0)) != DBUS_RESULT_NO_MEMORY); if (result != DBUS_RESULT_SUCCESS) { @@ -324,7 +324,7 @@ bus_driver_handle_acquire_service (DBusConnection *connection, service_reply = DBUS_SERVICE_REPLY_PRIMARY_OWNER; } - BUS_HANDLE_OOM (dbus_message_append_fields (reply, DBUS_TYPE_UINT32, service_reply, 0)); + BUS_HANDLE_OOM (dbus_message_append_args (reply, DBUS_TYPE_UINT32, service_reply, 0)); /* Send service reply */ BUS_HANDLE_OOM (dbus_connection_send_message (connection, reply, NULL, NULL)); @@ -342,28 +342,28 @@ bus_driver_handle_service_exists (DBusConnection *connection, BusService *service; char *name; - BUS_HANDLE_OOM ((result = dbus_message_get_fields (message, - DBUS_TYPE_STRING, &name, - 0)) != DBUS_RESULT_NO_MEMORY); - if (result != DBUS_RESULT_SUCCESS) + BUS_HANDLE_OOM ((result = dbus_message_get_args (message, + DBUS_TYPE_STRING, &name, + 0)) != DBUS_RESULT_NO_MEMORY); + if (result != DBUS_RESULT_SUCCESS) { dbus_free (name); dbus_connection_disconnect (connection); return; } - _dbus_string_init_const (&service_name, name); - service = bus_service_lookup (&service_name, FALSE); + _dbus_string_init_const (&service_name, name); + service = bus_service_lookup (&service_name, FALSE); - BUS_HANDLE_OOM ((reply = dbus_message_new_reply (message))); - BUS_HANDLE_OOM (dbus_message_set_sender (reply, DBUS_SERVICE_DBUS)); - - BUS_HANDLE_OOM (dbus_message_append_fields (reply, - DBUS_TYPE_UINT32, service != NULL, - 0)); - BUS_HANDLE_OOM (dbus_connection_send_message (connection, reply, NULL, NULL)); - dbus_message_unref (reply); - dbus_free (name); + BUS_HANDLE_OOM ((reply = dbus_message_new_reply (message))); + BUS_HANDLE_OOM (dbus_message_set_sender (reply, DBUS_SERVICE_DBUS)); + + BUS_HANDLE_OOM (dbus_message_append_args (reply, + DBUS_TYPE_UINT32, service != NULL, + 0)); + BUS_HANDLE_OOM (dbus_connection_send_message (connection, reply, NULL, NULL)); + dbus_message_unref (reply); + dbus_free (name); } void diff --git a/dbus/dbus-bus.c b/dbus/dbus-bus.c index a9468ed6..776c78ae 100644 --- a/dbus/dbus-bus.c +++ b/dbus/dbus-bus.c @@ -64,9 +64,9 @@ dbus_bus_register_client (DBusConnection *connection, if (!reply) return NULL; - code = dbus_message_get_fields (reply, - DBUS_TYPE_STRING, &name, - 0); + code = dbus_message_get_args (reply, + DBUS_TYPE_STRING, &name, + 0); if (code != DBUS_RESULT_SUCCESS) { dbus_set_result (result, code); @@ -106,10 +106,10 @@ dbus_bus_acquire_service (DBusConnection *connection, return -1; } - if (!dbus_message_append_fields (message, - DBUS_TYPE_STRING, service_name, - DBUS_TYPE_UINT32, flags, - 0)) + if (!dbus_message_append_args (message, + DBUS_TYPE_STRING, service_name, + DBUS_TYPE_UINT32, flags, + 0)) { dbus_message_unref (message); dbus_set_result (result, DBUS_RESULT_NO_MEMORY); @@ -122,9 +122,9 @@ dbus_bus_acquire_service (DBusConnection *connection, if (!reply) return -1; - code = dbus_message_get_fields (reply, - DBUS_TYPE_UINT32, &service_result, - 0); + code = dbus_message_get_args (reply, + DBUS_TYPE_UINT32, &service_result, + 0); if (code != DBUS_RESULT_SUCCESS) { dbus_set_result (result, code); @@ -161,9 +161,9 @@ dbus_bus_service_exists (DBusConnection *connection, return FALSE; } - if (!dbus_message_append_fields (message, - DBUS_TYPE_STRING, service_name, - 0)) + if (!dbus_message_append_args (message, + DBUS_TYPE_STRING, service_name, + 0)) { dbus_message_unref (message); dbus_set_result (result, DBUS_RESULT_NO_MEMORY); @@ -176,9 +176,9 @@ dbus_bus_service_exists (DBusConnection *connection, if (!reply) return FALSE; - code = dbus_message_get_fields (reply, - DBUS_TYPE_UINT32, &exists, - 0); + code = dbus_message_get_args (reply, + DBUS_TYPE_UINT32, &exists, + 0); if (code != DBUS_RESULT_SUCCESS) { dbus_set_result (result, code); diff --git a/dbus/dbus-errors.c b/dbus/dbus-errors.c index 86bdc037..9c178d84 100644 --- a/dbus/dbus-errors.c +++ b/dbus/dbus-errors.c @@ -111,8 +111,8 @@ dbus_result_to_string (DBusResultCode code) return "Address already in use"; case DBUS_RESULT_DISCONNECTED: return "Disconnected."; - case DBUS_RESULT_INVALID_FIELDS: - return "Invalid fields."; + case DBUS_RESULT_INVALID_ARGS: + return "Invalid argumemts."; case DBUS_RESULT_NO_REPLY: return "Did not get a reply message."; case DBUS_RESULT_FILE_NOT_FOUND: diff --git a/dbus/dbus-errors.h b/dbus/dbus-errors.h index a8347ec0..55e2c315 100644 --- a/dbus/dbus-errors.h +++ b/dbus/dbus-errors.h @@ -63,7 +63,7 @@ typedef enum DBUS_RESULT_NO_NETWORK, /**< Can't find the network */ DBUS_RESULT_ADDRESS_IN_USE, /**< Someone's already using the address */ DBUS_RESULT_DISCONNECTED, /**< No more connection. */ - DBUS_RESULT_INVALID_FIELDS, /**< One or more invalid fields encountered. */ + DBUS_RESULT_INVALID_ARGS, /**< One or more invalid arguments encountered. */ DBUS_RESULT_NO_REPLY, /**< Did not get a reply message. */ DBUS_RESULT_FILE_NOT_FOUND /**< File doesn't exist */ } DBusResultCode; diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c index dbdd141c..4287bd95 100644 --- a/dbus/dbus-message.c +++ b/dbus/dbus-message.c @@ -950,22 +950,22 @@ dbus_message_get_service (DBusMessage *message) * with 0. * * @param message the message - * @param first_field_type type of the first field - * @param ... value of first field, list of additional type-value pairs + * @param first_argument_type type of the first argument + * @param ... value of first argument, list of additional type-value pairs * @returns #TRUE on success */ dbus_bool_t -dbus_message_append_fields (DBusMessage *message, - int first_field_type, - ...) +dbus_message_append_args (DBusMessage *message, + int first_arg_type, + ...) { dbus_bool_t retval; va_list var_args; - va_start (var_args, first_field_type); - retval = dbus_message_append_fields_valist (message, - first_field_type, - var_args); + va_start (var_args, first_arg_type); + retval = dbus_message_append_args_valist (message, + first_arg_type, + var_args); va_end (var_args); return retval; @@ -974,22 +974,22 @@ dbus_message_append_fields (DBusMessage *message, /** * This function takes a va_list for use by language bindings * - * @see dbus_message_append_fields. + * @see dbus_message_append_args. * @param message the message - * @param first_field_type type of first field - * @param var_args value of first field, then list of type/value pairs + * @param first_arg_type type of first argument + * @param var_args value of first argument, then list of type/value pairs * @returns #TRUE on success */ dbus_bool_t -dbus_message_append_fields_valist (DBusMessage *message, - int first_field_type, - va_list var_args) +dbus_message_append_args_valist (DBusMessage *message, + int first_arg_type, + va_list var_args) { int type, old_len; old_len = _dbus_string_get_length (&message->body); - type = first_field_type; + type = first_arg_type; while (type != 0) { @@ -1193,28 +1193,26 @@ dbus_message_append_string_array (DBusMessage *message, } /** - * Gets fields from a message given a variable argument list. + * Gets arguments from a message given a variable argument list. * The variable argument list should contain the type of the - * field followed by a pointer to where the value should be + * argumen followed by a pointer to where the value should be * stored. The list is terminated with 0. * - * @todo rename get_args to avoid confusion with header fields - * * @param message the message - * @param first_field_type the first field type - * @param ... location for first field value, then list of type-location pairs + * @param first_arg_type the first argument type + * @param ... location for first argument value, then list of type-location pairs * @returns result code */ DBusResultCode -dbus_message_get_fields (DBusMessage *message, - int first_field_type, - ...) +dbus_message_get_args (DBusMessage *message, + int first_arg_type, + ...) { DBusResultCode retval; va_list var_args; - va_start (var_args, first_field_type); - retval = dbus_message_get_fields_valist (message, first_field_type, var_args); + va_start (var_args, first_arg_type); + retval = dbus_message_get_args_valist (message, first_arg_type, var_args); va_end (var_args); return retval; @@ -1230,45 +1228,43 @@ dbus_message_get_fields (DBusMessage *message, * to the arg that's bad, as that would be a security hole * (allow one app to force another to leak memory) * - * @todo We need to free the field data when an error occurs. - * - * @todo rename get_args_valist to avoid confusion with header fields + * @todo We need to free the argument data when an error occurs. * - * @see dbus_message_get_fields + * @see dbus_message_get_args * @param message the message - * @param first_field_type type of the first field - * @param var_args return location for first field, followed by list of type/location pairs + * @param first_arg_type type of the first argument + * @param var_args return location for first argument, followed by list of type/location pairs * @returns result code */ DBusResultCode -dbus_message_get_fields_valist (DBusMessage *message, - int first_field_type, - va_list var_args) +dbus_message_get_args_valist (DBusMessage *message, + int first_arg_type, + va_list var_args) { int spec_type, msg_type, i; DBusMessageIter *iter; - iter = dbus_message_get_fields_iter (message); + iter = dbus_message_get_args_iter (message); if (iter == NULL) return DBUS_RESULT_NO_MEMORY; - spec_type = first_field_type; + spec_type = first_arg_type; i = 0; while (spec_type != 0) { - msg_type = dbus_message_iter_get_field_type (iter); + msg_type = dbus_message_iter_get_arg_type (iter); if (msg_type != spec_type) { - _dbus_verbose ("Field %d is specified to be of type \"%s\", but " + _dbus_verbose ("Argument %d is specified to be of type \"%s\", but " "is actually of type \"%s\"\n", i, _dbus_type_to_string (spec_type), _dbus_type_to_string (msg_type)); dbus_message_iter_unref (iter); - return DBUS_RESULT_INVALID_FIELDS; + return DBUS_RESULT_INVALID_ARGS; } switch (spec_type) @@ -1356,7 +1352,7 @@ dbus_message_get_fields_valist (DBusMessage *message, _dbus_verbose ("More fields than exist in the message were specified or field is corrupt\n"); dbus_message_iter_unref (iter); - return DBUS_RESULT_INVALID_FIELDS; + return DBUS_RESULT_INVALID_ARGS; } i++; } @@ -1366,7 +1362,7 @@ dbus_message_get_fields_valist (DBusMessage *message, } /** - * Returns a DBusMessageIter representing the fields of the + * Returns a DBusMessageIter representing the arguments of the * message passed in. * * @todo IMO the message iter should follow the GtkTextIter pattern, @@ -1375,13 +1371,11 @@ dbus_message_get_fields_valist (DBusMessage *message, * ref/unref is kind of annoying to deal with, and slower too. * This implies not ref'ing the message from the iter. * - * @todo rename get_args_iter to avoid confusion with header fields - * * @param message the message * @returns a new iter. */ DBusMessageIter * -dbus_message_get_fields_iter (DBusMessage *message) +dbus_message_get_args_iter (DBusMessage *message) { DBusMessageIter *iter; @@ -1479,14 +1473,14 @@ dbus_message_iter_next (DBusMessageIter *iter) } /** - * Returns the field type of the field that the + * Returns the argument type of the argument that the * message iterator points at. * * @param iter the message iter * @returns the field type */ int -dbus_message_iter_get_field_type (DBusMessageIter *iter) +dbus_message_iter_get_arg_type (DBusMessageIter *iter) { const char *data; @@ -1513,7 +1507,7 @@ dbus_message_iter_get_field_type (DBusMessageIter *iter) char * dbus_message_iter_get_string (DBusMessageIter *iter) { - _dbus_assert (dbus_message_iter_get_field_type (iter) == DBUS_TYPE_STRING); + _dbus_assert (dbus_message_iter_get_arg_type (iter) == DBUS_TYPE_STRING); return _dbus_demarshal_string (&iter->message->body, iter->message->byte_order, iter->pos + 1, NULL); @@ -1583,7 +1577,7 @@ unsigned char * dbus_message_iter_get_byte_array (DBusMessageIter *iter, int *len) { - _dbus_assert (dbus_message_iter_get_field_type (iter) == DBUS_TYPE_BYTE_ARRAY); + _dbus_assert (dbus_message_iter_get_arg_type (iter) == DBUS_TYPE_BYTE_ARRAY); return _dbus_demarshal_byte_array (&iter->message->body, iter->message->byte_order, iter->pos + 1, NULL, len); @@ -1605,7 +1599,7 @@ char ** dbus_message_iter_get_string_array (DBusMessageIter *iter, int *len) { - _dbus_assert (dbus_message_iter_get_field_type (iter) == DBUS_TYPE_STRING_ARRAY); + _dbus_assert (dbus_message_iter_get_arg_type (iter) == DBUS_TYPE_STRING_ARRAY); return _dbus_demarshal_string_array (&iter->message->body, iter->message->byte_order, iter->pos + 1, NULL, len); @@ -2270,11 +2264,11 @@ message_iter_test (DBusMessage *message) DBusMessageIter *iter; char *str; - iter = dbus_message_get_fields_iter (message); + iter = dbus_message_get_args_iter (message); /* String tests */ - if (dbus_message_iter_get_field_type (iter) != DBUS_TYPE_STRING) - _dbus_assert_not_reached ("Field type isn't string"); + if (dbus_message_iter_get_arg_type (iter) != DBUS_TYPE_STRING) + _dbus_assert_not_reached ("Argument type isn't string"); str = dbus_message_iter_get_string (iter); if (strcmp (str, "Test string") != 0) @@ -2282,11 +2276,11 @@ message_iter_test (DBusMessage *message) dbus_free (str); if (!dbus_message_iter_next (iter)) - _dbus_assert_not_reached ("Reached end of fields"); + _dbus_assert_not_reached ("Reached end of arguments"); /* Signed integer tests */ - if (dbus_message_iter_get_field_type (iter) != DBUS_TYPE_INT32) - _dbus_assert_not_reached ("Field type isn't int32"); + if (dbus_message_iter_get_arg_type (iter) != DBUS_TYPE_INT32) + _dbus_assert_not_reached ("Argument type isn't int32"); if (dbus_message_iter_get_int32 (iter) != -0x12345678) _dbus_assert_not_reached ("Signed integers differ"); @@ -2295,24 +2289,24 @@ message_iter_test (DBusMessage *message) _dbus_assert_not_reached ("Reached end of fields"); /* Unsigned integer tests */ - if (dbus_message_iter_get_field_type (iter) != DBUS_TYPE_UINT32) - _dbus_assert_not_reached ("Field type isn't int32"); + if (dbus_message_iter_get_arg_type (iter) != DBUS_TYPE_UINT32) + _dbus_assert_not_reached ("Argument type isn't int32"); if (dbus_message_iter_get_int32 (iter) != 0xedd1e) _dbus_assert_not_reached ("Unsigned integers differ"); if (!dbus_message_iter_next (iter)) - _dbus_assert_not_reached ("Reached end of fields"); + _dbus_assert_not_reached ("Reached end of arguments"); /* Double tests */ - if (dbus_message_iter_get_field_type (iter) != DBUS_TYPE_DOUBLE) - _dbus_assert_not_reached ("Field type isn't double"); + if (dbus_message_iter_get_arg_type (iter) != DBUS_TYPE_DOUBLE) + _dbus_assert_not_reached ("Argument type isn't double"); if (dbus_message_iter_get_double (iter) != 3.14159) _dbus_assert_not_reached ("Doubles differ"); if (dbus_message_iter_next (iter)) - _dbus_assert_not_reached ("Didn't reach end of fields"); + _dbus_assert_not_reached ("Didn't reach end of arguments"); dbus_message_iter_unref (iter); } @@ -2340,12 +2334,12 @@ check_message_handling (DBusMessage *message) goto failed; } - /* If we implement message_set_field (message, n, value) + /* If we implement message_set_arg (message, n, value) * then we would want to test it here */ - iter = dbus_message_get_fields_iter (message); - while ((type = dbus_message_iter_get_field_type (iter)) != DBUS_TYPE_INVALID) + iter = dbus_message_get_args_iter (message); + while ((type = dbus_message_iter_get_arg_type (iter)) != DBUS_TYPE_INVALID) { switch (type) { @@ -2851,22 +2845,22 @@ _dbus_message_test (const char *test_data_dir) /* Test the vararg functions */ message = dbus_message_new ("org.freedesktop.DBus.Test", "testMessage"); _dbus_message_set_client_serial (message, 1); - dbus_message_append_fields (message, - DBUS_TYPE_INT32, -0x12345678, - DBUS_TYPE_STRING, "Test string", - DBUS_TYPE_DOUBLE, 3.14159, - 0); + dbus_message_append_args (message, + DBUS_TYPE_INT32, -0x12345678, + DBUS_TYPE_STRING, "Test string", + DBUS_TYPE_DOUBLE, 3.14159, + 0); _dbus_verbose_bytes_of_string (&message->header, 0, _dbus_string_get_length (&message->header)); _dbus_verbose_bytes_of_string (&message->body, 0, _dbus_string_get_length (&message->body)); - if (dbus_message_get_fields (message, - DBUS_TYPE_INT32, &our_int, - DBUS_TYPE_STRING, &our_str, - DBUS_TYPE_DOUBLE, &our_double, - 0) != DBUS_RESULT_SUCCESS) - _dbus_assert_not_reached ("Could not get fields"); + if (dbus_message_get_args (message, + DBUS_TYPE_INT32, &our_int, + DBUS_TYPE_STRING, &our_str, + DBUS_TYPE_DOUBLE, &our_double, + 0) != DBUS_RESULT_SUCCESS) + _dbus_assert_not_reached ("Could not get arguments"); if (our_int != -0x12345678) _dbus_assert_not_reached ("integers differ!"); diff --git a/dbus/dbus-message.h b/dbus/dbus-message.h index 753cc381..82faf658 100644 --- a/dbus/dbus-message.h +++ b/dbus/dbus-message.h @@ -53,52 +53,52 @@ void dbus_message_set_is_error (DBusMessage *message, dbus_bool_t is_error_reply); dbus_bool_t dbus_message_get_is_error (DBusMessage *message); - -dbus_bool_t dbus_message_append_fields (DBusMessage *message, - int first_field_type, +dbus_bool_t dbus_message_append_args (DBusMessage *message, + int first_arg_type, + ...); +dbus_bool_t dbus_message_append_args_valist (DBusMessage *message, + int first_arg_type, + va_list var_args); +dbus_bool_t dbus_message_append_int32 (DBusMessage *message, + dbus_int32_t value); +dbus_bool_t dbus_message_append_uint32 (DBusMessage *message, + dbus_uint32_t value); +dbus_bool_t dbus_message_append_double (DBusMessage *message, + double value); +dbus_bool_t dbus_message_append_string (DBusMessage *message, + const char *value); +dbus_bool_t dbus_message_append_byte_array (DBusMessage *message, + unsigned const char *value, + int len); +dbus_bool_t dbus_message_append_string_array (DBusMessage *message, + const char **value, + int len); + + +DBusMessageIter *dbus_message_get_args_iter (DBusMessage *message); +DBusResultCode dbus_message_get_args (DBusMessage *message, + int first_arg_type, ...); -dbus_bool_t dbus_message_append_fields_valist (DBusMessage *message, - int first_field_type, - va_list var_args); -dbus_bool_t dbus_message_append_int32 (DBusMessage *message, - dbus_int32_t value); -dbus_bool_t dbus_message_append_uint32 (DBusMessage *message, - dbus_uint32_t value); -dbus_bool_t dbus_message_append_double (DBusMessage *message, - double value); -dbus_bool_t dbus_message_append_string (DBusMessage *message, - const char *value); -dbus_bool_t dbus_message_append_byte_array (DBusMessage *message, - unsigned const char *value, - int len); -dbus_bool_t dbus_message_append_string_array (DBusMessage *message, - const char **value, - int len); - - - -DBusMessageIter *dbus_message_get_fields_iter (DBusMessage *message); -DBusResultCode dbus_message_get_fields (DBusMessage *message, - int first_field_type, - ...); -DBusResultCode dbus_message_get_fields_valist (DBusMessage *message, - int first_field_type, - va_list var_args); - -void dbus_message_iter_ref (DBusMessageIter *iter); -void dbus_message_iter_unref (DBusMessageIter *iter); - -dbus_bool_t dbus_message_iter_has_next (DBusMessageIter *iter); -dbus_bool_t dbus_message_iter_next (DBusMessageIter *iter); -int dbus_message_iter_get_field_type (DBusMessageIter *iter); -int dbus_message_iter_get_int32 (DBusMessageIter *iter); -int dbus_message_iter_get_uint32 (DBusMessageIter *iter); -double dbus_message_iter_get_double (DBusMessageIter *iter); -char * dbus_message_iter_get_string (DBusMessageIter *iter); -unsigned char * dbus_message_iter_get_byte_array (DBusMessageIter *iter, +DBusResultCode dbus_message_get_args_valist (DBusMessage *message, + int first_arg_type, + va_list var_args); + + + +void dbus_message_iter_ref (DBusMessageIter *iter); +void dbus_message_iter_unref (DBusMessageIter *iter); +dbus_bool_t dbus_message_iter_has_next (DBusMessageIter *iter); +dbus_bool_t dbus_message_iter_next (DBusMessageIter *iter); +int dbus_message_iter_get_arg_type (DBusMessageIter *iter); +int dbus_message_iter_get_int32 (DBusMessageIter *iter); +int dbus_message_iter_get_uint32 (DBusMessageIter *iter); +double dbus_message_iter_get_double (DBusMessageIter *iter); +char * dbus_message_iter_get_string (DBusMessageIter *iter); +unsigned char *dbus_message_iter_get_byte_array (DBusMessageIter *iter, + int *len); +char ** dbus_message_iter_get_string_array (DBusMessageIter *iter, int *len); -char ** dbus_message_iter_get_string_array (DBusMessageIter *iter, - int *len); + diff --git a/test/bus-test.c b/test/bus-test.c index 29443c0f..cfafe0ff 100644 --- a/test/bus-test.c +++ b/test/bus-test.c @@ -167,9 +167,9 @@ main (int argc, message = dbus_message_new (DBUS_SERVICE_DBUS, DBUS_MESSAGE_HELLO); - dbus_message_append_fields (message, - DBUS_TYPE_STRING, "test", - 0); + dbus_message_append_args (message, + DBUS_TYPE_STRING, "test", + 0); handler = dbus_message_handler_new (message_handler, NULL, NULL); dbus_connection_add_filter (connection, handler); |