[Midnightbsd-cvs] src [8869] trunk/sys: use decimal values for UDP, TCP anzd UNIX domain sockets.

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Mon Sep 26 09:17:42 EDT 2016


Revision: 8869
          http://svnweb.midnightbsd.org/src/?rev=8869
Author:   laffer1
Date:     2016-09-26 09:17:42 -0400 (Mon, 26 Sep 2016)
Log Message:
-----------
use decimal values for UDP, TCP anzd UNIX domain sockets.

Modified Paths:
--------------
    trunk/sys/netinet/tcp.h
    trunk/sys/netinet/udp.h
    trunk/sys/sys/socket.h
    trunk/sys/sys/un.h

Modified: trunk/sys/netinet/tcp.h
===================================================================
--- trunk/sys/netinet/tcp.h	2016-09-26 13:15:31 UTC (rev 8868)
+++ trunk/sys/netinet/tcp.h	2016-09-26 13:17:42 UTC (rev 8869)
@@ -149,21 +149,26 @@
 #endif /* __BSD_VISIBLE */
 
 /*
- * User-settable options (used with setsockopt).
+ * User-settable options (used with setsockopt).  These are discrete
+ * values and are not masked together.  Some values appear to be
+ * bitmasks for historical reasons.
  */
-#define	TCP_NODELAY	0x01	/* don't delay send to coalesce packets */
+#define	TCP_NODELAY	1	/* don't delay send to coalesce packets */
 #if __BSD_VISIBLE
-#define	TCP_MAXSEG	0x02	/* set maximum segment size */
-#define TCP_NOPUSH	0x04	/* don't push last block of write */
-#define TCP_NOOPT	0x08	/* don't use TCP options */
-#define TCP_MD5SIG	0x10	/* use MD5 digests (RFC2385) */
-#define	TCP_INFO	0x20	/* retrieve tcp_info structure */
-#define	TCP_CONGESTION	0x40	/* get/set congestion control algorithm */
-#define	TCP_KEEPINIT	0x80	/* N, time to establish connection */
-#define	TCP_KEEPIDLE	0x100	/* L,N,X start keeplives after this period */
-#define	TCP_KEEPINTVL	0x200	/* L,N interval between keepalives */
-#define	TCP_KEEPCNT	0x400	/* L,N number of keepalives before close */
+#define	TCP_MAXSEG	2	/* set maximum segment size */
+#define TCP_NOPUSH	4	/* don't push last block of write */
+#define TCP_NOOPT	8	/* don't use TCP options */
+#define TCP_MD5SIG	16	/* use MD5 digests (RFC2385) */
+#define	TCP_INFO	32	/* retrieve tcp_info structure */
+#define	TCP_CONGESTION	64	/* get/set congestion control algorithm */
+#define	TCP_KEEPINIT	128	/* N, time to establish connection */
+#define	TCP_KEEPIDLE	256	/* L,N,X start keeplives after this period */
+#define	TCP_KEEPINTVL	512	/* L,N interval between keepalives */
+#define	TCP_KEEPCNT	1024	/* L,N number of keepalives before close */
 
+/* Start of reserved space for third-party user-settable options. */
+#define	TCP_VENDOR	SO_VENDOR
+
 #define	TCP_CA_NAME_MAX	16	/* max congestion control name length */
 
 #define	TCPI_OPT_TIMESTAMPS	0x01

Modified: trunk/sys/netinet/udp.h
===================================================================
--- trunk/sys/netinet/udp.h	2016-09-26 13:15:31 UTC (rev 8868)
+++ trunk/sys/netinet/udp.h	2016-09-26 13:17:42 UTC (rev 8869)
@@ -48,8 +48,10 @@
 /* 
  * User-settable options (used with setsockopt).
  */
-#define	UDP_ENCAP			0x01
+#define	UDP_ENCAP			1
 
+/* Start of reserved space for third-party user-settable options. */
+#define	UDP_VENDOR			SO_VENDOR
 
 /*
  * UDP Encapsulation of IPsec Packets options.

Modified: trunk/sys/sys/socket.h
===================================================================
--- trunk/sys/sys/socket.h	2016-09-26 13:15:31 UTC (rev 8868)
+++ trunk/sys/sys/socket.h	2016-09-26 13:17:42 UTC (rev 8869)
@@ -152,6 +152,15 @@
 #endif
 
 /*
+ * Space reserved for new socket options added by third-party vendors.
+ * This range applies to all socket option levels.  New socket options
+ * in FreeBSD should always use an option value less than SO_VENDOR.
+ */
+#if __BSD_VISIBLE
+#define	SO_VENDOR	0x80000000
+#endif
+
+/*
  * Structure used for manipulating linger option.
  */
 struct linger {

Modified: trunk/sys/sys/un.h
===================================================================
--- trunk/sys/sys/un.h	2016-09-26 13:15:31 UTC (rev 8868)
+++ trunk/sys/sys/un.h	2016-09-26 13:17:42 UTC (rev 8869)
@@ -1,4 +1,4 @@
-/* $MidnightBSD: src/sys/sys/un.h,v 1.2 2008/12/03 00:11:23 laffer1 Exp $ */
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1982, 1986, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -54,10 +54,13 @@
 #if __BSD_VISIBLE
 
 /* Socket options. */
-#define	LOCAL_PEERCRED		0x001	/* retrieve peer credentials */
-#define	LOCAL_CREDS		0x002	/* pass credentials to receiver */
-#define	LOCAL_CONNWAIT		0x004	/* connects block until accepted */
+#define	LOCAL_PEERCRED		1	/* retrieve peer credentials */
+#define	LOCAL_CREDS		2	/* pass credentials to receiver */
+#define	LOCAL_CONNWAIT		4	/* connects block until accepted */
 
+/* Start of reserved space for third-party socket options. */
+#define	LOCAL_VENDOR		SO_VENDOR
+
 #ifndef _KERNEL
 
 /* actual length of an initialized sockaddr_un */



More information about the Midnightbsd-cvs mailing list