diff options
author | Havoc Pennington <hp@redhat.com> | 2005-01-15 07:15:38 +0000 |
---|---|---|
committer | Havoc Pennington <hp@redhat.com> | 2005-01-15 07:15:38 +0000 |
commit | 9c3d566e95c9080f6040c64531b0ccae22bd5d74 (patch) | |
tree | d21a18baa5a5ee9855c8a00eb2c1985bc23ca65f /dbus/dbus-marshal.h | |
parent | 6ec04e917c8b4d477e818aa65ebb5e1fd50e4395 (diff) |
2005-01-15 Havoc Pennington <hp@redhat.com>
* Land the new message args API and type system.
This patch is huge, but the public API change is not
really large. The set of D-BUS types has changed somewhat,
and the arg "getters" are more geared toward language bindings;
they don't make a copy, etc.
There are also some known issues. See these emails for details
on this huge patch:
http://lists.freedesktop.org/archives/dbus/2004-December/001836.html
http://lists.freedesktop.org/archives/dbus/2005-January/001922.html
* dbus/dbus-marshal-*: all the new stuff
* dbus/dbus-message.c: basically rewritten
* dbus/dbus-memory.c (check_guards): with "guards" enabled, init
freed blocks to be all non-nul bytes so using freed memory is less
likely to work right
* dbus/dbus-internals.c (_dbus_test_oom_handling): add
DBUS_FAIL_MALLOC=N environment variable, so you can do
DBUS_FAIL_MALLOC=0 to skip the out-of-memory checking, or
DBUS_FAIL_MALLOC=10 to make it really, really, really slow and
thorough.
* qt/message.cpp: port to the new message args API
(operator<<): use str.utf8() rather than str.unicode()
(pretty sure this is right from the Qt docs?)
* glib/dbus-gvalue.c: port to the new message args API
* bus/dispatch.c, bus/driver.c: port to the new message args API
* dbus/dbus-string.c (_dbus_string_init_const_len): initialize the
"locked" flag to TRUE and align_offset to 0; I guess we never
looked at these anyhow, but seems cleaner.
* dbus/dbus-string.h (_DBUS_STRING_ALLOCATION_PADDING):
move allocation padding macro to this header; use it to implement
(_DBUS_STRING_STATIC): ability to declare a static string.
* dbus/dbus-message.c (_dbus_message_has_type_interface_member):
change to return TRUE if the interface is not set.
* dbus/dbus-string.[hc]: move the D-BUS specific validation stuff
to dbus-marshal-validate.[hc]
* dbus/dbus-marshal-basic.c (_dbus_type_to_string): move here from
dbus-internals.c
* dbus/Makefile.am: cut over from dbus-marshal.[hc]
to dbus-marshal-*.[hc]
* dbus/dbus-object-tree.c (_dbus_decompose_path): move this
function here from dbus-marshal.c
Diffstat (limited to 'dbus/dbus-marshal.h')
-rw-r--r-- | dbus/dbus-marshal.h | 348 |
1 files changed, 0 insertions, 348 deletions
diff --git a/dbus/dbus-marshal.h b/dbus/dbus-marshal.h deleted file mode 100644 index dccfc1db..00000000 --- a/dbus/dbus-marshal.h +++ /dev/null @@ -1,348 +0,0 @@ -/* -*- mode: C; c-file-style: "gnu" -*- */ -/* dbus-marshal.h Marshalling routines - * - * Copyright (C) 2002 CodeFactory AB - * - * Licensed under the Academic Free License version 2.1 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef DBUS_MARSHAL_H -#define DBUS_MARSHAL_H - -#include <config.h> -#include <dbus/dbus-protocol.h> -#include <dbus/dbus-types.h> -#include <dbus/dbus-arch-deps.h> -#include <dbus/dbus-string.h> - -#ifndef PACKAGE -#error "config.h not included here" -#endif - -#ifdef WORDS_BIGENDIAN -#define DBUS_COMPILER_BYTE_ORDER DBUS_BIG_ENDIAN -#else -#define DBUS_COMPILER_BYTE_ORDER DBUS_LITTLE_ENDIAN -#endif - -#define DBUS_UINT32_SWAP_LE_BE_CONSTANT(val) ((dbus_uint32_t) ( \ - (((dbus_uint32_t) (val) & (dbus_uint32_t) 0x000000ffU) << 24) | \ - (((dbus_uint32_t) (val) & (dbus_uint32_t) 0x0000ff00U) << 8) | \ - (((dbus_uint32_t) (val) & (dbus_uint32_t) 0x00ff0000U) >> 8) | \ - (((dbus_uint32_t) (val) & (dbus_uint32_t) 0xff000000U) >> 24))) - -#ifdef DBUS_HAVE_INT64 - -#define DBUS_UINT64_SWAP_LE_BE_CONSTANT(val) ((dbus_uint64_t) ( \ - (((dbus_uint64_t) (val) & \ - (dbus_uint64_t) DBUS_UINT64_CONSTANT (0x00000000000000ff)) << 56) | \ - (((dbus_uint64_t) (val) & \ - (dbus_uint64_t) DBUS_UINT64_CONSTANT (0x000000000000ff00)) << 40) | \ - (((dbus_uint64_t) (val) & \ - (dbus_uint64_t) DBUS_UINT64_CONSTANT (0x0000000000ff0000)) << 24) | \ - (((dbus_uint64_t) (val) & \ - (dbus_uint64_t) DBUS_UINT64_CONSTANT (0x00000000ff000000)) << 8) | \ - (((dbus_uint64_t) (val) & \ - (dbus_uint64_t) DBUS_UINT64_CONSTANT (0x000000ff00000000)) >> 8) | \ - (((dbus_uint64_t) (val) & \ - (dbus_uint64_t) DBUS_UINT64_CONSTANT (0x0000ff0000000000)) >> 24) | \ - (((dbus_uint64_t) (val) & \ - (dbus_uint64_t) DBUS_UINT64_CONSTANT (0x00ff000000000000)) >> 40) | \ - (((dbus_uint64_t) (val) & \ - (dbus_uint64_t) DBUS_UINT64_CONSTANT (0xff00000000000000)) >> 56))) -#endif /* DBUS_HAVE_INT64 */ - -#define DBUS_UINT32_SWAP_LE_BE(val) (DBUS_UINT32_SWAP_LE_BE_CONSTANT (val)) -#define DBUS_INT32_SWAP_LE_BE(val) ((dbus_int32_t)DBUS_UINT32_SWAP_LE_BE_CONSTANT (val)) - -#ifdef DBUS_HAVE_INT64 -#define DBUS_UINT64_SWAP_LE_BE(val) (DBUS_UINT64_SWAP_LE_BE_CONSTANT (val)) -#define DBUS_INT64_SWAP_LE_BE(val) ((dbus_int64_t)DBUS_UINT64_SWAP_LE_BE_CONSTANT (val)) -#endif /* DBUS_HAVE_INT64 */ - -#ifdef WORDS_BIGENDIAN -#define DBUS_INT32_TO_BE(val) ((dbus_int32_t) (val)) -#define DBUS_UINT32_TO_BE(val) ((dbus_uint32_t) (val)) -#define DBUS_INT32_TO_LE(val) (DBUS_INT32_SWAP_LE_BE (val)) -#define DBUS_UINT32_TO_LE(val) (DBUS_UINT32_SWAP_LE_BE (val)) -# ifdef DBUS_HAVE_INT64 -#define DBUS_INT64_TO_BE(val) ((dbus_int64_t) (val)) -#define DBUS_UINT64_TO_BE(val) ((dbus_uint64_t) (val)) -#define DBUS_INT64_TO_LE(val) (DBUS_INT64_SWAP_LE_BE (val)) -#define DBUS_UINT64_TO_LE(val) (DBUS_UINT64_SWAP_LE_BE (val)) -# endif /* DBUS_HAVE_INT64 */ -#else -#define DBUS_INT32_TO_LE(val) ((dbus_int32_t) (val)) -#define DBUS_UINT32_TO_LE(val) ((dbus_uint32_t) (val)) -#define DBUS_INT32_TO_BE(val) ((dbus_int32_t) DBUS_UINT32_SWAP_LE_BE (val)) -#define DBUS_UINT32_TO_BE(val) (DBUS_UINT32_SWAP_LE_BE (val)) -# ifdef DBUS_HAVE_INT64 -#define DBUS_INT64_TO_LE(val) ((dbus_int64_t) (val)) -#define DBUS_UINT64_TO_LE(val) ((dbus_uint64_t) (val)) -#define DBUS_INT64_TO_BE(val) ((dbus_int64_t) DBUS_UINT64_SWAP_LE_BE (val)) -#define DBUS_UINT64_TO_BE(val) (DBUS_UINT64_SWAP_LE_BE (val)) -# endif /* DBUS_HAVE_INT64 */ -#endif - -/* The transformation is symmetric, so the FROM just maps to the TO. */ -#define DBUS_INT32_FROM_LE(val) (DBUS_INT32_TO_LE (val)) -#define DBUS_UINT32_FROM_LE(val) (DBUS_UINT32_TO_LE (val)) -#define DBUS_INT32_FROM_BE(val) (DBUS_INT32_TO_BE (val)) -#define DBUS_UINT32_FROM_BE(val) (DBUS_UINT32_TO_BE (val)) -#ifdef DBUS_HAVE_INT64 -#define DBUS_INT64_FROM_LE(val) (DBUS_INT64_TO_LE (val)) -#define DBUS_UINT64_FROM_LE(val) (DBUS_UINT64_TO_LE (val)) -#define DBUS_INT64_FROM_BE(val) (DBUS_INT64_TO_BE (val)) -#define DBUS_UINT64_FROM_BE(val) (DBUS_UINT64_TO_BE (val)) -#endif /* DBUS_HAVE_INT64 */ - -void _dbus_pack_int32 (dbus_int32_t value, - int byte_order, - unsigned char *data); -dbus_int32_t _dbus_unpack_int32 (int byte_order, - const unsigned char *data); -void _dbus_pack_uint32 (dbus_uint32_t value, - int byte_order, - unsigned char *data); -dbus_uint32_t _dbus_unpack_uint32 (int byte_order, - const unsigned char *data); -#ifdef DBUS_HAVE_INT64 -void _dbus_pack_int64 (dbus_int64_t value, - int byte_order, - unsigned char *data); -dbus_int64_t _dbus_unpack_int64 (int byte_order, - const unsigned char *data); -void _dbus_pack_uint64 (dbus_uint64_t value, - int byte_order, - unsigned char *data); -dbus_uint64_t _dbus_unpack_uint64 (int byte_order, - const unsigned char *data); -#endif /* DBUS_HAVE_INT64 */ - -void _dbus_marshal_set_int32 (DBusString *str, - int byte_order, - int offset, - dbus_int32_t value); -void _dbus_marshal_set_uint32 (DBusString *str, - int byte_order, - int offset, - dbus_uint32_t value); -#ifdef DBUS_HAVE_INT64 -void _dbus_marshal_set_int64 (DBusString *str, - int byte_order, - int offset, - dbus_int64_t value); -void _dbus_marshal_set_uint64 (DBusString *str, - int byte_order, - int offset, - dbus_uint64_t value); -#endif /* DBUS_HAVE_INT64 */ - -dbus_bool_t _dbus_marshal_set_string (DBusString *str, - int byte_order, - int offset, - const DBusString *value, - int len); -void _dbus_marshal_set_object_path (DBusString *str, - int byte_order, - int offset, - const char **path, - int path_len); - -dbus_bool_t _dbus_marshal_int32 (DBusString *str, - int byte_order, - dbus_int32_t value); -dbus_bool_t _dbus_marshal_uint32 (DBusString *str, - int byte_order, - dbus_uint32_t value); -#ifdef DBUS_HAVE_INT64 -dbus_bool_t _dbus_marshal_int64 (DBusString *str, - int byte_order, - dbus_int64_t value); -dbus_bool_t _dbus_marshal_uint64 (DBusString *str, - int byte_order, - dbus_uint64_t value); -#endif /* DBUS_HAVE_INT64 */ -dbus_bool_t _dbus_marshal_double (DBusString *str, - int byte_order, - double value); -dbus_bool_t _dbus_marshal_string (DBusString *str, - int byte_order, - const char *value); -dbus_bool_t _dbus_marshal_string_len (DBusString *str, - int byte_order, - const char *value, - int len); -dbus_bool_t _dbus_marshal_basic_type (DBusString *str, - char type, - void *value, - int byte_order); -dbus_bool_t _dbus_marshal_byte_array (DBusString *str, - int byte_order, - const unsigned char *value, - int len); -dbus_bool_t _dbus_marshal_int32_array (DBusString *str, - int byte_order, - const dbus_int32_t *value, - int len); -dbus_bool_t _dbus_marshal_uint32_array (DBusString *str, - int byte_order, - const dbus_uint32_t *value, - int len); -#ifdef DBUS_HAVE_INT64 -dbus_bool_t _dbus_marshal_int64_array (DBusString *str, - int byte_order, - const dbus_int64_t *value, - int len); -dbus_bool_t _dbus_marshal_uint64_array (DBusString *str, - int byte_order, - const dbus_uint64_t *value, - int len); -#endif /* DBUS_HAVE_INT64 */ -dbus_bool_t _dbus_marshal_double_array (DBusString *str, - int byte_order, - const double *value, - int len); -dbus_bool_t _dbus_marshal_basic_type_array (DBusString *str, - char element_type, - const void *value, - int len, - int byte_order); - -dbus_bool_t _dbus_marshal_string_array (DBusString *str, - int byte_order, - const char **value, - int len); -dbus_bool_t _dbus_marshal_object_path (DBusString *str, - int byte_order, - const char **path, - int path_len); - -double _dbus_demarshal_double (const DBusString *str, - int byte_order, - int pos, - int *new_pos); -dbus_int32_t _dbus_demarshal_int32 (const DBusString *str, - int byte_order, - int pos, - int *new_pos); -dbus_uint32_t _dbus_demarshal_uint32 (const DBusString *str, - int byte_order, - int pos, - int *new_pos); -#ifdef DBUS_HAVE_INT64 -dbus_int64_t _dbus_demarshal_int64 (const DBusString *str, - int byte_order, - int pos, - int *new_pos); -dbus_uint64_t _dbus_demarshal_uint64 (const DBusString *str, - int byte_order, - int pos, - int *new_pos); -#endif /* DBUS_HAVE_INT64 */ -void _dbus_demarshal_basic_type (const DBusString *str, - int type, - void *value, - int byte_order, - int *pos); -char * _dbus_demarshal_string (const DBusString *str, - int byte_order, - int pos, - int *new_pos); -dbus_bool_t _dbus_demarshal_byte_array (const DBusString *str, - int byte_order, - int pos, - int *new_pos, - unsigned char **array, - int *array_len); -dbus_bool_t _dbus_demarshal_int32_array (const DBusString *str, - int byte_order, - int pos, - int *new_pos, - dbus_int32_t **array, - int *array_len); -dbus_bool_t _dbus_demarshal_uint32_array (const DBusString *str, - int byte_order, - int pos, - int *new_pos, - dbus_uint32_t **array, - int *array_len); -#ifdef DBUS_HAVE_INT64 -dbus_bool_t _dbus_demarshal_int64_array (const DBusString *str, - int byte_order, - int pos, - int *new_pos, - dbus_int64_t **array, - int *array_len); -dbus_bool_t _dbus_demarshal_uint64_array (const DBusString *str, - int byte_order, - int pos, - int *new_pos, - dbus_uint64_t **array, - int *array_len); -#endif /* DBUS_HAVE_INT64 */ -dbus_bool_t _dbus_demarshal_double_array (const DBusString *str, - int byte_order, - int pos, - int *new_pos, - double **array, - int *array_len); -dbus_bool_t _dbus_demarshal_basic_type_array (const DBusString *str, - int type, - void **array, - int *array_len, - int byte_order, - int *pos); - -dbus_bool_t _dbus_demarshal_string_array (const DBusString *str, - int byte_order, - int pos, - int *new_pos, - char ***array, - int *array_len); -dbus_bool_t _dbus_decompose_path (const char* data, - int len, - char ***path, - int *path_len); -dbus_bool_t _dbus_demarshal_object_path (const DBusString *str, - int byte_order, - int pos, - int *new_pos, - char ***path, - int *path_len); - -dbus_bool_t _dbus_marshal_get_arg_end_pos (const DBusString *str, - int byte_order, - int type, - int pos, - int *end_pos); -dbus_bool_t _dbus_marshal_validate_type (const DBusString *str, - int pos, - int *type, - int *end_pos); -dbus_bool_t _dbus_marshal_validate_arg (const DBusString *str, - int depth, - int byte_order, - int type, - int array_type_pos, - int pos, - int *end_pos); - -dbus_bool_t _dbus_type_is_valid (int typecode); - -#endif /* DBUS_MARSHAL_H */ |