dbus-message.h

00001 /* -*- mode: C; c-file-style: "gnu" -*- */
00002 /* dbus-message.h DBusMessage object
00003  *
00004  * Copyright (C) 2002, 2003, 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 #if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
00024 #error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
00025 #endif
00026 
00027 #ifndef DBUS_MESSAGE_H
00028 #define DBUS_MESSAGE_H
00029 
00030 #include <dbus/dbus-macros.h>
00031 #include <dbus/dbus-types.h>
00032 #include <dbus/dbus-arch-deps.h>
00033 #include <dbus/dbus-memory.h>
00034 #include <dbus/dbus-errors.h>
00035 #include <stdarg.h>
00036 
00037 DBUS_BEGIN_DECLS
00038 
00044 typedef struct DBusMessage DBusMessage;
00046 typedef struct DBusMessageIter DBusMessageIter;
00047 
00051 struct DBusMessageIter
00052 { 
00053   void *dummy1;         
00054   void *dummy2;         
00055   dbus_uint32_t dummy3; 
00056   int dummy4;           
00057   int dummy5;           
00058   int dummy6;           
00059   int dummy7;           
00060   int dummy8;           
00061   int dummy9;           
00062   int dummy10;          
00063   int dummy11;          
00064   int pad1;             
00065   int pad2;             
00066   void *pad3;           
00067 };
00068 
00069 DBusMessage* dbus_message_new               (int          message_type);
00070 DBusMessage* dbus_message_new_method_call   (const char  *bus_name,
00071                                              const char  *path,
00072                                              const char  *interface,
00073                                              const char  *method);
00074 DBusMessage* dbus_message_new_method_return (DBusMessage *method_call);
00075 DBusMessage* dbus_message_new_signal        (const char  *path,
00076                                              const char  *interface,
00077                                              const char  *name);
00078 DBusMessage* dbus_message_new_error         (DBusMessage *reply_to,
00079                                              const char  *error_name,
00080                                              const char  *error_message);
00081 DBusMessage* dbus_message_new_error_printf  (DBusMessage *reply_to,
00082                                              const char  *error_name,
00083                                              const char  *error_format,
00084                                              ...);
00085 
00086 DBusMessage* dbus_message_copy              (const DBusMessage *message);
00087 
00088 DBusMessage*  dbus_message_ref              (DBusMessage   *message);
00089 void          dbus_message_unref            (DBusMessage   *message);
00090 int           dbus_message_get_type         (DBusMessage   *message);
00091 dbus_bool_t   dbus_message_set_path         (DBusMessage   *message,
00092                                              const char    *object_path);
00093 const char*   dbus_message_get_path         (DBusMessage   *message);
00094 dbus_bool_t   dbus_message_has_path         (DBusMessage   *message, 
00095                                              const char    *object_path);  
00096 dbus_bool_t   dbus_message_set_interface    (DBusMessage   *message,
00097                                              const char    *interface);       
00098 const char*   dbus_message_get_interface    (DBusMessage   *message);
00099 dbus_bool_t   dbus_message_has_interface    (DBusMessage   *message, 
00100                                              const char    *interface);
00101 dbus_bool_t   dbus_message_set_member       (DBusMessage   *message,
00102                                              const char    *member);
00103 const char*   dbus_message_get_member       (DBusMessage   *message);
00104 dbus_bool_t   dbus_message_has_member       (DBusMessage   *message, 
00105                                              const char    *member);
00106 dbus_bool_t   dbus_message_set_error_name   (DBusMessage   *message,
00107                                              const char    *name);
00108 const char*   dbus_message_get_error_name   (DBusMessage   *message);
00109 dbus_bool_t   dbus_message_set_destination  (DBusMessage   *message,
00110                                              const char    *destination);
00111 const char*   dbus_message_get_destination  (DBusMessage   *message);
00112 dbus_bool_t   dbus_message_set_sender       (DBusMessage   *message,
00113                                              const char    *sender);
00114 const char*   dbus_message_get_sender       (DBusMessage   *message);
00115 const char*   dbus_message_get_signature    (DBusMessage   *message);
00116 void          dbus_message_set_no_reply     (DBusMessage   *message,
00117                                              dbus_bool_t    no_reply);
00118 dbus_bool_t   dbus_message_get_no_reply     (DBusMessage   *message);
00119 dbus_bool_t   dbus_message_is_method_call   (DBusMessage   *message,
00120                                              const char    *interface,
00121                                              const char    *method);
00122 dbus_bool_t   dbus_message_is_signal        (DBusMessage   *message,
00123                                              const char    *interface,
00124                                              const char    *signal_name);
00125 dbus_bool_t   dbus_message_is_error         (DBusMessage   *message,
00126                                              const char    *error_name);
00127 dbus_bool_t   dbus_message_has_destination  (DBusMessage   *message,
00128                                              const char    *bus_name);
00129 dbus_bool_t   dbus_message_has_sender       (DBusMessage   *message,
00130                                              const char    *unique_bus_name);
00131 dbus_bool_t   dbus_message_has_signature    (DBusMessage   *message,
00132                                              const char    *signature);
00133 dbus_uint32_t dbus_message_get_serial       (DBusMessage   *message);
00134 dbus_bool_t   dbus_message_set_reply_serial (DBusMessage   *message,
00135                                              dbus_uint32_t  reply_serial);
00136 dbus_uint32_t dbus_message_get_reply_serial (DBusMessage   *message);
00137 
00138 void          dbus_message_set_auto_start   (DBusMessage   *message,
00139                                              dbus_bool_t    auto_start);
00140 dbus_bool_t   dbus_message_get_auto_start   (DBusMessage   *message);
00141 
00142 dbus_bool_t   dbus_message_get_path_decomposed (DBusMessage   *message,
00143                                                 char        ***path);
00144 
00145 dbus_bool_t dbus_message_append_args          (DBusMessage     *message,
00146                                                int              first_arg_type,
00147                                                ...);
00148 dbus_bool_t dbus_message_append_args_valist   (DBusMessage     *message,
00149                                                int              first_arg_type,
00150                                                va_list          var_args);
00151 dbus_bool_t dbus_message_get_args             (DBusMessage     *message,
00152                                                DBusError       *error,
00153                                                int              first_arg_type,
00154                                                ...);
00155 dbus_bool_t dbus_message_get_args_valist      (DBusMessage     *message,
00156                                                DBusError       *error,
00157                                                int              first_arg_type,
00158                                                va_list          var_args);
00159 
00160 
00161 dbus_bool_t dbus_message_iter_init             (DBusMessage     *message,
00162                                                 DBusMessageIter *iter);
00163 dbus_bool_t dbus_message_iter_has_next         (DBusMessageIter *iter);
00164 dbus_bool_t dbus_message_iter_next             (DBusMessageIter *iter);
00165 char*       dbus_message_iter_get_signature    (DBusMessageIter *iter);
00166 int         dbus_message_iter_get_arg_type     (DBusMessageIter *iter);
00167 int         dbus_message_iter_get_element_type (DBusMessageIter *iter);
00168 void        dbus_message_iter_recurse          (DBusMessageIter *iter,
00169                                                 DBusMessageIter *sub);
00170 void        dbus_message_iter_get_basic        (DBusMessageIter *iter,
00171                                                 void            *value);
00172 #ifndef DBUS_DISABLE_DEPRECATED
00173 /* This function returns the wire protocol size of the array in bytes,
00174  * you do not want to know that probably
00175  */
00176 int         dbus_message_iter_get_array_len    (DBusMessageIter *iter) DBUS_GNUC_DEPRECATED;
00177 #endif
00178 void        dbus_message_iter_get_fixed_array  (DBusMessageIter *iter,
00179                                                 void            *value,
00180                                                 int             *n_elements);
00181 
00182 
00183 void        dbus_message_iter_init_append        (DBusMessage     *message,
00184                                                   DBusMessageIter *iter);
00185 dbus_bool_t dbus_message_iter_append_basic       (DBusMessageIter *iter,
00186                                                   int              type,
00187                                                   const void      *value);
00188 dbus_bool_t dbus_message_iter_append_fixed_array (DBusMessageIter *iter,
00189                                                   int              element_type,
00190                                                   const void      *value,
00191                                                   int              n_elements);
00192 dbus_bool_t dbus_message_iter_open_container     (DBusMessageIter *iter,
00193                                                   int              type,
00194                                                   const char      *contained_signature,
00195                                                   DBusMessageIter *sub);
00196 dbus_bool_t dbus_message_iter_close_container    (DBusMessageIter *iter,
00197                                                   DBusMessageIter *sub);
00198 
00199 
00200 dbus_bool_t  dbus_set_error_from_message  (DBusError    *error,
00201                                            DBusMessage  *message);
00202 
00203 
00204 dbus_bool_t dbus_message_allocate_data_slot (dbus_int32_t     *slot_p);
00205 void        dbus_message_free_data_slot     (dbus_int32_t     *slot_p);
00206 dbus_bool_t dbus_message_set_data           (DBusMessage      *message,
00207                                              dbus_int32_t      slot,
00208                                              void             *data,
00209                                              DBusFreeFunction  free_data_func);
00210 void*       dbus_message_get_data           (DBusMessage      *message,
00211                                              dbus_int32_t      slot);
00212 
00213 int dbus_message_type_from_string (const char *type_str);
00214 const char * dbus_message_type_to_string (int type);
00215 
00218 DBUS_END_DECLS
00219 
00220 #endif /* DBUS_MESSAGE_H */

Generated on Fri Sep 21 18:12:12 2007 for D-Bus by  doxygen 1.5.1