chiark / gitweb /
unit: add new abstracted maintenance state for units
[elogind.git] / src / dbus-timer.c
1 /*-*- Mode: C; c-basic-offset: 8 -*-*/
2
3 /***
4   This file is part of systemd.
5
6   Copyright 2010 Lennart Poettering
7
8   systemd is free software; you can redistribute it and/or modify it
9   under the terms of the GNU General Public License as published by
10   the Free Software Foundation; either version 2 of the License, or
11   (at your option) any later version.
12
13   systemd is distributed in the hope that it will be useful, but
14   WITHOUT ANY WARRANTY; without even the implied warranty of
15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16   General Public License for more details.
17
18   You should have received a copy of the GNU General Public License
19   along with systemd; If not, see <http://www.gnu.org/licenses/>.
20 ***/
21
22 #include <errno.h>
23
24 #include "dbus-unit.h"
25 #include "dbus-timer.h"
26 #include "dbus-execute.h"
27
28 #define BUS_TIMER_INTERFACE                                             \
29         " <interface name=\"org.freedesktop.systemd1.Timer\">\n"        \
30         "  <property name=\"Unit\" type=\"s\"  access=\"read\"/>\n"     \
31         " </interface>\n"                                               \
32
33 #define INTROSPECTION                                                   \
34         DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE                       \
35         "<node>\n"                                                      \
36         BUS_UNIT_INTERFACE                                              \
37         BUS_TIMER_INTERFACE                                             \
38         BUS_PROPERTIES_INTERFACE                                        \
39         BUS_INTROSPECTABLE_INTERFACE                                    \
40         "</node>\n"
41
42 const char bus_timer_interface[] = BUS_TIMER_INTERFACE;
43
44 DBusHandlerResult bus_timer_message_handler(Unit *u, DBusConnection *c, DBusMessage *message) {
45         const BusProperty properties[] = {
46                 BUS_UNIT_PROPERTIES,
47                 { "org.freedesktop.systemd1.Timer", "Unit", bus_property_append_string, "s", &u->timer.unit->meta.id },
48                 { NULL, NULL, NULL, NULL, NULL }
49         };
50
51         return bus_default_message_handler(u->meta.manager, c, message, INTROSPECTION, properties);
52 }