xref: /freebsd/sys/netinet/udp.h (revision aa70361d863b7ec20c7e72a6fa7de8fb110715e1)
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  *	@(#)udp.h	8.1 (Berkeley) 6/10/93
33c3aac50fSPeter Wemm  * $FreeBSD$
34df8bae1dSRodney W. Grimes  */
35df8bae1dSRodney W. Grimes 
36707f139eSPaul Richards #ifndef _NETINET_UDP_H_
37707f139eSPaul Richards #define	_NETINET_UDP_H_
38707f139eSPaul Richards 
39*aa70361dSKristof Provost #include <sys/types.h>
40*aa70361dSKristof Provost 
41df8bae1dSRodney W. Grimes /*
423329b236SRobert Watson  * UDP protocol header.
43df8bae1dSRodney W. Grimes  * Per RFC 768, September, 1981.
44df8bae1dSRodney W. Grimes  */
45df8bae1dSRodney W. Grimes struct udphdr {
46df8bae1dSRodney W. Grimes 	u_short	uh_sport;		/* source port */
47df8bae1dSRodney W. Grimes 	u_short	uh_dport;		/* destination port */
48430d30d8SBill Fenner 	u_short	uh_ulen;		/* udp length */
49df8bae1dSRodney W. Grimes 	u_short	uh_sum;			/* udp checksum */
50df8bae1dSRodney W. Grimes };
51707f139eSPaul Richards 
527b495c44SVANHULLEBUS Yvan /*
537b495c44SVANHULLEBUS Yvan  * User-settable options (used with setsockopt).
547b495c44SVANHULLEBUS Yvan  */
551d77fa5aSJohn Baldwin #define	UDP_ENCAP			1
567b495c44SVANHULLEBUS Yvan 
570d25fab4SJohn Baldwin /* Start of reserved space for third-party user-settable options. */
580d25fab4SJohn Baldwin #define	UDP_VENDOR			SO_VENDOR
597b495c44SVANHULLEBUS Yvan 
607b495c44SVANHULLEBUS Yvan /*
617b495c44SVANHULLEBUS Yvan  * UDP Encapsulation of IPsec Packets options.
627b495c44SVANHULLEBUS Yvan  */
637b495c44SVANHULLEBUS Yvan /* Encapsulation types. */
647b495c44SVANHULLEBUS Yvan #define	UDP_ENCAP_ESPINUDP_NON_IKE	1 /* draft-ietf-ipsec-nat-t-ike-00/01 */
65fcf59617SAndrey V. Elsukov #define	UDP_ENCAP_ESPINUDP		2 /* RFC3948 */
667b495c44SVANHULLEBUS Yvan 
677b495c44SVANHULLEBUS Yvan /* Default ESP in UDP encapsulation port. */
687b495c44SVANHULLEBUS Yvan #define	UDP_ENCAP_ESPINUDP_PORT		500
697b495c44SVANHULLEBUS Yvan 
707b495c44SVANHULLEBUS Yvan /* Maximum UDP fragment size for ESP over UDP. */
717b495c44SVANHULLEBUS Yvan #define	UDP_ENCAP_ESPINUDP_MAXFRAGLEN	552
727b495c44SVANHULLEBUS Yvan 
73707f139eSPaul Richards #endif
74