xref: /freebsd/sys/compat/linuxkpi/common/include/net/netlink.h (revision 75388b9ca5e566fb7cbd62a37cea1f66d8203fc6)
1*75388b9cSBjoern A. Zeeb /*-
2*75388b9cSBjoern A. Zeeb  * Copyright (c) 2020,2022 Bjoern A. Zeeb
3*75388b9cSBjoern A. Zeeb  *
4*75388b9cSBjoern A. Zeeb  * Redistribution and use in source and binary forms, with or without
5*75388b9cSBjoern A. Zeeb  * modification, are permitted provided that the following conditions
6*75388b9cSBjoern A. Zeeb  * are met:
7*75388b9cSBjoern A. Zeeb  * 1. Redistributions of source code must retain the above copyright
8*75388b9cSBjoern A. Zeeb  *    notice, this list of conditions and the following disclaimer.
9*75388b9cSBjoern A. Zeeb  * 2. Redistributions in binary form must reproduce the above copyright
10*75388b9cSBjoern A. Zeeb  *    notice, this list of conditions and the following disclaimer in the
11*75388b9cSBjoern A. Zeeb  *    documentation and/or other materials provided with the distribution.
12*75388b9cSBjoern A. Zeeb  *
13*75388b9cSBjoern A. Zeeb  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14*75388b9cSBjoern A. Zeeb  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15*75388b9cSBjoern A. Zeeb  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16*75388b9cSBjoern A. Zeeb  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17*75388b9cSBjoern A. Zeeb  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18*75388b9cSBjoern A. Zeeb  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19*75388b9cSBjoern A. Zeeb  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20*75388b9cSBjoern A. Zeeb  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21*75388b9cSBjoern A. Zeeb  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22*75388b9cSBjoern A. Zeeb  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23*75388b9cSBjoern A. Zeeb  * SUCH DAMAGE.
24*75388b9cSBjoern A. Zeeb  */
25*75388b9cSBjoern A. Zeeb 
26*75388b9cSBjoern A. Zeeb #ifndef	_LINUXKPI_NET_NETLINK_H
27*75388b9cSBjoern A. Zeeb #define	_LINUXKPI_NET_NETLINK_H
28*75388b9cSBjoern A. Zeeb 
29*75388b9cSBjoern A. Zeeb #include <netlink/netlink.h>
30*75388b9cSBjoern A. Zeeb 
31*75388b9cSBjoern A. Zeeb struct nla_policy {
32*75388b9cSBjoern A. Zeeb };
33*75388b9cSBjoern A. Zeeb 
34*75388b9cSBjoern A. Zeeb struct netlink_callback {
35*75388b9cSBjoern A. Zeeb 	int		args[8];
36*75388b9cSBjoern A. Zeeb };
37*75388b9cSBjoern A. Zeeb 
38*75388b9cSBjoern A. Zeeb static __inline int
nla_put(struct sk_buff * skb,int attr,size_t len,void * data)39*75388b9cSBjoern A. Zeeb nla_put(struct sk_buff *skb, int attr, size_t len, void *data)
40*75388b9cSBjoern A. Zeeb {
41*75388b9cSBjoern A. Zeeb 
42*75388b9cSBjoern A. Zeeb 	pr_debug("%s: TODO -- now native?\n", __func__);
43*75388b9cSBjoern A. Zeeb 	return (-ENXIO);
44*75388b9cSBjoern A. Zeeb }
45*75388b9cSBjoern A. Zeeb 
46*75388b9cSBjoern A. Zeeb static __inline int
nla_put_u16(struct sk_buff * skb,int attr,uint32_t val)47*75388b9cSBjoern A. Zeeb nla_put_u16(struct sk_buff *skb, int attr, uint32_t val)
48*75388b9cSBjoern A. Zeeb {
49*75388b9cSBjoern A. Zeeb 
50*75388b9cSBjoern A. Zeeb 	return (nla_put(skb, attr, sizeof(uint32_t), &val));
51*75388b9cSBjoern A. Zeeb }
52*75388b9cSBjoern A. Zeeb 
53*75388b9cSBjoern A. Zeeb #endif	/* _LINUXKPI_NET_NETLINK_H */
54