]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/libsystemd/sd-netlink/netlink-util.h
pkgconfig: define variables relative to ${prefix}/${rootprefix}/${sysconfdir}
[thirdparty/systemd.git] / src / libsystemd / sd-netlink / netlink-util.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 #include "sd-netlink.h"
5
6 #include "util.h"
7
8 int rtnl_message_new_synthetic_error(sd_netlink *rtnl, int error, uint32_t serial, sd_netlink_message **ret);
9 uint32_t rtnl_message_get_serial(sd_netlink_message *m);
10 void rtnl_message_seal(sd_netlink_message *m);
11
12 static inline bool rtnl_message_type_is_neigh(uint16_t type) {
13 return IN_SET(type, RTM_NEWNEIGH, RTM_GETNEIGH, RTM_DELNEIGH);
14 }
15
16 static inline bool rtnl_message_type_is_route(uint16_t type) {
17 return IN_SET(type, RTM_NEWROUTE, RTM_GETROUTE, RTM_DELROUTE);
18 }
19
20 static inline bool rtnl_message_type_is_link(uint16_t type) {
21 return IN_SET(type, RTM_NEWLINK, RTM_SETLINK, RTM_GETLINK, RTM_DELLINK);
22 }
23
24 static inline bool rtnl_message_type_is_addr(uint16_t type) {
25 return IN_SET(type, RTM_NEWADDR, RTM_GETADDR, RTM_DELADDR);
26 }
27
28 static inline bool rtnl_message_type_is_addrlabel(uint16_t type) {
29 return IN_SET(type, RTM_NEWADDRLABEL, RTM_DELADDRLABEL, RTM_GETADDRLABEL);
30 }
31
32 static inline bool rtnl_message_type_is_routing_policy_rule(uint16_t type) {
33 return IN_SET(type, RTM_NEWRULE, RTM_DELRULE, RTM_GETRULE);
34 }
35
36 int rtnl_set_link_name(sd_netlink **rtnl, int ifindex, const char *name);
37 int rtnl_set_link_properties(sd_netlink **rtnl, int ifindex, const char *alias, const struct ether_addr *mac, uint32_t mtu);
38
39 int rtnl_log_parse_error(int r);
40 int rtnl_log_create_error(int r);