Commit 75742242 authored by Havoc Pennington's avatar Havoc Pennington

2003-10-20 Havoc Pennington <hp@redhat.com>

        hmm, make check is currently not passing.

	* doc/dbus-specification.xml: add requirement that custom type
	names follow the same rules as interface names.

	* dbus/dbus-protocol.h: change some of the byte codes, to avoid
	duplication and allow 'c' to be 'custom'; dict is now 'm' for
	'map'

	* doc/dbus-specification.xml: update type codes to match
	dbus-protocol.h, using the ASCII byte values. Rename type NAMED to
	CUSTOM. Add type OBJECT_PATH to the spec.

2003-10-17  Havoc Pennington  <hp@redhat.com>

	* bus/driver.c (create_unique_client_name): use "." as separator
	in base service names instead of '-'

	* dbus/dbus-string.c (_dbus_string_get_byte): allow getting nul
	byte at the end of the string

	* dbus/dbus-internals.h (_DBUS_LIKELY, _DBUS_UNLIKELY): add
	optimization macros since string validation seems to be a slow
	point.

	* doc/dbus-specification.xml: restrict valid
	service/interface/member/error names. Add test suite code for the
	name validation.

	* dbus/dbus-string.c: limit service/interface/member/error names
	to [0-9][A-Z][a-z]_

	* dbus/dbus-connection.c (dbus_connection_dispatch): add missing
	format arg to verbose spew

	* glib/dbus-gproxy.c (dbus_gproxy_call_no_reply): if not out of
	memory, return instead of g_error

	* test/test-service.c (path_message_func): support emitting a
	signal on request

	* dbus/dbus-bus.c (init_connections_unlocked): only fill in
	activation bus type if DBUS_BUS_ACTIVATION was set; default to
	assuming the activation bus was the session bus so that services
	started manually will still register.
	(init_connections_unlocked): fix so that in OOM situation we get
	the same semantics when retrying the function

	* test/test-service.c (main): change to use path registration, to
	test those codepaths; register with DBUS_BUS_ACTIVATION rather
	than DBUS_BUS_SESSION
