/usr/include/cjs-1.0/cjs-dbus/dbus.h is in libcjs-dev 2.2.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | /* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
/* Copyright 2008 litl, LLC.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#ifndef __GJS_UTIL_DBUS_H__
#define __GJS_UTIL_DBUS_H__
#include <glib-object.h>
#include <dbus/dbus.h>
G_BEGIN_DECLS
/* Convenience macro */
#define GJS_DBUS_NAME_FROM_TYPE(type) ((type) == DBUS_BUS_SESSION ? "session" : "system")
/* Error names */
#define GJS_DBUS_ERROR_STREAM_RECEIVER_CLOSED "com.litl.Error.Stream.ReceiverClosed"
/*
* Monitor whether we are connected / not-connected to the bus
*/
typedef void (* GjsDBusConnectionOpenedFunc) (DBusConnection *connection,
void *data);
typedef void (* GjsDBusConnectionClosedFunc) (DBusConnection *connection,
void *data);
typedef struct {
DBusBusType which_bus;
GjsDBusConnectionOpenedFunc opened;
GjsDBusConnectionClosedFunc closed;
} GjsDBusConnectFuncs;
void gjs_dbus_add_connect_funcs (const GjsDBusConnectFuncs *funcs,
void *data);
void gjs_dbus_remove_connect_funcs (const GjsDBusConnectFuncs *funcs,
void *data);
void gjs_dbus_add_connect_funcs_sync_notify (const GjsDBusConnectFuncs *funcs,
void *data);
void gjs_dbus_add_bus_weakref (DBusBusType bus_type,
DBusConnection **connection_p);
void gjs_dbus_remove_bus_weakref (DBusBusType bus_type,
DBusConnection **connection_p);
DBusConnection* gjs_dbus_get_weak_ref (DBusBusType which_bus);
void gjs_dbus_try_connecting_now (DBusBusType which_bus);
/*
* Own a bus name
*
*/
typedef enum {
GJS_DBUS_NAME_SINGLE_INSTANCE,
GJS_DBUS_NAME_MANY_INSTANCES
} GjsDBusNameType;
typedef void (* GjsDBusNameAcquiredFunc) (DBusConnection *connection,
const char *name,
void *data);
typedef void (* GjsDBusNameLostFunc) (DBusConnection *connection,
const char *name,
void *data);
typedef struct {
char *name;
GjsDBusNameType type;
GjsDBusNameAcquiredFunc acquired;
GjsDBusNameLostFunc lost;
} GjsDBusNameOwnerFuncs;
guint gjs_dbus_acquire_name (DBusBusType bus_type,
const GjsDBusNameOwnerFuncs *funcs,
void *data);
void gjs_dbus_release_name (DBusBusType bus_type,
const GjsDBusNameOwnerFuncs *funcs,
void *data);
void gjs_dbus_release_name_by_id (DBusBusType bus_type,
guint id);
/*
* Keep track of someone else's bus name
*
*/
typedef enum {
GJS_DBUS_NAME_START_IF_NOT_FOUND = 0x1
} GjsDBusWatchNameFlags;
typedef void (* GjsDBusNameAppearedFunc) (DBusConnection *connection,
const char *name,
const char *new_owner_unique_name,
void *data);
typedef void (* GjsDBusNameVanishedFunc) (DBusConnection *connection,
const char *name,
const char *old_owner_unique_name,
void *data);
typedef struct {
GjsDBusNameAppearedFunc appeared;
GjsDBusNameVanishedFunc vanished;
} GjsDBusWatchNameFuncs;
void gjs_dbus_watch_name (DBusBusType bus_type,
const char *name,
GjsDBusWatchNameFlags flags,
const GjsDBusWatchNameFuncs *funcs,
void *data);
void gjs_dbus_unwatch_name (DBusBusType bus_type,
const char *name,
const GjsDBusWatchNameFuncs *funcs,
void *data);
const char* gjs_dbus_get_watched_name_owner (DBusBusType bus_type,
const char *name);
typedef void (* GjsDBusSignalHandler) (DBusConnection *connection,
DBusMessage *message,
void *data);
int gjs_dbus_watch_signal (DBusBusType bus_type,
const char *sender,
const char *path,
const char *iface,
const char *name,
GjsDBusSignalHandler handler,
void *data,
GDestroyNotify data_dnotify);
void gjs_dbus_unwatch_signal (DBusBusType bus_type,
const char *sender,
const char *path,
const char *iface,
const char *name,
GjsDBusSignalHandler handler,
void *data);
void gjs_dbus_unwatch_signal_by_id (DBusBusType bus_type,
int id);
/* A "json method" is a D-Bus method with signature
* DICT jsonMethodName(DICT)
* with the idea that it both takes and returns
* a JavaScript-style dictionary. This makes
* our JavaScript-to-dbus bindings really simple,
* and avoids a lot of futzing with dbus IDL.
*
* Of course it's completely annoying for someone
* using D-Bus in a "normal" way but the idea is just
* to use this to communicate within our own app
* that happens to consist of multiple processes
* and have bits written in JS.
*/
typedef void (* GjsDBusJsonSyncMethodFunc) (DBusConnection *connection,
DBusMessage *message,
DBusMessageIter *in_iter,
DBusMessageIter *out_iter,
void *data,
DBusError *error);
typedef void (* GjsDBusJsonAsyncMethodFunc) (DBusConnection *connection,
DBusMessage *message,
DBusMessageIter *in_iter,
void *data);
typedef struct {
const char *name;
/* one of these two but not both should be non-NULL */
GjsDBusJsonSyncMethodFunc sync_func;
GjsDBusJsonAsyncMethodFunc async_func;
} GjsDBusJsonMethod;
void gjs_dbus_register_json (DBusConnection *connection,
const char *iface_name,
const GjsDBusJsonMethod *methods,
int n_methods);
void gjs_dbus_unregister_json (DBusConnection *connection,
const char *iface_name);
void gjs_dbus_register_g_object (DBusConnection *connection,
const char *path,
GObject *gobj,
const char *iface_name);
void gjs_dbus_unregister_g_object (DBusConnection *connection,
const char *path);
void gjs_dbus_append_json_entry (DBusMessageIter *dict_iter,
const char *key,
int dbus_type,
void *basic_value_p);
void gjs_dbus_append_json_entry_STRING (DBusMessageIter *dict_iter,
const char *key,
const char *value);
void gjs_dbus_append_json_entry_INT32 (DBusMessageIter *dict_iter,
const char *key,
dbus_int32_t value);
void gjs_dbus_append_json_entry_DOUBLE (DBusMessageIter *dict_iter,
const char *key,
double value);
void gjs_dbus_append_json_entry_BOOLEAN (DBusMessageIter *dict_iter,
const char *key,
dbus_bool_t value);
void gjs_dbus_append_json_entry_EMPTY_ARRAY (DBusMessageIter *dict_iter,
const char *key);
void gjs_dbus_append_json_entry_STRING_ARRAY (DBusMessageIter *dict_iter,
const char *key,
const char **value);
gboolean gjs_dbus_message_iter_get_gsize (DBusMessageIter *iter,
gsize *value_p);
gboolean gjs_dbus_message_iter_get_gssize (DBusMessageIter *iter,
gssize *value_p);
void gjs_dbus_start_service(DBusConnection *connection,
const char *name);
G_END_DECLS
#endif /* __GJS_UTIL_DBUS_H__ */
|