From 75742242000e782719bc1656f0a7da72b059e88e Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Tue, 21 Oct 2003 05:46:52 +0000 Subject: 2003-10-20 Havoc Pennington 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 * 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 --- doc/dbus-specification.xml | 127 +++++++++++++++++++++++++-------------------- 1 file changed, 72 insertions(+), 55 deletions(-) (limited to 'doc/dbus-specification.xml') diff --git a/doc/dbus-specification.xml b/doc/dbus-specification.xml index 807769b7..42bd5138 100644 --- a/doc/dbus-specification.xml +++ b/doc/dbus-specification.xml @@ -300,7 +300,7 @@ PATH 1 - STRING + OBJECT_PATH The object to send the message to; objects are identified by a path, "/foo/bar" @@ -388,56 +388,60 @@ INVALID - 0 + 0 (ASCII NUL) Not a valid type code (error if it appears in a message) NIL - 1 - Marks an "unset" or "nonexistent" argument + 118 (ASCII 'v') + Marks a "void"/"unset"/"nonexistent"/"null" argument BYTE - 2 + 121 (ASCII 'y') 8-bit unsigned integer BOOLEAN - 3 + 98 (ASCII 'b') Boolean value, 0 is FALSE and 1 is TRUE. Everything else is invalid. INT32 - 4 + 105 (ASCII 'i') 32-bit signed integer UINT32 - 5 + 117 (ASCII 'u') 32-bit unsigned integer INT64 - 6 + 120 (ASCII 'x') 64-bit signed integer UINT64 - 7 + 116 (ASCII 't') 64-bit unsigned integer DOUBLE - 8 + 100 (ASCII 'd') IEEE 754 double STRING - 9 + 115 (ASCII 's') UTF-8 string (must be valid UTF-8). Must be zero terminated. - NAMED - 10 + CUSTOM + 99 (ASCII 'c') A named byte array, used for custom types ARRAY - 11 + 97 (ASCII 'a') Array DICT - 12 + 109 (ASCII 'm') A dictionary of key/value pairs + + OBJECT_PATH + 111 (ASCII 'o') + Name of an object @@ -490,10 +494,12 @@ byte. - NAMED + CUSTOM A string (encoded as the STRING type above) giving the name of the type followed by an UINT32 aligned to 4-byte boundary indicating the data length in bytes, followed by the data. + The string has some restrictions on its content, see + . ARRAY @@ -513,6 +519,10 @@ as a byte with typecode and how that type normally would be encoded alone. + + OBJECT_PATH + Encoded as if it were a STRING. + @@ -523,41 +533,46 @@ Valid names - The various header fields of type STRING have some restrictions - on the string's format. + The various names in D-BUS messages have some restrictions. - - Service names + + Interface names - Services have names with type STRING, meaning that + Interfaces have names with type STRING, meaning that they must be valid UTF-8. However, there are also some - additional restrictions that apply to service names + additional restrictions that apply to interface names specifically: - They must contain at least one '.' (period) character - They must not begin with a '.' (period) character - They must not exceed 256 bytes in length - They must be at least 1 byte in length + They are composed of 1 or more elements separated by + a period ('.') character. All elements must contain at least + one character. + + + Each element must only contain the ASCII characters + "[A-Z][a-z][0-9]_" and must not begin with a digit. + + + + They must contain at least one '.' (period) + character (and thus at least two elements). + + + They must not begin with a '.' (period) character. + They must not exceed 256 bytes in length. + They must be at least 1 byte in length. - - As a special exception, base service names (those beginning with a colon - (':') character) need not contain a period. - - - FIXME really, shouldn't we ban basically everything non-alphanumeric - so the name will work in all programming languages? - - Interface names - - Interface names have the same restrictions as service names, - but do not have the special exception for names beginning with - a colon. - + + Service names - FIXME really, shouldn't we ban basically everything non-alphanumeric - so the name will work in all programming languages? + Service names have the same restrictions as interface names, with a + special exception for base services. A base service name's first + element must start with a colon (':') character. After the colon, any + characters in the range "[A-Z][a-z][0-9]_" may appear. Elements after + the first must follow the usual rules, except that they may start with + a digit. Service names not starting with a colon have none of these + exceptions and follow the same rules as interface names. @@ -565,24 +580,23 @@ Method names: - May not contain the '.' (period) character + Must only contain the ASCII characters + "[A-Z][a-z][0-9]_" and may not begin with a + digit. + Must not contain the '.' (period) character Must not exceed 256 bytes in length Must be at least 1 byte in length - - FIXME really, shouldn't we ban basically everything non-alphanumeric - so the name will work in all programming languages? - Path names - A path must begin with an ASCII '/' (slash) character. Paths may not - end with a slash character unless the path is the one-byte string - "/". Two slash characters may not appear adjacent to one another (the - empty string is not a valid "subdirectory"). Paths may not exceed - 256 bytes in length. + A path (type OBJECT_PATH) must begin with an ASCII '/' (slash) + character. Paths may not end with a slash character unless the path is + the one-byte string "/". Two slash characters may not appear adjacent + to one another (the empty string is not a valid "subdirectory"). Paths + may not exceed 256 bytes in length. @@ -590,9 +604,12 @@ Error names have the same restrictions as interface names. + + + Custom types - FIXME really, shouldn't we ban basically everything non-alphanumeric - so the name will work in all programming languages? + Custom type names for values of type CUSTOM follow the same + restrictions as interface names. -- cgit