WARNING: this is really WIP, anything could change, please don't use it yet!
Subd is a collection of helper functions that make using dbus-1 more convenient. For me, at least, but I hope others will find it useful as well :) It is by no means a complete wrapper around libdbus, it just provides some functions that make using the low-level API easier. This means that you still have to use the low-level API with subd - as I have stated earlier, this is just a collection of helper functions.
The reason I wrote these functions is that I started porting an application that uses sd-bus. We don't have sd-bus on FreeBSD (and probably never will), but I really liked some aspects of it (especially the way it lets you define object members, and method handlers). I also didn't want to use a complete DBus library like GDBus or QTDBus, so subd was born.
The scope is very limited currently, it basically provides helpers only in areas I needed to work with so far:
- Opening a connection to the bus.
- Reading and sending messages.
- Implementing the Introspectable interface.
- Dispatching handlers for method type members.
- Handling watches.
DBusConnection *subd_open_session(const char *service_name, DBusError *err);
dbus_bool_t subd_emit_signal(DBusConnection *conn, const char *path,
const char *interface, const char *name, DBusError *err, ...);
dbus_bool_t subd_reply_method_return(DBusConnection *conn, DBusMessage *msg,
DBusError *err, ...);
dbus_bool_t subd_message_read(DBusMessageIter *iter, DBusError *err, ...);
struct subd_watches {
struct pollfd *fds;
DBusWatch **watches;
int capacity;
int length;
sem_t mutex;
};
struct subd_watches *subd_init_watches(DBusConnection *conn, struct pollfd *fds,
int size, DBusError *err);
enum subd_member_type {
SUBD_METHOD,
SUBD_SIGNAL,
SUBD_PROPERTY,
SUBD_MEMBERS_END,
};
enum subd_property_access {
SUBD_PROPERTY_READ,
SUBD_PROPERTY_WRITE,
SUBD_PROPERTY_READWRITE,
};
struct subd_member {
enum subd_member_type type;
union {
struct {
const char *name;
dbus_bool_t (*handler)(DBusConnection *, DBusMessage *, void *, DBusError *);
const char *input_signature;
const char *output_signature;
} m;
struct {
const char *name;
const char *signature;
} s;
struct {
const char *name;
const char *signature;
enum subd_property_access access;
} p;
int e;
};
};
dbus_bool_t subd_add_object_vtable(DBusConnection *conn, const char *path,
const char *interface, const struct subd_member *members, void *userdata,
DBusError *err);
For a detailed description of what each function does, please refer to the include/subd.h file.
subd's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.