Line data Source code
1 : /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2 :
3 : /***
4 : This file is part of systemd.
5 :
6 : Copyright 2015 Tom Gundersen
7 :
8 : systemd is free software; you can redistribute it and/or modify it
9 : under the terms of the GNU Lesser General Public License as published by
10 : the Free Software Foundation; either version 2.1 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 : Lesser General Public License for more details.
17 :
18 : You should have received a copy of the GNU Lesser General Public License
19 : along with systemd; If not, see <http://www.gnu.org/licenses/>.
20 : ***/
21 :
22 : #include "bus-util.h"
23 :
24 : #include "networkd.h"
25 :
26 0 : static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_operational_state, link_operstate, LinkOperationalState);
27 :
28 : const sd_bus_vtable manager_vtable[] = {
29 : SD_BUS_VTABLE_START(0),
30 :
31 : SD_BUS_PROPERTY("OperationalState", "s", property_get_operational_state, offsetof(Manager, operational_state), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
32 :
33 : SD_BUS_VTABLE_END
34 : };
35 :
36 0 : int manager_send_changed(Manager *manager, const char *property, ...) {
37 : char **l;
38 :
39 0 : assert(manager);
40 :
41 0 : if (!manager->bus)
42 0 : return 0; /* replace by assert when we have kdbus */
43 :
44 0 : l = strv_from_stdarg_alloca(property);
45 :
46 0 : return sd_bus_emit_properties_changed_strv(
47 : manager->bus,
48 : "/org/freedesktop/network1",
49 : "org.freedesktop.network1.Manager",
50 : l);
51 : }
|