Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:55:13

0001 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
0002 /* dbus-message.h DBusMessage object
0003  *
0004  * Copyright (C) 2002, 2003, 2005 Red Hat Inc.
0005  *
0006  * Licensed under the Academic Free License version 2.1
0007  *
0008  * This program is free software; you can redistribute it and/or modify
0009  * it under the terms of the GNU General Public License as published by
0010  * the Free Software Foundation; either version 2 of the License, or
0011  * (at your option) any later version.
0012  *
0013  * This program is distributed in the hope that it will be useful,
0014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0016  * GNU General Public License for more details.
0017  *
0018  * You should have received a copy of the GNU General Public License
0019  * along with this program; if not, write to the Free Software
0020  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
0021  *
0022  */
0023 #if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
0024 #error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
0025 #endif
0026 
0027 #ifndef DBUS_MESSAGE_H
0028 #define DBUS_MESSAGE_H
0029 
0030 #include <dbus/dbus-macros.h>
0031 #include <dbus/dbus-types.h>
0032 #include <dbus/dbus-arch-deps.h>
0033 #include <dbus/dbus-memory.h>
0034 #include <dbus/dbus-errors.h>
0035 #include <stdarg.h>
0036 
0037 DBUS_BEGIN_DECLS
0038 
0039 /**
0040  * @addtogroup DBusMessage
0041  * @{
0042  */
0043 
0044 typedef struct DBusMessage DBusMessage;
0045 /**
0046  * Opaque type representing a message iterator. Can be copied by value and
0047  * allocated on the stack.
0048  *
0049  * A DBusMessageIter usually contains no allocated memory. However, there
0050  * is one special case: after a successful call to
0051  * dbus_message_iter_open_container(), the caller is responsible for calling
0052  * either dbus_message_iter_close_container() or
0053  * dbus_message_iter_abandon_container() exactly once, with the same pair
0054  * of iterators.
0055  */
0056 typedef struct DBusMessageIter DBusMessageIter;
0057 
0058 /**
0059  * DBusMessageIter struct; contains no public fields. 
0060  */
0061 struct DBusMessageIter
0062 { 
0063   void *dummy1;         /**< Don't use this */
0064   void *dummy2;         /**< Don't use this */
0065   dbus_uint32_t dummy3; /**< Don't use this */
0066   int dummy4;           /**< Don't use this */
0067   int dummy5;           /**< Don't use this */
0068   int dummy6;           /**< Don't use this */
0069   int dummy7;           /**< Don't use this */
0070   int dummy8;           /**< Don't use this */
0071   int dummy9;           /**< Don't use this */
0072   int dummy10;          /**< Don't use this */
0073   int dummy11;          /**< Don't use this */
0074   int pad1;             /**< Don't use this */
0075   void *pad2;           /**< Don't use this */
0076   void *pad3;           /**< Don't use this */
0077 };
0078 
0079 /**
0080  * A message iterator for which dbus_message_iter_abandon_container_if_open()
0081  * is the only valid operation.
0082  */
0083 #define DBUS_MESSAGE_ITER_INIT_CLOSED \
0084 { \
0085   NULL, /* dummy1 */ \
0086   NULL, /* dummy2 */ \
0087   0, /* dummy3 */ \
0088   0, /* dummy4 */ \
0089   0, /* dummy5 */ \
0090   0, /* dummy6 */ \
0091   0, /* dummy7 */ \
0092   0, /* dummy8 */ \
0093   0, /* dummy9 */ \
0094   0, /* dummy10 */ \
0095   0, /* dummy11 */ \
0096   0, /* pad1 */ \
0097   NULL, /* pad2 */ \
0098   NULL /* pad3 */ \
0099 }
0100 
0101 DBUS_EXPORT
0102 DBusMessage* dbus_message_new               (int          message_type);
0103 DBUS_EXPORT
0104 DBusMessage* dbus_message_new_method_call   (const char  *bus_name,
0105                                              const char  *path,
0106                                              const char  *iface,
0107                                              const char  *method);
0108 DBUS_EXPORT
0109 DBusMessage* dbus_message_new_method_return (DBusMessage *method_call);
0110 DBUS_EXPORT
0111 DBusMessage* dbus_message_new_signal        (const char  *path,
0112                                              const char  *iface,
0113                                              const char  *name);
0114 DBUS_EXPORT
0115 DBusMessage* dbus_message_new_error         (DBusMessage *reply_to,
0116                                              const char  *error_name,
0117                                              const char  *error_message);
0118 DBUS_EXPORT
0119 DBusMessage* dbus_message_new_error_printf  (DBusMessage *reply_to,
0120                                              const char  *error_name,
0121                                              const char  *error_format,
0122                                              ...) _DBUS_GNUC_PRINTF (3, 4);
0123 
0124 DBUS_EXPORT
0125 DBusMessage* dbus_message_copy              (const DBusMessage *message);
0126 
0127 DBUS_EXPORT
0128 DBusMessage*  dbus_message_ref              (DBusMessage   *message);
0129 DBUS_EXPORT
0130 void          dbus_message_unref            (DBusMessage   *message);
0131 DBUS_EXPORT
0132 int           dbus_message_get_type         (DBusMessage   *message);
0133 DBUS_EXPORT
0134 dbus_bool_t   dbus_message_set_path         (DBusMessage   *message,
0135                                              const char    *object_path);
0136 DBUS_EXPORT
0137 const char*   dbus_message_get_path         (DBusMessage   *message);
0138 DBUS_EXPORT
0139 dbus_bool_t   dbus_message_has_path         (DBusMessage   *message, 
0140                                              const char    *object_path);  
0141 DBUS_EXPORT
0142 dbus_bool_t   dbus_message_set_interface    (DBusMessage   *message,
0143                                              const char    *iface);
0144 DBUS_EXPORT
0145 const char*   dbus_message_get_interface    (DBusMessage   *message);
0146 DBUS_EXPORT
0147 dbus_bool_t   dbus_message_has_interface    (DBusMessage   *message, 
0148                                              const char    *iface);
0149 DBUS_EXPORT
0150 dbus_bool_t   dbus_message_set_member       (DBusMessage   *message,
0151                                              const char    *member);
0152 DBUS_EXPORT
0153 const char*   dbus_message_get_member       (DBusMessage   *message);
0154 DBUS_EXPORT
0155 dbus_bool_t   dbus_message_has_member       (DBusMessage   *message, 
0156                                              const char    *member);
0157 DBUS_EXPORT
0158 dbus_bool_t   dbus_message_set_error_name   (DBusMessage   *message,
0159                                              const char    *name);
0160 DBUS_EXPORT
0161 const char*   dbus_message_get_error_name   (DBusMessage   *message);
0162 DBUS_EXPORT
0163 dbus_bool_t   dbus_message_set_destination  (DBusMessage   *message,
0164                                              const char    *destination);
0165 DBUS_EXPORT
0166 const char*   dbus_message_get_destination  (DBusMessage   *message);
0167 DBUS_EXPORT
0168 dbus_bool_t   dbus_message_set_sender       (DBusMessage   *message,
0169                                              const char    *sender);
0170 DBUS_EXPORT
0171 const char*   dbus_message_get_sender       (DBusMessage   *message);
0172 DBUS_EXPORT
0173 const char*   dbus_message_get_signature    (DBusMessage   *message);
0174 DBUS_EXPORT
0175 void          dbus_message_set_no_reply     (DBusMessage   *message,
0176                                              dbus_bool_t    no_reply);
0177 DBUS_EXPORT
0178 dbus_bool_t   dbus_message_get_no_reply     (DBusMessage   *message);
0179 DBUS_EXPORT
0180 dbus_bool_t   dbus_message_is_method_call   (DBusMessage   *message,
0181                                              const char    *iface,
0182                                              const char    *method);
0183 DBUS_EXPORT
0184 dbus_bool_t   dbus_message_is_signal        (DBusMessage   *message,
0185                                              const char    *iface,
0186                                              const char    *signal_name);
0187 DBUS_EXPORT
0188 dbus_bool_t   dbus_message_is_error         (DBusMessage   *message,
0189                                              const char    *error_name);
0190 DBUS_EXPORT
0191 dbus_bool_t   dbus_message_has_destination  (DBusMessage   *message,
0192                                              const char    *bus_name);
0193 DBUS_EXPORT
0194 dbus_bool_t   dbus_message_has_sender       (DBusMessage   *message,
0195                                              const char    *unique_bus_name);
0196 DBUS_EXPORT
0197 dbus_bool_t   dbus_message_has_signature    (DBusMessage   *message,
0198                                              const char    *signature);
0199 DBUS_EXPORT
0200 dbus_uint32_t dbus_message_get_serial       (DBusMessage   *message);
0201 DBUS_EXPORT
0202 void          dbus_message_set_serial       (DBusMessage   *message, 
0203                                              dbus_uint32_t  serial);
0204 DBUS_EXPORT
0205 dbus_bool_t   dbus_message_set_reply_serial (DBusMessage   *message,
0206                                              dbus_uint32_t  reply_serial);
0207 DBUS_EXPORT
0208 dbus_uint32_t dbus_message_get_reply_serial (DBusMessage   *message);
0209 
0210 DBUS_EXPORT
0211 void          dbus_message_set_auto_start   (DBusMessage   *message,
0212                                              dbus_bool_t    auto_start);
0213 DBUS_EXPORT
0214 dbus_bool_t   dbus_message_get_auto_start   (DBusMessage   *message);
0215 
0216 DBUS_EXPORT
0217 dbus_bool_t   dbus_message_get_path_decomposed (DBusMessage   *message,
0218                                                 char        ***path);
0219 
0220 DBUS_EXPORT
0221 const char   *dbus_message_get_container_instance (DBusMessage   *message);
0222 DBUS_EXPORT
0223 dbus_bool_t   dbus_message_set_container_instance (DBusMessage   *message,
0224                                                    const char    *object_path);
0225 
0226 DBUS_EXPORT
0227 dbus_bool_t dbus_message_append_args          (DBusMessage     *message,
0228                            int              first_arg_type,
0229                            ...);
0230 DBUS_EXPORT
0231 dbus_bool_t dbus_message_append_args_valist   (DBusMessage     *message,
0232                            int              first_arg_type,
0233                            va_list          var_args);
0234 DBUS_EXPORT
0235 dbus_bool_t dbus_message_get_args             (DBusMessage     *message,
0236                            DBusError       *error,
0237                            int              first_arg_type,
0238                            ...);
0239 DBUS_EXPORT
0240 dbus_bool_t dbus_message_get_args_valist      (DBusMessage     *message,
0241                            DBusError       *error,
0242                            int              first_arg_type,
0243                            va_list          var_args);
0244 
0245 DBUS_EXPORT
0246 dbus_bool_t dbus_message_contains_unix_fds    (DBusMessage *message);
0247 
0248 DBUS_EXPORT
0249 void        dbus_message_iter_init_closed        (DBusMessageIter *iter);
0250 DBUS_EXPORT
0251 dbus_bool_t dbus_message_iter_init             (DBusMessage     *message,
0252                                                 DBusMessageIter *iter);
0253 DBUS_EXPORT
0254 dbus_bool_t dbus_message_iter_has_next         (DBusMessageIter *iter);
0255 DBUS_EXPORT
0256 dbus_bool_t dbus_message_iter_next             (DBusMessageIter *iter);
0257 DBUS_EXPORT
0258 char*       dbus_message_iter_get_signature    (DBusMessageIter *iter);
0259 DBUS_EXPORT
0260 int         dbus_message_iter_get_arg_type     (DBusMessageIter *iter);
0261 DBUS_EXPORT
0262 int         dbus_message_iter_get_element_type (DBusMessageIter *iter);
0263 DBUS_EXPORT
0264 void        dbus_message_iter_recurse          (DBusMessageIter *iter,
0265                                                 DBusMessageIter *sub);
0266 DBUS_EXPORT
0267 void        dbus_message_iter_get_basic        (DBusMessageIter *iter,
0268                                                 void            *value);
0269 DBUS_EXPORT
0270 int         dbus_message_iter_get_element_count(DBusMessageIter *iter);
0271 
0272 #ifndef DBUS_DISABLE_DEPRECATED
0273 /* This function returns the wire protocol size of the array in bytes,
0274  * you do not want to know that probably
0275  */
0276 DBUS_EXPORT
0277 DBUS_DEPRECATED int         dbus_message_iter_get_array_len    (DBusMessageIter *iter);
0278 #endif
0279 DBUS_EXPORT
0280 void        dbus_message_iter_get_fixed_array  (DBusMessageIter *iter,
0281                                                 void            *value,
0282                                                 int             *n_elements);
0283 
0284 
0285 DBUS_EXPORT
0286 void        dbus_message_iter_init_append        (DBusMessage     *message,
0287                                                   DBusMessageIter *iter);
0288 DBUS_EXPORT
0289 dbus_bool_t dbus_message_iter_append_basic       (DBusMessageIter *iter,
0290                                                   int              type,
0291                                                   const void      *value);
0292 DBUS_EXPORT
0293 dbus_bool_t dbus_message_iter_append_fixed_array (DBusMessageIter *iter,
0294                                                   int              element_type,
0295                                                   const void      *value,
0296                                                   int              n_elements);
0297 DBUS_EXPORT
0298 dbus_bool_t dbus_message_iter_open_container     (DBusMessageIter *iter,
0299                                                   int              type,
0300                                                   const char      *contained_signature,
0301                                                   DBusMessageIter *sub);
0302 DBUS_EXPORT
0303 dbus_bool_t dbus_message_iter_close_container    (DBusMessageIter *iter,
0304                                                   DBusMessageIter *sub);
0305 DBUS_EXPORT
0306 void        dbus_message_iter_abandon_container  (DBusMessageIter *iter,
0307                                                   DBusMessageIter *sub);
0308 
0309 DBUS_EXPORT
0310 void        dbus_message_iter_abandon_container_if_open (DBusMessageIter *iter,
0311                                                          DBusMessageIter *sub);
0312 
0313 DBUS_EXPORT
0314 void dbus_message_lock    (DBusMessage  *message);
0315 
0316 DBUS_EXPORT
0317 dbus_bool_t  dbus_set_error_from_message  (DBusError    *error,
0318                                            DBusMessage  *message);
0319 
0320 
0321 DBUS_EXPORT
0322 dbus_bool_t dbus_message_allocate_data_slot (dbus_int32_t     *slot_p);
0323 DBUS_EXPORT
0324 void        dbus_message_free_data_slot     (dbus_int32_t     *slot_p);
0325 DBUS_EXPORT
0326 dbus_bool_t dbus_message_set_data           (DBusMessage      *message,
0327                                              dbus_int32_t      slot,
0328                                              void             *data,
0329                                              DBusFreeFunction  free_data_func);
0330 DBUS_EXPORT
0331 void*       dbus_message_get_data           (DBusMessage      *message,
0332                                              dbus_int32_t      slot);
0333 
0334 DBUS_EXPORT
0335 int         dbus_message_type_from_string (const char *type_str);
0336 DBUS_EXPORT
0337 const char* dbus_message_type_to_string   (int type);
0338 
0339 DBUS_EXPORT
0340 dbus_bool_t  dbus_message_marshal   (DBusMessage  *msg,
0341                                      char        **marshalled_data_p,
0342                                      int          *len_p);
0343 DBUS_EXPORT
0344 DBusMessage* dbus_message_demarshal (const char *str,
0345                                      int         len,
0346                                      DBusError  *error);
0347 
0348 DBUS_EXPORT
0349 int          dbus_message_demarshal_bytes_needed (const char *str, 
0350                                                   int len);
0351 
0352 DBUS_EXPORT
0353 void dbus_message_set_allow_interactive_authorization (DBusMessage *message,
0354     dbus_bool_t allow);
0355 
0356 DBUS_EXPORT
0357 dbus_bool_t dbus_message_get_allow_interactive_authorization (
0358     DBusMessage *message);
0359 
0360 /**
0361  * Clear a variable or struct member that contains a #DBusMessage.
0362  * If it does not contain #NULL, the message that was previously
0363  * there is unreferenced with dbus_message_unref().
0364  *
0365  * This is very similar to dbus_clear_connection(): see that function
0366  * for more details.
0367  *
0368  * @param pointer_to_message A pointer to a variable or struct member.
0369  * pointer_to_message must not be #NULL, but *pointer_to_message
0370  * may be #NULL.
0371  */
0372 static inline void
0373 dbus_clear_message (DBusMessage **pointer_to_message)
0374 {
0375   _dbus_clear_pointer_impl (DBusMessage, pointer_to_message,
0376                             dbus_message_unref);
0377 }
0378 
0379 /** @} */
0380 
0381 DBUS_END_DECLS
0382 
0383 #endif /* DBUS_MESSAGE_H */