diff options
author | Micael Karlberg <[email protected]> | 2018-07-09 14:10:35 +0200 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2018-09-18 14:50:18 +0200 |
commit | d45e3bf3dfeda0e849b07a9a7a19e50a52b04c35 (patch) | |
tree | 5070c73bdd508a484f2ae9ad56de05a851465bf8 /erts/preloaded/src | |
parent | 6632cb103336786f3ca12f9d1f1d3338fc76c237 (diff) | |
download | otp-d45e3bf3dfeda0e849b07a9a7a19e50a52b04c35.tar.gz otp-d45e3bf3dfeda0e849b07a9a7a19e50a52b04c35.tar.bz2 otp-d45e3bf3dfeda0e849b07a9a7a19e50a52b04c35.zip |
[socket-nif] Add support for socket (level socket) options domain and protocol
Make it possible to *get* the socket options domain and
protocol (in addition to type).
OTP-14831
Diffstat (limited to 'erts/preloaded/src')
-rw-r--r-- | erts/preloaded/src/socket.erl | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/erts/preloaded/src/socket.erl b/erts/preloaded/src/socket.erl index a1db295a79..4932e301fb 100644 --- a/erts/preloaded/src/socket.erl +++ b/erts/preloaded/src/socket.erl @@ -193,6 +193,7 @@ broadcast | busy_poll | debug | + domain | dontroute | error | keepalive | @@ -203,6 +204,7 @@ peek_off | peek_cred | priority | + protocol | rcvbuf | rcvbufforce | rcvlowat | @@ -463,14 +465,16 @@ -define(SOCKET_OPT_OTP_CTRL_PROC, 2). -define(SOCKET_OPT_SOCK_BROADCAST, 4). --define(SOCKET_OPT_SOCK_DONTROUTE, 7). --define(SOCKET_OPT_SOCK_KEEPALIVE, 9). --define(SOCKET_OPT_SOCK_LINGER, 10). --define(SOCKET_OPT_SOCK_PRIORITY, 16). --define(SOCKET_OPT_SOCK_RCVBUF, 17). --define(SOCKET_OPT_SOCK_REUSEADDR, 21). --define(SOCKET_OPT_SOCK_SNDBUF, 27). --define(SOCKET_OPT_SOCK_TYPE, 32). +-define(SOCKET_OPT_SOCK_DOMAIN, 7). +-define(SOCKET_OPT_SOCK_DONTROUTE, 8). +-define(SOCKET_OPT_SOCK_KEEPALIVE, 10). +-define(SOCKET_OPT_SOCK_LINGER, 11). +-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, 29). +-define(SOCKET_OPT_SOCK_TYPE, 34). -define(SOCKET_OPT_IP_RECVTOS, 25). -define(SOCKET_OPT_IP_ROUTER_ALERT, 28). @@ -2032,6 +2036,8 @@ enc_sockopt_key(socket = L, busy_poll = Opt, _Dir, _D, _T, _P) -> not_supported({L, Opt}); enc_sockopt_key(socket = L, debug = Opt, _Dir, _D, _T, _P) -> not_supported({L, Opt}); +enc_sockopt_key(socket, domain = _Opt, get = _Dir, _D, _T, _P) -> + ?SOCKET_OPT_SOCK_DOMAIN; enc_sockopt_key(socket, dontroute = _Opt, _Dir, _D, _T, _P) -> ?SOCKET_OPT_SOCK_DONTROUTE; enc_sockopt_key(socket = L, error = Opt, get = _Dir, _D, _T, _P) -> @@ -2055,6 +2061,8 @@ enc_sockopt_key(socket = L, peek_cred = Opt, get = _Dir, _D, _T, _P) -> not_supported({L, Opt}); enc_sockopt_key(socket, priority = _Opt, _Dir, _D, _T, _P) -> ?SOCKET_OPT_SOCK_PRIORITY; +enc_sockopt_key(socket, protocol = _Opt, get = _Dir, _D, _T, _P) -> + ?SOCKET_OPT_SOCK_PROTOCOL; enc_sockopt_key(socket, rcvbuf = _Opt, _Dir, _D, _T, _P) -> ?SOCKET_OPT_SOCK_RCVBUF; enc_sockopt_key(socket = L, rcvbufforce = Opt, _Dir, _D, _T, _P) -> |