Skip to content

Commit

Permalink
add basic (and not very useful) D-Bus support
Browse files Browse the repository at this point in the history
  • Loading branch information
poettering committed Feb 1, 2010
1 parent b9f880f commit ea43098
Show file tree
Hide file tree
Showing 18 changed files with 1,392 additions and 23 deletions.
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CFLAGS=-Wall -Wextra -O0 -g -pipe -D_GNU_SOURCE -fdiagnostics-show-option -Wno-unused-parameter -DUNIT_PATH=\"/tmp/does/not/exist\" `pkg-config --cflags libudev`
LIBS=-lrt -lcap `pkg-config --libs libudev`
CFLAGS=-Wall -Wextra -O0 -g -pipe -D_GNU_SOURCE -fdiagnostics-show-option -Wno-unused-parameter -DUNIT_PATH=\"/tmp/does/not/exist\" `pkg-config --cflags libudev dbus-1`
LIBS=-lrt -lcap `pkg-config --libs libudev dbus-1`

COMMON= \
unit.o \
Expand All @@ -23,7 +23,11 @@ COMMON= \
timer.o \
load-dropin.o \
execute.o \
ratelimit.o
ratelimit.o \
dbus.o \
dbus-manager.o \
dbus-unit.o \
dbus-job.o

all: systemd test-engine test-job-type systemd-logger

Expand Down
4 changes: 2 additions & 2 deletions conf-parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
/* An abstract parser for simple, line based, shallow configuration
* files consisting of variable assignments only. */

typedef int (*config_parser_cb_t)(const char *filename, unsigned line, const char *section, const char *lvalue, const char *rvalue, void *data, void *userdata);
typedef int (*ConfigParserCallback)(const char *filename, unsigned line, const char *section, const char *lvalue, const char *rvalue, void *data, void *userdata);

/* Wraps info for parsing a specific configuration variable */
typedef struct ConfigItem {
const char *lvalue; /* name of the variable */
config_parser_cb_t parse; /* Function that is called to parse the variable's value */
ConfigParserCallback parse; /* Function that is called to parse the variable's value */
void *data; /* Where to store the variable's data */
const char *section;
} ConfigItem;
Expand Down
32 changes: 32 additions & 0 deletions dbus-job.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*-*- Mode: C; c-basic-offset: 8 -*-*/

#include "dbus.h"
#include "log.h"

static const char introspection[] =
DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE
"<node>"
" <interface name=\"org.freedesktop.systemd1.Job\">"
" </interface>"
BUS_PROPERTIES_INTERFACE
BUS_INTROSPECTABLE_INTERFACE
"</node>";

DBusHandlerResult bus_job_message_handler(DBusConnection *connection, DBusMessage *message, void *data) {
Manager *m = data;

assert(connection);
assert(message);
assert(m);

log_debug("Got D-Bus request: %s.%s() on %s",
dbus_message_get_interface(message),
dbus_message_get_member(message),
dbus_message_get_path(message));

return bus_default_message_handler(m, message, introspection, NULL);
}

const DBusObjectPathVTable bus_job_vtable = {
.message_function = bus_job_message_handler
};
Loading

0 comments on commit ea43098

Please sign in to comment.