aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2018-05-08 15:45:48 +0200
committerMicael Karlberg <[email protected]>2018-09-18 13:01:37 +0200
commit0f2b8a76edaa462fca388a55eaf449a36296820a (patch)
treed2ec1f07e9a9d93329b88137ca34c5b2d39d4bd8 /erts/emulator
parent3d719906dd0ad8d07547c3a20a2190a416dda364 (diff)
downloadotp-0f2b8a76edaa462fca388a55eaf449a36296820a.tar.gz
otp-0f2b8a76edaa462fca388a55eaf449a36296820a.tar.bz2
otp-0f2b8a76edaa462fca388a55eaf449a36296820a.zip
[socket-nif] setopt of socket option broadcast
Diffstat (limited to 'erts/emulator')
-rw-r--r--erts/emulator/nifs/common/socket_nif.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/erts/emulator/nifs/common/socket_nif.c b/erts/emulator/nifs/common/socket_nif.c
index d8e274341f..f9727d41b1 100644
--- a/erts/emulator/nifs/common/socket_nif.c
+++ b/erts/emulator/nifs/common/socket_nif.c
@@ -359,6 +359,7 @@ typedef union {
#define SOCKET_OPT_OTP_DEBUG 0
#define SOCKET_OPT_OTP_IOW 1
+#define SOCKET_OPT_SOCK_BROADCAST 4
#define SOCKET_OPT_SOCK_DONTROUTE 7
#define SOCKET_OPT_SOCK_KEEPALIVE 9
#define SOCKET_OPT_SOCK_LINGER 10
@@ -3398,6 +3399,25 @@ BOOLEAN_T eoptval2optval_socket(ErlNifEnv* env,
SocketOptValue* valP)
{
switch (eOpt) {
+#if defined(SO_BROADCAST)
+ case SOCKET_OPT_SOCK_BROADCAST:
+ {
+ BOOLEAN_T val;
+
+ if (decode_bool(env, eVal, &val)) {
+ *opt = SO_BROADCAST;
+ valP->tag = SOCKET_OPT_VALUE_INT;
+ valP->u.intVal = (val) ? 1 : 0;
+ return TRUE;
+ } else {
+ *opt = -1;
+ valP->tag = SOCKET_OPT_VALUE_UNDEF;
+ return FALSE;
+ }
+ }
+ break;
+#endif
+
#if defined(SO_DONTROUTE)
case SOCKET_OPT_SOCK_DONTROUTE:
{