xref: /freebsd/sys/netinet/udp.h (revision 29363fb446372cb3f10bc98664e9767c53fbb457)
1c398230bSWarner Losh /*-
251369649SPedro F. Giffuni  * SPDX-License-Identifier: BSD-3-Clause
351369649SPedro F. Giffuni  *
4df8bae1dSRodney W. Grimes  * Copyright (c) 1982, 1986, 1993
53329b236SRobert Watson  *	The Regents of the University of California.
63329b236SRobert Watson  * All rights reserved.
7df8bae1dSRodney W. Grimes  *
8df8bae1dSRodney W. Grimes  * Redistribution and use in source and binary forms, with or without
9df8bae1dSRodney W. Grimes  * modification, are permitted provided that the following conditions
10df8bae1dSRodney W. Grimes  * are met:
11df8bae1dSRodney W. Grimes  * 1. Redistributions of source code must retain the above copyright
12df8bae1dSRodney W. Grimes  *    notice, this list of conditions and the following disclaimer.
13df8bae1dSRodney W. Grimes  * 2. Redistributions in binary form must reproduce the above copyright
14df8bae1dSRodney W. Grimes  *    notice, this list of conditions and the following disclaimer in the
15df8bae1dSRodney W. Grimes  *    documentation and/or other materials provided with the distribution.
16fbbd9655SWarner Losh  * 3. Neither the name of the University nor the names of its contributors
17df8bae1dSRodney W. Grimes  *    may be used to endorse or promote products derived from this software
18df8bae1dSRodney W. Grimes  *    without specific prior written permission.
19df8bae1dSRodney W. Grimes  *
20df8bae1dSRodney W. Grimes  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21df8bae1dSRodney W. Grimes  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22df8bae1dSRodney W. Grimes  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23df8bae1dSRodney W. Grimes  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24df8bae1dSRodney W. Grimes  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25df8bae1dSRodney W. Grimes  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26df8bae1dSRodney W. Grimes  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27df8bae1dSRodney W. Grimes  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28df8bae1dSRodney W. Grimes  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29df8bae1dSRodney W. Grimes  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30df8bae1dSRodney W. Grimes  * SUCH DAMAGE.
31df8bae1dSRodney W. Grimes  */
32df8bae1dSRodney W. Grimes 
33707f139eSPaul Richards #ifndef _NETINET_UDP_H_
34707f139eSPaul Richards #define	_NETINET_UDP_H_
35707f139eSPaul Richards 
36*aa70361dSKristof Provost #include <sys/types.h>
37*aa70361dSKristof Provost 
38df8bae1dSRodney W. Grimes /*
393329b236SRobert Watson  * UDP protocol header.
40df8bae1dSRodney W. Grimes  * Per RFC 768, September, 1981.
41df8bae1dSRodney W. Grimes  */
42df8bae1dSRodney W. Grimes struct udphdr {
43df8bae1dSRodney W. Grimes 	u_short	uh_sport;		/* source port */
44df8bae1dSRodney W. Grimes 	u_short	uh_dport;		/* destination port */
45430d30d8SBill Fenner 	u_short	uh_ulen;		/* udp length */
46df8bae1dSRodney W. Grimes 	u_short	uh_sum;			/* udp checksum */
47df8bae1dSRodney W. Grimes };
48707f139eSPaul Richards 
497b495c44SVANHULLEBUS Yvan /*
507b495c44SVANHULLEBUS Yvan  * User-settable options (used with setsockopt).
517b495c44SVANHULLEBUS Yvan  */
521d77fa5aSJohn Baldwin #define	UDP_ENCAP			1
537b495c44SVANHULLEBUS Yvan 
540d25fab4SJohn Baldwin /* Start of reserved space for third-party user-settable options. */
550d25fab4SJohn Baldwin #define	UDP_VENDOR			SO_VENDOR
567b495c44SVANHULLEBUS Yvan 
577b495c44SVANHULLEBUS Yvan /*
587b495c44SVANHULLEBUS Yvan  * UDP Encapsulation of IPsec Packets options.
597b495c44SVANHULLEBUS Yvan  */
607b495c44SVANHULLEBUS Yvan /* Encapsulation types. */
617b495c44SVANHULLEBUS Yvan #define	UDP_ENCAP_ESPINUDP_NON_IKE	1 /* draft-ietf-ipsec-nat-t-ike-00/01 */
62fcf59617SAndrey V. Elsukov #define	UDP_ENCAP_ESPINUDP		2 /* RFC3948 */
637b495c44SVANHULLEBUS Yvan 
647b495c44SVANHULLEBUS Yvan /* Default ESP in UDP encapsulation port. */
657b495c44SVANHULLEBUS Yvan #define	UDP_ENCAP_ESPINUDP_PORT		500
667b495c44SVANHULLEBUS Yvan 
677b495c44SVANHULLEBUS Yvan /* Maximum UDP fragment size for ESP over UDP. */
687b495c44SVANHULLEBUS Yvan #define	UDP_ENCAP_ESPINUDP_MAXFRAGLEN	552
697b495c44SVANHULLEBUS Yvan 
70707f139eSPaul Richards #endif
71