• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List

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., 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 dbus_bool_t _dbus_type_reader_greater_than              (const DBusTypeReader  *lhs,
00133                                                          const DBusTypeReader  *rhs);
00134 
00135 dbus_bool_t _dbus_type_reader_equal_values              (const DBusTypeReader *lhs,
00136                                                          const DBusTypeReader *rhs);
00137 
00138 void        _dbus_type_signature_next                   (const char            *signature,
00139                                                          int                   *type_pos);
00140 
00141 void        _dbus_type_writer_init                 (DBusTypeWriter        *writer,
00142                                                     int                    byte_order,
00143                                                     DBusString            *type_str,
00144                                                     int                    type_pos,
00145                                                     DBusString            *value_str,
00146                                                     int                    value_pos);
00147 void        _dbus_type_writer_init_types_delayed   (DBusTypeWriter        *writer,
00148                                                     int                    byte_order,
00149                                                     DBusString            *value_str,
00150                                                     int                    value_pos);
00151 void        _dbus_type_writer_add_types            (DBusTypeWriter        *writer,
00152                                                     DBusString            *type_str,
00153                                                     int                    type_pos);
00154 void        _dbus_type_writer_remove_types         (DBusTypeWriter        *writer);
00155 void        _dbus_type_writer_init_values_only     (DBusTypeWriter        *writer,
00156                                                     int                    byte_order,
00157                                                     const DBusString      *type_str,
00158                                                     int                    type_pos,
00159                                                     DBusString            *value_str,
00160                                                     int                    value_pos);
00161 dbus_bool_t _dbus_type_writer_write_basic          (DBusTypeWriter        *writer,
00162                                                     int                    type,
00163                                                     const void            *value);
00164 dbus_bool_t _dbus_type_writer_write_fixed_multi    (DBusTypeWriter        *writer,
00165                                                     int                    element_type,
00166                                                     const void            *value,
00167                                                     int                    n_elements);
00168 dbus_bool_t _dbus_type_writer_recurse              (DBusTypeWriter        *writer,
00169                                                     int                    container_type,
00170                                                     const DBusString      *contained_type,
00171                                                     int                    contained_type_start,
00172                                                     DBusTypeWriter        *sub);
00173 dbus_bool_t _dbus_type_writer_unrecurse            (DBusTypeWriter        *writer,
00174                                                     DBusTypeWriter        *sub);
00175 dbus_bool_t _dbus_type_writer_append_array         (DBusTypeWriter        *writer,
00176                                                     const DBusString      *contained_type,
00177                                                     int                    contained_type_start,
00178                                                     DBusTypeWriter        *sub);
00179 dbus_bool_t _dbus_type_writer_write_reader         (DBusTypeWriter        *writer,
00180                                                     DBusTypeReader        *reader);
00181 dbus_bool_t _dbus_type_writer_write_reader_partial (DBusTypeWriter        *writer,
00182                                                     DBusTypeReader        *reader,
00183                                                     const DBusTypeReader  *start_after,
00184                                                     int                    start_after_new_pos,
00185                                                     int                    start_after_new_len,
00186                                                     DBusList             **fixups);
00187 void        _dbus_type_writer_set_enabled          (DBusTypeWriter        *writer,
00188                                                     dbus_bool_t            enabled);
00189 
00190 
00191 #endif /* DBUS_MARSHAL_RECURSIVE_H */

Generated on Mon Sep 6 2010 for D-Bus by  doxygen 1.7.1