dbus-marshal-recursive.h
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* dbus-marshal-recursive.h Marshalling routines for recursive types
*
* Copyright (C) 2004, 2005 Red Hat, Inc.
*
* Licensed under the Academic Free License version 2.1
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef DBUS_MARSHAL_RECURSIVE_H
#define DBUS_MARSHAL_RECURSIVE_H
#include <dbus/dbus-protocol.h>
#include <dbus/dbus-list.h>
typedef struct DBusTypeReader DBusTypeReader;
typedef struct DBusTypeWriter DBusTypeWriter;
typedef struct DBusTypeReaderClass DBusTypeReaderClass;
typedef struct DBusArrayLenFixup DBusArrayLenFixup;
struct DBusTypeReader
{
dbus_uint32_t byte_order : 8;
dbus_uint32_t finished : 1;
dbus_uint32_t array_len_offset : 3;
const DBusString *type_str;
int type_pos;
const DBusString *value_str;
int value_pos;
const DBusTypeReaderClass *klass;
union
{
struct {
int start_pos;
} array;
} u;
};
struct DBusTypeWriter
{
dbus_uint32_t byte_order : 8;
dbus_uint32_t container_type : 8;
dbus_uint32_t type_pos_is_expectation : 1;
dbus_uint32_t enabled : 1;
DBusString *type_str;
int type_pos;
DBusString *value_str;
int value_pos;
union
{
struct {
int start_pos;
int len_pos;
int element_type_pos;
} array;
} u;
};
struct DBusArrayLenFixup
{
int len_pos_in_reader;
int new_len;
};
void _dbus_type_reader_init (DBusTypeReader *reader,
int byte_order,
const DBusString *type_str,
int type_pos,
const DBusString *value_str,
int value_pos);
void _dbus_type_reader_init_types_only (DBusTypeReader *reader,
const DBusString *type_str,
int type_pos);
int _dbus_type_reader_get_current_type (const DBusTypeReader *reader);
int _dbus_type_reader_get_element_type (const DBusTypeReader *reader);
int _dbus_type_reader_get_value_pos (const DBusTypeReader *reader);
void _dbus_type_reader_read_basic (const DBusTypeReader *reader,
void *value);
int _dbus_type_reader_get_array_length (const DBusTypeReader *reader);
void _dbus_type_reader_read_fixed_multi (const DBusTypeReader *reader,
void *value,
int *n_elements);
void _dbus_type_reader_read_raw (const DBusTypeReader *reader,
const unsigned char **value_location);
void _dbus_type_reader_recurse (DBusTypeReader *reader,
DBusTypeReader *subreader);
dbus_bool_t _dbus_type_reader_next (DBusTypeReader *reader);
dbus_bool_t _dbus_type_reader_has_next (const DBusTypeReader *reader);
void _dbus_type_reader_get_signature (const DBusTypeReader *reader,
const DBusString **str_p,
int *start_p,
int *len_p);
dbus_bool_t _dbus_type_reader_set_basic (DBusTypeReader *reader,
const void *value,
const DBusTypeReader *realign_root);
dbus_bool_t _dbus_type_reader_delete (DBusTypeReader *reader,
const DBusTypeReader *realign_root);
dbus_bool_t _dbus_type_reader_equal_values (const DBusTypeReader *lhs,
const DBusTypeReader *rhs);
void _dbus_type_signature_next (const char *signature,
int *type_pos);
void _dbus_type_writer_init (DBusTypeWriter *writer,
int byte_order,
DBusString *type_str,
int type_pos,
DBusString *value_str,
int value_pos);
void _dbus_type_writer_init_types_delayed (DBusTypeWriter *writer,
int byte_order,
DBusString *value_str,
int value_pos);
void _dbus_type_writer_add_types (DBusTypeWriter *writer,
DBusString *type_str,
int type_pos);
void _dbus_type_writer_remove_types (DBusTypeWriter *writer);
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);
dbus_bool_t _dbus_type_writer_write_basic (DBusTypeWriter *writer,
int type,
const void *value);
dbus_bool_t _dbus_type_writer_write_fixed_multi (DBusTypeWriter *writer,
int element_type,
const void *value,
int n_elements);
dbus_bool_t _dbus_type_writer_recurse (DBusTypeWriter *writer,
int container_type,
const DBusString *contained_type,
int contained_type_start,
DBusTypeWriter *sub);
dbus_bool_t _dbus_type_writer_unrecurse (DBusTypeWriter *writer,
DBusTypeWriter *sub);
dbus_bool_t _dbus_type_writer_append_array (DBusTypeWriter *writer,
const DBusString *contained_type,
int contained_type_start,
DBusTypeWriter *sub);
dbus_bool_t _dbus_type_writer_write_reader (DBusTypeWriter *writer,
DBusTypeReader *reader);
#endif /* DBUS_MARSHAL_RECURSIVE_H */