26 #include "dbus-internals.h"
27 #include "dbus-test.h"
28 #include "dbus-message-private.h"
29 #include "dbus-marshal-recursive.h"
30 #include "dbus-string.h"
31 #ifdef HAVE_UNIX_FD_PASSING
32 #include "dbus-sysdeps-unix.h"
37 #include <sys/types.h>
48 #ifdef DBUS_BUILD_TESTS
70 _dbus_return_val_if_fail (iter !=
NULL,
FALSE);
71 _dbus_return_val_if_error_is_set (error,
FALSE);
73 va_start (var_args, first_arg_type);
83 #ifdef DBUS_BUILD_TESTS
84 #include "dbus-test.h"
85 #include "dbus-message-factory.h"
89 static int validities_seen[DBUS_VALIDITY_LAST + _DBUS_NEGATIVE_VALIDITY_COUNT];
92 reset_validities_seen (
void)
98 validities_seen[i] = 0;
106 validities_seen[validity + _DBUS_NEGATIVE_VALIDITY_COUNT] += 1;
116 if ((i - _DBUS_NEGATIVE_VALIDITY_COUNT) == DBUS_VALIDITY_UNKNOWN ||
117 (i - _DBUS_NEGATIVE_VALIDITY_COUNT) == DBUS_INVALID_FOR_UNKNOWN_REASON)
119 else if ((not_seen && validities_seen[i] == 0) ||
120 (!not_seen && validities_seen[i] > 0))
121 printf (
"validity %3d seen %d times\n",
122 i - _DBUS_NEGATIVE_VALIDITY_COUNT,
129 check_memleaks (
void)
133 if (_dbus_get_malloc_blocks_outstanding () != 0)
135 _dbus_warn (
"%d dbus_malloc blocks were not freed in %s\n",
136 _dbus_get_malloc_blocks_outstanding (), __FILE__);
142 struct DBusInitialFDs {
148 _dbus_check_fdleaks_enter (
void)
155 fds = malloc (
sizeof (DBusInitialFDs));
160 if ((d = opendir (
"/proc/self/fd")))
164 while ((de = readdir(d)))
170 if (de->d_name[0] ==
'.')
174 l = strtol (de->d_name, &e, 10);
185 FD_SET (fd, &fds->set);
198 _dbus_check_fdleaks_leave (DBusInitialFDs *fds)
205 if ((d = opendir (
"/proc/self/fd")))
209 while ((de = readdir(d)))
215 if (de->d_name[0] ==
'.')
219 l = strtol (de->d_name, &e, 10);
230 if (FD_ISSET (fd, &fds->set))
233 _dbus_warn (
"file descriptor %i leaked in %s.\n", fd, __FILE__);
257 _dbus_warn (
"loader corrupted on message that was expected to be valid; invalid reason %d\n",
265 _dbus_warn (
"didn't load message that was expected to be valid (message not popped)\n");
271 _dbus_warn (
"had leftover bytes from expected-to-be-valid single message\n");
281 if (!check_message_handling (message))
306 _dbus_warn (
"loader not corrupted on message that was expected to be invalid\n");
312 if (expected_validity != DBUS_INVALID_FOR_UNKNOWN_REASON &&
315 _dbus_warn (
"expected message to be corrupted for reason %d and was corrupted for %d instead\n",
337 _dbus_warn (
"loader corrupted on message that was expected to be valid (but incomplete), corruption reason %d\n",
345 _dbus_warn (
"loaded message that was expected to be incomplete\n");
349 record_validity_seen (DBUS_VALID_BUT_INCOMPLETE);
366 return check_have_valid_message (loader);
367 else if (expected_validity == DBUS_VALID_BUT_INCOMPLETE)
368 return check_incomplete_message (loader);
369 else if (expected_validity == DBUS_VALIDITY_UNKNOWN)
381 return check_invalid_message (loader, expected_validity);
392 dbus_internal_do_not_use_load_message_file (
const DBusString *filename,
403 _dbus_warn (
"Could not load message file %s: %s\n",
426 dbus_internal_do_not_use_try_message_file (
const DBusString *filename,
437 if (!dbus_internal_do_not_use_load_message_file (filename, &data))
440 retval = dbus_internal_do_not_use_try_message_data (&data, expected_validity);
450 _dbus_warn (
"Failed message loader test on %s\n",
468 dbus_internal_do_not_use_try_message_data (
const DBusString *data,
489 for (i = 0; i < len; i++)
499 if (!check_loader_results (loader, expected_validity))
518 if (!check_loader_results (loader, expected_validity))
529 for (i = 0; i < len; i += 2)
542 if (!check_loader_results (loader, expected_validity))
559 process_test_subdir (
const DBusString *test_base_dir,
562 DBusForeachMessageFileFunc
function,
600 printf (
"Testing %s:\n", subdir);
622 printf (
"SKIP: Could not load %s, message builder language no longer supported\n",
626 _dbus_verbose (
"Skipping non-.message file %s\n",
635 if (! (*
function) (&full_path,
636 expected_validity, user_data))
647 _dbus_warn (
"Could not get next file in %s: %s\n",
676 dbus_internal_do_not_use_foreach_message_file (
const char *test_data_dir,
677 DBusForeachMessageFileFunc func,
687 if (!process_test_subdir (&test_directory,
"valid-messages",
693 if (!process_test_subdir (&test_directory,
"invalid-messages",
694 DBUS_INVALID_FOR_UNKNOWN_REASON, func, user_data))
699 if (!process_test_subdir (&test_directory,
"incomplete-messages",
700 DBUS_VALID_BUT_INCOMPLETE, func, user_data))
715 #define GET_AND_CHECK(iter, typename, literal) \
717 if (dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_##typename) \
718 _dbus_assert_not_reached ("got wrong argument type from message iter"); \
719 dbus_message_iter_get_basic (&iter, &v_##typename); \
720 if (v_##typename != literal) \
721 _dbus_assert_not_reached ("got wrong value from message iter"); \
724 #define GET_AND_CHECK_STRCMP(iter, typename, literal) \
726 if (dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_##typename) \
727 _dbus_assert_not_reached ("got wrong argument type from message iter"); \
728 dbus_message_iter_get_basic (&iter, &v_##typename); \
729 if (strcmp (v_##typename, literal) != 0) \
730 _dbus_assert_not_reached ("got wrong value from message iter"); \
733 #define GET_AND_CHECK_AND_NEXT(iter, typename, literal) \
735 GET_AND_CHECK(iter, typename, literal); \
736 if (!dbus_message_iter_next (&iter)) \
737 _dbus_assert_not_reached ("failed to move iter to next"); \
740 #define GET_AND_CHECK_STRCMP_AND_NEXT(iter, typename, literal) \
742 GET_AND_CHECK_STRCMP(iter, typename, literal); \
743 if (!dbus_message_iter_next (&iter)) \
744 _dbus_assert_not_reached ("failed to move iter to next"); \
751 const char *v_STRING;
757 #ifdef DBUS_HAVE_INT64
761 unsigned char v_BYTE;
769 GET_AND_CHECK_STRCMP_AND_NEXT (iter, STRING,
"Test string");
770 GET_AND_CHECK_AND_NEXT (iter, INT32, -0x12345678);
771 GET_AND_CHECK_AND_NEXT (iter, UINT32, 0xedd1e);
772 GET_AND_CHECK_AND_NEXT (iter, DOUBLE, 3.14159);
782 GET_AND_CHECK_AND_NEXT (array, DOUBLE, 1.5);
783 GET_AND_CHECK (array, DOUBLE, 2.5);
791 GET_AND_CHECK_AND_NEXT (iter, BYTE, 0xF0);
808 GET_AND_CHECK (iter, BYTE, 0xF0);
828 unsigned char our_byte_1, our_byte_2;
830 int our_uint32_array_len;
832 int our_int32_array_len;
833 #ifdef DBUS_HAVE_INT64
837 int our_uint64_array_len;
838 const dbus_int64_t *our_int64_array = (
void*)0xdeadbeef;
839 int our_int64_array_len;
841 const double *our_double_array = (
void*)0xdeadbeef;
842 int our_double_array_len;
843 const unsigned char *our_byte_array = (
void*)0xdeadbeef;
844 int our_byte_array_len;
845 const dbus_bool_t *our_boolean_array = (
void*)0xdeadbeef;
846 int our_boolean_array_len;
847 char **our_string_array;
848 int our_string_array_len;
852 if (!dbus_message_iter_get_args (&iter, &error,
867 &our_uint32_array, &our_uint32_array_len,
869 &our_int32_array, &our_int32_array_len,
872 &our_uint64_array, &our_uint64_array_len,
873 DBUS_TYPE_ARRAY, DBUS_TYPE_INT64,
874 &our_int64_array, &our_int64_array_len,
877 &our_double_array, &our_double_array_len,
879 &our_byte_array, &our_byte_array_len,
881 &our_boolean_array, &our_boolean_array_len,
882 DBUS_TYPE_ARRAY, DBUS_TYPE_STRING,
883 &our_string_array, &our_string_array_len,
891 if (our_int16 != -0x123)
894 if (our_uint16 != 0x123)
897 if (our_int != -0x12345678)
900 if (our_uint != 0x12300042)
903 #ifdef DBUS_HAVE_INT64
914 if (strcmp (our_str,
"Test string") != 0)
920 if (our_byte_1 != 42)
923 if (our_byte_2 != 24)
926 if (our_uint32_array_len != 4 ||
927 our_uint32_array[0] != 0x12345678 ||
928 our_uint32_array[1] != 0x23456781 ||
929 our_uint32_array[2] != 0x34567812 ||
930 our_uint32_array[3] != 0x45678123)
933 if (our_int32_array_len != 4 ||
934 our_int32_array[0] != 0x12345678 ||
935 our_int32_array[1] != -0x23456781 ||
936 our_int32_array[2] != 0x34567812 ||
937 our_int32_array[3] != -0x45678123)
940 #ifdef DBUS_HAVE_INT64
941 if (our_uint64_array_len != 4 ||
942 our_uint64_array[0] != 0x12345678 ||
943 our_uint64_array[1] != 0x23456781 ||
944 our_uint64_array[2] != 0x34567812 ||
945 our_uint64_array[3] != 0x45678123)
948 if (our_int64_array_len != 4 ||
949 our_int64_array[0] != 0x12345678 ||
950 our_int64_array[1] != -0x23456781 ||
951 our_int64_array[2] != 0x34567812 ||
952 our_int64_array[3] != -0x45678123)
956 if (our_double_array_len != 3)
965 v_DOUBLE = 9876.54321;
972 if (our_byte_array_len != 4)
975 if (our_byte_array[0] !=
'a' ||
976 our_byte_array[1] !=
'b' ||
977 our_byte_array[2] !=
'c' ||
978 our_byte_array[3] != 234)
981 if (our_boolean_array_len != 5)
984 if (our_boolean_array[0] !=
TRUE ||
985 our_boolean_array[1] !=
FALSE ||
986 our_boolean_array[2] !=
TRUE ||
987 our_boolean_array[3] !=
TRUE ||
988 our_boolean_array[4] !=
FALSE)
991 if (our_string_array_len != 4)
994 if (strcmp (our_string_array[0],
"Foo") != 0 ||
995 strcmp (our_string_array[1],
"bar") != 0 ||
996 strcmp (our_string_array[2],
"") != 0 ||
997 strcmp (our_string_array[3],
"woo woo woo woo") != 0)
1013 _dbus_message_test (
const char *test_data_dir)
1023 { 0x12345678, 0x23456781, 0x34567812, 0x45678123 };
1025 { 0x12345678, -0x23456781, 0x34567812, -0x45678123 };
1028 #ifdef DBUS_HAVE_INT64
1030 { 0x12345678, 0x23456781, 0x34567812, 0x45678123 };
1032 { 0x12345678, -0x23456781, 0x34567812, -0x45678123 };
1036 const char *our_string_array[] = {
"Foo",
"bar",
"",
"woo woo woo woo" };
1037 const char **v_ARRAY_STRING = our_string_array;
1038 const double our_double_array[] = { 0.1234, 9876.54321, -300.0 };
1039 const double *v_ARRAY_DOUBLE = our_double_array;
1040 const unsigned char our_byte_array[] = {
'a',
'b',
'c', 234 };
1041 const unsigned char *v_ARRAY_BYTE = our_byte_array;
1043 const dbus_bool_t *v_ARRAY_BOOLEAN = our_boolean_array;
1046 const char *v_STRING;
1052 #ifdef DBUS_HAVE_INT64
1056 unsigned char v_BYTE;
1057 unsigned char v2_BYTE;
1060 #ifdef HAVE_UNIX_FD_PASSING
1064 DBusInitialFDs *initial_fds;
1066 initial_fds = _dbus_check_fdleaks_enter ();
1069 "/org/freedesktop/TestPath",
1070 "Foo.TestInterface",
1076 "/org/freedesktop/TestPath") == 0);
1138 "org.Foo.Bar") == 0);
1194 "/org/freedesktop/TestPath",
1195 "Foo.TestInterface",
1202 v_INT32 = -0x12345678;
1203 v_UINT32 = 0x12300042;
1204 #ifdef DBUS_HAVE_INT64
1208 v_STRING =
"Test string";
1213 #ifdef HAVE_UNIX_FD_PASSING
1223 DBUS_TYPE_INT64, &v_INT64,
1226 DBUS_TYPE_STRING, &v_STRING,
1238 DBUS_TYPE_ARRAY, DBUS_TYPE_INT64, &v_ARRAY_INT64,
1247 DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &v_ARRAY_STRING,
1257 #ifdef DBUS_HAVE_INT64
1270 #ifdef DBUS_HAVE_INT64
1287 #ifdef HAVE_UNIX_FD_PASSING
1297 _dbus_verbose (
"HEADER\n");
1300 _dbus_verbose (
"BODY\n");
1304 _dbus_verbose (
"Signature expected \"%s\" actual \"%s\"\n",
1312 verify_test_message (message);
1326 verify_test_message (copy);
1370 #ifdef HAVE_UNIX_FD_PASSING
1373 unsigned n_unix_fds;
1407 verify_test_message (message_without_unix_fds);
1414 char *marshalled =
NULL;
1429 verify_test_message (message2);
1461 _dbus_check_fdleaks_leave (initial_fds);
1462 initial_fds = _dbus_check_fdleaks_enter ();
1466 "/org/freedesktop/TestPath",
1467 "Foo.TestInterface",
1479 NULL, &struct_iter));
1494 DBusMessageDataIter diter;
1495 DBusMessageData mdata;
1498 reset_validities_seen ();
1501 _dbus_message_data_iter_init (&diter);
1503 while (_dbus_message_data_iter_get_and_next (&diter,
1506 if (!dbus_internal_do_not_use_try_message_data (&mdata.data,
1507 mdata.expected_validity))
1509 _dbus_warn (
"expected validity %d and did not get it\n",
1510 mdata.expected_validity);
1514 _dbus_message_data_free (&mdata);
1519 printf (
"%d sample messages tested\n", count);
1521 print_validities_seen (
FALSE);
1522 print_validities_seen (
TRUE);
1526 _dbus_check_fdleaks_leave (initial_fds);
1529 if (test_data_dir ==
NULL)
1532 initial_fds = _dbus_check_fdleaks_enter ();
1534 if (!dbus_internal_do_not_use_foreach_message_file (test_data_dir,
1535 (DBusForeachMessageFileFunc)
1536 dbus_internal_do_not_use_try_message_file,
1540 _dbus_check_fdleaks_leave (initial_fds);
unsigned int dbus_uint32_t
A 32-bit unsigned integer on all platforms.
#define DBUS_TYPE_UINT16
Type code marking a 16-bit unsigned integer.
void dbus_message_lock(DBusMessage *message)
Locks a message.
const char * message
public error message field
#define NULL
A null pointer, defined appropriately for C or C++.
long _dbus_message_loader_get_max_message_size(DBusMessageLoader *loader)
Gets the maximum allowed message size in bytes.
void dbus_message_set_no_reply(DBusMessage *message, dbus_bool_t no_reply)
Sets a flag indicating that the message does not want a reply; if this flag is set, the other end of the connection may (but is not required to) optimize by not sending method return or error replies.
int dbus_message_iter_get_arg_type(DBusMessageIter *iter)
Returns the argument type of the argument that the message iterator points to.
void dbus_free(void *memory)
Frees a block of memory previously allocated by dbus_malloc() or dbus_malloc0().
void _dbus_message_loader_return_unix_fds(DBusMessageLoader *loader, int *fds, unsigned n_fds)
Returns a buffer obtained from _dbus_message_loader_get_unix_fds().
dbus_uint32_t dbus_message_get_serial(DBusMessage *message)
Returns the serial of a message or 0 if none has been specified.
#define DBUS_STRUCT_BEGIN_CHAR_AS_STRING
DBUS_STRUCT_BEGIN_CHAR as a string literal instead of a int literal
void dbus_message_iter_recurse(DBusMessageIter *iter, DBusMessageIter *sub)
Recurses into a container value when reading values from a message, initializing a sub-iterator to us...
DBusMessage * _dbus_message_loader_pop_message(DBusMessageLoader *loader)
Pops a loaded message (passing ownership of the message to the caller).
#define DBUS_TYPE_STRUCT
STRUCT and DICT_ENTRY are sort of special since their codes can't appear in a type string...
void _dbus_directory_close(DBusDirIter *iter)
Closes a directory iteration.
dbus_bool_t _dbus_message_iter_get_args_valist(DBusMessageIter *iter, DBusError *error, int first_arg_type, va_list var_args)
Implementation of the varargs arg-getting functions.
#define DBUS_TYPE_STRING
Type code marking a UTF-8 encoded, nul-terminated Unicode string.
DBusString body
Body network data.
#define _dbus_assert(condition)
Aborts with an error message if the condition is false.
dbus_bool_t _dbus_directory_get_next_file(DBusDirIter *iter, DBusString *filename, DBusError *error)
Get next file in the directory.
#define DBUS_ERROR_INIT
Expands to a suitable initializer for a DBusError on the stack.
const char * dbus_message_get_signature(DBusMessage *message)
Gets the type signature of the message, i.e.
void dbus_message_iter_init_append(DBusMessage *message, DBusMessageIter *iter)
Initializes a DBusMessageIter for appending arguments to the end of a message.
void dbus_error_free(DBusError *error)
Frees an error that's been set (or just initialized), then reinitializes the error as in dbus_error_i...
#define DBUS_TYPE_BYTE
Type code marking an 8-bit unsigned integer.
void _dbus_message_loader_unref(DBusMessageLoader *loader)
Decrements the reference count of the loader and finalizes the loader when the count reaches zero...
unsigned char _dbus_string_get_byte(const DBusString *str, int start)
Gets the byte at the given position.
int _dbus_dup(int fd, DBusError *error)
Duplicates a file descriptor.
const char * dbus_message_get_path(DBusMessage *message)
Gets the object path this message is being sent to (for DBUS_MESSAGE_TYPE_METHOD_CALL) or being emitt...
DBusDirIter * _dbus_directory_open(const DBusString *filename, DBusError *error)
Open a directory to iterate over.
dbus_bool_t _dbus_string_init(DBusString *str)
Initializes a 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...
DBusValidity
This is primarily used in unit testing, so we can verify that each invalid message is invalid for the...
DBusMessageIter struct; contains no public fields.
#define DBUS_TYPE_DOUBLE
Type code marking an 8-byte double in IEEE 754 format.
dbus_bool_t dbus_message_iter_init(DBusMessage *message, DBusMessageIter *iter)
Initializes a DBusMessageIter for reading the arguments of the message passed in. ...
dbus_bool_t _dbus_string_ends_with_c_str(const DBusString *a, const char *c_str)
Returns whether a string ends with the given suffix.
#define DBUS_TYPE_ARRAY
Type code marking a D-Bus array type.
#define DBUS_TYPE_INT64
Type code marking a 64-bit signed integer.
Internals of directory iterator.
const char * dbus_message_get_member(DBusMessage *message)
Gets the interface member being invoked (DBUS_MESSAGE_TYPE_METHOD_CALL) or emitted (DBUS_MESSAGE_TYPE...
Internals of DBusMessage.
dbus_bool_t _dbus_concat_dir_and_file(DBusString *dir, const DBusString *next_component)
Appends the given filename to the given directory.
#define DBUS_MINIMUM_HEADER_SIZE
The smallest header size that can occur.
dbus_uint32_t dbus_bool_t
A boolean, valid values are TRUE and FALSE.
void _dbus_string_init_const(DBusString *str, const char *value)
Initializes a constant string.
DBusHeader header
Header network data and associated cache.
dbus_bool_t dbus_message_set_sender(DBusMessage *message, const char *sender)
Sets the message sender.
DBusString data
Buffered data.
_DBUS_GNUC_EXTENSION typedef unsigned long long dbus_uint64_t
A 64-bit unsigned integer on all platforms that support it.
DBusMessageLoader * _dbus_message_loader_ref(DBusMessageLoader *loader)
Increments the reference count of the loader.
dbus_bool_t dbus_message_get_path_decomposed(DBusMessage *message, char ***path)
Gets the object path this message is being sent to (for DBUS_MESSAGE_TYPE_METHOD_CALL) or being emitt...
void _dbus_warn(const char *format,...)
Prints a warning message to stderr.
dbus_bool_t dbus_message_set_interface(DBusMessage *message, const char *interface)
Sets the interface this message is being sent to (for DBUS_MESSAGE_TYPE_METHOD_CALL) or the interface...
dbus_bool_t dbus_message_set_path(DBusMessage *message, const char *object_path)
Sets the object path this message is being sent to (for DBUS_MESSAGE_TYPE_METHOD_CALL) or the one a s...
#define DBUS_TYPE_INT32
Type code marking a 32-bit signed integer.
int _dbus_string_get_length(const DBusString *str)
Gets the length of a string (not including nul termination).
DBusMessageLoader * _dbus_message_loader_new(void)
Creates a new message loader.
Object representing an exception.
_DBUS_GNUC_EXTENSION typedef long long dbus_int64_t
A 64-bit signed integer on all platforms that support it.
dbus_bool_t dbus_message_append_args(DBusMessage *message, int first_arg_type,...)
Appends fields to a message given a variable argument list.
#define DBUS_TYPE_UINT64
Type code marking a 64-bit unsigned integer.
dbus_uint32_t dbus_message_get_reply_serial(DBusMessage *message)
Returns the serial that the message is a reply to or 0 if none.
dbus_bool_t dbus_message_has_signature(DBusMessage *message, const char *signature)
Checks whether the message has the given signature; see dbus_message_get_signature() for more details...
dbus_bool_t _dbus_message_loader_get_is_corrupted(DBusMessageLoader *loader)
Checks whether the loader is confused due to bad data.
#define _DBUS_N_ELEMENTS(array)
Computes the number of elements in a fixed-size array using sizeof().
#define DBUS_TYPE_UINT32
Type code marking a 32-bit unsigned integer.
dbus_bool_t dbus_message_has_destination(DBusMessage *message, const char *name)
Checks whether the message was sent to the given name.
short dbus_int16_t
A 16-bit signed integer on all platforms.
dbus_bool_t _dbus_string_append_byte(DBusString *str, unsigned char byte)
Appends a single byte to the string, returning FALSE if not enough memory.
void _dbus_string_free(DBusString *str)
Frees a string created by _dbus_string_init().
#define TRUE
Expands to "1".
dbus_bool_t dbus_message_marshal(DBusMessage *msg, char **marshalled_data_p, int *len_p)
Turn a DBusMessage into the marshalled form as described in the D-Bus specification.
#define _dbus_assert_not_reached(explanation)
Aborts with an error message if called.
DBusMessage * dbus_message_copy(const DBusMessage *message)
Creates a new message that is an exact replica of the message specified, except that its refcount is ...
int dbus_message_iter_get_element_type(DBusMessageIter *iter)
Returns the element type of the array that the message iterator points to.
dbus_bool_t dbus_message_is_method_call(DBusMessage *message, const char *interface, const char *method)
Checks whether the message is a method call with the given interface and member fields.
const char * name
public error name field
DBusMessage * dbus_message_demarshal(const char *str, int len, DBusError *error)
Demarshal a D-Bus message from the format described in the D-Bus specification.
#define DBUS_TYPE_UNIX_FD
Type code marking a unix file descriptor.
void _dbus_message_loader_return_buffer(DBusMessageLoader *loader, DBusString *buffer, int bytes_read)
Returns a buffer obtained from _dbus_message_loader_get_buffer(), indicating to the loader how many b...
const char * dbus_message_get_interface(DBusMessage *message)
Gets the interface this message is being sent to (for DBUS_MESSAGE_TYPE_METHOD_CALL) or being emitted...
#define DBUS_TYPE_INVALID
Type code that is never equal to a legitimate type code.
dbus_bool_t dbus_message_set_reply_serial(DBusMessage *message, dbus_uint32_t reply_serial)
Sets the reply serial of a message (the serial of the message this is a reply to).
dbus_bool_t dbus_message_has_sender(DBusMessage *message, const char *name)
Checks whether the message has the given unique name as its sender.
dbus_bool_t dbus_message_iter_next(DBusMessageIter *iter)
Moves the iterator to the next field, if any.
#define DBUS_INT64_CONSTANT(val)
Declare a 64-bit signed integer constant.
dbus_bool_t dbus_message_get_no_reply(DBusMessage *message)
Returns TRUE if the message does not expect a reply.
#define DBUS_TYPE_INT16
Type code marking a 16-bit signed integer.
dbus_bool_t _dbus_message_loader_get_unix_fds(DBusMessageLoader *loader, int **fds, unsigned *max_n_fds)
Gets the buffer to use for reading unix fds from the network.
void dbus_free_string_array(char **str_array)
Frees a NULL-terminated array of strings.
#define DBUS_TYPE_BOOLEAN
Type code marking a boolean.
void _dbus_message_loader_get_buffer(DBusMessageLoader *loader, DBusString **buffer)
Gets the buffer to use for reading data from the network.
#define DBUS_STRUCT_END_CHAR_AS_STRING
DBUS_STRUCT_END_CHAR a string literal instead of a int literal
#define DBUS_HAVE_INT64
Defined if 64-bit integers are available.
dbus_bool_t dbus_message_iter_open_container(DBusMessageIter *iter, int type, const char *contained_signature, DBusMessageIter *sub)
Appends a container-typed value to the message; you are required to append the contents of the contai...
dbus_bool_t _dbus_file_get_contents(DBusString *str, const DBusString *filename, DBusError *error)
Appends the contents of the given file to the string, returning error code.
#define DBUS_TYPE_STRING_AS_STRING
DBUS_TYPE_STRING as a string literal instead of a int literal
dbus_bool_t dbus_message_iter_append_basic(DBusMessageIter *iter, int type, const void *value)
Appends a basic-typed value to the message.
void dbus_shutdown(void)
Frees all memory allocated internally by libdbus and reverses the effects of dbus_threads_init().
#define FALSE
Expands to "0".
int dbus_message_demarshal_bytes_needed(const char *buf, int len)
Returns the number of bytes required to be in the buffer to demarshal a D-Bus message.
void dbus_message_iter_abandon_container(DBusMessageIter *iter, DBusMessageIter *sub)
Abandons creation of a contained-typed value and frees resources created by dbus_message_iter_open_co...
void _dbus_verbose_bytes_of_string(const DBusString *str, int start, int len)
Dump the given part of the string to verbose log.
dbus_bool_t _dbus_message_loader_queue_messages(DBusMessageLoader *loader)
Converts buffered data into messages, if we have enough data.
int dbus_int32_t
A 32-bit signed integer on all platforms.
#define DBUS_UINT64_CONSTANT(val)
Declare a 64-bit unsigned integer constant.
DBusValidity corruption_reason
why we were corrupted
dbus_bool_t dbus_message_set_member(DBusMessage *message, const char *member)
Sets the interface member being invoked (DBUS_MESSAGE_TYPE_METHOD_CALL) or emitted (DBUS_MESSAGE_TYPE...
const char * _dbus_string_get_const_data(const DBusString *str)
Gets the raw character buffer from a const string.
void dbus_message_unref(DBusMessage *message)
Decrements the reference count of a DBusMessage, freeing the message if the count reaches 0...
Implementation details of DBusMessageLoader.
DBusMessage * dbus_message_new_method_call(const char *destination, const char *path, const char *interface, const char *method)
Constructs a new message to invoke a method on a remote object.
dbus_bool_t dbus_error_is_set(const DBusError *error)
Checks whether an error occurred (the error is set).
#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...
void dbus_message_set_serial(DBusMessage *message, dbus_uint32_t serial)
Sets the serial number of a message.
unsigned short dbus_uint16_t
A 16-bit unsigned integer on all platforms.