epoc32/include/stdapis/dbus-1.0/dbus/dbus-connection.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 /* -*- mode: C; c-file-style: "gnu" -*- */
     2 /* dbus-connection.h DBusConnection object
     3  *
     4  * Copyright (C) 2002, 2003  Red Hat Inc.
     5  * Portion Copyright © 2008 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
     6  * Licensed under the Academic Free License version 2.1
     7  * 
     8  * This program is free software; you can redistribute it and/or modify
     9  * it under the terms of the GNU General Public License as published by
    10  * the Free Software Foundation; either version 2 of the License, or
    11  * (at your option) any later version.
    12  *
    13  * This program is distributed in the hope that it will be useful,
    14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16  * GNU General Public License for more details.
    17  * 
    18  * You should have received a copy of the GNU General Public License
    19  * along with this program; if not, write to the Free Software
    20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    21  *
    22  */
    23 #if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
    24 #error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
    25 #endif
    26 
    27 #ifndef DBUS_CONNECTION_H
    28 #define DBUS_CONNECTION_H
    29 
    30 #include <dbus/dbus-errors.h>
    31 #include <dbus/dbus-memory.h>
    32 #include <dbus/dbus-message.h>
    33 #include <dbus/dbus-shared.h>
    34 
    35 DBUS_BEGIN_DECLS
    36 
    37 /**
    38  * @addtogroup DBusConnection
    39  * @{
    40  */
    41 
    42 /* documented in dbus-watch.c */
    43 typedef struct DBusWatch DBusWatch;
    44 /* documented in dbus-timeout.c */
    45 typedef struct DBusTimeout DBusTimeout;
    46 /** Opaque type representing preallocated resources so a message can be sent without further memory allocation. */
    47 typedef struct DBusPreallocatedSend DBusPreallocatedSend;
    48 /** Opaque type representing a method call that has not yet received a reply. */
    49 typedef struct DBusPendingCall DBusPendingCall;
    50 /** Opaque type representing a connection to a remote application and associated incoming/outgoing message queues. */
    51 typedef struct DBusConnection DBusConnection;
    52 /** Set of functions that must be implemented to handle messages sent to a particular object path. */
    53 typedef struct DBusObjectPathVTable DBusObjectPathVTable;
    54 
    55 /**
    56  * Indicates the status of a #DBusWatch.
    57  */
    58 typedef enum
    59 {
    60   DBUS_WATCH_READABLE = 1 << 0, /**< As in POLLIN */
    61   DBUS_WATCH_WRITABLE = 1 << 1, /**< As in POLLOUT */
    62   DBUS_WATCH_ERROR    = 1 << 2, /**< As in POLLERR (can't watch for
    63                                  *   this, but can be present in
    64                                  *   current state passed to
    65                                  *   dbus_watch_handle()).
    66                                  */
    67   DBUS_WATCH_HANGUP   = 1 << 3  /**< As in POLLHUP (can't watch for
    68                                  *   it, but can be present in current
    69                                  *   state passed to
    70                                  *   dbus_watch_handle()).
    71                                  */
    72 } DBusWatchFlags;
    73 
    74 /**
    75  * Indicates the status of incoming data on a #DBusConnection. This determines whether
    76  * dbus_connection_dispatch() needs to be called.
    77  */
    78 typedef enum
    79 {
    80   DBUS_DISPATCH_DATA_REMAINS,  /**< There is more data to potentially convert to messages. */
    81   DBUS_DISPATCH_COMPLETE,      /**< All currently available data has been processed. */
    82   DBUS_DISPATCH_NEED_MEMORY    /**< More memory is needed to continue. */
    83 } DBusDispatchStatus;
    84 
    85 /** Called when libdbus needs a new watch to be monitored by the main
    86  * loop. Returns #FALSE if it lacks enough memory to add the
    87  * watch. Set by dbus_connection_set_watch_functions() or
    88  * dbus_server_set_watch_functions().
    89  */
    90 typedef dbus_bool_t (* DBusAddWatchFunction)       (DBusWatch      *watch,
    91                                                     void           *data);
    92 /** Called when dbus_watch_get_enabled() may return a different value
    93  *  than it did before.  Set by dbus_connection_set_watch_functions()
    94  *  or dbus_server_set_watch_functions().
    95  */
    96 typedef void        (* DBusWatchToggledFunction)   (DBusWatch      *watch,
    97                                                     void           *data);
    98 /** Called when libdbus no longer needs a watch to be monitored by the
    99  * main loop. Set by dbus_connection_set_watch_functions() or
   100  * dbus_server_set_watch_functions().
   101  */
   102 typedef void        (* DBusRemoveWatchFunction)    (DBusWatch      *watch,
   103                                                     void           *data);
   104 /** Called when libdbus needs a new timeout to be monitored by the main
   105  * loop. Returns #FALSE if it lacks enough memory to add the
   106  * watch. Set by dbus_connection_set_timeout_functions() or
   107  * dbus_server_set_timeout_functions().
   108  */
   109 typedef dbus_bool_t (* DBusAddTimeoutFunction)     (DBusTimeout    *timeout,
   110                                                     void           *data);
   111 /** Called when dbus_timeout_get_enabled() may return a different
   112  * value than it did before.
   113  * Set by dbus_connection_set_timeout_functions() or
   114  * dbus_server_set_timeout_functions().
   115  */
   116 typedef void        (* DBusTimeoutToggledFunction) (DBusTimeout    *timeout,
   117                                                     void           *data);
   118 /** Called when libdbus no longer needs a timeout to be monitored by the
   119  * main loop. Set by dbus_connection_set_timeout_functions() or
   120  * dbus_server_set_timeout_functions().
   121  */
   122 typedef void        (* DBusRemoveTimeoutFunction)  (DBusTimeout    *timeout,
   123                                                     void           *data);
   124 /** Called when the return value of dbus_connection_get_dispatch_status()
   125  * may have changed. Set with dbus_connection_set_dispatch_status_function().
   126  */
   127 typedef void        (* DBusDispatchStatusFunction) (DBusConnection *connection,
   128                                                     DBusDispatchStatus new_status,
   129                                                     void           *data);
   130 /**
   131  * Called when the main loop's thread should be notified that there's now work
   132  * to do. Set with dbus_connection_set_wakeup_main_function().
   133  */
   134 typedef void        (* DBusWakeupMainFunction)     (void           *data);
   135 /**
   136  * Called during authentication on UNIX systems to check whether the given
   137  * user ID is allowed to connect. Never called on Windows. Set with
   138  * dbus_connection_set_unix_user_function().
   139  */ 
   140 typedef dbus_bool_t (* DBusAllowUnixUserFunction)  (DBusConnection *connection,
   141                                                     unsigned long   uid,
   142                                                     void           *data);
   143 /**
   144  * Called when a pending call now has a reply available. Set with
   145  * dbus_pending_call_set_notify().
   146  */
   147 typedef void (* DBusPendingCallNotifyFunction) (DBusPendingCall *pending,
   148                                                 void            *user_data);
   149 
   150 /**
   151  * Called when a message needs to be handled. The result indicates whether or
   152  * not more handlers should be run. Set with dbus_connection_add_filter().
   153  */
   154 typedef DBusHandlerResult (* DBusHandleMessageFunction) (DBusConnection     *connection,
   155                                                          DBusMessage        *message,
   156                                                          void               *user_data);
   157 
   158 #ifdef __SYMBIAN32__
   159 IMPORT_C
   160 #endif
   161 DBusConnection*    dbus_connection_open                         (const char                 *address,
   162                                                                  DBusError                  *error);
   163 #ifdef __SYMBIAN32__
   164 IMPORT_C
   165 #endif
   166 DBusConnection*    dbus_connection_open_private                 (const char                 *address,
   167                                                                  DBusError                  *error);
   168 #ifdef __SYMBIAN32__
   169 IMPORT_C
   170 #endif
   171 DBusConnection*    dbus_connection_ref                          (DBusConnection             *connection);
   172 #ifdef __SYMBIAN32__
   173 IMPORT_C
   174 #endif
   175 void               dbus_connection_unref                        (DBusConnection             *connection);
   176 #ifdef __SYMBIAN32__
   177 IMPORT_C
   178 #endif
   179 void               dbus_connection_close                        (DBusConnection             *connection);
   180 #ifdef __SYMBIAN32__
   181 IMPORT_C
   182 #endif
   183 dbus_bool_t        dbus_connection_get_is_connected             (DBusConnection             *connection);
   184 #ifdef __SYMBIAN32__
   185 IMPORT_C
   186 #endif
   187 dbus_bool_t        dbus_connection_get_is_authenticated         (DBusConnection             *connection);
   188 #ifdef __SYMBIAN32__
   189 IMPORT_C
   190 #endif
   191 void               dbus_connection_set_exit_on_disconnect       (DBusConnection             *connection,
   192                                                                  dbus_bool_t                 exit_on_disconnect);
   193 #ifdef __SYMBIAN32__
   194 IMPORT_C
   195 #endif
   196 void               dbus_connection_flush                        (DBusConnection             *connection);
   197 #ifdef __SYMBIAN32__
   198 IMPORT_C
   199 #endif
   200 dbus_bool_t        dbus_connection_read_write_dispatch          (DBusConnection             *connection,
   201                                                                  int                         timeout_milliseconds);
   202 #ifdef __SYMBIAN32__
   203 IMPORT_C
   204 #endif
   205 dbus_bool_t        dbus_connection_read_write                   (DBusConnection             *connection,
   206                                                                  int                         timeout_milliseconds);
   207 #ifdef __SYMBIAN32__
   208 IMPORT_C
   209 #endif
   210 DBusMessage*       dbus_connection_borrow_message               (DBusConnection             *connection);
   211 #ifdef __SYMBIAN32__
   212 IMPORT_C
   213 #endif
   214 void               dbus_connection_return_message               (DBusConnection             *connection,
   215                                                                  DBusMessage                *message);
   216 #ifdef __SYMBIAN32__
   217 IMPORT_C
   218 #endif
   219 void               dbus_connection_steal_borrowed_message       (DBusConnection             *connection,
   220                                                                  DBusMessage                *message);
   221 #ifdef __SYMBIAN32__
   222 IMPORT_C
   223 #endif
   224 DBusMessage*       dbus_connection_pop_message                  (DBusConnection             *connection);
   225 #ifdef __SYMBIAN32__
   226 IMPORT_C
   227 #endif
   228 DBusDispatchStatus dbus_connection_get_dispatch_status          (DBusConnection             *connection);
   229 #ifdef __SYMBIAN32__
   230 IMPORT_C
   231 #endif
   232 DBusDispatchStatus dbus_connection_dispatch                     (DBusConnection             *connection);
   233 #ifdef __SYMBIAN32__
   234 IMPORT_C
   235 #endif
   236 dbus_bool_t        dbus_connection_has_messages_to_send         (DBusConnection *connection);
   237 #ifdef __SYMBIAN32__
   238 IMPORT_C
   239 #endif
   240 dbus_bool_t        dbus_connection_send                         (DBusConnection             *connection,
   241                                                                  DBusMessage                *message,
   242                                                                  dbus_uint32_t              *client_serial);
   243 #ifdef __SYMBIAN32__
   244 IMPORT_C
   245 #endif
   246 dbus_bool_t        dbus_connection_send_with_reply              (DBusConnection             *connection,
   247                                                                  DBusMessage                *message,
   248                                                                  DBusPendingCall           **pending_return,
   249                                                                  int                         timeout_milliseconds);
   250 #ifdef __SYMBIAN32__
   251 IMPORT_C
   252 #endif
   253 DBusMessage *      dbus_connection_send_with_reply_and_block    (DBusConnection             *connection,
   254                                                                  DBusMessage                *message,
   255                                                                  int                         timeout_milliseconds,
   256                                                                  DBusError                  *error);
   257 #ifdef __SYMBIAN32__
   258 IMPORT_C
   259 #endif
   260 dbus_bool_t        dbus_connection_set_watch_functions          (DBusConnection             *connection,
   261                                                                  DBusAddWatchFunction        add_function,
   262                                                                  DBusRemoveWatchFunction     remove_function,
   263                                                                  DBusWatchToggledFunction    toggled_function,
   264                                                                  void                       *data,
   265                                                                  DBusFreeFunction            free_data_function);
   266 #ifdef __SYMBIAN32__
   267 IMPORT_C
   268 #endif
   269 dbus_bool_t        dbus_connection_set_timeout_functions        (DBusConnection             *connection,
   270                                                                  DBusAddTimeoutFunction      add_function,
   271                                                                  DBusRemoveTimeoutFunction   remove_function,
   272                                                                  DBusTimeoutToggledFunction  toggled_function,
   273                                                                  void                       *data,
   274                                                                  DBusFreeFunction            free_data_function);
   275 #ifdef __SYMBIAN32__
   276 IMPORT_C
   277 #endif
   278 void               dbus_connection_set_wakeup_main_function     (DBusConnection             *connection,
   279                                                                  DBusWakeupMainFunction      wakeup_main_function,
   280                                                                  void                       *data,
   281                                                                  DBusFreeFunction            free_data_function);
   282 #ifdef __SYMBIAN32__
   283 IMPORT_C
   284 #endif
   285 void               dbus_connection_set_dispatch_status_function (DBusConnection             *connection,
   286                                                                  DBusDispatchStatusFunction  function,
   287                                                                  void                       *data,
   288                                                                  DBusFreeFunction            free_data_function);
   289 #ifdef __SYMBIAN32__
   290 IMPORT_C
   291 #endif
   292 dbus_bool_t        dbus_connection_get_unix_user                (DBusConnection             *connection,
   293                                                                  unsigned long              *uid);
   294 #ifdef __SYMBIAN32__
   295 IMPORT_C
   296 #endif
   297 dbus_bool_t        dbus_connection_get_unix_process_id          (DBusConnection             *connection,
   298                                                                  unsigned long              *pid);
   299 #ifdef __SYMBIAN32__
   300 IMPORT_C
   301 #endif
   302 void               dbus_connection_set_unix_user_function       (DBusConnection             *connection,
   303                                                                  DBusAllowUnixUserFunction   function,
   304                                                                  void                       *data,
   305                                                                  DBusFreeFunction            free_data_function);
   306 #ifdef __SYMBIAN32__
   307 IMPORT_C
   308 #endif
   309 void               dbus_connection_set_route_peer_messages      (DBusConnection             *connection,
   310                                                                  dbus_bool_t                 value);
   311 
   312 
   313 /* Filters */
   314 
   315 #ifdef __SYMBIAN32__
   316 IMPORT_C
   317 #endif
   318 dbus_bool_t dbus_connection_add_filter    (DBusConnection            *connection,
   319                                            DBusHandleMessageFunction  function,
   320                                            void                      *user_data,
   321                                            DBusFreeFunction           free_data_function);
   322 #ifdef __SYMBIAN32__
   323 IMPORT_C
   324 #endif
   325 void        dbus_connection_remove_filter (DBusConnection            *connection,
   326                                            DBusHandleMessageFunction  function,
   327                                            void                      *user_data);
   328 
   329 
   330 /* Other */
   331 #ifdef __SYMBIAN32__
   332 IMPORT_C
   333 #endif
   334 dbus_bool_t dbus_connection_allocate_data_slot (dbus_int32_t     *slot_p);
   335 #ifdef __SYMBIAN32__
   336 IMPORT_C
   337 #endif
   338 void        dbus_connection_free_data_slot     (dbus_int32_t     *slot_p);
   339 #ifdef __SYMBIAN32__
   340 IMPORT_C
   341 #endif
   342 dbus_bool_t dbus_connection_set_data           (DBusConnection   *connection,
   343                                                 dbus_int32_t      slot,
   344                                                 void             *data,
   345                                                 DBusFreeFunction  free_data_func);
   346 #ifdef __SYMBIAN32__
   347 IMPORT_C
   348 #endif
   349 void*       dbus_connection_get_data           (DBusConnection   *connection,
   350                                                 dbus_int32_t      slot);
   351 
   352 #ifdef __SYMBIAN32__
   353 IMPORT_C
   354 #endif
   355 void        dbus_connection_set_change_sigpipe (dbus_bool_t       will_modify_sigpipe); 
   356 
   357 #ifdef __SYMBIAN32__
   358 IMPORT_C
   359 #endif
   360 void dbus_connection_set_max_message_size  (DBusConnection *connection,
   361                                             long            size);
   362 #ifdef __SYMBIAN32__
   363 IMPORT_C
   364 #endif
   365 long dbus_connection_get_max_message_size  (DBusConnection *connection);
   366 #ifdef __SYMBIAN32__
   367 IMPORT_C
   368 #endif
   369 void dbus_connection_set_max_received_size (DBusConnection *connection,
   370                                             long            size);
   371 #ifdef __SYMBIAN32__
   372 IMPORT_C
   373 #endif
   374 long dbus_connection_get_max_received_size (DBusConnection *connection);
   375 #ifdef __SYMBIAN32__
   376 IMPORT_C
   377 #endif
   378 long dbus_connection_get_outgoing_size     (DBusConnection *connection);
   379 
   380 #ifdef __SYMBIAN32__
   381 IMPORT_C
   382 #endif
   383 DBusPreallocatedSend* dbus_connection_preallocate_send       (DBusConnection       *connection);
   384 #ifdef __SYMBIAN32__
   385 IMPORT_C
   386 #endif
   387 void                  dbus_connection_free_preallocated_send (DBusConnection       *connection,
   388                                                               DBusPreallocatedSend *preallocated);
   389 #ifdef __SYMBIAN32__
   390 IMPORT_C
   391 #endif
   392 void                  dbus_connection_send_preallocated      (DBusConnection       *connection,
   393                                                               DBusPreallocatedSend *preallocated,
   394                                                               DBusMessage          *message,
   395                                                               dbus_uint32_t        *client_serial);
   396 
   397 
   398 /* Object tree functionality */
   399 
   400 /**
   401  * Called when a #DBusObjectPathVTable is unregistered (or its connection is freed).
   402  * Found in #DBusObjectPathVTable.
   403  */
   404 typedef void              (* DBusObjectPathUnregisterFunction) (DBusConnection  *connection,
   405                                                                 void            *user_data);
   406 /**
   407  * Called when a message is sent to a registered object path. Found in
   408  * #DBusObjectPathVTable which is registered with dbus_connection_register_object_path()
   409  * or dbus_connection_register_fallback().
   410  */
   411 typedef DBusHandlerResult (* DBusObjectPathMessageFunction)    (DBusConnection  *connection,
   412                                                                 DBusMessage     *message,
   413                                                                 void            *user_data);
   414 
   415 /**
   416  * Virtual table that must be implemented to handle a portion of the
   417  * object path hierarchy. Attach the vtable to a particular path using
   418  * dbus_connection_register_object_path() or
   419  * dbus_connection_register_fallback().
   420  */
   421 struct DBusObjectPathVTable
   422 {
   423   DBusObjectPathUnregisterFunction   unregister_function; /**< Function to unregister this handler */
   424   DBusObjectPathMessageFunction      message_function; /**< Function to handle messages */
   425   
   426   void (* dbus_internal_pad1) (void *); /**< Reserved for future expansion */
   427   void (* dbus_internal_pad2) (void *); /**< Reserved for future expansion */
   428   void (* dbus_internal_pad3) (void *); /**< Reserved for future expansion */
   429   void (* dbus_internal_pad4) (void *); /**< Reserved for future expansion */
   430 };
   431 
   432 #ifdef __SYMBIAN32__
   433 IMPORT_C
   434 #endif
   435 dbus_bool_t dbus_connection_register_object_path   (DBusConnection              *connection,
   436                                                     const char                  *path,
   437                                                     const DBusObjectPathVTable  *vtable,
   438                                                     void                        *user_data);
   439 #ifdef __SYMBIAN32__
   440 IMPORT_C
   441 #endif
   442 dbus_bool_t dbus_connection_register_fallback      (DBusConnection              *connection,
   443                                                     const char                  *path,
   444                                                     const DBusObjectPathVTable  *vtable,
   445                                                     void                        *user_data);
   446 #ifdef __SYMBIAN32__
   447 IMPORT_C
   448 #endif
   449 dbus_bool_t dbus_connection_unregister_object_path (DBusConnection              *connection,
   450                                                     const char                  *path);
   451 
   452 #ifdef __SYMBIAN32__
   453 IMPORT_C
   454 #endif
   455 dbus_bool_t dbus_connection_get_object_path_data   (DBusConnection              *connection,
   456                                                     const char                  *path,
   457                                                     void                       **data_p);
   458 
   459 #ifdef __SYMBIAN32__
   460 IMPORT_C
   461 #endif
   462 dbus_bool_t dbus_connection_list_registered        (DBusConnection              *connection,
   463                                                     const char                  *parent_path,
   464                                                     char                      ***child_entries);
   465 
   466 #ifdef __SYMBIAN32__
   467 IMPORT_C
   468 #endif
   469 dbus_bool_t dbus_connection_get_unix_fd            (DBusConnection              *connection,
   470                                                     int                         *fd);
   471 #ifdef __SYMBIAN32__
   472 IMPORT_C
   473 #endif
   474 dbus_bool_t dbus_connection_get_socket             (DBusConnection              *connection,
   475                                                     int                         *fd);
   476 
   477 /** @} */
   478 
   479 
   480 /**
   481  * @addtogroup DBusWatch
   482  * @{
   483  */
   484 
   485 #ifdef __SYMBIAN32__
   486 IMPORT_C
   487 #endif
   488 int          dbus_watch_get_fd      (DBusWatch        *watch);
   489 #ifdef __SYMBIAN32__
   490 IMPORT_C
   491 #endif
   492 unsigned int dbus_watch_get_flags   (DBusWatch        *watch);
   493 #ifdef __SYMBIAN32__
   494 IMPORT_C
   495 #endif
   496 void*        dbus_watch_get_data    (DBusWatch        *watch);
   497 #ifdef __SYMBIAN32__
   498 IMPORT_C
   499 #endif
   500 void         dbus_watch_set_data    (DBusWatch        *watch,
   501                                      void             *data,
   502                                      DBusFreeFunction  free_data_function);
   503 #ifdef __SYMBIAN32__
   504 IMPORT_C
   505 #endif
   506 dbus_bool_t  dbus_watch_handle      (DBusWatch        *watch,
   507                                      unsigned int      flags);
   508 #ifdef __SYMBIAN32__
   509 IMPORT_C
   510 #endif
   511 dbus_bool_t  dbus_watch_get_enabled (DBusWatch        *watch);
   512 
   513 /** @} */
   514 
   515 /**
   516  * @addtogroup DBusTimeout
   517  * @{
   518  */
   519 
   520 #ifdef __SYMBIAN32__
   521 IMPORT_C
   522 #endif
   523 int         dbus_timeout_get_interval (DBusTimeout      *timeout);
   524 #ifdef __SYMBIAN32__
   525 IMPORT_C
   526 #endif
   527 void*       dbus_timeout_get_data     (DBusTimeout      *timeout);
   528 #ifdef __SYMBIAN32__
   529 IMPORT_C
   530 #endif
   531 void        dbus_timeout_set_data     (DBusTimeout      *timeout,
   532                                        void             *data,
   533                                        DBusFreeFunction  free_data_function);
   534 #ifdef __SYMBIAN32__
   535 IMPORT_C
   536 #endif
   537 dbus_bool_t dbus_timeout_handle       (DBusTimeout      *timeout);
   538 #ifdef __SYMBIAN32__
   539 IMPORT_C
   540 #endif
   541 dbus_bool_t dbus_timeout_get_enabled  (DBusTimeout      *timeout);
   542 
   543 /** @} */
   544 
   545 DBUS_END_DECLS
   546 
   547 #endif /* DBUS_CONNECTION_H */