aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/nifs/common/socket_nif.c
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2018-07-09 18:41:07 +0200
committerMicael Karlberg <[email protected]>2018-09-18 14:50:18 +0200
commit5329726352f8b983e419b6206a85c15cc8836676 (patch)
treeee9e0899c9278dce981aa247715259a660751528 /erts/emulator/nifs/common/socket_nif.c
parent6031321a78e3df5304f555ba356a4482469e7d56 (diff)
downloadotp-5329726352f8b983e419b6206a85c15cc8836676.tar.gz
otp-5329726352f8b983e419b6206a85c15cc8836676.tar.bz2
otp-5329726352f8b983e419b6206a85c15cc8836676.zip
[socket-nif] Add support for socket (level socket) option peek_off
The socket option (level socket) peek_off is now supported. OTP-14831
Diffstat (limited to 'erts/emulator/nifs/common/socket_nif.c')
-rw-r--r--erts/emulator/nifs/common/socket_nif.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/erts/emulator/nifs/common/socket_nif.c b/erts/emulator/nifs/common/socket_nif.c
index c2a8170227..4cc953df62 100644
--- a/erts/emulator/nifs/common/socket_nif.c
+++ b/erts/emulator/nifs/common/socket_nif.c
@@ -353,6 +353,7 @@ 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
@@ -807,6 +808,11 @@ static ERL_NIF_TERM nsetopt_lvl_sock_linger(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,
+ ERL_NIF_TERM eVal);
+#endif
#if defined(SO_PRIORITY)
static ERL_NIF_TERM nsetopt_lvl_sock_priority(ErlNifEnv* env,
SocketDescriptor* descP,
@@ -964,6 +970,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_PEEK_OFF)
+static ERL_NIF_TERM ngetopt_lvl_sock_peek_off(ErlNifEnv* env,
+ SocketDescriptor* descP);
+#endif
#if defined(SO_PRIORITY)
static ERL_NIF_TERM ngetopt_lvl_sock_priority(ErlNifEnv* env,
SocketDescriptor* descP);
@@ -3723,6 +3733,12 @@ ERL_NIF_TERM nsetopt_lvl_socket(ErlNifEnv* env,
break;
#endif
+#if defined(SO_PEEK_OFF)
+ case SOCKET_OPT_SOCK_PEEK_OFF:
+ result = nsetopt_lvl_sock_peek_off(env, descP, eVal);
+ break;
+#endif
+
#if defined(SO_PRIORITY)
case SOCKET_OPT_SOCK_PRIORITY:
result = nsetopt_lvl_sock_priority(env, descP, eVal);
@@ -3837,6 +3853,17 @@ ERL_NIF_TERM nsetopt_lvl_sock_priority(ErlNifEnv* env,
#endif
+#if defined(SO_PEEK_OFF)
+static
+ERL_NIF_TERM nsetopt_lvl_sock_peek_off(ErlNifEnv* env,
+ SocketDescriptor* descP,
+ ERL_NIF_TERM eVal)
+{
+ return nsetopt_int_opt(env, descP, SOL_SOCKET, SO_PEEK_OFF, eVal);
+}
+#endif
+
+
#if defined(SO_RCVBUF)
static
ERL_NIF_TERM nsetopt_lvl_sock_rcvbuf(ErlNifEnv* env,
@@ -4798,6 +4825,12 @@ ERL_NIF_TERM ngetopt_lvl_socket(ErlNifEnv* env,
break;
#endif
+#if defined(SO_PEEK_OFF)
+ case SOCKET_OPT_SOCK_PEEK_OFF:
+ result = ngetopt_lvl_sock_peek_off(env, descP);
+ break;
+#endif
+
#if defined(SO_PRIORITY)
case SOCKET_OPT_SOCK_PRIORITY:
result = ngetopt_lvl_sock_priority(env, descP);
@@ -4968,6 +5001,16 @@ ERL_NIF_TERM ngetopt_lvl_sock_linger(ErlNifEnv* env,
#endif
+#if defined(SO_PEEK_OFF)
+static
+ERL_NIF_TERM ngetopt_lvl_sock_peek_off(ErlNifEnv* env,
+ SocketDescriptor* descP)
+{
+ return ngetopt_int_opt(env, descP, SOL_SOCKET, SO_PEEK_OFF);
+}
+#endif
+
+
#if defined(SO_PRIORITY)
static
ERL_NIF_TERM ngetopt_lvl_sock_priority(ErlNifEnv* env,