26#include "dbus-internals.h"
27#include "dbus-marshal-basic.h"
28#include "dbus-signature.h"
29#include <dbus/dbus-test-tap.h>
33#if defined(__GNUC__) && (__GNUC__ >= 4)
34# define _DBUS_ASSERT_ALIGNMENT(type, op, val) \
35 _DBUS_STATIC_ASSERT (__extension__ __alignof__ (type) op val)
36# define _DBUS_ASSERT_CMP_ALIGNMENT(left, op, right) \
37 _DBUS_STATIC_ASSERT (__extension__ __alignof__ (left) op __extension__ __alignof__ (right))
41# define _DBUS_ASSERT_ALIGNMENT(type, op, val) \
42 _DBUS_STATIC_ASSERT (TRUE)
43# define _DBUS_ASSERT_CMP_ALIGNMENT(left, op, right) \
44 _DBUS_STATIC_ASSERT (TRUE)
48_DBUS_STATIC_ASSERT (
sizeof (
char) == 1);
49_DBUS_ASSERT_ALIGNMENT (
char, ==, 1);
66_DBUS_STATIC_ASSERT (
sizeof (
double) == 8);
67_DBUS_ASSERT_ALIGNMENT (
double, <=, 8);
153 pack_4_octets (value, byte_order, data);
160 if (byte_order != DBUS_COMPILER_BYTE_ORDER)
162 *value = DBUS_UINT64_SWAP_LE_BE (*value);
166#ifndef _dbus_unpack_uint16
176 const unsigned char *data)
181 return DBUS_UINT16_FROM_LE (*(
dbus_uint16_t *) (
void *) data);
183 return DBUS_UINT16_FROM_BE (*(
dbus_uint16_t *) (
void *) data);
187#ifndef _dbus_unpack_uint32
197 const unsigned char *data)
202 return DBUS_UINT32_FROM_LE (*(
dbus_uint32_t *) (
void *) data);
204 return DBUS_UINT32_FROM_BE (*(
dbus_uint32_t *) (
void *) data);
221 pack_2_octets (value, byte_order, (
unsigned char *) data);
237 pack_4_octets (value, byte_order, (
unsigned char *) data);
253 pack_8_octets (value, byte_order, (
unsigned char *) data);
272 set_4_octets (str, pos, value, byte_order);
302 int old_len, new_len;
307 _dbus_assert (_DBUS_ALIGN_VALUE (pos, 4) == (
unsigned) pos);
309 _dbus_string_get_const_udata_len (str, pos, 4));
311 new_len = _dbus_string_get_length (&dstr);
314 str, pos + 4, old_len))
320 *old_end_pos = pos + 4 + old_len + 1;
322 *new_end_pos = pos + 4 + new_len + 1;
348 int old_len, new_len;
353 old_len = _dbus_string_get_byte (str, pos);
354 new_len = _dbus_string_get_length (&dstr);
357 str, pos + 1, old_len))
360 _dbus_string_set_byte (str, pos, new_len);
363 *old_end_pos = pos + 1 + old_len + 1;
365 *new_end_pos = pos + 1 + new_len + 1;
399 const unsigned char *u8_p;
403 const char *
const *string_p;
409 _dbus_string_set_byte (str, pos, *u8_p);
411 *old_end_pos = pos + 1;
413 *new_end_pos = pos + 1;
419 pos = _DBUS_ALIGN_VALUE (pos, 2);
420 set_2_octets (str, pos, *u16_p, byte_order);
422 *old_end_pos = pos + 2;
424 *new_end_pos = pos + 2;
432 pos = _DBUS_ALIGN_VALUE (pos, 4);
433 set_4_octets (str, pos, *u32_p, byte_order);
435 *old_end_pos = pos + 4;
437 *new_end_pos = pos + 4;
444 pos = _DBUS_ALIGN_VALUE (pos, 8);
445 set_8_octets (str, pos, *u64_p, byte_order);
447 *old_end_pos = pos + 8;
449 *new_end_pos = pos + 8;
455 pos = _DBUS_ALIGN_VALUE (pos, 4);
457 return set_string (str, pos, *string_p, byte_order,
458 old_end_pos, new_end_pos);
463 return set_signature (str, pos, *string_p, byte_order,
464 old_end_pos, new_end_pos);
488 pos = _DBUS_ALIGN_VALUE (pos, 4);
493 _dbus_assert (pos + 4 <= _dbus_string_get_length (str));
496 _dbus_string_get_const_udata (str) + pos);
528 const char *str_data;
532 str_data = _dbus_string_get_const_data (str);
542 volatile unsigned char *vp = value;
543 *vp = (
unsigned char) _dbus_string_get_byte (str, pos);
551 pos = _DBUS_ALIGN_VALUE (pos, 2);
553 if (byte_order != DBUS_COMPILER_BYTE_ORDER)
554 *vp = DBUS_UINT16_SWAP_LE_BE (*vp);
564 pos = _DBUS_ALIGN_VALUE (pos, 4);
566 if (byte_order != DBUS_COMPILER_BYTE_ORDER)
567 *vp = DBUS_UINT32_SWAP_LE_BE (*vp);
576 pos = _DBUS_ALIGN_VALUE (pos, 8);
577 if (byte_order != DBUS_COMPILER_BYTE_ORDER)
578 *vp = DBUS_UINT64_SWAP_LE_BE (
589 volatile char **vp = value;
593 *vp = (
char*) str_data + pos;
601 volatile char **vp = value;
603 len = _dbus_string_get_byte (str, pos);
606 *vp = (
char*) str_data + pos;
632 _DBUS_STATIC_ASSERT (
sizeof (value) == 2);
634 if (byte_order != DBUS_COMPILER_BYTE_ORDER)
635 value = DBUS_UINT16_SWAP_LE_BE (value);
637 orig_len = _dbus_string_get_length (str);
640 (
const unsigned char *)&value);
644 *pos_after = insert_at + (_dbus_string_get_length (str) - orig_len);
645 _dbus_assert (*pos_after <= _dbus_string_get_length (str));
661 _DBUS_STATIC_ASSERT (
sizeof (value) == 4);
663 if (byte_order != DBUS_COMPILER_BYTE_ORDER)
664 value = DBUS_UINT32_SWAP_LE_BE (value);
666 orig_len = _dbus_string_get_length (str);
669 (
const unsigned char *)&value);
673 *pos_after = insert_at + (_dbus_string_get_length (str) - orig_len);
674 _dbus_assert (*pos_after <= _dbus_string_get_length (str));
690 _DBUS_STATIC_ASSERT (
sizeof (value) == 8);
692 swap_8_octets (&value, byte_order);
694 orig_len = _dbus_string_get_length (str);
697 (
const unsigned char *)&value);
700 *pos_after = insert_at + _dbus_string_get_length (str) - orig_len;
708 MARSHAL_AS_SIGNATURE,
709 MARSHAL_AS_BYTE_ARRAY
713marshal_len_followed_by_bytes (
int marshal_as,
716 const unsigned char *value,
726 if (insert_at > _dbus_string_get_length (str))
727 _dbus_warn (
"insert_at = %d string len = %d data_len = %d",
728 insert_at, _dbus_string_get_length (str), data_len);
730 if (marshal_as == MARSHAL_AS_BYTE_ARRAY)
731 value_len = data_len;
733 value_len = data_len + 1;
739 if (marshal_as == MARSHAL_AS_SIGNATURE)
751 if (!marshal_4_octets (str, pos, data_len,
788 return marshal_len_followed_by_bytes (MARSHAL_AS_STRING,
789 str, insert_at, (
const unsigned char *) value,
791 byte_order, pos_after);
800 return marshal_len_followed_by_bytes (MARSHAL_AS_SIGNATURE,
801 str, insert_at, (
const unsigned char *) value,
803 DBUS_COMPILER_BYTE_ORDER,
838 const unsigned char *u8_p;
842 const char *
const *string_p;
853 *pos_after = insert_at + 1;
859 return marshal_2_octets (str, insert_at, *u16_p,
860 byte_order, pos_after);
864 return marshal_4_octets (str, insert_at, (*u32_p !=
FALSE),
865 byte_order, pos_after);
871 return marshal_4_octets (str, insert_at, *u32_p,
872 byte_order, pos_after);
878 return marshal_8_octets (str, insert_at, *u64_p, byte_order, pos_after);
885 return marshal_string (str, insert_at, *string_p, byte_order, pos_after);
890 return marshal_signature (str, insert_at, *string_p, pos_after);
902 const unsigned char *value,
941 _dbus_assert (_DBUS_ALIGN_ADDRESS (data, alignment) == data);
947 end = data + (n_elements * alignment);
954 d = ((
unsigned char *) d) + 8;
957 else if (alignment == 4)
962 d = ((
unsigned char *) d) + 4;
972 d = ((
unsigned char *) d) + 2;
984 _dbus_assert (_DBUS_ALIGN_VALUE (array_start, alignment) == (
unsigned) array_start);
986 if (byte_order != DBUS_COMPILER_BYTE_ORDER)
991 _dbus_swap_array ((
unsigned char*) (_dbus_string_get_const_data (str) + array_start),
992 n_elements, alignment);
1012 old_string_len = _dbus_string_get_length (str);
1014 len_in_bytes = n_elements * alignment;
1015 array_start = insert_at;
1027 (
const char *) value,
1034 swap_array (str, array_start, n_elements, byte_order, alignment);
1037 *pos_after = array_start + len_in_bytes;
1043 _dbus_string_get_length (str) - old_string_len);
1081 const unsigned char *
const *u8_pp;
1090 _dbus_verbose (
"writing %d elements of %s\n",
1094 switch (element_type)
1098 return marshal_1_octets_array (str, insert_at, *u8_pp, n_elements, byte_order, pos_after);
1103 return marshal_fixed_multi (str, insert_at, *u16_pp, n_elements, byte_order, 2, pos_after);
1109 return marshal_fixed_multi (str, insert_at, *u32_pp, n_elements, byte_order, 4, pos_after);
1115 return marshal_fixed_multi (str, insert_at, *u64_pp, n_elements, byte_order, 8, pos_after);
1152 *pos = _DBUS_ALIGN_VALUE (*pos, 2);
1159 *pos = _DBUS_ALIGN_VALUE (*pos, 4);
1165 *pos = _DBUS_ALIGN_VALUE (*pos, 8);
1182 len = _dbus_string_get_byte (str, *pos);
1214 i = _DBUS_ALIGN_VALUE (*pos, 4);
1220 i = _DBUS_ALIGN_VALUE (i, alignment);
1222 *pos = i + array_len;
1306 return "object_path";
1312 return "dict_entry";
1318 return "begin_struct";
1320 return "end_struct";
1322 return "begin_dict_entry";
1324 return "end_dict_entry";
1345 const unsigned char *aligned;
1349 if (!_dbus_is_verbose())
1353 aligned = _DBUS_ALIGN_ADDRESS (data, 4);
1358 if (aligned != data)
1360 _dbus_verbose (
"%4ld\t%p: ", - (
long)(data - aligned), aligned);
1361 while (aligned != data)
1363 _dbus_verbose (
" ");
1372 if (_DBUS_ALIGN_ADDRESS (&data[i], 4) == &data[i])
1374 _dbus_verbose (
"%4d\t%p: ",
1375 offset + i, &data[i]);
1378 if (data[i] >= 32 &&
1380 _dbus_verbose (
" '%c' ", data[i]);
1382 _dbus_verbose (
"0x%s%x ",
1383 data[i] <= 0xf ?
"0" :
"", data[i]);
1387 if (_DBUS_ALIGN_ADDRESS (&data[i], 4) == &data[i])
1390 _dbus_verbose (
"BE: %d LE: %d",
1395 _DBUS_ALIGN_ADDRESS (&data[i], 8) == &data[i])
1399 _dbus_verbose (
" dbl: %g", *(
double *) (
void *) &data[i - 8]);
1402 _dbus_verbose (
"\n");
1406 _dbus_verbose (
"\n");
1424 real_len = _dbus_string_get_length (str);
1428 if (start > real_len)
1430 _dbus_verbose (
" [%d,%d) is not inside string of length %d\n",
1431 start, len, real_len);
1435 if ((start + len) > real_len)
1437 _dbus_verbose (
" [%d,%d) extends outside string of length %d\n",
1438 start, len, real_len);
1439 len = real_len - start;
1442 d = _dbus_string_get_const_data_len (str, start, len);
1448map_type_char_to_type (
int t)
1476 return map_type_char_to_type (_dbus_string_get_byte (str, pos));
1491 return map_type_char_to_type (str[pos]);
1496#ifdef DBUS_ENABLE_EMBEDDED_TESTS
1497#include "dbus-test.h"
1519_dbus_marshal_read_fixed_multi (
const DBusString *str,
1534 _dbus_verbose (
"reading %d elements of %s\n",
1540 pos = _DBUS_ALIGN_VALUE (pos, alignment);
1542 array_len = n_elements * alignment;
1544 *value = _dbus_string_get_const_data_len (str, pos, array_len);
1546 *new_pos = pos + array_len;
1550swap_test_array (
void *array,
1561 swap_array (&t, 0, len_bytes / alignment, byte_order, alignment);
1564#define MARSHAL_BASIC(typename, byte_order, literal) \
1566 v_##typename = literal; \
1567 if (!_dbus_marshal_write_basic (&str, pos, DBUS_TYPE_##typename, \
1569 byte_order, NULL)) \
1570 _dbus_test_fatal ("no memory"); \
1573#define DEMARSHAL_BASIC(typename, byte_order) \
1575 _dbus_marshal_read_basic (&str, pos, DBUS_TYPE_##typename, &v_##typename, \
1576 byte_order, &pos); \
1579#define DEMARSHAL_BASIC_AND_CHECK(typename, byte_order, literal) \
1581 DEMARSHAL_BASIC (typename, byte_order); \
1582 if (literal != v_##typename) \
1584 _dbus_verbose_bytes_of_string (&str, dump_pos, \
1585 _dbus_string_get_length (&str) - dump_pos); \
1586 _dbus_test_fatal ("demarshaled wrong value"); \
1590#define MARSHAL_TEST(typename, byte_order, literal) \
1592 MARSHAL_BASIC (typename, byte_order, literal); \
1594 DEMARSHAL_BASIC_AND_CHECK (typename, byte_order, literal); \
1597#define MARSHAL_TEST_STRCMP(typename, byte_order, literal) \
1599 MARSHAL_BASIC (typename, byte_order, literal); \
1601 DEMARSHAL_BASIC (typename, byte_order); \
1602 if (strcmp (literal, v_##typename) != 0) \
1604 _dbus_verbose_bytes_of_string (&str, dump_pos, \
1605 _dbus_string_get_length (&str) - dump_pos); \
1606 _dbus_warn ("literal '%s'\nvalue '%s'", literal, v_##typename); \
1607 _dbus_test_fatal ("demarshaled wrong value"); \
1611#define MARSHAL_FIXED_ARRAY(typename, byte_order, literal) \
1614 v_UINT32 = sizeof(literal); \
1615 if (!_dbus_marshal_write_basic (&str, pos, DBUS_TYPE_UINT32, &v_UINT32, \
1616 byte_order, &next)) \
1617 _dbus_test_fatal ("no memory"); \
1618 v_ARRAY_##typename = literal; \
1619 if (!_dbus_marshal_write_fixed_multi (&str, next, DBUS_TYPE_##typename, \
1620 &v_ARRAY_##typename, _DBUS_N_ELEMENTS(literal), \
1621 byte_order, NULL)) \
1622 _dbus_test_fatal ("no memory"); \
1625#define DEMARSHAL_FIXED_ARRAY(typename, byte_order) \
1628 alignment = _dbus_type_get_alignment (DBUS_TYPE_##typename); \
1629 v_UINT32 = _dbus_marshal_read_uint32 (&str, dump_pos, byte_order, &next); \
1630 _dbus_marshal_read_fixed_multi (&str, next, DBUS_TYPE_##typename, \
1631 (const void **) &v_ARRAY_##typename, \
1632 v_UINT32/alignment, \
1633 byte_order, NULL); \
1634 swap_test_array (v_ARRAY_##typename, v_UINT32, \
1635 byte_order, alignment); \
1638#define DEMARSHAL_FIXED_ARRAY_AND_CHECK(typename, byte_order, literal) \
1640 DEMARSHAL_FIXED_ARRAY (typename, byte_order); \
1641 if (memcmp (literal, v_ARRAY_##typename, sizeof (literal)) != 0) \
1643 _dbus_verbose ("MARSHALED DATA\n"); \
1644 _dbus_verbose_bytes_of_string (&str, dump_pos, \
1645 _dbus_string_get_length (&str) - dump_pos); \
1646 _dbus_verbose ("LITERAL DATA\n"); \
1647 _dbus_verbose_bytes ((const unsigned char *) literal, sizeof (literal), 0); \
1648 _dbus_verbose ("READ DATA\n"); \
1649 _dbus_verbose_bytes ((const unsigned char *) v_ARRAY_##typename, sizeof (literal), 0); \
1650 _dbus_test_fatal ("demarshaled wrong fixed array value"); \
1654#define MARSHAL_TEST_FIXED_ARRAY(typename, byte_order, literal) \
1656 MARSHAL_FIXED_ARRAY (typename, byte_order, literal); \
1658 DEMARSHAL_FIXED_ARRAY_AND_CHECK (typename, byte_order, literal); \
1662_dbus_marshal_test (
const char *test_data_dir _DBUS_GNUC_UNUSED)
1667 unsigned char array1[5] = { 3, 4, 0, 1, 9 };
1676 unsigned char *v_ARRAY_BYTE;
1690 unsigned char v_BYTE;
1692 const char *v_STRING;
1693 const char *v_SIGNATURE;
1694 const char *v_OBJECT_PATH;
1698 _dbus_test_fatal (
"failed to init string");
1707 _dbus_test_fatal (
"got wrong double value");
1713 _dbus_test_fatal (
"got wrong double value");
1752 MARSHAL_TEST_STRCMP (STRING,
DBUS_BIG_ENDIAN,
"This is the dbus test string");
1797 _dbus_string_get_const_data (&str)));
1805 _dbus_string_get_const_data (&str)));
1810 _dbus_string_get_data (&str));
1814 _dbus_string_get_const_data (&str)));
1819 _dbus_string_get_data (&str));
1823 _dbus_string_get_const_data (&str)));
1831 _dbus_string_get_const_data (&str)));
1839 _dbus_string_get_const_data (&str)));
1844 _dbus_string_get_data (&str));
1848 _dbus_string_get_const_data (&str)));
1853 _dbus_string_get_data (&str));
1857 _dbus_string_get_const_data (&str)));
1868 _dbus_string_get_const_data (&str)));
1876 _dbus_string_get_const_data (&str)));
1879 _dbus_pack_int32 (-0x123456,
1881 _dbus_string_get_data (&str));
1885 _dbus_string_get_const_data (&str)));
1888 _dbus_pack_int32 (-0x123456,
1890 _dbus_string_get_data (&str));
1894 _dbus_string_get_const_data (&str)));
1903 _dbus_string_get_const_data (&str)));
1912 _dbus_string_get_const_data (&str)));
1917 _dbus_string_get_data (&str));
1921 _dbus_string_get_const_data (&str)));
1926 _dbus_string_get_data (&str));
1930 _dbus_string_get_const_data (&str)));
1944 MARSHAL_TEST_STRCMP (STRING, byte_order,
"Hello world");
1949 v_STRING = _dbus_string_get_const_data (&t);
1951 &v_STRING, byte_order,
NULL,
NULL);
1954 &v_STRING, byte_order,
1956 _dbus_assert (strcmp (v_STRING,
"Hello world foo") == 0);
1961 v_STRING = _dbus_string_get_const_data (&t);
1963 &v_STRING, byte_order,
NULL,
NULL);
1965 &v_STRING, byte_order,
#define _dbus_assert_not_reached(explanation)
Aborts with an error message if called.
#define _dbus_assert(condition)
Aborts with an error message if the condition is false.
void _dbus_warn_check_failed(const char *format,...)
Prints a "critical" warning to stderr when an assertion fails; differs from _dbus_warn primarily in t...
void _dbus_warn(const char *format,...)
Prints a warning message to stderr.
#define NULL
A null pointer, defined appropriately for C or C++.
#define TRUE
Expands to "1".
#define FALSE
Expands to "0".
dbus_uint16_t _dbus_unpack_uint16(int byte_order, const unsigned char *data)
Unpacks a 16 bit unsigned integer from a data pointer.
int _dbus_type_get_alignment(int typecode)
Gets the alignment requirement for the given type; will be 1, 4, or 8.
void _dbus_verbose_bytes_of_string(const DBusString *str, int start, int len)
Dump the given part of the string to verbose log.
void _dbus_pack_uint32(dbus_uint32_t value, int byte_order, unsigned char *data)
Packs a 32 bit unsigned integer into a data pointer.
void _dbus_marshal_set_uint32(DBusString *str, int pos, dbus_uint32_t value, int byte_order)
Sets the 4 bytes at the given offset to a marshaled unsigned integer, replacing anything found there ...
dbus_uint32_t _dbus_unpack_uint32(int byte_order, const unsigned char *data)
Unpacks a 32 bit unsigned integer from a data pointer.
dbus_bool_t _dbus_marshal_write_basic(DBusString *str, int insert_at, int type, const void *value, int byte_order, int *pos_after)
Marshals a basic-typed value.
int _dbus_first_type_in_signature(const DBusString *str, int pos)
Get the first type in the signature.
int _dbus_first_type_in_signature_c_str(const char *str, int pos)
Similar to _dbus_first_type_in_signature, but operates on a C string buffer.
dbus_uint32_t _dbus_marshal_read_uint32(const DBusString *str, int pos, int byte_order, int *new_pos)
Convenience function to demarshal a 32 bit unsigned integer.
void _dbus_verbose_bytes(const unsigned char *data, int len, int offset)
If in verbose mode, print a block of binary data.
dbus_bool_t _dbus_marshal_set_basic(DBusString *str, int pos, int type, const void *value, int byte_order, int *old_end_pos, int *new_end_pos)
Sets an existing basic type value to a new value.
void _dbus_marshal_skip_array(const DBusString *str, int element_type, int byte_order, int *pos)
Skips an array, returning the next position.
dbus_bool_t _dbus_marshal_write_fixed_multi(DBusString *str, int insert_at, int element_type, const void *value, int n_elements, int byte_order, int *pos_after)
Marshals a block of values of fixed-length type all at once, as an optimization.
const char * _dbus_type_to_string(int typecode)
Returns a string describing the given type.
void _dbus_marshal_read_basic(const DBusString *str, int pos, int type, void *value, int byte_order, int *new_pos)
Demarshals a basic-typed value.
void _dbus_swap_array(unsigned char *data, int n_elements, int alignment)
Swaps the elements of an array to the opposite byte order.
void _dbus_marshal_skip_basic(const DBusString *str, int type, int byte_order, int *pos)
Skips over a basic-typed value, reporting the following position.
#define DBUS_TYPE_SIGNATURE
Type code marking a D-Bus type signature.
#define DBUS_MAXIMUM_SIGNATURE_LENGTH
This one is 255 so it fits in a byte.
#define DBUS_DICT_ENTRY_END_CHAR
Code marking the end of a dict entry type in a type signature.
#define DBUS_TYPE_OBJECT_PATH
Type code marking a D-Bus object path.
#define DBUS_TYPE_BYTE
Type code marking an 8-bit unsigned integer.
#define DBUS_TYPE_INT16
Type code marking a 16-bit signed integer.
#define DBUS_TYPE_VARIANT
Type code marking a D-Bus variant type.
#define DBUS_MAXIMUM_ARRAY_LENGTH
Max length of a marshaled array in bytes (64M, 2^26) We use signed int for lengths so must be INT_MAX...
#define DBUS_TYPE_INT32
Type code marking a 32-bit signed integer.
#define DBUS_TYPE_UNIX_FD
Type code marking a unix file descriptor.
#define DBUS_TYPE_BOOLEAN
Type code marking a boolean.
#define DBUS_STRUCT_BEGIN_CHAR
Code marking the start of a struct type in a type signature.
#define DBUS_TYPE_STRING
Type code marking a UTF-8 encoded, nul-terminated Unicode string.
#define DBUS_TYPE_ARRAY
Type code marking a D-Bus array type.
#define DBUS_TYPE_INVALID
Type code that is never equal to a legitimate type code.
#define DBUS_LITTLE_ENDIAN
Code marking LSB-first byte order in the wire protocol.
#define DBUS_TYPE_INT64
Type code marking a 64-bit signed integer.
#define DBUS_TYPE_DOUBLE
Type code marking an 8-byte double in IEEE 754 format.
#define DBUS_TYPE_UINT64
Type code marking a 64-bit unsigned integer.
#define DBUS_TYPE_DICT_ENTRY
Type code used to represent a dict entry; however, this type code does not appear in type signatures,...
#define DBUS_DICT_ENTRY_BEGIN_CHAR
Code marking the start of a dict entry type in a type signature.
#define DBUS_TYPE_UINT16
Type code marking a 16-bit unsigned integer.
#define DBUS_TYPE_STRUCT
STRUCT and DICT_ENTRY are sort of special since their codes can't appear in a type string,...
#define DBUS_STRUCT_END_CHAR
Code marking the end of a struct type in a type signature.
#define DBUS_BIG_ENDIAN
Code marking MSB-first byte order in the wire protocol.
#define DBUS_TYPE_UINT32
Type code marking a 32-bit unsigned integer.
dbus_bool_t dbus_type_is_basic(int typecode)
A "basic type" is a somewhat arbitrary concept, but the intent is to include those types that are ful...
dbus_bool_t dbus_type_is_fixed(int typecode)
Tells you whether values of this type can change length if you set them to some other value.
dbus_bool_t _dbus_string_set_length(DBusString *str, int length)
Sets the length of a string.
dbus_bool_t _dbus_string_insert_8_aligned(DBusString *str, int insert_at, const unsigned char octets[8])
Inserts 8 bytes aligned on an 8 byte boundary with any alignment padding initialized to 0.
dbus_bool_t _dbus_string_equal_substring(const DBusString *a, int a_start, int a_len, const DBusString *b, int b_start)
Tests two sub-parts of two DBusString for equality.
dbus_bool_t _dbus_string_insert_alignment(DBusString *str, int *insert_at, int alignment)
Inserts padding at *insert_at such to align it to the given boundary.
dbus_bool_t _dbus_string_init(DBusString *str)
Initializes a string.
void _dbus_string_init_const(DBusString *str, const char *value)
Initializes a constant string.
dbus_bool_t _dbus_string_copy(const DBusString *source, int start, DBusString *dest, int insert_at)
Like _dbus_string_move(), but does not delete the section of the source string that's copied to the d...
char * _dbus_string_get_data_len(DBusString *str, int start, int len)
Gets a sub-portion of the raw character buffer from the string.
void _dbus_string_init_const_len(DBusString *str, const char *value, int len)
Initializes a constant string with a length.
void _dbus_string_free(DBusString *str)
Frees a string created by _dbus_string_init(), and fills it with the same contents as #_DBUS_STRING_I...
void _dbus_string_delete(DBusString *str, int start, int len)
Deletes a segment of a DBusString with length len starting at start.
dbus_bool_t _dbus_string_insert_byte(DBusString *str, int i, unsigned char byte)
Inserts a single byte at the given position.
dbus_bool_t _dbus_string_insert_4_aligned(DBusString *str, int insert_at, const unsigned char octets[4])
Inserts 4 bytes aligned on a 4 byte boundary with any alignment padding initialized to 0.
dbus_bool_t _dbus_string_insert_2_aligned(DBusString *str, int insert_at, const unsigned char octets[2])
Inserts 2 bytes aligned on a 2 byte boundary with any alignment padding initialized to 0.
dbus_bool_t _dbus_string_copy_len(const DBusString *source, int start, int len, DBusString *dest, int insert_at)
Like _dbus_string_copy(), but can copy a segment from the middle of the source string.
dbus_bool_t _dbus_string_replace_len(const DBusString *source, int start, int len, DBusString *dest, int replace_at, int replace_len)
Replaces a segment of dest string with a segment of source string.
#define _DBUS_DOUBLES_BITWISE_EQUAL(a, b)
On x86 there is an 80-bit FPU, and if you do "a == b" it may have a or b in an 80-bit register,...
_DBUS_GNUC_EXTENSION typedef unsigned long dbus_uint64_t
A 64-bit unsigned integer.
#define DBUS_UINT64_CONSTANT(val)
Declare a 64-bit unsigned integer constant.
dbus_uint32_t dbus_bool_t
A boolean, valid values are TRUE and FALSE.
short dbus_int16_t
A 16-bit signed integer on all platforms.
#define DBUS_INT64_MODIFIER
A string literal for a length modifier that is appropriate to print the dbus_int64_t and dbus_uint64_...
unsigned short dbus_uint16_t
A 16-bit unsigned integer on all platforms.
#define DBUS_INT64_CONSTANT(val)
Declare a 64-bit signed integer constant.
int dbus_int32_t
A 32-bit signed integer on all platforms.
_DBUS_GNUC_EXTENSION typedef long dbus_int64_t
A 64-bit signed integer.
unsigned int dbus_uint32_t
A 32-bit unsigned integer on all platforms.
An 8-byte struct you could use to access int64 without having int64 support.
A simple value union that lets you access bytes as if they were various types; useful when dealing wi...