parent 8a4d94fe
2003-10-20 Havoc Pennington <hp@redhat.com>
hmm, make check is currently not passing.
* doc/dbus-specification.xml: add requirement that custom type
names follow the same rules as interface names.
* dbus/dbus-protocol.h: change some of the byte codes, to avoid
duplication and allow 'c' to be 'custom'; dict is now 'm' for
'map'
* doc/dbus-specification.xml: update type codes to match
dbus-protocol.h, using the ASCII byte values. Rename type NAMED to
CUSTOM. Add type OBJECT_PATH to the spec.
2003-10-17 Havoc Pennington <hp@redhat.com>
* bus/driver.c (create_unique_client_name): use "." as separator
in base service names instead of '-'
* dbus/dbus-string.c (_dbus_string_get_byte): allow getting nul
byte at the end of the string
* dbus/dbus-internals.h (_DBUS_LIKELY, _DBUS_UNLIKELY): add
optimization macros since string validation seems to be a slow
point.
* doc/dbus-specification.xml: restrict valid
service/interface/member/error names. Add test suite code for the
name validation.
* dbus/dbus-string.c: limit service/interface/member/error names
to [0-9][A-Z][a-z]_
* dbus/dbus-connection.c (dbus_connection_dispatch): add missing
format arg to verbose spew
* glib/dbus-gproxy.c (dbus_gproxy_call_no_reply): if not out of
memory, return instead of g_error
* test/test-service.c (path_message_func): support emitting a
signal on request
* dbus/dbus-bus.c (init_connections_unlocked): only fill in
activation bus type if DBUS_BUS_ACTIVATION was set; default to
assuming the activation bus was the session bus so that services
started manually will still register.
(init_connections_unlocked): fix so that in OOM situation we get
the same semantics when retrying the function
* test/test-service.c (main): change to use path registration, to
test those codepaths; register with DBUS_BUS_ACTIVATION rather
than DBUS_BUS_SESSION
2003-10-16 Havoc Pennington <hp@redhat.com>
* glib/dbus-gtest-main.c: bracket with #ifdef DBUS_BUILD_TESTS
......
......@@ -919,6 +919,7 @@ bus_context_check_security_policy (BusContext *context,
type = dbus_message_get_type (message);
/* dispatch.c was supposed to ensure these invariants */
/* FIXME this assertion is failing in make check */
_dbus_assert (dbus_message_get_destination (message) != NULL ||
type == DBUS_MESSAGE_TYPE_SIGNAL);
_dbus_assert (type == DBUS_MESSAGE_TYPE_SIGNAL ||
......
......@@ -173,10 +173,8 @@ bus_dispatch (DBusConnection *connection,
#endif /* DBUS_ENABLE_VERBOSE_MODE */
/* If service_name is NULL, if it's a signal we send it to all
* connections with a match rule. If it's not a signal, it goes to
* the bus daemon but doesn't go "on the bus"; e.g. a peer-to-peer
* ping. Handle these immediately, especially disconnection
* messages. There are no security policy checks on these.
* connections with a match rule. If it's not a signal, there
* are some special cases here but mostly we just bail out.
*/
if (service_name == NULL)
{
......
......@@ -245,7 +245,7 @@ create_unique_client_name (BusRegistry *registry,
if (!_dbus_string_append_int (str, next_major_number))
return FALSE;
if (!_dbus_string_append (str, "-"))
if (!_dbus_string_append (str, "."))
return FALSE;
if (!_dbus_string_append_int (str, next_minor_number))
......
......@@ -857,6 +857,7 @@ AC_SUBST(TEST_$1)
TEST_PATH(SERVICE_DIR, data/valid-service-files)
TEST_PATH(SERVICE_BINARY, test-service)
TEST_PATH(GLIB_SERVICE_BINARY, test-service-glib)
TEST_PATH(EXIT_BINARY, test-exit)
TEST_PATH(SEGFAULT_BINARY, test-segfault)
TEST_PATH(SLEEP_FOREVER_BINARY, test-sleep-forever)
......
......@@ -139,6 +139,9 @@ init_connections_unlocked (void)
/* Don't init these twice, we may run this code twice if
* init_connections_unlocked() fails midway through.
* In practice, each block below should contain only one
* "return FALSE" or running through twice may not
* work right.
*/
if (bus_connection_addresses[DBUS_BUS_SYSTEM] == NULL)
......@@ -148,22 +151,23 @@ init_connections_unlocked (void)
if (!get_from_env (&bus_connection_addresses[DBUS_BUS_SYSTEM],
"DBUS_SYSTEM_BUS_ADDRESS"))
return FALSE;
}
if (bus_connection_addresses[DBUS_BUS_SYSTEM] == NULL)
{
/* Use default system bus address if none set in environment */
bus_connection_addresses[DBUS_BUS_SYSTEM] =
_dbus_strdup (DBUS_SYSTEM_BUS_DEFAULT_ADDRESS);
if (bus_connection_addresses[DBUS_BUS_SYSTEM] == NULL)
{
/* Use default system bus address if none set in environment */
bus_connection_addresses[DBUS_BUS_SYSTEM] =
_dbus_strdup (DBUS_SYSTEM_BUS_DEFAULT_ADDRESS);
if (bus_connection_addresses[DBUS_BUS_SYSTEM] == NULL)
return FALSE;
_dbus_verbose (" used default system bus \"%s\"\n",
bus_connection_addresses[DBUS_BUS_SYSTEM]);
}
else
_dbus_verbose (" used env var system bus \"%s\"\n",
bus_connection_addresses[DBUS_BUS_SYSTEM]);
return FALSE;
_dbus_verbose (" used default system bus \"%s\"\n",
bus_connection_addresses[DBUS_BUS_SYSTEM]);
}
else
_dbus_verbose (" used env var system bus \"%s\"\n",
bus_connection_addresses[DBUS_BUS_SYSTEM]);
if (bus_connection_addresses[DBUS_BUS_SESSION] == NULL)
{
......@@ -183,23 +187,38 @@ init_connections_unlocked (void)
if (!get_from_env (&bus_connection_addresses[DBUS_BUS_ACTIVATION],
"DBUS_ACTIVATION_ADDRESS"))
return FALSE;
_dbus_verbose (" \"%s\"\n", bus_connection_addresses[DBUS_BUS_ACTIVATION] ?
bus_connection_addresses[DBUS_BUS_ACTIVATION] : "none set");
}
s = _dbus_getenv ("DBUS_ACTIVATION_BUS_TYPE");
if (s != NULL)
if (bus_connection_addresses[DBUS_BUS_ACTIVATION] != NULL)
{
_dbus_verbose ("Bus activation type was set to \"%s\"\n", s);
if (strcmp (s, "system") == 0)
activation_bus_type = DBUS_BUS_SYSTEM;
else if (strcmp (s, "session") == 0)
activation_bus_type = DBUS_BUS_SESSION;
s = _dbus_getenv ("DBUS_ACTIVATION_BUS_TYPE");
if (s != NULL)
{
_dbus_verbose ("Bus activation type was set to \"%s\"\n", s);
if (strcmp (s, "system") == 0)
activation_bus_type = DBUS_BUS_SYSTEM;
else if (strcmp (s, "session") == 0)
activation_bus_type = DBUS_BUS_SESSION;
}
}
else
{
/* Default to the session bus instead if available */
if (bus_connection_addresses[DBUS_BUS_SESSION] != NULL)
{
bus_connection_addresses[DBUS_BUS_ACTIVATION] =
_dbus_strdup (bus_connection_addresses[DBUS_BUS_SESSION]);
if (bus_connection_addresses[DBUS_BUS_ACTIVATION] == NULL)
return FALSE;
}
}
/* If we return FALSE we have to be sure that restarting
* the above code will work right
*/
......
......@@ -1830,6 +1830,10 @@ check_for_reply_unlocked (DBusConnection *connection,
* the whole message queue for example) and has thread issues,
* see comments in source
*
* Does not re-enter the main loop or run filter/path-registered
* callbacks. The reply to the message will not be seen by
* filter callbacks.
*
* @param connection the connection
* @param client_serial the reply serial to wait for
* @param timeout_milliseconds timeout in milliseconds or -1 for default
......@@ -2430,8 +2434,15 @@ dbus_connection_get_dispatch_status (DBusConnection *connection)
* @todo some FIXME in here about handling DBUS_HANDLER_RESULT_NEED_MEMORY
*
* @todo right now a message filter gets run on replies to a pending
* call in here, but not in the case where we block without
* entering the main loop.
* call in here, but not in the case where we block without entering
* the main loop. Simple solution might be to just have the pending
* call stuff run before the filters.
*
* @todo FIXME what if we call out to application code to handle a
* message, holding the dispatch lock, and the application code runs
* the main loop and dispatches again? Probably deadlocks at the
* moment. Maybe we want a dispatch status of DBUS_DISPATCH_IN_PROGRESS,
* and then the GSource etc. could handle the situation?
*
* @param connection the connection
* @returns dispatch status
......@@ -2581,7 +2592,8 @@ dbus_connection_dispatch (DBusConnection *connection)
dbus_message_get_type (message),
dbus_message_get_interface (message) ?
dbus_message_get_interface (message) :
"no interface");
"no interface",
dbus_message_get_signature (message));
result = _dbus_object_tree_dispatch_and_unlock (connection->objects,
message);
......@@ -3009,7 +3021,9 @@ dbus_connection_set_unix_user_function (DBusConnection *connection,
*
* @todo we don't run filters on messages while blocking without
* entering the main loop, since filters are run as part of
* dbus_connection_dispatch().
* dbus_connection_dispatch(). This is probably a feature, as filters
* could create arbitrary reentrancy. But kind of sucks if you're
* trying to filter METHOD_RETURN for some reason.
*
* @param connection the connection
* @param function function to handle messages
......
......@@ -380,8 +380,8 @@ _dbus_type_to_string (int type)
return "double";
case DBUS_TYPE_STRING:
return "string";
case DBUS_TYPE_NAMED:
return "named";
case DBUS_TYPE_CUSTOM:
return "custom";
case DBUS_TYPE_ARRAY:
return "array";
case DBUS_TYPE_DICT:
......@@ -448,7 +448,7 @@ _dbus_real_assert (dbus_bool_t condition,
const char *file,
int line)
{
if (!condition)
if (_DBUS_UNLIKELY (!condition))
{
_dbus_warn ("%lu: assertion failed \"%s\" file \"%s\" line %d\n",
_dbus_getpid (), condition_text, file, line);
......
......@@ -51,6 +51,33 @@ void _dbus_verbose_reset_real (void);
#define _DBUS_FUNCTION_NAME "unknown function"
#endif
/*
* (code from GLib)
*
* The _DBUS_LIKELY and _DBUS_UNLIKELY macros let the programmer give hints to
* the compiler about the expected result of an expression. Some compilers
* can use this information for optimizations.
*
* The _DBUS_BOOLEAN_EXPR macro is intended to trigger a gcc warning when
* putting assignments in the macro arg
*/
#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__)
#define _DBUS_BOOLEAN_EXPR(expr) \
__extension__ ({ \
int _dbus_boolean_var_; \
if (expr) \
_dbus_boolean_var_ = 1; \
else \
_dbus_boolean_var_ = 0; \
_dbus_boolean_var_; \
})
#define _DBUS_LIKELY(expr) (__builtin_expect (_DBUS_BOOLEAN_EXPR(expr), 1))
#define _DBUS_UNLIKELY(expr) (__builtin_expect (_DBUS_BOOLEAN_EXPR(expr), 0))
#else
#define _DBUS_LIKELY(expr) (expr)
#define _DBUS_UNLIKELY(expr) (expr)
#endif
#ifdef DBUS_ENABLE_VERBOSE_MODE
# define _dbus_verbose _dbus_verbose_real
# define _dbus_verbose_reset _dbus_verbose_reset_real
......
......@@ -1642,7 +1642,7 @@ _dbus_marshal_get_arg_end_pos (const DBusString *str,
}
break;
case DBUS_TYPE_NAMED:
case DBUS_TYPE_CUSTOM:
{
int len;
......@@ -1836,7 +1836,7 @@ validate_array_data (const DBusString *str,
case DBUS_TYPE_OBJECT_PATH:
case DBUS_TYPE_STRING:
case DBUS_TYPE_NAMED:
case DBUS_TYPE_CUSTOM:
case DBUS_TYPE_ARRAY:
case DBUS_TYPE_DICT:
/* This clean recursion to validate_arg is what we
......@@ -2050,7 +2050,7 @@ _dbus_marshal_validate_arg (const DBusString *str,
}
break;
case DBUS_TYPE_NAMED:
case DBUS_TYPE_CUSTOM:
{
int len;
......@@ -2226,7 +2226,7 @@ _dbus_type_is_valid (int typecode)
case DBUS_TYPE_UINT64:
case DBUS_TYPE_DOUBLE:
case DBUS_TYPE_STRING:
case DBUS_TYPE_NAMED:
case DBUS_TYPE_CUSTOM:
case DBUS_TYPE_ARRAY:
case DBUS_TYPE_DICT:
case DBUS_TYPE_OBJECT_PATH:
......
......@@ -735,8 +735,8 @@ _dbus_message_data_load (DBusString *dest,
code = DBUS_TYPE_STRING;
else if (_dbus_string_starts_with_c_str (&line, "OBJECT_PATH"))
code = DBUS_TYPE_OBJECT_PATH;
else if (_dbus_string_starts_with_c_str (&line, "NAMED"))
code = DBUS_TYPE_NAMED;
else if (_dbus_string_starts_with_c_str (&line, "CUSTOM"))
code = DBUS_TYPE_CUSTOM;
else if (_dbus_string_starts_with_c_str (&line, "ARRAY"))
code = DBUS_TYPE_ARRAY;
else if (_dbus_string_starts_with_c_str (&line, "DICT"))
......
......@@ -488,13 +488,13 @@ re_align_field_recurse (DBusMessage *message,
case DBUS_TYPE_DOUBLE:
padding = _DBUS_ALIGN_VALUE (pos, 8) - pos;
break;
case DBUS_TYPE_NAMED:
case DBUS_TYPE_CUSTOM:
case DBUS_TYPE_ARRAY:
case DBUS_TYPE_DICT:
/* FIXME This is no good; we have to handle undefined header fields
* also. SECURITY and spec compliance issue.
*/
_dbus_assert_not_reached ("no defined header fields may contain a named, array or dict value");
_dbus_assert_not_reached ("no defined header fields may contain a custom, array or dict value");
break;
case DBUS_TYPE_INVALID:
default:
......@@ -1832,7 +1832,7 @@ dbus_message_append_args_valist (DBusMessage *message,
dbus_message_append_iter_init (message, &iter);
while (type != 0)
while (type != DBUS_TYPE_INVALID)
{
switch (type)
{
......@@ -1873,7 +1873,7 @@ dbus_message_append_args_valist (DBusMessage *message,
case DBUS_TYPE_OBJECT_PATH:
break;
case DBUS_TYPE_NAMED:
case DBUS_TYPE_CUSTOM:
{
const char *name;
unsigned char *data;
......@@ -1883,7 +1883,7 @@ dbus_message_append_args_valist (DBusMessage *message,
data = va_arg (var_args, unsigned char *);
len = va_arg (var_args, int);
if (!dbus_message_iter_append_named (&iter, name, data, len))
if (!dbus_message_iter_append_custom (&iter, name, data, len))
goto errorout;
break;
}
......@@ -1934,7 +1934,7 @@ dbus_message_append_args_valist (DBusMessage *message,
break;
case DBUS_TYPE_NIL:
case DBUS_TYPE_ARRAY:
case DBUS_TYPE_NAMED:
case DBUS_TYPE_CUSTOM:
case DBUS_TYPE_DICT:
_dbus_warn ("dbus_message_append_args_valist doesn't support recursive arrays\n");
goto errorout;
......@@ -2194,7 +2194,7 @@ dbus_message_iter_get_args_valist (DBusMessageIter *iter,
break;
}
case DBUS_TYPE_NAMED:
case DBUS_TYPE_CUSTOM:
{
char **name;
unsigned char **data;
......@@ -2204,7 +2204,7 @@ dbus_message_iter_get_args_valist (DBusMessageIter *iter,
data = va_arg (var_args, unsigned char **);
len = va_arg (var_args, int *);
if (!dbus_message_iter_get_named (iter, name, data, len))
if (!dbus_message_iter_get_custom (iter, name, data, len))
{
dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
goto out;
......@@ -2295,7 +2295,7 @@ dbus_message_iter_get_args_valist (DBusMessageIter *iter,
break;
case DBUS_TYPE_NIL:
case DBUS_TYPE_ARRAY:
case DBUS_TYPE_NAMED:
case DBUS_TYPE_CUSTOM:
case DBUS_TYPE_DICT:
_dbus_warn ("dbus_message_get_args_valist doesn't support recursive arrays\n");
dbus_set_error (error, DBUS_ERROR_NOT_SUPPORTED, NULL);
......@@ -2682,24 +2682,23 @@ dbus_message_iter_get_object_path (DBusMessageIter *iter)
#endif
/**
* Returns the name and data from a named type that an
* iterator may point to. Note that you need to check that
* the iterator points to a named type before using this
* function.
* Returns the name and data from a custom type that an iterator may
* point to. Note that you need to check that the iterator points to a
* custom type before using this function.
*
* @see dbus_message_iter_get_arg_type
* @param iter the message iter
* @param name return location for the name
* @param name return location for the name of the custom type
* @param value return location for data
* @param len return location for length of data
* @returns TRUE if get succeed
*
*/
dbus_bool_t
dbus_message_iter_get_named (DBusMessageIter *iter,
char **name,
unsigned char **value,
int *len)
dbus_message_iter_get_custom (DBusMessageIter *iter,
char **name,
unsigned char **value,
int *len)
{
DBusMessageRealIter *real = (DBusMessageRealIter *)iter;
int type, pos;
......@@ -2709,7 +2708,7 @@ dbus_message_iter_get_named (DBusMessageIter *iter,
pos = dbus_message_iter_get_data_start (real, &type);
_dbus_assert (type == DBUS_TYPE_NAMED);
_dbus_assert (type == DBUS_TYPE_CUSTOM);
_name = _dbus_demarshal_string (&real->message->body, real->message->byte_order,
pos, &pos);
......@@ -3773,7 +3772,7 @@ dbus_message_iter_append_string (DBusMessageIter *iter,
}
/**
* Appends a named type data chunk to the message. A named
* Appends a custom type data chunk to the message. A custom
* type is simply an arbitrary UTF-8 string used as a type
* tag, plus an array of arbitrary bytes to be interpreted
* according to the type tag.
......@@ -3785,16 +3784,16 @@ dbus_message_iter_append_string (DBusMessageIter *iter,
* @returns #TRUE on success
*/
dbus_bool_t
dbus_message_iter_append_named (DBusMessageIter *iter,
const char *name,
const unsigned char *data,
int len)
dbus_message_iter_append_custom (DBusMessageIter *iter,
const char *name,
const unsigned char *data,
int len)
{
DBusMessageRealIter *real = (DBusMessageRealIter *)iter;
_dbus_return_val_if_fail (dbus_message_iter_append_check (real), FALSE);
if (!dbus_message_iter_append_type (real, DBUS_TYPE_NAMED))
if (!dbus_message_iter_append_type (real, DBUS_TYPE_CUSTOM))
return FALSE;
if (!_dbus_marshal_string (&real->message->body, real->message->byte_order, name))
......@@ -4865,6 +4864,11 @@ decode_string_field (const DBusString *data,
return TRUE;
}
/* FIXME because the service/interface/member/error names are already
* validated to be in the particular ASCII subset, UTF-8 validating
* them could be skipped as a probably-interesting optimization.
* The UTF-8 validation definitely shows up in profiles.
*/
static dbus_bool_t
decode_header_data (const DBusString *data,
int header_len,
......@@ -5753,6 +5757,7 @@ dbus_message_type_from_string (const char *type_str)
#ifdef DBUS_BUILD_TESTS
#include "dbus-test.h"
#include <stdio.h>
#include <stdlib.h>
static void
message_iter_test (DBusMessage *message)
......@@ -5942,13 +5947,13 @@ message_iter_test (DBusMessage *message)
if (!dbus_message_iter_next (&iter))
_dbus_assert_not_reached ("Reached end of arguments");
if (dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_NAMED)
if (dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_CUSTOM)
_dbus_assert_not_reached ("wrong type after dict");
if (!dbus_message_iter_get_named (&iter, &str, &data, &len))
_dbus_assert_not_reached ("failed to get named");
if (!dbus_message_iter_get_custom (&iter, &str, &data, &len))
_dbus_assert_not_reached ("failed to get custom type");
_dbus_assert (strcmp (str, "named")==0);
_dbus_assert (strcmp (str, "MyTypeName")==0);
_dbus_assert (len == 5);
_dbus_assert (strcmp (data, "data")==0);
dbus_free (str);
......@@ -6006,15 +6011,15 @@ check_message_handling_type (DBusMessageIter *iter,
dbus_free (str);
}
break;
case DBUS_TYPE_NAMED:
case DBUS_TYPE_CUSTOM:
{
char *name;
unsigned char *data;
int len;
if (!dbus_message_iter_get_named (iter, &name, &data, &len))
if (!dbus_message_iter_get_custom (iter, &name, &data, &len))
{
_dbus_warn ("error reading name from named type\n");
_dbus_warn ("error reading name from custom type\n");
return FALSE;
}
dbus_free (data);
......@@ -7083,8 +7088,8 @@ _dbus_message_test (const char *test_data_dir)
dbus_message_iter_append_nil (&iter);
dbus_message_iter_append_named (&iter, "named",
"data", 5);
dbus_message_iter_append_custom (&iter, "MyTypeName",
"data", 5);
message_iter_test (message);
......
/* -*- mode: C; c-file-style: "gnu" -*- */
/* dbus-message.h DBusMessage object
*
* Copyright (C) 2002 Red Hat Inc.
* Copyright (C) 2002, 2003 Red Hat Inc.
*
* Licensed under the Academic Free License version 1.2
*
......@@ -164,7 +164,7 @@ double dbus_message_iter_get_double (DBusMessageIter *iter
char * dbus_message_iter_get_string (DBusMessageIter *iter);
char * dbus_message_iter_get_object_path (DBusMessageIter *iter);
char * dbus_message_iter_get_dict_key (DBusMessageIter *iter);
dbus_bool_t dbus_message_iter_get_named (DBusMessageIter *iter,
dbus_bool_t dbus_message_iter_get_custom (DBusMessageIter *iter,
char **name,
unsigned char **value,
int *len);
......@@ -226,7 +226,7 @@ dbus_bool_t dbus_message_iter_append_double (DBusMessageIter *iter,
double value);
dbus_bool_t dbus_message_iter_append_string (DBusMessageIter *iter,
const char *value);
dbus_bool_t dbus_message_iter_append_named (DBusMessageIter *iter,
dbus_bool_t dbus_message_iter_append_custom (DBusMessageIter *iter,
const char *name,
const unsigned char *data,
int len);
......
......@@ -50,9 +50,9 @@ extern "C" {
#define DBUS_TYPE_UINT64 ((int) 't')
#define DBUS_TYPE_DOUBLE ((int) 'd')
#define DBUS_TYPE_STRING ((int) 's')
#define DBUS_TYPE_NAMED ((int) 'n')
#define DBUS_TYPE_CUSTOM ((int) 'c')
#define DBUS_TYPE_ARRAY ((int) 'a')
#define DBUS_TYPE_DICT ((int) 'c')
#define DBUS_TYPE_DICT ((int) 'm')
#define DBUS_TYPE_OBJECT_PATH ((int) 'o')
#define DBUS_NUMBER_OF_TYPES (13)
......
This diff is collapsed.
/* -*- mode: C; c-file-style: "gnu" -*- */
/* dbus-string.h String utility class (internal to D-BUS implementation)
*
* Copyright (C) 2002 Red Hat, Inc.
* Copyright (C) 2002, 2003 Red Hat, Inc.
*
* Licensed under the Academic Free License version 1.2
*
......
......@@ -26,19 +26,10 @@
which of these functions to include, in light of the fact that
GLib/Qt native stubs will probably also exist.
- The message handler interface needs rethinking, perhaps handlers should be able
to return an error that automatically gets turned into a message; most likely
some basic spec'ing out of the GLib/Qt level stubs/skels stuff will be
needed to understand the right approach.
- assorted _-prefixed symbols in libdbus aren't actually used by
libdbus, only by the message bus. These bloat up the library
size. Not sure how to fix, really.
- if you send a message to a service then block for reply, and the service exits/crashes
after the message bus has processed your message but before the service has replied,
it would be nice if the message bus sent you an error reply.
- build and install the Doxygen manual in Makefile when --enable-docs
- if you send the same message to multiple connections, the serial number
......@@ -89,8 +80,6 @@
- add dbus_message_has_path(), maybe has_member/interface
- The OBJECT_PATH type is not documented in the spec.
- re_align_field_recurse() in dbus-message.c is broken because it
crashes on some types of header field values. security problem.
......@@ -99,18 +88,21 @@
be coded to handle it restarting
- modify the wire protocol to keep the args signature separate
from the args themselves. Make the name of TYPE_NAMED part
from the args themselves. Make the name of TYPE_CUSTOM part
of the type signature, rather than part of the value.
Then you have the full typecheck in a single string.
- rename TYPE_NAMED to TYPE_CUSTOM, probably a clearer name.
- dbus_message_iter_init_array_iterator has "iter" and "iterator"
in the same function name
- the GLib bindings varargs take DBUS_TYPE_WHATEVER and
return stuff allocated with dbus_malloc(); should this
be made more "G" at some expense in code duplication?
You also still have to use some D-BUS functions such as
dbus_message_get_args() which takes a DBusError.
Probably we need to either fully encapsulate and hide
dbus/dbus.h, or encapsulate it slightly less e.g. no
GError.
- need to define bus behavior if you send a message to
yourself; is it an error, or allowed? If allowed,
......@@ -124,3 +116,9 @@