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> 57 #ifdef HAVE_UNIX_FD_PASSING 58 return message->n_unix_fds;
64 #ifdef DBUS_ENABLE_EMBEDDED_TESTS 86 _dbus_return_val_if_fail (iter !=
NULL,
FALSE);
87 _dbus_return_val_if_error_is_set (error,
FALSE);
89 va_start (var_args, first_arg_type);
99 #ifdef DBUS_ENABLE_EMBEDDED_TESTS 100 #include "dbus-test.h" 101 #include "dbus-message-factory.h" 105 static int validities_seen[DBUS_VALIDITY_LAST + _DBUS_NEGATIVE_VALIDITY_COUNT];
108 reset_validities_seen (
void)
114 validities_seen[i] = 0;
122 validities_seen[validity + _DBUS_NEGATIVE_VALIDITY_COUNT] += 1;
132 if ((i - _DBUS_NEGATIVE_VALIDITY_COUNT) == DBUS_VALIDITY_UNKNOWN ||
133 (i - _DBUS_NEGATIVE_VALIDITY_COUNT) == DBUS_INVALID_FOR_UNKNOWN_REASON)
135 else if ((not_seen && validities_seen[i] == 0) ||
136 (!not_seen && validities_seen[i] > 0))
137 printf (
"validity %3d seen %d times\n",
138 i - _DBUS_NEGATIVE_VALIDITY_COUNT,
145 check_memleaks (
void)
149 if (_dbus_get_malloc_blocks_outstanding () != 0)
151 _dbus_warn (
"%d dbus_malloc blocks were not freed in %s",
152 _dbus_get_malloc_blocks_outstanding (), __FILE__);
158 struct DBusInitialFDs {
164 _dbus_check_fdleaks_enter (
void)
171 fds = malloc (
sizeof (DBusInitialFDs));
176 if ((d = opendir (
"/proc/self/fd")))
180 while ((de = readdir(d)))
186 if (de->d_name[0] ==
'.')
190 l = strtol (de->d_name, &e, 10);
201 if (fd >= FD_SETSIZE)
203 _dbus_verbose (
"FD %d unexpectedly large; cannot track whether " 204 "it is leaked\n", fd);
208 FD_SET (fd, &fds->set);
221 _dbus_check_fdleaks_leave (DBusInitialFDs *fds)
228 if ((d = opendir (
"/proc/self/fd")))
232 while ((de = readdir(d)))
238 if (de->d_name[0] ==
'.')
242 l = strtol (de->d_name, &e, 10);
253 if (fd >= FD_SETSIZE)
255 _dbus_verbose (
"FD %d unexpectedly large; cannot track whether " 256 "it is leaked\n", fd);
260 if (FD_ISSET (fd, &fds->set))
263 _dbus_warn (
"file descriptor %i leaked in %s.", fd, __FILE__);
287 _dbus_warn (
"loader corrupted on message that was expected to be valid; invalid reason %d",
295 _dbus_warn (
"didn't load message that was expected to be valid (message not popped)");
299 if (_dbus_string_get_length (&loader->
data) > 0)
301 _dbus_warn (
"had leftover bytes from expected-to-be-valid single message");
311 if (!check_message_handling (message))
336 _dbus_warn (
"loader not corrupted on message that was expected to be invalid");
342 if (expected_validity != DBUS_INVALID_FOR_UNKNOWN_REASON &&
345 _dbus_warn (
"expected message to be corrupted for reason %d and was corrupted for %d instead",
367 _dbus_warn (
"loader corrupted on message that was expected to be valid (but incomplete), corruption reason %d",
375 _dbus_warn (
"loaded message that was expected to be incomplete");
379 record_validity_seen (DBUS_VALID_BUT_INCOMPLETE);
396 return check_have_valid_message (loader);
397 else if (expected_validity == DBUS_VALID_BUT_INCOMPLETE)
398 return check_incomplete_message (loader);
399 else if (expected_validity == DBUS_VALIDITY_UNKNOWN)
411 return check_invalid_message (loader, expected_validity);
422 dbus_internal_do_not_use_load_message_file (
const DBusString *filename,
430 _dbus_verbose (
"Loading raw %s\n", _dbus_string_get_const_data (filename));
433 _dbus_warn (
"Could not load message file %s: %s",
434 _dbus_string_get_const_data (filename),
456 dbus_internal_do_not_use_try_message_file (
const DBusString *filename,
467 if (!dbus_internal_do_not_use_load_message_file (filename, &data))
470 retval = dbus_internal_do_not_use_try_message_data (&data, expected_validity);
476 if (_dbus_string_get_length (&data) > 0)
478 _dbus_string_get_length (&data));
480 _dbus_warn (
"Failed message loader test on %s",
481 _dbus_string_get_const_data (filename));
498 dbus_internal_do_not_use_try_message_data (
const DBusString *data,
519 len = _dbus_string_get_length (data);
520 for (i = 0; i < len; i++)
526 _dbus_string_get_byte (data, i)))
531 if (!check_loader_results (loader, expected_validity))
548 _dbus_string_get_length (buffer)))
553 if (!check_loader_results (loader, expected_validity))
565 len = _dbus_string_get_length (data);
566 for (i = 0; i < len; i += 2)
572 _dbus_string_get_byte (data, i)))
578 _dbus_string_get_byte (data, i+1)))
585 if (!check_loader_results (loader, expected_validity))
602 process_test_subdir (
const DBusString *test_base_dir,
605 DBusForeachMessageFileFunc
function,
637 _dbus_string_get_const_data (&test_directory),
643 printf (
"Testing %s:\n", subdir);
665 printf (
"SKIP: Could not load %s, message builder language no longer supported\n",
666 _dbus_string_get_const_data (&filename));
669 _dbus_verbose (
"Skipping non-.message file %s\n",
670 _dbus_string_get_const_data (&filename));
676 _dbus_string_get_const_data (&filename));
678 if (! (*
function) (&full_path,
679 expected_validity, user_data))
690 _dbus_warn (
"Could not get next file in %s: %s",
691 _dbus_string_get_const_data (&test_directory),
719 dbus_internal_do_not_use_foreach_message_file (
const char *test_data_dir,
720 DBusForeachMessageFileFunc func,
730 if (!process_test_subdir (&test_directory,
"valid-messages",
736 if (!process_test_subdir (&test_directory,
"invalid-messages",
737 DBUS_INVALID_FOR_UNKNOWN_REASON, func, user_data))
742 if (!process_test_subdir (&test_directory,
"incomplete-messages",
743 DBUS_VALID_BUT_INCOMPLETE, func, user_data))
758 #define GET_AND_CHECK(iter, typename, literal) \ 760 if (dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_##typename) \ 761 _dbus_assert_not_reached ("got wrong argument type from message iter"); \ 762 dbus_message_iter_get_basic (&iter, &v_##typename); \ 763 if (v_##typename != literal) \ 764 _dbus_assert_not_reached ("got wrong value from message iter"); \ 767 #define GET_AND_CHECK_STRCMP(iter, typename, literal) \ 769 if (dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_##typename) \ 770 _dbus_assert_not_reached ("got wrong argument type from message iter"); \ 771 dbus_message_iter_get_basic (&iter, &v_##typename); \ 772 if (strcmp (v_##typename, literal) != 0) \ 773 _dbus_assert_not_reached ("got wrong value from message iter"); \ 776 #define GET_AND_CHECK_AND_NEXT(iter, typename, literal) \ 778 GET_AND_CHECK(iter, typename, literal); \ 779 if (!dbus_message_iter_next (&iter)) \ 780 _dbus_assert_not_reached ("failed to move iter to next"); \ 783 #define GET_AND_CHECK_STRCMP_AND_NEXT(iter, typename, literal) \ 785 GET_AND_CHECK_STRCMP(iter, typename, literal); \ 786 if (!dbus_message_iter_next (&iter)) \ 787 _dbus_assert_not_reached ("failed to move iter to next"); \ 794 const char *v_STRING;
802 unsigned char v_BYTE;
810 GET_AND_CHECK_STRCMP_AND_NEXT (iter, STRING,
"Test string");
811 GET_AND_CHECK_AND_NEXT (iter, INT32, -0x12345678);
812 GET_AND_CHECK_AND_NEXT (iter, UINT32, 0xedd1e);
813 GET_AND_CHECK_AND_NEXT (iter, DOUBLE, 3.14159);
823 GET_AND_CHECK_AND_NEXT (array, DOUBLE, 1.5);
824 GET_AND_CHECK (array, DOUBLE, 2.5);
832 GET_AND_CHECK_AND_NEXT (iter, BYTE, 0xF0);
849 GET_AND_CHECK (iter, BYTE, 0xF0);
869 unsigned char our_byte_1, our_byte_2;
871 int our_uint32_array_len;
873 int our_int32_array_len;
877 int our_uint64_array_len;
878 const dbus_int64_t *our_int64_array = (
void*)0xdeadbeef;
879 int our_int64_array_len;
880 const double *our_double_array = (
void*)0xdeadbeef;
881 int our_double_array_len;
882 const unsigned char *our_byte_array = (
void*)0xdeadbeef;
883 int our_byte_array_len;
884 const dbus_bool_t *our_boolean_array = (
void*)0xdeadbeef;
885 int our_boolean_array_len;
886 char **our_string_array;
887 int our_string_array_len;
891 if (!dbus_message_iter_get_args (&iter, &error,
904 &our_uint32_array, &our_uint32_array_len,
906 &our_int32_array, &our_int32_array_len,
908 &our_uint64_array, &our_uint64_array_len,
910 &our_int64_array, &our_int64_array_len,
912 &our_double_array, &our_double_array_len,
914 &our_byte_array, &our_byte_array_len,
916 &our_boolean_array, &our_boolean_array_len,
918 &our_string_array, &our_string_array_len,
926 if (our_int16 != -0x123)
929 if (our_uint16 != 0x123)
932 if (our_int != -0x12345678)
935 if (our_uint != 0x12300042)
947 if (strcmp (our_str,
"Test string") != 0)
953 if (our_byte_1 != 42)
956 if (our_byte_2 != 24)
959 if (our_uint32_array_len != 4 ||
960 our_uint32_array[0] != 0x12345678 ||
961 our_uint32_array[1] != 0x23456781 ||
962 our_uint32_array[2] != 0x34567812 ||
963 our_uint32_array[3] != 0x45678123)
966 if (our_int32_array_len != 4 ||
967 our_int32_array[0] != 0x12345678 ||
968 our_int32_array[1] != -0x23456781 ||
969 our_int32_array[2] != 0x34567812 ||
970 our_int32_array[3] != -0x45678123)
973 if (our_uint64_array_len != 4 ||
974 our_uint64_array[0] != 0x12345678 ||
975 our_uint64_array[1] != 0x23456781 ||
976 our_uint64_array[2] != 0x34567812 ||
977 our_uint64_array[3] != 0x45678123)
980 if (our_int64_array_len != 4 ||
981 our_int64_array[0] != 0x12345678 ||
982 our_int64_array[1] != -0x23456781 ||
983 our_int64_array[2] != 0x34567812 ||
984 our_int64_array[3] != -0x45678123)
987 if (our_double_array_len != 3)
996 v_DOUBLE = 9876.54321;
1003 if (our_byte_array_len != 4)
1006 if (our_byte_array[0] !=
'a' ||
1007 our_byte_array[1] !=
'b' ||
1008 our_byte_array[2] !=
'c' ||
1009 our_byte_array[3] != 234)
1012 if (our_boolean_array_len != 5)
1015 if (our_boolean_array[0] !=
TRUE ||
1016 our_boolean_array[1] !=
FALSE ||
1017 our_boolean_array[2] !=
TRUE ||
1018 our_boolean_array[3] !=
TRUE ||
1019 our_boolean_array[4] !=
FALSE)
1022 if (our_string_array_len != 4)
1025 if (strcmp (our_string_array[0],
"Foo") != 0 ||
1026 strcmp (our_string_array[1],
"bar") != 0 ||
1027 strcmp (our_string_array[2],
"") != 0 ||
1028 strcmp (our_string_array[3],
"woo woo woo woo") != 0)
1038 verify_test_message_args_ignored (
DBusMessage *message)
1043 DBusInitialFDs *initial_fds;
1045 initial_fds = _dbus_check_fdleaks_enter ();
1049 if (!dbus_message_iter_get_args (&iter, &error,
1058 _dbus_verbose (
"arguments ignored.\n");
1063 if (!dbus_message_iter_get_args (&iter, &error,
1073 _dbus_verbose (
"arguments ignored.\n");
1076 _dbus_check_fdleaks_leave (initial_fds);
1080 verify_test_message_memleak (
DBusMessage *message)
1087 char **our_string_array1;
1088 int our_string_array_len1;
1089 char **our_string_array2;
1090 int our_string_array_len2;
1091 #ifdef HAVE_UNIX_FD_PASSING 1095 DBusInitialFDs *initial_fds;
1097 initial_fds = _dbus_check_fdleaks_enter ();
1102 if (!dbus_message_iter_get_args (&iter, &error,
1105 &our_string_array1, &our_string_array_len1,
1106 #ifdef HAVE_UNIX_FD_PASSING
1113 _dbus_verbose (
"expected error: %s - %s\n", error.
name,
1117 #ifdef HAVE_UNIX_FD_PASSING 1123 _dbus_warn (
"error: parse with wrong signature: 'uashuu'.");
1129 if (!dbus_message_iter_get_args (&iter, &error,
1132 &our_string_array1, &our_string_array_len1,
1133 #ifdef HAVE_UNIX_FD_PASSING
1138 &our_string_array2, &our_string_array_len2,
1139 #ifdef HAVE_UNIX_FD_PASSING
1145 _dbus_verbose (
"expected error: %s - %s\n", error.
name,
1150 #ifdef HAVE_UNIX_FD_PASSING 1157 _dbus_warn (
"error: parse with wrong signature: 'uashuashu'.");
1163 if (!dbus_message_iter_get_args (&iter, &error,
1166 &our_string_array1, &our_string_array_len1,
1167 #ifdef HAVE_UNIX_FD_PASSING
1172 &our_string_array2, &our_string_array_len2,
1173 #ifdef HAVE_UNIX_FD_PASSING
1186 #ifdef HAVE_UNIX_FD_PASSING 1191 _dbus_check_fdleaks_leave (initial_fds);
1201 _dbus_message_test (
const char *test_data_dir)
1211 { 0x12345678, 0x23456781, 0x34567812, 0x45678123 };
1213 { 0x12345678, -0x23456781, 0x34567812, -0x45678123 };
1217 { 0x12345678, 0x23456781, 0x34567812, 0x45678123 };
1219 { 0x12345678, -0x23456781, 0x34567812, -0x45678123 };
1222 const char *our_string_array[] = {
"Foo",
"bar",
"",
"woo woo woo woo" };
1223 const char *our_string_array1[] = {
"foo",
"Bar",
"",
"Woo woo Woo woo" };
1224 const char **v_ARRAY_STRING = our_string_array;
1225 const char **v1_ARRAY_STRING = our_string_array1;
1226 const double our_double_array[] = { 0.1234, 9876.54321, -300.0 };
1227 const double *v_ARRAY_DOUBLE = our_double_array;
1228 const unsigned char our_byte_array[] = {
'a',
'b',
'c', 234 };
1229 const unsigned char *v_ARRAY_BYTE = our_byte_array;
1231 const dbus_bool_t *v_ARRAY_BOOLEAN = our_boolean_array;
1234 const char *v_STRING;
1243 unsigned char v_BYTE;
1244 unsigned char v2_BYTE;
1247 #ifdef HAVE_UNIX_FD_PASSING 1252 DBusInitialFDs *initial_fds;
1265 initial_fds = _dbus_check_fdleaks_enter ();
1268 "/org/freedesktop/TestPath",
1269 "Foo.TestInterface",
1275 "/org/freedesktop/TestPath") == 0);
1286 _dbus_string_get_length (&message->
header.
data));
1288 _dbus_string_get_length (&message->
body));
1295 _dbus_string_get_length (&message->
header.
data));
1297 _dbus_string_get_length (&message->
body));
1337 "org.Foo.Bar") == 0);
1393 "/org/freedesktop/TestPath",
1394 "Foo.TestInterface",
1401 v_INT32 = -0x12345678;
1402 v_UINT32 = 0x12300042;
1405 v_STRING =
"Test string";
1410 #ifdef HAVE_UNIX_FD_PASSING 1477 #ifdef HAVE_UNIX_FD_PASSING 1487 _dbus_verbose (
"HEADER\n");
1489 _dbus_string_get_length (&message->
header.
data));
1490 _dbus_verbose (
"BODY\n");
1492 _dbus_string_get_length (&message->
body));
1494 _dbus_verbose (
"Signature expected \"%s\" actual \"%s\"\n",
1502 verify_test_message (message);
1511 _dbus_string_get_length (©->
header.
data));
1514 _dbus_string_get_length (©->
body));
1516 verify_test_message (copy);
1539 data = _dbus_string_get_const_data (&message->
header.
data);
1540 for (i = 0; i < _dbus_string_get_length (&message->
header.
data); i++)
1550 data = _dbus_string_get_const_data (&message->
body);
1551 for (i = 0; i < _dbus_string_get_length (&message->
body); i++)
1560 #ifdef HAVE_UNIX_FD_PASSING 1563 unsigned n_unix_fds;
1565 _dbus_message_loader_get_unix_fds(loader, &unix_fds, &n_unix_fds);
1570 _dbus_message_loader_return_unix_fds(loader, unix_fds, 1);
1597 verify_test_message (message_without_unix_fds);
1604 char *marshalled =
NULL;
1619 verify_test_message (message2);
1651 _dbus_check_fdleaks_leave (initial_fds);
1652 initial_fds = _dbus_check_fdleaks_enter ();
1655 for (i = strlen (basic_types) - 1; i > 0; i--)
1661 signature[0] = basic_types[i];
1662 s =
"SomeThingToSay";
1663 memset (&val,
'\0',
sizeof (val));
1666 "/de/ende/test",
"de.ende.Test",
"ArtistName");
1670 signature, &array_iter);
1671 for (some = 0; some < 3; some++)
1686 "/de/ende/test",
"de.ende.Test",
"ArtistName");
1694 NULL, &struct_iter);
1706 "/org/freedesktop/TestPath",
1707 "Foo.TestInterface",
1720 NULL, &struct_iter);
1735 "/org/freedesktop/TestPath",
1736 "Foo.TestInterface",
1744 #ifdef HAVE_UNIX_FD_PASSING
1750 #ifdef HAVE_UNIX_FD_PASSING
1760 #ifdef HAVE_UNIX_FD_PASSING 1766 #ifdef HAVE_UNIX_FD_PASSING 1773 verify_test_message_args_ignored (message);
1774 verify_test_message_memleak (message);
1780 DBusMessageDataIter diter;
1781 DBusMessageData mdata;
1784 reset_validities_seen ();
1787 _dbus_message_data_iter_init (&diter);
1789 while (_dbus_message_data_iter_get_and_next (&diter,
1792 if (!dbus_internal_do_not_use_try_message_data (&mdata.data,
1793 mdata.expected_validity))
1795 _dbus_warn (
"expected validity %d and did not get it",
1796 mdata.expected_validity);
1800 _dbus_message_data_free (&mdata);
1805 printf (
"%d sample messages tested\n", count);
1807 print_validities_seen (
FALSE);
1808 print_validities_seen (
TRUE);
1812 _dbus_check_fdleaks_leave (initial_fds);
1815 if (test_data_dir ==
NULL)
1818 initial_fds = _dbus_check_fdleaks_enter ();
1820 if (!dbus_internal_do_not_use_foreach_message_file (test_data_dir,
1821 (DBusForeachMessageFileFunc)
1822 dbus_internal_do_not_use_try_message_file,
1826 _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++.
dbus_bool_t dbus_message_is_method_call(DBusMessage *message, const char *iface, const char *method)
Checks whether the message is a method call with the given interface and member fields.
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.
DBUS_PRIVATE_EXPORT void _dbus_message_loader_return_buffer(DBusMessageLoader *loader, DBusString *buffer)
Returns a buffer obtained from _dbus_message_loader_get_buffer(), indicating to the loader how many b...
void dbus_free(void *memory)
Frees a block of memory previously allocated by dbus_malloc() or dbus_malloc0().
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...
DBUS_PRIVATE_EXPORT DBusMessage * _dbus_message_loader_pop_message(DBusMessageLoader *loader)
Pops a loaded message (passing ownership of the message to the caller).
dbus_bool_t dbus_message_set_interface(DBusMessage *message, const char *iface)
Sets the interface this message is being sent to (for DBUS_MESSAGE_TYPE_METHOD_CALL) or the interface...
dbus_bool_t dbus_message_iter_close_container(DBusMessageIter *iter, DBusMessageIter *sub)
Closes a container-typed value appended to the message; may write out more information to the message...
#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_PRIVATE_EXPORT 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.
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.
DBUS_PRIVATE_EXPORT void _dbus_message_loader_unref(DBusMessageLoader *loader)
Decrements the reference count of the loader and finalizes the loader when the count reaches zero...
dbus_bool_t _dbus_concat_dir_and_file(DBusString *dir, const DBusString *next_component)
Appends the given filename to the given directory.
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.
int _dbus_dup(int fd, DBusError *error)
Duplicates a file descriptor.
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.
#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 dbus_uint64_t
A 64-bit unsigned integer.
DBUS_PRIVATE_EXPORT 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_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.
DBUS_PRIVATE_EXPORT DBusMessageLoader * _dbus_message_loader_new(void)
Creates a new message loader.
Object representing an exception.
_DBUS_GNUC_EXTENSION typedef long dbus_int64_t
A 64-bit signed integer.
int dbus_message_iter_get_element_count(DBusMessageIter *iter)
Returns the number of elements in the array-typed value pointed to by the iterator.
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_PRIVATE_EXPORT 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.
DBusMessage * dbus_message_new_method_call(const char *destination, const char *path, const char *iface, const char *method)
Constructs a new message to invoke a method on a remote object.
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.
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.
unsigned int _dbus_message_get_n_unix_fds(DBusMessage *message)
Gets the number of unix fds attached to this message.
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.
void dbus_free_string_array(char **str_array)
Frees a NULL-terminated array of strings.
#define DBUS_TYPE_BOOLEAN
Type code marking a boolean.
#define DBUS_STRUCT_END_CHAR_AS_STRING
DBUS_STRUCT_END_CHAR a string literal instead of a int literal
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.
A simple value union that lets you access bytes as if they were various types; useful when dealing wi...
#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.
dbus_bool_t _dbus_close(int fd, DBusError *error)
Closes a file descriptor.
void dbus_shutdown(void)
Frees all memory allocated internally by libdbus and reverses the effects of dbus_threads_init().
#define FALSE
Expands to "0".
DBUS_PRIVATE_EXPORT void _dbus_message_loader_get_buffer(DBusMessageLoader *loader, DBusString **buffer, int *max_to_read, dbus_bool_t *may_read_unix_fds)
Gets the buffer to use for reading data from the network.
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...
DBUS_PRIVATE_EXPORT void _dbus_verbose_bytes_of_string(const DBusString *str, int start, int len)
Dump the given part of the string to verbose log.
DBUS_PRIVATE_EXPORT 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.
char * _dbus_strdup(const char *str)
Duplicates a string.
#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...
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.
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.