]>
Commit | Line | Data |
---|---|---|
53e1b683 | 1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
a2cdd907 LP |
2 | #pragma once |
3 | ||
d8921c6d TG |
4 | /*** |
5 | This file is part of systemd. | |
6 | ||
7 | Copyright (C) 2013 Tom Gundersen <teg@jklm.no> | |
8 | ||
9 | systemd is free software; you can redistribute it and/or modify it | |
10 | under the terms of the GNU Lesser General Public License as published by | |
11 | the Free Software Foundation; either version 2.1 of the License, or | |
12 | (at your option) any later version. | |
13 | ||
14 | systemd is distributed in the hope that it will be useful, but | |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 | Lesser General Public License for more details. | |
18 | ||
19 | You should have received a copy of the GNU Lesser General Public License | |
20 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
21 | ***/ | |
22 | ||
07630cea | 23 | #include "sd-netlink.h" |
d8921c6d | 24 | |
a33dece5 | 25 | #include "util.h" |
d8921c6d | 26 | |
1c4baffc TG |
27 | int rtnl_message_new_synthetic_error(int error, uint32_t serial, sd_netlink_message **ret); |
28 | uint32_t rtnl_message_get_serial(sd_netlink_message *m); | |
29 | void rtnl_message_seal(sd_netlink_message *m); | |
3815f36f | 30 | |
cb4d8b2d SS |
31 | static inline bool rtnl_message_type_is_neigh(uint16_t type) { |
32 | return IN_SET(type, RTM_NEWNEIGH, RTM_GETNEIGH, RTM_DELNEIGH); | |
33 | } | |
34 | ||
35 | static inline bool rtnl_message_type_is_route(uint16_t type) { | |
36 | return IN_SET(type, RTM_NEWROUTE, RTM_GETROUTE, RTM_DELROUTE); | |
37 | } | |
38 | ||
39 | static inline bool rtnl_message_type_is_link(uint16_t type) { | |
40 | return IN_SET(type, RTM_NEWLINK, RTM_SETLINK, RTM_GETLINK, RTM_DELLINK); | |
41 | } | |
42 | ||
43 | static inline bool rtnl_message_type_is_addr(uint16_t type) { | |
44 | return IN_SET(type, RTM_NEWADDR, RTM_GETADDR, RTM_DELADDR); | |
45 | } | |
3815f36f | 46 | |
30746d60 SS |
47 | static inline bool rtnl_message_type_is_addrlabel(uint16_t type) { |
48 | return IN_SET(type, RTM_NEWADDRLABEL, RTM_DELADDRLABEL, RTM_GETADDRLABEL); | |
49 | } | |
50 | ||
bce67bbe SS |
51 | static inline bool rtnl_message_type_is_routing_policy_rule(uint16_t type) { |
52 | return IN_SET(type, RTM_NEWRULE, RTM_DELRULE, RTM_GETRULE); | |
53 | } | |
54 | ||
1c4baffc TG |
55 | int rtnl_set_link_name(sd_netlink **rtnl, int ifindex, const char *name); |
56 | int rtnl_set_link_properties(sd_netlink **rtnl, int ifindex, const char *alias, const struct ether_addr *mac, unsigned mtu); | |
a33dece5 | 57 | |
ee8c4568 LP |
58 | int rtnl_log_parse_error(int r); |
59 | int rtnl_log_create_error(int r); |