xref: /illumos-gate/usr/src/uts/common/netinet/udp.h (revision 3e8b6b84)
17c478bd9Sstevel@tonic-gate /*
2437220cdSdanmcd  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
37c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
47c478bd9Sstevel@tonic-gate  */
57c478bd9Sstevel@tonic-gate 
67c478bd9Sstevel@tonic-gate /*
77c478bd9Sstevel@tonic-gate  * Copyright (c) 1982, 1986 Regents of the University of California.
87c478bd9Sstevel@tonic-gate  * All rights reserved.  The Berkeley software License Agreement
97c478bd9Sstevel@tonic-gate  * specifies the terms and conditions for redistribution.
107c478bd9Sstevel@tonic-gate  */
117c478bd9Sstevel@tonic-gate 
127c478bd9Sstevel@tonic-gate /*
137c478bd9Sstevel@tonic-gate  * Udp protocol header.
147c478bd9Sstevel@tonic-gate  * Per RFC 768, September, 1981.
157c478bd9Sstevel@tonic-gate  */
167c478bd9Sstevel@tonic-gate 
177c478bd9Sstevel@tonic-gate #ifndef	_NETINET_UDP_H
187c478bd9Sstevel@tonic-gate #define	_NETINET_UDP_H
197c478bd9Sstevel@tonic-gate 
207c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
217c478bd9Sstevel@tonic-gate extern "C" {
227c478bd9Sstevel@tonic-gate #endif
237c478bd9Sstevel@tonic-gate 
247c478bd9Sstevel@tonic-gate struct udphdr {
257c478bd9Sstevel@tonic-gate 	in_port_t	uh_sport;		/* source port */
267c478bd9Sstevel@tonic-gate 	in_port_t	uh_dport;		/* destination port */
277c478bd9Sstevel@tonic-gate 	int16_t		uh_ulen;		/* udp length */
287c478bd9Sstevel@tonic-gate 	uint16_t	uh_sum;			/* udp checksum */
297c478bd9Sstevel@tonic-gate };
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate /* Option definitions. */
327c478bd9Sstevel@tonic-gate #define	UDP_ANONPRIVBIND	0x0100		/* for internal use only */
337c478bd9Sstevel@tonic-gate #define	UDP_EXCLBIND		0x0101		/* for internal use only */
347c478bd9Sstevel@tonic-gate #define	UDP_RCVHDR		0x0102		/* for internal use only */
35437220cdSdanmcd #define	UDP_NAT_T_ENDPOINT	0x0103		/* for internal use only */
36*3e8b6b84SRobert Mustacchi #define	UDP_SRCPORT_HASH	0x0104		/* for internal use only */
37*3e8b6b84SRobert Mustacchi 
38*3e8b6b84SRobert Mustacchi /*
39*3e8b6b84SRobert Mustacchi  * Hash definitions for UDP_SRCPORT_HASH that effectively tell UDP how to go
40*3e8b6b84SRobert Mustacchi  * handle UDP_SRCPORT_HASH.
41*3e8b6b84SRobert Mustacchi  */
42*3e8b6b84SRobert Mustacchi #define	UDP_HASH_DISABLE	0x0000		/* for internal use only */
43*3e8b6b84SRobert Mustacchi #define	UDP_HASH_VXLAN		0x0001		/* for internal use only */
44*3e8b6b84SRobert Mustacchi 
457c478bd9Sstevel@tonic-gate /*
467c478bd9Sstevel@tonic-gate  * Following option in UDP_ namespace required to be exposed through
477c478bd9Sstevel@tonic-gate  * <xti.h> (It also requires exposing options not implemented). The options
487c478bd9Sstevel@tonic-gate  * with potential for conflicts use #ifndef guards.
497c478bd9Sstevel@tonic-gate  *
507c478bd9Sstevel@tonic-gate  */
517c478bd9Sstevel@tonic-gate #ifndef UDP_CHECKSUM
527c478bd9Sstevel@tonic-gate #define	UDP_CHECKSUM	0x0600
537c478bd9Sstevel@tonic-gate #endif
547c478bd9Sstevel@tonic-gate 
557c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
567c478bd9Sstevel@tonic-gate }
577c478bd9Sstevel@tonic-gate #endif
587c478bd9Sstevel@tonic-gate 
597c478bd9Sstevel@tonic-gate #endif	/* _NETINET_UDP_H */
60