aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2018-07-10 11:28:11 +0200
committerMicael Karlberg <[email protected]>2018-09-18 14:50:18 +0200
commit9110ba256099e6fa55461fc4ca90da5ec4b2966b (patch)
treec290bff6c491817266f2d62f5914212d8783ee67 /erts/emulator
parent5329726352f8b983e419b6206a85c15cc8836676 (diff)
downloadotp-9110ba256099e6fa55461fc4ca90da5ec4b2966b.tar.gz
otp-9110ba256099e6fa55461fc4ca90da5ec4b2966b.tar.bz2
otp-9110ba256099e6fa55461fc4ca90da5ec4b2966b.zip
[socket-nif] Add support for socket (level socket) option oobinline
Added support for socket level socket option oobinline (both get and set). OTP-14831
Diffstat (limited to 'erts/emulator')
-rw-r--r--erts/emulator/nifs/common/socket_nif.c67
1 files changed, 55 insertions, 12 deletions
diff --git a/erts/emulator/nifs/common/socket_nif.c b/erts/emulator/nifs/common/socket_nif.c
index 4cc953df62..82468c6e8f 100644
--- a/erts/emulator/nifs/common/socket_nif.c
+++ b/erts/emulator/nifs/common/socket_nif.c
@@ -353,13 +353,14 @@ typedef union {
#define SOCKET_OPT_SOCK_DONTROUTE 8
#define SOCKET_OPT_SOCK_KEEPALIVE 10
#define SOCKET_OPT_SOCK_LINGER 11
-#define SOCKET_OPT_SOCK_PEEK_OFF 16
-#define SOCKET_OPT_SOCK_PRIORITY 18
-#define SOCKET_OPT_SOCK_PROTOCOL 19
-#define SOCKET_OPT_SOCK_RCVBUF 20
-#define SOCKET_OPT_SOCK_REUSEADDR 24
-#define SOCKET_OPT_SOCK_SNDBUF 30
-#define SOCKET_OPT_SOCK_TYPE 35
+#define SOCKET_OPT_SOCK_OOBINLINE 13
+#define SOCKET_OPT_SOCK_PEEK_OFF 15
+#define SOCKET_OPT_SOCK_PRIORITY 17
+#define SOCKET_OPT_SOCK_PROTOCOL 18
+#define SOCKET_OPT_SOCK_RCVBUF 19
+#define SOCKET_OPT_SOCK_REUSEADDR 23
+#define SOCKET_OPT_SOCK_SNDBUF 27
+#define SOCKET_OPT_SOCK_TYPE 32
#define SOCKET_OPT_IP_RECVTOS 25
#define SOCKET_OPT_IP_ROUTER_ALERT 28
@@ -808,6 +809,11 @@ static ERL_NIF_TERM nsetopt_lvl_sock_linger(ErlNifEnv* env,
SocketDescriptor* descP,
ERL_NIF_TERM eVal);
#endif
+#if defined(SO_OOBINLINE)
+static ERL_NIF_TERM nsetopt_lvl_sock_oobinline(ErlNifEnv* env,
+ SocketDescriptor* descP,
+ ERL_NIF_TERM eVal);
+#endif
#if defined(SO_PEEK_OFF)
static ERL_NIF_TERM nsetopt_lvl_sock_peek_off(ErlNifEnv* env,
SocketDescriptor* descP,
@@ -970,6 +976,10 @@ static ERL_NIF_TERM ngetopt_lvl_sock_keepalive(ErlNifEnv* env,
static ERL_NIF_TERM ngetopt_lvl_sock_linger(ErlNifEnv* env,
SocketDescriptor* descP);
#endif
+#if defined(SO_OOBINLINE)
+static ERL_NIF_TERM ngetopt_lvl_sock_oobinline(ErlNifEnv* env,
+ SocketDescriptor* descP);
+#endif
#if defined(SO_PEEK_OFF)
static ERL_NIF_TERM ngetopt_lvl_sock_peek_off(ErlNifEnv* env,
SocketDescriptor* descP);
@@ -3739,6 +3749,12 @@ ERL_NIF_TERM nsetopt_lvl_socket(ErlNifEnv* env,
break;
#endif
+#if defined(SO_OOBINLINE)
+ case SOCKET_OPT_SOCK_OOBINLINE:
+ result = nsetopt_lvl_sock_oobinline(env, descP, eVal);
+ break;
+#endif
+
#if defined(SO_PRIORITY)
case SOCKET_OPT_SOCK_PRIORITY:
result = nsetopt_lvl_sock_priority(env, descP, eVal);
@@ -3842,13 +3858,13 @@ ERL_NIF_TERM nsetopt_lvl_sock_linger(ErlNifEnv* env,
#endif
-#if defined(SO_PRIORITY)
+#if defined(SO_OOBINLINE)
static
-ERL_NIF_TERM nsetopt_lvl_sock_priority(ErlNifEnv* env,
- SocketDescriptor* descP,
- ERL_NIF_TERM eVal)
+ERL_NIF_TERM nsetopt_lvl_sock_oobinline(ErlNifEnv* env,
+ SocketDescriptor* descP,
+ ERL_NIF_TERM eVal)
{
- return nsetopt_int_opt(env, descP, SOL_SOCKET, SO_PRIORITY, eVal);
+ return nsetopt_bool_opt(env, descP, SOL_SOCKET, SO_OOBINLINE, eVal);
}
#endif
@@ -3864,6 +3880,17 @@ ERL_NIF_TERM nsetopt_lvl_sock_peek_off(ErlNifEnv* env,
#endif
+#if defined(SO_PRIORITY)
+static
+ERL_NIF_TERM nsetopt_lvl_sock_priority(ErlNifEnv* env,
+ SocketDescriptor* descP,
+ ERL_NIF_TERM eVal)
+{
+ return nsetopt_int_opt(env, descP, SOL_SOCKET, SO_PRIORITY, eVal);
+}
+#endif
+
+
#if defined(SO_RCVBUF)
static
ERL_NIF_TERM nsetopt_lvl_sock_rcvbuf(ErlNifEnv* env,
@@ -4825,6 +4852,12 @@ ERL_NIF_TERM ngetopt_lvl_socket(ErlNifEnv* env,
break;
#endif
+#if defined(SO_OOBINLINE)
+ case SOCKET_OPT_SOCK_OOBINLINE:
+ result = ngetopt_lvl_sock_oobinline(env, descP);
+ break;
+#endif
+
#if defined(SO_PEEK_OFF)
case SOCKET_OPT_SOCK_PEEK_OFF:
result = ngetopt_lvl_sock_peek_off(env, descP);
@@ -5001,6 +5034,16 @@ ERL_NIF_TERM ngetopt_lvl_sock_linger(ErlNifEnv* env,
#endif
+#if defined(SO_OOBINLINE)
+static
+ERL_NIF_TERM ngetopt_lvl_sock_oobinline(ErlNifEnv* env,
+ SocketDescriptor* descP)
+{
+ return ngetopt_bool_opt(env, descP, SOL_SOCKET, SO_OOBINLINE);
+}
+#endif
+
+
#if defined(SO_PEEK_OFF)
static
ERL_NIF_TERM ngetopt_lvl_sock_peek_off(ErlNifEnv* env,