about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDrew Crawford <drew@sealedabstract.com>2015-03-14 22:31:45 -0500
committerValerii Hiora <valerii.hiora@gmail.com>2015-03-19 16:04:01 +0200
commita848ce4d383429c5c43fd78f7021f9c56cd6ed78 (patch)
tree7a14fc94ee5f90710ea63865f62c5c405e3762dc
parentd5408f376f93123a043845b69d467d4b7686ae86 (diff)
downloadrust-a848ce4d383429c5c43fd78f7021f9c56cd6ed78.tar.gz
rust-a848ce4d383429c5c43fd78f7021f9c56cd6ed78.zip
Adding sys/socket.h constants for iOS/Mac, particularly for SO_SOCKET options.
This is probably more broadly applicable than these two platforms
(since it's part of the bsd4.4 standard) but that's outside my problem domain today.
If this goes well, I may submit Linux/64 support in a separate PR.

Reviewers should take a look at http://www.opensource.apple.com/source/xnu/xnu-792.17.14/bsd/sys/socket.h?txt
which defines constants for OSX.  iOS uses the same header.

I release this patch under the MIT license.
-rw-r--r--src/liblibc/lib.rs17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/liblibc/lib.rs b/src/liblibc/lib.rs
index 893781e6220..b74a313b13e 100644
--- a/src/liblibc/lib.rs
+++ b/src/liblibc/lib.rs
@@ -4820,10 +4820,25 @@ pub mod consts {
             pub const TCP_NODELAY: c_int = 0x01;
             pub const TCP_KEEPALIVE: c_int = 0x10;
             pub const SOL_SOCKET: c_int = 0xffff;
+            
+            pub const SO_DEBUG: c_int = 0x01;
+            pub const SO_ACCEPTCONN: c_int = 0x0002;
+            pub const SO_REUSEADDR: c_int = 0x0004;
             pub const SO_KEEPALIVE: c_int = 0x0008;
+            pub const SO_DONTROUTE: c_int = 0x0010;
             pub const SO_BROADCAST: c_int = 0x0020;
-            pub const SO_REUSEADDR: c_int = 0x0004;
+            pub const SO_USELOOPBACK: c_int = 0x0040;
+            pub const SO_LINGER: c_int = 0x0080;
+            pub const SO_OOBINLINE: c_int = 0x0100;
+            pub const SO_REUSEPORT: c_int = 0x0200;
+            pub const SO_SNDBUF: c_int = 0x1001;
+            pub const SO_RCVBUF: c_int = 0x1002;
+            pub const SO_SNDLOWAT: c_int = 0x1003;
+            pub const SO_RCVLOWAT: c_int = 0x1004;
+            pub const SO_SNDTIMEO: c_int = 0x1005;
+            pub const SO_RCVTIMEO: c_int = 0x1006;
             pub const SO_ERROR: c_int = 0x1007;
+            pub const SO_TYPE: c_int = 0x1008;
 
             pub const IFF_LOOPBACK: c_int = 0x8;