26 #include "dbus-signature.h"
27 #include "dbus-marshal-recursive.h"
28 #include "dbus-marshal-basic.h"
29 #include "dbus-internals.h"
30 #include "dbus-test.h"
38 unsigned int finished : 1;
39 unsigned int in_array : 1;
43 #define TYPE_IS_CONTAINER(typecode) \
44 ((typecode) == DBUS_TYPE_STRUCT || \
45 (typecode) == DBUS_TYPE_DICT_ENTRY || \
46 (typecode) == DBUS_TYPE_VARIANT || \
47 (typecode) == DBUS_TYPE_ARRAY)
68 const char *signature)
72 real_iter->
pos = signature;
182 real_iter->
pos += pos;
215 *real_sub_iter = *real_iter;
217 real_sub_iter->
pos++;
299 return TYPE_IS_CONTAINER (typecode);
413 #ifdef DBUS_ENABLE_EMBEDDED_TESTS
422 _dbus_signature_test (
void)
481 DBUS_TYPE_BYTE_AS_STRING
486 DBUS_TYPE_BYTE_AS_STRING
487 DBUS_STRUCT_END_CHAR_AS_STRING
554 sig = DBUS_TYPE_ARRAY_AS_STRING
569 DBUS_TYPE_INT32_AS_STRING
573 sig = DBUS_STRUCT_END_CHAR_AS_STRING
577 sig = DBUS_STRUCT_BEGIN_CHAR_AS_STRING
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...
#define DBUS_TYPE_UINT16
Type code marking a 16-bit unsigned integer.
#define NULL
A null pointer, defined appropriately for C or C++.
#define DBUS_STRUCT_BEGIN_CHAR_AS_STRING
DBUS_STRUCT_BEGIN_CHAR as a string literal instead of a int literal
#define DBUS_TYPE_STRUCT
STRUCT and DICT_ENTRY are sort of special since their codes can't appear in a type string...
#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_TYPE_STRING
Type code marking a UTF-8 encoded, nul-terminated Unicode string.
#define _dbus_assert(condition)
Aborts with an error message if the condition is false.
void _dbus_type_signature_next(const char *type_str, int *type_pos)
Skips to the next "complete" type inside a type signature.
#define DBUS_TYPE_ARRAY_AS_STRING
DBUS_TYPE_ARRAY as a string literal instead of a int literal
#define DBUS_TYPE_BYTE
Type code marking an 8-bit unsigned integer.
DBusSignatureIter struct; contains no public fields.
dbus_bool_t dbus_signature_iter_next(DBusSignatureIter *iter)
Skip to the next value on this "level".
dbus_bool_t _dbus_string_init(DBusString *str)
Initializes a string.
#define DBUS_DICT_ENTRY_END_CHAR_AS_STRING
DBUS_DICT_ENTRY_END_CHAR as a string literal instead of a int literal
DBusValidity
This is primarily used in unit testing, so we can verify that each invalid message is invalid for the...
#define DBUS_STRUCT_END_CHAR
Code marking the end of a struct type in a type signature.
#define DBUS_TYPE_DOUBLE
Type code marking an 8-byte double in IEEE 754 format.
#define DBUS_TYPE_ARRAY
Type code marking a D-Bus array type.
#define DBUS_TYPE_INT64
Type code marking a 64-bit signed integer.
Implementation details of DBusSignatureIter, all fields are private.
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_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_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.
void dbus_signature_iter_init(DBusSignatureIter *iter, const char *signature)
Initializes a DBusSignatureIter for reading a type signature.
#define DBUS_TYPE_INT32_AS_STRING
DBUS_TYPE_INT32 as a string literal instead of a int literal
#define DBUS_TYPE_VARIANT_AS_STRING
DBUS_TYPE_VARIANT as a string literal instead of a int literal
void dbus_signature_iter_recurse(const DBusSignatureIter *iter, DBusSignatureIter *subiter)
Initialize a new iterator pointing to the first type in the current container.
#define DBUS_TYPE_UINT16_AS_STRING
DBUS_TYPE_UINT16 as a string literal instead of a int literal
#define DBUS_TYPE_INT32
Type code marking a 32-bit signed integer.
unsigned int finished
true if we are at the end iter
#define DBUS_TYPE_DOUBLE_AS_STRING
DBUS_TYPE_DOUBLE as a string literal instead of a int literal
Object representing an exception.
#define DBUS_TYPE_BYTE_AS_STRING
DBUS_TYPE_BYTE as a string literal instead of a int literal
#define DBUS_TYPE_SIGNATURE
Type code marking a D-Bus type signature.
#define DBUS_TYPE_UINT64
Type code marking a 64-bit unsigned integer.
void dbus_set_error(DBusError *error, const char *name, const char *format,...)
Assigns an error name and message to a DBusError.
#define DBUS_TYPE_VARIANT
Type code marking a D-Bus variant type.
#define DBUS_TYPE_UINT32
Type code marking a 32-bit unsigned integer.
void _dbus_string_free(DBusString *str)
Frees a string created by _dbus_string_init().
#define TRUE
Expands to "1".
#define _dbus_assert_not_reached(explanation)
Aborts with an error message if called.
#define DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
DBUS_DICT_ENTRY_BEGIN_CHAR as a string literal instead of a int literal
#define DBUS_TYPE_OBJECT_PATH
Type code marking a D-Bus object path.
#define DBUS_TYPE_UNIX_FD
Type code marking a unix file descriptor.
#define DBUS_TYPE_INT16_AS_STRING
DBUS_TYPE_INT16 as a string literal instead of a int literal
int dbus_signature_iter_get_element_type(const DBusSignatureIter *iter)
Convenience function for returning the element type of an array; This function allows you to avoid in...
#define DBUS_TYPE_INVALID
Type code that is never equal to a legitimate type code.
#define DBUS_ERROR_INVALID_SIGNATURE
A type signature is not valid.
#define DBUS_TYPE_INT16
Type code marking a 16-bit signed integer.
#define DBUS_TYPE_BOOLEAN
Type code marking a boolean.
dbus_bool_t _dbus_string_append_len(DBusString *str, const char *buffer, int len)
Appends block of bytes with the given length to a DBusString.
#define DBUS_STRUCT_END_CHAR_AS_STRING
DBUS_STRUCT_END_CHAR a string literal instead of a int literal
dbus_bool_t dbus_signature_validate(const char *signature, DBusError *error)
Check a type signature for validity.
#define DBUS_TYPE_STRING_AS_STRING
DBUS_TYPE_STRING as a string literal instead of a int literal
#define FALSE
Expands to "0".
dbus_bool_t dbus_signature_validate_single(const char *signature, DBusError *error)
Check that a type signature is both valid and contains exactly one complete type. ...
#define DBUS_DICT_ENTRY_END_CHAR
Code marking the end of a dict entry type in a type signature.
#define DBUS_TYPE_BOOLEAN_AS_STRING
DBUS_TYPE_BOOLEAN as a string literal instead of a int literal
dbus_bool_t _dbus_string_steal_data(DBusString *str, char **data_return)
Like _dbus_string_get_data(), but removes the gotten data from the original string.
int dbus_signature_iter_get_current_type(const DBusSignatureIter *iter)
Returns the current type pointed to by the iterator.
const char * pos
current position in the signature string
DBusValidity _dbus_validate_signature_with_reason(const DBusString *type_str, int type_pos, int len)
Verifies that the range of type_str from type_pos to type_end is a valid signature.
unsigned int in_array
true if we are a subiterator pointing to an array's element type
#define DBUS_TYPE_DICT_ENTRY_AS_STRING
DBUS_TYPE_DICT_ENTRY as a string literal instead of a int literal
#define DBUS_TYPE_UINT32_AS_STRING
DBUS_TYPE_UINT32 as a string literal instead of a int literal
dbus_bool_t dbus_type_is_valid(int typecode)
Return TRUE if the argument is a valid typecode.
char * dbus_signature_iter_get_signature(const DBusSignatureIter *iter)
Returns the signature of the single complete type starting at the given iterator. ...
dbus_bool_t dbus_type_is_container(int typecode)
A "container type" can contain basic types, or nested container types.