File indexing completed on 2025-01-18 09:55:13
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
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_CONNECTION_H
0028 #define DBUS_CONNECTION_H
0029
0030 #include <dbus/dbus-errors.h>
0031 #include <dbus/dbus-macros.h>
0032 #include <dbus/dbus-memory.h>
0033 #include <dbus/dbus-message.h>
0034 #include <dbus/dbus-shared.h>
0035
0036 DBUS_BEGIN_DECLS
0037
0038
0039
0040
0041
0042
0043
0044 typedef struct DBusWatch DBusWatch;
0045
0046 typedef struct DBusTimeout DBusTimeout;
0047
0048 typedef struct DBusPreallocatedSend DBusPreallocatedSend;
0049
0050 typedef struct DBusPendingCall DBusPendingCall;
0051
0052 typedef struct DBusConnection DBusConnection;
0053
0054 typedef struct DBusObjectPathVTable DBusObjectPathVTable;
0055
0056
0057
0058
0059 typedef enum
0060 {
0061 DBUS_WATCH_READABLE = 1 << 0,
0062 DBUS_WATCH_WRITABLE = 1 << 1,
0063 DBUS_WATCH_ERROR = 1 << 2,
0064
0065
0066
0067
0068 DBUS_WATCH_HANGUP = 1 << 3
0069
0070
0071
0072
0073
0074 } DBusWatchFlags;
0075
0076
0077
0078
0079
0080 typedef enum
0081 {
0082 DBUS_DISPATCH_DATA_REMAINS,
0083 DBUS_DISPATCH_COMPLETE,
0084 DBUS_DISPATCH_NEED_MEMORY
0085 } DBusDispatchStatus;
0086
0087
0088
0089
0090
0091
0092 typedef dbus_bool_t (* DBusAddWatchFunction) (DBusWatch *watch,
0093 void *data);
0094
0095
0096
0097
0098 typedef void (* DBusWatchToggledFunction) (DBusWatch *watch,
0099 void *data);
0100
0101
0102
0103
0104 typedef void (* DBusRemoveWatchFunction) (DBusWatch *watch,
0105 void *data);
0106
0107
0108
0109
0110
0111 typedef dbus_bool_t (* DBusAddTimeoutFunction) (DBusTimeout *timeout,
0112 void *data);
0113
0114
0115
0116
0117
0118 typedef void (* DBusTimeoutToggledFunction) (DBusTimeout *timeout,
0119 void *data);
0120
0121
0122
0123
0124 typedef void (* DBusRemoveTimeoutFunction) (DBusTimeout *timeout,
0125 void *data);
0126
0127
0128
0129 typedef void (* DBusDispatchStatusFunction) (DBusConnection *connection,
0130 DBusDispatchStatus new_status,
0131 void *data);
0132
0133
0134
0135
0136 typedef void (* DBusWakeupMainFunction) (void *data);
0137
0138
0139
0140
0141
0142
0143
0144 typedef dbus_bool_t (* DBusAllowUnixUserFunction) (DBusConnection *connection,
0145 unsigned long uid,
0146 void *data);
0147
0148
0149
0150
0151
0152
0153
0154 typedef dbus_bool_t (* DBusAllowWindowsUserFunction) (DBusConnection *connection,
0155 const char *user_sid,
0156 void *data);
0157
0158
0159
0160
0161
0162
0163 typedef void (* DBusPendingCallNotifyFunction) (DBusPendingCall *pending,
0164 void *user_data);
0165
0166
0167
0168
0169
0170 typedef DBusHandlerResult (* DBusHandleMessageFunction) (DBusConnection *connection,
0171 DBusMessage *message,
0172 void *user_data);
0173 DBUS_EXPORT
0174 DBusConnection* dbus_connection_open (const char *address,
0175 DBusError *error);
0176 DBUS_EXPORT
0177 DBusConnection* dbus_connection_open_private (const char *address,
0178 DBusError *error);
0179 DBUS_EXPORT
0180 DBusConnection* dbus_connection_ref (DBusConnection *connection);
0181 DBUS_EXPORT
0182 void dbus_connection_unref (DBusConnection *connection);
0183 DBUS_EXPORT
0184 void dbus_connection_close (DBusConnection *connection);
0185 DBUS_EXPORT
0186 dbus_bool_t dbus_connection_get_is_connected (DBusConnection *connection);
0187 DBUS_EXPORT
0188 dbus_bool_t dbus_connection_get_is_authenticated (DBusConnection *connection);
0189 DBUS_EXPORT
0190 dbus_bool_t dbus_connection_get_is_anonymous (DBusConnection *connection);
0191 DBUS_EXPORT
0192 char* dbus_connection_get_server_id (DBusConnection *connection);
0193 DBUS_EXPORT
0194 dbus_bool_t dbus_connection_can_send_type (DBusConnection *connection,
0195 int type);
0196
0197 DBUS_EXPORT
0198 void dbus_connection_set_exit_on_disconnect (DBusConnection *connection,
0199 dbus_bool_t exit_on_disconnect);
0200 DBUS_EXPORT
0201 void dbus_connection_flush (DBusConnection *connection);
0202 DBUS_EXPORT
0203 dbus_bool_t dbus_connection_read_write_dispatch (DBusConnection *connection,
0204 int timeout_milliseconds);
0205 DBUS_EXPORT
0206 dbus_bool_t dbus_connection_read_write (DBusConnection *connection,
0207 int timeout_milliseconds);
0208 DBUS_EXPORT
0209 DBusMessage* dbus_connection_borrow_message (DBusConnection *connection);
0210 DBUS_EXPORT
0211 void dbus_connection_return_message (DBusConnection *connection,
0212 DBusMessage *message);
0213 DBUS_EXPORT
0214 void dbus_connection_steal_borrowed_message (DBusConnection *connection,
0215 DBusMessage *message);
0216 DBUS_EXPORT
0217 DBusMessage* dbus_connection_pop_message (DBusConnection *connection);
0218 DBUS_EXPORT
0219 DBusDispatchStatus dbus_connection_get_dispatch_status (DBusConnection *connection);
0220 DBUS_EXPORT
0221 DBusDispatchStatus dbus_connection_dispatch (DBusConnection *connection);
0222 DBUS_EXPORT
0223 dbus_bool_t dbus_connection_has_messages_to_send (DBusConnection *connection);
0224 DBUS_EXPORT
0225 dbus_bool_t dbus_connection_send (DBusConnection *connection,
0226 DBusMessage *message,
0227 dbus_uint32_t *client_serial);
0228 DBUS_EXPORT
0229 dbus_bool_t dbus_connection_send_with_reply (DBusConnection *connection,
0230 DBusMessage *message,
0231 DBusPendingCall **pending_return,
0232 int timeout_milliseconds);
0233 DBUS_EXPORT
0234 DBusMessage * dbus_connection_send_with_reply_and_block (DBusConnection *connection,
0235 DBusMessage *message,
0236 int timeout_milliseconds,
0237 DBusError *error);
0238 DBUS_EXPORT
0239 dbus_bool_t dbus_connection_set_watch_functions (DBusConnection *connection,
0240 DBusAddWatchFunction add_function,
0241 DBusRemoveWatchFunction remove_function,
0242 DBusWatchToggledFunction toggled_function,
0243 void *data,
0244 DBusFreeFunction free_data_function);
0245 DBUS_EXPORT
0246 dbus_bool_t dbus_connection_set_timeout_functions (DBusConnection *connection,
0247 DBusAddTimeoutFunction add_function,
0248 DBusRemoveTimeoutFunction remove_function,
0249 DBusTimeoutToggledFunction toggled_function,
0250 void *data,
0251 DBusFreeFunction free_data_function);
0252 DBUS_EXPORT
0253 void dbus_connection_set_wakeup_main_function (DBusConnection *connection,
0254 DBusWakeupMainFunction wakeup_main_function,
0255 void *data,
0256 DBusFreeFunction free_data_function);
0257 DBUS_EXPORT
0258 void dbus_connection_set_dispatch_status_function (DBusConnection *connection,
0259 DBusDispatchStatusFunction function,
0260 void *data,
0261 DBusFreeFunction free_data_function);
0262 DBUS_EXPORT
0263 dbus_bool_t dbus_connection_get_unix_user (DBusConnection *connection,
0264 unsigned long *uid);
0265 DBUS_EXPORT
0266 dbus_bool_t dbus_connection_get_unix_process_id (DBusConnection *connection,
0267 unsigned long *pid);
0268 DBUS_EXPORT
0269 dbus_bool_t dbus_connection_get_adt_audit_session_data (DBusConnection *connection,
0270 void **data,
0271 dbus_int32_t *data_size);
0272 DBUS_EXPORT
0273 void dbus_connection_set_unix_user_function (DBusConnection *connection,
0274 DBusAllowUnixUserFunction function,
0275 void *data,
0276 DBusFreeFunction free_data_function);
0277 DBUS_EXPORT
0278 dbus_bool_t dbus_connection_get_windows_user (DBusConnection *connection,
0279 char **windows_sid_p);
0280 DBUS_EXPORT
0281 void dbus_connection_set_windows_user_function (DBusConnection *connection,
0282 DBusAllowWindowsUserFunction function,
0283 void *data,
0284 DBusFreeFunction free_data_function);
0285 DBUS_EXPORT
0286 void dbus_connection_set_allow_anonymous (DBusConnection *connection,
0287 dbus_bool_t value);
0288 DBUS_EXPORT
0289 void dbus_connection_set_route_peer_messages (DBusConnection *connection,
0290 dbus_bool_t value);
0291
0292
0293
0294
0295 DBUS_EXPORT
0296 dbus_bool_t dbus_connection_add_filter (DBusConnection *connection,
0297 DBusHandleMessageFunction function,
0298 void *user_data,
0299 DBusFreeFunction free_data_function);
0300 DBUS_EXPORT
0301 void dbus_connection_remove_filter (DBusConnection *connection,
0302 DBusHandleMessageFunction function,
0303 void *user_data);
0304
0305
0306
0307 DBUS_EXPORT
0308 dbus_bool_t dbus_connection_allocate_data_slot (dbus_int32_t *slot_p);
0309 DBUS_EXPORT
0310 void dbus_connection_free_data_slot (dbus_int32_t *slot_p);
0311 DBUS_EXPORT
0312 dbus_bool_t dbus_connection_set_data (DBusConnection *connection,
0313 dbus_int32_t slot,
0314 void *data,
0315 DBusFreeFunction free_data_func);
0316 DBUS_EXPORT
0317 void* dbus_connection_get_data (DBusConnection *connection,
0318 dbus_int32_t slot);
0319
0320 DBUS_EXPORT
0321 void dbus_connection_set_change_sigpipe (dbus_bool_t will_modify_sigpipe);
0322
0323 DBUS_EXPORT
0324 void dbus_connection_set_max_message_size (DBusConnection *connection,
0325 long size);
0326 DBUS_EXPORT
0327 long dbus_connection_get_max_message_size (DBusConnection *connection);
0328 DBUS_EXPORT
0329 void dbus_connection_set_max_received_size (DBusConnection *connection,
0330 long size);
0331 DBUS_EXPORT
0332 long dbus_connection_get_max_received_size (DBusConnection *connection);
0333
0334 DBUS_EXPORT
0335 void dbus_connection_set_max_message_unix_fds (DBusConnection *connection,
0336 long n);
0337 DBUS_EXPORT
0338 long dbus_connection_get_max_message_unix_fds (DBusConnection *connection);
0339 DBUS_EXPORT
0340 void dbus_connection_set_max_received_unix_fds(DBusConnection *connection,
0341 long n);
0342 DBUS_EXPORT
0343 long dbus_connection_get_max_received_unix_fds(DBusConnection *connection);
0344
0345 DBUS_EXPORT
0346 long dbus_connection_get_outgoing_size (DBusConnection *connection);
0347 DBUS_EXPORT
0348 long dbus_connection_get_outgoing_unix_fds (DBusConnection *connection);
0349
0350 DBUS_EXPORT
0351 DBusPreallocatedSend* dbus_connection_preallocate_send (DBusConnection *connection);
0352 DBUS_EXPORT
0353 void dbus_connection_free_preallocated_send (DBusConnection *connection,
0354 DBusPreallocatedSend *preallocated);
0355 DBUS_EXPORT
0356 void dbus_connection_send_preallocated (DBusConnection *connection,
0357 DBusPreallocatedSend *preallocated,
0358 DBusMessage *message,
0359 dbus_uint32_t *client_serial);
0360
0361
0362
0363
0364
0365
0366
0367
0368 typedef void (* DBusObjectPathUnregisterFunction) (DBusConnection *connection,
0369 void *user_data);
0370
0371
0372
0373
0374
0375 typedef DBusHandlerResult (* DBusObjectPathMessageFunction) (DBusConnection *connection,
0376 DBusMessage *message,
0377 void *user_data);
0378
0379
0380
0381
0382
0383
0384
0385 struct DBusObjectPathVTable
0386 {
0387 DBusObjectPathUnregisterFunction unregister_function;
0388 DBusObjectPathMessageFunction message_function;
0389
0390 void (* dbus_internal_pad1) (void *);
0391 void (* dbus_internal_pad2) (void *);
0392 void (* dbus_internal_pad3) (void *);
0393 void (* dbus_internal_pad4) (void *);
0394 };
0395
0396 DBUS_EXPORT
0397 dbus_bool_t dbus_connection_try_register_object_path (DBusConnection *connection,
0398 const char *path,
0399 const DBusObjectPathVTable *vtable,
0400 void *user_data,
0401 DBusError *error);
0402
0403 DBUS_EXPORT
0404 dbus_bool_t dbus_connection_register_object_path (DBusConnection *connection,
0405 const char *path,
0406 const DBusObjectPathVTable *vtable,
0407 void *user_data);
0408
0409 DBUS_EXPORT
0410 dbus_bool_t dbus_connection_try_register_fallback (DBusConnection *connection,
0411 const char *path,
0412 const DBusObjectPathVTable *vtable,
0413 void *user_data,
0414 DBusError *error);
0415
0416 DBUS_EXPORT
0417 dbus_bool_t dbus_connection_register_fallback (DBusConnection *connection,
0418 const char *path,
0419 const DBusObjectPathVTable *vtable,
0420 void *user_data);
0421 DBUS_EXPORT
0422 dbus_bool_t dbus_connection_unregister_object_path (DBusConnection *connection,
0423 const char *path);
0424
0425 DBUS_EXPORT
0426 dbus_bool_t dbus_connection_get_object_path_data (DBusConnection *connection,
0427 const char *path,
0428 void **data_p);
0429
0430 DBUS_EXPORT
0431 dbus_bool_t dbus_connection_list_registered (DBusConnection *connection,
0432 const char *parent_path,
0433 char ***child_entries);
0434
0435 DBUS_EXPORT
0436 dbus_bool_t dbus_connection_get_unix_fd (DBusConnection *connection,
0437 int *fd);
0438 DBUS_EXPORT
0439 dbus_bool_t dbus_connection_get_socket (DBusConnection *connection,
0440 int *fd);
0441
0442
0443
0444
0445
0446
0447
0448
0449
0450
0451
0452
0453
0454
0455
0456
0457
0458
0459
0460
0461
0462
0463
0464 static inline void
0465 dbus_clear_connection (DBusConnection **pointer_to_connection)
0466 {
0467 _dbus_clear_pointer_impl (DBusConnection, pointer_to_connection,
0468 dbus_connection_unref);
0469 }
0470
0471
0472
0473
0474
0475
0476
0477
0478
0479 #ifndef DBUS_DISABLE_DEPRECATED
0480 DBUS_EXPORT
0481 DBUS_DEPRECATED int dbus_watch_get_fd (DBusWatch *watch);
0482 #endif
0483
0484 DBUS_EXPORT
0485 int dbus_watch_get_unix_fd (DBusWatch *watch);
0486 DBUS_EXPORT
0487 int dbus_watch_get_socket (DBusWatch *watch);
0488 DBUS_EXPORT
0489 unsigned int dbus_watch_get_flags (DBusWatch *watch);
0490 DBUS_EXPORT
0491 void* dbus_watch_get_data (DBusWatch *watch);
0492 DBUS_EXPORT
0493 void dbus_watch_set_data (DBusWatch *watch,
0494 void *data,
0495 DBusFreeFunction free_data_function);
0496 DBUS_EXPORT
0497 dbus_bool_t dbus_watch_handle (DBusWatch *watch,
0498 unsigned int flags);
0499 DBUS_EXPORT
0500 dbus_bool_t dbus_watch_get_enabled (DBusWatch *watch);
0501
0502
0503
0504
0505
0506
0507
0508
0509 DBUS_EXPORT
0510 int dbus_timeout_get_interval (DBusTimeout *timeout);
0511 DBUS_EXPORT
0512 void* dbus_timeout_get_data (DBusTimeout *timeout);
0513 DBUS_EXPORT
0514 void dbus_timeout_set_data (DBusTimeout *timeout,
0515 void *data,
0516 DBusFreeFunction free_data_function);
0517 DBUS_EXPORT
0518 dbus_bool_t dbus_timeout_handle (DBusTimeout *timeout);
0519 DBUS_EXPORT
0520 dbus_bool_t dbus_timeout_get_enabled (DBusTimeout *timeout);
0521
0522
0523
0524 DBUS_END_DECLS
0525
0526 #endif