1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
/* -*- mode: C; c-file-style: "gnu" -*- */
/* dbus-marshal-recursive.h Marshalling routines for recursive types
*
* Copyright (C) 2004 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef DBUS_MARSHAL_RECURSIVE_H
#define DBUS_MARSHAL_RECURSIVE_H
#include <config.h>
#include <dbus/dbus-marshal-basic.h>
#ifndef PACKAGE
#error "config.h not included here"
#endif
typedef struct DBusTypeReader DBusTypeReader;
typedef struct DBusTypeWriter DBusTypeWriter;
typedef struct DBusTypeReaderClass DBusTypeReaderClass;
struct DBusTypeReader
{
int byte_order;
const DBusString *type_str;
int type_pos;
const DBusString *value_str;
int value_pos;
const DBusTypeReaderClass *klass;
union
{
struct {
int start_pos;
dbus_uint32_t len;
int element_type;
} array;
struct {
dbus_uint32_t finished : 1;
} strct;
} u;
};
struct DBusTypeWriter
{
int byte_order;
DBusString *type_str;
int type_pos;
DBusString *value_str;
int value_pos;
dbus_uint32_t type_pos_is_expectation : 1; /* type_pos is an insertion point or an expected next type */
dbus_uint32_t container_type : 8;
union
{
struct {
int start_pos; /* first element */
int len_pos;
int element_type_pos; /* position of array element type in type_str */
} array;
} u;
};
void _dbus_type_reader_init (DBusTypeReader *reader,
int byte_order,
const DBusString *type_str,
int type_pos,
const DBusString *value_str,
int value_pos);
int _dbus_type_reader_get_current_type (DBusTypeReader *reader);
dbus_bool_t _dbus_type_reader_array_is_empty (DBusTypeReader *reader);
void _dbus_type_reader_read_basic (DBusTypeReader *reader,
void *value);
dbus_bool_t _dbus_type_reader_read_array_of_basic (DBusTypeReader *reader,
int type,
void **array,
int *array_len);
void _dbus_type_reader_recurse (DBusTypeReader *reader,
DBusTypeReader *subreader);
dbus_bool_t _dbus_type_reader_next (DBusTypeReader *reader);
void _dbus_type_writer_init (DBusTypeWriter *writer,
int byte_order,
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_array (DBusTypeWriter *writer,
int type,
const void *array,
int array_len);
dbus_bool_t _dbus_type_writer_recurse_struct (DBusTypeWriter *writer,
DBusTypeWriter *sub);
dbus_bool_t _dbus_type_writer_recurse_array (DBusTypeWriter *writer,
const char *element_type,
DBusTypeWriter *sub);
dbus_bool_t _dbus_type_writer_recurse_variant (DBusTypeWriter *writer,
const char *contained_type,
DBusTypeWriter *sub);
dbus_bool_t _dbus_type_writer_unrecurse (DBusTypeWriter *writer,
DBusTypeWriter *sub);
#endif /* DBUS_MARSHAL_RECURSIVE_H */
|