1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3 
4 #include "sd-netlink.h"
5 
6 #include "log-link.h"
7 #include "network-util.h"
8 
9 typedef struct Link Link;
10 typedef struct Manager Manager;
11 
12 struct Link {
13         Manager *manager;
14 
15         int ifindex;
16         char *ifname;
17         unsigned flags;
18 
19         bool required_for_online;
20         LinkOperationalStateRange required_operstate;
21         LinkOperationalState operational_state;
22         AddressFamily required_family;
23         LinkAddressState ipv4_address_state;
24         LinkAddressState ipv6_address_state;
25         char *state;
26 };
27 
28 int link_new(Manager *m, Link **ret, int ifindex, const char *ifname);
29 Link *link_free(Link *l);
30 int link_update_rtnl(Link *l, sd_netlink_message *m);
31 int link_update_monitor(Link *l);
32 
33 DEFINE_TRIVIAL_CLEANUP_FUNC(Link*, link_free);
34