Main Page | Modules | Data Structures | Directories | File List | Data Fields | Related Pages

dbus-marshal-recursive.h

00001 /* -*- mode: C; c-file-style: "gnu" -*- */
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021  *
00022  */
00023 
00024 #ifndef DBUS_MARSHAL_RECURSIVE_H
00025 #define DBUS_MARSHAL_RECURSIVE_H
00026 
00027 #include <config.h>
00028 #include <dbus/dbus-protocol.h>
00029 #include <dbus/dbus-list.h>
00030 
00031 #ifndef PACKAGE
00032 #error "config.h not included here"
00033 #endif
00034 
00035 typedef struct DBusTypeMark        DBusTypeMark;
00036 typedef struct DBusTypeReader      DBusTypeReader;
00037 typedef struct DBusTypeWriter      DBusTypeWriter;
00038 typedef struct DBusTypeReaderClass DBusTypeReaderClass;
00039 typedef struct DBusArrayLenFixup   DBusArrayLenFixup;
00040 
00051 struct DBusTypeMark
00052 {
00053   dbus_uint32_t type_pos_in_value_str : 1; 
00054   dbus_uint32_t container_type : 3; 
00055   dbus_uint32_t array_len_offset : 3; 
00056   dbus_uint32_t type_pos : DBUS_MAXIMUM_MESSAGE_LENGTH_BITS; 
00057   dbus_uint32_t value_pos : DBUS_MAXIMUM_MESSAGE_LENGTH_BITS; 
00058   dbus_uint32_t array_start_pos : DBUS_MAXIMUM_MESSAGE_LENGTH_BITS; 
00059 };
00060 
00065 struct DBusTypeReader
00066 {
00067   dbus_uint32_t byte_order : 8; 
00069   dbus_uint32_t finished : 1;   
00072   dbus_uint32_t array_len_offset : 3; 
00073   const DBusString *type_str;   
00074   int type_pos;                 
00075   const DBusString *value_str;  
00076   int value_pos;                
00078   const DBusTypeReaderClass *klass; 
00079   union
00080   {
00081     struct {
00082       int start_pos;                
00083     } array;
00084   } u; 
00085 };
00086 
00090 struct DBusTypeWriter
00091 {
00092   dbus_uint32_t byte_order : 8;            
00094   dbus_uint32_t container_type : 8;        
00096   dbus_uint32_t type_pos_is_expectation : 1; 
00098   dbus_uint32_t enabled : 1; 
00100   DBusString *type_str; 
00101   int type_pos;         
00102   DBusString *value_str; 
00103   int value_pos;         
00105   union
00106   {
00107     struct {
00108       int start_pos; 
00109       int len_pos;   
00110       int element_type_pos; 
00111     } array;
00112   } u; 
00113 };
00114 
00119 struct DBusArrayLenFixup
00120 {
00121   int len_pos_in_reader; 
00122   int new_len;           
00123 };
00124 
00125 void        _dbus_type_reader_init                      (DBusTypeReader        *reader,
00126                                                          int                    byte_order,
00127                                                          const DBusString      *type_str,
00128                                                          int                    type_pos,
00129                                                          const DBusString      *value_str,
00130                                                          int                    value_pos);
00131 void        _dbus_type_reader_init_from_mark            (DBusTypeReader        *reader,
00132                                                          int                    byte_order,
00133                                                          const DBusString      *type_str,
00134                                                          const DBusString      *value_str,
00135                                                          const DBusTypeMark    *mark);
00136 void        _dbus_type_reader_init_types_only           (DBusTypeReader        *reader,
00137                                                          const DBusString      *type_str,
00138                                                          int                    type_pos);
00139 void        _dbus_type_reader_init_types_only_from_mark (DBusTypeReader        *reader,
00140                                                          const DBusString      *type_str,
00141                                                          const DBusTypeMark    *mark);
00142 void        _dbus_type_reader_save_mark                 (const DBusTypeReader  *reader,
00143                                                          DBusTypeMark          *mark);
00144 int         _dbus_type_reader_get_current_type          (const DBusTypeReader  *reader);
00145 int         _dbus_type_reader_get_element_type          (const DBusTypeReader  *reader);
00146 int         _dbus_type_reader_get_value_pos             (const DBusTypeReader  *reader);
00147 void        _dbus_type_reader_read_basic                (const DBusTypeReader  *reader,
00148                                                          void                  *value);
00149 int         _dbus_type_reader_get_array_length          (const DBusTypeReader  *reader);
00150 void        _dbus_type_reader_read_fixed_multi          (const DBusTypeReader  *reader,
00151                                                          void                  *value,
00152                                                          int                   *n_elements);
00153 void        _dbus_type_reader_read_raw                  (const DBusTypeReader  *reader,
00154                                                          const unsigned char  **value_location);
00155 void        _dbus_type_reader_recurse                   (DBusTypeReader        *reader,
00156                                                          DBusTypeReader        *subreader);
00157 dbus_bool_t _dbus_type_reader_next                      (DBusTypeReader        *reader);
00158 dbus_bool_t _dbus_type_reader_has_next                  (const DBusTypeReader  *reader);
00159 void        _dbus_type_reader_get_signature             (const DBusTypeReader  *reader,
00160                                                          const DBusString     **str_p,
00161                                                          int                   *start_p,
00162                                                          int                   *len_p);
00163 dbus_bool_t _dbus_type_reader_set_basic                 (DBusTypeReader        *reader,
00164                                                          const void            *value,
00165                                                          const DBusTypeReader  *realign_root);
00166 dbus_bool_t _dbus_type_reader_delete                    (DBusTypeReader        *reader,
00167                                                          const DBusTypeReader  *realign_root);
00168 dbus_bool_t _dbus_type_reader_greater_than              (const DBusTypeReader  *lhs,
00169                                                          const DBusTypeReader  *rhs);
00170 
00171 dbus_bool_t _dbus_type_reader_equal_values              (const DBusTypeReader *lhs,
00172                                                          const DBusTypeReader *rhs);
00173 
00174 void        _dbus_type_signature_next                   (const char            *signature,
00175                                                          int                   *type_pos);
00176 
00177 void        _dbus_type_writer_init                 (DBusTypeWriter        *writer,
00178                                                     int                    byte_order,
00179                                                     DBusString            *type_str,
00180                                                     int                    type_pos,
00181                                                     DBusString            *value_str,
00182                                                     int                    value_pos);
00183 void        _dbus_type_writer_init_types_delayed   (DBusTypeWriter        *writer,
00184                                                     int                    byte_order,
00185                                                     DBusString            *value_str,
00186                                                     int                    value_pos);
00187 void        _dbus_type_writer_add_types            (DBusTypeWriter        *writer,
00188                                                     DBusString            *type_str,
00189                                                     int                    type_pos);
00190 void        _dbus_type_writer_remove_types         (DBusTypeWriter        *writer);
00191 void        _dbus_type_writer_init_values_only     (DBusTypeWriter        *writer,
00192                                                     int                    byte_order,
00193                                                     const DBusString      *type_str,
00194                                                     int                    type_pos,
00195                                                     DBusString            *value_str,
00196                                                     int                    value_pos);
00197 dbus_bool_t _dbus_type_writer_write_basic          (DBusTypeWriter        *writer,
00198                                                     int                    type,
00199                                                     const void            *value);
00200 dbus_bool_t _dbus_type_writer_write_fixed_multi    (DBusTypeWriter        *writer,
00201                                                     int                    element_type,
00202                                                     const void            *value,
00203                                                     int                    n_elements);
00204 dbus_bool_t _dbus_type_writer_recurse              (DBusTypeWriter        *writer,
00205                                                     int                    container_type,
00206                                                     const DBusString      *contained_type,
00207                                                     int                    contained_type_start,
00208                                                     DBusTypeWriter        *sub);
00209 dbus_bool_t _dbus_type_writer_unrecurse            (DBusTypeWriter        *writer,
00210                                                     DBusTypeWriter        *sub);
00211 dbus_bool_t _dbus_type_writer_append_array         (DBusTypeWriter        *writer,
00212                                                     const DBusString      *contained_type,
00213                                                     int                    contained_type_start,
00214                                                     DBusTypeWriter        *sub);
00215 dbus_bool_t _dbus_type_writer_write_reader         (DBusTypeWriter        *writer,
00216                                                     DBusTypeReader        *reader);
00217 dbus_bool_t _dbus_type_writer_write_reader_partial (DBusTypeWriter        *writer,
00218                                                     DBusTypeReader        *reader,
00219                                                     const DBusTypeReader  *start_after,
00220                                                     int                    start_after_new_pos,
00221                                                     int                    start_after_new_len,
00222                                                     DBusList             **fixups);
00223 void        _dbus_type_writer_set_enabled          (DBusTypeWriter        *writer,
00224                                                     dbus_bool_t            enabled);
00225 
00226 
00227 #endif /* DBUS_MARSHAL_RECURSIVE_H */

Generated on Fri Sep 30 19:45:36 2005 for D-BUS by  doxygen 1.4.4