1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright 2017 6WIND S.A.
3 * Copyright 2017 Mellanox Technologies, Ltd
6 #ifndef _TAP_NETLINK_H_
7 #define _TAP_NETLINK_H_
11 #include <linux/rtnetlink.h>
12 #include <linux/netlink.h>
23 struct nested_tail *nested_tails;
26 #define NLMSG_TAIL(nlh) (void *)((char *)(nlh) + NLMSG_ALIGN((nlh)->nlmsg_len))
28 int tap_nl_init(uint32_t nl_groups);
29 int tap_nl_final(int nlsk_fd);
30 int tap_nl_send(int nlsk_fd, struct nlmsghdr *nh);
31 int tap_nl_recv(int nlsk_fd, int (*callback)(struct nlmsghdr *, void *),
33 int tap_nl_recv_ack(int nlsk_fd);
34 void tap_nlattr_add(struct nlmsghdr *nh, unsigned short type,
35 unsigned int data_len, const void *data);
36 void tap_nlattr_add8(struct nlmsghdr *nh, unsigned short type, uint8_t data);
37 void tap_nlattr_add16(struct nlmsghdr *nh, unsigned short type, uint16_t data);
38 void tap_nlattr_add32(struct nlmsghdr *nh, unsigned short type, uint32_t data);
39 int tap_nlattr_nested_start(struct nlmsg *msg, uint16_t type);
40 void tap_nlattr_nested_finish(struct nlmsg *msg);
42 #endif /* _TAP_NETLINK_H_ */