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

dbus-connection.h

00001 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
00002 /* dbus-connection.h DBusConnection object
00003  *
00004  * Copyright (C) 2002, 2003  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 #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_CONNECTION_H
00028 #define DBUS_CONNECTION_H
00029 
00030 #include <dbus/dbus-errors.h>
00031 #include <dbus/dbus-memory.h>
00032 #include <dbus/dbus-message.h>
00033 #include <dbus/dbus-shared.h>
00034 
00035 DBUS_BEGIN_DECLS
00036 
00042 /* documented in dbus-watch.c */
00043 typedef struct DBusWatch DBusWatch;
00044 /* documented in dbus-timeout.c */
00045 typedef struct DBusTimeout DBusTimeout;
00047 typedef struct DBusPreallocatedSend DBusPreallocatedSend;
00049 typedef struct DBusPendingCall DBusPendingCall;
00051 typedef struct DBusConnection DBusConnection;
00053 typedef struct DBusObjectPathVTable DBusObjectPathVTable;
00054 
00058 typedef enum
00059 {
00060   DBUS_WATCH_READABLE = 1 << 0, 
00061   DBUS_WATCH_WRITABLE = 1 << 1, 
00062   DBUS_WATCH_ERROR    = 1 << 2, 
00067   DBUS_WATCH_HANGUP   = 1 << 3  
00072   /* Internal to libdbus, there is also _DBUS_WATCH_NVAL in dbus-watch.h */
00073 } DBusWatchFlags;
00074 
00079 typedef enum
00080 {
00081   DBUS_DISPATCH_DATA_REMAINS,  
00082   DBUS_DISPATCH_COMPLETE,      
00083   DBUS_DISPATCH_NEED_MEMORY    
00084 } DBusDispatchStatus;
00085 
00091 typedef dbus_bool_t (* DBusAddWatchFunction)       (DBusWatch      *watch,
00092                                                     void           *data);
00097 typedef void        (* DBusWatchToggledFunction)   (DBusWatch      *watch,
00098                                                     void           *data);
00103 typedef void        (* DBusRemoveWatchFunction)    (DBusWatch      *watch,
00104                                                     void           *data);
00110 typedef dbus_bool_t (* DBusAddTimeoutFunction)     (DBusTimeout    *timeout,
00111                                                     void           *data);
00117 typedef void        (* DBusTimeoutToggledFunction) (DBusTimeout    *timeout,
00118                                                     void           *data);
00123 typedef void        (* DBusRemoveTimeoutFunction)  (DBusTimeout    *timeout,
00124                                                     void           *data);
00128 typedef void        (* DBusDispatchStatusFunction) (DBusConnection *connection,
00129                                                     DBusDispatchStatus new_status,
00130                                                     void           *data);
00135 typedef void        (* DBusWakeupMainFunction)     (void           *data);
00136 
00143 typedef dbus_bool_t (* DBusAllowUnixUserFunction)  (DBusConnection *connection,
00144                                                     unsigned long   uid,
00145                                                     void           *data);
00146 
00153 typedef dbus_bool_t (* DBusAllowWindowsUserFunction)  (DBusConnection *connection,
00154                                                        const char     *user_sid,
00155                                                        void           *data);
00156 
00157 
00162 typedef void (* DBusPendingCallNotifyFunction) (DBusPendingCall *pending,
00163                                                 void            *user_data);
00164 
00169 typedef DBusHandlerResult (* DBusHandleMessageFunction) (DBusConnection     *connection,
00170                                                          DBusMessage        *message,
00171                                                          void               *user_data);
00172 DBUS_EXPORT
00173 DBusConnection*    dbus_connection_open                         (const char                 *address,
00174                                                                  DBusError                  *error);
00175 DBUS_EXPORT
00176 DBusConnection*    dbus_connection_open_private                 (const char                 *address,
00177                                                                  DBusError                  *error);
00178 DBUS_EXPORT
00179 DBusConnection*    dbus_connection_ref                          (DBusConnection             *connection);
00180 DBUS_EXPORT
00181 void               dbus_connection_unref                        (DBusConnection             *connection);
00182 DBUS_EXPORT
00183 void               dbus_connection_close                        (DBusConnection             *connection);
00184 DBUS_EXPORT
00185 dbus_bool_t        dbus_connection_get_is_connected             (DBusConnection             *connection);
00186 DBUS_EXPORT
00187 dbus_bool_t        dbus_connection_get_is_authenticated         (DBusConnection             *connection);
00188 DBUS_EXPORT
00189 dbus_bool_t        dbus_connection_get_is_anonymous             (DBusConnection             *connection);
00190 DBUS_EXPORT
00191 char*              dbus_connection_get_server_id                (DBusConnection             *connection);
00192 DBUS_EXPORT
00193 dbus_bool_t        dbus_connection_can_send_type                (DBusConnection             *connection,
00194                                                                  int                         type);
00195 
00196 DBUS_EXPORT
00197 void               dbus_connection_set_exit_on_disconnect       (DBusConnection             *connection,
00198                                                                  dbus_bool_t                 exit_on_disconnect);
00199 DBUS_EXPORT
00200 void               dbus_connection_flush                        (DBusConnection             *connection);
00201 DBUS_EXPORT
00202 dbus_bool_t        dbus_connection_read_write_dispatch          (DBusConnection             *connection,
00203                                                                  int                         timeout_milliseconds);
00204 DBUS_EXPORT
00205 dbus_bool_t        dbus_connection_read_write                   (DBusConnection             *connection,
00206                                                                  int                         timeout_milliseconds);
00207 DBUS_EXPORT
00208 DBusMessage*       dbus_connection_borrow_message               (DBusConnection             *connection);
00209 DBUS_EXPORT
00210 void               dbus_connection_return_message               (DBusConnection             *connection,
00211                                                                  DBusMessage                *message);
00212 DBUS_EXPORT
00213 void               dbus_connection_steal_borrowed_message       (DBusConnection             *connection,
00214                                                                  DBusMessage                *message);
00215 DBUS_EXPORT
00216 DBusMessage*       dbus_connection_pop_message                  (DBusConnection             *connection);
00217 DBUS_EXPORT
00218 DBusDispatchStatus dbus_connection_get_dispatch_status          (DBusConnection             *connection);
00219 DBUS_EXPORT
00220 DBusDispatchStatus dbus_connection_dispatch                     (DBusConnection             *connection);
00221 DBUS_EXPORT
00222 dbus_bool_t        dbus_connection_has_messages_to_send         (DBusConnection *connection);
00223 DBUS_EXPORT
00224 dbus_bool_t        dbus_connection_send                         (DBusConnection             *connection,
00225                                                                  DBusMessage                *message,
00226                                                                  dbus_uint32_t              *client_serial);
00227 DBUS_EXPORT
00228 dbus_bool_t        dbus_connection_send_with_reply              (DBusConnection             *connection,
00229                                                                  DBusMessage                *message,
00230                                                                  DBusPendingCall           **pending_return,
00231                                                                  int                         timeout_milliseconds);
00232 DBUS_EXPORT
00233 DBusMessage *      dbus_connection_send_with_reply_and_block    (DBusConnection             *connection,
00234                                                                  DBusMessage                *message,
00235                                                                  int                         timeout_milliseconds,
00236                                                                  DBusError                  *error);
00237 DBUS_EXPORT
00238 dbus_bool_t        dbus_connection_set_watch_functions          (DBusConnection             *connection,
00239                                                                  DBusAddWatchFunction        add_function,
00240                                                                  DBusRemoveWatchFunction     remove_function,
00241                                                                  DBusWatchToggledFunction    toggled_function,
00242                                                                  void                       *data,
00243                                                                  DBusFreeFunction            free_data_function);
00244 DBUS_EXPORT
00245 dbus_bool_t        dbus_connection_set_timeout_functions        (DBusConnection             *connection,
00246                                                                  DBusAddTimeoutFunction      add_function,
00247                                                                  DBusRemoveTimeoutFunction   remove_function,
00248                                                                  DBusTimeoutToggledFunction  toggled_function,
00249                                                                  void                       *data,
00250                                                                  DBusFreeFunction            free_data_function);
00251 DBUS_EXPORT
00252 void               dbus_connection_set_wakeup_main_function     (DBusConnection             *connection,
00253                                                                  DBusWakeupMainFunction      wakeup_main_function,
00254                                                                  void                       *data,
00255                                                                  DBusFreeFunction            free_data_function);
00256 DBUS_EXPORT
00257 void               dbus_connection_set_dispatch_status_function (DBusConnection             *connection,
00258                                                                  DBusDispatchStatusFunction  function,
00259                                                                  void                       *data,
00260                                                                  DBusFreeFunction            free_data_function);
00261 DBUS_EXPORT
00262 dbus_bool_t        dbus_connection_get_unix_user                (DBusConnection             *connection,
00263                                                                  unsigned long              *uid);
00264 DBUS_EXPORT
00265 dbus_bool_t        dbus_connection_get_unix_process_id          (DBusConnection             *connection,
00266                                                                  unsigned long              *pid);
00267 DBUS_EXPORT
00268 dbus_bool_t        dbus_connection_get_adt_audit_session_data   (DBusConnection             *connection,
00269                                                                  void                      **data,
00270                                                                  dbus_int32_t               *data_size);
00271 DBUS_EXPORT
00272 void               dbus_connection_set_unix_user_function       (DBusConnection             *connection,
00273                                                                  DBusAllowUnixUserFunction   function,
00274                                                                  void                       *data,
00275                                                                  DBusFreeFunction            free_data_function);
00276 DBUS_EXPORT
00277 dbus_bool_t        dbus_connection_get_windows_user             (DBusConnection             *connection,
00278                                                                  char                      **windows_sid_p); 
00279 DBUS_EXPORT
00280 void               dbus_connection_set_windows_user_function    (DBusConnection             *connection,
00281                                                                  DBusAllowWindowsUserFunction function,
00282                                                                  void                       *data,
00283                                                                  DBusFreeFunction            free_data_function);
00284 DBUS_EXPORT
00285 void               dbus_connection_set_allow_anonymous          (DBusConnection             *connection,
00286                                                                  dbus_bool_t                 value);
00287 DBUS_EXPORT
00288 void               dbus_connection_set_route_peer_messages      (DBusConnection             *connection,
00289                                                                  dbus_bool_t                 value);
00290 
00291 
00292 /* Filters */
00293 
00294 DBUS_EXPORT
00295 dbus_bool_t dbus_connection_add_filter    (DBusConnection            *connection,
00296                                            DBusHandleMessageFunction  function,
00297                                            void                      *user_data,
00298                                            DBusFreeFunction           free_data_function);
00299 DBUS_EXPORT
00300 void        dbus_connection_remove_filter (DBusConnection            *connection,
00301                                            DBusHandleMessageFunction  function,
00302                                            void                      *user_data);
00303 
00304 
00305 /* Other */
00306 DBUS_EXPORT
00307 dbus_bool_t dbus_connection_allocate_data_slot (dbus_int32_t     *slot_p);
00308 DBUS_EXPORT
00309 void        dbus_connection_free_data_slot     (dbus_int32_t     *slot_p);
00310 DBUS_EXPORT
00311 dbus_bool_t dbus_connection_set_data           (DBusConnection   *connection,
00312                                                 dbus_int32_t      slot,
00313                                                 void             *data,
00314                                                 DBusFreeFunction  free_data_func);
00315 DBUS_EXPORT
00316 void*       dbus_connection_get_data           (DBusConnection   *connection,
00317                                                 dbus_int32_t      slot);
00318 
00319 DBUS_EXPORT
00320 void        dbus_connection_set_change_sigpipe (dbus_bool_t       will_modify_sigpipe); 
00321 
00322 DBUS_EXPORT
00323 void dbus_connection_set_max_message_size  (DBusConnection *connection,
00324                                             long            size);
00325 DBUS_EXPORT
00326 long dbus_connection_get_max_message_size  (DBusConnection *connection);
00327 DBUS_EXPORT
00328 void dbus_connection_set_max_received_size (DBusConnection *connection,
00329                                             long            size);
00330 DBUS_EXPORT
00331 long dbus_connection_get_max_received_size (DBusConnection *connection);
00332 
00333 DBUS_EXPORT
00334 void dbus_connection_set_max_message_unix_fds (DBusConnection *connection,
00335                                                long            n);
00336 DBUS_EXPORT
00337 long dbus_connection_get_max_message_unix_fds (DBusConnection *connection);
00338 DBUS_EXPORT
00339 void dbus_connection_set_max_received_unix_fds(DBusConnection *connection,
00340                                                long            n);
00341 DBUS_EXPORT
00342 long dbus_connection_get_max_received_unix_fds(DBusConnection *connection);
00343 
00344 DBUS_EXPORT
00345 long dbus_connection_get_outgoing_size     (DBusConnection *connection);
00346 DBUS_EXPORT
00347 long dbus_connection_get_outgoing_unix_fds (DBusConnection *connection);
00348 
00349 DBUS_EXPORT
00350 DBusPreallocatedSend* dbus_connection_preallocate_send       (DBusConnection       *connection);
00351 DBUS_EXPORT
00352 void                  dbus_connection_free_preallocated_send (DBusConnection       *connection,
00353                                                               DBusPreallocatedSend *preallocated);
00354 DBUS_EXPORT
00355 void                  dbus_connection_send_preallocated      (DBusConnection       *connection,
00356                                                               DBusPreallocatedSend *preallocated,
00357                                                               DBusMessage          *message,
00358                                                               dbus_uint32_t        *client_serial);
00359 
00360 
00361 /* Object tree functionality */
00362 
00367 typedef void              (* DBusObjectPathUnregisterFunction) (DBusConnection  *connection,
00368                                                                 void            *user_data);
00374 typedef DBusHandlerResult (* DBusObjectPathMessageFunction)    (DBusConnection  *connection,
00375                                                                 DBusMessage     *message,
00376                                                                 void            *user_data);
00377 
00384 struct DBusObjectPathVTable
00385 {
00386   DBusObjectPathUnregisterFunction   unregister_function; 
00387   DBusObjectPathMessageFunction      message_function; 
00389   void (* dbus_internal_pad1) (void *); 
00390   void (* dbus_internal_pad2) (void *); 
00391   void (* dbus_internal_pad3) (void *); 
00392   void (* dbus_internal_pad4) (void *); 
00393 };
00394 
00395 DBUS_EXPORT
00396 dbus_bool_t dbus_connection_try_register_object_path (DBusConnection              *connection,
00397                                                       const char                  *path,
00398                                                       const DBusObjectPathVTable  *vtable,
00399                                                       void                        *user_data,
00400                                                       DBusError                   *error);
00401 
00402 DBUS_EXPORT
00403 dbus_bool_t dbus_connection_register_object_path   (DBusConnection              *connection,
00404                                                     const char                  *path,
00405                                                     const DBusObjectPathVTable  *vtable,
00406                                                     void                        *user_data);
00407 
00408 DBUS_EXPORT
00409 dbus_bool_t dbus_connection_try_register_fallback (DBusConnection              *connection,
00410                                                    const char                  *path,
00411                                                    const DBusObjectPathVTable  *vtable,
00412                                                    void                        *user_data,
00413                                                    DBusError                   *error);
00414 
00415 DBUS_EXPORT
00416 dbus_bool_t dbus_connection_register_fallback      (DBusConnection              *connection,
00417                                                     const char                  *path,
00418                                                     const DBusObjectPathVTable  *vtable,
00419                                                     void                        *user_data);
00420 DBUS_EXPORT
00421 dbus_bool_t dbus_connection_unregister_object_path (DBusConnection              *connection,
00422                                                     const char                  *path);
00423 
00424 DBUS_EXPORT
00425 dbus_bool_t dbus_connection_get_object_path_data   (DBusConnection              *connection,
00426                                                     const char                  *path,
00427                                                     void                       **data_p);
00428 
00429 DBUS_EXPORT
00430 dbus_bool_t dbus_connection_list_registered        (DBusConnection              *connection,
00431                                                     const char                  *parent_path,
00432                                                     char                      ***child_entries);
00433 
00434 DBUS_EXPORT
00435 dbus_bool_t dbus_connection_get_unix_fd            (DBusConnection              *connection,
00436                                                     int                         *fd);
00437 DBUS_EXPORT
00438 dbus_bool_t dbus_connection_get_socket             (DBusConnection              *connection,
00439                                                     int                         *fd);
00440 
00449 #ifndef DBUS_DISABLE_DEPRECATED
00450 DBUS_EXPORT
00451 DBUS_DEPRECATED int dbus_watch_get_fd      (DBusWatch        *watch);
00452 #endif
00453 
00454 DBUS_EXPORT
00455 int          dbus_watch_get_unix_fd (DBusWatch        *watch);
00456 DBUS_EXPORT
00457 int          dbus_watch_get_socket  (DBusWatch        *watch);
00458 DBUS_EXPORT
00459 unsigned int dbus_watch_get_flags   (DBusWatch        *watch);
00460 DBUS_EXPORT
00461 void*        dbus_watch_get_data    (DBusWatch        *watch);
00462 DBUS_EXPORT
00463 void         dbus_watch_set_data    (DBusWatch        *watch,
00464                                      void             *data,
00465                                      DBusFreeFunction  free_data_function);
00466 DBUS_EXPORT
00467 dbus_bool_t  dbus_watch_handle      (DBusWatch        *watch,
00468                                      unsigned int      flags);
00469 DBUS_EXPORT
00470 dbus_bool_t  dbus_watch_get_enabled (DBusWatch        *watch);
00471 
00479 DBUS_EXPORT
00480 int         dbus_timeout_get_interval (DBusTimeout      *timeout);
00481 DBUS_EXPORT
00482 void*       dbus_timeout_get_data     (DBusTimeout      *timeout);
00483 DBUS_EXPORT
00484 void        dbus_timeout_set_data     (DBusTimeout      *timeout,
00485                                        void             *data,
00486                                        DBusFreeFunction  free_data_function);
00487 DBUS_EXPORT
00488 dbus_bool_t dbus_timeout_handle       (DBusTimeout      *timeout);
00489 DBUS_EXPORT
00490 dbus_bool_t dbus_timeout_get_enabled  (DBusTimeout      *timeout);
00491 
00494 DBUS_END_DECLS
00495 
00496 #endif /* DBUS_CONNECTION_H */

Generated on Fri Jul 11 2014 20:41:31 for D-Bus by  doxygen 1.7.1