]> git.ipfire.org Git - people/ms/systemd.git/blob - dbus-socket.c
device: allow easy identification of network interfaces without their full sysfs...
[people/ms/systemd.git] / dbus-socket.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 "dbus-unit.h"
23 #include "dbus-socket.h"
24 #include "dbus-execute.h"
25
26 static const char introspection[] =
27 DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE
28 "<node>"
29 BUS_UNIT_INTERFACE
30 BUS_PROPERTIES_INTERFACE
31 " <interface name=\"org.freedesktop.systemd1.Socket\">"
32 " <property name=\"BindIPv6Only\" type=\"b\" access=\"read\"/>"
33 " <property name=\"Backlog\" type=\"u\" access=\"read\"/>"
34 " <property name=\"TimeoutUSec\" type=\"t\" access=\"read\"/>"
35 BUS_EXEC_CONTEXT_INTERFACE
36 " <property name=\"KillMode\" type=\"s\" access=\"read\"/>"
37 " <property name=\"ControlPID\" type=\"u\" access=\"read\"/>"
38 " <property name=\"BindToDevice\" type=\"s\" access=\"read\"/>"
39 " <property name=\"DirectoryMode\" type=\"u\" access=\"read\"/>"
40 " <property name=\"SocketMode\" type=\"u\" access=\"read\"/>"
41 " <property name=\"Accept\" type=\"b\" access=\"read\"/>"
42 " </interface>"
43 BUS_INTROSPECTABLE_INTERFACE
44 "</node>";
45
46 DBusHandlerResult bus_socket_message_handler(Unit *u, DBusMessage *message) {
47 const BusProperty properties[] = {
48 BUS_UNIT_PROPERTIES,
49 { "org.freedesktop.systemd1.Socket", "BindIPv6Only", bus_property_append_bool, "b", &u->socket.bind_ipv6_only },
50 { "org.freedesktop.systemd1.Socket", "Backlog", bus_property_append_unsigned, "u", &u->socket.backlog },
51 { "org.freedesktop.systemd1.Socket", "TimeoutUSec", bus_property_append_usec, "t", &u->socket.timeout_usec },
52 /* ExecCommand */
53 BUS_EXEC_CONTEXT_PROPERTIES("org.freedesktop.systemd1.Socket", u->socket.exec_context),
54 { "org.freedesktop.systemd1.Socket", "KillMode", bus_unit_append_kill_mode, "s", &u->socket.kill_mode },
55 { "org.freedesktop.systemd1.Socket", "ControlPID", bus_property_append_pid, "u", &u->socket.control_pid },
56 { "org.freedesktop.systemd1.Socket", "BindToDevice", bus_property_append_string, "s", u->socket.bind_to_device },
57 { "org.freedesktop.systemd1.Socket", "DirectoryMode", bus_property_append_mode, "u", &u->socket.directory_mode },
58 { "org.freedesktop.systemd1.Socket", "SocketMode", bus_property_append_mode, "u", &u->socket.socket_mode },
59 { "org.freedesktop.systemd1.Socket", "Accept", bus_property_append_bool, "b", &u->socket.accept },
60 { NULL, NULL, NULL, NULL, NULL }
61 };
62
63 return bus_default_message_handler(u->meta.manager, message, introspection, properties);
64 }