dbus-marshal-recursive.h

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., 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 DBusTypeReader      DBusTypeReader;
00036 typedef struct DBusTypeWriter      DBusTypeWriter;
00037 typedef struct DBusTypeReaderClass DBusTypeReaderClass;
00038 typedef struct DBusArrayLenFixup   DBusArrayLenFixup;
00039 
00044 struct DBusTypeReader
00045 {
00046   dbus_uint32_t byte_order : 8; 
00048   dbus_uint32_t finished : 1;   
00051   dbus_uint32_t array_len_offset : 3; 
00052   const DBusString *type_str;   
00053   int type_pos;                 
00054   const DBusString *value_str;  
00055   int value_pos;                
00057   const DBusTypeReaderClass *klass; 
00058   union
00059   {
00060     struct {
00061       int start_pos;                
00062     } array;
00063   } u; 
00064 };
00065 
00069 struct DBusTypeWriter
00070 {
00071   dbus_uint32_t byte_order : 8;            
00073   dbus_uint32_t container_type : 8;        
00075   dbus_uint32_t type_pos_is_expectation : 1; 
00077   dbus_uint32_t enabled : 1; 
00079   DBusString *type_str; 
00080   int type_pos;         
00081   DBusString *value_str; 
00082   int value_pos;         
00084   union
00085   {
00086     struct {
00087       int start_pos; 
00088       int len_pos;   
00089       int element_type_pos; 
00090     } array;
00091   } u; 
00092 };
00093 
00098 struct DBusArrayLenFixup
00099 {
00100   int len_pos_in_reader; 
00101   int new_len;           
00102 };
00103 
00104 void        _dbus_type_reader_init                      (DBusTypeReader        *reader,
00105                                                          int                    byte_order,
00106                                                          const DBusString      *type_str,
00107                                                          int                    type_pos,
00108                                                          const DBusString      *value_str,
00109                                                          int                    value_pos);
00110 void        _dbus_type_reader_init_types_only           (DBusTypeReader        *reader,
00111                                                          const DBusString      *type_str,
00112                                                          int                    type_pos);
00113 int         _dbus_type_reader_get_current_type          (const DBusTypeReader  *reader);
00114 int         _dbus_type_reader_get_element_type          (const DBusTypeReader  *reader);
00115 int         _dbus_type_reader_get_value_pos             (const DBusTypeReader  *reader);
00116 void        _dbus_type_reader_read_basic                (const DBusTypeReader  *reader,
00117                                                          void                  *value);
00118 int         _dbus_type_reader_get_array_length          (const DBusTypeReader  *reader);
00119 void        _dbus_type_reader_read_fixed_multi          (const DBusTypeReader  *reader,
00120                                                          void                  *value,
00121                                                          int                   *n_elements);
00122 void        _dbus_type_reader_read_raw                  (const DBusTypeReader  *reader,
00123                                                          const unsigned char  **value_location);
00124 void        _dbus_type_reader_recurse                   (DBusTypeReader        *reader,
00125                                                          DBusTypeReader        *subreader);
00126 dbus_bool_t _dbus_type_reader_next                      (DBusTypeReader        *reader);
00127 dbus_bool_t _dbus_type_reader_has_next                  (const DBusTypeReader  *reader);
00128 void        _dbus_type_reader_get_signature             (const DBusTypeReader  *reader,
00129                                                          const DBusString     **str_p,
00130                                                          int                   *start_p,
00131                                                          int                   *len_p);
00132 dbus_bool_t _dbus_type_reader_set_basic                 (DBusTypeReader        *reader,
00133                                                          const void            *value,
00134                                                          const DBusTypeReader  *realign_root);
00135 dbus_bool_t _dbus_type_reader_delete                    (DBusTypeReader        *reader,
00136                                                          const DBusTypeReader  *realign_root);
00137 dbus_bool_t _dbus_type_reader_greater_than              (const DBusTypeReader  *lhs,
00138                                                          const DBusTypeReader  *rhs);
00139 
00140 dbus_bool_t _dbus_type_reader_equal_values              (const DBusTypeReader *lhs,
00141                                                          const DBusTypeReader *rhs);
00142 
00143 void        _dbus_type_signature_next                   (const char            *signature,
00144                                                          int                   *type_pos);
00145 
00146 void        _dbus_type_writer_init                 (DBusTypeWriter        *writer,
00147                                                     int                    byte_order,
00148                                                     DBusString            *type_str,
00149                                                     int                    type_pos,
00150                                                     DBusString            *value_str,
00151                                                     int                    value_pos);
00152 void        _dbus_type_writer_init_types_delayed   (DBusTypeWriter        *writer,
00153                                                     int                    byte_order,
00154                                                     DBusString            *value_str,
00155                                                     int                    value_pos);
00156 void        _dbus_type_writer_add_types            (DBusTypeWriter        *writer,
00157                                                     DBusString            *type_str,
00158                                                     int                    type_pos);
00159 void        _dbus_type_writer_remove_types         (DBusTypeWriter        *writer);
00160 void        _dbus_type_writer_init_values_only     (DBusTypeWriter        *writer,
00161                                                     int                    byte_order,
00162                                                     const DBusString      *type_str,
00163                                                     int                    type_pos,
00164                                                     DBusString            *value_str,
00165                                                     int                    value_pos);
00166 dbus_bool_t _dbus_type_writer_write_basic          (DBusTypeWriter        *writer,
00167                                                     int                    type,
00168                                                     const void            *value);
00169 dbus_bool_t _dbus_type_writer_write_fixed_multi    (DBusTypeWriter        *writer,
00170                                                     int                    element_type,
00171                                                     const void            *value,
00172                                                     int                    n_elements);
00173 dbus_bool_t _dbus_type_writer_recurse              (DBusTypeWriter        *writer,
00174                                                     int                    container_type,
00175                                                     const DBusString      *contained_type,
00176                                                     int                    contained_type_start,
00177                                                     DBusTypeWriter        *sub);
00178 dbus_bool_t _dbus_type_writer_unrecurse            (DBusTypeWriter        *writer,
00179                                                     DBusTypeWriter        *sub);
00180 dbus_bool_t _dbus_type_writer_append_array         (DBusTypeWriter        *writer,
00181                                                     const DBusString      *contained_type,
00182                                                     int                    contained_type_start,
00183                                                     DBusTypeWriter        *sub);
00184 dbus_bool_t _dbus_type_writer_write_reader         (DBusTypeWriter        *writer,
00185                                                     DBusTypeReader        *reader);
00186 dbus_bool_t _dbus_type_writer_write_reader_partial (DBusTypeWriter        *writer,
00187                                                     DBusTypeReader        *reader,
00188                                                     const DBusTypeReader  *start_after,
00189                                                     int                    start_after_new_pos,
00190                                                     int                    start_after_new_len,
00191                                                     DBusList             **fixups);
00192 void        _dbus_type_writer_set_enabled          (DBusTypeWriter        *writer,
00193                                                     dbus_bool_t            enabled);
00194 
00195 
00196 #endif /* DBUS_MARSHAL_RECURSIVE_H */

Generated on Sat Dec 6 19:43:43 2008 for D-Bus by  doxygen 1.5.1