D-Bus 1.14.10
|
functions to marshal/unmarshal data from the wire More...
Data Structures | |
struct | HeaderFieldType |
struct | DBusTypeReaderClass |
Virtual table for a type reader. More... | |
struct | ReplacementBlock |
Macros | |
#define | FIELDS_ARRAY_SIGNATURE_OFFSET 6 |
Offset from start of _dbus_header_signature_str to the signature of the fields array. More... | |
#define | FIELDS_ARRAY_ELEMENT_SIGNATURE_OFFSET 7 |
Offset from start of _dbus_header_signature_str to the signature of an element of the fields array. More... | |
#define | BYTE_ORDER_OFFSET 0 |
Offset to byte order from start of header. More... | |
#define | TYPE_OFFSET 1 |
Offset to type from start of header. More... | |
#define | FLAGS_OFFSET 2 |
Offset to flags from start of header. More... | |
#define | VERSION_OFFSET 3 |
Offset to version from start of header. More... | |
#define | BODY_LENGTH_OFFSET 4 |
Offset to body length from start of header. More... | |
#define | SERIAL_OFFSET 8 |
Offset to client serial from start of header. More... | |
#define | FIELDS_ARRAY_LENGTH_OFFSET 12 |
Offset to fields array length from start of header. More... | |
#define | FIRST_FIELD_OFFSET 16 |
Offset to first field in header. More... | |
#define | EXPECTED_TYPE_OF_FIELD(field) (_dbus_header_field_types[field].type) |
Macro to look up the correct type for a field. More... | |
#define | MAX_POSSIBLE_HEADER_PADDING 7 |
The most padding we could ever need for a header. More... | |
#define | HEADER_END_BEFORE_PADDING(header) (_dbus_string_get_length (&(header)->data) - (header)->padding) |
Compute the end of the header, ignoring padding. More... | |
#define | RECURSIVE_MARSHAL_READ_TRACE 0 |
turn this on to get deluged in TypeReader verbose spam More... | |
#define | RECURSIVE_MARSHAL_WRITE_TRACE 0 |
turn this on to get deluged in TypeWriter verbose spam More... | |
#define | ARRAY_READER_LEN_POS(reader) ((reader)->u.array.start_pos - ((int)(reader)->array_len_offset) - 4) |
compute position of array length given array_len_offset, which is the offset back from start_pos to end of the len More... | |
#define | VALID_INITIAL_NAME_CHARACTER(c) |
Determine wether the given character is valid as the first character in a name. More... | |
#define | VALID_NAME_CHARACTER(c) |
Determine wether the given character is valid as a second or later character in a name. More... | |
#define | VALID_INITIAL_BUS_NAME_CHARACTER(c) |
Determine wether the given character is valid as the first character in a bus name. More... | |
#define | VALID_BUS_NAME_CHARACTER(c) |
Determine wether the given character is valid as a second or later character in a bus name. More... | |
#define | _dbus_validate_utf8(s, b, e) _dbus_string_validate_utf8 (s, b, e) |
#define | DECLARE_DBUS_NAME_CHECK(what) dbus_bool_t _dbus_check_is_valid_##what (const char *name) |
A name check is used in _dbus_return_if_fail(), it's not suitable for validating untrusted data. More... | |
#define | DEFINE_DBUS_NAME_CHECK(what) |
Define a name check to be used in _dbus_return_if_fail() statements. More... | |
Enumerations | |
enum | { MARSHAL_AS_STRING , MARSHAL_AS_SIGNATURE , MARSHAL_AS_BYTE_ARRAY } |
enum | DBusValidationMode { DBUS_VALIDATION_MODE_WE_TRUST_THIS_DATA_ABSOLUTELY , DBUS_VALIDATION_MODE_DATA_IS_UNTRUSTED } |
This is used rather than a bool for high visibility. More... | |
enum | DBusValidity { DBUS_VALIDITY_UNKNOWN_OOM_ERROR = -4 , DBUS_INVALID_FOR_UNKNOWN_REASON = -3 , DBUS_VALID_BUT_INCOMPLETE = -2 , DBUS_VALIDITY_UNKNOWN = -1 , DBUS_VALID = 0 , DBUS_INVALID_UNKNOWN_TYPECODE = 1 , DBUS_INVALID_MISSING_ARRAY_ELEMENT_TYPE = 2 , DBUS_INVALID_SIGNATURE_TOO_LONG = 3 , DBUS_INVALID_EXCEEDED_MAXIMUM_ARRAY_RECURSION = 4 , DBUS_INVALID_EXCEEDED_MAXIMUM_STRUCT_RECURSION = 5 , DBUS_INVALID_STRUCT_ENDED_BUT_NOT_STARTED = 6 , DBUS_INVALID_STRUCT_STARTED_BUT_NOT_ENDED = 7 , DBUS_INVALID_STRUCT_HAS_NO_FIELDS = 8 , DBUS_INVALID_ALIGNMENT_PADDING_NOT_NUL = 9 , DBUS_INVALID_BOOLEAN_NOT_ZERO_OR_ONE = 10 , DBUS_INVALID_NOT_ENOUGH_DATA = 11 , DBUS_INVALID_TOO_MUCH_DATA = 12 , DBUS_INVALID_BAD_BYTE_ORDER = 13 , DBUS_INVALID_BAD_PROTOCOL_VERSION = 14 , DBUS_INVALID_BAD_MESSAGE_TYPE = 15 , DBUS_INVALID_BAD_SERIAL = 16 , DBUS_INVALID_INSANE_FIELDS_ARRAY_LENGTH = 17 , DBUS_INVALID_INSANE_BODY_LENGTH = 18 , DBUS_INVALID_MESSAGE_TOO_LONG = 19 , DBUS_INVALID_HEADER_FIELD_CODE = 20 , DBUS_INVALID_HEADER_FIELD_HAS_WRONG_TYPE = 21 , DBUS_INVALID_USES_LOCAL_INTERFACE = 22 , DBUS_INVALID_USES_LOCAL_PATH = 23 , DBUS_INVALID_HEADER_FIELD_APPEARS_TWICE = 24 , DBUS_INVALID_BAD_DESTINATION = 25 , DBUS_INVALID_BAD_INTERFACE = 26 , DBUS_INVALID_BAD_MEMBER = 27 , DBUS_INVALID_BAD_ERROR_NAME = 28 , DBUS_INVALID_BAD_SENDER = 29 , DBUS_INVALID_MISSING_PATH = 30 , DBUS_INVALID_MISSING_INTERFACE = 31 , DBUS_INVALID_MISSING_MEMBER = 32 , DBUS_INVALID_MISSING_ERROR_NAME = 33 , DBUS_INVALID_MISSING_REPLY_SERIAL = 34 , DBUS_INVALID_LENGTH_OUT_OF_BOUNDS = 35 , DBUS_INVALID_ARRAY_LENGTH_EXCEEDS_MAXIMUM = 36 , DBUS_INVALID_BAD_PATH = 37 , DBUS_INVALID_SIGNATURE_LENGTH_OUT_OF_BOUNDS = 38 , DBUS_INVALID_BAD_UTF8_IN_STRING = 39 , DBUS_INVALID_ARRAY_LENGTH_INCORRECT = 40 , DBUS_INVALID_VARIANT_SIGNATURE_LENGTH_OUT_OF_BOUNDS = 41 , DBUS_INVALID_VARIANT_SIGNATURE_BAD = 42 , DBUS_INVALID_VARIANT_SIGNATURE_EMPTY = 43 , DBUS_INVALID_VARIANT_SIGNATURE_SPECIFIES_MULTIPLE_VALUES = 44 , DBUS_INVALID_VARIANT_SIGNATURE_MISSING_NUL = 45 , DBUS_INVALID_STRING_MISSING_NUL = 46 , DBUS_INVALID_SIGNATURE_MISSING_NUL = 47 , DBUS_INVALID_EXCEEDED_MAXIMUM_DICT_ENTRY_RECURSION = 48 , DBUS_INVALID_DICT_ENTRY_ENDED_BUT_NOT_STARTED = 49 , DBUS_INVALID_DICT_ENTRY_STARTED_BUT_NOT_ENDED = 50 , DBUS_INVALID_DICT_ENTRY_HAS_NO_FIELDS = 51 , DBUS_INVALID_DICT_ENTRY_HAS_ONLY_ONE_FIELD = 52 , DBUS_INVALID_DICT_ENTRY_HAS_TOO_MANY_FIELDS = 53 , DBUS_INVALID_DICT_ENTRY_NOT_INSIDE_ARRAY = 54 , DBUS_INVALID_DICT_KEY_MUST_BE_BASIC_TYPE = 55 , DBUS_INVALID_MISSING_UNIX_FDS = 56 , DBUS_INVALID_NESTED_TOO_DEEPLY = 57 , DBUS_VALIDITY_LAST } |
This is primarily used in unit testing, so we can verify that each invalid message is invalid for the expected reasons. More... | |
Functions | |
void | _dbus_pack_uint32 (dbus_uint32_t value, int byte_order, unsigned char *data) |
Packs a 32 bit unsigned integer into a data pointer. More... | |
dbus_uint16_t | _dbus_unpack_uint16 (int byte_order, const unsigned char *data) |
Unpacks a 16 bit unsigned integer from a data pointer. More... | |
dbus_uint32_t | _dbus_unpack_uint32 (int byte_order, const unsigned char *data) |
Unpacks a 32 bit unsigned integer from a data pointer. More... | |
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 previously. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
void | _dbus_swap_array (unsigned char *data, int n_elements, int alignment) |
Swaps the elements of an array to the opposite byte order. More... | |
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. More... | |
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. More... | |
void | _dbus_marshal_skip_array (const DBusString *str, int element_type, int byte_order, int *pos) |
Skips an array, returning the next position. More... | |
int | _dbus_type_get_alignment (int typecode) |
Gets the alignment requirement for the given type; will be 1, 4, or 8. More... | |
const char * | _dbus_type_to_string (int typecode) |
Returns a string describing the given type. More... | |
void | _dbus_verbose_bytes (const unsigned char *data, int len, int offset) |
If in verbose mode, print a block of binary data. More... | |
void | _dbus_verbose_bytes_of_string (const DBusString *str, int start, int len) |
Dump the given part of the string to verbose log. More... | |
int | _dbus_first_type_in_signature (const DBusString *str, int pos) |
Get the first type in the signature. More... | |
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. More... | |
void | _dbus_marshal_byteswap (const DBusString *signature, int signature_start, int old_byte_order, int new_byte_order, DBusString *value_str, int value_pos) |
Byteswaps the marshaled data in the given value_str. More... | |
_DBUS_STRING_DEFINE_STATIC (_dbus_header_signature_str, DBUS_HEADER_SIGNATURE) | |
Static DBusString containing the signature of a message header. | |
_DBUS_STRING_DEFINE_STATIC (_dbus_local_interface_str, DBUS_INTERFACE_LOCAL) | |
Static DBusString containing the local interface. | |
_DBUS_STRING_DEFINE_STATIC (_dbus_local_path_str, DBUS_PATH_LOCAL) | |
Static DBusString containing the local path. | |
char | _dbus_header_get_byte_order (const DBusHeader *header) |
Returns the header's byte order. More... | |
int | _dbus_header_get_message_type (DBusHeader *header) |
Gets the type of the message. More... | |
void | _dbus_header_set_serial (DBusHeader *header, dbus_uint32_t serial) |
Sets the serial number of a header. More... | |
dbus_uint32_t | _dbus_header_get_serial (DBusHeader *header) |
See dbus_message_get_serial() More... | |
void | _dbus_header_reinit (DBusHeader *header) |
Re-initializes a header that was previously initialized and never freed. More... | |
dbus_bool_t | _dbus_header_init (DBusHeader *header) |
Initializes a header, but doesn't prepare it for use; to make the header valid, you have to call _dbus_header_create(). More... | |
void | _dbus_header_free (DBusHeader *header) |
Frees a header. More... | |
dbus_bool_t | _dbus_header_copy (const DBusHeader *header, DBusHeader *dest) |
Initializes dest with a copy of the given header. More... | |
dbus_bool_t | _dbus_header_create (DBusHeader *header, int byte_order, int message_type, const char *destination, const char *path, const char *interface, const char *member, const char *error_name) |
Fills in the primary fields of the header, so the header is ready for use. More... | |
dbus_bool_t | _dbus_header_have_message_untrusted (int max_message_length, DBusValidity *validity, int *byte_order, int *fields_array_len, int *header_len, int *body_len, const DBusString *str, int start, int len) |
Given data long enough to contain the length of the message body and the fields array, check whether the data is long enough to contain the entire message (assuming the claimed lengths are accurate). More... | |
dbus_bool_t | _dbus_header_load (DBusHeader *header, DBusValidationMode mode, DBusValidity *validity, int byte_order, int fields_array_len, int header_len, int body_len, const DBusString *str) |
Creates a message header from potentially-untrusted data. More... | |
void | _dbus_header_update_lengths (DBusHeader *header, int body_len) |
Fills in the correct body length. More... | |
dbus_bool_t | _dbus_header_set_field_basic (DBusHeader *header, int field, int type, const void *value) |
Sets the value of a field with basic type. More... | |
dbus_bool_t | _dbus_header_get_field_basic (DBusHeader *header, int field, int type, void *value) |
Gets the value of a field with basic type. More... | |
dbus_bool_t | _dbus_header_get_field_raw (DBusHeader *header, int field, const DBusString **str, int *pos) |
Gets the raw marshaled data for a field. More... | |
dbus_bool_t | _dbus_header_delete_field (DBusHeader *header, int field) |
Deletes a field, if it exists. More... | |
void | _dbus_header_toggle_flag (DBusHeader *header, dbus_uint32_t flag, dbus_bool_t value) |
Toggles a message flag bit, turning on the bit if value = TRUE and flipping it off if value = FALSE. More... | |
dbus_bool_t | _dbus_header_get_flag (DBusHeader *header, dbus_uint32_t flag) |
Gets a message flag bit, returning TRUE if the bit is set. More... | |
void | _dbus_header_byteswap (DBusHeader *header, int new_order) |
Swaps the header into the given order if required. More... | |
dbus_bool_t | _dbus_header_remove_unknown_fields (DBusHeader *header) |
Remove every header field not known to this version of dbus. More... | |
void | _dbus_type_signature_next (const char *type_str, int *type_pos) |
Skips to the next "complete" type inside a type signature. More... | |
void | _dbus_type_reader_init (DBusTypeReader *reader, int byte_order, const DBusString *type_str, int type_pos, const DBusString *value_str, int value_pos) |
Initializes a type reader. More... | |
void | _dbus_type_reader_init_types_only (DBusTypeReader *reader, const DBusString *type_str, int type_pos) |
Like _dbus_type_reader_init() but the iteration is over the signature, not over values. More... | |
int | _dbus_type_reader_get_current_type (const DBusTypeReader *reader) |
Gets the type of the value the reader is currently pointing to; or for a types-only reader gets the type it's currently pointing to. More... | |
int | _dbus_type_reader_get_element_type (const DBusTypeReader *reader) |
Gets the type of an element of the array the reader is currently pointing to. More... | |
int | _dbus_type_reader_get_value_pos (const DBusTypeReader *reader) |
Gets the current position in the value block. More... | |
void | _dbus_type_reader_read_raw (const DBusTypeReader *reader, const unsigned char **value_location) |
Get the address of the marshaled value in the data being read. More... | |
void | _dbus_type_reader_read_basic (const DBusTypeReader *reader, void *value) |
Reads a basic-typed value, as with _dbus_marshal_read_basic(). More... | |
int | _dbus_type_reader_get_array_length (const DBusTypeReader *reader) |
Returns the number of bytes in the array. More... | |
void | _dbus_type_reader_read_fixed_multi (const DBusTypeReader *reader, const void **value, int *n_elements) |
Reads a block of fixed-length basic values, from the current point in an array to the end of the array. More... | |
void | _dbus_type_reader_recurse (DBusTypeReader *reader, DBusTypeReader *sub) |
Initialize a new reader pointing to the first type and corresponding value that's a child of the current container. More... | |
dbus_bool_t | _dbus_type_reader_next (DBusTypeReader *reader) |
Skip to the next value on this "level". More... | |
dbus_bool_t | _dbus_type_reader_has_next (const DBusTypeReader *reader) |
Check whether there's another value on this "level". More... | |
void | _dbus_type_reader_get_signature (const DBusTypeReader *reader, const DBusString **str_p, int *start_p, int *len_p) |
Gets the string and range of said string containing the signature of the current value. More... | |
dbus_bool_t | _dbus_type_reader_set_basic (DBusTypeReader *reader, const void *value, const DBusTypeReader *realign_root) |
Sets a new value for the basic type value pointed to by the reader, leaving the reader valid to continue reading. More... | |
dbus_bool_t | _dbus_type_reader_delete (DBusTypeReader *reader, const DBusTypeReader *realign_root) |
Recursively deletes any value pointed to by the reader, leaving the reader valid to continue reading. More... | |
void | _dbus_type_writer_init (DBusTypeWriter *writer, int byte_order, DBusString *type_str, int type_pos, DBusString *value_str, int value_pos) |
Initialize a write iterator, which is used to write out values in serialized D-Bus format. More... | |
void | _dbus_type_writer_init_types_delayed (DBusTypeWriter *writer, int byte_order, DBusString *value_str, int value_pos) |
Initialize a write iterator, with the signature to be provided later. More... | |
void | _dbus_type_writer_add_types (DBusTypeWriter *writer, DBusString *type_str, int type_pos) |
Adds type string to the writer, if it had none. More... | |
void | _dbus_type_writer_remove_types (DBusTypeWriter *writer) |
Removes type string from the writer. More... | |
void | _dbus_type_writer_init_values_only (DBusTypeWriter *writer, int byte_order, const DBusString *type_str, int type_pos, DBusString *value_str, int value_pos) |
Like _dbus_type_writer_init(), except the type string passed in should correspond to an existing signature that matches what you're going to write out. More... | |
dbus_bool_t | _dbus_type_writer_recurse (DBusTypeWriter *writer, int container_type, const DBusString *contained_type, int contained_type_start, DBusTypeWriter *sub) |
Opens a new container and writes out the initial information for that container. More... | |
dbus_bool_t | _dbus_type_writer_append_array (DBusTypeWriter *writer, const DBusString *contained_type, int contained_type_start, DBusTypeWriter *sub) |
Append to an existing array. More... | |
dbus_bool_t | _dbus_type_writer_unrecurse (DBusTypeWriter *writer, DBusTypeWriter *sub) |
Closes a container created by _dbus_type_writer_recurse() and writes any additional information to the values block. More... | |
dbus_bool_t | _dbus_type_writer_write_basic (DBusTypeWriter *writer, int type, const void *value) |
Writes out a basic type. More... | |
dbus_bool_t | _dbus_type_writer_write_fixed_multi (DBusTypeWriter *writer, int element_type, const void *value, int n_elements) |
Writes a block of fixed-length basic values, i.e. More... | |
dbus_bool_t | _dbus_type_writer_write_reader (DBusTypeWriter *writer, DBusTypeReader *reader) |
Iterate through all values in the given reader, writing a copy of each value to the writer. More... | |
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. More... | |
DBusValidity | _dbus_validate_body_with_reason (const DBusString *expected_signature, int expected_signature_start, int byte_order, int *bytes_remaining, const DBusString *value_str, int value_pos, int len) |
Verifies that the range of value_str from value_pos to value_end is a legitimate value of type expected_signature. More... | |
dbus_bool_t | _dbus_validate_path (const DBusString *str, int start, int len) |
Checks that the given range of the string is a valid object path name in the D-Bus protocol. More... | |
const char * | _dbus_validity_to_error_message (DBusValidity validity) |
dbus_bool_t | _dbus_validate_interface (const DBusString *str, int start, int len) |
Checks that the given range of the string is a valid interface name in the D-Bus protocol. More... | |
dbus_bool_t | _dbus_validate_member (const DBusString *str, int start, int len) |
Checks that the given range of the string is a valid member name in the D-Bus protocol. More... | |
dbus_bool_t | _dbus_validate_error_name (const DBusString *str, int start, int len) |
Checks that the given range of the string is a valid error name in the D-Bus protocol. More... | |
dbus_bool_t | _dbus_validate_bus_name (const DBusString *str, int start, int len) |
Checks that the given range of the string is a valid bus name in the D-Bus protocol. More... | |
dbus_bool_t | _dbus_validate_bus_namespace (const DBusString *str, int start, int len) |
Checks that the given range of the string is a prefix of a valid bus name in the D-Bus protocol. More... | |
DECLARE_DBUS_NAME_CHECK (path) | |
defines _dbus_check_is_valid_path() | |
DECLARE_DBUS_NAME_CHECK (interface) | |
defines _dbus_check_is_valid_interface() | |
DECLARE_DBUS_NAME_CHECK (member) | |
defines _dbus_check_is_valid_member() | |
DECLARE_DBUS_NAME_CHECK (error_name) | |
defines _dbus_check_is_valid_error_name() | |
DECLARE_DBUS_NAME_CHECK (bus_name) | |
defines _dbus_check_is_valid_bus_name() | |
DECLARE_DBUS_NAME_CHECK (utf8) | |
defines _dbus_check_is_valid_utf8() | |
functions to marshal/unmarshal data from the wire
Types and functions related to converting primitive data types from wire format to native machine format, and vice versa.
A signature is just a string with multiple types one after the other. for example a type is "i" or "(ii)", a signature is "i(ii)" where i is int and (ii) is struct { int; int; }
#define _dbus_validate_utf8 | ( | s, | |
b, | |||
e | |||
) | _dbus_string_validate_utf8 (s, b, e) |
Definition at line 161 of file dbus-marshal-validate.h.
#define ARRAY_READER_LEN_POS | ( | reader | ) | ((reader)->u.array.start_pos - ((int)(reader)->array_len_offset) - 4) |
compute position of array length given array_len_offset, which is the offset back from start_pos to end of the len
Definition at line 214 of file dbus-marshal-recursive.c.
#define BODY_LENGTH_OFFSET 4 |
Offset to body length from start of header.
Definition at line 61 of file dbus-marshal-header.c.
#define BYTE_ORDER_OFFSET 0 |
Offset to byte order from start of header.
Definition at line 53 of file dbus-marshal-header.c.
#define DECLARE_DBUS_NAME_CHECK | ( | what | ) | dbus_bool_t _dbus_check_is_valid_##what (const char *name) |
A name check is used in _dbus_return_if_fail(), it's not suitable for validating untrusted data.
use _dbus_validate_whatever for that.
Definition at line 176 of file dbus-marshal-validate.h.
#define DEFINE_DBUS_NAME_CHECK | ( | what | ) |
Define a name check to be used in _dbus_return_if_fail() statements.
Definition at line 181 of file dbus-marshal-validate.h.
#define EXPECTED_TYPE_OF_FIELD | ( | field | ) | (_dbus_header_field_types[field].type) |
Macro to look up the correct type for a field.
Definition at line 91 of file dbus-marshal-header.c.
#define FIELDS_ARRAY_ELEMENT_SIGNATURE_OFFSET 7 |
Offset from start of _dbus_header_signature_str to the signature of an element of the fields array.
Definition at line 49 of file dbus-marshal-header.c.
#define FIELDS_ARRAY_LENGTH_OFFSET 12 |
Offset to fields array length from start of header.
Definition at line 65 of file dbus-marshal-header.c.
#define FIELDS_ARRAY_SIGNATURE_OFFSET 6 |
Offset from start of _dbus_header_signature_str to the signature of the fields array.
Definition at line 47 of file dbus-marshal-header.c.
#define FIRST_FIELD_OFFSET 16 |
Offset to first field in header.
Definition at line 67 of file dbus-marshal-header.c.
#define FLAGS_OFFSET 2 |
Offset to flags from start of header.
Definition at line 57 of file dbus-marshal-header.c.
#define HEADER_END_BEFORE_PADDING | ( | header | ) | (_dbus_string_get_length (&(header)->data) - (header)->padding) |
Compute the end of the header, ignoring padding.
In the DBusHeader diagram, this is the distance from 0 to [B].
Definition at line 126 of file dbus-marshal-header.c.
#define MAX_POSSIBLE_HEADER_PADDING 7 |
The most padding we could ever need for a header.
Definition at line 94 of file dbus-marshal-header.c.
#define RECURSIVE_MARSHAL_READ_TRACE 0 |
turn this on to get deluged in TypeReader verbose spam
Definition at line 48 of file dbus-marshal-recursive.c.
#define RECURSIVE_MARSHAL_WRITE_TRACE 0 |
turn this on to get deluged in TypeWriter verbose spam
Definition at line 51 of file dbus-marshal-recursive.c.
#define SERIAL_OFFSET 8 |
Offset to client serial from start of header.
Definition at line 63 of file dbus-marshal-header.c.
#define TYPE_OFFSET 1 |
Offset to type from start of header.
Definition at line 55 of file dbus-marshal-header.c.
#define VALID_BUS_NAME_CHARACTER | ( | c | ) |
Determine wether the given character is valid as a second or later character in a bus name.
Definition at line 1133 of file dbus-marshal-validate.c.
#define VALID_INITIAL_BUS_NAME_CHARACTER | ( | c | ) |
Determine wether the given character is valid as the first character in a bus name.
Definition at line 1124 of file dbus-marshal-validate.c.
#define VALID_INITIAL_NAME_CHARACTER | ( | c | ) |
Determine wether the given character is valid as the first character in a name.
Definition at line 805 of file dbus-marshal-validate.c.
#define VALID_NAME_CHARACTER | ( | c | ) |
Determine wether the given character is valid as a second or later character in a name.
Definition at line 814 of file dbus-marshal-validate.c.
#define VERSION_OFFSET 3 |
Offset to version from start of header.
Definition at line 59 of file dbus-marshal-header.c.
anonymous enum |
Definition at line 708 of file dbus-marshal-basic.c.
enum DBusValidationMode |
This is used rather than a bool for high visibility.
Definition at line 38 of file dbus-marshal-validate.h.
enum DBusValidity |
This is primarily used in unit testing, so we can verify that each invalid message is invalid for the expected reasons.
Thus we really want a distinct enum value for every codepath leaving the validator functions. Enum values are specified manually for ease of debugging (so you can see the enum value given a printf)
Enumerator | |
---|---|
DBUS_VALIDITY_UNKNOWN_OOM_ERROR | can't determine validity due to OOM |
DBUS_VALID | the data is valid |
DBUS_INVALID_TOO_MUCH_DATA | trailing junk makes it invalid |
Definition at line 51 of file dbus-marshal-validate.h.
int _dbus_first_type_in_signature | ( | const DBusString * | str, |
int | pos | ||
) |
Get the first type in the signature.
The difference between this and just getting the first byte of the signature is that you won't get DBUS_STRUCT_BEGIN_CHAR, you'll get DBUS_TYPE_STRUCT instead.
str | string containing signature |
pos | where the signature starts |
Definition at line 1477 of file dbus-marshal-basic.c.
Referenced by _dbus_type_reader_get_current_type(), _dbus_type_reader_get_element_type(), and _dbus_type_reader_recurse().
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.
str | a C string buffer |
pos | where the signature starts |
Definition at line 1492 of file dbus-marshal-basic.c.
Referenced by dbus_signature_iter_get_current_type(), and dbus_signature_iter_get_element_type().
void _dbus_header_byteswap | ( | DBusHeader * | header, |
int | new_order | ||
) |
Swaps the header into the given order if required.
header | the header |
new_order | the new byte order |
Definition at line 1505 of file dbus-marshal-header.c.
References _dbus_header_get_byte_order(), _dbus_marshal_byteswap(), BYTE_ORDER_OFFSET, and DBusHeader::data.
dbus_bool_t _dbus_header_copy | ( | const DBusHeader * | header, |
DBusHeader * | dest | ||
) |
Initializes dest with a copy of the given header.
Resets the message serial to 0 on the copy.
header | header to copy |
dest | destination for copy |
Definition at line 493 of file dbus-marshal-header.c.
References _dbus_header_set_serial(), _dbus_string_copy(), _dbus_string_free(), _dbus_string_init_preallocated(), DBusHeader::data, FALSE, and TRUE.
Referenced by dbus_message_copy().
dbus_bool_t _dbus_header_create | ( | DBusHeader * | header, |
int | byte_order, | ||
int | message_type, | ||
const char * | destination, | ||
const char * | path, | ||
const char * | interface, | ||
const char * | member, | ||
const char * | error_name | ||
) |
Fills in the primary fields of the header, so the header is ready for use.
NULL may be specified for some or all of the fields to avoid adding those fields. Some combinations of fields don't make sense, and passing them in will trigger an assertion failure.
header | the header |
byte_order | byte order of the header |
message_type | the message type |
destination | destination field or NULL |
path | path field or NULL |
interface | interface field or NULL |
member | member field or NULL |
error_name | error name or NULL |
Definition at line 531 of file dbus-marshal-header.c.
References _dbus_assert, DBusHeader::data, DBUS_BIG_ENDIAN, DBUS_LITTLE_ENDIAN, and DBUS_MESSAGE_TYPE_SIGNAL.
dbus_bool_t _dbus_header_delete_field | ( | DBusHeader * | header, |
int | field | ||
) |
Deletes a field, if it exists.
header | the header |
field | the field to delete |
Definition at line 1425 of file dbus-marshal-header.c.
void _dbus_header_free | ( | DBusHeader * | header | ) |
Frees a header.
header | the header |
Definition at line 479 of file dbus-marshal-header.c.
References _dbus_string_free(), and DBusHeader::data.
Referenced by dbus_message_copy().
char _dbus_header_get_byte_order | ( | const DBusHeader * | header | ) |
Returns the header's byte order.
header | the header |
Definition at line 177 of file dbus-marshal-header.c.
References _dbus_assert, BYTE_ORDER_OFFSET, and DBusHeader::data.
Referenced by _dbus_header_byteswap(), _dbus_header_get_serial(), _dbus_header_remove_unknown_fields(), _dbus_header_set_serial(), and _dbus_header_update_lengths().
dbus_bool_t _dbus_header_get_field_basic | ( | DBusHeader * | header, |
int | field, | ||
int | type, | ||
void * | value | ||
) |
Gets the value of a field with basic type.
If the field doesn't exist, returns FALSE, otherwise returns TRUE.
header | the header |
field | the field to get |
type | the type of the value |
value | the value as for _dbus_marshal_read_basic() |
Definition at line 1360 of file dbus-marshal-header.c.
References _dbus_assert, DBUS_HEADER_FIELD_INVALID, and DBUS_HEADER_FIELD_LAST.
Referenced by dbus_message_get_container_instance(), dbus_message_get_destination(), dbus_message_get_error_name(), dbus_message_get_interface(), dbus_message_get_member(), dbus_message_get_path(), dbus_message_get_reply_serial(), and dbus_message_get_sender().
dbus_bool_t _dbus_header_get_field_raw | ( | DBusHeader * | header, |
int | field, | ||
const DBusString ** | str, | ||
int * | pos | ||
) |
Gets the raw marshaled data for a field.
If the field doesn't exist, returns FALSE, otherwise returns TRUE. Returns the start of the marshaled data, i.e. usually the byte where the length starts (for strings and arrays) or for basic types just the value itself.
header | the header |
field | the field to get |
str | return location for the data string |
pos | return location for start of field value |
Definition at line 1401 of file dbus-marshal-header.c.
dbus_bool_t _dbus_header_get_flag | ( | DBusHeader * | header, |
dbus_uint32_t | flag | ||
) |
Gets a message flag bit, returning TRUE if the bit is set.
header | the header |
flag | the message flag to get |
Definition at line 1488 of file dbus-marshal-header.c.
References DBusHeader::data, and FLAGS_OFFSET.
Referenced by dbus_message_get_allow_interactive_authorization(), dbus_message_get_auto_start(), and dbus_message_get_no_reply().
int _dbus_header_get_message_type | ( | DBusHeader * | header | ) |
Gets the type of the message.
header | the header |
Definition at line 389 of file dbus-marshal-header.c.
References _dbus_assert, DBusHeader::data, DBUS_MESSAGE_TYPE_INVALID, and TYPE_OFFSET.
Referenced by dbus_message_get_type().
dbus_uint32_t _dbus_header_get_serial | ( | DBusHeader * | header | ) |
header | the header |
Definition at line 430 of file dbus-marshal-header.c.
References _dbus_header_get_byte_order(), _dbus_marshal_read_uint32(), DBusHeader::data, NULL, and SERIAL_OFFSET.
Referenced by _dbus_header_set_serial(), and dbus_message_get_serial().
dbus_bool_t _dbus_header_have_message_untrusted | ( | int | max_message_length, |
DBusValidity * | validity, | ||
int * | byte_order, | ||
int * | fields_array_len, | ||
int * | header_len, | ||
int * | body_len, | ||
const DBusString * | str, | ||
int | start, | ||
int | len | ||
) |
Given data long enough to contain the length of the message body and the fields array, check whether the data is long enough to contain the entire message (assuming the claimed lengths are accurate).
Also checks that the lengths are in sanity parameters.
max_message_length | maximum length of a valid message |
validity | return location for why the data is invalid if it is |
byte_order | return location for byte order |
fields_array_len | return location for claimed fields array length |
header_len | return location for claimed header length |
body_len | return location for claimed body length |
str | the data |
start | start of data, 8-aligned |
len | length of data |
Definition at line 679 of file dbus-marshal-header.c.
References _dbus_assert, _DBUS_INT32_MAX, BYTE_ORDER_OFFSET, DBUS_BIG_ENDIAN, and DBUS_LITTLE_ENDIAN.
Referenced by _dbus_message_loader_queue_messages(), and dbus_message_demarshal_bytes_needed().
dbus_bool_t _dbus_header_init | ( | DBusHeader * | header | ) |
Initializes a header, but doesn't prepare it for use; to make the header valid, you have to call _dbus_header_create().
header | header to initialize |
Definition at line 463 of file dbus-marshal-header.c.
References _dbus_header_reinit(), _dbus_string_init_preallocated(), DBusHeader::data, FALSE, and TRUE.
dbus_bool_t _dbus_header_load | ( | DBusHeader * | header, |
DBusValidationMode | mode, | ||
DBusValidity * | validity, | ||
int | byte_order, | ||
int | fields_array_len, | ||
int | header_len, | ||
int | body_len, | ||
const DBusString * | str | ||
) |
Creates a message header from potentially-untrusted data.
The return value is TRUE if there was enough memory and the data was valid. If it returns TRUE, the header will be created. If it returns FALSE and *validity == DBUS_VALIDITY_UNKNOWN_OOM_ERROR, then there wasn't enough memory. If it returns FALSE and *validity != DBUS_VALIDITY_UNKNOWN_OOM_ERROR then the data was invalid.
The byte_order, fields_array_len, and body_len args should be from _dbus_header_have_message_untrusted(). Validation performed in _dbus_header_have_message_untrusted() is assumed to have been already done.
header | the header (must be initialized) |
mode | whether to do validation |
validity | return location for invalidity reason |
byte_order | byte order from header |
fields_array_len | claimed length of fields array |
body_len | claimed length of body |
header_len | claimed length of header |
str | a string starting with the header |
Definition at line 979 of file dbus-marshal-header.c.
References _dbus_assert, _dbus_string_copy_len(), DBusHeader::data, DBUS_VALIDITY_UNKNOWN_OOM_ERROR, and FALSE.
void _dbus_header_reinit | ( | DBusHeader * | header | ) |
Re-initializes a header that was previously initialized and never freed.
After this, to make the header valid you have to call _dbus_header_create().
header | header to re-initialize |
Definition at line 446 of file dbus-marshal-header.c.
References _dbus_string_set_length(), DBusHeader::data, and DBusHeader::padding.
Referenced by _dbus_header_init().
dbus_bool_t _dbus_header_remove_unknown_fields | ( | DBusHeader * | header | ) |
Remove every header field not known to this version of dbus.
header | the header |
Definition at line 1530 of file dbus-marshal-header.c.
References _dbus_assert, _dbus_header_get_byte_order(), _dbus_type_reader_get_current_type(), _dbus_type_reader_init(), _dbus_type_reader_read_basic(), _dbus_type_reader_recurse(), DBusHeader::data, DBUS_HEADER_FIELD_LAST, DBUS_TYPE_BYTE, DBUS_TYPE_INVALID, FIELDS_ARRAY_LENGTH_OFFSET, and FIELDS_ARRAY_SIGNATURE_OFFSET.
Referenced by _dbus_message_remove_unknown_fields().
dbus_bool_t _dbus_header_set_field_basic | ( | DBusHeader * | header, |
int | field, | ||
int | type, | ||
const void * | value | ||
) |
Sets the value of a field with basic type.
If the value is a string value, it isn't allowed to be NULL. If the field doesn't exist, it will be created.
header | the header |
field | the field to set |
type | the type of the value |
value | the value as for _dbus_marshal_set_basic() |
Definition at line 1282 of file dbus-marshal-header.c.
References _dbus_assert, and DBUS_HEADER_FIELD_LAST.
Referenced by dbus_message_set_reply_serial().
void _dbus_header_set_serial | ( | DBusHeader * | header, |
dbus_uint32_t | serial | ||
) |
Sets the serial number of a header.
This can only be done once on a header.
header | the header |
serial | the serial |
Definition at line 407 of file dbus-marshal-header.c.
References _dbus_assert, _dbus_header_get_byte_order(), _dbus_header_get_serial(), _dbus_marshal_set_uint32(), DBusHeader::data, and SERIAL_OFFSET.
Referenced by _dbus_header_copy(), and dbus_message_set_serial().
void _dbus_header_toggle_flag | ( | DBusHeader * | header, |
dbus_uint32_t | flag, | ||
dbus_bool_t | value | ||
) |
Toggles a message flag bit, turning on the bit if value = TRUE and flipping it off if value = FALSE.
header | the header |
flag | the message flag to toggle |
value | toggle on or off |
Definition at line 1466 of file dbus-marshal-header.c.
References DBusHeader::data, and FLAGS_OFFSET.
Referenced by dbus_message_set_allow_interactive_authorization(), dbus_message_set_auto_start(), and dbus_message_set_no_reply().
void _dbus_header_update_lengths | ( | DBusHeader * | header, |
int | body_len | ||
) |
Fills in the correct body length.
header | the header |
body_len | the length of the body |
Definition at line 1205 of file dbus-marshal-header.c.
References _dbus_header_get_byte_order(), _dbus_marshal_set_uint32(), BODY_LENGTH_OFFSET, and DBusHeader::data.
Referenced by dbus_message_lock().
void _dbus_marshal_byteswap | ( | const DBusString * | signature, |
int | signature_start, | ||
int | old_byte_order, | ||
int | new_byte_order, | ||
DBusString * | value_str, | ||
int | value_pos | ||
) |
Byteswaps the marshaled data in the given value_str.
signature | the types in the value_str |
signature_start | where in signature is the signature |
old_byte_order | the old byte order |
new_byte_order | the new byte order |
value_str | the string containing the body |
value_pos | where the values start |
Definition at line 218 of file dbus-marshal-byteswap.c.
References _dbus_assert, and _dbus_type_reader_init_types_only().
Referenced by _dbus_header_byteswap().
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.
The "value" pointer is always the address of a variable of the basic type. So e.g. if the basic type is "double" then the pointer is a double*, and if it's "char*" then the pointer is a "char**".
A value of type DBusBasicValue is guaranteed to be large enough to hold any of the types that may be returned, which is handy if you are trying to do things generically. For example you can pass a DBusBasicValue* in to this function, and then pass the same DBusBasicValue* in to _dbus_marshal_basic_type() in order to move a value from one place to another.
str | the string containing the data |
pos | position in the string |
type | type of value to demarshal |
value | pointer to return value data |
byte_order | the byte order |
new_pos | pointer to update with new position, or NULL |
Definition at line 525 of file dbus-marshal-basic.c.
References _dbus_assert, _dbus_assert_not_reached, _dbus_marshal_read_uint32(), _dbus_type_to_string(), _dbus_warn_check_failed(), DBUS_TYPE_BOOLEAN, DBUS_TYPE_BYTE, DBUS_TYPE_DOUBLE, DBUS_TYPE_INT16, DBUS_TYPE_INT32, DBUS_TYPE_INT64, dbus_type_is_basic(), DBUS_TYPE_OBJECT_PATH, DBUS_TYPE_SIGNATURE, DBUS_TYPE_STRING, DBUS_TYPE_UINT16, DBUS_TYPE_UINT32, DBUS_TYPE_UINT64, and DBUS_TYPE_UNIX_FD.
Referenced by _dbus_type_reader_read_basic().
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.
str | the string containing the data |
byte_order | the byte order |
pos | the position in the string |
new_pos | the new position of the string |
Definition at line 487 of file dbus-marshal-basic.c.
References _dbus_assert, and _dbus_unpack_uint32().
Referenced by _dbus_header_get_serial(), _dbus_marshal_read_basic(), _dbus_marshal_skip_array(), and _dbus_marshal_skip_basic().
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.
Arguments work the same way as _dbus_marshal_basic_type().
str | the string |
pos | location of the current value |
type | the type of the current and new values |
value | the address of the new value |
byte_order | byte order for marshaling |
old_end_pos | location to store end position of the old value, or NULL |
new_end_pos | location to store end position of the new value, or NULL |
Definition at line 388 of file dbus-marshal-basic.c.
References DBUS_TYPE_BYTE, DBUS_TYPE_INT16, DBUS_TYPE_UINT16, and TRUE.
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 previously.
str | the string to write the marshalled int to |
pos | the byte offset where int should be written |
value | the value |
byte_order | the byte order to use |
Definition at line 271 of file dbus-marshal-basic.c.
Referenced by _dbus_header_set_serial(), and _dbus_header_update_lengths().
void _dbus_marshal_skip_array | ( | const DBusString * | str, |
int | element_type, | ||
int | byte_order, | ||
int * | pos | ||
) |
Skips an array, returning the next position.
str | the string containing the data |
element_type | the type of array elements |
byte_order | the byte order |
pos | pointer to position in the string, updated on return to new position |
Definition at line 1208 of file dbus-marshal-basic.c.
References _dbus_marshal_read_uint32(), and _dbus_type_get_alignment().
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.
str | the string containing the data |
type | type of value to read |
byte_order | the byte order |
pos | pointer to position in the string, updated on return to new position |
Definition at line 1140 of file dbus-marshal-basic.c.
References _dbus_assert, _dbus_assert_not_reached, _dbus_marshal_read_uint32(), _dbus_type_to_string(), _dbus_warn(), DBUS_BIG_ENDIAN, DBUS_LITTLE_ENDIAN, DBUS_TYPE_BOOLEAN, DBUS_TYPE_BYTE, DBUS_TYPE_DOUBLE, DBUS_TYPE_INT16, DBUS_TYPE_INT32, DBUS_TYPE_INT64, DBUS_TYPE_OBJECT_PATH, DBUS_TYPE_SIGNATURE, DBUS_TYPE_STRING, DBUS_TYPE_UINT16, DBUS_TYPE_UINT32, DBUS_TYPE_UINT64, and DBUS_TYPE_UNIX_FD.
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.
The "value" pointer is always the address of a variable containing the basic type value. So for example for int32 it will be dbus_int32_t*, and for string it will be const char**. This is for symmetry with _dbus_marshal_read_basic() and to have a simple consistent rule.
str | string to marshal to |
insert_at | where to insert the value |
type | type of value |
value | pointer to a variable containing the value |
byte_order | byte order |
pos_after | NULL or the position after the type |
Definition at line 827 of file dbus-marshal-basic.c.
References _dbus_assert, _dbus_string_insert_byte(), DBUS_TYPE_BYTE, DBUS_TYPE_INT16, dbus_type_is_basic(), DBUS_TYPE_UINT16, FALSE, and TRUE.
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.
dbus_type_is_fixed() returns TRUE for fixed-length types, which are the basic types minus the string-like types.
The value argument should be the adddress of an array, so e.g. "const dbus_uint32_t**"
str | string to marshal to |
insert_at | where to insert the value |
element_type | type of array elements |
value | address of an array to marshal |
n_elements | number of elements in the array |
byte_order | byte order |
pos_after | NULL or the position after the type |
Definition at line 1069 of file dbus-marshal-basic.c.
References _dbus_assert, _dbus_type_to_string(), DBUS_TYPE_BYTE, and dbus_type_is_fixed().
void _dbus_pack_uint32 | ( | dbus_uint32_t | value, |
int | byte_order, | ||
unsigned char * | data | ||
) |
Packs a 32 bit unsigned integer into a data pointer.
value | the value |
byte_order | the byte order to use |
data | the data pointer |
Definition at line 153 of file dbus-marshal-basic.c.
void _dbus_swap_array | ( | unsigned char * | data, |
int | n_elements, | ||
int | alignment | ||
) |
Swaps the elements of an array to the opposite byte order.
data | start of array |
n_elements | number of elements |
alignment | size of each element |
Definition at line 937 of file dbus-marshal-basic.c.
References _dbus_assert.
int _dbus_type_get_alignment | ( | int | typecode | ) |
Gets the alignment requirement for the given type; will be 1, 4, or 8.
typecode | the type |
Definition at line 1236 of file dbus-marshal-basic.c.
References _dbus_assert_not_reached, DBUS_TYPE_ARRAY, DBUS_TYPE_BOOLEAN, DBUS_TYPE_BYTE, DBUS_TYPE_DICT_ENTRY, DBUS_TYPE_DOUBLE, DBUS_TYPE_INT16, DBUS_TYPE_INT32, DBUS_TYPE_INT64, DBUS_TYPE_OBJECT_PATH, DBUS_TYPE_SIGNATURE, DBUS_TYPE_STRING, DBUS_TYPE_STRUCT, DBUS_TYPE_UINT16, DBUS_TYPE_UINT32, DBUS_TYPE_UINT64, DBUS_TYPE_UNIX_FD, and DBUS_TYPE_VARIANT.
Referenced by _dbus_marshal_skip_array(), and dbus_message_iter_get_element_count().
dbus_bool_t _dbus_type_reader_delete | ( | DBusTypeReader * | reader, |
const DBusTypeReader * | realign_root | ||
) |
Recursively deletes any value pointed to by the reader, leaving the reader valid to continue reading.
Any other readers will be invalidated.
The provided realign_root is the reader to start from when realigning the data that follows the newly-set value. See _dbus_type_reader_set_basic() for more details on the realign_root paramter.
reader | reader indicating where to delete a value |
realign_root | realign from here |
Definition at line 1420 of file dbus-marshal-recursive.c.
References _dbus_assert, DBusTypeReader::klass, and NULL.
int _dbus_type_reader_get_array_length | ( | const DBusTypeReader * | reader | ) |
Returns the number of bytes in the array.
reader | the reader to read from |
Definition at line 900 of file dbus-marshal-recursive.c.
References _dbus_assert, DBusTypeReader::klass, and DBusTypeReaderClass::types_only.
Referenced by dbus_message_iter_get_array_len(), and dbus_message_iter_get_element_count().
int _dbus_type_reader_get_current_type | ( | const DBusTypeReader * | reader | ) |
Gets the type of the value the reader is currently pointing to; or for a types-only reader gets the type it's currently pointing to.
If the reader is at the end of a block or end of a container such as an array, returns DBUS_TYPE_INVALID.
reader | the reader |
Definition at line 786 of file dbus-marshal-recursive.c.
References _dbus_assert, _dbus_first_type_in_signature(), _dbus_type_to_string(), DBusTypeReaderClass::check_finished, DBUS_DICT_ENTRY_BEGIN_CHAR, DBUS_DICT_ENTRY_END_CHAR, DBUS_STRUCT_BEGIN_CHAR, DBUS_STRUCT_END_CHAR, DBUS_TYPE_INVALID, DBusTypeReader::finished, DBusTypeReader::klass, DBusTypeReader::type_pos, and DBusTypeReader::type_str.
Referenced by _dbus_header_remove_unknown_fields(), _dbus_message_iter_get_args_valist(), _dbus_type_reader_get_element_type(), _dbus_type_reader_next(), _dbus_type_reader_read_basic(), _dbus_type_reader_set_basic(), dbus_message_iter_get_element_count(), and dbus_message_iter_get_fixed_array().
int _dbus_type_reader_get_element_type | ( | const DBusTypeReader * | reader | ) |
Gets the type of an element of the array the reader is currently pointing to.
It's an error to call this if _dbus_type_reader_get_current_type() doesn't return DBUS_TYPE_ARRAY for this reader.
reader | the reader |
Definition at line 821 of file dbus-marshal-recursive.c.
References _dbus_assert, _dbus_first_type_in_signature(), _dbus_type_reader_get_current_type(), DBUS_TYPE_ARRAY, DBusTypeReader::type_pos, and DBusTypeReader::type_str.
Referenced by _dbus_message_iter_get_args_valist(), and dbus_message_iter_get_element_count().
void _dbus_type_reader_get_signature | ( | const DBusTypeReader * | reader, |
const DBusString ** | str_p, | ||
int * | start_p, | ||
int * | len_p | ||
) |
Gets the string and range of said string containing the signature of the current value.
Essentially a more complete version of _dbus_type_reader_get_current_type() (returns the full type rather than only the outside of the onion).
Note though that the first byte in a struct signature is DBUS_STRUCT_BEGIN_CHAR while the current type will be DBUS_TYPE_STRUCT so it isn't true that the first byte of the signature is always the same as the current type. Another difference is that this function will still return a signature when inside an empty array; say you recurse into empty array of int32, the signature is "i" but the current type will always be DBUS_TYPE_INVALID since there are no elements to be currently pointing to.
reader | the reader |
str_p | place to return the string with the type in it |
start_p | place to return start of the type |
len_p | place to return the length of the type |
Definition at line 1125 of file dbus-marshal-recursive.c.
References DBusTypeReader::type_pos, and DBusTypeReader::type_str.
Referenced by dbus_message_iter_get_signature().
int _dbus_type_reader_get_value_pos | ( | const DBusTypeReader * | reader | ) |
Gets the current position in the value block.
reader | the reader |
Definition at line 838 of file dbus-marshal-recursive.c.
References DBusTypeReader::value_pos.
dbus_bool_t _dbus_type_reader_has_next | ( | const DBusTypeReader * | reader | ) |
Check whether there's another value on this "level".
e.g. the next field in a struct, the next value in an array. Returns FALSE at the end of the current container.
You probably don't want to use this; it makes for an awkward for/while loop. A nicer one is "while ((current_type = get_current_type()) != INVALID)"
reader | the reader |
Definition at line 1094 of file dbus-marshal-recursive.c.
void _dbus_type_reader_init | ( | DBusTypeReader * | reader, |
int | byte_order, | ||
const DBusString * | type_str, | ||
int | type_pos, | ||
const DBusString * | value_str, | ||
int | value_pos | ||
) |
Initializes a type reader.
reader | the reader |
byte_order | the byte order of the block to read |
type_str | the signature of the block to read |
type_pos | location of signature |
value_str | the string containing values block |
value_pos | start of values block |
Definition at line 733 of file dbus-marshal-recursive.c.
Referenced by _dbus_header_remove_unknown_fields().
void _dbus_type_reader_init_types_only | ( | DBusTypeReader * | reader, |
const DBusString * | type_str, | ||
int | type_pos | ||
) |
Like _dbus_type_reader_init() but the iteration is over the signature, not over values.
reader | the reader |
type_str | the signature string |
type_pos | location in the signature string |
Definition at line 761 of file dbus-marshal-recursive.c.
Referenced by _dbus_marshal_byteswap(), and _dbus_validate_body_with_reason().
dbus_bool_t _dbus_type_reader_next | ( | DBusTypeReader * | reader | ) |
Skip to the next value on this "level".
e.g. the next field in a struct, the next value in an array. Returns FALSE at the end of the current container.
reader | the reader |
Definition at line 1054 of file dbus-marshal-recursive.c.
References _dbus_type_reader_get_current_type(), _dbus_type_to_string(), DBUS_TYPE_INVALID, FALSE, DBusTypeReader::klass, DBusTypeReaderClass::next, DBusTypeReader::type_pos, DBusTypeReader::type_str, and DBusTypeReader::value_pos.
Referenced by _dbus_message_iter_get_args_valist(), and dbus_message_iter_get_element_count().
void _dbus_type_reader_read_basic | ( | const DBusTypeReader * | reader, |
void * | value | ||
) |
Reads a basic-typed value, as with _dbus_marshal_read_basic().
reader | the reader |
value | the address of the value |
Definition at line 870 of file dbus-marshal-recursive.c.
References _dbus_assert, _dbus_marshal_read_basic(), _dbus_type_reader_get_current_type(), DBusTypeReader::byte_order, DBusTypeReader::klass, NULL, DBusTypeReader::type_pos, DBusTypeReader::type_str, DBusTypeReaderClass::types_only, DBusTypeReader::value_pos, and DBusTypeReader::value_str.
Referenced by _dbus_header_remove_unknown_fields(), _dbus_message_iter_get_args_valist(), and dbus_message_iter_get_basic().
void _dbus_type_reader_read_fixed_multi | ( | const DBusTypeReader * | reader, |
const void ** | value, | ||
int * | n_elements | ||
) |
Reads a block of fixed-length basic values, from the current point in an array to the end of the array.
Does not work for arrays of string or container types.
This function returns the array in-place; it does not make a copy, and it does not swap the bytes.
If you ask for DBUS_TYPE_DOUBLE you will get a "const double*" back and the "value" argument should be a "const double**" and so on.
reader | the reader to read from |
value | place to return the array values |
n_elements | place to return number of array elements |
Definition at line 924 of file dbus-marshal-recursive.c.
References _dbus_assert, DBusTypeReader::klass, and DBusTypeReaderClass::types_only.
Referenced by _dbus_message_iter_get_args_valist(), and dbus_message_iter_get_fixed_array().
void _dbus_type_reader_read_raw | ( | const DBusTypeReader * | reader, |
const unsigned char ** | value_location | ||
) |
Get the address of the marshaled value in the data being read.
The address may not be aligned; you have to align it to the type of the value you want to read. Most of the demarshal routines do this for you.
reader | the reader |
value_location | the address of the marshaled value |
Definition at line 853 of file dbus-marshal-recursive.c.
References _dbus_assert, DBusTypeReader::klass, DBusTypeReaderClass::types_only, DBusTypeReader::value_pos, and DBusTypeReader::value_str.
void _dbus_type_reader_recurse | ( | DBusTypeReader * | reader, |
DBusTypeReader * | sub | ||
) |
Initialize a new reader pointing to the first type and corresponding value that's a child of the current container.
It's an error to call this if the current type is a non-container.
Note that DBusTypeReader traverses values, not types. So if you have an empty array of array of int, you can't recurse into it. You can only recurse into each element.
reader | the reader |
sub | a reader to init pointing to the first child |
Definition at line 988 of file dbus-marshal-recursive.c.
References _dbus_first_type_in_signature(), DBUS_TYPE_STRUCT, DBusTypeReader::klass, NULL, DBusTypeReader::type_pos, DBusTypeReader::type_str, and DBusTypeReaderClass::types_only.
Referenced by _dbus_header_remove_unknown_fields(), _dbus_message_iter_get_args_valist(), dbus_message_iter_get_element_count(), and dbus_message_iter_recurse().
dbus_bool_t _dbus_type_reader_set_basic | ( | DBusTypeReader * | reader, |
const void * | value, | ||
const DBusTypeReader * | realign_root | ||
) |
Sets a new value for the basic type value pointed to by the reader, leaving the reader valid to continue reading.
Any other readers will be invalidated if you set a variable-length type such as a string.
The provided realign_root is the reader to start from when realigning the data that follows the newly-set value. The reader parameter must point to a value below the realign_root parameter. If the type being set is fixed-length, then realign_root may be NULL. Only values reachable from realign_root will be realigned, so if your string contains other values you will need to deal with those somehow yourself. It is OK if realign_root is the same reader as the reader parameter, though if you aren't setting the root it may not be such a good idea.
reader | reader indicating where to set a new value |
value | address of the value to set |
realign_root | realign from here |
Definition at line 1363 of file dbus-marshal-recursive.c.
References _dbus_assert, _dbus_type_reader_get_current_type(), _dbus_type_to_string(), _dbus_verbose_bytes_of_string(), dbus_type_is_basic(), dbus_type_is_fixed(), DBusTypeReader::klass, DBusTypeReader::type_pos, DBusTypeReader::type_str, DBusTypeReaderClass::types_only, DBusTypeReader::value_pos, and DBusTypeReader::value_str.
void _dbus_type_signature_next | ( | const char * | type_str, |
int * | type_pos | ||
) |
Skips to the next "complete" type inside a type signature.
The signature is read starting at type_pos, and the next type position is stored in the same variable.
type_str | a type signature (must be valid) |
type_pos | an integer position in the type signature (in and out) |
Definition at line 341 of file dbus-marshal-recursive.c.
References _dbus_assert, DBUS_DICT_ENTRY_BEGIN_CHAR, DBUS_DICT_ENTRY_END_CHAR, DBUS_STRUCT_BEGIN_CHAR, DBUS_STRUCT_END_CHAR, DBUS_TYPE_ARRAY, DBUS_TYPE_INVALID, NULL, and TRUE.
Referenced by dbus_signature_iter_get_signature(), and dbus_signature_iter_next().
const char * _dbus_type_to_string | ( | int | typecode | ) |
Returns a string describing the given type.
typecode | the type to describe |
Definition at line 1282 of file dbus-marshal-basic.c.
References DBUS_DICT_ENTRY_BEGIN_CHAR, DBUS_DICT_ENTRY_END_CHAR, DBUS_STRUCT_BEGIN_CHAR, DBUS_STRUCT_END_CHAR, DBUS_TYPE_ARRAY, DBUS_TYPE_BOOLEAN, DBUS_TYPE_BYTE, DBUS_TYPE_DICT_ENTRY, DBUS_TYPE_DOUBLE, DBUS_TYPE_INT16, DBUS_TYPE_INT32, DBUS_TYPE_INT64, DBUS_TYPE_INVALID, DBUS_TYPE_OBJECT_PATH, DBUS_TYPE_SIGNATURE, DBUS_TYPE_STRING, DBUS_TYPE_STRUCT, DBUS_TYPE_UINT16, DBUS_TYPE_UINT32, DBUS_TYPE_UINT64, DBUS_TYPE_UNIX_FD, and DBUS_TYPE_VARIANT.
Referenced by _dbus_marshal_read_basic(), _dbus_marshal_skip_basic(), _dbus_marshal_write_fixed_multi(), _dbus_message_iter_get_args_valist(), _dbus_type_reader_get_current_type(), _dbus_type_reader_next(), _dbus_type_reader_set_basic(), _dbus_type_writer_unrecurse(), and dbus_message_append_args_valist().
void _dbus_type_writer_add_types | ( | DBusTypeWriter * | writer, |
DBusString * | type_str, | ||
int | type_pos | ||
) |
Adds type string to the writer, if it had none.
writer | the writer to init |
type_str | type string to add |
type_pos | type position |
Definition at line 1546 of file dbus-marshal-recursive.c.
References NULL, DBusTypeWriter::type_pos, and DBusTypeWriter::type_str.
dbus_bool_t _dbus_type_writer_append_array | ( | DBusTypeWriter * | writer, |
const DBusString * | contained_type, | ||
int | contained_type_start, | ||
DBusTypeWriter * | sub | ||
) |
Append to an existing array.
Essentially, the writer will read an existing length at the write location; jump over that length; and write new fields. On unrecurse(), the existing length will be updated.
writer | the writer |
contained_type | element type |
contained_type_start | position of element type |
sub | the subwriter to init |
Definition at line 2143 of file dbus-marshal-recursive.c.
void _dbus_type_writer_init | ( | DBusTypeWriter * | writer, |
int | byte_order, | ||
DBusString * | type_str, | ||
int | type_pos, | ||
DBusString * | value_str, | ||
int | value_pos | ||
) |
Initialize a write iterator, which is used to write out values in serialized D-Bus format.
The type_pos passed in is expected to be inside an already-valid, though potentially empty, type signature. This means that the byte after type_pos must be either DBUS_TYPE_INVALID (aka nul) or some other valid type. DBusTypeWriter won't enforce that the signature is already valid (you can append the nul byte at the end if you like), but just be aware that you need the nul byte eventually and DBusTypeWriter isn't going to write it for you.
writer | the writer to init |
byte_order | the byte order to marshal into |
type_str | the string to write typecodes into |
type_pos | where to insert typecodes |
value_str | the string to write values into |
value_pos | where to insert values |
Definition at line 1493 of file dbus-marshal-recursive.c.
References DBusTypeWriter::byte_order, DBusTypeWriter::container_type, DBUS_TYPE_INVALID, DBusTypeWriter::enabled, FALSE, TRUE, DBusTypeWriter::type_pos, DBusTypeWriter::type_pos_is_expectation, DBusTypeWriter::type_str, DBusTypeWriter::value_pos, and DBusTypeWriter::value_str.
Referenced by _dbus_type_writer_init_types_delayed(), and _dbus_type_writer_init_values_only().
void _dbus_type_writer_init_types_delayed | ( | DBusTypeWriter * | writer, |
int | byte_order, | ||
DBusString * | value_str, | ||
int | value_pos | ||
) |
Initialize a write iterator, with the signature to be provided later.
writer | the writer to init |
byte_order | the byte order to marshal into |
value_str | the string to write values into |
value_pos | where to insert values |
Definition at line 1528 of file dbus-marshal-recursive.c.
References _dbus_type_writer_init(), and NULL.
void _dbus_type_writer_init_values_only | ( | DBusTypeWriter * | writer, |
int | byte_order, | ||
const DBusString * | type_str, | ||
int | type_pos, | ||
DBusString * | value_str, | ||
int | value_pos | ||
) |
Like _dbus_type_writer_init(), except the type string passed in should correspond to an existing signature that matches what you're going to write out.
The writer will check what you write vs. this existing signature.
writer | the writer to init |
byte_order | the byte order to marshal into |
type_str | the string with signature |
type_pos | start of signature |
value_str | the string to write values into |
value_pos | where to insert values |
Definition at line 1584 of file dbus-marshal-recursive.c.
References _dbus_type_writer_init(), TRUE, and DBusTypeWriter::type_pos_is_expectation.
dbus_bool_t _dbus_type_writer_recurse | ( | DBusTypeWriter * | writer, |
int | container_type, | ||
const DBusString * | contained_type, | ||
int | contained_type_start, | ||
DBusTypeWriter * | sub | ||
) |
Opens a new container and writes out the initial information for that container.
writer | the writer |
container_type | the type of the container to open |
contained_type | the array element type or variant content type |
contained_type_start | position to look for the type |
sub | the new sub-writer to write container contents |
Definition at line 2109 of file dbus-marshal-recursive.c.
void _dbus_type_writer_remove_types | ( | DBusTypeWriter * | writer | ) |
Removes type string from the writer.
writer | the writer to remove from |
Definition at line 1563 of file dbus-marshal-recursive.c.
References NULL, DBusTypeWriter::type_pos, and DBusTypeWriter::type_str.
dbus_bool_t _dbus_type_writer_unrecurse | ( | DBusTypeWriter * | writer, |
DBusTypeWriter * | sub | ||
) |
Closes a container created by _dbus_type_writer_recurse() and writes any additional information to the values block.
writer | the writer |
sub | the sub-writer created by _dbus_type_writer_recurse() |
Definition at line 2179 of file dbus-marshal-recursive.c.
References _dbus_assert, _dbus_type_to_string(), DBusTypeWriter::container_type, DBUS_TYPE_STRUCT, DBusTypeWriter::type_pos, DBusTypeWriter::type_pos_is_expectation, and DBusTypeWriter::value_pos.
dbus_bool_t _dbus_type_writer_write_basic | ( | DBusTypeWriter * | writer, |
int | type, | ||
const void * | value | ||
) |
Writes out a basic type.
writer | the writer |
type | the type to write |
value | the address of the value to write |
Definition at line 2311 of file dbus-marshal-recursive.c.
References _dbus_string_alloc_space(), FALSE, NULL, DBusTypeWriter::type_pos_is_expectation, and DBusTypeWriter::type_str.
dbus_bool_t _dbus_type_writer_write_fixed_multi | ( | DBusTypeWriter * | writer, |
int | element_type, | ||
const void * | value, | ||
int | n_elements | ||
) |
Writes a block of fixed-length basic values, i.e.
those that are both dbus_type_is_fixed() and _dbus_type_is_basic(). The block must be written inside an array.
The value parameter should be the address of said array of values, so e.g. if it's an array of double, pass in "const double**"
writer | the writer |
element_type | type of stuff in the array |
value | address of the array |
n_elements | number of elements in the array |
Definition at line 2359 of file dbus-marshal-recursive.c.
References _dbus_assert, DBusTypeWriter::container_type, DBUS_TYPE_ARRAY, dbus_type_is_fixed(), DBusTypeWriter::type_pos, DBusTypeWriter::type_pos_is_expectation, and DBusTypeWriter::value_pos.
dbus_bool_t _dbus_type_writer_write_reader | ( | DBusTypeWriter * | writer, |
DBusTypeReader * | reader | ||
) |
Iterate through all values in the given reader, writing a copy of each value to the writer.
The reader will be moved forward to its end position.
writer | the writer to copy to |
reader | the reader to copy from |
Definition at line 2731 of file dbus-marshal-recursive.c.
dbus_uint16_t _dbus_unpack_uint16 | ( | int | byte_order, |
const unsigned char * | data | ||
) |
Unpacks a 16 bit unsigned integer from a data pointer.
byte_order | The byte order to use |
data | the data pointer |
Definition at line 179 of file dbus-marshal-basic.c.
References _dbus_assert, and DBUS_LITTLE_ENDIAN.
dbus_uint32_t _dbus_unpack_uint32 | ( | int | byte_order, |
const unsigned char * | data | ||
) |
Unpacks a 32 bit unsigned integer from a data pointer.
byte_order | The byte order to use |
data | the data pointer |
Definition at line 200 of file dbus-marshal-basic.c.
References _dbus_assert, and DBUS_LITTLE_ENDIAN.
Referenced by _dbus_marshal_read_uint32(), and _dbus_verbose_bytes().
DBUS_PRIVATE_EXPORT DBusValidity _dbus_validate_body_with_reason | ( | const DBusString * | expected_signature, |
int | expected_signature_start, | ||
int | byte_order, | ||
int * | bytes_remaining, | ||
const DBusString * | value_str, | ||
int | value_pos, | ||
int | len | ||
) |
Verifies that the range of value_str from value_pos to value_end is a legitimate value of type expected_signature.
If this function returns TRUE, it will be safe to iterate over the values with DBusTypeReader. The signature is assumed to be already valid.
If bytes_remaining is not NULL, then leftover bytes will be stored there and DBUS_VALID returned. If it is NULL, then DBUS_INVALID_TOO_MUCH_DATA will be returned if bytes are left over.
expected_signature | the expected types in the value_str |
expected_signature_start | where in expected_signature is the signature |
byte_order | the byte order |
bytes_remaining | place to store leftover bytes |
value_str | the string containing the body |
value_pos | where the values start |
len | length of values after value_pos |
Definition at line 755 of file dbus-marshal-validate.c.
References _dbus_assert, and _dbus_type_reader_init_types_only().
DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_validate_bus_name | ( | const DBusString * | str, |
int | start, | ||
int | len | ||
) |
Checks that the given range of the string is a valid bus name in the D-Bus protocol.
This includes a length restriction, etc., see the specification.
str | the string |
start | first byte index to check |
len | number of bytes to check |
Definition at line 1241 of file dbus-marshal-validate.c.
Referenced by dbus_validate_bus_name().
DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_validate_bus_namespace | ( | const DBusString * | str, |
int | start, | ||
int | len | ||
) |
Checks that the given range of the string is a prefix of a valid bus name in the D-Bus protocol.
Unlike _dbus_validate_bus_name(), this accepts strings with only one period-separated component.
str | the string |
start | first byte index to check |
len | number of bytes to check |
Definition at line 1262 of file dbus-marshal-validate.c.
DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_validate_error_name | ( | const DBusString * | str, |
int | start, | ||
int | len | ||
) |
Checks that the given range of the string is a valid error name in the D-Bus protocol.
This includes a length restriction, etc., see the specification.
str | the string |
start | first byte index to check |
len | number of bytes to check |
Definition at line 1112 of file dbus-marshal-validate.c.
References _dbus_validate_interface().
Referenced by dbus_validate_error_name().
DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_validate_interface | ( | const DBusString * | str, |
int | start, | ||
int | len | ||
) |
Checks that the given range of the string is a valid interface name in the D-Bus protocol.
This includes a length restriction and an ASCII subset, see the specification.
str | the string |
start | first byte index to check |
len | number of bytes to check |
Definition at line 975 of file dbus-marshal-validate.c.
References _dbus_assert, DBUS_MAXIMUM_NAME_LENGTH, FALSE, NULL, TRUE, VALID_INITIAL_NAME_CHARACTER, and VALID_NAME_CHARACTER.
Referenced by _dbus_validate_error_name(), and dbus_validate_interface().
DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_validate_member | ( | const DBusString * | str, |
int | start, | ||
int | len | ||
) |
Checks that the given range of the string is a valid member name in the D-Bus protocol.
This includes a length restriction, etc., see the specification.
str | the string |
start | first byte index to check |
len | number of bytes to check |
Definition at line 1051 of file dbus-marshal-validate.c.
References _dbus_assert, DBUS_MAXIMUM_NAME_LENGTH, FALSE, TRUE, VALID_INITIAL_NAME_CHARACTER, and VALID_NAME_CHARACTER.
Referenced by dbus_validate_member().
DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_validate_path | ( | const DBusString * | str, |
int | start, | ||
int | len | ||
) |
Checks that the given range of the string is a valid object path name in the D-Bus protocol.
Part of the validation ensures that the object path contains only ASCII.
str | the string |
start | first byte index to check |
len | number of bytes to check |
Definition at line 837 of file dbus-marshal-validate.c.
References _dbus_assert, FALSE, TRUE, and VALID_NAME_CHARACTER.
Referenced by dbus_validate_path().
DBUS_PRIVATE_EXPORT 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.
If this function returns TRUE, it will be safe to iterate over the signature with a types-only DBusTypeReader. The range passed in should NOT include the terminating nul/DBUS_TYPE_INVALID.
type_str | the string |
type_pos | where the typecodes start |
len | length of typecodes |
Definition at line 51 of file dbus-marshal-validate.c.
References _dbus_assert, _DBUS_INT32_MAX, _DBUS_INT_TO_POINTER, _dbus_list_append(), DBUS_MAXIMUM_SIGNATURE_LENGTH, DBUS_MAXIMUM_TYPE_RECURSION_DEPTH, DBUS_VALID, DBUS_VALIDITY_UNKNOWN_OOM_ERROR, and NULL.
Referenced by dbus_signature_validate().
const char * _dbus_validity_to_error_message | ( | DBusValidity | validity | ) |
Definition at line 889 of file dbus-marshal-validate.c.
void _dbus_verbose_bytes | ( | const unsigned char * | data, |
int | len, | ||
int | offset | ||
) |
If in verbose mode, print a block of binary data.
data | the data |
len | the length of the data |
offset | where to start counting for byte indexes |
Definition at line 1343 of file dbus-marshal-basic.c.
References _dbus_assert, _dbus_unpack_uint32(), DBUS_BIG_ENDIAN, and DBUS_LITTLE_ENDIAN.
Referenced by _dbus_verbose_bytes_of_string().
void _dbus_verbose_bytes_of_string | ( | const DBusString * | str, |
int | start, | ||
int | len | ||
) |
Dump the given part of the string to verbose log.
str | the string |
start | the start of range to dump |
len | length of range |
Definition at line 1421 of file dbus-marshal-basic.c.
References _dbus_assert, and _dbus_verbose_bytes().
Referenced by _dbus_read(), _dbus_read_socket(), _dbus_type_reader_set_basic(), _dbus_write(), and _dbus_write_socket().