initial commit, 4.5 stable
Some checks failed
🔗 GHA / 📊 Static checks (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
🔗 GHA / 🌐 Web (push) Has been cancelled

This commit is contained in:
2025-09-16 20:46:46 -04:00
commit 9d30169a8d
13378 changed files with 7050105 additions and 0 deletions

View File

@@ -0,0 +1,86 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
#endif
#ifndef DBUS_ADDRESS_H
#define DBUS_ADDRESS_H
#include <dbus/dbus-types.h>
#include <dbus/dbus-errors.h>
DBUS_BEGIN_DECLS
/**
* @addtogroup DBusAddress
* @{
*/
/** Opaque type representing one of the semicolon-separated items in an address */
typedef struct DBusAddressEntry DBusAddressEntry;
DBUS_EXPORT
dbus_bool_t dbus_parse_address (const char *address,
DBusAddressEntry ***entry_result,
int *array_len,
DBusError *error);
DBUS_EXPORT
const char *dbus_address_entry_get_value (DBusAddressEntry *entry,
const char *key);
DBUS_EXPORT
const char *dbus_address_entry_get_method (DBusAddressEntry *entry);
DBUS_EXPORT
void dbus_address_entries_free (DBusAddressEntry **entries);
DBUS_EXPORT
char* dbus_address_escape_value (const char *value);
DBUS_EXPORT
char* dbus_address_unescape_value (const char *value,
DBusError *error);
/**
* Clear a variable or struct member that contains an array of #DBusAddressEntry.
* If it does not contain #NULL, the entries that were previously
* there are freed with dbus_address_entries_free().
*
* This is similar to dbus_clear_connection(): see that function
* for more details.
*
* @param pointer_to_entries A pointer to a variable or struct member.
* pointer_to_entries must not be #NULL, but *pointer_to_entries
* may be #NULL.
*/
static inline void
dbus_clear_address_entries (DBusAddressEntry ***pointer_to_entries)
{
_dbus_clear_pointer_impl (DBusAddressEntry *, pointer_to_entries,
dbus_address_entries_free);
}
/** @} */
DBUS_END_DECLS
#endif /* DBUS_ADDRESS_H */

View File

@@ -0,0 +1,61 @@
/* -*- 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
#endif
#ifndef DBUS_ARCH_DEPS_H
#define DBUS_ARCH_DEPS_H
#include <dbus/dbus-macros.h>
DBUS_BEGIN_DECLS
/* D-Bus no longer supports platforms with no 64-bit integer type. */
#define DBUS_HAVE_INT64 1
_DBUS_GNUC_EXTENSION typedef long dbus_int64_t;
_DBUS_GNUC_EXTENSION typedef unsigned long dbus_uint64_t;
#define DBUS_INT64_CONSTANT(val) (_DBUS_GNUC_EXTENSION (val##L))
#define DBUS_UINT64_CONSTANT(val) (_DBUS_GNUC_EXTENSION (val##UL))
typedef int dbus_int32_t;
typedef unsigned int dbus_uint32_t;
typedef short dbus_int16_t;
typedef unsigned short dbus_uint16_t;
/* This is not really arch-dependent, but it's not worth
* creating an additional generated header just for this
*/
#define DBUS_MAJOR_VERSION 1
#define DBUS_MINOR_VERSION 12
#define DBUS_MICRO_VERSION 2
#define DBUS_VERSION_STRING "1.12.2"
#define DBUS_VERSION ((1 << 16) | (12 << 8) | (2))
DBUS_END_DECLS
#endif /* DBUS_ARCH_DEPS_H */

View File

@@ -0,0 +1,95 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
#endif
#ifndef DBUS_BUS_H
#define DBUS_BUS_H
#include <dbus/dbus-connection.h>
DBUS_BEGIN_DECLS
/**
* @addtogroup DBusBus
* @{
*/
DBUS_EXPORT
DBusConnection *dbus_bus_get (DBusBusType type,
DBusError *error);
DBUS_EXPORT
DBusConnection *dbus_bus_get_private (DBusBusType type,
DBusError *error);
DBUS_EXPORT
dbus_bool_t dbus_bus_register (DBusConnection *connection,
DBusError *error);
DBUS_EXPORT
dbus_bool_t dbus_bus_set_unique_name (DBusConnection *connection,
const char *unique_name);
DBUS_EXPORT
const char* dbus_bus_get_unique_name (DBusConnection *connection);
DBUS_EXPORT
unsigned long dbus_bus_get_unix_user (DBusConnection *connection,
const char *name,
DBusError *error);
DBUS_EXPORT
char* dbus_bus_get_id (DBusConnection *connection,
DBusError *error);
DBUS_EXPORT
int dbus_bus_request_name (DBusConnection *connection,
const char *name,
unsigned int flags,
DBusError *error);
DBUS_EXPORT
int dbus_bus_release_name (DBusConnection *connection,
const char *name,
DBusError *error);
DBUS_EXPORT
dbus_bool_t dbus_bus_name_has_owner (DBusConnection *connection,
const char *name,
DBusError *error);
DBUS_EXPORT
dbus_bool_t dbus_bus_start_service_by_name (DBusConnection *connection,
const char *name,
dbus_uint32_t flags,
dbus_uint32_t *reply,
DBusError *error);
DBUS_EXPORT
void dbus_bus_add_match (DBusConnection *connection,
const char *rule,
DBusError *error);
DBUS_EXPORT
void dbus_bus_remove_match (DBusConnection *connection,
const char *rule,
DBusError *error);
/** @} */
DBUS_END_DECLS
#endif /* DBUS_BUS_H */

View File

@@ -0,0 +1,526 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
#endif
#ifndef DBUS_CONNECTION_H
#define DBUS_CONNECTION_H
#include <dbus/dbus-errors.h>
#include <dbus/dbus-macros.h>
#include <dbus/dbus-memory.h>
#include <dbus/dbus-message.h>
#include <dbus/dbus-shared.h>
DBUS_BEGIN_DECLS
/**
* @addtogroup DBusConnection
* @{
*/
/* documented in dbus-watch.c */
typedef struct DBusWatch DBusWatch;
/* documented in dbus-timeout.c */
typedef struct DBusTimeout DBusTimeout;
/** Opaque type representing preallocated resources so a message can be sent without further memory allocation. */
typedef struct DBusPreallocatedSend DBusPreallocatedSend;
/** Opaque type representing a method call that has not yet received a reply. */
typedef struct DBusPendingCall DBusPendingCall;
/** Opaque type representing a connection to a remote application and associated incoming/outgoing message queues. */
typedef struct DBusConnection DBusConnection;
/** Set of functions that must be implemented to handle messages sent to a particular object path. */
typedef struct DBusObjectPathVTable DBusObjectPathVTable;
/**
* Indicates the status of a #DBusWatch.
*/
typedef enum
{
DBUS_WATCH_READABLE = 1 << 0, /**< As in POLLIN */
DBUS_WATCH_WRITABLE = 1 << 1, /**< As in POLLOUT */
DBUS_WATCH_ERROR = 1 << 2, /**< As in POLLERR (can't watch for
* this, but can be present in
* current state passed to
* dbus_watch_handle()).
*/
DBUS_WATCH_HANGUP = 1 << 3 /**< As in POLLHUP (can't watch for
* it, but can be present in current
* state passed to
* dbus_watch_handle()).
*/
/* Internal to libdbus, there is also _DBUS_WATCH_NVAL in dbus-watch.h */
} DBusWatchFlags;
/**
* Indicates the status of incoming data on a #DBusConnection. This determines whether
* dbus_connection_dispatch() needs to be called.
*/
typedef enum
{
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. */
} DBusDispatchStatus;
/** Called when libdbus needs a new watch to be monitored by the main
* loop. Returns #FALSE if it lacks enough memory to add the
* watch. Set by dbus_connection_set_watch_functions() or
* dbus_server_set_watch_functions().
*/
typedef dbus_bool_t (* DBusAddWatchFunction) (DBusWatch *watch,
void *data);
/** Called when dbus_watch_get_enabled() may return a different value
* than it did before. Set by dbus_connection_set_watch_functions()
* or dbus_server_set_watch_functions().
*/
typedef void (* DBusWatchToggledFunction) (DBusWatch *watch,
void *data);
/** Called when libdbus no longer needs a watch to be monitored by the
* main loop. Set by dbus_connection_set_watch_functions() or
* dbus_server_set_watch_functions().
*/
typedef void (* DBusRemoveWatchFunction) (DBusWatch *watch,
void *data);
/** Called when libdbus needs a new timeout to be monitored by the main
* loop. Returns #FALSE if it lacks enough memory to add the
* watch. Set by dbus_connection_set_timeout_functions() or
* dbus_server_set_timeout_functions().
*/
typedef dbus_bool_t (* DBusAddTimeoutFunction) (DBusTimeout *timeout,
void *data);
/** Called when dbus_timeout_get_enabled() may return a different
* value than it did before.
* Set by dbus_connection_set_timeout_functions() or
* dbus_server_set_timeout_functions().
*/
typedef void (* DBusTimeoutToggledFunction) (DBusTimeout *timeout,
void *data);
/** Called when libdbus no longer needs a timeout to be monitored by the
* main loop. Set by dbus_connection_set_timeout_functions() or
* dbus_server_set_timeout_functions().
*/
typedef void (* DBusRemoveTimeoutFunction) (DBusTimeout *timeout,
void *data);
/** Called when the return value of dbus_connection_get_dispatch_status()
* may have changed. Set with dbus_connection_set_dispatch_status_function().
*/
typedef void (* DBusDispatchStatusFunction) (DBusConnection *connection,
DBusDispatchStatus new_status,
void *data);
/**
* Called when the main loop's thread should be notified that there's now work
* to do. Set with dbus_connection_set_wakeup_main_function().
*/
typedef void (* DBusWakeupMainFunction) (void *data);
/**
* Called during authentication to check whether the given UNIX user
* ID is allowed to connect, if the client tried to auth as a UNIX
* user ID. Normally on Windows this would never happen. Set with
* dbus_connection_set_unix_user_function().
*/
typedef dbus_bool_t (* DBusAllowUnixUserFunction) (DBusConnection *connection,
unsigned long uid,
void *data);
/**
* Called during authentication to check whether the given Windows user
* ID is allowed to connect, if the client tried to auth as a Windows
* user ID. Normally on UNIX this would never happen. Set with
* dbus_connection_set_windows_user_function().
*/
typedef dbus_bool_t (* DBusAllowWindowsUserFunction) (DBusConnection *connection,
const char *user_sid,
void *data);
/**
* Called when a pending call now has a reply available. Set with
* dbus_pending_call_set_notify().
*/
typedef void (* DBusPendingCallNotifyFunction) (DBusPendingCall *pending,
void *user_data);
/**
* Called when a message needs to be handled. The result indicates whether or
* not more handlers should be run. Set with dbus_connection_add_filter().
*/
typedef DBusHandlerResult (* DBusHandleMessageFunction) (DBusConnection *connection,
DBusMessage *message,
void *user_data);
DBUS_EXPORT
DBusConnection* dbus_connection_open (const char *address,
DBusError *error);
DBUS_EXPORT
DBusConnection* dbus_connection_open_private (const char *address,
DBusError *error);
DBUS_EXPORT
DBusConnection* dbus_connection_ref (DBusConnection *connection);
DBUS_EXPORT
void dbus_connection_unref (DBusConnection *connection);
DBUS_EXPORT
void dbus_connection_close (DBusConnection *connection);
DBUS_EXPORT
dbus_bool_t dbus_connection_get_is_connected (DBusConnection *connection);
DBUS_EXPORT
dbus_bool_t dbus_connection_get_is_authenticated (DBusConnection *connection);
DBUS_EXPORT
dbus_bool_t dbus_connection_get_is_anonymous (DBusConnection *connection);
DBUS_EXPORT
char* dbus_connection_get_server_id (DBusConnection *connection);
DBUS_EXPORT
dbus_bool_t dbus_connection_can_send_type (DBusConnection *connection,
int type);
DBUS_EXPORT
void dbus_connection_set_exit_on_disconnect (DBusConnection *connection,
dbus_bool_t exit_on_disconnect);
DBUS_EXPORT
void dbus_connection_flush (DBusConnection *connection);
DBUS_EXPORT
dbus_bool_t dbus_connection_read_write_dispatch (DBusConnection *connection,
int timeout_milliseconds);
DBUS_EXPORT
dbus_bool_t dbus_connection_read_write (DBusConnection *connection,
int timeout_milliseconds);
DBUS_EXPORT
DBusMessage* dbus_connection_borrow_message (DBusConnection *connection);
DBUS_EXPORT
void dbus_connection_return_message (DBusConnection *connection,
DBusMessage *message);
DBUS_EXPORT
void dbus_connection_steal_borrowed_message (DBusConnection *connection,
DBusMessage *message);
DBUS_EXPORT
DBusMessage* dbus_connection_pop_message (DBusConnection *connection);
DBUS_EXPORT
DBusDispatchStatus dbus_connection_get_dispatch_status (DBusConnection *connection);
DBUS_EXPORT
DBusDispatchStatus dbus_connection_dispatch (DBusConnection *connection);
DBUS_EXPORT
dbus_bool_t dbus_connection_has_messages_to_send (DBusConnection *connection);
DBUS_EXPORT
dbus_bool_t dbus_connection_send (DBusConnection *connection,
DBusMessage *message,
dbus_uint32_t *client_serial);
DBUS_EXPORT
dbus_bool_t dbus_connection_send_with_reply (DBusConnection *connection,
DBusMessage *message,
DBusPendingCall **pending_return,
int timeout_milliseconds);
DBUS_EXPORT
DBusMessage * dbus_connection_send_with_reply_and_block (DBusConnection *connection,
DBusMessage *message,
int timeout_milliseconds,
DBusError *error);
DBUS_EXPORT
dbus_bool_t dbus_connection_set_watch_functions (DBusConnection *connection,
DBusAddWatchFunction add_function,
DBusRemoveWatchFunction remove_function,
DBusWatchToggledFunction toggled_function,
void *data,
DBusFreeFunction free_data_function);
DBUS_EXPORT
dbus_bool_t dbus_connection_set_timeout_functions (DBusConnection *connection,
DBusAddTimeoutFunction add_function,
DBusRemoveTimeoutFunction remove_function,
DBusTimeoutToggledFunction toggled_function,
void *data,
DBusFreeFunction free_data_function);
DBUS_EXPORT
void dbus_connection_set_wakeup_main_function (DBusConnection *connection,
DBusWakeupMainFunction wakeup_main_function,
void *data,
DBusFreeFunction free_data_function);
DBUS_EXPORT
void dbus_connection_set_dispatch_status_function (DBusConnection *connection,
DBusDispatchStatusFunction function,
void *data,
DBusFreeFunction free_data_function);
DBUS_EXPORT
dbus_bool_t dbus_connection_get_unix_user (DBusConnection *connection,
unsigned long *uid);
DBUS_EXPORT
dbus_bool_t dbus_connection_get_unix_process_id (DBusConnection *connection,
unsigned long *pid);
DBUS_EXPORT
dbus_bool_t dbus_connection_get_adt_audit_session_data (DBusConnection *connection,
void **data,
dbus_int32_t *data_size);
DBUS_EXPORT
void dbus_connection_set_unix_user_function (DBusConnection *connection,
DBusAllowUnixUserFunction function,
void *data,
DBusFreeFunction free_data_function);
DBUS_EXPORT
dbus_bool_t dbus_connection_get_windows_user (DBusConnection *connection,
char **windows_sid_p);
DBUS_EXPORT
void dbus_connection_set_windows_user_function (DBusConnection *connection,
DBusAllowWindowsUserFunction function,
void *data,
DBusFreeFunction free_data_function);
DBUS_EXPORT
void dbus_connection_set_allow_anonymous (DBusConnection *connection,
dbus_bool_t value);
DBUS_EXPORT
void dbus_connection_set_route_peer_messages (DBusConnection *connection,
dbus_bool_t value);
/* Filters */
DBUS_EXPORT
dbus_bool_t dbus_connection_add_filter (DBusConnection *connection,
DBusHandleMessageFunction function,
void *user_data,
DBusFreeFunction free_data_function);
DBUS_EXPORT
void dbus_connection_remove_filter (DBusConnection *connection,
DBusHandleMessageFunction function,
void *user_data);
/* Other */
DBUS_EXPORT
dbus_bool_t dbus_connection_allocate_data_slot (dbus_int32_t *slot_p);
DBUS_EXPORT
void dbus_connection_free_data_slot (dbus_int32_t *slot_p);
DBUS_EXPORT
dbus_bool_t dbus_connection_set_data (DBusConnection *connection,
dbus_int32_t slot,
void *data,
DBusFreeFunction free_data_func);
DBUS_EXPORT
void* dbus_connection_get_data (DBusConnection *connection,
dbus_int32_t slot);
DBUS_EXPORT
void dbus_connection_set_change_sigpipe (dbus_bool_t will_modify_sigpipe);
DBUS_EXPORT
void dbus_connection_set_max_message_size (DBusConnection *connection,
long size);
DBUS_EXPORT
long dbus_connection_get_max_message_size (DBusConnection *connection);
DBUS_EXPORT
void dbus_connection_set_max_received_size (DBusConnection *connection,
long size);
DBUS_EXPORT
long dbus_connection_get_max_received_size (DBusConnection *connection);
DBUS_EXPORT
void dbus_connection_set_max_message_unix_fds (DBusConnection *connection,
long n);
DBUS_EXPORT
long dbus_connection_get_max_message_unix_fds (DBusConnection *connection);
DBUS_EXPORT
void dbus_connection_set_max_received_unix_fds(DBusConnection *connection,
long n);
DBUS_EXPORT
long dbus_connection_get_max_received_unix_fds(DBusConnection *connection);
DBUS_EXPORT
long dbus_connection_get_outgoing_size (DBusConnection *connection);
DBUS_EXPORT
long dbus_connection_get_outgoing_unix_fds (DBusConnection *connection);
DBUS_EXPORT
DBusPreallocatedSend* dbus_connection_preallocate_send (DBusConnection *connection);
DBUS_EXPORT
void dbus_connection_free_preallocated_send (DBusConnection *connection,
DBusPreallocatedSend *preallocated);
DBUS_EXPORT
void dbus_connection_send_preallocated (DBusConnection *connection,
DBusPreallocatedSend *preallocated,
DBusMessage *message,
dbus_uint32_t *client_serial);
/* Object tree functionality */
/**
* Called when a #DBusObjectPathVTable is unregistered (or its connection is freed).
* Found in #DBusObjectPathVTable.
*/
typedef void (* DBusObjectPathUnregisterFunction) (DBusConnection *connection,
void *user_data);
/**
* Called when a message is sent to a registered object path. Found in
* #DBusObjectPathVTable which is registered with dbus_connection_register_object_path()
* or dbus_connection_register_fallback().
*/
typedef DBusHandlerResult (* DBusObjectPathMessageFunction) (DBusConnection *connection,
DBusMessage *message,
void *user_data);
/**
* Virtual table that must be implemented to handle a portion of the
* object path hierarchy. Attach the vtable to a particular path using
* dbus_connection_register_object_path() or
* dbus_connection_register_fallback().
*/
struct DBusObjectPathVTable
{
DBusObjectPathUnregisterFunction unregister_function; /**< Function to unregister this handler */
DBusObjectPathMessageFunction message_function; /**< Function to handle messages */
void (* dbus_internal_pad1) (void *); /**< Reserved for future expansion */
void (* dbus_internal_pad2) (void *); /**< Reserved for future expansion */
void (* dbus_internal_pad3) (void *); /**< Reserved for future expansion */
void (* dbus_internal_pad4) (void *); /**< Reserved for future expansion */
};
DBUS_EXPORT
dbus_bool_t dbus_connection_try_register_object_path (DBusConnection *connection,
const char *path,
const DBusObjectPathVTable *vtable,
void *user_data,
DBusError *error);
DBUS_EXPORT
dbus_bool_t dbus_connection_register_object_path (DBusConnection *connection,
const char *path,
const DBusObjectPathVTable *vtable,
void *user_data);
DBUS_EXPORT
dbus_bool_t dbus_connection_try_register_fallback (DBusConnection *connection,
const char *path,
const DBusObjectPathVTable *vtable,
void *user_data,
DBusError *error);
DBUS_EXPORT
dbus_bool_t dbus_connection_register_fallback (DBusConnection *connection,
const char *path,
const DBusObjectPathVTable *vtable,
void *user_data);
DBUS_EXPORT
dbus_bool_t dbus_connection_unregister_object_path (DBusConnection *connection,
const char *path);
DBUS_EXPORT
dbus_bool_t dbus_connection_get_object_path_data (DBusConnection *connection,
const char *path,
void **data_p);
DBUS_EXPORT
dbus_bool_t dbus_connection_list_registered (DBusConnection *connection,
const char *parent_path,
char ***child_entries);
DBUS_EXPORT
dbus_bool_t dbus_connection_get_unix_fd (DBusConnection *connection,
int *fd);
DBUS_EXPORT
dbus_bool_t dbus_connection_get_socket (DBusConnection *connection,
int *fd);
/**
* Clear a variable or struct member that contains a #DBusConnection.
* If it does not contain #NULL, the connection that was previously
* there is unreferenced with dbus_connection_unref().
*
* For example, this function and the similar functions for
* other reference-counted types can be used in code like this:
*
* @code
* DBusConnection *conn = NULL;
* struct { ...; DBusMessage *m; ... } *larger_structure = ...;
*
* ... code that might set conn or m to be non-NULL ...
*
* dbus_clear_connection (&conn);
* dbus_clear_message (&larger_structure->m);
* @endcode
*
* @param pointer_to_connection A pointer to a variable or struct member.
* pointer_to_connection must not be #NULL, but *pointer_to_connection
* may be #NULL.
*/
static inline void
dbus_clear_connection (DBusConnection **pointer_to_connection)
{
_dbus_clear_pointer_impl (DBusConnection, pointer_to_connection,
dbus_connection_unref);
}
/** @} */
/**
* @addtogroup DBusWatch
* @{
*/
#ifndef DBUS_DISABLE_DEPRECATED
DBUS_EXPORT
DBUS_DEPRECATED int dbus_watch_get_fd (DBusWatch *watch);
#endif
DBUS_EXPORT
int dbus_watch_get_unix_fd (DBusWatch *watch);
DBUS_EXPORT
int dbus_watch_get_socket (DBusWatch *watch);
DBUS_EXPORT
unsigned int dbus_watch_get_flags (DBusWatch *watch);
DBUS_EXPORT
void* dbus_watch_get_data (DBusWatch *watch);
DBUS_EXPORT
void dbus_watch_set_data (DBusWatch *watch,
void *data,
DBusFreeFunction free_data_function);
DBUS_EXPORT
dbus_bool_t dbus_watch_handle (DBusWatch *watch,
unsigned int flags);
DBUS_EXPORT
dbus_bool_t dbus_watch_get_enabled (DBusWatch *watch);
/** @} */
/**
* @addtogroup DBusTimeout
* @{
*/
DBUS_EXPORT
int dbus_timeout_get_interval (DBusTimeout *timeout);
DBUS_EXPORT
void* dbus_timeout_get_data (DBusTimeout *timeout);
DBUS_EXPORT
void dbus_timeout_set_data (DBusTimeout *timeout,
void *data,
DBusFreeFunction free_data_function);
DBUS_EXPORT
dbus_bool_t dbus_timeout_handle (DBusTimeout *timeout);
DBUS_EXPORT
dbus_bool_t dbus_timeout_get_enabled (DBusTimeout *timeout);
/** @} */
DBUS_END_DECLS
#endif /* DBUS_CONNECTION_H */

View File

@@ -0,0 +1,90 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
#endif
#ifndef DBUS_ERROR_H
#define DBUS_ERROR_H
#include <dbus/dbus-macros.h>
#include <dbus/dbus-types.h>
#include <dbus/dbus-protocol.h>
DBUS_BEGIN_DECLS
/**
* @addtogroup DBusErrors
* @{
*/
/** Mostly-opaque type representing an error that occurred */
typedef struct DBusError DBusError;
/**
* Object representing an exception.
*/
struct DBusError
{
const char *name; /**< public error name field */
const char *message; /**< public error message field */
unsigned int dummy1 : 1; /**< placeholder */
unsigned int dummy2 : 1; /**< placeholder */
unsigned int dummy3 : 1; /**< placeholder */
unsigned int dummy4 : 1; /**< placeholder */
unsigned int dummy5 : 1; /**< placeholder */
void *padding1; /**< placeholder */
};
#define DBUS_ERROR_INIT { NULL, NULL, TRUE, 0, 0, 0, 0, NULL }
DBUS_EXPORT
void dbus_error_init (DBusError *error);
DBUS_EXPORT
void dbus_error_free (DBusError *error);
DBUS_EXPORT
void dbus_set_error (DBusError *error,
const char *name,
const char *message,
...) _DBUS_GNUC_PRINTF (3, 4);
DBUS_EXPORT
void dbus_set_error_const (DBusError *error,
const char *name,
const char *message);
DBUS_EXPORT
void dbus_move_error (DBusError *src,
DBusError *dest);
DBUS_EXPORT
dbus_bool_t dbus_error_has_name (const DBusError *error,
const char *name);
DBUS_EXPORT
dbus_bool_t dbus_error_is_set (const DBusError *error);
/** @} */
DBUS_END_DECLS
#endif /* DBUS_ERROR_H */

View File

@@ -0,0 +1,240 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
#endif
#ifndef DBUS_MACROS_H
#define DBUS_MACROS_H
#ifdef __cplusplus
# define DBUS_BEGIN_DECLS extern "C" {
# define DBUS_END_DECLS }
#else
# define DBUS_BEGIN_DECLS
# define DBUS_END_DECLS
#endif
#ifndef TRUE
# define TRUE 1
#endif
#ifndef FALSE
# define FALSE 0
#endif
#ifndef NULL
# ifdef __cplusplus
# define NULL (0L)
# else /* !__cplusplus */
# define NULL ((void*) 0)
# endif /* !__cplusplus */
#endif
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
# define DBUS_DEPRECATED __attribute__ ((__deprecated__))
#elif defined(_MSC_VER) && (_MSC_VER >= 1300)
# define DBUS_DEPRECATED __declspec(deprecated)
#else
# define DBUS_DEPRECATED
#endif
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
# define _DBUS_GNUC_EXTENSION __extension__
#else
# define _DBUS_GNUC_EXTENSION
#endif
#if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)) || \
defined(__clang__)
#define _DBUS_GNUC_PRINTF( format_idx, arg_idx ) \
__attribute__((__format__ (__printf__, format_idx, arg_idx)))
#define _DBUS_GNUC_NORETURN \
__attribute__((__noreturn__))
#define _DBUS_GNUC_UNUSED \
__attribute__((__unused__))
#else /* !__GNUC__ */
#define _DBUS_GNUC_PRINTF( format_idx, arg_idx )
#define _DBUS_GNUC_NORETURN
#define _DBUS_GNUC_UNUSED
#endif /* !__GNUC__ */
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
#define DBUS_MALLOC __attribute__((__malloc__))
#else
#define DBUS_MALLOC
#endif
#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
#define DBUS_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
#define DBUS_ALLOC_SIZE2(x,y) __attribute__((__alloc_size__(x,y)))
#else
#define DBUS_ALLOC_SIZE(x)
#define DBUS_ALLOC_SIZE2(x,y)
#endif
#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
#define _DBUS_GNUC_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
#else
#define _DBUS_GNUC_WARN_UNUSED_RESULT
#endif
/** @def _DBUS_GNUC_PRINTF
* used to tell gcc about printf format strings
*/
/** @def _DBUS_GNUC_NORETURN
* used to tell gcc about functions that never return, such as _dbus_abort()
*/
/** @def _DBUS_GNUC_WARN_UNUSED_RESULT
* used to tell gcc about functions whose result must be used
*/
/* 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.
*
* Please don't use this in your own code, consider it
* D-Bus internal.
*/
/**
* @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.
*
* Please don't use this in your own code, consider it
* D-Bus internal.
*/
/**
* @def TRUE
*
* Expands to "1"
*/
/**
* @def FALSE
*
* Expands to "0"
*/
/**
* @def NULL
*
* A null pointer, defined appropriately for C or C++.
*/
/**
* @def DBUS_DEPRECATED
*
* Tells the compiler to warn about a function or type if it's used.
* Code marked in this way should also be enclosed in
* @code
* #ifndef DBUS_DISABLE_DEPRECATED
* deprecated stuff here
* #endif
* @endcode
*
* Please don't use this in your own code, consider it
* D-Bus internal.
*/
/**
* @def _DBUS_GNUC_EXTENSION
*
* Tells gcc not to warn about extensions to the C standard in the
* following expression, even if compiling with -pedantic. Do not use
* this macro in your own code; please consider it to be internal to libdbus.
*/
/*
* @def DBUS_EXPORT
*
* Declare the following symbol as public. This is currently a noop on
* platforms other than Windows.
*/
#if defined(DBUS_EXPORT)
/* value forced by compiler command line, don't redefine */
#elif defined(_WIN32)
# if defined(DBUS_STATIC_BUILD)
# define DBUS_EXPORT
# elif defined(dbus_1_EXPORTS)
# define DBUS_EXPORT __declspec(dllexport)
# else
# define DBUS_EXPORT __declspec(dllimport)
# endif
#elif defined(__GNUC__) && __GNUC__ >= 4
# define DBUS_EXPORT __attribute__ ((__visibility__ ("default")))
#else
#define DBUS_EXPORT
#endif
#if defined(DBUS_PRIVATE_EXPORT)
/* value forced by compiler command line, don't redefine */
#elif defined(_WIN32)
# if defined(DBUS_STATIC_BUILD)
# define DBUS_PRIVATE_EXPORT /* no decoration */
# elif defined(dbus_1_EXPORTS)
# define DBUS_PRIVATE_EXPORT __declspec(dllexport)
# else
# define DBUS_PRIVATE_EXPORT __declspec(dllimport)
# endif
#elif defined(__GNUC__) && __GNUC__ >= 4
# define DBUS_PRIVATE_EXPORT __attribute__ ((__visibility__ ("default")))
#else
# define DBUS_PRIVATE_EXPORT /* no decoration */
#endif
/* Implementation for dbus_clear_message() etc. This is not API,
* do not use it directly.
*
* We're using a specific type (T ** and T *) instead of void ** and
* void * partly for type-safety, partly to be strict-aliasing-compliant,
* and partly to keep C++ compilers happy. This code is inlined into
* users of libdbus, so we can't rely on it having dbus' own compiler
* settings. */
#define _dbus_clear_pointer_impl(T, pointer_to_pointer, destroy) \
do { \
T **_pp = (pointer_to_pointer); \
T *_value = *_pp; \
\
*_pp = NULL; \
\
if (_value != NULL) \
destroy (_value); \
} while (0)
/* Not (destroy) (_value) in case destroy() is a function-like macro */
/** @} */
#endif /* DBUS_MACROS_H */

View File

@@ -0,0 +1,73 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
#endif
#ifndef DBUS_MEMORY_H
#define DBUS_MEMORY_H
#include <dbus/dbus-macros.h>
#include <stddef.h>
DBUS_BEGIN_DECLS
/**
* @addtogroup DBusMemory
* @{
*/
DBUS_EXPORT
DBUS_MALLOC
DBUS_ALLOC_SIZE(1)
void* dbus_malloc (size_t bytes);
DBUS_EXPORT
DBUS_MALLOC
DBUS_ALLOC_SIZE(1)
void* dbus_malloc0 (size_t bytes);
DBUS_EXPORT
DBUS_MALLOC
DBUS_ALLOC_SIZE(2)
void* dbus_realloc (void *memory,
size_t bytes);
DBUS_EXPORT
void dbus_free (void *memory);
#define dbus_new(type, count) ((type*)dbus_malloc (sizeof (type) * (count)))
#define dbus_new0(type, count) ((type*)dbus_malloc0 (sizeof (type) * (count)))
DBUS_EXPORT
void dbus_free_string_array (char **str_array);
typedef void (* DBusFreeFunction) (void *memory);
DBUS_EXPORT
void dbus_shutdown (void);
/** @} */
DBUS_END_DECLS
#endif /* DBUS_MEMORY_H */

View File

@@ -0,0 +1,377 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
#endif
#ifndef DBUS_MESSAGE_H
#define DBUS_MESSAGE_H
#include <dbus/dbus-macros.h>
#include <dbus/dbus-types.h>
#include <dbus/dbus-arch-deps.h>
#include <dbus/dbus-memory.h>
#include <dbus/dbus-errors.h>
#include <stdarg.h>
DBUS_BEGIN_DECLS
/**
* @addtogroup DBusMessage
* @{
*/
typedef struct DBusMessage DBusMessage;
/**
* Opaque type representing a message iterator. Can be copied by value and
* allocated on the stack.
*
* A DBusMessageIter usually contains no allocated memory. However, there
* is one special case: after a successful call to
* dbus_message_iter_open_container(), the caller is responsible for calling
* either dbus_message_iter_close_container() or
* dbus_message_iter_abandon_container() exactly once, with the same pair
* of iterators.
*/
typedef struct DBusMessageIter DBusMessageIter;
/**
* DBusMessageIter struct; contains no public fields.
*/
struct DBusMessageIter
{
void *dummy1; /**< Don't use this */
void *dummy2; /**< Don't use this */
dbus_uint32_t dummy3; /**< Don't use this */
int dummy4; /**< Don't use this */
int dummy5; /**< Don't use this */
int dummy6; /**< Don't use this */
int dummy7; /**< Don't use this */
int dummy8; /**< Don't use this */
int dummy9; /**< Don't use this */
int dummy10; /**< Don't use this */
int dummy11; /**< Don't use this */
int pad1; /**< Don't use this */
void *pad2; /**< Don't use this */
void *pad3; /**< Don't use this */
};
/**
* A message iterator for which dbus_message_iter_abandon_container_if_open()
* is the only valid operation.
*/
#define DBUS_MESSAGE_ITER_INIT_CLOSED \
{ \
NULL, /* dummy1 */ \
NULL, /* dummy2 */ \
0, /* dummy3 */ \
0, /* dummy4 */ \
0, /* dummy5 */ \
0, /* dummy6 */ \
0, /* dummy7 */ \
0, /* dummy8 */ \
0, /* dummy9 */ \
0, /* dummy10 */ \
0, /* dummy11 */ \
0, /* pad1 */ \
NULL, /* pad2 */ \
NULL /* pad3 */ \
}
DBUS_EXPORT
DBusMessage* dbus_message_new (int message_type);
DBUS_EXPORT
DBusMessage* dbus_message_new_method_call (const char *bus_name,
const char *path,
const char *iface,
const char *method);
DBUS_EXPORT
DBusMessage* dbus_message_new_method_return (DBusMessage *method_call);
DBUS_EXPORT
DBusMessage* dbus_message_new_signal (const char *path,
const char *iface,
const char *name);
DBUS_EXPORT
DBusMessage* dbus_message_new_error (DBusMessage *reply_to,
const char *error_name,
const char *error_message);
DBUS_EXPORT
DBusMessage* dbus_message_new_error_printf (DBusMessage *reply_to,
const char *error_name,
const char *error_format,
...) _DBUS_GNUC_PRINTF (3, 4);
DBUS_EXPORT
DBusMessage* dbus_message_copy (const DBusMessage *message);
DBUS_EXPORT
DBusMessage* dbus_message_ref (DBusMessage *message);
DBUS_EXPORT
void dbus_message_unref (DBusMessage *message);
DBUS_EXPORT
int dbus_message_get_type (DBusMessage *message);
DBUS_EXPORT
dbus_bool_t dbus_message_set_path (DBusMessage *message,
const char *object_path);
DBUS_EXPORT
const char* dbus_message_get_path (DBusMessage *message);
DBUS_EXPORT
dbus_bool_t dbus_message_has_path (DBusMessage *message,
const char *object_path);
DBUS_EXPORT
dbus_bool_t dbus_message_set_interface (DBusMessage *message,
const char *iface);
DBUS_EXPORT
const char* dbus_message_get_interface (DBusMessage *message);
DBUS_EXPORT
dbus_bool_t dbus_message_has_interface (DBusMessage *message,
const char *iface);
DBUS_EXPORT
dbus_bool_t dbus_message_set_member (DBusMessage *message,
const char *member);
DBUS_EXPORT
const char* dbus_message_get_member (DBusMessage *message);
DBUS_EXPORT
dbus_bool_t dbus_message_has_member (DBusMessage *message,
const char *member);
DBUS_EXPORT
dbus_bool_t dbus_message_set_error_name (DBusMessage *message,
const char *name);
DBUS_EXPORT
const char* dbus_message_get_error_name (DBusMessage *message);
DBUS_EXPORT
dbus_bool_t dbus_message_set_destination (DBusMessage *message,
const char *destination);
DBUS_EXPORT
const char* dbus_message_get_destination (DBusMessage *message);
DBUS_EXPORT
dbus_bool_t dbus_message_set_sender (DBusMessage *message,
const char *sender);
DBUS_EXPORT
const char* dbus_message_get_sender (DBusMessage *message);
DBUS_EXPORT
const char* dbus_message_get_signature (DBusMessage *message);
DBUS_EXPORT
void dbus_message_set_no_reply (DBusMessage *message,
dbus_bool_t no_reply);
DBUS_EXPORT
dbus_bool_t dbus_message_get_no_reply (DBusMessage *message);
DBUS_EXPORT
dbus_bool_t dbus_message_is_method_call (DBusMessage *message,
const char *iface,
const char *method);
DBUS_EXPORT
dbus_bool_t dbus_message_is_signal (DBusMessage *message,
const char *iface,
const char *signal_name);
DBUS_EXPORT
dbus_bool_t dbus_message_is_error (DBusMessage *message,
const char *error_name);
DBUS_EXPORT
dbus_bool_t dbus_message_has_destination (DBusMessage *message,
const char *bus_name);
DBUS_EXPORT
dbus_bool_t dbus_message_has_sender (DBusMessage *message,
const char *unique_bus_name);
DBUS_EXPORT
dbus_bool_t dbus_message_has_signature (DBusMessage *message,
const char *signature);
DBUS_EXPORT
dbus_uint32_t dbus_message_get_serial (DBusMessage *message);
DBUS_EXPORT
void dbus_message_set_serial (DBusMessage *message,
dbus_uint32_t serial);
DBUS_EXPORT
dbus_bool_t dbus_message_set_reply_serial (DBusMessage *message,
dbus_uint32_t reply_serial);
DBUS_EXPORT
dbus_uint32_t dbus_message_get_reply_serial (DBusMessage *message);
DBUS_EXPORT
void dbus_message_set_auto_start (DBusMessage *message,
dbus_bool_t auto_start);
DBUS_EXPORT
dbus_bool_t dbus_message_get_auto_start (DBusMessage *message);
DBUS_EXPORT
dbus_bool_t dbus_message_get_path_decomposed (DBusMessage *message,
char ***path);
DBUS_EXPORT
dbus_bool_t dbus_message_append_args (DBusMessage *message,
int first_arg_type,
...);
DBUS_EXPORT
dbus_bool_t dbus_message_append_args_valist (DBusMessage *message,
int first_arg_type,
va_list var_args);
DBUS_EXPORT
dbus_bool_t dbus_message_get_args (DBusMessage *message,
DBusError *error,
int first_arg_type,
...);
DBUS_EXPORT
dbus_bool_t dbus_message_get_args_valist (DBusMessage *message,
DBusError *error,
int first_arg_type,
va_list var_args);
DBUS_EXPORT
dbus_bool_t dbus_message_contains_unix_fds (DBusMessage *message);
DBUS_EXPORT
void dbus_message_iter_init_closed (DBusMessageIter *iter);
DBUS_EXPORT
dbus_bool_t dbus_message_iter_init (DBusMessage *message,
DBusMessageIter *iter);
DBUS_EXPORT
dbus_bool_t dbus_message_iter_has_next (DBusMessageIter *iter);
DBUS_EXPORT
dbus_bool_t dbus_message_iter_next (DBusMessageIter *iter);
DBUS_EXPORT
char* dbus_message_iter_get_signature (DBusMessageIter *iter);
DBUS_EXPORT
int dbus_message_iter_get_arg_type (DBusMessageIter *iter);
DBUS_EXPORT
int dbus_message_iter_get_element_type (DBusMessageIter *iter);
DBUS_EXPORT
void dbus_message_iter_recurse (DBusMessageIter *iter,
DBusMessageIter *sub);
DBUS_EXPORT
void dbus_message_iter_get_basic (DBusMessageIter *iter,
void *value);
DBUS_EXPORT
int dbus_message_iter_get_element_count(DBusMessageIter *iter);
#ifndef DBUS_DISABLE_DEPRECATED
/* This function returns the wire protocol size of the array in bytes,
* you do not want to know that probably
*/
DBUS_EXPORT
DBUS_DEPRECATED int dbus_message_iter_get_array_len (DBusMessageIter *iter);
#endif
DBUS_EXPORT
void dbus_message_iter_get_fixed_array (DBusMessageIter *iter,
void *value,
int *n_elements);
DBUS_EXPORT
void dbus_message_iter_init_append (DBusMessage *message,
DBusMessageIter *iter);
DBUS_EXPORT
dbus_bool_t dbus_message_iter_append_basic (DBusMessageIter *iter,
int type,
const void *value);
DBUS_EXPORT
dbus_bool_t dbus_message_iter_append_fixed_array (DBusMessageIter *iter,
int element_type,
const void *value,
int n_elements);
DBUS_EXPORT
dbus_bool_t dbus_message_iter_open_container (DBusMessageIter *iter,
int type,
const char *contained_signature,
DBusMessageIter *sub);
DBUS_EXPORT
dbus_bool_t dbus_message_iter_close_container (DBusMessageIter *iter,
DBusMessageIter *sub);
DBUS_EXPORT
void dbus_message_iter_abandon_container (DBusMessageIter *iter,
DBusMessageIter *sub);
DBUS_EXPORT
void dbus_message_iter_abandon_container_if_open (DBusMessageIter *iter,
DBusMessageIter *sub);
DBUS_EXPORT
void dbus_message_lock (DBusMessage *message);
DBUS_EXPORT
dbus_bool_t dbus_set_error_from_message (DBusError *error,
DBusMessage *message);
DBUS_EXPORT
dbus_bool_t dbus_message_allocate_data_slot (dbus_int32_t *slot_p);
DBUS_EXPORT
void dbus_message_free_data_slot (dbus_int32_t *slot_p);
DBUS_EXPORT
dbus_bool_t dbus_message_set_data (DBusMessage *message,
dbus_int32_t slot,
void *data,
DBusFreeFunction free_data_func);
DBUS_EXPORT
void* dbus_message_get_data (DBusMessage *message,
dbus_int32_t slot);
DBUS_EXPORT
int dbus_message_type_from_string (const char *type_str);
DBUS_EXPORT
const char* dbus_message_type_to_string (int type);
DBUS_EXPORT
dbus_bool_t dbus_message_marshal (DBusMessage *msg,
char **marshalled_data_p,
int *len_p);
DBUS_EXPORT
DBusMessage* dbus_message_demarshal (const char *str,
int len,
DBusError *error);
DBUS_EXPORT
int dbus_message_demarshal_bytes_needed (const char *str,
int len);
DBUS_EXPORT
void dbus_message_set_allow_interactive_authorization (DBusMessage *message,
dbus_bool_t allow);
DBUS_EXPORT
dbus_bool_t dbus_message_get_allow_interactive_authorization (
DBusMessage *message);
/**
* Clear a variable or struct member that contains a #DBusMessage.
* If it does not contain #NULL, the message that was previously
* there is unreferenced with dbus_message_unref().
*
* This is very similar to dbus_clear_connection(): see that function
* for more details.
*
* @param pointer_to_message A pointer to a variable or struct member.
* pointer_to_message must not be #NULL, but *pointer_to_message
* may be #NULL.
*/
static inline void
dbus_clear_message (DBusMessage **pointer_to_message)
{
_dbus_clear_pointer_impl (DBusMessage, pointer_to_message,
dbus_message_unref);
}
/** @} */
DBUS_END_DECLS
#endif /* DBUS_MESSAGE_H */

View File

@@ -0,0 +1,59 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* dbus-misc.h A few assorted public functions that don't fit elsewhere
*
* Copyright (C) 2006 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
#endif
#ifndef DBUS_MISC_H
#define DBUS_MISC_H
#include <dbus/dbus-types.h>
#include <dbus/dbus-errors.h>
DBUS_BEGIN_DECLS
/**
* @addtogroup DBusMisc
* @{
*/
DBUS_EXPORT
char* dbus_get_local_machine_id (void);
DBUS_EXPORT
void dbus_get_version (int *major_version_p,
int *minor_version_p,
int *micro_version_p);
DBUS_EXPORT
dbus_bool_t dbus_setenv (const char *variable,
const char *value);
DBUS_EXPORT
char *dbus_try_get_local_machine_id (DBusError *error);
/** @} */
DBUS_END_DECLS
#endif /* DBUS_MISC_H */

View File

@@ -0,0 +1,98 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
#endif
#ifndef DBUS_PENDING_CALL_H
#define DBUS_PENDING_CALL_H
#include <dbus/dbus-macros.h>
#include <dbus/dbus-types.h>
#include <dbus/dbus-connection.h>
DBUS_BEGIN_DECLS
/**
* @addtogroup DBusPendingCall
* @{
*/
#define DBUS_TIMEOUT_INFINITE ((int) 0x7fffffff)
#define DBUS_TIMEOUT_USE_DEFAULT (-1)
DBUS_EXPORT
DBusPendingCall* dbus_pending_call_ref (DBusPendingCall *pending);
DBUS_EXPORT
void dbus_pending_call_unref (DBusPendingCall *pending);
DBUS_EXPORT
dbus_bool_t dbus_pending_call_set_notify (DBusPendingCall *pending,
DBusPendingCallNotifyFunction function,
void *user_data,
DBusFreeFunction free_user_data);
DBUS_EXPORT
void dbus_pending_call_cancel (DBusPendingCall *pending);
DBUS_EXPORT
dbus_bool_t dbus_pending_call_get_completed (DBusPendingCall *pending);
DBUS_EXPORT
DBusMessage* dbus_pending_call_steal_reply (DBusPendingCall *pending);
DBUS_EXPORT
void dbus_pending_call_block (DBusPendingCall *pending);
DBUS_EXPORT
dbus_bool_t dbus_pending_call_allocate_data_slot (dbus_int32_t *slot_p);
DBUS_EXPORT
void dbus_pending_call_free_data_slot (dbus_int32_t *slot_p);
DBUS_EXPORT
dbus_bool_t dbus_pending_call_set_data (DBusPendingCall *pending,
dbus_int32_t slot,
void *data,
DBusFreeFunction free_data_func);
DBUS_EXPORT
void* dbus_pending_call_get_data (DBusPendingCall *pending,
dbus_int32_t slot);
/**
* Clear a variable or struct member that contains a #DBusPendingCall.
* If it does not contain #NULL, the pending call that was previously
* there is unreferenced with dbus_pending_call_unref().
*
* This is very similar to dbus_clear_connection(): see that function
* for more details.
*
* @param pointer_to_pending_call A pointer to a variable or struct member.
* pointer_to_pending_call must not be #NULL, but *pointer_to_pending_call
* may be #NULL.
*/
static inline void
dbus_clear_pending_call (DBusPendingCall **pointer_to_pending_call)
{
_dbus_clear_pointer_impl (DBusPendingCall, pointer_to_pending_call,
dbus_pending_call_unref);
}
/** @} */
DBUS_END_DECLS
#endif /* DBUS_PENDING_CALL_H */

View File

@@ -0,0 +1,481 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef DBUS_PROTOCOL_H
#define DBUS_PROTOCOL_H
/* Don't include anything in here from anywhere else. It's
* intended for use by any random library.
*/
#ifdef __cplusplus
extern "C" {
#if 0
} /* avoids confusing emacs indentation */
#endif
#endif
/* Normally docs are in .c files, but there isn't a .c file for this. */
/**
* @defgroup DBusProtocol Protocol constants
* @ingroup DBus
*
* @brief Defines constants which are part of the D-Bus protocol
*
* This header is intended for use by any library, not only libdbus.
*
* @{
*/
/* Message byte order */
#define DBUS_LITTLE_ENDIAN ('l') /**< Code marking LSB-first byte order in the wire protocol. */
#define DBUS_BIG_ENDIAN ('B') /**< Code marking MSB-first byte order in the wire protocol. */
/** Protocol version. */
#define DBUS_MAJOR_PROTOCOL_VERSION 1
/** Type code that is never equal to a legitimate type code */
#define DBUS_TYPE_INVALID ((int) '\0')
/** #DBUS_TYPE_INVALID as a string literal instead of a int literal */
#define DBUS_TYPE_INVALID_AS_STRING "\0"
/* Primitive types */
/** Type code marking an 8-bit unsigned integer */
#define DBUS_TYPE_BYTE ((int) 'y')
/** #DBUS_TYPE_BYTE as a string literal instead of a int literal */
#define DBUS_TYPE_BYTE_AS_STRING "y"
/** Type code marking a boolean */
#define DBUS_TYPE_BOOLEAN ((int) 'b')
/** #DBUS_TYPE_BOOLEAN as a string literal instead of a int literal */
#define DBUS_TYPE_BOOLEAN_AS_STRING "b"
/** Type code marking a 16-bit signed integer */
#define DBUS_TYPE_INT16 ((int) 'n')
/** #DBUS_TYPE_INT16 as a string literal instead of a int literal */
#define DBUS_TYPE_INT16_AS_STRING "n"
/** Type code marking a 16-bit unsigned integer */
#define DBUS_TYPE_UINT16 ((int) 'q')
/** #DBUS_TYPE_UINT16 as a string literal instead of a int literal */
#define DBUS_TYPE_UINT16_AS_STRING "q"
/** Type code marking a 32-bit signed integer */
#define DBUS_TYPE_INT32 ((int) 'i')
/** #DBUS_TYPE_INT32 as a string literal instead of a int literal */
#define DBUS_TYPE_INT32_AS_STRING "i"
/** Type code marking a 32-bit unsigned integer */
#define DBUS_TYPE_UINT32 ((int) 'u')
/** #DBUS_TYPE_UINT32 as a string literal instead of a int literal */
#define DBUS_TYPE_UINT32_AS_STRING "u"
/** Type code marking a 64-bit signed integer */
#define DBUS_TYPE_INT64 ((int) 'x')
/** #DBUS_TYPE_INT64 as a string literal instead of a int literal */
#define DBUS_TYPE_INT64_AS_STRING "x"
/** Type code marking a 64-bit unsigned integer */
#define DBUS_TYPE_UINT64 ((int) 't')
/** #DBUS_TYPE_UINT64 as a string literal instead of a int literal */
#define DBUS_TYPE_UINT64_AS_STRING "t"
/** Type code marking an 8-byte double in IEEE 754 format */
#define DBUS_TYPE_DOUBLE ((int) 'd')
/** #DBUS_TYPE_DOUBLE as a string literal instead of a int literal */
#define DBUS_TYPE_DOUBLE_AS_STRING "d"
/** Type code marking a UTF-8 encoded, nul-terminated Unicode string */
#define DBUS_TYPE_STRING ((int) 's')
/** #DBUS_TYPE_STRING as a string literal instead of a int literal */
#define DBUS_TYPE_STRING_AS_STRING "s"
/** Type code marking a D-Bus object path */
#define DBUS_TYPE_OBJECT_PATH ((int) 'o')
/** #DBUS_TYPE_OBJECT_PATH as a string literal instead of a int literal */
#define DBUS_TYPE_OBJECT_PATH_AS_STRING "o"
/** Type code marking a D-Bus type signature */
#define DBUS_TYPE_SIGNATURE ((int) 'g')
/** #DBUS_TYPE_SIGNATURE as a string literal instead of a int literal */
#define DBUS_TYPE_SIGNATURE_AS_STRING "g"
/** Type code marking a unix file descriptor */
#define DBUS_TYPE_UNIX_FD ((int) 'h')
/** #DBUS_TYPE_UNIX_FD as a string literal instead of a int literal */
#define DBUS_TYPE_UNIX_FD_AS_STRING "h"
/* Compound types */
/** Type code marking a D-Bus array type */
#define DBUS_TYPE_ARRAY ((int) 'a')
/** #DBUS_TYPE_ARRAY as a string literal instead of a int literal */
#define DBUS_TYPE_ARRAY_AS_STRING "a"
/** Type code marking a D-Bus variant type */
#define DBUS_TYPE_VARIANT ((int) 'v')
/** #DBUS_TYPE_VARIANT as a string literal instead of a int literal */
#define 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
*/
/** Type code used to represent a struct; however, this type code does not appear
* in type signatures, instead #DBUS_STRUCT_BEGIN_CHAR and #DBUS_STRUCT_END_CHAR will
* appear in a signature.
*/
#define DBUS_TYPE_STRUCT ((int) 'r')
/** #DBUS_TYPE_STRUCT as a string literal instead of a int literal */
#define DBUS_TYPE_STRUCT_AS_STRING "r"
/** Type code used to represent a dict entry; however, this type code does not appear
* in type signatures, instead #DBUS_DICT_ENTRY_BEGIN_CHAR and #DBUS_DICT_ENTRY_END_CHAR will
* appear in a signature.
*/
#define DBUS_TYPE_DICT_ENTRY ((int) 'e')
/** #DBUS_TYPE_DICT_ENTRY as a string literal instead of a int literal */
#define DBUS_TYPE_DICT_ENTRY_AS_STRING "e"
/** Does not include #DBUS_TYPE_INVALID, #DBUS_STRUCT_BEGIN_CHAR, #DBUS_STRUCT_END_CHAR,
* #DBUS_DICT_ENTRY_BEGIN_CHAR, or #DBUS_DICT_ENTRY_END_CHAR - i.e. it is the number of
* valid types, not the number of distinct characters that may appear in a type signature.
*/
#define DBUS_NUMBER_OF_TYPES (16)
/* characters other than typecodes that appear in type signatures */
/** Code marking the start of a struct type in a type signature */
#define DBUS_STRUCT_BEGIN_CHAR ((int) '(')
/** #DBUS_STRUCT_BEGIN_CHAR as a string literal instead of a int literal */
#define DBUS_STRUCT_BEGIN_CHAR_AS_STRING "("
/** Code marking the end of a struct type in a type signature */
#define DBUS_STRUCT_END_CHAR ((int) ')')
/** #DBUS_STRUCT_END_CHAR a string literal instead of a int literal */
#define DBUS_STRUCT_END_CHAR_AS_STRING ")"
/** Code marking the start of a dict entry type in a type signature */
#define DBUS_DICT_ENTRY_BEGIN_CHAR ((int) '{')
/** #DBUS_DICT_ENTRY_BEGIN_CHAR as a string literal instead of a int literal */
#define DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING "{"
/** Code marking the end of a dict entry type in a type signature */
#define DBUS_DICT_ENTRY_END_CHAR ((int) '}')
/** #DBUS_DICT_ENTRY_END_CHAR as a string literal instead of a int literal */
#define 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.
*/
#define DBUS_MAXIMUM_NAME_LENGTH 255
/** This one is 255 so it fits in a byte */
#define DBUS_MAXIMUM_SIGNATURE_LENGTH 255
/** Max length of a match rule string; to keep people from hosing the
* daemon with some huge rule
*/
#define 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
*/
#define 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.
*/
#define DBUS_MAXIMUM_ARRAY_LENGTH (67108864)
/** Number of bits you need in an unsigned to store the max array size */
#define DBUS_MAXIMUM_ARRAY_LENGTH_BITS 26
/** The maximum total message size including header and body; similar
* rationale to max array size.
*/
#define DBUS_MAXIMUM_MESSAGE_LENGTH (DBUS_MAXIMUM_ARRAY_LENGTH * 2)
/** Number of bits you need in an unsigned to store the max message size */
#define DBUS_MAXIMUM_MESSAGE_LENGTH_BITS 27
/** The maximum total number of unix fds in a message. Similar
* rationale as DBUS_MAXIMUM_MESSAGE_LENGTH. However we divide by four
* given that one fd is an int and hence at least 32 bits.
*/
#define DBUS_MAXIMUM_MESSAGE_UNIX_FDS (DBUS_MAXIMUM_MESSAGE_LENGTH/4)
/** Number of bits you need in an unsigned to store the max message unix fds */
#define DBUS_MAXIMUM_MESSAGE_UNIX_FDS_BITS (DBUS_MAXIMUM_MESSAGE_LENGTH_BITS-2)
/** 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.
*/
#define DBUS_MAXIMUM_TYPE_RECURSION_DEPTH 32
/* Types of message */
/** This value is never a valid message type, see dbus_message_get_type() */
#define DBUS_MESSAGE_TYPE_INVALID 0
/** Message type of a method call message, see dbus_message_get_type() */
#define DBUS_MESSAGE_TYPE_METHOD_CALL 1
/** Message type of a method return message, see dbus_message_get_type() */
#define DBUS_MESSAGE_TYPE_METHOD_RETURN 2
/** Message type of an error reply message, see dbus_message_get_type() */
#define DBUS_MESSAGE_TYPE_ERROR 3
/** Message type of a signal message, see dbus_message_get_type() */
#define DBUS_MESSAGE_TYPE_SIGNAL 4
#define DBUS_NUM_MESSAGE_TYPES 5
/* Header flags */
/** If set, this flag means that the sender of a message does not care about getting
* a reply, so the recipient need not send one. See dbus_message_set_no_reply().
*/
#define DBUS_HEADER_FLAG_NO_REPLY_EXPECTED 0x1
/**
* If set, this flag means that even if the message bus knows how to start an owner for
* the destination bus name (see dbus_message_set_destination()), it should not
* do so. If this flag is not set, the bus may launch a program to process the
* message.
*/
#define DBUS_HEADER_FLAG_NO_AUTO_START 0x2
/**
* If set on a method call, this flag means that the caller is prepared to
* wait for interactive authorization.
*/
#define DBUS_HEADER_FLAG_ALLOW_INTERACTIVE_AUTHORIZATION 0x4
/* Header fields */
/** Not equal to any valid header field code */
#define DBUS_HEADER_FIELD_INVALID 0
/** Header field code for the path - the path is the object emitting a signal or the object receiving a method call.
* See dbus_message_set_path().
*/
#define DBUS_HEADER_FIELD_PATH 1
/** Header field code for the interface containing a member (method or signal).
* See dbus_message_set_interface().
*/
#define DBUS_HEADER_FIELD_INTERFACE 2
/** Header field code for a member (method or signal). See dbus_message_set_member(). */
#define DBUS_HEADER_FIELD_MEMBER 3
/** Header field code for an error name (found in #DBUS_MESSAGE_TYPE_ERROR messages).
* See dbus_message_set_error_name().
*/
#define DBUS_HEADER_FIELD_ERROR_NAME 4
/** Header field code for a reply serial, used to match a #DBUS_MESSAGE_TYPE_METHOD_RETURN message with the
* message that it's a reply to. See dbus_message_set_reply_serial().
*/
#define DBUS_HEADER_FIELD_REPLY_SERIAL 5
/**
* Header field code for the destination bus name of a message. See dbus_message_set_destination().
*/
#define DBUS_HEADER_FIELD_DESTINATION 6
/**
* Header field code for the sender of a message; usually initialized by the message bus.
* See dbus_message_set_sender().
*/
#define DBUS_HEADER_FIELD_SENDER 7
/**
* Header field code for the type signature of a message.
*/
#define DBUS_HEADER_FIELD_SIGNATURE 8
/**
* Header field code for the number of unix file descriptors associated
* with this message.
*/
#define DBUS_HEADER_FIELD_UNIX_FDS 9
/**
* Value of the highest-numbered header field code, can be used to determine
* the size of an array indexed by header field code. Remember though
* that unknown codes must be ignored, so check for that before
* indexing the array.
*/
#define DBUS_HEADER_FIELD_LAST DBUS_HEADER_FIELD_UNIX_FDS
/** 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.
*/
#define 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.
*/
#define 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.
*/
/** A generic error; "something went wrong" - see the error message for more. */
#define DBUS_ERROR_FAILED "org.freedesktop.DBus.Error.Failed"
/** There was not enough memory to complete an operation. */
#define DBUS_ERROR_NO_MEMORY "org.freedesktop.DBus.Error.NoMemory"
/** The bus doesn't know how to launch a service to supply the bus name you wanted. */
#define DBUS_ERROR_SERVICE_UNKNOWN "org.freedesktop.DBus.Error.ServiceUnknown"
/** The bus name you referenced doesn't exist (i.e. no application owns it). */
#define DBUS_ERROR_NAME_HAS_NO_OWNER "org.freedesktop.DBus.Error.NameHasNoOwner"
/** No reply to a message expecting one, usually means a timeout occurred. */
#define DBUS_ERROR_NO_REPLY "org.freedesktop.DBus.Error.NoReply"
/** Something went wrong reading or writing to a socket, for example. */
#define DBUS_ERROR_IO_ERROR "org.freedesktop.DBus.Error.IOError"
/** A D-Bus bus address was malformed. */
#define DBUS_ERROR_BAD_ADDRESS "org.freedesktop.DBus.Error.BadAddress"
/** Requested operation isn't supported (like ENOSYS on UNIX). */
#define DBUS_ERROR_NOT_SUPPORTED "org.freedesktop.DBus.Error.NotSupported"
/** Some limited resource is exhausted. */
#define DBUS_ERROR_LIMITS_EXCEEDED "org.freedesktop.DBus.Error.LimitsExceeded"
/** Security restrictions don't allow doing what you're trying to do. */
#define DBUS_ERROR_ACCESS_DENIED "org.freedesktop.DBus.Error.AccessDenied"
/** Authentication didn't work. */
#define DBUS_ERROR_AUTH_FAILED "org.freedesktop.DBus.Error.AuthFailed"
/** Unable to connect to server (probably caused by ECONNREFUSED on a socket). */
#define DBUS_ERROR_NO_SERVER "org.freedesktop.DBus.Error.NoServer"
/** Certain timeout errors, possibly ETIMEDOUT on a socket.
* Note that #DBUS_ERROR_NO_REPLY is used for message reply timeouts.
* @warning this is confusingly-named given that #DBUS_ERROR_TIMED_OUT also exists. We can't fix
* it for compatibility reasons so just be careful.
*/
#define DBUS_ERROR_TIMEOUT "org.freedesktop.DBus.Error.Timeout"
/** No network access (probably ENETUNREACH on a socket). */
#define DBUS_ERROR_NO_NETWORK "org.freedesktop.DBus.Error.NoNetwork"
/** Can't bind a socket since its address is in use (i.e. EADDRINUSE). */
#define DBUS_ERROR_ADDRESS_IN_USE "org.freedesktop.DBus.Error.AddressInUse"
/** The connection is disconnected and you're trying to use it. */
#define DBUS_ERROR_DISCONNECTED "org.freedesktop.DBus.Error.Disconnected"
/** Invalid arguments passed to a method call. */
#define DBUS_ERROR_INVALID_ARGS "org.freedesktop.DBus.Error.InvalidArgs"
/** Missing file. */
#define DBUS_ERROR_FILE_NOT_FOUND "org.freedesktop.DBus.Error.FileNotFound"
/** Existing file and the operation you're using does not silently overwrite. */
#define DBUS_ERROR_FILE_EXISTS "org.freedesktop.DBus.Error.FileExists"
/** Method name you invoked isn't known by the object you invoked it on. */
#define DBUS_ERROR_UNKNOWN_METHOD "org.freedesktop.DBus.Error.UnknownMethod"
/** Object you invoked a method on isn't known. */
#define DBUS_ERROR_UNKNOWN_OBJECT "org.freedesktop.DBus.Error.UnknownObject"
/** Interface you invoked a method on isn't known by the object. */
#define DBUS_ERROR_UNKNOWN_INTERFACE "org.freedesktop.DBus.Error.UnknownInterface"
/** Property you tried to access isn't known by the object. */
#define DBUS_ERROR_UNKNOWN_PROPERTY "org.freedesktop.DBus.Error.UnknownProperty"
/** Property you tried to set is read-only. */
#define DBUS_ERROR_PROPERTY_READ_ONLY "org.freedesktop.DBus.Error.PropertyReadOnly"
/** Certain timeout errors, e.g. while starting a service.
* @warning this is confusingly-named given that #DBUS_ERROR_TIMEOUT also exists. We can't fix
* it for compatibility reasons so just be careful.
*/
#define DBUS_ERROR_TIMED_OUT "org.freedesktop.DBus.Error.TimedOut"
/** Tried to remove or modify a match rule that didn't exist. */
#define DBUS_ERROR_MATCH_RULE_NOT_FOUND "org.freedesktop.DBus.Error.MatchRuleNotFound"
/** The match rule isn't syntactically valid. */
#define DBUS_ERROR_MATCH_RULE_INVALID "org.freedesktop.DBus.Error.MatchRuleInvalid"
/** While starting a new process, the exec() call failed. */
#define DBUS_ERROR_SPAWN_EXEC_FAILED "org.freedesktop.DBus.Error.Spawn.ExecFailed"
/** While starting a new process, the fork() call failed. */
#define DBUS_ERROR_SPAWN_FORK_FAILED "org.freedesktop.DBus.Error.Spawn.ForkFailed"
/** While starting a new process, the child exited with a status code. */
#define DBUS_ERROR_SPAWN_CHILD_EXITED "org.freedesktop.DBus.Error.Spawn.ChildExited"
/** While starting a new process, the child exited on a signal. */
#define DBUS_ERROR_SPAWN_CHILD_SIGNALED "org.freedesktop.DBus.Error.Spawn.ChildSignaled"
/** While starting a new process, something went wrong. */
#define DBUS_ERROR_SPAWN_FAILED "org.freedesktop.DBus.Error.Spawn.Failed"
/** We failed to setup the environment correctly. */
#define DBUS_ERROR_SPAWN_SETUP_FAILED "org.freedesktop.DBus.Error.Spawn.FailedToSetup"
/** We failed to setup the config parser correctly. */
#define DBUS_ERROR_SPAWN_CONFIG_INVALID "org.freedesktop.DBus.Error.Spawn.ConfigInvalid"
/** Bus name was not valid. */
#define DBUS_ERROR_SPAWN_SERVICE_INVALID "org.freedesktop.DBus.Error.Spawn.ServiceNotValid"
/** Service file not found in system-services directory. */
#define DBUS_ERROR_SPAWN_SERVICE_NOT_FOUND "org.freedesktop.DBus.Error.Spawn.ServiceNotFound"
/** Permissions are incorrect on the setuid helper. */
#define DBUS_ERROR_SPAWN_PERMISSIONS_INVALID "org.freedesktop.DBus.Error.Spawn.PermissionsInvalid"
/** Service file invalid (Name, User or Exec missing). */
#define DBUS_ERROR_SPAWN_FILE_INVALID "org.freedesktop.DBus.Error.Spawn.FileInvalid"
/** Tried to get a UNIX process ID and it wasn't available. */
#define DBUS_ERROR_SPAWN_NO_MEMORY "org.freedesktop.DBus.Error.Spawn.NoMemory"
/** Tried to get a UNIX process ID and it wasn't available. */
#define DBUS_ERROR_UNIX_PROCESS_ID_UNKNOWN "org.freedesktop.DBus.Error.UnixProcessIdUnknown"
/** A type signature is not valid. */
#define DBUS_ERROR_INVALID_SIGNATURE "org.freedesktop.DBus.Error.InvalidSignature"
/** A file contains invalid syntax or is otherwise broken. */
#define DBUS_ERROR_INVALID_FILE_CONTENT "org.freedesktop.DBus.Error.InvalidFileContent"
/** Asked for SELinux security context and it wasn't available. */
#define DBUS_ERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN "org.freedesktop.DBus.Error.SELinuxSecurityContextUnknown"
/** Asked for AppArmor security context and it wasn't available. */
#define DBUS_ERROR_APPARMOR_SECURITY_CONTEXT_UNKNOWN "org.freedesktop.DBus.Error.AppArmorSecurityContextUnknown"
/** Asked for ADT audit data and it wasn't available. */
#define DBUS_ERROR_ADT_AUDIT_DATA_UNKNOWN "org.freedesktop.DBus.Error.AdtAuditDataUnknown"
/** There's already an object with the requested object path. */
#define DBUS_ERROR_OBJECT_PATH_IN_USE "org.freedesktop.DBus.Error.ObjectPathInUse"
/** The message meta data does not match the payload. e.g. expected
number of file descriptors were not sent over the socket this message was received on. */
#define DBUS_ERROR_INCONSISTENT_MESSAGE "org.freedesktop.DBus.Error.InconsistentMessage"
/** The message is not allowed without performing interactive authorization,
* but could have succeeded if an interactive authorization step was
* allowed. */
#define DBUS_ERROR_INTERACTIVE_AUTHORIZATION_REQUIRED "org.freedesktop.DBus.Error.InteractiveAuthorizationRequired"
/* XML introspection format */
/** XML namespace of the introspection format version 1.0 */
#define DBUS_INTROSPECT_1_0_XML_NAMESPACE "http://www.freedesktop.org/standards/dbus"
/** XML public identifier of the introspection format version 1.0 */
#define DBUS_INTROSPECT_1_0_XML_PUBLIC_IDENTIFIER "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
/** XML system identifier of the introspection format version 1.0 */
#define DBUS_INTROSPECT_1_0_XML_SYSTEM_IDENTIFIER "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"
/** XML document type declaration of the introspection format version 1.0 */
#define 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"
/** @} */
#ifdef __cplusplus
#if 0
{ /* avoids confusing emacs indentation */
#endif
}
#endif
#endif /* DBUS_PROTOCOL_H */

View File

@@ -0,0 +1,125 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
#endif
#ifndef DBUS_SERVER_H
#define DBUS_SERVER_H
#include <dbus/dbus-errors.h>
#include <dbus/dbus-macros.h>
#include <dbus/dbus-message.h>
#include <dbus/dbus-connection.h>
#include <dbus/dbus-protocol.h>
DBUS_BEGIN_DECLS
/**
* @addtogroup DBusServer
* @{
*/
typedef struct DBusServer DBusServer;
/** Called when a new connection to the server is available. Must reference and save the new
* connection, or close the new connection. Set with dbus_server_set_new_connection_function().
*/
typedef void (* DBusNewConnectionFunction) (DBusServer *server,
DBusConnection *new_connection,
void *data);
DBUS_EXPORT
DBusServer* dbus_server_listen (const char *address,
DBusError *error);
DBUS_EXPORT
DBusServer* dbus_server_ref (DBusServer *server);
DBUS_EXPORT
void dbus_server_unref (DBusServer *server);
DBUS_EXPORT
void dbus_server_disconnect (DBusServer *server);
DBUS_EXPORT
dbus_bool_t dbus_server_get_is_connected (DBusServer *server);
DBUS_EXPORT
char* dbus_server_get_address (DBusServer *server);
DBUS_EXPORT
char* dbus_server_get_id (DBusServer *server);
DBUS_EXPORT
void dbus_server_set_new_connection_function (DBusServer *server,
DBusNewConnectionFunction function,
void *data,
DBusFreeFunction free_data_function);
DBUS_EXPORT
dbus_bool_t dbus_server_set_watch_functions (DBusServer *server,
DBusAddWatchFunction add_function,
DBusRemoveWatchFunction remove_function,
DBusWatchToggledFunction toggled_function,
void *data,
DBusFreeFunction free_data_function);
DBUS_EXPORT
dbus_bool_t dbus_server_set_timeout_functions (DBusServer *server,
DBusAddTimeoutFunction add_function,
DBusRemoveTimeoutFunction remove_function,
DBusTimeoutToggledFunction toggled_function,
void *data,
DBusFreeFunction free_data_function);
DBUS_EXPORT
dbus_bool_t dbus_server_set_auth_mechanisms (DBusServer *server,
const char **mechanisms);
DBUS_EXPORT
dbus_bool_t dbus_server_allocate_data_slot (dbus_int32_t *slot_p);
DBUS_EXPORT
void dbus_server_free_data_slot (dbus_int32_t *slot_p);
DBUS_EXPORT
dbus_bool_t dbus_server_set_data (DBusServer *server,
int slot,
void *data,
DBusFreeFunction free_data_func);
DBUS_EXPORT
void* dbus_server_get_data (DBusServer *server,
int slot);
/**
* Clear a variable or struct member that contains a #DBusServer.
* If it does not contain #NULL, the server that was previously
* there is unreferenced with dbus_server_unref().
*
* This is very similar to dbus_clear_connection(): see that function
* for more details.
*
* @param pointer_to_server A pointer to a variable or struct member.
* pointer_to_server must not be #NULL, but *pointer_to_server
* may be #NULL.
*/
static inline void
dbus_clear_server (DBusServer **pointer_to_server)
{
_dbus_clear_pointer_impl (DBusServer, pointer_to_server, dbus_server_unref);
}
/** @} */
DBUS_END_DECLS
#endif /* DBUS_SERVER_H */

View File

@@ -0,0 +1,136 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef DBUS_SHARED_H
#define DBUS_SHARED_H
/* Don't include anything in here from anywhere else. It's
* intended for use by any random library.
*/
#ifdef __cplusplus
extern "C" {
#if 0
} /* avoids confusing emacs indentation */
#endif
#endif
/* Normally docs are in .c files, but there isn't a .c file for this. */
/**
* @defgroup DBusShared Shared constants
* @ingroup DBus
*
* @brief Shared header included by both libdbus and C/C++ bindings such as the GLib bindings.
*
* Usually a C/C++ binding such as the GLib or Qt binding won't want to include dbus.h in its
* public headers. However, a few constants and macros may be useful to include; those are
* found here and in dbus-protocol.h
*
* @{
*/
/**
* Well-known bus types. See dbus_bus_get().
*/
typedef enum
{
DBUS_BUS_SESSION, /**< The login session bus */
DBUS_BUS_SYSTEM, /**< The systemwide bus */
DBUS_BUS_STARTER /**< The bus that started us, if any */
} DBusBusType;
/**
* Results that a message handler can return.
*/
typedef enum
{
DBUS_HANDLER_RESULT_HANDLED, /**< Message has had its effect - no need to run more handlers. */
DBUS_HANDLER_RESULT_NOT_YET_HANDLED, /**< Message has not had any effect - see if other handlers want it. */
DBUS_HANDLER_RESULT_NEED_MEMORY /**< Need more memory in order to return #DBUS_HANDLER_RESULT_HANDLED or #DBUS_HANDLER_RESULT_NOT_YET_HANDLED. Please try again later with more memory. */
} DBusHandlerResult;
/* Bus names */
/** The bus name used to talk to the bus itself. */
#define DBUS_SERVICE_DBUS "org.freedesktop.DBus"
/* Paths */
/** The object path used to talk to the bus itself. */
#define DBUS_PATH_DBUS "/org/freedesktop/DBus"
/** The object path used in local/in-process-generated messages. */
#define DBUS_PATH_LOCAL "/org/freedesktop/DBus/Local"
/* Interfaces, these #define don't do much other than
* catch typos at compile time
*/
/** The interface exported by the object with #DBUS_SERVICE_DBUS and #DBUS_PATH_DBUS */
#define DBUS_INTERFACE_DBUS "org.freedesktop.DBus"
/** The monitoring interface exported by the dbus-daemon */
#define DBUS_INTERFACE_MONITORING "org.freedesktop.DBus.Monitoring"
/** The verbose interface exported by the dbus-daemon */
#define DBUS_INTERFACE_VERBOSE "org.freedesktop.DBus.Verbose"
/** The interface supported by introspectable objects */
#define DBUS_INTERFACE_INTROSPECTABLE "org.freedesktop.DBus.Introspectable"
/** The interface supported by objects with properties */
#define DBUS_INTERFACE_PROPERTIES "org.freedesktop.DBus.Properties"
/** The interface supported by most dbus peers */
#define 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).
*/
#define DBUS_INTERFACE_LOCAL "org.freedesktop.DBus.Local"
/* Owner flags */
#define DBUS_NAME_FLAG_ALLOW_REPLACEMENT 0x1 /**< Allow another service to become the primary owner if requested */
#define DBUS_NAME_FLAG_REPLACE_EXISTING 0x2 /**< Request to replace the current primary owner */
#define DBUS_NAME_FLAG_DO_NOT_QUEUE 0x4 /**< If we can not become the primary owner do not place us in the queue */
/* Replies to request for a name */
#define DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER 1 /**< Service has become the primary owner of the requested name */
#define DBUS_REQUEST_NAME_REPLY_IN_QUEUE 2 /**< Service could not become the primary owner and has been placed in the queue */
#define DBUS_REQUEST_NAME_REPLY_EXISTS 3 /**< Service is already in the queue */
#define DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER 4 /**< Service is already the primary owner */
/* Replies to releasing a name */
#define DBUS_RELEASE_NAME_REPLY_RELEASED 1 /**< Service was released from the given name */
#define DBUS_RELEASE_NAME_REPLY_NON_EXISTENT 2 /**< The given name does not exist on the bus */
#define DBUS_RELEASE_NAME_REPLY_NOT_OWNER 3 /**< Service is not an owner of the given name */
/* Replies to service starts */
#define DBUS_START_REPLY_SUCCESS 1 /**< Service was auto started */
#define DBUS_START_REPLY_ALREADY_RUNNING 2 /**< Service was already running */
/** @} */
#ifdef __cplusplus
#if 0
{ /* avoids confusing emacs indentation */
#endif
}
#endif
#endif /* DBUS_SHARED_H */

View File

@@ -0,0 +1,95 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
#endif
#ifndef DBUS_SIGNATURES_H
#define DBUS_SIGNATURES_H
#include <dbus/dbus-macros.h>
#include <dbus/dbus-types.h>
#include <dbus/dbus-errors.h>
DBUS_BEGIN_DECLS
/**
* @addtogroup DBusSignature
* @{
*/
/**
* DBusSignatureIter struct; contains no public fields
*/
typedef struct
{
void *dummy1; /**< Don't use this */
void *dummy2; /**< Don't use this */
dbus_uint32_t dummy8; /**< Don't use this */
int dummy12; /**< Don't use this */
int dummy17; /**< Don't use this */
} DBusSignatureIter;
DBUS_EXPORT
void dbus_signature_iter_init (DBusSignatureIter *iter,
const char *signature);
DBUS_EXPORT
int dbus_signature_iter_get_current_type (const DBusSignatureIter *iter);
DBUS_EXPORT
char * dbus_signature_iter_get_signature (const DBusSignatureIter *iter);
DBUS_EXPORT
int dbus_signature_iter_get_element_type (const DBusSignatureIter *iter);
DBUS_EXPORT
dbus_bool_t dbus_signature_iter_next (DBusSignatureIter *iter);
DBUS_EXPORT
void dbus_signature_iter_recurse (const DBusSignatureIter *iter,
DBusSignatureIter *subiter);
DBUS_EXPORT
dbus_bool_t dbus_signature_validate (const char *signature,
DBusError *error);
DBUS_EXPORT
dbus_bool_t dbus_signature_validate_single (const char *signature,
DBusError *error);
DBUS_EXPORT
dbus_bool_t dbus_type_is_valid (int typecode);
DBUS_EXPORT
dbus_bool_t dbus_type_is_basic (int typecode);
DBUS_EXPORT
dbus_bool_t dbus_type_is_container (int typecode);
DBUS_EXPORT
dbus_bool_t dbus_type_is_fixed (int typecode);
/** @} */
DBUS_END_DECLS
#endif /* DBUS_SIGNATURE_H */

View File

@@ -0,0 +1,58 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* dbus-syntax.h - utility functions for strings with special syntax
*
* Author: Simon McVittie <simon.mcvittie@collabora.co.uk>
* Copyright © 2011 Nokia Corporation
*
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
#endif
#ifndef DBUS_SYNTAX_H
#define DBUS_SYNTAX_H
#include <dbus/dbus-macros.h>
#include <dbus/dbus-types.h>
#include <dbus/dbus-errors.h>
DBUS_BEGIN_DECLS
DBUS_EXPORT
dbus_bool_t dbus_validate_path (const char *path,
DBusError *error);
DBUS_EXPORT
dbus_bool_t dbus_validate_interface (const char *name,
DBusError *error);
DBUS_EXPORT
dbus_bool_t dbus_validate_member (const char *name,
DBusError *error);
DBUS_EXPORT
dbus_bool_t dbus_validate_error_name (const char *name,
DBusError *error);
DBUS_EXPORT
dbus_bool_t dbus_validate_bus_name (const char *name,
DBusError *error);
DBUS_EXPORT
dbus_bool_t dbus_validate_utf8 (const char *alleged_utf8,
DBusError *error);
DBUS_END_DECLS
#endif /* multiple-inclusion guard */

View File

@@ -0,0 +1,189 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
#endif
#ifndef DBUS_THREADS_H
#define DBUS_THREADS_H
#include <dbus/dbus-macros.h>
#include <dbus/dbus-types.h>
DBUS_BEGIN_DECLS
/**
* @addtogroup DBusThreads
* @{
*/
/** An opaque mutex type provided by the #DBusThreadFunctions implementation installed by dbus_threads_init(). */
typedef struct DBusMutex DBusMutex;
/** An opaque condition variable type provided by the #DBusThreadFunctions implementation installed by dbus_threads_init(). */
typedef struct DBusCondVar DBusCondVar;
/** Deprecated, provide DBusRecursiveMutexNewFunction instead. */
typedef DBusMutex* (* DBusMutexNewFunction) (void);
/** Deprecated, provide DBusRecursiveMutexFreeFunction instead. */
typedef void (* DBusMutexFreeFunction) (DBusMutex *mutex);
/** Deprecated, provide DBusRecursiveMutexLockFunction instead. Return value is lock success, but gets ignored in practice. */
typedef dbus_bool_t (* DBusMutexLockFunction) (DBusMutex *mutex);
/** Deprecated, provide DBusRecursiveMutexUnlockFunction instead. Return value is unlock success, but gets ignored in practice. */
typedef dbus_bool_t (* DBusMutexUnlockFunction) (DBusMutex *mutex);
/** Creates a new recursively-lockable mutex, or returns #NULL if not
* enough memory. Can only fail due to lack of memory. Found in
* #DBusThreadFunctions. Do not just use PTHREAD_MUTEX_RECURSIVE for
* this, because it does not save/restore the recursion count when
* waiting on a condition. libdbus requires the Java-style behavior
* where the mutex is fully unlocked to wait on a condition.
*/
typedef DBusMutex* (* DBusRecursiveMutexNewFunction) (void);
/** Frees a recursively-lockable mutex. Found in #DBusThreadFunctions.
*/
typedef void (* DBusRecursiveMutexFreeFunction) (DBusMutex *mutex);
/** Locks a recursively-lockable mutex. Found in #DBusThreadFunctions.
* Can only fail due to lack of memory.
*/
typedef void (* DBusRecursiveMutexLockFunction) (DBusMutex *mutex);
/** Unlocks a recursively-lockable mutex. Found in #DBusThreadFunctions.
* Can only fail due to lack of memory.
*/
typedef void (* DBusRecursiveMutexUnlockFunction) (DBusMutex *mutex);
/** Creates a new condition variable. Found in #DBusThreadFunctions.
* Can only fail (returning #NULL) due to lack of memory.
*/
typedef DBusCondVar* (* DBusCondVarNewFunction) (void);
/** Frees a condition variable. Found in #DBusThreadFunctions.
*/
typedef void (* DBusCondVarFreeFunction) (DBusCondVar *cond);
/** Waits on a condition variable. Found in
* #DBusThreadFunctions. Must work with either a recursive or
* nonrecursive mutex, whichever the thread implementation
* provides. Note that PTHREAD_MUTEX_RECURSIVE does not work with
* condition variables (does not save/restore the recursion count) so
* don't try using simply pthread_cond_wait() and a
* PTHREAD_MUTEX_RECURSIVE to implement this, it won't work right.
*
* Has no error conditions. Must succeed if it returns.
*/
typedef void (* DBusCondVarWaitFunction) (DBusCondVar *cond,
DBusMutex *mutex);
/** Waits on a condition variable with a timeout. Found in
* #DBusThreadFunctions. Returns #TRUE if the wait did not
* time out, and #FALSE if it did.
*
* Has no error conditions. Must succeed if it returns.
*/
typedef dbus_bool_t (* DBusCondVarWaitTimeoutFunction) (DBusCondVar *cond,
DBusMutex *mutex,
int timeout_milliseconds);
/** Wakes one waiting thread on a condition variable. Found in #DBusThreadFunctions.
*
* Has no error conditions. Must succeed if it returns.
*/
typedef void (* DBusCondVarWakeOneFunction) (DBusCondVar *cond);
/** Wakes all waiting threads on a condition variable. Found in #DBusThreadFunctions.
*
* Has no error conditions. Must succeed if it returns.
*/
typedef void (* DBusCondVarWakeAllFunction) (DBusCondVar *cond);
/**
* Flags indicating which functions are present in #DBusThreadFunctions. Used to allow
* the library to detect older callers of dbus_threads_init() if new possible functions
* are added to #DBusThreadFunctions.
*/
typedef enum
{
DBUS_THREAD_FUNCTIONS_MUTEX_NEW_MASK = 1 << 0,
DBUS_THREAD_FUNCTIONS_MUTEX_FREE_MASK = 1 << 1,
DBUS_THREAD_FUNCTIONS_MUTEX_LOCK_MASK = 1 << 2,
DBUS_THREAD_FUNCTIONS_MUTEX_UNLOCK_MASK = 1 << 3,
DBUS_THREAD_FUNCTIONS_CONDVAR_NEW_MASK = 1 << 4,
DBUS_THREAD_FUNCTIONS_CONDVAR_FREE_MASK = 1 << 5,
DBUS_THREAD_FUNCTIONS_CONDVAR_WAIT_MASK = 1 << 6,
DBUS_THREAD_FUNCTIONS_CONDVAR_WAIT_TIMEOUT_MASK = 1 << 7,
DBUS_THREAD_FUNCTIONS_CONDVAR_WAKE_ONE_MASK = 1 << 8,
DBUS_THREAD_FUNCTIONS_CONDVAR_WAKE_ALL_MASK = 1 << 9,
DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_NEW_MASK = 1 << 10,
DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_FREE_MASK = 1 << 11,
DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_LOCK_MASK = 1 << 12,
DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_UNLOCK_MASK = 1 << 13,
DBUS_THREAD_FUNCTIONS_ALL_MASK = (1 << 14) - 1
} DBusThreadFunctionsMask;
/**
* Functions that must be implemented to make the D-Bus library
* thread-aware.
*
* If you supply both recursive and non-recursive mutexes,
* libdbus will use the non-recursive version for condition variables,
* and the recursive version in other contexts.
*
* The condition variable functions have to work with nonrecursive
* mutexes if you provide those, or with recursive mutexes if you
* don't.
*/
typedef struct
{
unsigned int mask; /**< Mask indicating which functions are present. */
DBusMutexNewFunction mutex_new; /**< Function to create a mutex; optional and deprecated. */
DBusMutexFreeFunction mutex_free; /**< Function to free a mutex; optional and deprecated. */
DBusMutexLockFunction mutex_lock; /**< Function to lock a mutex; optional and deprecated. */
DBusMutexUnlockFunction mutex_unlock; /**< Function to unlock a mutex; optional and deprecated. */
DBusCondVarNewFunction condvar_new; /**< Function to create a condition variable */
DBusCondVarFreeFunction condvar_free; /**< Function to free a condition variable */
DBusCondVarWaitFunction condvar_wait; /**< Function to wait on a condition */
DBusCondVarWaitTimeoutFunction condvar_wait_timeout; /**< Function to wait on a condition with a timeout */
DBusCondVarWakeOneFunction condvar_wake_one; /**< Function to wake one thread waiting on the condition */
DBusCondVarWakeAllFunction condvar_wake_all; /**< Function to wake all threads waiting on the condition */
DBusRecursiveMutexNewFunction recursive_mutex_new; /**< Function to create a recursive mutex */
DBusRecursiveMutexFreeFunction recursive_mutex_free; /**< Function to free a recursive mutex */
DBusRecursiveMutexLockFunction recursive_mutex_lock; /**< Function to lock a recursive mutex */
DBusRecursiveMutexUnlockFunction recursive_mutex_unlock; /**< Function to unlock a recursive mutex */
void (* padding1) (void); /**< Reserved for future expansion */
void (* padding2) (void); /**< Reserved for future expansion */
void (* padding3) (void); /**< Reserved for future expansion */
void (* padding4) (void); /**< Reserved for future expansion */
} DBusThreadFunctions;
DBUS_EXPORT
dbus_bool_t dbus_threads_init (const DBusThreadFunctions *functions);
DBUS_EXPORT
dbus_bool_t dbus_threads_init_default (void);
/** @} */
DBUS_END_DECLS
#endif /* DBUS_THREADS_H */

View File

@@ -0,0 +1,156 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
#endif
#ifndef DBUS_TYPES_H
#define DBUS_TYPES_H
#include <stddef.h>
#include <dbus/dbus-arch-deps.h>
typedef dbus_uint32_t dbus_unichar_t;
/* boolean size must be fixed at 4 bytes due to wire protocol! */
typedef dbus_uint32_t dbus_bool_t;
/* 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.
*/
/**
* @typedef dbus_int64_t
*
* A 64-bit signed integer.
*/
/**
* @def DBUS_HAVE_INT64
*
* Always defined.
*
* In older libdbus versions, this would be undefined if there was no
* 64-bit integer type on that platform. libdbus no longer supports
* such platforms.
*/
/**
* @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"
*/
/**
* An 8-byte struct you could use to access int64 without having
* int64 support. Use #dbus_int64_t or #dbus_uint64_t instead.
*/
typedef struct
{
dbus_uint32_t first32; /**< first 32 bits in the 8 bytes (beware endian issues) */
dbus_uint32_t second32; /**< second 32 bits in the 8 bytes (beware endian issues) */
} DBus8ByteStruct;
/**
* A simple value union that lets you access bytes as if they
* were various types; useful when dealing with basic types via
* void pointers and varargs.
*
* This union also contains a pointer member (which can be used
* to retrieve a string from dbus_message_iter_get_basic(), for
* instance), so on future platforms it could conceivably be larger
* than 8 bytes.
*/
typedef union
{
unsigned char bytes[8]; /**< as 8 individual bytes */
dbus_int16_t i16; /**< as int16 */
dbus_uint16_t u16; /**< as int16 */
dbus_int32_t i32; /**< as int32 */
dbus_uint32_t u32; /**< as int32 */
dbus_bool_t bool_val; /**< as boolean */
dbus_int64_t i64; /**< as int64 */
dbus_uint64_t u64; /**< as int64 */
DBus8ByteStruct eight; /**< as 8-byte struct */
double dbl; /**< as double */
unsigned char byt; /**< as byte */
char *str; /**< as char* (string, object path or signature) */
int fd; /**< as Unix file descriptor */
} DBusBasicValue;
/** @} */
#endif /* DBUS_TYPES_H */

104
thirdparty/linuxbsd_headers/dbus/dbus.h vendored Normal file
View File

@@ -0,0 +1,104 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef DBUS_H
#define DBUS_H
#define DBUS_INSIDE_DBUS_H 1
#include <dbus/dbus-arch-deps.h>
#include <dbus/dbus-address.h>
#include <dbus/dbus-bus.h>
#include <dbus/dbus-connection.h>
#include <dbus/dbus-errors.h>
#include <dbus/dbus-macros.h>
#include <dbus/dbus-message.h>
#include <dbus/dbus-misc.h>
#include <dbus/dbus-pending-call.h>
#include <dbus/dbus-protocol.h>
#include <dbus/dbus-server.h>
#include <dbus/dbus-shared.h>
#include <dbus/dbus-signature.h>
#include <dbus/dbus-syntax.h>
#include <dbus/dbus-threads.h>
#include <dbus/dbus-types.h>
#undef DBUS_INSIDE_DBUS_H
/**
* @defgroup DBus D-Bus low-level public API
* @brief The low-level public API of the D-Bus library
*
* libdbus provides a low-level C 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.
*
* @{
*/
/** @} */
/**
* @mainpage
*
* This manual documents the <em>low-level</em> D-Bus C API. <b>If you use
* this low-level API directly, you're signing up for some pain.</b>
*
* Caveats aside, you might get started learning the low-level API by reading
* about @ref DBusConnection and @ref DBusMessage.
*
* There are several other places to look for D-Bus information, such
* as the tutorial and the specification; those can be found at <a
* href="http://www.freedesktop.org/wiki/Software/dbus">the D-Bus
* website</a>. If you're interested in a sysadmin or package
* maintainer's perspective on the dbus-daemon itself and its
* configuration, be sure to check out the man pages as well.
*
* The low-level API documented in this manual deliberately lacks
* most convenience functions - those are left up to higher-level libraries
* based on frameworks such as GLib, Qt, Python, Mono, Java,
* etc. These higher-level libraries (often called "D-Bus bindings")
* have features such as object systems and main loops that allow a
* <em>much</em> more convenient API.
*
* The low-level API also contains plenty of clutter to support
* integration with arbitrary object systems, languages, main loops,
* and so forth. These features add a lot of noise to the API that you
* probably don't care about unless you're coding a binding.
*
* This manual also contains docs for @ref DBusInternals "D-Bus internals",
* so you can use it to get oriented to the D-Bus source code if you're
* interested in patching the code. You should also read the
* file HACKING which comes with the source code if you plan to contribute to
* D-Bus.
*
* As you read the code, you can identify internal D-Bus functions
* because they start with an underscore ('_') character. Also, any
* identifier or macro that lacks a DBus, dbus_, or DBUS_ namepace
* prefix is internal, with a couple of exceptions such as #NULL,
* #TRUE, and #FALSE.
*/
#endif /* DBUS_H */