xref: /illumos-gate/usr/src/uts/common/netinet/udp.h (revision 3e8b6b84)
1 /*
2  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 /*
7  * Copyright (c) 1982, 1986 Regents of the University of California.
8  * All rights reserved.  The Berkeley software License Agreement
9  * specifies the terms and conditions for redistribution.
10  */
11 
12 /*
13  * Udp protocol header.
14  * Per RFC 768, September, 1981.
15  */
16 
17 #ifndef	_NETINET_UDP_H
18 #define	_NETINET_UDP_H
19 
20 #ifdef	__cplusplus
21 extern "C" {
22 #endif
23 
24 struct udphdr {
25 	in_port_t	uh_sport;		/* source port */
26 	in_port_t	uh_dport;		/* destination port */
27 	int16_t		uh_ulen;		/* udp length */
28 	uint16_t	uh_sum;			/* udp checksum */
29 };
30 
31 /* Option definitions. */
32 #define	UDP_ANONPRIVBIND	0x0100		/* for internal use only */
33 #define	UDP_EXCLBIND		0x0101		/* for internal use only */
34 #define	UDP_RCVHDR		0x0102		/* for internal use only */
35 #define	UDP_NAT_T_ENDPOINT	0x0103		/* for internal use only */
36 #define	UDP_SRCPORT_HASH	0x0104		/* for internal use only */
37 
38 /*
39  * Hash definitions for UDP_SRCPORT_HASH that effectively tell UDP how to go
40  * handle UDP_SRCPORT_HASH.
41  */
42 #define	UDP_HASH_DISABLE	0x0000		/* for internal use only */
43 #define	UDP_HASH_VXLAN		0x0001		/* for internal use only */
44 
45 /*
46  * Following option in UDP_ namespace required to be exposed through
47  * <xti.h> (It also requires exposing options not implemented). The options
48  * with potential for conflicts use #ifndef guards.
49  *
50  */
51 #ifndef UDP_CHECKSUM
52 #define	UDP_CHECKSUM	0x0600
53 #endif
54 
55 #ifdef	__cplusplus
56 }
57 #endif
58 
59 #endif	/* _NETINET_UDP_H */
60