mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-16 04:59:25 +02:00
+ Initial check-in from Felipe Monteiro de Carvalho's implementation of dbus
git-svn-id: trunk@4872 -
This commit is contained in:
parent
61d979808a
commit
df7323318f
22
.gitattributes
vendored
22
.gitattributes
vendored
@ -1242,6 +1242,28 @@ packages/Makefile svneol=native#text/plain
|
||||
packages/Makefile.fpc svneol=native#text/plain
|
||||
packages/base/Makefile svneol=native#text/plain
|
||||
packages/base/Makefile.fpc svneol=native#text/plain
|
||||
packages/base/dbus/Makefile svneol=native#text/plain
|
||||
packages/base/dbus/Makefile.fpc svneol=native#text/plain
|
||||
packages/base/dbus/dbus-address.inc svneol=native#text/plain
|
||||
packages/base/dbus/dbus-arch-deps.inc svneol=native#text/plain
|
||||
packages/base/dbus/dbus-bus.inc svneol=native#text/plain
|
||||
packages/base/dbus/dbus-connection.inc svneol=native#text/plain
|
||||
packages/base/dbus/dbus-errors.inc svneol=native#text/plain
|
||||
packages/base/dbus/dbus-macros.inc svneol=native#text/plain
|
||||
packages/base/dbus/dbus-memory.inc svneol=native#text/plain
|
||||
packages/base/dbus/dbus-message.inc svneol=native#text/plain
|
||||
packages/base/dbus/dbus-pending-call.inc svneol=native#text/plain
|
||||
packages/base/dbus/dbus-protocol.inc svneol=native#text/plain
|
||||
packages/base/dbus/dbus-server.inc svneol=native#text/plain
|
||||
packages/base/dbus/dbus-shared.inc svneol=native#text/plain
|
||||
packages/base/dbus/dbus-signature.inc svneol=native#text/plain
|
||||
packages/base/dbus/dbus-threads.inc svneol=native#text/plain
|
||||
packages/base/dbus/dbus-types.inc svneol=native#text/plain
|
||||
packages/base/dbus/dbus.pas svneol=native#text/plain
|
||||
packages/base/dbus/dbus_arch_deps.inc svneol=native#text/plain
|
||||
packages/base/dbus/example/Makefile svneol=native#text/plain
|
||||
packages/base/dbus/example/Makefile.fpc svneol=native#text/plain
|
||||
packages/base/dbus/example/busexample.pp svneol=native#text/plain
|
||||
packages/base/fpmake.inc svneol=native#text/plain
|
||||
packages/base/fpmake.pp svneol=native#text/plain
|
||||
packages/base/gdbint/Makefile svneol=native#text/plain
|
||||
|
1766
packages/base/dbus/Makefile
Normal file
1766
packages/base/dbus/Makefile
Normal file
File diff suppressed because it is too large
Load Diff
22
packages/base/dbus/Makefile.fpc
Normal file
22
packages/base/dbus/Makefile.fpc
Normal file
@ -0,0 +1,22 @@
|
||||
#
|
||||
# Makefile.fpc for dbus unit
|
||||
#
|
||||
|
||||
[package]
|
||||
name=dbus
|
||||
version=2.0.4
|
||||
|
||||
[target]
|
||||
units=dbus
|
||||
exampledirs=example
|
||||
|
||||
[require]
|
||||
libc=y
|
||||
|
||||
[install]
|
||||
fpcpackage=y
|
||||
|
||||
[default]
|
||||
fpcdir=../../..
|
||||
|
||||
[rules]
|
45
packages/base/dbus/dbus-address.inc
Normal file
45
packages/base/dbus/dbus-address.inc
Normal file
@ -0,0 +1,45 @@
|
||||
{ -*- mode: C; c-file-style: "gnu" -*- }
|
||||
{ dbus-address.h Server address parser.
|
||||
*
|
||||
* Copyright (C) 2003 CodeFactory AB
|
||||
*
|
||||
* Licensed under the Academic Free License version 2.1
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
}
|
||||
|
||||
//#include <dbus/dbus-types.h>
|
||||
//#include <dbus/dbus-errors.h>
|
||||
|
||||
type
|
||||
|
||||
DBusAddressEntry = record end;
|
||||
|
||||
PDBusAddressEntry = ^DBusAddressEntry;
|
||||
|
||||
PPDBusAddressEntry = ^PDBusAddressEntry;
|
||||
|
||||
PPPDBusAddressEntry = ^PPDBusAddressEntry;
|
||||
|
||||
function dbus_parse_address(const address: PChar; entry: PPPDBusAddressEntry;
|
||||
array_len: PInteger; error: PDBusError): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_address_entry_get_value(entry: PDBusAddressEntry; const key: PChar): PChar; cdecl; external LibDBus;
|
||||
function dbus_address_entry_get_method(entry: PDBusAddressEntry): PChar; cdecl; external LibDBus;
|
||||
procedure dbus_address_entries_free(entries: PPDBusAddressEntry); cdecl; external LibDBus;
|
||||
|
||||
function dbus_address_escape_value(const value: PChar): PChar; cdecl; external LibDBus;
|
||||
function dbus_address_unescape_value(const value: PChar; error: PDBusError): PChar; cdecl; external LibDBus;
|
||||
|
46
packages/base/dbus/dbus-arch-deps.inc
Normal file
46
packages/base/dbus/dbus-arch-deps.inc
Normal file
@ -0,0 +1,46 @@
|
||||
{ -*- mode: C; c-file-style: "gnu" -*- }
|
||||
{ dbus-arch-deps.h Header with architecture/compiler specific information, installed to libdir
|
||||
*
|
||||
* Copyright (C) 2003 Red Hat, Inc.
|
||||
*
|
||||
* Licensed under the Academic Free License version 2.0
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
}
|
||||
|
||||
//#include <dbus/dbus-macros.h>
|
||||
|
||||
const DBUS_HAVE_INT64 = 1;
|
||||
|
||||
type
|
||||
dbus_int64_t = Int64;
|
||||
|
||||
dbus_uint64_t = Int64;
|
||||
|
||||
{#define DBUS_INT64_CONSTANT(val) (val##LL)
|
||||
#define DBUS_UINT64_CONSTANT(val) (val##ULL)}
|
||||
|
||||
dbus_int32_t = cint;
|
||||
Pdbus_int32_t = ^dbus_int32_t;
|
||||
|
||||
dbus_uint32_t = cuint;
|
||||
Pdbus_uint32_t = ^dbus_uint32_t;
|
||||
|
||||
dbus_int16_t = cshort;
|
||||
dbus_uint16_t = cushort;
|
||||
|
||||
size_t = Integer;
|
||||
|
52
packages/base/dbus/dbus-bus.inc
Normal file
52
packages/base/dbus/dbus-bus.inc
Normal file
@ -0,0 +1,52 @@
|
||||
{ -*- mode: C; c-file-style: "gnu" -*- }
|
||||
{ dbus-bus.h Convenience functions for communicating with the bus.
|
||||
*
|
||||
* Copyright (C) 2003 CodeFactory AB
|
||||
*
|
||||
* Licensed under the Academic Free License version 2.1
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
}
|
||||
|
||||
//#include <dbus/dbus-connection.h>
|
||||
|
||||
function dbus_bus_get(type_: DBusBusType; error: PDBusError): PDBusConnection; cdecl; external LibDBus;
|
||||
function dbus_bus_get_private(type_: DBusBusType; error: PDBusError): PDBusConnection; cdecl; external LibDBus;
|
||||
|
||||
function dbus_bus_register(connection: PDBusConnection; error: PDBusError): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_bus_set_unique_name(connection: PDBusConnection;
|
||||
const unique_name: PChar): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_bus_get_unique_name(connection: PDBusConnection): PChar; cdecl; external LibDBus;
|
||||
function dbus_bus_get_unix_user(connection: PDBusConnection;
|
||||
const name: PChar; error: PDBusError): culong; cdecl; external LibDBus;
|
||||
function dbus_bus_request_name(connection: PDBusConnection;
|
||||
const name: PChar; flags: cuint; error: PDBusError): cint; cdecl; external LibDBus;
|
||||
function dbus_bus_release_name(connection: PDBusConnection;
|
||||
const name: PChar; error: PDBusError): cint; cdecl; external LibDBus;
|
||||
function dbus_bus_name_has_owner(connection: PDBusConnection;
|
||||
const name: PChar; error: PDBusError): dbus_bool_t; cdecl; external LibDBus;
|
||||
|
||||
function dbus_bus_start_service_by_name (connection: PDBusConnection;
|
||||
const name: PChar; flags: dbus_uint32_t; reply: Pdbus_uint32_t;
|
||||
error: PDBusError): dbus_bool_t; cdecl; external LibDBus;
|
||||
|
||||
procedure dbus_bus_add_match(connection: PDBusConnection;
|
||||
const rule: PChar; error: PDBusError); cdecl; external LibDBus;
|
||||
procedure dbus_bus_remove_match(connection: PDBusConnection;
|
||||
const rule: PChar; error: PDBusError); cdecl; external LibDBus;
|
||||
|
||||
procedure _dbus_bus_check_connection_and_unref (connection: PDBusConnection); cdecl; external LibDBus;
|
||||
|
236
packages/base/dbus/dbus-connection.inc
Normal file
236
packages/base/dbus/dbus-connection.inc
Normal file
@ -0,0 +1,236 @@
|
||||
{ -*- mode: C; c-file-style: "gnu" -*- }
|
||||
{ dbus-connection.h DBusConnection object
|
||||
*
|
||||
* Copyright (C) 2002, 2003 Red Hat Inc.
|
||||
*
|
||||
* Licensed under the Academic Free License version 2.1
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
}
|
||||
|
||||
{#include <dbus/dbus-errors.h>}
|
||||
{.$include dbus-memory.inc}
|
||||
{#include <dbus/dbus-message.h>}
|
||||
{.$include dbus-shared.inc}
|
||||
|
||||
type
|
||||
DBusWatch = record end;
|
||||
PDBusWatch = ^DBusWatch;
|
||||
|
||||
DBusTimeout = record end;
|
||||
PDBusTimeout = ^DBusTimeout;
|
||||
|
||||
DBusPreallocatedSend = record end;
|
||||
PDBusPreallocatedSend = ^DBusPreallocatedSend;
|
||||
|
||||
DBusPendingCall = record end;
|
||||
PDBusPendingCall = ^DBusPendingCall;
|
||||
PPDBusPendingCall = ^PDBusPendingCall;
|
||||
|
||||
DBusConnection = record end;
|
||||
PDBusConnection = ^DBusConnection;
|
||||
|
||||
DBusWatchFlags =
|
||||
(
|
||||
DBUS_WATCH_READABLE = 1 shl 0, {< As in POLLIN }
|
||||
DBUS_WATCH_WRITABLE = 1 shl 1, {< As in POLLOUT }
|
||||
DBUS_WATCH_ERROR = 1 shl 2, {< As in POLLERR (can't watch for this, but
|
||||
* the flag can be passed to dbus_watch_handle()).}
|
||||
DBUS_WATCH_HANGUP = 1 shl 3 {< As in POLLHUP (can't watch for it, but
|
||||
* can be present in current state). }
|
||||
);
|
||||
|
||||
DBusDispatchStatus =
|
||||
(
|
||||
DBUS_DISPATCH_DATA_REMAINS, {< There is more data to potentially convert to messages. }
|
||||
DBUS_DISPATCH_COMPLETE, {< All currently available data has been processed. }
|
||||
DBUS_DISPATCH_NEED_MEMORY {< More memory is needed to continue. }
|
||||
);
|
||||
|
||||
DBusAddWatchFunction = function (watch: PDBusWatch; data: Pointer): dbus_bool_t;
|
||||
DBusWatchToggledFunction = procedure(watch: PDBusWatch; data: Pointer);
|
||||
DBusRemoveWatchFunction = procedure(watch: PDBusWatch; data: Pointer);
|
||||
DBusAddTimeoutFunction = function(timeout: PDBusTimeout; data: Pointer): dbus_bool_t;
|
||||
DBusTimeoutToggledFunction = procedure(timeout: PDBusTimeout; data: Pointer);
|
||||
DBusRemoveTimeoutFunction = procedure(timeout: PDBusTimeout; data: Pointer);
|
||||
DBusDispatchStatusFunction = procedure(connection: PDBusConnection;
|
||||
new_status: DBusDispatchStatus; data: Pointer);
|
||||
DBusWakeupMainFunction = procedure(data: Pointer);
|
||||
DBusAllowUnixUserFunction = function(connection: PDBusConnection;
|
||||
uid: cuint; data: Pointer): dbus_bool_t;
|
||||
|
||||
DBusPendingCallNotifyFunction = procedure(pending: PDBusPendingCall;
|
||||
user_data: Pointer);
|
||||
|
||||
DBusHandleMessageFunction = function(connection: PDBusConnection;
|
||||
message_: PDBusMessage; user_data: Pointer): DBusHandlerResult;
|
||||
|
||||
function dbus_connection_open(const address: PChar; error: PDBusError): PDBusConnection; cdecl; external LibDBus;
|
||||
function dbus_connection_open_private(const address: PChar; error: PDBusError): PDBusConnection; cdecl; external LibDBus;
|
||||
function dbus_connection_ref(connection: PDBusConnection): PDBusConnection; cdecl; external LibDBus;
|
||||
procedure dbus_connection_unref(connection: PDBusConnection); cdecl; external LibDBus;
|
||||
procedure dbus_connection_close(connection: PDBusConnection); cdecl; external LibDBus;
|
||||
function dbus_connection_get_is_connected(connection: PDBusConnection): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_connection_get_is_authenticated(connection: PDBusConnection): dbus_bool_t; cdecl; external LibDBus;
|
||||
procedure dbus_connection_set_exit_on_disconnect(connection: PDBusConnection;
|
||||
exit_on_disconnect: dbus_bool_t); cdecl; external LibDBus;
|
||||
procedure dbus_connection_flush(connection: PDBusConnection); cdecl; external LibDBus;
|
||||
function dbus_connection_read_write_dispatch(connection: PDBusConnection;
|
||||
timeout_milliseconds: Integer): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_connection_read_write(connection: PDBusConnection;
|
||||
timeout_milliseconds: Integer): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_connection_borrow_message(connection: PDBusConnection): PDBusMessage; cdecl; external LibDBus;
|
||||
procedure dbus_connection_return_message(connection: PDBusConnection; message_: PDBusMessage); cdecl; external LibDBus;
|
||||
procedure dbus_connection_steal_borrowed_message(connection: PDBusConnection; message_: PDBusMessage); cdecl; external LibDBus;
|
||||
function dbus_connection_pop_message(connection: PDBusConnection): PDBusMessage; cdecl; external LibDBus;
|
||||
function dbus_connection_get_dispatch_status(connection: PDBusConnection): DBusDispatchStatus; cdecl; external LibDBus;
|
||||
function dbus_connection_dispatch(connection: PDBusConnection): DBusDispatchStatus; cdecl; external LibDBus;
|
||||
function dbus_connection_has_messages_to_send(connection: PDBusConnection): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_connection_send(connection: PDBusConnection; message_: PDBusMessage;
|
||||
client_serial: Pdbus_uint32_t): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_connection_send_with_reply(connection: PDBusConnection;
|
||||
message_: PDBusMessage;
|
||||
pending_return: PPDBusPendingCall;
|
||||
timeout_milliseconds: cint): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_connection_send_with_reply_and_block(connection: PDBusConnection;
|
||||
message_: PDBusMessage;
|
||||
timeout_milliseconds: cint;
|
||||
error: PDBusError): PDBusMessage; cdecl; external LibDBus;
|
||||
function dbus_connection_set_watch_functions(connection: PDBusConnection;
|
||||
add_function: DBusAddWatchFunction;
|
||||
remove_function: DBusRemoveWatchFunction;
|
||||
toggled_function: DBusWatchToggledFunction;
|
||||
data: Pointer;
|
||||
free_data_function: DBusFreeFunction): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_connection_set_timeout_functions(connection: PDBusConnection;
|
||||
add_function: DBusAddTimeoutFunction;
|
||||
remove_function: DBusRemoveTimeoutFunction;
|
||||
toggled_function: DBusTimeoutToggledFunction;
|
||||
data: Pointer;
|
||||
free_data_function: DBusFreeFunction): dbus_bool_t; cdecl; external LibDBus;
|
||||
procedure dbus_connection_set_wakeup_main_function(connection: PDBusConnection;
|
||||
wakeup_main_function: DBusWakeupMainFunction;
|
||||
data: Pointer;
|
||||
free_data_function: DBusFreeFunction); cdecl; external LibDBus;
|
||||
procedure dbus_connection_set_dispatch_status_function (connection: PDBusConnection;
|
||||
function_: DBusDispatchStatusFunction;
|
||||
data: Pointer;
|
||||
free_data_function: DBusFreeFunction); cdecl; external LibDBus;
|
||||
function dbus_connection_get_unix_user(connection: PDBusConnection;
|
||||
uid: Pculong): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_connection_get_unix_process_id(connection: PDBusConnection;
|
||||
pid: Pculong): dbus_bool_t; cdecl; external LibDBus;
|
||||
procedure dbus_connection_set_unix_user_function(connection: PDBusConnection;
|
||||
function_: DBusAllowUnixUserFunction;
|
||||
data: Pointer;
|
||||
free_data_function: DBusFreeFunction); cdecl; external LibDBus;
|
||||
|
||||
|
||||
function dbus_watch_get_fd(watch: PDBusWatch): cint; cdecl; external LibDBus;
|
||||
function dbus_watch_get_flags(watch: PDBusWatch): cuint; cdecl; external LibDBus;
|
||||
function dbus_watch_get_data(watch: PDBusWatch): Pointer; cdecl; external LibDBus;
|
||||
procedure dbus_watch_set_data(watch: PDBusWatch;
|
||||
data: Pointer; free_data_function: DBusFreeFunction); cdecl; external LibDBus;
|
||||
function dbus_watch_handle(watch: PDBusWatch; flags: cuint): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_watch_get_enabled(watch: PDBusWatch): dbus_bool_t; cdecl; external LibDBus;
|
||||
|
||||
function dbus_timeout_get_interval(timeout: PDBusTimeout): cint; cdecl; external LibDBus;
|
||||
function dbus_timeout_get_data(timeout: PDBusTimeout): Pointer; cdecl; external LibDBus;
|
||||
procedure dbus_timeout_set_data(timeout: PDBusTimeout;
|
||||
data: Pointer; free_data_function: DBusFreeFunction); cdecl; external LibDBus;
|
||||
function dbus_timeout_handle(timeout: PDBusTimeout): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_timeout_get_enabled(timeout: PDBusTimeout): dbus_bool_t; cdecl; external LibDBus;
|
||||
|
||||
{ Filters }
|
||||
|
||||
function dbus_connection_add_filter(connection: PDBusConnection;
|
||||
function_: DBusHandleMessageFunction;
|
||||
user_data: Pointer; free_data_function: DBusFreeFunction): dbus_bool_t; cdecl; external LibDBus;
|
||||
procedure dbus_connection_remove_filter (connection: PDBusConnection;
|
||||
function_: DBusHandleMessageFunction; user_data: Pointer); cdecl; external LibDBus;
|
||||
|
||||
|
||||
{ Other }
|
||||
function dbus_connection_allocate_data_slot (slot_p: Pdbus_int32_t): dbus_bool_t; cdecl; external LibDBus;
|
||||
procedure dbus_connection_free_data_slot (slot_p: Pdbus_int32_t); cdecl; external LibDBus;
|
||||
function dbus_connection_set_data(connection: PDBusConnection;
|
||||
slot: dbus_int32_t; data: Pointer; free_data_func: DBusFreeFunction): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_connection_get_data(connection: PDBusConnection; slot: dbus_int32_t): Pointer; cdecl; external LibDBus;
|
||||
|
||||
procedure dbus_connection_set_change_sigpipe (will_modify_sigpipe: dbus_bool_t); cdecl; external LibDBus;
|
||||
|
||||
procedure dbus_connection_set_max_message_size (connection: PDBusConnection; size: clong); cdecl; external LibDBus;
|
||||
function dbus_connection_get_max_message_size (connection: PDBusConnection): clong; cdecl; external LibDBus;
|
||||
procedure dbus_connection_set_max_received_size (connection: PDBusConnection; size: clong); cdecl; external LibDBus;
|
||||
function dbus_connection_get_max_received_size (connection: PDBusConnection): clong; cdecl; external LibDBus;
|
||||
function dbus_connection_get_outgoing_size (connection: PDBusConnection): clong; cdecl; external LibDBus;
|
||||
|
||||
function dbus_connection_preallocate_send (connection: PDBusConnection): PDBusPreallocatedSend; cdecl; external LibDBus;
|
||||
procedure dbus_connection_free_preallocated_send (connection: PDBusConnection; preallocated: PDBusPreallocatedSend); cdecl; external LibDBus;
|
||||
procedure dbus_connection_send_preallocated (connection: PDBusConnection;
|
||||
preallocated: PDBusPreallocatedSend;
|
||||
message_: PDBusMessage; client_serial: Pdbus_uint32_t); cdecl; external LibDBus;
|
||||
|
||||
|
||||
{ Object tree functionality }
|
||||
|
||||
type
|
||||
DBusObjectPathUnregisterFunction = procedure(connection: PDBusConnection;
|
||||
user_data: Pointer);
|
||||
DBusObjectPathMessageFunction = function(connection: PDBusConnection;
|
||||
message_: PDBusMessage; user_data: Pointer): DBusHandlerResult;
|
||||
|
||||
{
|
||||
* Virtual table that must be implemented to handle a portion of the
|
||||
* object path hierarchy.
|
||||
}
|
||||
dbus_internal_func = procedure(param1: Pointer);
|
||||
|
||||
PDBusObjectPathVTable = ^DBusObjectPathVTable;
|
||||
|
||||
DBusObjectPathVTable = record
|
||||
|
||||
unregister_function: DBusObjectPathUnregisterFunction; {< Function to unregister this handler }
|
||||
message_function: DBusObjectPathMessageFunction; {< Function to handle messages }
|
||||
|
||||
dbus_internal_pad1: dbus_internal_func; {< Reserved for future expansion }
|
||||
dbus_internal_pad2: dbus_internal_func; {< Reserved for future expansion }
|
||||
dbus_internal_pad3: dbus_internal_func; {< Reserved for future expansion }
|
||||
dbus_internal_pad4: dbus_internal_func; {< Reserved for future expansion }
|
||||
end;
|
||||
|
||||
function dbus_connection_register_object_path(connection: PDBusConnection;
|
||||
const path: PChar;
|
||||
const vtable: PDBusObjectPathVTable;
|
||||
user_data: Pointer): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_connection_register_fallback(connection: PDBusConnection;
|
||||
const path: PChar;
|
||||
const vtable: PDBusObjectPathVTable;
|
||||
user_data: Pointer): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_connection_unregister_object_path(connection: PDBusConnection;
|
||||
const path: PChar): dbus_bool_t; cdecl; external LibDBus;
|
||||
|
||||
function dbus_connection_get_object_path_data(connection: PDBusConnection;
|
||||
const path: PChar;
|
||||
data_p: PPointer): dbus_bool_t; cdecl; external LibDBus;
|
||||
|
||||
function dbus_connection_list_registered(connection: PDBusConnection;
|
||||
const parent_path: PChar;
|
||||
child_entries: PPPChar): dbus_bool_t; cdecl; external LibDBus;
|
||||
|
||||
function dbus_connection_get_unix_fd(connection: PDBusConnection;
|
||||
fd: Pcint): dbus_bool_t; cdecl; external LibDBus;
|
||||
|
54
packages/base/dbus/dbus-errors.inc
Normal file
54
packages/base/dbus/dbus-errors.inc
Normal file
@ -0,0 +1,54 @@
|
||||
{ -*- mode: C; c-file-style: "gnu" -*- }
|
||||
{ dbus-errors.h Error reporting
|
||||
*
|
||||
* Copyright (C) 2002 Red Hat Inc.
|
||||
* Copyright (C) 2003 CodeFactory AB
|
||||
*
|
||||
* Licensed under the Academic Free License version 2.1
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
}
|
||||
|
||||
//#include <dbus/dbus-macros.h>
|
||||
//#include <dbus/dbus-types.h>
|
||||
|
||||
type
|
||||
PDBusError = ^DBusError;
|
||||
|
||||
{
|
||||
* Object representing an exception.
|
||||
}
|
||||
DBusError = record
|
||||
name: PChar; {< error name }
|
||||
message: PChar; {< error message }
|
||||
|
||||
dummy1: cuint; //: 1; {< placeholder }
|
||||
// unsigned int dummy2 : 1; {< placeholder }
|
||||
// unsigned int dummy3 : 1; {< placeholder }
|
||||
// unsigned int dummy4 : 1; {< placeholder }
|
||||
// unsigned int dummy5 : 1; {< placeholder }
|
||||
|
||||
padding1: Pointer; {< placeholder }
|
||||
end;
|
||||
|
||||
procedure dbus_error_init(error: PDBusError); cdecl; external LibDBus;
|
||||
procedure dbus_error_free(error: PDBusError); cdecl; external LibDBus;
|
||||
procedure dbus_set_error(error: PDBusError; const name, message: PChar; others: array of const); cdecl; external LibDBus;
|
||||
procedure dbus_set_error_const(error: PDBusError; const name, message: PChar); cdecl; external LibDBus;
|
||||
procedure dbus_move_error(src, dest: PDBusError); cdecl; external LibDBus;
|
||||
function dbus_error_has_name(const error: PDBusError; const name: PChar): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_error_is_set(const error: PDBusError): dbus_bool_t; cdecl; external LibDBus;
|
||||
|
63
packages/base/dbus/dbus-macros.inc
Normal file
63
packages/base/dbus/dbus-macros.inc
Normal file
@ -0,0 +1,63 @@
|
||||
{ -*- mode: C; c-file-style: "gnu" -*- }
|
||||
{ dbus-macros.h generic macros
|
||||
*
|
||||
* Copyright (C) 2002 Red Hat Inc.
|
||||
*
|
||||
* Licensed under the Academic Free License version 2.1
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
}
|
||||
|
||||
{ Normally docs are in .c files, but there isn't a .c file for this. }
|
||||
{
|
||||
* @defgroup DBusMacros Utility macros
|
||||
* @ingroup DBus
|
||||
* @brief #TRUE, #FALSE, #NULL, and so on
|
||||
*
|
||||
* Utility macros.
|
||||
*
|
||||
}
|
||||
|
||||
{
|
||||
* @def DBUS_BEGIN_DECLS
|
||||
*
|
||||
* Macro used prior to declaring functions in the D-Bus header
|
||||
* files. Expands to "extern "C"" when using a C++ compiler,
|
||||
* and expands to nothing when using a C compiler.
|
||||
}
|
||||
{
|
||||
* @def DBUS_END_DECLS
|
||||
*
|
||||
* Macro used after declaring functions in the D-Bus header
|
||||
* files. Expands to "}{" when using a C++ compiler,
|
||||
* and expands to nothing when using a C compiler.
|
||||
}
|
||||
{
|
||||
* @def TRUE
|
||||
*
|
||||
* Expands to "1"
|
||||
}
|
||||
{
|
||||
* @def FALSE
|
||||
*
|
||||
* Expands to "0"
|
||||
}
|
||||
{
|
||||
* @def NULL
|
||||
*
|
||||
* A null pointer, defined appropriately for C or C++.
|
||||
}
|
||||
|
41
packages/base/dbus/dbus-memory.inc
Normal file
41
packages/base/dbus/dbus-memory.inc
Normal file
@ -0,0 +1,41 @@
|
||||
{ -*- mode: C; c-file-style: "gnu" -*- }
|
||||
{ dbus-memory.h D-Bus memory handling
|
||||
*
|
||||
* Copyright (C) 2002 Red Hat Inc.
|
||||
*
|
||||
* Licensed under the Academic Free License version 2.1
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
}
|
||||
|
||||
{#include <dbus/dbus-macros.h>
|
||||
#include <stddef.h>}
|
||||
|
||||
function dbus_malloc(bytes: size_t): Pointer; cdecl; external LibDBus;
|
||||
function dbus_malloc0(bytes: size_t): Pointer; cdecl; external LibDBus;
|
||||
function dbus_realloc(memory: Pointer; bytes: size_t): Pointer; cdecl; external LibDBus;
|
||||
procedure dbus_free(memory: Pointer); cdecl; external LibDBus;
|
||||
|
||||
//#define dbus_new(type, count) ((type*)dbus_malloc (sizeof (type) * (count)));
|
||||
//#define dbus_new0(type, count) ((type*)dbus_malloc0 (sizeof (type) * (count)));
|
||||
|
||||
procedure dbus_free_string_array(str_array: PPChar); cdecl; external LibDBus;
|
||||
|
||||
type
|
||||
DBusFreeFunction = procedure(memory: Pointer);
|
||||
|
||||
procedure dbus_shutdown; cdecl; external LibDBus;
|
||||
|
166
packages/base/dbus/dbus-message.inc
Normal file
166
packages/base/dbus/dbus-message.inc
Normal file
@ -0,0 +1,166 @@
|
||||
{ -*- mode: C; c-file-style: "gnu" -*- }
|
||||
{ dbus-message.h DBusMessage object
|
||||
*
|
||||
* Copyright (C) 2002, 2003, 2005 Red Hat Inc.
|
||||
*
|
||||
* Licensed under the Academic Free License version 2.1
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
}
|
||||
|
||||
{#include <dbus/dbus-macros.h>
|
||||
#include <dbus/dbus-types.h>
|
||||
#include <dbus/dbus-arch-deps.h>}
|
||||
{$include dbus-memory.inc}
|
||||
{#include <dbus/dbus-errors.h>
|
||||
#include <stdarg.h>}
|
||||
|
||||
type
|
||||
DBusMessage = record end;
|
||||
PDBusMessage = ^DBusMessage;
|
||||
|
||||
PDBusMessageIter = ^DBusMessageIter;
|
||||
|
||||
{
|
||||
* DBusMessageIter struct; contains no public fields
|
||||
}
|
||||
DBusMessageIter = record
|
||||
dummy1: Pointer; {< Don't use this }
|
||||
dummy2: Pointer; {< Don't use this }
|
||||
dummy3: dbus_uint32_t; {< Don't use this }
|
||||
dummy4: cint; {< Don't use this }
|
||||
dummy5: cint; {< Don't use this }
|
||||
dummy6: cint; {< Don't use this }
|
||||
dummy7: cint; {< Don't use this }
|
||||
dummy8: cint; {< Don't use this }
|
||||
dummy9: cint; {< Don't use this }
|
||||
dummy10: cint; {< Don't use this }
|
||||
dummy11: cint; {< Don't use this }
|
||||
pad1: cint; {< Don't use this }
|
||||
pad2: cint; {< Don't use this }
|
||||
pad3: Pointer {< Don't use this }
|
||||
end;
|
||||
|
||||
function dbus_message_new(message_type: Integer): PDBusMessage; cdecl; external LibDBus;
|
||||
function dbus_message_new_method_call(
|
||||
const bus_name, path, interface_, method: PChar): PDBusMessage; cdecl; external LibDBus;
|
||||
function dbus_message_new_method_return(method_call: PDBusMessage): PDBusMessage; cdecl; external LibDBus;
|
||||
function dbus_message_new_signal(const path, interface_, name: PChar): PDBusMessage; cdecl; external LibDBus;
|
||||
function dbus_message_new_error(reply_to: PDBusMessage;
|
||||
const error_name, error_message: PChar): PDBusMessage; cdecl; external LibDBus;
|
||||
function dbus_message_new_error_printf(reply_to: PDBusMessage;
|
||||
const error_name, error_format: PChar;
|
||||
others: array of const): PDBusMessage; cdecl; external LibDBus;
|
||||
|
||||
function dbus_message_copy(const message_: PDBusMessage): PDBusMessage; cdecl; external LibDBus;
|
||||
|
||||
function dbus_message_ref(message_: PDBusMessage): PDBusMessage; cdecl; external LibDBus;
|
||||
procedure dbus_message_unref(message_: PDBusMessage); cdecl; external LibDBus;
|
||||
function dbus_message_get_type(message_: PDBusMessage): cint; cdecl; external LibDBus;
|
||||
function dbus_message_set_path(message_: PDBusMessage;
|
||||
const object_path: PChar): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_message_get_path(message_: PDBusMessage): PChar; cdecl; external LibDBus;
|
||||
function dbus_message_has_path(message_: PDBusMessage;
|
||||
const object_path: PChar): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_message_set_interface(message_: PDBusMessage;
|
||||
const interface_: PChar): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_message_get_interface(message_: PDBusMessage): PChar; cdecl; external LibDBus;
|
||||
function dbus_message_has_interface(message_: PDBusMessage;
|
||||
const interface_: PChar): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_message_set_member(message_: PDBusMessage;
|
||||
const member: PChar): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_message_get_member(message_: PDBusMessage): PChar; cdecl; external LibDBus;
|
||||
function dbus_message_has_member(message_: PDBusMessage;
|
||||
const member: PChar): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_message_set_error_name(message_: PDBusMessage;
|
||||
const name: PChar): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_message_get_error_name(message_: PDBusMessage): PChar; cdecl; external LibDBus;
|
||||
function dbus_message_set_destination(message_: PDBusMessage;
|
||||
const destination: PChar): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_message_get_destination(message_: PDBusMessage): PChar; cdecl; external LibDBus;
|
||||
function dbus_message_set_sender(message_: PDBusMessage;
|
||||
const sender: PChar): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_message_get_sender(message_: PDBusMessage): PChar; cdecl; external LibDBus;
|
||||
function dbus_message_get_signature(message_: PDBusMessage): PChar; cdecl; external LibDBus;
|
||||
procedure dbus_message_set_no_reply(message_: PDBusMessage;
|
||||
no_reply: dbus_bool_t); cdecl; external LibDBus;
|
||||
function dbus_message_get_no_reply(message_: PDBusMessage): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_message_is_method_call(message_: PDBusMessage;
|
||||
const interface_, method: PChar): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_message_is_signal(message_: PDBusMessage;
|
||||
const interface_, signal_name: PChar): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_message_is_error(message_: PDBusMessage;
|
||||
const error_name: PChar): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_message_has_destination(message_: PDBusMessage;
|
||||
const bus_name: PChar): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_message_has_sender(message_: PDBusMessage;
|
||||
const unique_bus_name: PChar): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_message_has_signature(message_: PDBusMessage;
|
||||
const signature: PChar): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_message_get_serial(message_: PDBusMessage): dbus_uint32_t; cdecl; external LibDBus;
|
||||
function dbus_message_set_reply_serial(message_: PDBusMessage;
|
||||
reply_serial: dbus_uint32_t): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_message_get_reply_serial(message_: PDBusMessage): dbus_uint32_t; cdecl; external LibDBus;
|
||||
|
||||
procedure dbus_message_set_auto_start(message_: PDBusMessage; auto_start: dbus_bool_t); cdecl; external LibDBus;
|
||||
function dbus_message_get_auto_start(message_: PDBusMessage): dbus_bool_t; cdecl; external LibDBus;
|
||||
|
||||
function dbus_message_get_path_decomposed(message_: PDBusMessage; path: PPPChar): dbus_bool_t; cdecl; external LibDBus;
|
||||
|
||||
function dbus_message_append_args(message_: PDBusMessage;
|
||||
first_arg_type: cint; others: array of const): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_message_append_args_valist(message_: PDBusMessage;
|
||||
first_arg_type: cint; var_args: va_list): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_message_get_args(message_: PDBusMessage;
|
||||
error: PDBusError; first_arg_type: cint; others: array of const): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_message_get_args_valist(message_: PDBusMessage;
|
||||
error: PDBusError; first_arg_type: cint; var_args: va_list): dbus_bool_t; cdecl; external LibDBus;
|
||||
|
||||
|
||||
function dbus_message_iter_init(message_: PDBusMessage; iter: PDBusMessageIter): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_message_iter_has_next(iter: PDBusMessageIter): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_message_iter_next(iter: PDBusMessageIter): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_message_iter_get_signature(iter: PDBusMessageIter): PChar; cdecl; external LibDBus;
|
||||
function dbus_message_iter_get_arg_type(iter: PDBusMessageIter): cint; cdecl; external LibDBus;
|
||||
function dbus_message_iter_get_element_type(iter: PDBusMessageIter): cint; cdecl; external LibDBus;
|
||||
procedure dbus_message_iter_recurse(iter, sub: PDBusMessageIter); cdecl; external LibDBus;
|
||||
procedure dbus_message_iter_get_basic(iter: PDBusMessageIter; value: Pointer); cdecl; external LibDBus;
|
||||
function dbus_message_iter_get_array_len(iter: PDBusMessageIter): cint; cdecl; external LibDBus;
|
||||
procedure dbus_message_iter_get_fixed_array(iter: PDBusMessageIter; value: Pointer; n_elements: Pcint); cdecl; external LibDBus;
|
||||
|
||||
|
||||
procedure dbus_message_iter_init_append(message_: PDBusMessage; iter: PDBusMessageIter); cdecl; external LibDBus;
|
||||
function dbus_message_iter_append_basic(iter: PDBusMessageIter;
|
||||
type_: cint; const value: Pointer): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_message_iter_append_fixed_array(iter: PDBusMessageIter;
|
||||
element_type: cint; const value: Pointer; n_elements: cint): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_message_iter_open_container(iter: PDBusMessageIter;
|
||||
type_: cint; const contained_signature: PChar; sub: PDBusMessageIter): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_message_iter_close_container(iter, sub: PDBusMessageIter): dbus_bool_t; cdecl; external LibDBus;
|
||||
|
||||
|
||||
function dbus_set_error_from_message(error: PDBusError; message_: PDBusMessage): dbus_bool_t; cdecl; external LibDBus;
|
||||
|
||||
|
||||
function dbus_message_allocate_data_slot(slot_p: Pdbus_int32_t): dbus_bool_t; cdecl; external LibDBus;
|
||||
procedure dbus_message_free_data_slot(slot_p: Pdbus_int32_t); cdecl; external LibDBus;
|
||||
function dbus_message_set_data(message_: PDBusMessage;
|
||||
slot: dbus_int32_t; data: Pointer; free_data_func: DBusFreeFunction): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_message_get_data(message_: PDBusMessage; slot: dbus_int32_t): Pointer; cdecl; external LibDBus;
|
||||
|
||||
function dbus_message_type_from_string(const type_str: PChar): cint; cdecl; external LibDBus;
|
||||
function dbus_message_type_to_string(type_: cint): PChar; cdecl; external LibDBus;
|
||||
|
43
packages/base/dbus/dbus-pending-call.inc
Normal file
43
packages/base/dbus/dbus-pending-call.inc
Normal file
@ -0,0 +1,43 @@
|
||||
{ -*- mode: C; c-file-style: "gnu" -*- }
|
||||
{ dbus-pending-call.h Object representing a call in progress.
|
||||
*
|
||||
* Copyright (C) 2002, 2003 Red Hat Inc.
|
||||
*
|
||||
* Licensed under the Academic Free License version 2.1
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
}
|
||||
|
||||
{#include <dbus/dbus-macros.h>
|
||||
#include <dbus/dbus-types.h>
|
||||
#include <dbus/dbus-connection.h>}
|
||||
|
||||
function dbus_pending_call_ref(pending: PDBusPendingCall): PDBusPendingCall; cdecl; external LibDBus;
|
||||
procedure dbus_pending_call_unref(pending: PDBusPendingCall); cdecl; external LibDBus;
|
||||
function dbus_pending_call_set_notify(pending: PDBusPendingCall;
|
||||
function_: DBusPendingCallNotifyFunction;
|
||||
user_data: Pointer; free_user_data: DBusFreeFunction): dbus_bool_t; cdecl; external LibDBus;
|
||||
procedure dbus_pending_call_cancel(pending: PDBusPendingCall); cdecl; external LibDBus;
|
||||
function dbus_pending_call_get_completed(pending: PDBusPendingCall): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_pending_call_steal_reply(pending: PDBusPendingCall): PDBusMessage; cdecl; external LibDBus;
|
||||
procedure dbus_pending_call_block(pending: PDBusPendingCall); cdecl; external LibDBus;
|
||||
|
||||
function dbus_pending_call_allocate_data_slot(slot_p: Pdbus_int32_t): dbus_bool_t; cdecl; external LibDBus;
|
||||
procedure dbus_pending_call_free_data_slot(slot_p: Pdbus_int32_t); cdecl; external LibDBus;
|
||||
function dbus_pending_call_set_data(pending: PDBusPendingCall;
|
||||
slot: dbus_int32_t; data: Pointer; free_data_func: DBusFreeFunction): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_pending_call_get_data(pending: PDBusPendingCall; slot: dbus_int32_t): Pointer; cdecl; external LibDBus;
|
||||
|
251
packages/base/dbus/dbus-protocol.inc
Normal file
251
packages/base/dbus/dbus-protocol.inc
Normal file
@ -0,0 +1,251 @@
|
||||
{ -*- mode: C; c-file-style: "gnu" -*- }
|
||||
{ dbus-protocol.h D-Bus protocol constants
|
||||
*
|
||||
* Copyright (C) 2002, 2003 CodeFactory AB
|
||||
* Copyright (C) 2004, 2005 Red Hat, Inc.
|
||||
*
|
||||
* Licensed under the Academic Free License version 2.1
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
}
|
||||
|
||||
{ Normally docs are in .c files, but there isn't a .c file for this. }
|
||||
{
|
||||
* @defgroup DBusProtocol Protocol constants
|
||||
* @ingroup DBus
|
||||
*
|
||||
* D-Bus protocol constants
|
||||
*
|
||||
* @brief Defines constants which are part of the D-Bus protocol
|
||||
}
|
||||
|
||||
const
|
||||
|
||||
{ Message byte order }
|
||||
DBUS_LITTLE_ENDIAN = 'l'; {< LSB first }
|
||||
DBUS_BIG_ENDIAN = 'B'; {< MSB first }
|
||||
|
||||
{ Protocol version }
|
||||
DBUS_MAJOR_PROTOCOL_VERSION = 1;
|
||||
|
||||
{ Never a legitimate type }
|
||||
DBUS_TYPE_INVALID = 0;
|
||||
DBUS_TYPE_INVALID_AS_STRING = #0;
|
||||
|
||||
{ Primitive types }
|
||||
DBUS_TYPE_BYTE = Integer('y');
|
||||
DBUS_TYPE_BYTE_AS_STRING = 'y';
|
||||
DBUS_TYPE_BOOLEAN = Integer('b');
|
||||
DBUS_TYPE_BOOLEAN_AS_STRING = 'b';
|
||||
DBUS_TYPE_INT16 = Integer('n');
|
||||
DBUS_TYPE_INT16_AS_STRING = 'n';
|
||||
DBUS_TYPE_UINT16 = Integer('q');
|
||||
DBUS_TYPE_UINT16_AS_STRING = 'q';
|
||||
DBUS_TYPE_INT32 = Integer('i');
|
||||
DBUS_TYPE_INT32_AS_STRING = 'i';
|
||||
DBUS_TYPE_UINT32 = Integer('u');
|
||||
DBUS_TYPE_UINT32_AS_STRING = 'u';
|
||||
DBUS_TYPE_INT64 = Integer('x');
|
||||
DBUS_TYPE_INT64_AS_STRING = 'x';
|
||||
DBUS_TYPE_UINT64 = Integer('t');
|
||||
DBUS_TYPE_UINT64_AS_STRING = 't';
|
||||
DBUS_TYPE_DOUBLE = Integer('d');
|
||||
DBUS_TYPE_DOUBLE_AS_STRING = 'd';
|
||||
DBUS_TYPE_STRING = Integer('s');
|
||||
DBUS_TYPE_STRING_AS_STRING = 's';
|
||||
DBUS_TYPE_OBJECT_PATH = Integer('o');
|
||||
DBUS_TYPE_OBJECT_PATH_AS_STRING = 'o';
|
||||
DBUS_TYPE_SIGNATURE = Integer('g');
|
||||
DBUS_TYPE_SIGNATURE_AS_STRING = 'g';
|
||||
|
||||
{ Compound types }
|
||||
DBUS_TYPE_ARRAY = Integer('a');
|
||||
DBUS_TYPE_ARRAY_AS_STRING = 'a';
|
||||
DBUS_TYPE_VARIANT = Integer('v');
|
||||
DBUS_TYPE_VARIANT_AS_STRING = 'v';
|
||||
|
||||
{ STRUCT and DICT_ENTRY are sort of special since their codes can't
|
||||
* appear in a type string, instead
|
||||
* DBUS_STRUCT_BEGIN_CHAR/DBUS_DICT_ENTRY_BEGIN_CHAR have to appear
|
||||
}
|
||||
DBUS_TYPE_STRUCT = Integer('r');
|
||||
DBUS_TYPE_STRUCT_AS_STRING = 'r';
|
||||
DBUS_TYPE_DICT_ENTRY = Integer('e');
|
||||
DBUS_TYPE_DICT_ENTRY_AS_STRING = 'e';
|
||||
|
||||
{ Does not count INVALID }
|
||||
DBUS_NUMBER_OF_TYPES = (16);
|
||||
|
||||
{ characters other than typecodes that appear in type signatures }
|
||||
DBUS_STRUCT_BEGIN_CHAR = Integer('(');
|
||||
DBUS_STRUCT_BEGIN_CHAR_AS_STRING = '(';
|
||||
DBUS_STRUCT_END_CHAR = Integer(')');
|
||||
DBUS_STRUCT_END_CHAR_AS_STRING = ')';
|
||||
DBUS_DICT_ENTRY_BEGIN_CHAR = Integer('{');
|
||||
DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING = '{';
|
||||
DBUS_DICT_ENTRY_END_CHAR = Integer('}');
|
||||
DBUS_DICT_ENTRY_END_CHAR_AS_STRING = '}';
|
||||
|
||||
{ Max length in bytes of a bus name, interface, or member (not object
|
||||
* path, paths are unlimited). This is limited because lots of stuff
|
||||
* is O(n) in this number, plus it would be obnoxious to type in a
|
||||
* paragraph-long method name so most likely something like that would
|
||||
* be an exploit.
|
||||
}
|
||||
DBUS_MAXIMUM_NAME_LENGTH = 255;
|
||||
|
||||
{ This one is 255 so it fits in a byte }
|
||||
DBUS_MAXIMUM_SIGNATURE_LENGTH = 255;
|
||||
|
||||
{ Max length of a match rule string; to keep people from hosing the
|
||||
* daemon with some huge rule
|
||||
}
|
||||
DBUS_MAXIMUM_MATCH_RULE_LENGTH = 1024;
|
||||
|
||||
{ Max arg number you can match on in a match rule, e.g.
|
||||
* arg0='hello' is OK, arg3489720987='hello' is not
|
||||
}
|
||||
DBUS_MAXIMUM_MATCH_RULE_ARG_NUMBER = 63;
|
||||
|
||||
{ Max length of a marshaled array in bytes (64M, 2^26) We use signed
|
||||
* int for lengths so must be INT_MAX or less. We need something a
|
||||
* bit smaller than INT_MAX because the array is inside a message with
|
||||
* header info, etc. so an INT_MAX array wouldn't allow the message
|
||||
* overhead. The 64M number is an attempt at a larger number than
|
||||
* we'd reasonably ever use, but small enough that your bus would chew
|
||||
* through it fairly quickly without locking up forever. If you have
|
||||
* data that's likely to be larger than this, you should probably be
|
||||
* sending it in multiple incremental messages anyhow.
|
||||
}
|
||||
DBUS_MAXIMUM_ARRAY_LENGTH = (67108864);
|
||||
{ Number of bits you need in an unsigned to store the max array size }
|
||||
DBUS_MAXIMUM_ARRAY_LENGTH_BITS = 26;
|
||||
|
||||
{ The maximum total message size including header and body; similar
|
||||
* rationale to max array size.
|
||||
}
|
||||
DBUS_MAXIMUM_MESSAGE_LENGTH = (DBUS_MAXIMUM_ARRAY_LENGTH * 2);
|
||||
{ Number of bits you need in an unsigned to store the max message size }
|
||||
DBUS_MAXIMUM_MESSAGE_LENGTH_BITS = 27;
|
||||
|
||||
{ Depth of recursion in the type tree. This is automatically limited
|
||||
* to DBUS_MAXIMUM_SIGNATURE_LENGTH since you could only have an array
|
||||
* of array of array of ... that fit in the max signature. But that's
|
||||
* probably a bit too large.
|
||||
}
|
||||
DBUS_MAXIMUM_TYPE_RECURSION_DEPTH = 32;
|
||||
|
||||
{ Types of message }
|
||||
DBUS_MESSAGE_TYPE_INVALID = 0;
|
||||
DBUS_MESSAGE_TYPE_METHOD_CALL = 1;
|
||||
DBUS_MESSAGE_TYPE_METHOD_RETURN= 2;
|
||||
DBUS_MESSAGE_TYPE_ERROR = 3;
|
||||
DBUS_MESSAGE_TYPE_SIGNAL = 4;
|
||||
|
||||
{ Header flags }
|
||||
DBUS_HEADER_FLAG_NO_REPLY_EXPECTED = $1;
|
||||
DBUS_HEADER_FLAG_NO_AUTO_START = $2;
|
||||
|
||||
{ Header fields }
|
||||
DBUS_HEADER_FIELD_INVALID = 0;
|
||||
DBUS_HEADER_FIELD_PATH = 1;
|
||||
DBUS_HEADER_FIELD_INTERFACE = 2;
|
||||
DBUS_HEADER_FIELD_MEMBER = 3;
|
||||
DBUS_HEADER_FIELD_ERROR_NAME = 4;
|
||||
DBUS_HEADER_FIELD_REPLY_SERIAL = 5;
|
||||
DBUS_HEADER_FIELD_DESTINATION = 6;
|
||||
DBUS_HEADER_FIELD_SENDER = 7;
|
||||
DBUS_HEADER_FIELD_SIGNATURE = 8;
|
||||
|
||||
DBUS_HEADER_FIELD_LAST = DBUS_HEADER_FIELD_SIGNATURE;
|
||||
|
||||
{ Header format is defined as a signature:
|
||||
* byte byte order
|
||||
* byte message type ID
|
||||
* byte flags
|
||||
* byte protocol version
|
||||
* uint32 body length
|
||||
* uint32 serial
|
||||
* array of struct (byte,variant) (field name, value)
|
||||
*
|
||||
* The length of the header can be computed as the
|
||||
* fixed size of the initial data, plus the length of
|
||||
* the array at the end, plus padding to an 8-boundary.
|
||||
}
|
||||
{ DBUS_HEADER_SIGNATURE \
|
||||
DBUS_TYPE_BYTE_AS_STRING \
|
||||
DBUS_TYPE_BYTE_AS_STRING \
|
||||
DBUS_TYPE_BYTE_AS_STRING \
|
||||
DBUS_TYPE_BYTE_AS_STRING \
|
||||
DBUS_TYPE_UINT32_AS_STRING \
|
||||
DBUS_TYPE_UINT32_AS_STRING \
|
||||
DBUS_TYPE_ARRAY_AS_STRING \
|
||||
DBUS_STRUCT_BEGIN_CHAR_AS_STRING \
|
||||
DBUS_TYPE_BYTE_AS_STRING \
|
||||
DBUS_TYPE_VARIANT_AS_STRING \
|
||||
DBUS_STRUCT_END_CHAR_AS_STRING}
|
||||
|
||||
|
||||
{
|
||||
* The smallest header size that can occur. (It won't be valid due to
|
||||
* missing required header fields.) This is 4 bytes, two uint32, an
|
||||
* array length. This isn't any kind of resource limit, just the
|
||||
* necessary/logical outcome of the header signature.
|
||||
}
|
||||
DBUS_MINIMUM_HEADER_SIZE = 16;
|
||||
|
||||
{ Errors }
|
||||
{ WARNING these get autoconverted to an enum in dbus-glib.h. Thus,
|
||||
* if you change the order it breaks the ABI. Keep them in order.
|
||||
* Also, don't change the formatting since that will break the sed
|
||||
* script.
|
||||
}
|
||||
DBUS_ERROR_FAILED = 'org.freedesktop.DBus.Error.Failed';
|
||||
DBUS_ERROR_NO_MEMORY = 'org.freedesktop.DBus.Error.NoMemory';
|
||||
DBUS_ERROR_SERVICE_UNKNOWN = 'org.freedesktop.DBus.Error.ServiceUnknown';
|
||||
DBUS_ERROR_NAME_HAS_NO_OWNER = 'org.freedesktop.DBus.Error.NameHasNoOwner';
|
||||
DBUS_ERROR_NO_REPLY = 'org.freedesktop.DBus.Error.NoReply';
|
||||
DBUS_ERROR_IO_ERROR = 'org.freedesktop.DBus.Error.IOError';
|
||||
DBUS_ERROR_BAD_ADDRESS = 'org.freedesktop.DBus.Error.BadAddress';
|
||||
DBUS_ERROR_NOT_SUPPORTED = 'org.freedesktop.DBus.Error.NotSupported';
|
||||
DBUS_ERROR_LIMITS_EXCEEDED = 'org.freedesktop.DBus.Error.LimitsExceeded';
|
||||
DBUS_ERROR_ACCESS_DENIED = 'org.freedesktop.DBus.Error.AccessDenied';
|
||||
DBUS_ERROR_AUTH_FAILED = 'org.freedesktop.DBus.Error.AuthFailed';
|
||||
DBUS_ERROR_NO_SERVER = 'org.freedesktop.DBus.Error.NoServer';
|
||||
DBUS_ERROR_TIMEOUT = 'org.freedesktop.DBus.Error.Timeout';
|
||||
DBUS_ERROR_NO_NETWORK = 'org.freedesktop.DBus.Error.NoNetwork';
|
||||
DBUS_ERROR_ADDRESS_IN_USE = 'org.freedesktop.DBus.Error.AddressInUse';
|
||||
DBUS_ERROR_DISCONNECTED = 'org.freedesktop.DBus.Error.Disconnected';
|
||||
DBUS_ERROR_INVALID_ARGS = 'org.freedesktop.DBus.Error.InvalidArgs';
|
||||
DBUS_ERROR_FILE_NOT_FOUND = 'org.freedesktop.DBus.Error.FileNotFound';
|
||||
DBUS_ERROR_UNKNOWN_METHOD = 'org.freedesktop.DBus.Error.UnknownMethod';
|
||||
DBUS_ERROR_TIMED_OUT = 'org.freedesktop.DBus.Error.TimedOut';
|
||||
DBUS_ERROR_MATCH_RULE_NOT_FOUND = 'org.freedesktop.DBus.Error.MatchRuleNotFound';
|
||||
DBUS_ERROR_MATCH_RULE_INVALID = 'org.freedesktop.DBus.Error.MatchRuleInvalid';
|
||||
DBUS_ERROR_SPAWN_EXEC_FAILED = 'org.freedesktop.DBus.Error.Spawn.ExecFailed';
|
||||
DBUS_ERROR_SPAWN_FORK_FAILED = 'org.freedesktop.DBus.Error.Spawn.ForkFailed';
|
||||
DBUS_ERROR_SPAWN_CHILD_EXITED = 'org.freedesktop.DBus.Error.Spawn.ChildExited';
|
||||
DBUS_ERROR_SPAWN_CHILD_SIGNALED = 'org.freedesktop.DBus.Error.Spawn.ChildSignaled';
|
||||
DBUS_ERROR_SPAWN_FAILED = 'org.freedesktop.DBus.Error.Spawn.Failed';
|
||||
DBUS_ERROR_UNIX_PROCESS_ID_UNKNOWN = 'org.freedesktop.DBus.Error.UnixProcessIdUnknown';
|
||||
DBUS_ERROR_INVALID_SIGNATURE = 'org.freedesktop.DBus.Error.InvalidSignature';
|
||||
DBUS_ERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN = 'org.freedesktop.DBus.Error.SELinuxSecurityContextUnknown';
|
||||
|
||||
DBUS_INTROSPECT_1_0_XML_NAMESPACE = 'http://www.freedesktop.org/standards/dbus';
|
||||
DBUS_INTROSPECT_1_0_XML_PUBLIC_IDENTIFIER = '-//freedesktop//DTD D-BUS Object Introspection 1.0//EN';
|
||||
DBUS_INTROSPECT_1_0_XML_SYSTEM_IDENTIFIER = 'http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd';
|
||||
DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE = '<!DOCTYPE node PUBLIC \""DBUS_INTROSPECT_1_0_XML_PUBLIC_IDENTIFIER"\"\n\""DBUS_INTROSPECT_1_0_XML_SYSTEM_IDENTIFIER"\">\n';
|
||||
|
63
packages/base/dbus/dbus-server.inc
Normal file
63
packages/base/dbus/dbus-server.inc
Normal file
@ -0,0 +1,63 @@
|
||||
{ -*- mode: C; c-file-style: "gnu" -*- }
|
||||
{ dbus-server.h DBusServer object
|
||||
*
|
||||
* Copyright (C) 2002, 2003 Red Hat Inc.
|
||||
*
|
||||
* Licensed under the Academic Free License version 2.1
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
}
|
||||
|
||||
{#include <dbus/dbus-errors.h>
|
||||
#include <dbus/dbus-message.h>
|
||||
#include <dbus/dbus-connection.h>
|
||||
#include <dbus/dbus-protocol.h>}
|
||||
|
||||
type
|
||||
DBusServer = record end;
|
||||
PDBusServer = ^DBusServer;
|
||||
|
||||
DBusNewConnectionFunction = procedure (server: PDBusServer;
|
||||
new_connection: PDBusConnection; data: Pointer);
|
||||
|
||||
function dbus_server_listen(const address: PChar; error: PDBusError): PDBusServer; cdecl; external LibDBus;
|
||||
function dbus_server_ref(error: PDBusError): PDBusServer; cdecl; external LibDBus;
|
||||
procedure dbus_server_unref(error: PDBusError); cdecl; external LibDBus;
|
||||
procedure dbus_server_disconnect(error: PDBusError); cdecl; external LibDBus;
|
||||
function dbus_server_get_is_connected(error: PDBusError): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_server_get_address(error: PDBusError): PChar; cdecl; external LibDBus;
|
||||
procedure dbus_server_set_new_connection_function(server: PDBusServer;
|
||||
function_: DBusNewConnectionFunction; data: Pointer; free_data_function: DBusFreeFunction); cdecl; external LibDBus;
|
||||
function dbus_server_set_watch_functions(server: PDBusServer;
|
||||
add_function: DBusAddWatchFunction;
|
||||
remove_function: DBusRemoveWatchFunction;
|
||||
toggled_function: DBusWatchToggledFunction;
|
||||
data: Pointer;
|
||||
free_data_function: DBusFreeFunction): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_server_set_timeout_functions(server: PDBusServer;
|
||||
add_function: DBusAddTimeoutFunction;
|
||||
remove_function: DBusRemoveTimeoutFunction;
|
||||
toggled_function: DBusTimeoutToggledFunction;
|
||||
data: Pointer;
|
||||
free_data_function: DBusFreeFunction): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_server_set_auth_mechanisms(server: PDBusServer; const mechanisms: PPChar): dbus_bool_t; cdecl; external LibDBus;
|
||||
|
||||
function dbus_server_allocate_data_slot(slot_p: Pdbus_int32_t): dbus_bool_t; cdecl; external LibDBus;
|
||||
procedure dbus_server_free_data_slot(slot_p: Pdbus_int32_t); cdecl; external LibDBus;
|
||||
function dbus_server_set_data(server: PDBusServer;
|
||||
slot: cint; data: Pointer; free_data_func: DBusFreeFunction): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_server_get_data(server: PDBusServer; slot: cint): Pointer; cdecl; external LibDBus;
|
||||
|
91
packages/base/dbus/dbus-shared.inc
Normal file
91
packages/base/dbus/dbus-shared.inc
Normal file
@ -0,0 +1,91 @@
|
||||
{ -*- mode: C; c-file-style: "gnu" -*- }
|
||||
{ dbus-shared.h Stuff used by both dbus/dbus.h low-level and C/C++ binding APIs
|
||||
*
|
||||
* Copyright (C) 2004 Red Hat, Inc.
|
||||
*
|
||||
* Licensed under the Academic Free License version 2.1
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
}
|
||||
|
||||
{ Normally docs are in .c files, but there isn't a .c file for this. }
|
||||
{
|
||||
* @defgroup DBusShared Shared constants
|
||||
* @ingroup DBus
|
||||
*
|
||||
* Shared constants.
|
||||
*
|
||||
* @brief Stuff used by both dbus/dbus.h low-level and C/C++ binding APIs
|
||||
}
|
||||
|
||||
|
||||
type
|
||||
DBusBusType =
|
||||
(
|
||||
DBUS_BUS_SESSION, {< The login session bus }
|
||||
DBUS_BUS_SYSTEM, {< The systemwide bus }
|
||||
DBUS_BUS_STARTER {< The bus that started us, if any }
|
||||
);
|
||||
|
||||
DBusHandlerResult =
|
||||
(
|
||||
DBUS_HANDLER_RESULT_HANDLED, {< Message has had its effect }
|
||||
DBUS_HANDLER_RESULT_NOT_YET_HANDLED, {< Message has not had any effect }
|
||||
DBUS_HANDLER_RESULT_NEED_MEMORY {< Need more memory to return another result }
|
||||
);
|
||||
|
||||
{ Services }
|
||||
const
|
||||
DBUS_SERVICE_DBUS = 'org.freedesktop.DBus';
|
||||
|
||||
{ Paths }
|
||||
DBUS_PATH_DBUS = '/org/freedesktop/DBus';
|
||||
DBUS_PATH_LOCAL = '/org/freedesktop/DBus/Local';
|
||||
|
||||
{ Interfaces, these #define don't do much other than
|
||||
* catch typos at compile time
|
||||
}
|
||||
DBUS_INTERFACE_DBUS = 'org.freedesktop.DBus';
|
||||
DBUS_INTERFACE_INTROSPECTABLE = 'org.freedesktop.DBus.Introspectable';
|
||||
DBUS_INTERFACE_PROPERTIES = 'org.freedesktop.DBus.Properties';
|
||||
DBUS_INTERFACE_PEER = 'org.freedesktop.DBus.Peer';
|
||||
|
||||
{ This is a special interface whose methods can only be invoked
|
||||
* by the local implementation (messages from remote apps aren't
|
||||
* allowed to specify this interface).
|
||||
}
|
||||
DBUS_INTERFACE_LOCAL = 'org.freedesktop.DBus.Local';
|
||||
|
||||
{ Owner flags }
|
||||
DBUS_NAME_FLAG_ALLOW_REPLACEMENT = $1; {< Allow another service to become the primary owner if requested }
|
||||
DBUS_NAME_FLAG_REPLACE_EXISTING = $2; {< Request to replace the current primary owner }
|
||||
DBUS_NAME_FLAG_DO_NOT_QUEUE = $4; {< If we can not become the primary owner do not place us in the queue }
|
||||
|
||||
{ Replies to request for a name }
|
||||
DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER = 1; {< Service has become the primary owner of the requested name }
|
||||
DBUS_REQUEST_NAME_REPLY_IN_QUEUE = 2; {< Service could not become the primary owner and has been placed in the queue }
|
||||
DBUS_REQUEST_NAME_REPLY_EXISTS = 3; {< Service is already in the queue }
|
||||
DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER = 4; {< Service is already the primary owner }
|
||||
|
||||
{ Replies to releasing a name }
|
||||
DBUS_RELEASE_NAME_REPLY_RELEASED = 1; {< Service was released from the given name }
|
||||
DBUS_RELEASE_NAME_REPLY_NON_EXISTENT = 2; {< The given name does not exist on the bus }
|
||||
DBUS_RELEASE_NAME_REPLY_NOT_OWNER = 3; {< Service is not an owner of the given name }
|
||||
|
||||
{ Replies to service starts }
|
||||
DBUS_START_REPLY_SUCCESS = 1; {< service was auto started }
|
||||
DBUS_START_REPLY_ALREADY_RUNNING = 2; {< service was already running }
|
||||
|
61
packages/base/dbus/dbus-signature.inc
Normal file
61
packages/base/dbus/dbus-signature.inc
Normal file
@ -0,0 +1,61 @@
|
||||
{ -*- mode: C; c-file-style: "gnu" -*- }
|
||||
{ dbus-signatures.h utility functions for D-Bus types
|
||||
*
|
||||
* Copyright (C) 2005 Red Hat Inc.
|
||||
*
|
||||
* Licensed under the Academic Free License version 2.1
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
}
|
||||
|
||||
{#include <dbus/dbus-macros.h>
|
||||
#include <dbus/dbus-types.h>
|
||||
#include <dbus/dbus-errors.h>}
|
||||
|
||||
{
|
||||
* DBusSignatureIter struct; contains no public fields
|
||||
}
|
||||
type
|
||||
DBusSignatureIter = record
|
||||
dummy1: Pointer; {< Don't use this }
|
||||
dummy2: Pointer; {< Don't use this }
|
||||
dummy8: dbus_uint32_t; {< Don't use this }
|
||||
dummy12: cint; {< Don't use this }
|
||||
dummy17: cint; {< Don't use this }
|
||||
end;
|
||||
|
||||
PDBusSignatureIter = ^DBusSignatureIter;
|
||||
|
||||
procedure dbus_signature_iter_init(iter: PDBusSignatureIter; const signature: PChar); cdecl; external LibDBus;
|
||||
|
||||
function dbus_signature_iter_get_current_type(const iter: PDBusSignatureIter): Integer; cdecl; external LibDBus;
|
||||
|
||||
function dbus_signature_iter_get_signature(const iter: PDBusSignatureIter): PChar; cdecl; external LibDBus;
|
||||
|
||||
function dbus_signature_iter_get_element_type(const iter: PDBusSignatureIter): Integer; cdecl; external LibDBus;
|
||||
|
||||
function dbus_signature_iter_next(const iter: PDBusSignatureIter): dbus_bool_t; cdecl; external LibDBus;
|
||||
|
||||
procedure dbus_signature_iter_recurse(const iter: PDBusSignatureIter; subiter: PDBusSignatureIter); cdecl; external LibDBus;
|
||||
|
||||
function dbus_signature_validate(const signature: PChar; error: PDBusError): dbus_bool_t; cdecl; external LibDBus;
|
||||
|
||||
function dbus_signature_validate_single(const signature: PChar; error: PDBusError): dbus_bool_t; cdecl; external LibDBus;
|
||||
|
||||
function dbus_type_is_basic(typecode: cint): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_type_is_container(typecode: cint): dbus_bool_t; cdecl; external LibDBus;
|
||||
function dbus_type_is_fixed(typecode: cint): dbus_bool_t; cdecl; external LibDBus;
|
||||
|
95
packages/base/dbus/dbus-threads.inc
Normal file
95
packages/base/dbus/dbus-threads.inc
Normal file
@ -0,0 +1,95 @@
|
||||
{ -*- mode: C; c-file-style: "gnu" -*- }
|
||||
{ dbus-threads.h D-Bus threads handling
|
||||
*
|
||||
* Copyright (C) 2002 Red Hat Inc.
|
||||
*
|
||||
* Licensed under the Academic Free License version 2.1
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
}
|
||||
|
||||
{#include <dbus/dbus-macros.h>
|
||||
#include <dbus/dbus-types.h>}
|
||||
|
||||
type
|
||||
DBusMutex = record end;
|
||||
PDBusMutex = ^DBusMutex;
|
||||
|
||||
DBusCondVar = record end;
|
||||
PDBusCondVar = ^DBusCondVar;
|
||||
|
||||
DBusMutexNewFunction = function (): DBusMutex;
|
||||
DBusMutexFreeFunction = procedure (mutex: PDBusMutex);
|
||||
DBusMutexLockFunction = function (mutex: PDBusMutex): dbus_bool_t;
|
||||
DBusMutexUnlockFunction = function (mutex: PDBusMutex): dbus_bool_t;
|
||||
|
||||
DBusCondVarNewFunction = function (): PDBusCondVar;
|
||||
DBusCondVarFreeFunction = procedure (cond: PDBusCondVar);
|
||||
DBusCondVarWaitFunction = procedure (cond: PDBusCondVar; mutex: PDBusMutex);
|
||||
DBusCondVarWaitTimeoutFunction = procedure (cond: PDBusCondVar; mutex: PDBusMutex;
|
||||
timeout_milliseconds: cint);
|
||||
DBusCondVarWakeOneFunction = procedure (cond: PDBusCondVar);
|
||||
DBusCondVarWakeAllFunction = procedure (cond: PDBusCondVar);
|
||||
|
||||
DBusThreadFunctionsMask =
|
||||
(
|
||||
DBUS_THREAD_FUNCTIONS_MUTEX_NEW_MASK = 1 shl 0,
|
||||
DBUS_THREAD_FUNCTIONS_MUTEX_FREE_MASK = 1 shl 1,
|
||||
DBUS_THREAD_FUNCTIONS_MUTEX_LOCK_MASK = 1 shl 2,
|
||||
DBUS_THREAD_FUNCTIONS_MUTEX_UNLOCK_MASK = 1 shl 3,
|
||||
DBUS_THREAD_FUNCTIONS_CONDVAR_NEW_MASK = 1 shl 4,
|
||||
DBUS_THREAD_FUNCTIONS_CONDVAR_FREE_MASK = 1 shl 5,
|
||||
DBUS_THREAD_FUNCTIONS_CONDVAR_WAIT_MASK = 1 shl 6,
|
||||
DBUS_THREAD_FUNCTIONS_CONDVAR_WAIT_TIMEOUT_MASK = 1 shl 7,
|
||||
DBUS_THREAD_FUNCTIONS_CONDVAR_WAKE_ONE_MASK = 1 shl 8,
|
||||
DBUS_THREAD_FUNCTIONS_CONDVAR_WAKE_ALL_MASK = 1 shl 9,
|
||||
|
||||
DBUS_THREAD_FUNCTIONS_ALL_MASK = (1 shl 10) - 1
|
||||
);
|
||||
|
||||
{
|
||||
* Functions that must be implemented to make the D-Bus
|
||||
* library thread-aware.
|
||||
}
|
||||
DBusThreadFunctions = record
|
||||
mask: cuint; {< Mask indicating which functions are present. }
|
||||
|
||||
mutex_new: DBusMutexNewFunction; {< Function to create a mutex }
|
||||
mutex_free: DBusMutexFreeFunction; {< Function to free a mutex }
|
||||
mutex_lock: DBusMutexLockFunction; {< Function to lock a mutex }
|
||||
mutex_unlock: DBusMutexUnlockFunction; {< Function to unlock a mutex }
|
||||
|
||||
condvar_new: DBusCondVarNewFunction; {< Function to create a condition variable }
|
||||
condvar_free: DBusCondVarFreeFunction; {< Function to free a condition variable }
|
||||
condvar_wait: DBusCondVarWaitFunction; {< Function to wait on a condition }
|
||||
condvar_wait_timeout: DBusCondVarWaitTimeoutFunction; {< Function to wait on a condition with a timeout }
|
||||
condvar_wake_one: DBusCondVarWakeOneFunction; {< Function to wake one thread waiting on the condition }
|
||||
condvar_wake_all: DBusCondVarWakeAllFunction; {< Function to wake all threads waiting on the condition }
|
||||
|
||||
padding1: procedure; {< Reserved for future expansion }
|
||||
padding2: procedure; {< Reserved for future expansion }
|
||||
padding3: procedure; {< Reserved for future expansion }
|
||||
padding4: procedure; {< Reserved for future expansion }
|
||||
padding5: procedure; {< Reserved for future expansion }
|
||||
padding6: procedure; {< Reserved for future expansion }
|
||||
padding7: procedure; {< Reserved for future expansion }
|
||||
padding8: procedure; {< Reserved for future expansion }
|
||||
end;
|
||||
|
||||
PDBusThreadFunctions = ^DBusThreadFunctions;
|
||||
|
||||
function dbus_threads_init(const functions: PDBusThreadFunctions): dbus_bool_t; cdecl; external LibDBus;
|
||||
|
115
packages/base/dbus/dbus-types.inc
Normal file
115
packages/base/dbus/dbus-types.inc
Normal file
@ -0,0 +1,115 @@
|
||||
{ -*- mode: C; c-file-style: "gnu" -*- }
|
||||
{ dbus-types.h types such as dbus_bool_t
|
||||
*
|
||||
* Copyright (C) 2002 Red Hat Inc.
|
||||
*
|
||||
* Licensed under the Academic Free License version 2.1
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
}
|
||||
|
||||
//#include <stddef.h>
|
||||
//#include <dbus/dbus-arch-deps.h>
|
||||
|
||||
type
|
||||
dbus_unichar_t = dbus_uint32_t;
|
||||
|
||||
{ boolean size must be fixed at 4 bytes due to wire protocol! }
|
||||
dbus_bool_t = dbus_uint32_t;
|
||||
|
||||
PPPChar = ^PPChar;
|
||||
|
||||
va_list = Pointer;
|
||||
|
||||
{ Normally docs are in .c files, but there isn't a .c file for this. }
|
||||
{
|
||||
* @defgroup DBusTypes Basic types
|
||||
* @ingroup DBus
|
||||
* @brief dbus_bool_t, dbus_int32_t, etc.
|
||||
*
|
||||
* Typedefs for common primitive types.
|
||||
*
|
||||
}
|
||||
|
||||
{
|
||||
* @typedef dbus_bool_t
|
||||
*
|
||||
* A boolean, valid values are #TRUE and #FALSE.
|
||||
}
|
||||
|
||||
{
|
||||
* @typedef dbus_uint32_t
|
||||
*
|
||||
* A 32-bit unsigned integer on all platforms.
|
||||
}
|
||||
|
||||
{
|
||||
* @typedef dbus_int32_t
|
||||
*
|
||||
* A 32-bit signed integer on all platforms.
|
||||
}
|
||||
|
||||
{
|
||||
* @typedef dbus_uint16_t
|
||||
*
|
||||
* A 16-bit unsigned integer on all platforms.
|
||||
}
|
||||
|
||||
{
|
||||
* @typedef dbus_int16_t
|
||||
*
|
||||
* A 16-bit signed integer on all platforms.
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
* @typedef dbus_uint64_t
|
||||
*
|
||||
* A 64-bit unsigned integer on all platforms that support it.
|
||||
* If supported, #DBUS_HAVE_INT64 will be defined.
|
||||
*
|
||||
* C99 requires a 64-bit type and most likely all interesting
|
||||
* compilers support one. GLib for example flat-out requires
|
||||
* a 64-bit type.
|
||||
}
|
||||
|
||||
{
|
||||
* @typedef dbus_int64_t
|
||||
*
|
||||
* A 64-bit signed integer on all platforms that support it.
|
||||
* If supported, #DBUS_HAVE_INT64 will be defined.
|
||||
*
|
||||
* C99 requires a 64-bit type and most likely all interesting
|
||||
* compilers support one. GLib for example flat-out requires
|
||||
* a 64-bit type.
|
||||
}
|
||||
|
||||
{
|
||||
* @def DBUS_INT64_CONSTANT
|
||||
*
|
||||
* Declare a 64-bit signed integer constant. The macro
|
||||
* adds the necessary "LL" or whatever after the integer,
|
||||
* giving a literal such as "325145246765LL"
|
||||
}
|
||||
|
||||
{
|
||||
* @def DBUS_UINT64_CONSTANT
|
||||
*
|
||||
* Declare a 64-bit unsigned integer constant. The macro
|
||||
* adds the necessary "ULL" or whatever after the integer,
|
||||
* giving a literal such as "325145246765ULL"
|
||||
}
|
||||
|
91
packages/base/dbus/dbus.pas
Normal file
91
packages/base/dbus/dbus.pas
Normal file
@ -0,0 +1,91 @@
|
||||
{
|
||||
Pascal translation of the dbus headers
|
||||
|
||||
Based on dbus version 0.92
|
||||
}
|
||||
{ -*- mode: C; c-file-style: "gnu" -*- }
|
||||
{ dbus.h Convenience header including all other headers
|
||||
*
|
||||
* Copyright (C) 2002, 2003 Red Hat Inc.
|
||||
*
|
||||
* Licensed under the Academic Free License version 2.1
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
}
|
||||
unit dbus;
|
||||
|
||||
{$ifdef fpc}
|
||||
{$mode delphi}{$H+}
|
||||
{$endif}
|
||||
|
||||
{$minenumsize 4}
|
||||
|
||||
{ FPC 2.0.2 compatibility code }
|
||||
{$ifdef win32}
|
||||
{$define windows}
|
||||
{$endif}
|
||||
|
||||
{ Delphi compatibility code }
|
||||
{$ifndef fpc}
|
||||
{$define windows}
|
||||
{$endif}
|
||||
|
||||
interface
|
||||
|
||||
uses ctypes;
|
||||
|
||||
{ D-Bus hasn't reached 1.0 and is subject to protocol and API churn.
|
||||
See the README for a full explanation. }
|
||||
|
||||
const
|
||||
{$ifdef unix}
|
||||
LibDBus = 'libdbus-1';
|
||||
{$endif}
|
||||
{$ifdef windows}
|
||||
LibDBus = 'libdbus.dll';
|
||||
{$endif}
|
||||
|
||||
{$include dbus-macros.inc}
|
||||
{$include dbus-arch-deps.inc}
|
||||
{$include dbus-types.inc}
|
||||
{$include dbus-errors.inc}
|
||||
{$include dbus-address.inc}
|
||||
{$include dbus-message.inc}
|
||||
{$include dbus-shared.inc}
|
||||
{$include dbus-connection.inc}
|
||||
{$include dbus-bus.inc}
|
||||
|
||||
{$include dbus-pending-call.inc}
|
||||
{$include dbus-protocol.inc}
|
||||
{$include dbus-server.inc}
|
||||
|
||||
{$include dbus-signature.inc}
|
||||
{$include dbus-threads.inc}
|
||||
|
||||
{
|
||||
* @defgroup DBus D-Bus low-level public API
|
||||
* @brief The low-level public API of the D-Bus library
|
||||
*
|
||||
* libdbus provides a low-level API intended primarily for use by
|
||||
* bindings to specific object systems and languages. D-Bus is most
|
||||
* convenient when used with the GLib bindings, Python bindings, Qt
|
||||
* bindings, Mono bindings, and so forth. This low-level API has a
|
||||
* lot of complexity useful only for bindings.
|
||||
*
|
||||
}
|
||||
implementation
|
||||
|
||||
end.
|
45
packages/base/dbus/dbus_arch_deps.inc
Normal file
45
packages/base/dbus/dbus_arch_deps.inc
Normal file
@ -0,0 +1,45 @@
|
||||
{ -*- mode: C; c-file-style: "gnu" -*- }
|
||||
{ dbus-arch-deps.h Header with architecture/compiler specific information, installed to libdir
|
||||
*
|
||||
* Copyright (C) 2003 Red Hat, Inc.
|
||||
*
|
||||
* Licensed under the Academic Free License version 2.0
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
}
|
||||
|
||||
{ Only <dbus/dbus.h> can be included directly, this file may disappear or change contents. }
|
||||
|
||||
//#include <dbus/dbus-macros.h>
|
||||
|
||||
const DBUS_HAVE_INT64 = 1;
|
||||
|
||||
type
|
||||
dbus_int64_t = Int64;
|
||||
|
||||
dbus_uint64_t = Int64;
|
||||
|
||||
{#define DBUS_INT64_CONSTANT(val) (val##LL)
|
||||
#define DBUS_UINT64_CONSTANT(val) (val##ULL)}
|
||||
|
||||
dbus_int32_t = cint;
|
||||
dbus_uint32_t = cuint;
|
||||
|
||||
dbus_int16_t = cshort;
|
||||
dbus_uint16_t = cushort;
|
||||
|
||||
size_t = Integer;
|
||||
|
1618
packages/base/dbus/example/Makefile
Normal file
1618
packages/base/dbus/example/Makefile
Normal file
File diff suppressed because it is too large
Load Diff
15
packages/base/dbus/example/Makefile.fpc
Normal file
15
packages/base/dbus/example/Makefile.fpc
Normal file
@ -0,0 +1,15 @@
|
||||
#
|
||||
# Makefile.fpc for dbus units example
|
||||
#
|
||||
|
||||
[target]
|
||||
programs=busexample
|
||||
|
||||
[require]
|
||||
packages=dbus
|
||||
|
||||
[install]
|
||||
fpcpackage=y
|
||||
|
||||
[default]
|
||||
fpcdir=../../../..
|
82
packages/base/dbus/example/busexample.pp
Normal file
82
packages/base/dbus/example/busexample.pp
Normal file
@ -0,0 +1,82 @@
|
||||
program busexample;
|
||||
|
||||
{$ifdef fpc}
|
||||
{$mode objfpc}{$H+}
|
||||
{$endif}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||
cthreads,
|
||||
{$ENDIF}{$ENDIF}
|
||||
SysUtils,
|
||||
ctypes,
|
||||
dbus;
|
||||
|
||||
procedure BusSend;
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
procedure BusReceive;
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
procedure BusListen;
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
procedure BusQuery;
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
const
|
||||
SINTAX_TEXT = 'Syntax: dbus-example [send|receive|listen|query] [<param>]';
|
||||
var
|
||||
err: DBusError;
|
||||
conn: PDBusConnection;
|
||||
ret: cint;
|
||||
begin
|
||||
{ Initializes the errors }
|
||||
dbus_error_init(@err);
|
||||
|
||||
{ Connection }
|
||||
conn := dbus_bus_get(DBUS_BUS_SESSION, @err);
|
||||
|
||||
if dbus_error_is_set(@err) <> 0 then
|
||||
begin
|
||||
WriteLn('Connection Error: ' + err.message);
|
||||
dbus_error_free(@err);
|
||||
end;
|
||||
|
||||
if conn = nil then Exit;
|
||||
|
||||
{ Request the name of the bus }
|
||||
ret := dbus_bus_request_name(conn, 'test.method.server', DBUS_NAME_FLAG_REPLACE_EXISTING, @err);
|
||||
|
||||
if dbus_error_is_set(@err) <> 0 then
|
||||
begin
|
||||
WriteLn('Name Error: ' + err.message);
|
||||
dbus_error_free(@err);
|
||||
end;
|
||||
|
||||
if ret <> DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER then Exit;
|
||||
|
||||
{ Parses parameters }
|
||||
|
||||
if (ParamCount <> 1) and (ParamCount <> 2) then WriteLn(SINTAX_TEXT)
|
||||
else
|
||||
begin
|
||||
if ParamStr(1) = 'send' then BusSend
|
||||
else if ParamStr(1) = 'receive' then BusReceive
|
||||
else if ParamStr(1) = 'listen' then BusListen
|
||||
else if ParamStr(1) = 'query' then BusQuery
|
||||
else WriteLn(SINTAX_TEXT);
|
||||
end;
|
||||
|
||||
{ Finalization }
|
||||
dbus_connection_close(conn);
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user