]> git.proxmox.com Git - systemd.git/blob - src/network/networkd-manager-bus.c
Imported Upstream version 229
[systemd.git] / src / network / networkd-manager-bus.c
1 /***
2 This file is part of systemd.
3
4 Copyright 2015 Tom Gundersen
5
6 systemd is free software; you can redistribute it and/or modify it
7 under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation; either version 2.1 of the License, or
9 (at your option) any later version.
10
11 systemd is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with systemd; If not, see <http://www.gnu.org/licenses/>.
18 ***/
19
20 #include "alloc-util.h"
21 #include "bus-util.h"
22 #include "networkd.h"
23
24 static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_operational_state, link_operstate, LinkOperationalState);
25
26 const sd_bus_vtable manager_vtable[] = {
27 SD_BUS_VTABLE_START(0),
28
29 SD_BUS_PROPERTY("OperationalState", "s", property_get_operational_state, offsetof(Manager, operational_state), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
30
31 SD_BUS_VTABLE_END
32 };
33
34 int manager_send_changed(Manager *manager, const char *property, ...) {
35 char **l;
36
37 assert(manager);
38
39 if (!manager->bus)
40 return 0; /* replace by assert when we have kdbus */
41
42 l = strv_from_stdarg_alloca(property);
43
44 return sd_bus_emit_properties_changed_strv(
45 manager->bus,
46 "/org/freedesktop/network1",
47 "org.freedesktop.network1.Manager",
48 l);
49 }