dbus-connection.inc 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. { -*- mode: C; c-file-style: "gnu" -*- }
  2. { dbus-connection.h DBusConnection object
  3. *
  4. * Copyright (C) 2002, 2003 Red Hat Inc.
  5. *
  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. {#include <dbus/dbus-errors.h>}
  24. {.$include dbus-memory.inc}
  25. {#include <dbus/dbus-message.h>}
  26. {.$include dbus-shared.inc}
  27. type
  28. DBusWatch = record end;
  29. PDBusWatch = ^DBusWatch;
  30. DBusTimeout = record end;
  31. PDBusTimeout = ^DBusTimeout;
  32. DBusPreallocatedSend = record end;
  33. PDBusPreallocatedSend = ^DBusPreallocatedSend;
  34. DBusPendingCall = record end;
  35. PDBusPendingCall = ^DBusPendingCall;
  36. PPDBusPendingCall = ^PDBusPendingCall;
  37. DBusConnection = record end;
  38. PDBusConnection = ^DBusConnection;
  39. DBusWatchFlags =
  40. (
  41. DBUS_WATCH_READABLE = 1 shl 0, {< As in POLLIN }
  42. DBUS_WATCH_WRITABLE = 1 shl 1, {< As in POLLOUT }
  43. DBUS_WATCH_ERROR = 1 shl 2, {< As in POLLERR (can't watch for this, but
  44. * the flag can be passed to dbus_watch_handle()).}
  45. DBUS_WATCH_HANGUP = 1 shl 3 {< As in POLLHUP (can't watch for it, but
  46. * can be present in current state). }
  47. );
  48. DBusDispatchStatus =
  49. (
  50. DBUS_DISPATCH_DATA_REMAINS, {< There is more data to potentially convert to messages. }
  51. DBUS_DISPATCH_COMPLETE, {< All currently available data has been processed. }
  52. DBUS_DISPATCH_NEED_MEMORY {< More memory is needed to continue. }
  53. );
  54. DBusAddWatchFunction = function (watch: PDBusWatch; data: Pointer): dbus_bool_t;
  55. DBusWatchToggledFunction = procedure(watch: PDBusWatch; data: Pointer);
  56. DBusRemoveWatchFunction = procedure(watch: PDBusWatch; data: Pointer);
  57. DBusAddTimeoutFunction = function(timeout: PDBusTimeout; data: Pointer): dbus_bool_t;
  58. DBusTimeoutToggledFunction = procedure(timeout: PDBusTimeout; data: Pointer);
  59. DBusRemoveTimeoutFunction = procedure(timeout: PDBusTimeout; data: Pointer);
  60. DBusDispatchStatusFunction = procedure(connection: PDBusConnection;
  61. new_status: DBusDispatchStatus; data: Pointer);
  62. DBusWakeupMainFunction = procedure(data: Pointer);
  63. DBusAllowUnixUserFunction = function(connection: PDBusConnection;
  64. uid: cuint; data: Pointer): dbus_bool_t;
  65. DBusPendingCallNotifyFunction = procedure(pending: PDBusPendingCall;
  66. user_data: Pointer);
  67. DBusHandleMessageFunction = function(connection: PDBusConnection;
  68. message_: PDBusMessage; user_data: Pointer): DBusHandlerResult;
  69. function dbus_connection_open(const address: PChar; error: PDBusError): PDBusConnection; cdecl; external LibDBus;
  70. function dbus_connection_open_private(const address: PChar; error: PDBusError): PDBusConnection; cdecl; external LibDBus;
  71. function dbus_connection_ref(connection: PDBusConnection): PDBusConnection; cdecl; external LibDBus;
  72. procedure dbus_connection_unref(connection: PDBusConnection); cdecl; external LibDBus;
  73. procedure dbus_connection_close(connection: PDBusConnection); cdecl; external LibDBus;
  74. function dbus_connection_get_is_connected(connection: PDBusConnection): dbus_bool_t; cdecl; external LibDBus;
  75. function dbus_connection_get_is_authenticated(connection: PDBusConnection): dbus_bool_t; cdecl; external LibDBus;
  76. procedure dbus_connection_set_exit_on_disconnect(connection: PDBusConnection;
  77. exit_on_disconnect: dbus_bool_t); cdecl; external LibDBus;
  78. procedure dbus_connection_flush(connection: PDBusConnection); cdecl; external LibDBus;
  79. function dbus_connection_read_write_dispatch(connection: PDBusConnection;
  80. timeout_milliseconds: Integer): dbus_bool_t; cdecl; external LibDBus;
  81. function dbus_connection_read_write(connection: PDBusConnection;
  82. timeout_milliseconds: Integer): dbus_bool_t; cdecl; external LibDBus;
  83. function dbus_connection_borrow_message(connection: PDBusConnection): PDBusMessage; cdecl; external LibDBus;
  84. procedure dbus_connection_return_message(connection: PDBusConnection; message_: PDBusMessage); cdecl; external LibDBus;
  85. procedure dbus_connection_steal_borrowed_message(connection: PDBusConnection; message_: PDBusMessage); cdecl; external LibDBus;
  86. function dbus_connection_pop_message(connection: PDBusConnection): PDBusMessage; cdecl; external LibDBus;
  87. function dbus_connection_get_dispatch_status(connection: PDBusConnection): DBusDispatchStatus; cdecl; external LibDBus;
  88. function dbus_connection_dispatch(connection: PDBusConnection): DBusDispatchStatus; cdecl; external LibDBus;
  89. function dbus_connection_has_messages_to_send(connection: PDBusConnection): dbus_bool_t; cdecl; external LibDBus;
  90. function dbus_connection_send(connection: PDBusConnection; message_: PDBusMessage;
  91. client_serial: Pdbus_uint32_t): dbus_bool_t; cdecl; external LibDBus;
  92. function dbus_connection_send_with_reply(connection: PDBusConnection;
  93. message_: PDBusMessage;
  94. pending_return: PPDBusPendingCall;
  95. timeout_milliseconds: cint): dbus_bool_t; cdecl; external LibDBus;
  96. function dbus_connection_send_with_reply_and_block(connection: PDBusConnection;
  97. message_: PDBusMessage;
  98. timeout_milliseconds: cint;
  99. error: PDBusError): PDBusMessage; cdecl; external LibDBus;
  100. function dbus_connection_set_watch_functions(connection: PDBusConnection;
  101. add_function: DBusAddWatchFunction;
  102. remove_function: DBusRemoveWatchFunction;
  103. toggled_function: DBusWatchToggledFunction;
  104. data: Pointer;
  105. free_data_function: DBusFreeFunction): dbus_bool_t; cdecl; external LibDBus;
  106. function dbus_connection_set_timeout_functions(connection: PDBusConnection;
  107. add_function: DBusAddTimeoutFunction;
  108. remove_function: DBusRemoveTimeoutFunction;
  109. toggled_function: DBusTimeoutToggledFunction;
  110. data: Pointer;
  111. free_data_function: DBusFreeFunction): dbus_bool_t; cdecl; external LibDBus;
  112. procedure dbus_connection_set_wakeup_main_function(connection: PDBusConnection;
  113. wakeup_main_function: DBusWakeupMainFunction;
  114. data: Pointer;
  115. free_data_function: DBusFreeFunction); cdecl; external LibDBus;
  116. procedure dbus_connection_set_dispatch_status_function (connection: PDBusConnection;
  117. function_: DBusDispatchStatusFunction;
  118. data: Pointer;
  119. free_data_function: DBusFreeFunction); cdecl; external LibDBus;
  120. function dbus_connection_get_unix_user(connection: PDBusConnection;
  121. uid: Pculong): dbus_bool_t; cdecl; external LibDBus;
  122. function dbus_connection_get_unix_process_id(connection: PDBusConnection;
  123. pid: Pculong): dbus_bool_t; cdecl; external LibDBus;
  124. procedure dbus_connection_set_unix_user_function(connection: PDBusConnection;
  125. function_: DBusAllowUnixUserFunction;
  126. data: Pointer;
  127. free_data_function: DBusFreeFunction); cdecl; external LibDBus;
  128. function dbus_watch_get_fd(watch: PDBusWatch): cint; cdecl; external LibDBus;
  129. function dbus_watch_get_flags(watch: PDBusWatch): cuint; cdecl; external LibDBus;
  130. function dbus_watch_get_data(watch: PDBusWatch): Pointer; cdecl; external LibDBus;
  131. procedure dbus_watch_set_data(watch: PDBusWatch;
  132. data: Pointer; free_data_function: DBusFreeFunction); cdecl; external LibDBus;
  133. function dbus_watch_handle(watch: PDBusWatch; flags: cuint): dbus_bool_t; cdecl; external LibDBus;
  134. function dbus_watch_get_enabled(watch: PDBusWatch): dbus_bool_t; cdecl; external LibDBus;
  135. function dbus_timeout_get_interval(timeout: PDBusTimeout): cint; cdecl; external LibDBus;
  136. function dbus_timeout_get_data(timeout: PDBusTimeout): Pointer; cdecl; external LibDBus;
  137. procedure dbus_timeout_set_data(timeout: PDBusTimeout;
  138. data: Pointer; free_data_function: DBusFreeFunction); cdecl; external LibDBus;
  139. function dbus_timeout_handle(timeout: PDBusTimeout): dbus_bool_t; cdecl; external LibDBus;
  140. function dbus_timeout_get_enabled(timeout: PDBusTimeout): dbus_bool_t; cdecl; external LibDBus;
  141. { Filters }
  142. function dbus_connection_add_filter(connection: PDBusConnection;
  143. function_: DBusHandleMessageFunction;
  144. user_data: Pointer; free_data_function: DBusFreeFunction): dbus_bool_t; cdecl; external LibDBus;
  145. procedure dbus_connection_remove_filter (connection: PDBusConnection;
  146. function_: DBusHandleMessageFunction; user_data: Pointer); cdecl; external LibDBus;
  147. { Other }
  148. function dbus_connection_allocate_data_slot (slot_p: Pdbus_int32_t): dbus_bool_t; cdecl; external LibDBus;
  149. procedure dbus_connection_free_data_slot (slot_p: Pdbus_int32_t); cdecl; external LibDBus;
  150. function dbus_connection_set_data(connection: PDBusConnection;
  151. slot: dbus_int32_t; data: Pointer; free_data_func: DBusFreeFunction): dbus_bool_t; cdecl; external LibDBus;
  152. function dbus_connection_get_data(connection: PDBusConnection; slot: dbus_int32_t): Pointer; cdecl; external LibDBus;
  153. procedure dbus_connection_set_change_sigpipe (will_modify_sigpipe: dbus_bool_t); cdecl; external LibDBus;
  154. procedure dbus_connection_set_max_message_size (connection: PDBusConnection; size: clong); cdecl; external LibDBus;
  155. function dbus_connection_get_max_message_size (connection: PDBusConnection): clong; cdecl; external LibDBus;
  156. procedure dbus_connection_set_max_received_size (connection: PDBusConnection; size: clong); cdecl; external LibDBus;
  157. function dbus_connection_get_max_received_size (connection: PDBusConnection): clong; cdecl; external LibDBus;
  158. function dbus_connection_get_outgoing_size (connection: PDBusConnection): clong; cdecl; external LibDBus;
  159. function dbus_connection_preallocate_send (connection: PDBusConnection): PDBusPreallocatedSend; cdecl; external LibDBus;
  160. procedure dbus_connection_free_preallocated_send (connection: PDBusConnection; preallocated: PDBusPreallocatedSend); cdecl; external LibDBus;
  161. procedure dbus_connection_send_preallocated (connection: PDBusConnection;
  162. preallocated: PDBusPreallocatedSend;
  163. message_: PDBusMessage; client_serial: Pdbus_uint32_t); cdecl; external LibDBus;
  164. { Object tree functionality }
  165. type
  166. DBusObjectPathUnregisterFunction = procedure(connection: PDBusConnection;
  167. user_data: Pointer);
  168. DBusObjectPathMessageFunction = function(connection: PDBusConnection;
  169. message_: PDBusMessage; user_data: Pointer): DBusHandlerResult;
  170. {
  171. * Virtual table that must be implemented to handle a portion of the
  172. * object path hierarchy.
  173. }
  174. dbus_internal_func = procedure(param1: Pointer);
  175. PDBusObjectPathVTable = ^DBusObjectPathVTable;
  176. DBusObjectPathVTable = record
  177. unregister_function: DBusObjectPathUnregisterFunction; {< Function to unregister this handler }
  178. message_function: DBusObjectPathMessageFunction; {< Function to handle messages }
  179. dbus_internal_pad1: dbus_internal_func; {< Reserved for future expansion }
  180. dbus_internal_pad2: dbus_internal_func; {< Reserved for future expansion }
  181. dbus_internal_pad3: dbus_internal_func; {< Reserved for future expansion }
  182. dbus_internal_pad4: dbus_internal_func; {< Reserved for future expansion }
  183. end;
  184. function dbus_connection_register_object_path(connection: PDBusConnection;
  185. const path: PChar;
  186. const vtable: PDBusObjectPathVTable;
  187. user_data: Pointer): dbus_bool_t; cdecl; external LibDBus;
  188. function dbus_connection_register_fallback(connection: PDBusConnection;
  189. const path: PChar;
  190. const vtable: PDBusObjectPathVTable;
  191. user_data: Pointer): dbus_bool_t; cdecl; external LibDBus;
  192. function dbus_connection_unregister_object_path(connection: PDBusConnection;
  193. const path: PChar): dbus_bool_t; cdecl; external LibDBus;
  194. function dbus_connection_get_object_path_data(connection: PDBusConnection;
  195. const path: PChar;
  196. data_p: PPointer): dbus_bool_t; cdecl; external LibDBus;
  197. function dbus_connection_list_registered(connection: PDBusConnection;
  198. const parent_path: PChar;
  199. child_entries: PPPChar): dbus_bool_t; cdecl; external LibDBus;
  200. function dbus_connection_get_unix_fd(connection: PDBusConnection;
  201. fd: Pcint): dbus_bool_t; cdecl; external LibDBus;