xref: /freebsd/sys/compat/linuxkpi/common/include/linux/udp.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
1b26fb63fSBjoern A. Zeeb /*-
2b26fb63fSBjoern A. Zeeb  * SPDX-License-Identifier: BSD-2-Clause
3b26fb63fSBjoern A. Zeeb  *
4b26fb63fSBjoern A. Zeeb  * Copyright (c) 2020-2021 The FreeBSD Foundation
5b26fb63fSBjoern A. Zeeb  *
6b26fb63fSBjoern A. Zeeb  * This software was developed by Björn Zeeb under sponsorship from
7b26fb63fSBjoern A. Zeeb  * the FreeBSD Foundation.
8b26fb63fSBjoern A. Zeeb  *
9b26fb63fSBjoern A. Zeeb  * Redistribution and use in source and binary forms, with or without
10b26fb63fSBjoern A. Zeeb  * modification, are permitted provided that the following conditions
11b26fb63fSBjoern A. Zeeb  * are met:
12b26fb63fSBjoern A. Zeeb  * 1. Redistributions of source code must retain the above copyright
13b26fb63fSBjoern A. Zeeb  *    notice, this list of conditions and the following disclaimer.
14b26fb63fSBjoern A. Zeeb  * 2. Redistributions in binary form must reproduce the above copyright
15b26fb63fSBjoern A. Zeeb  *    notice, this list of conditions and the following disclaimer in the
16b26fb63fSBjoern A. Zeeb  *    documentation and/or other materials provided with the distribution.
17b26fb63fSBjoern A. Zeeb  *
18b26fb63fSBjoern A. Zeeb  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19b26fb63fSBjoern A. Zeeb  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20b26fb63fSBjoern A. Zeeb  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21b26fb63fSBjoern A. Zeeb  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22b26fb63fSBjoern A. Zeeb  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23b26fb63fSBjoern A. Zeeb  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24b26fb63fSBjoern A. Zeeb  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25b26fb63fSBjoern A. Zeeb  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26b26fb63fSBjoern A. Zeeb  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27b26fb63fSBjoern A. Zeeb  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28b26fb63fSBjoern A. Zeeb  * SUCH DAMAGE.
29b26fb63fSBjoern A. Zeeb  */
30b26fb63fSBjoern A. Zeeb 
31*307f78f3SVladimir Kondratyev #ifndef	_LINUXKPI_LINUX_UDP_H
32*307f78f3SVladimir Kondratyev #define	_LINUXKPI_LINUX_UDP_H
33b26fb63fSBjoern A. Zeeb 
34b26fb63fSBjoern A. Zeeb #include <sys/types.h>
35b26fb63fSBjoern A. Zeeb #include <linux/skbuff.h>
36b26fb63fSBjoern A. Zeeb 
37b26fb63fSBjoern A. Zeeb /* (u) unconfirmed structure field names. */
38b26fb63fSBjoern A. Zeeb struct udphdr {
39b26fb63fSBjoern A. Zeeb 	uint16_t	source;		/* (u) */
40b26fb63fSBjoern A. Zeeb 	uint16_t	dest;
41b26fb63fSBjoern A. Zeeb 	uint16_t	len;		/* (u) */
42b26fb63fSBjoern A. Zeeb 	uint16_t	check;
43b26fb63fSBjoern A. Zeeb };
44b26fb63fSBjoern A. Zeeb 
45b26fb63fSBjoern A. Zeeb static __inline struct udphdr *
udp_hdr(struct sk_buff * skb)46b26fb63fSBjoern A. Zeeb udp_hdr(struct sk_buff *skb)
47b26fb63fSBjoern A. Zeeb {
48b26fb63fSBjoern A. Zeeb 
49b26fb63fSBjoern A. Zeeb 	return (struct udphdr *)skb_transport_header(skb);
50b26fb63fSBjoern A. Zeeb }
51b26fb63fSBjoern A. Zeeb 
52*307f78f3SVladimir Kondratyev #endif	/* _LINUXKPI_LINUX_UDP_H */
53