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