xref: /f-stack/tools/compat/include/netinet/udp.h (revision d4a07e70)
11eaf0ac3Slogwang /*-
2*d4a07e70Sfengbojiang  * SPDX-License-Identifier: BSD-3-Clause
3*d4a07e70Sfengbojiang  *
41eaf0ac3Slogwang  * Copyright (c) 1982, 1986, 1993
51eaf0ac3Slogwang  *	The Regents of the University of California.
61eaf0ac3Slogwang  * All rights reserved.
71eaf0ac3Slogwang  *
81eaf0ac3Slogwang  * Redistribution and use in source and binary forms, with or without
91eaf0ac3Slogwang  * modification, are permitted provided that the following conditions
101eaf0ac3Slogwang  * are met:
111eaf0ac3Slogwang  * 1. Redistributions of source code must retain the above copyright
121eaf0ac3Slogwang  *    notice, this list of conditions and the following disclaimer.
131eaf0ac3Slogwang  * 2. Redistributions in binary form must reproduce the above copyright
141eaf0ac3Slogwang  *    notice, this list of conditions and the following disclaimer in the
151eaf0ac3Slogwang  *    documentation and/or other materials provided with the distribution.
16*d4a07e70Sfengbojiang  * 3. Neither the name of the University nor the names of its contributors
171eaf0ac3Slogwang  *    may be used to endorse or promote products derived from this software
181eaf0ac3Slogwang  *    without specific prior written permission.
191eaf0ac3Slogwang  *
201eaf0ac3Slogwang  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
211eaf0ac3Slogwang  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
221eaf0ac3Slogwang  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
231eaf0ac3Slogwang  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
241eaf0ac3Slogwang  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
251eaf0ac3Slogwang  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
261eaf0ac3Slogwang  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
271eaf0ac3Slogwang  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
281eaf0ac3Slogwang  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
291eaf0ac3Slogwang  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
301eaf0ac3Slogwang  * SUCH DAMAGE.
311eaf0ac3Slogwang  *
321eaf0ac3Slogwang  *	@(#)udp.h	8.1 (Berkeley) 6/10/93
331eaf0ac3Slogwang  * $FreeBSD$
341eaf0ac3Slogwang  */
351eaf0ac3Slogwang 
361eaf0ac3Slogwang #ifndef _NETINET_UDP_H_
371eaf0ac3Slogwang #define	_NETINET_UDP_H_
381eaf0ac3Slogwang 
391eaf0ac3Slogwang /*
401eaf0ac3Slogwang  * UDP protocol header.
411eaf0ac3Slogwang  * Per RFC 768, September, 1981.
421eaf0ac3Slogwang  */
431eaf0ac3Slogwang struct udphdr {
441eaf0ac3Slogwang 	u_short	uh_sport;		/* source port */
451eaf0ac3Slogwang 	u_short	uh_dport;		/* destination port */
461eaf0ac3Slogwang 	u_short	uh_ulen;		/* udp length */
471eaf0ac3Slogwang 	u_short	uh_sum;			/* udp checksum */
481eaf0ac3Slogwang };
491eaf0ac3Slogwang 
501eaf0ac3Slogwang /*
511eaf0ac3Slogwang  * User-settable options (used with setsockopt).
521eaf0ac3Slogwang  */
531eaf0ac3Slogwang #define	UDP_ENCAP			1
541eaf0ac3Slogwang 
551eaf0ac3Slogwang /* Start of reserved space for third-party user-settable options. */
561eaf0ac3Slogwang #define	UDP_VENDOR			SO_VENDOR
571eaf0ac3Slogwang 
581eaf0ac3Slogwang /*
591eaf0ac3Slogwang  * UDP Encapsulation of IPsec Packets options.
601eaf0ac3Slogwang  */
611eaf0ac3Slogwang /* Encapsulation types. */
621eaf0ac3Slogwang #define	UDP_ENCAP_ESPINUDP_NON_IKE	1 /* draft-ietf-ipsec-nat-t-ike-00/01 */
63*d4a07e70Sfengbojiang #define	UDP_ENCAP_ESPINUDP		2 /* RFC3948 */
641eaf0ac3Slogwang 
651eaf0ac3Slogwang /* Default ESP in UDP encapsulation port. */
661eaf0ac3Slogwang #define	UDP_ENCAP_ESPINUDP_PORT		500
671eaf0ac3Slogwang 
681eaf0ac3Slogwang /* Maximum UDP fragment size for ESP over UDP. */
691eaf0ac3Slogwang #define	UDP_ENCAP_ESPINUDP_MAXFRAGLEN	552
701eaf0ac3Slogwang 
711eaf0ac3Slogwang #endif
72