00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
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
00043 typedef struct DBusWatch DBusWatch;
00044
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 } DBusWatchFlags;
00073
00078 typedef enum
00079 {
00080 DBUS_DISPATCH_DATA_REMAINS,
00081 DBUS_DISPATCH_COMPLETE,
00082 DBUS_DISPATCH_NEED_MEMORY
00083 } DBusDispatchStatus;
00084
00090 typedef dbus_bool_t (* DBusAddWatchFunction) (DBusWatch *watch,
00091 void *data);
00096 typedef void (* DBusWatchToggledFunction) (DBusWatch *watch,
00097 void *data);
00102 typedef void (* DBusRemoveWatchFunction) (DBusWatch *watch,
00103 void *data);
00109 typedef dbus_bool_t (* DBusAddTimeoutFunction) (DBusTimeout *timeout,
00110 void *data);
00116 typedef void (* DBusTimeoutToggledFunction) (DBusTimeout *timeout,
00117 void *data);
00122 typedef void (* DBusRemoveTimeoutFunction) (DBusTimeout *timeout,
00123 void *data);
00127 typedef void (* DBusDispatchStatusFunction) (DBusConnection *connection,
00128 DBusDispatchStatus new_status,
00129 void *data);
00134 typedef void (* DBusWakeupMainFunction) (void *data);
00135
00142 typedef dbus_bool_t (* DBusAllowUnixUserFunction) (DBusConnection *connection,
00143 unsigned long uid,
00144 void *data);
00145
00152 typedef dbus_bool_t (* DBusAllowWindowsUserFunction) (DBusConnection *connection,
00153 const char *user_sid,
00154 void *data);
00155
00156
00161 typedef void (* DBusPendingCallNotifyFunction) (DBusPendingCall *pending,
00162 void *user_data);
00163
00168 typedef DBusHandlerResult (* DBusHandleMessageFunction) (DBusConnection *connection,
00169 DBusMessage *message,
00170 void *user_data);
00171
00172 DBusConnection* dbus_connection_open (const char *address,
00173 DBusError *error);
00174 DBusConnection* dbus_connection_open_private (const char *address,
00175 DBusError *error);
00176 DBusConnection* dbus_connection_ref (DBusConnection *connection);
00177 void dbus_connection_unref (DBusConnection *connection);
00178 void dbus_connection_close (DBusConnection *connection);
00179 dbus_bool_t dbus_connection_get_is_connected (DBusConnection *connection);
00180 dbus_bool_t dbus_connection_get_is_authenticated (DBusConnection *connection);
00181 dbus_bool_t dbus_connection_get_is_anonymous (DBusConnection *connection);
00182 char* dbus_connection_get_server_id (DBusConnection *connection);
00183 void dbus_connection_set_exit_on_disconnect (DBusConnection *connection,
00184 dbus_bool_t exit_on_disconnect);
00185 void dbus_connection_flush (DBusConnection *connection);
00186 dbus_bool_t dbus_connection_read_write_dispatch (DBusConnection *connection,
00187 int timeout_milliseconds);
00188 dbus_bool_t dbus_connection_read_write (DBusConnection *connection,
00189 int timeout_milliseconds);
00190 DBusMessage* dbus_connection_borrow_message (DBusConnection *connection);
00191 void dbus_connection_return_message (DBusConnection *connection,
00192 DBusMessage *message);
00193 void dbus_connection_steal_borrowed_message (DBusConnection *connection,
00194 DBusMessage *message);
00195 DBusMessage* dbus_connection_pop_message (DBusConnection *connection);
00196 DBusDispatchStatus dbus_connection_get_dispatch_status (DBusConnection *connection);
00197 DBusDispatchStatus dbus_connection_dispatch (DBusConnection *connection);
00198 dbus_bool_t dbus_connection_has_messages_to_send (DBusConnection *connection);
00199 dbus_bool_t dbus_connection_send (DBusConnection *connection,
00200 DBusMessage *message,
00201 dbus_uint32_t *client_serial);
00202 dbus_bool_t dbus_connection_send_with_reply (DBusConnection *connection,
00203 DBusMessage *message,
00204 DBusPendingCall **pending_return,
00205 int timeout_milliseconds);
00206 DBusMessage * dbus_connection_send_with_reply_and_block (DBusConnection *connection,
00207 DBusMessage *message,
00208 int timeout_milliseconds,
00209 DBusError *error);
00210 dbus_bool_t dbus_connection_set_watch_functions (DBusConnection *connection,
00211 DBusAddWatchFunction add_function,
00212 DBusRemoveWatchFunction remove_function,
00213 DBusWatchToggledFunction toggled_function,
00214 void *data,
00215 DBusFreeFunction free_data_function);
00216 dbus_bool_t dbus_connection_set_timeout_functions (DBusConnection *connection,
00217 DBusAddTimeoutFunction add_function,
00218 DBusRemoveTimeoutFunction remove_function,
00219 DBusTimeoutToggledFunction toggled_function,
00220 void *data,
00221 DBusFreeFunction free_data_function);
00222 void dbus_connection_set_wakeup_main_function (DBusConnection *connection,
00223 DBusWakeupMainFunction wakeup_main_function,
00224 void *data,
00225 DBusFreeFunction free_data_function);
00226 void dbus_connection_set_dispatch_status_function (DBusConnection *connection,
00227 DBusDispatchStatusFunction function,
00228 void *data,
00229 DBusFreeFunction free_data_function);
00230 dbus_bool_t dbus_connection_get_unix_user (DBusConnection *connection,
00231 unsigned long *uid);
00232 dbus_bool_t dbus_connection_get_unix_process_id (DBusConnection *connection,
00233 unsigned long *pid);
00234 dbus_bool_t dbus_connection_get_adt_audit_session_data (DBusConnection *connection,
00235 void **data,
00236 dbus_int32_t *data_size);
00237 void dbus_connection_set_unix_user_function (DBusConnection *connection,
00238 DBusAllowUnixUserFunction function,
00239 void *data,
00240 DBusFreeFunction free_data_function);
00241 dbus_bool_t dbus_connection_get_windows_user (DBusConnection *connection,
00242 char **windows_sid_p);
00243 void dbus_connection_set_windows_user_function (DBusConnection *connection,
00244 DBusAllowWindowsUserFunction function,
00245 void *data,
00246 DBusFreeFunction free_data_function);
00247 void dbus_connection_set_allow_anonymous (DBusConnection *connection,
00248 dbus_bool_t value);
00249 void dbus_connection_set_route_peer_messages (DBusConnection *connection,
00250 dbus_bool_t value);
00251
00252
00253
00254
00255 dbus_bool_t dbus_connection_add_filter (DBusConnection *connection,
00256 DBusHandleMessageFunction function,
00257 void *user_data,
00258 DBusFreeFunction free_data_function);
00259 void dbus_connection_remove_filter (DBusConnection *connection,
00260 DBusHandleMessageFunction function,
00261 void *user_data);
00262
00263
00264
00265 dbus_bool_t dbus_connection_allocate_data_slot (dbus_int32_t *slot_p);
00266 void dbus_connection_free_data_slot (dbus_int32_t *slot_p);
00267 dbus_bool_t dbus_connection_set_data (DBusConnection *connection,
00268 dbus_int32_t slot,
00269 void *data,
00270 DBusFreeFunction free_data_func);
00271 void* dbus_connection_get_data (DBusConnection *connection,
00272 dbus_int32_t slot);
00273
00274 void dbus_connection_set_change_sigpipe (dbus_bool_t will_modify_sigpipe);
00275
00276 void dbus_connection_set_max_message_size (DBusConnection *connection,
00277 long size);
00278 long dbus_connection_get_max_message_size (DBusConnection *connection);
00279 void dbus_connection_set_max_received_size (DBusConnection *connection,
00280 long size);
00281 long dbus_connection_get_max_received_size (DBusConnection *connection);
00282 long dbus_connection_get_outgoing_size (DBusConnection *connection);
00283
00284 DBusPreallocatedSend* dbus_connection_preallocate_send (DBusConnection *connection);
00285 void dbus_connection_free_preallocated_send (DBusConnection *connection,
00286 DBusPreallocatedSend *preallocated);
00287 void dbus_connection_send_preallocated (DBusConnection *connection,
00288 DBusPreallocatedSend *preallocated,
00289 DBusMessage *message,
00290 dbus_uint32_t *client_serial);
00291
00292
00293
00294
00299 typedef void (* DBusObjectPathUnregisterFunction) (DBusConnection *connection,
00300 void *user_data);
00306 typedef DBusHandlerResult (* DBusObjectPathMessageFunction) (DBusConnection *connection,
00307 DBusMessage *message,
00308 void *user_data);
00309
00316 struct DBusObjectPathVTable
00317 {
00318 DBusObjectPathUnregisterFunction unregister_function;
00319 DBusObjectPathMessageFunction message_function;
00321 void (* dbus_internal_pad1) (void *);
00322 void (* dbus_internal_pad2) (void *);
00323 void (* dbus_internal_pad3) (void *);
00324 void (* dbus_internal_pad4) (void *);
00325 };
00326
00327 dbus_bool_t dbus_connection_try_register_object_path (DBusConnection *connection,
00328 const char *path,
00329 const DBusObjectPathVTable *vtable,
00330 void *user_data,
00331 DBusError *error);
00332
00333 dbus_bool_t dbus_connection_register_object_path (DBusConnection *connection,
00334 const char *path,
00335 const DBusObjectPathVTable *vtable,
00336 void *user_data);
00337
00338 dbus_bool_t dbus_connection_try_register_fallback (DBusConnection *connection,
00339 const char *path,
00340 const DBusObjectPathVTable *vtable,
00341 void *user_data,
00342 DBusError *error);
00343
00344 dbus_bool_t dbus_connection_register_fallback (DBusConnection *connection,
00345 const char *path,
00346 const DBusObjectPathVTable *vtable,
00347 void *user_data);
00348 dbus_bool_t dbus_connection_unregister_object_path (DBusConnection *connection,
00349 const char *path);
00350
00351 dbus_bool_t dbus_connection_get_object_path_data (DBusConnection *connection,
00352 const char *path,
00353 void **data_p);
00354
00355 dbus_bool_t dbus_connection_list_registered (DBusConnection *connection,
00356 const char *parent_path,
00357 char ***child_entries);
00358
00359 dbus_bool_t dbus_connection_get_unix_fd (DBusConnection *connection,
00360 int *fd);
00361 dbus_bool_t dbus_connection_get_socket (DBusConnection *connection,
00362 int *fd);
00363
00372 #ifndef DBUS_DISABLE_DEPRECATED
00373 DBUS_DEPRECATED int dbus_watch_get_fd (DBusWatch *watch);
00374 #endif
00375
00376 int dbus_watch_get_unix_fd (DBusWatch *watch);
00377 int dbus_watch_get_socket (DBusWatch *watch);
00378 unsigned int dbus_watch_get_flags (DBusWatch *watch);
00379 void* dbus_watch_get_data (DBusWatch *watch);
00380 void dbus_watch_set_data (DBusWatch *watch,
00381 void *data,
00382 DBusFreeFunction free_data_function);
00383 dbus_bool_t dbus_watch_handle (DBusWatch *watch,
00384 unsigned int flags);
00385 dbus_bool_t dbus_watch_get_enabled (DBusWatch *watch);
00386
00394 int dbus_timeout_get_interval (DBusTimeout *timeout);
00395 void* dbus_timeout_get_data (DBusTimeout *timeout);
00396 void dbus_timeout_set_data (DBusTimeout *timeout,
00397 void *data,
00398 DBusFreeFunction free_data_function);
00399 dbus_bool_t dbus_timeout_handle (DBusTimeout *timeout);
00400 dbus_bool_t dbus_timeout_get_enabled (DBusTimeout *timeout);
00401
00404 DBUS_END_DECLS
00405
00406 #endif