Main Page   Modules   Data Structures   File List   Data Fields   Related Pages  

dbus-connection.h

00001 /* -*- mode: C; c-file-style: "gnu" -*- */
00002 /* dbus-connection.h DBusConnection object
00003  *
00004  * Copyright (C) 2002  Red Hat Inc.
00005  *
00006  * Licensed under the Academic Free License version 1.2
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_CONNECTION_H
00028 #define DBUS_CONNECTION_H
00029 
00030 #include <dbus/dbus-errors.h>
00031 #include <dbus/dbus-message.h>
00032 #include <dbus/dbus-memory.h>
00033 
00034 DBUS_BEGIN_DECLS;
00035 
00036 typedef struct DBusConnection DBusConnection;
00037 typedef struct DBusWatch DBusWatch;
00038 typedef struct DBusTimeout DBusTimeout;
00039 typedef struct DBusMessageHandler DBusMessageHandler;
00040 typedef struct DBusPreallocatedSend DBusPreallocatedSend;
00041 
00042 typedef enum
00043 {
00044   DBUS_HANDLER_RESULT_REMOVE_MESSAGE,     
00045   DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS 
00046 } DBusHandlerResult;
00047 
00048 typedef enum
00049 {
00050   DBUS_WATCH_READABLE = 1 << 0, 
00051   DBUS_WATCH_WRITABLE = 1 << 1, 
00052   DBUS_WATCH_ERROR    = 1 << 2, 
00055   DBUS_WATCH_HANGUP   = 1 << 3  
00057 } DBusWatchFlags;
00058 
00059 typedef enum
00060 {
00061   DBUS_DISPATCH_DATA_REMAINS,  
00062   DBUS_DISPATCH_COMPLETE,      
00063   DBUS_DISPATCH_NEED_MEMORY    
00064 } DBusDispatchStatus;
00065 
00066 typedef dbus_bool_t (* DBusAddWatchFunction)       (DBusWatch      *watch,
00067                                                     void           *data);
00068 typedef void        (* DBusWatchToggledFunction)   (DBusWatch      *watch,
00069                                                     void           *data);
00070 typedef void        (* DBusRemoveWatchFunction)    (DBusWatch      *watch,
00071                                                     void           *data);
00072 typedef dbus_bool_t (* DBusAddTimeoutFunction)     (DBusTimeout    *timeout,
00073                                                     void           *data);
00074 typedef void        (* DBusTimeoutToggledFunction) (DBusTimeout    *timeout,
00075                                                     void           *data);
00076 typedef void        (* DBusRemoveTimeoutFunction)  (DBusTimeout    *timeout,
00077                                                     void           *data);
00078 typedef void        (* DBusDispatchStatusFunction) (DBusConnection *connection,
00079                                                     DBusDispatchStatus new_status,
00080                                                     void           *data);
00081 typedef void        (* DBusWakeupMainFunction)     (void           *data);
00082 typedef dbus_bool_t (* DBusAllowUnixUserFunction)  (DBusConnection *connection,
00083                                                     unsigned long   uid,
00084                                                     void           *data);
00085 
00086 DBusConnection*    dbus_connection_open                         (const char                 *address,
00087                                                                  DBusError                  *error);
00088 void               dbus_connection_ref                          (DBusConnection             *connection);
00089 void               dbus_connection_unref                        (DBusConnection             *connection);
00090 void               dbus_connection_disconnect                   (DBusConnection             *connection);
00091 dbus_bool_t        dbus_connection_get_is_connected             (DBusConnection             *connection);
00092 dbus_bool_t        dbus_connection_get_is_authenticated         (DBusConnection             *connection);
00093 void               dbus_connection_flush                        (DBusConnection             *connection);
00094 DBusMessage*       dbus_connection_borrow_message               (DBusConnection             *connection);
00095 void               dbus_connection_return_message               (DBusConnection             *connection,
00096                                                                  DBusMessage                *message);
00097 void               dbus_connection_steal_borrowed_message       (DBusConnection             *connection,
00098                                                                  DBusMessage                *message);
00099 DBusMessage*       dbus_connection_pop_message                  (DBusConnection             *connection);
00100 DBusDispatchStatus dbus_connection_get_dispatch_status          (DBusConnection             *connection);
00101 DBusDispatchStatus dbus_connection_dispatch                     (DBusConnection             *connection);
00102 dbus_bool_t        dbus_connection_send                         (DBusConnection             *connection,
00103                                                                  DBusMessage                *message,
00104                                                                  dbus_uint32_t              *client_serial);
00105 dbus_bool_t        dbus_connection_send_with_reply              (DBusConnection             *connection,
00106                                                                  DBusMessage                *message,
00107                                                                  DBusMessageHandler         *reply_handler,
00108                                                                  int                         timeout_milliseconds);
00109 DBusMessage *      dbus_connection_send_with_reply_and_block    (DBusConnection             *connection,
00110                                                                  DBusMessage                *message,
00111                                                                  int                         timeout_milliseconds,
00112                                                                  DBusError                  *error);
00113 dbus_bool_t        dbus_connection_set_watch_functions          (DBusConnection             *connection,
00114                                                                  DBusAddWatchFunction        add_function,
00115                                                                  DBusRemoveWatchFunction     remove_function,
00116                                                                  DBusWatchToggledFunction    toggled_function,
00117                                                                  void                       *data,
00118                                                                  DBusFreeFunction            free_data_function);
00119 dbus_bool_t        dbus_connection_set_timeout_functions        (DBusConnection             *connection,
00120                                                                  DBusAddTimeoutFunction      add_function,
00121                                                                  DBusRemoveTimeoutFunction   remove_function,
00122                                                                  DBusTimeoutToggledFunction  toggled_function,
00123                                                                  void                       *data,
00124                                                                  DBusFreeFunction            free_data_function);
00125 void               dbus_connection_set_wakeup_main_function     (DBusConnection             *connection,
00126                                                                  DBusWakeupMainFunction      wakeup_main_function,
00127                                                                  void                       *data,
00128                                                                  DBusFreeFunction            free_data_function);
00129 void               dbus_connection_set_dispatch_status_function (DBusConnection             *connection,
00130                                                                  DBusDispatchStatusFunction  function,
00131                                                                  void                       *data,
00132                                                                  DBusFreeFunction            free_data_function);
00133 dbus_bool_t        dbus_connection_get_unix_user                (DBusConnection             *connection,
00134                                                                  unsigned long              *uid);
00135 void               dbus_connection_set_unix_user_function       (DBusConnection             *connection,
00136                                                                  DBusAllowUnixUserFunction   function,
00137                                                                  void                       *data,
00138                                                                  DBusFreeFunction            free_data_function);
00139 
00140 
00141 int          dbus_watch_get_fd      (DBusWatch        *watch);
00142 unsigned int dbus_watch_get_flags   (DBusWatch        *watch);
00143 void*        dbus_watch_get_data    (DBusWatch        *watch);
00144 void         dbus_watch_set_data    (DBusWatch        *watch,
00145                                      void             *data,
00146                                      DBusFreeFunction  free_data_function);
00147 dbus_bool_t  dbus_watch_handle      (DBusWatch        *watch,
00148                                      unsigned int      flags);
00149 dbus_bool_t  dbus_watch_get_enabled (DBusWatch        *watch);
00150 
00151 int         dbus_timeout_get_interval (DBusTimeout      *timeout);
00152 void*       dbus_timeout_get_data     (DBusTimeout      *timeout);
00153 void        dbus_timeout_set_data     (DBusTimeout      *timeout,
00154                                        void             *data,
00155                                        DBusFreeFunction  free_data_function);
00156 dbus_bool_t dbus_timeout_handle       (DBusTimeout      *timeout);
00157 dbus_bool_t dbus_timeout_get_enabled  (DBusTimeout      *timeout);
00158 
00159 /* Handlers */
00160 dbus_bool_t dbus_connection_add_filter         (DBusConnection      *connection,
00161                                                 DBusMessageHandler  *handler);
00162 void        dbus_connection_remove_filter      (DBusConnection      *connection,
00163                                                 DBusMessageHandler  *handler);
00164 
00165 dbus_bool_t dbus_connection_register_handler   (DBusConnection      *connection,
00166                                                 DBusMessageHandler  *handler,
00167                                                 const char         **messages_to_handle,
00168                                                 int                  n_messages);
00169 void        dbus_connection_unregister_handler (DBusConnection      *connection,
00170                                                 DBusMessageHandler  *handler,
00171                                                 const char         **messages_to_handle,
00172                                                 int                  n_messages);
00173 
00174 
00175 dbus_bool_t dbus_connection_allocate_data_slot (dbus_int32_t     *slot_p);
00176 void        dbus_connection_free_data_slot     (dbus_int32_t     *slot_p);
00177 dbus_bool_t dbus_connection_set_data           (DBusConnection   *connection,
00178                                                 dbus_int32_t      slot,
00179                                                 void             *data,
00180                                                 DBusFreeFunction  free_data_func);
00181 void*       dbus_connection_get_data           (DBusConnection   *connection,
00182                                                 dbus_int32_t      slot);
00183 
00184 void        dbus_connection_set_change_sigpipe (dbus_bool_t       will_modify_sigpipe); 
00185 
00186 void dbus_connection_set_max_message_size  (DBusConnection *connection,
00187                                             long            size);
00188 long dbus_connection_get_max_message_size  (DBusConnection *connection);
00189 void dbus_connection_set_max_received_size (DBusConnection *connection,
00190                                             long            size);
00191 long dbus_connection_get_max_received_size (DBusConnection *connection);
00192 long dbus_connection_get_outgoing_size     (DBusConnection *connection);
00193 
00194 DBusPreallocatedSend* dbus_connection_preallocate_send       (DBusConnection       *connection);
00195 void                  dbus_connection_free_preallocated_send (DBusConnection       *connection,
00196                                                               DBusPreallocatedSend *preallocated);
00197 void                  dbus_connection_send_preallocated      (DBusConnection       *connection,
00198                                                               DBusPreallocatedSend *preallocated,
00199                                                               DBusMessage          *message,
00200                                                               dbus_uint32_t        *client_serial);
00201 
00202 
00203 DBUS_END_DECLS;
00204 
00205 #endif /* DBUS_CONNECTION_H */

Generated on Wed Oct 22 14:05:01 2003 for D-BUS by doxygen1.3-rc3