D-Bus 1.6.12
|
00001 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ 00002 /* dbus-marshal-recursive.h Marshalling routines for recursive types 00003 * 00004 * Copyright (C) 2004, 2005 Red Hat, Inc. 00005 * 00006 * Licensed under the Academic Free License version 2.1 00007 * 00008 * This program is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation; either version 2 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * This program is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with this program; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00021 * 00022 */ 00023 00024 #ifndef DBUS_MARSHAL_RECURSIVE_H 00025 #define DBUS_MARSHAL_RECURSIVE_H 00026 00027 #include <dbus/dbus-protocol.h> 00028 #include <dbus/dbus-list.h> 00029 00030 typedef struct DBusTypeReader DBusTypeReader; 00031 typedef struct DBusTypeWriter DBusTypeWriter; 00032 typedef struct DBusTypeReaderClass DBusTypeReaderClass; 00033 typedef struct DBusArrayLenFixup DBusArrayLenFixup; 00034 00039 struct DBusTypeReader 00040 { 00041 dbus_uint32_t byte_order : 8; 00043 dbus_uint32_t finished : 1; 00046 dbus_uint32_t array_len_offset : 3; 00047 const DBusString *type_str; 00048 int type_pos; 00049 const DBusString *value_str; 00050 int value_pos; 00052 const DBusTypeReaderClass *klass; 00053 union 00054 { 00055 struct { 00056 int start_pos; 00057 } array; 00058 } u; 00059 }; 00060 00064 struct DBusTypeWriter 00065 { 00066 dbus_uint32_t byte_order : 8; 00068 dbus_uint32_t container_type : 8; 00070 dbus_uint32_t type_pos_is_expectation : 1; 00072 dbus_uint32_t enabled : 1; 00074 DBusString *type_str; 00075 int type_pos; 00076 DBusString *value_str; 00077 int value_pos; 00079 union 00080 { 00081 struct { 00082 int start_pos; 00083 int len_pos; 00084 int element_type_pos; 00085 } array; 00086 } u; 00087 }; 00088 00093 struct DBusArrayLenFixup 00094 { 00095 int len_pos_in_reader; 00096 int new_len; 00097 }; 00098 00099 void _dbus_type_reader_init (DBusTypeReader *reader, 00100 int byte_order, 00101 const DBusString *type_str, 00102 int type_pos, 00103 const DBusString *value_str, 00104 int value_pos); 00105 void _dbus_type_reader_init_types_only (DBusTypeReader *reader, 00106 const DBusString *type_str, 00107 int type_pos); 00108 int _dbus_type_reader_get_current_type (const DBusTypeReader *reader); 00109 int _dbus_type_reader_get_element_type (const DBusTypeReader *reader); 00110 int _dbus_type_reader_get_value_pos (const DBusTypeReader *reader); 00111 void _dbus_type_reader_read_basic (const DBusTypeReader *reader, 00112 void *value); 00113 int _dbus_type_reader_get_array_length (const DBusTypeReader *reader); 00114 void _dbus_type_reader_read_fixed_multi (const DBusTypeReader *reader, 00115 void *value, 00116 int *n_elements); 00117 void _dbus_type_reader_read_raw (const DBusTypeReader *reader, 00118 const unsigned char **value_location); 00119 void _dbus_type_reader_recurse (DBusTypeReader *reader, 00120 DBusTypeReader *subreader); 00121 dbus_bool_t _dbus_type_reader_next (DBusTypeReader *reader); 00122 dbus_bool_t _dbus_type_reader_has_next (const DBusTypeReader *reader); 00123 void _dbus_type_reader_get_signature (const DBusTypeReader *reader, 00124 const DBusString **str_p, 00125 int *start_p, 00126 int *len_p); 00127 dbus_bool_t _dbus_type_reader_set_basic (DBusTypeReader *reader, 00128 const void *value, 00129 const DBusTypeReader *realign_root); 00130 dbus_bool_t _dbus_type_reader_delete (DBusTypeReader *reader, 00131 const DBusTypeReader *realign_root); 00132 00133 dbus_bool_t _dbus_type_reader_equal_values (const DBusTypeReader *lhs, 00134 const DBusTypeReader *rhs); 00135 00136 void _dbus_type_signature_next (const char *signature, 00137 int *type_pos); 00138 00139 void _dbus_type_writer_init (DBusTypeWriter *writer, 00140 int byte_order, 00141 DBusString *type_str, 00142 int type_pos, 00143 DBusString *value_str, 00144 int value_pos); 00145 void _dbus_type_writer_init_types_delayed (DBusTypeWriter *writer, 00146 int byte_order, 00147 DBusString *value_str, 00148 int value_pos); 00149 void _dbus_type_writer_add_types (DBusTypeWriter *writer, 00150 DBusString *type_str, 00151 int type_pos); 00152 void _dbus_type_writer_remove_types (DBusTypeWriter *writer); 00153 void _dbus_type_writer_init_values_only (DBusTypeWriter *writer, 00154 int byte_order, 00155 const DBusString *type_str, 00156 int type_pos, 00157 DBusString *value_str, 00158 int value_pos); 00159 dbus_bool_t _dbus_type_writer_write_basic (DBusTypeWriter *writer, 00160 int type, 00161 const void *value); 00162 dbus_bool_t _dbus_type_writer_write_fixed_multi (DBusTypeWriter *writer, 00163 int element_type, 00164 const void *value, 00165 int n_elements); 00166 dbus_bool_t _dbus_type_writer_recurse (DBusTypeWriter *writer, 00167 int container_type, 00168 const DBusString *contained_type, 00169 int contained_type_start, 00170 DBusTypeWriter *sub); 00171 dbus_bool_t _dbus_type_writer_unrecurse (DBusTypeWriter *writer, 00172 DBusTypeWriter *sub); 00173 dbus_bool_t _dbus_type_writer_append_array (DBusTypeWriter *writer, 00174 const DBusString *contained_type, 00175 int contained_type_start, 00176 DBusTypeWriter *sub); 00177 dbus_bool_t _dbus_type_writer_write_reader (DBusTypeWriter *writer, 00178 DBusTypeReader *reader); 00179 00180 00181 #endif /* DBUS_MARSHAL_RECURSIVE_H */