From a0effef7feff6bb2753c835599dfaf4761eb9480 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Wed, 24 Jul 2019 12:47:18 +0200 Subject: [esock] Renaming internal functions to avoid name clashes The naming "convention" for "top" functions of the esock nif module was: The API functions where called nif_ This function did basic checks and arg extraction and then called the a function called n, which was the one doing the actual work. Unfortunately, och some platforms (AIX) these second names, n, clashed with system functions. So, in order to avoid this, the naming of second function has been changed to esock_. OTP-15955 --- erts/emulator/nifs/common/socket_nif.c | 4476 ++++++++++++++++---------------- 1 file changed, 2262 insertions(+), 2214 deletions(-) diff --git a/erts/emulator/nifs/common/socket_nif.c b/erts/emulator/nifs/common/socket_nif.c index 485aa282c2..6d5e1d026b 100644 --- a/erts/emulator/nifs/common/socket_nif.c +++ b/erts/emulator/nifs/common/socket_nif.c @@ -24,7 +24,7 @@ * The first function is called 'nif_', e.g. nif_open. * This does the initial validation and argument processing and then * calls the function that does the actual work. This is called - * 'n'. + * 'esock_'. * ---------------------------------------------------------------------- * * @@ -1021,10 +1021,10 @@ static BOOLEAN_T ecommand2command(ErlNifEnv* env, ERL_NIF_TERM ecommand, Uint16* command, ERL_NIF_TERM* edata); -static ERL_NIF_TERM ncommand(ErlNifEnv* env, - Uint16 cmd, - ERL_NIF_TERM ecdata); -static ERL_NIF_TERM ncommand_debug(ErlNifEnv* env, ERL_NIF_TERM ecdata); +static ERL_NIF_TERM esock_command(ErlNifEnv* env, + Uint16 cmd, + ERL_NIF_TERM ecdata); +static ERL_NIF_TERM esock_command_debug(ErlNifEnv* env, ERL_NIF_TERM ecdata); static ERL_NIF_TERM esock_global_info(ErlNifEnv* env); static ERL_NIF_TERM esock_socket_info(ErlNifEnv* env, @@ -1048,1109 +1048,1109 @@ static ERL_NIF_TERM socket_info_reqs(ErlNifEnv* env, ESockRequestor* crp, ESockRequestQueue* q); -static ERL_NIF_TERM nsupports(ErlNifEnv* env, int key); -static ERL_NIF_TERM nsupports_options(ErlNifEnv* env); -static ERL_NIF_TERM nsupports_options_socket(ErlNifEnv* env); -static ERL_NIF_TERM nsupports_options_ip(ErlNifEnv* env); -static ERL_NIF_TERM nsupports_options_ipv6(ErlNifEnv* env); -static ERL_NIF_TERM nsupports_options_tcp(ErlNifEnv* env); -static ERL_NIF_TERM nsupports_options_udp(ErlNifEnv* env); -static ERL_NIF_TERM nsupports_options_sctp(ErlNifEnv* env); -static ERL_NIF_TERM nsupports_sctp(ErlNifEnv* env); -static ERL_NIF_TERM nsupports_ipv6(ErlNifEnv* env); -static ERL_NIF_TERM nsupports_local(ErlNifEnv* env); - -static ERL_NIF_TERM nopen(ErlNifEnv* env, +static ERL_NIF_TERM esock_supports(ErlNifEnv* env, int key); +static ERL_NIF_TERM esock_supports_options(ErlNifEnv* env); +static ERL_NIF_TERM esock_supports_options_socket(ErlNifEnv* env); +static ERL_NIF_TERM esock_supports_options_ip(ErlNifEnv* env); +static ERL_NIF_TERM esock_supports_options_ipv6(ErlNifEnv* env); +static ERL_NIF_TERM esock_supports_options_tcp(ErlNifEnv* env); +static ERL_NIF_TERM esock_supports_options_udp(ErlNifEnv* env); +static ERL_NIF_TERM esock_supports_options_sctp(ErlNifEnv* env); +static ERL_NIF_TERM esock_supports_sctp(ErlNifEnv* env); +static ERL_NIF_TERM esock_supports_ipv6(ErlNifEnv* env); +static ERL_NIF_TERM esock_supports_local(ErlNifEnv* env); + +static ERL_NIF_TERM esock_open(ErlNifEnv* env, int domain, int type, int protocol, char* netns); -static BOOLEAN_T nopen_which_protocol(SOCKET sock, int* proto); +static BOOLEAN_T esock_open_which_protocol(SOCKET sock, int* proto); -static ERL_NIF_TERM nbind(ErlNifEnv* env, - ESockDescriptor* descP, - ESockAddress* sockAddrP, - unsigned int addrLen); -static ERL_NIF_TERM nconnect(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM sockRef); -static ERL_NIF_TERM nlisten(ErlNifEnv* env, - ESockDescriptor* descP, - int backlog); -static ERL_NIF_TERM naccept(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM sockRef, - ERL_NIF_TERM ref); -static ERL_NIF_TERM naccept_listening(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM sockRef, - ERL_NIF_TERM ref); -static ERL_NIF_TERM naccept_listening_error(ErlNifEnv* env, +static ERL_NIF_TERM esock_bind(ErlNifEnv* env, + ESockDescriptor* descP, + ESockAddress* sockAddrP, + unsigned int addrLen); +static ERL_NIF_TERM esock_connect(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM sockRef); +static ERL_NIF_TERM esock_listen(ErlNifEnv* env, + ESockDescriptor* descP, + int backlog); +static ERL_NIF_TERM esock_accept(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM sockRef, + ERL_NIF_TERM ref); +static ERL_NIF_TERM esock_accept_listening(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM sockRef, + ERL_NIF_TERM ref); +static ERL_NIF_TERM esock_accept_listening_error(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM sockRef, + ERL_NIF_TERM accRef, + ErlNifPid caller, + int save_errno); +static ERL_NIF_TERM esock_accept_listening_accept(ErlNifEnv* env, + ESockDescriptor* descP, + SOCKET accSock, + ErlNifPid caller, + ESockAddress* remote); +static ERL_NIF_TERM esock_accept_accepting(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM sockRef, + ERL_NIF_TERM ref); +static ERL_NIF_TERM esock_accept_accepting_current(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM sockRef, + ERL_NIF_TERM ref); +static ERL_NIF_TERM esock_accept_accepting_current_accept(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM sockRef, + SOCKET accSock, + ESockAddress* remote); +static ERL_NIF_TERM esock_accept_accepting_current_error(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM sockRef, + ERL_NIF_TERM opRef, + int save_errno); +static ERL_NIF_TERM esock_accept_accepting_other(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM ref, + ErlNifPid caller); +static ERL_NIF_TERM esock_accept_busy_retry(ErlNifEnv* env, ESockDescriptor* descP, ERL_NIF_TERM sockRef, ERL_NIF_TERM accRef, - ErlNifPid caller, - int save_errno); -static ERL_NIF_TERM naccept_listening_accept(ErlNifEnv* env, - ESockDescriptor* descP, - SOCKET accSock, - ErlNifPid caller, - ESockAddress* remote); -static ERL_NIF_TERM naccept_accepting(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM sockRef, - ERL_NIF_TERM ref); -static ERL_NIF_TERM naccept_accepting_current(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM sockRef, - ERL_NIF_TERM ref); -static ERL_NIF_TERM naccept_accepting_current_accept(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM sockRef, - SOCKET accSock, - ESockAddress* remote); -static ERL_NIF_TERM naccept_accepting_current_error(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM sockRef, - ERL_NIF_TERM opRef, - int save_errno); -static ERL_NIF_TERM naccept_accepting_other(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM ref, - ErlNifPid caller); -static ERL_NIF_TERM naccept_busy_retry(ErlNifEnv* env, + ErlNifPid* pid, + unsigned int nextState); +static BOOLEAN_T esock_accept_accepted(ErlNifEnv* env, ESockDescriptor* descP, - ERL_NIF_TERM sockRef, - ERL_NIF_TERM accRef, - ErlNifPid* pid, - unsigned int nextState); -static BOOLEAN_T naccept_accepted(ErlNifEnv* env, + SOCKET accSock, + ErlNifPid pid, + ESockAddress* remote, + ERL_NIF_TERM* result); +static ERL_NIF_TERM esock_send(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM sockRef, + ERL_NIF_TERM sendRef, + ErlNifBinary* dataP, + int flags); +static ERL_NIF_TERM esock_sendto(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM sockRef, + ERL_NIF_TERM sendRef, + ErlNifBinary* dataP, + int flags, + ESockAddress* toAddrP, + unsigned int toAddrLen); +static ERL_NIF_TERM esock_sendmsg(ErlNifEnv* env, ESockDescriptor* descP, - SOCKET accSock, - ErlNifPid pid, - ESockAddress* remote, - ERL_NIF_TERM* result); -static ERL_NIF_TERM nsend(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM sockRef, - ERL_NIF_TERM sendRef, - ErlNifBinary* dataP, - int flags); -static ERL_NIF_TERM nsendto(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM sockRef, - ERL_NIF_TERM sendRef, - ErlNifBinary* dataP, - int flags, - ESockAddress* toAddrP, - unsigned int toAddrLen); -static ERL_NIF_TERM nsendmsg(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM sockRef, - ERL_NIF_TERM sendRef, - ERL_NIF_TERM eMsgHdr, - int flags); -static ERL_NIF_TERM nrecv(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM sendRef, - ERL_NIF_TERM recvRef, - int len, - int flags); -static ERL_NIF_TERM nrecvfrom(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM sockRef, - ERL_NIF_TERM recvRef, - Uint16 bufSz, - int flags); -static ERL_NIF_TERM nrecvmsg(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM sockRef, - ERL_NIF_TERM recvRef, - Uint16 bufLen, - Uint16 ctrlLen, - int flags); -static ERL_NIF_TERM nclose(ErlNifEnv* env, - ESockDescriptor* descP); -static BOOLEAN_T nclose_check(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM* reason); -static ERL_NIF_TERM nclose_do(ErlNifEnv* env, - ESockDescriptor* descP); -static ERL_NIF_TERM nshutdown(ErlNifEnv* env, - ESockDescriptor* descP, - int how); -static ERL_NIF_TERM nsetopt(ErlNifEnv* env, - ESockDescriptor* descP, - BOOLEAN_T isEncoded, - BOOLEAN_T isOTP, - int level, - int eOpt, - ERL_NIF_TERM eVal); + ERL_NIF_TERM sockRef, + ERL_NIF_TERM sendRef, + ERL_NIF_TERM eMsgHdr, + int flags); +static ERL_NIF_TERM esock_recv(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM sendRef, + ERL_NIF_TERM recvRef, + int len, + int flags); +static ERL_NIF_TERM esock_recvfrom(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM sockRef, + ERL_NIF_TERM recvRef, + Uint16 bufSz, + int flags); +static ERL_NIF_TERM esock_recvmsg(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM sockRef, + ERL_NIF_TERM recvRef, + Uint16 bufLen, + Uint16 ctrlLen, + int flags); +static ERL_NIF_TERM esock_close(ErlNifEnv* env, + ESockDescriptor* descP); +static BOOLEAN_T esock_close_check(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM* reason); +static ERL_NIF_TERM esock_close_do(ErlNifEnv* env, + ESockDescriptor* descP); +static ERL_NIF_TERM esock_shutdown(ErlNifEnv* env, + ESockDescriptor* descP, + int how); +static ERL_NIF_TERM esock_setopt(ErlNifEnv* env, + ESockDescriptor* descP, + BOOLEAN_T isEncoded, + BOOLEAN_T isOTP, + int level, + int eOpt, + ERL_NIF_TERM eVal); /* Set OTP level options */ -static ERL_NIF_TERM nsetopt_otp(ErlNifEnv* env, - ESockDescriptor* descP, - int eOpt, - ERL_NIF_TERM eVal); -/* *** nsetopt_otp_debug *** - * *** nsetopt_otp_iow *** - * *** nsetopt_otp_ctrl_proc *** - * *** nsetopt_otp_rcvbuf *** - * *** nsetopt_otp_rcvctrlbuf *** - * *** nsetopt_otp_sndctrlbuf *** - */ -#define NSETOPT_OTP_FUNCS \ - NSETOPT_OTP_FUNC_DEF(debug); \ - NSETOPT_OTP_FUNC_DEF(iow); \ - NSETOPT_OTP_FUNC_DEF(ctrl_proc); \ - NSETOPT_OTP_FUNC_DEF(rcvbuf); \ - NSETOPT_OTP_FUNC_DEF(rcvctrlbuf); \ - NSETOPT_OTP_FUNC_DEF(sndctrlbuf); -#define NSETOPT_OTP_FUNC_DEF(F) \ - static ERL_NIF_TERM nsetopt_otp_##F(ErlNifEnv* env, \ - ESockDescriptor* descP, \ - ERL_NIF_TERM eVal) -NSETOPT_OTP_FUNCS -#undef NSETOPT_OTP_FUNC_DEF +static ERL_NIF_TERM esock_setopt_otp(ErlNifEnv* env, + ESockDescriptor* descP, + int eOpt, + ERL_NIF_TERM eVal); +/* *** esock_setopt_otp_debug *** + * *** esock_setopt_otp_iow *** + * *** esock_setopt_otp_ctrl_proc *** + * *** esock_setopt_otp_rcvbuf *** + * *** esock_setopt_otp_rcvctrlbuf *** + * *** esock_setopt_otp_sndctrlbuf *** + */ +#define ESOCK_SETOPT_OTP_FUNCS \ + ESOCK_SETOPT_OTP_FUNC_DEF(debug); \ + ESOCK_SETOPT_OTP_FUNC_DEF(iow); \ + ESOCK_SETOPT_OTP_FUNC_DEF(ctrl_proc); \ + ESOCK_SETOPT_OTP_FUNC_DEF(rcvbuf); \ + ESOCK_SETOPT_OTP_FUNC_DEF(rcvctrlbuf); \ + ESOCK_SETOPT_OTP_FUNC_DEF(sndctrlbuf); +#define ESOCK_SETOPT_OTP_FUNC_DEF(F) \ + static ERL_NIF_TERM esock_setopt_otp_##F(ErlNifEnv* env, \ + ESockDescriptor* descP, \ + ERL_NIF_TERM eVal) +ESOCK_SETOPT_OTP_FUNCS +#undef ESOCK_SETOPT_OTP_FUNC_DEF /* Set native options */ -static ERL_NIF_TERM nsetopt_native(ErlNifEnv* env, - ESockDescriptor* descP, - int level, - int eOpt, - ERL_NIF_TERM eVal); -static ERL_NIF_TERM nsetopt_level(ErlNifEnv* env, - ESockDescriptor* descP, - int level, - int eOpt, - ERL_NIF_TERM eVal); -static ERL_NIF_TERM nsetopt_lvl_socket(ErlNifEnv* env, +static ERL_NIF_TERM esock_setopt_native(ErlNifEnv* env, + ESockDescriptor* descP, + int level, + int eOpt, + ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_level(ErlNifEnv* env, ESockDescriptor* descP, + int level, int eOpt, ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_socket(ErlNifEnv* env, + ESockDescriptor* descP, + int eOpt, + ERL_NIF_TERM eVal); /* *** Handling set of socket options for level = socket *** */ #if defined(SO_BINDTODEVICE) -static ERL_NIF_TERM nsetopt_lvl_sock_bindtodevice(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_sock_bindtodevice(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(SO_BROADCAST) -static ERL_NIF_TERM nsetopt_lvl_sock_broadcast(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_sock_broadcast(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(SO_DEBUG) -static ERL_NIF_TERM nsetopt_lvl_sock_debug(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_sock_debug(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(SO_DONTROUTE) -static ERL_NIF_TERM nsetopt_lvl_sock_dontroute(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_sock_dontroute(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(SO_KEEPALIVE) -static ERL_NIF_TERM nsetopt_lvl_sock_keepalive(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_sock_keepalive(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(SO_LINGER) -static ERL_NIF_TERM nsetopt_lvl_sock_linger(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_sock_linger(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(SO_OOBINLINE) -static ERL_NIF_TERM nsetopt_lvl_sock_oobinline(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_sock_oobinline(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(SO_PEEK_OFF) -static ERL_NIF_TERM nsetopt_lvl_sock_peek_off(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_sock_peek_off(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(SO_PRIORITY) -static ERL_NIF_TERM nsetopt_lvl_sock_priority(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_sock_priority(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(SO_RCVBUF) -static ERL_NIF_TERM nsetopt_lvl_sock_rcvbuf(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_sock_rcvbuf(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(SO_RCVLOWAT) -static ERL_NIF_TERM nsetopt_lvl_sock_rcvlowat(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_sock_rcvlowat(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(SO_RCVTIMEO) -static ERL_NIF_TERM nsetopt_lvl_sock_rcvtimeo(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_sock_rcvtimeo(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(SO_REUSEADDR) -static ERL_NIF_TERM nsetopt_lvl_sock_reuseaddr(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_sock_reuseaddr(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(SO_REUSEPORT) -static ERL_NIF_TERM nsetopt_lvl_sock_reuseport(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_sock_reuseport(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(SO_SNDBUF) -static ERL_NIF_TERM nsetopt_lvl_sock_sndbuf(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_sock_sndbuf(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(SO_SNDLOWAT) -static ERL_NIF_TERM nsetopt_lvl_sock_sndlowat(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_sock_sndlowat(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(SO_SNDTIMEO) -static ERL_NIF_TERM nsetopt_lvl_sock_sndtimeo(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_sock_sndtimeo(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(SO_TIMESTAMP) -static ERL_NIF_TERM nsetopt_lvl_sock_timestamp(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_sock_timestamp(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif -static ERL_NIF_TERM nsetopt_lvl_ip(ErlNifEnv* env, - ESockDescriptor* descP, - int eOpt, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ip(ErlNifEnv* env, + ESockDescriptor* descP, + int eOpt, + ERL_NIF_TERM eVal); /* *** Handling set of socket options for level = ip *** */ #if defined(IP_ADD_MEMBERSHIP) -static ERL_NIF_TERM nsetopt_lvl_ip_add_membership(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ip_add_membership(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IP_ADD_SOURCE_MEMBERSHIP) -static ERL_NIF_TERM nsetopt_lvl_ip_add_source_membership(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ip_add_source_membership(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IP_BLOCK_SOURCE) -static ERL_NIF_TERM nsetopt_lvl_ip_block_source(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ip_block_source(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IP_DROP_MEMBERSHIP) -static ERL_NIF_TERM nsetopt_lvl_ip_drop_membership(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ip_drop_membership(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IP_DROP_SOURCE_MEMBERSHIP) -static ERL_NIF_TERM nsetopt_lvl_ip_drop_source_membership(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ip_drop_source_membership(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IP_FREEBIND) -static ERL_NIF_TERM nsetopt_lvl_ip_freebind(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ip_freebind(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IP_HDRINCL) -static ERL_NIF_TERM nsetopt_lvl_ip_hdrincl(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ip_hdrincl(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IP_MINTTL) -static ERL_NIF_TERM nsetopt_lvl_ip_minttl(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ip_minttl(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IP_MSFILTER) && defined(IP_MSFILTER_SIZE) -static ERL_NIF_TERM nsetopt_lvl_ip_msfilter(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ip_msfilter(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); static BOOLEAN_T decode_ip_msfilter_mode(ErlNifEnv* env, ERL_NIF_TERM eVal, Uint32* mode); -static ERL_NIF_TERM nsetopt_lvl_ip_msfilter_set(ErlNifEnv* env, - SOCKET sock, - struct ip_msfilter* msfP, - SOCKLEN_T optLen); +static ERL_NIF_TERM esock_setopt_lvl_ip_msfilter_set(ErlNifEnv* env, + SOCKET sock, + struct ip_msfilter* msfP, + SOCKLEN_T optLen); #endif #if defined(IP_MTU_DISCOVER) -static ERL_NIF_TERM nsetopt_lvl_ip_mtu_discover(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ip_mtu_discover(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IP_MULTICAST_ALL) -static ERL_NIF_TERM nsetopt_lvl_ip_multicast_all(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ip_multicast_all(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IP_MULTICAST_IF) -static ERL_NIF_TERM nsetopt_lvl_ip_multicast_if(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ip_multicast_if(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IP_MULTICAST_LOOP) -static ERL_NIF_TERM nsetopt_lvl_ip_multicast_loop(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ip_multicast_loop(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IP_MULTICAST_TTL) -static ERL_NIF_TERM nsetopt_lvl_ip_multicast_ttl(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ip_multicast_ttl(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IP_NODEFRAG) -static ERL_NIF_TERM nsetopt_lvl_ip_nodefrag(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ip_nodefrag(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IP_PKTINFO) -static ERL_NIF_TERM nsetopt_lvl_ip_pktinfo(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ip_pktinfo(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IP_RECVDSTADDR) -static ERL_NIF_TERM nsetopt_lvl_ip_recvdstaddr(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ip_recvdstaddr(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IP_RECVERR) -static ERL_NIF_TERM nsetopt_lvl_ip_recverr(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ip_recverr(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IP_RECVIF) -static ERL_NIF_TERM nsetopt_lvl_ip_recvif(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ip_recvif(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IP_RECVOPTS) -static ERL_NIF_TERM nsetopt_lvl_ip_recvopts(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ip_recvopts(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IP_RECVORIGDSTADDR) -static ERL_NIF_TERM nsetopt_lvl_ip_recvorigdstaddr(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ip_recvorigdstaddr(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IP_RECVTOS) -static ERL_NIF_TERM nsetopt_lvl_ip_recvtos(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ip_recvtos(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IP_RECVTTL) -static ERL_NIF_TERM nsetopt_lvl_ip_recvttl(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ip_recvttl(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IP_RETOPTS) -static ERL_NIF_TERM nsetopt_lvl_ip_retopts(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); -#endif -#if defined(IP_ROUTER_ALERT) -static ERL_NIF_TERM nsetopt_lvl_ip_router_alert(ErlNifEnv* env, +static ERL_NIF_TERM esock_setopt_lvl_ip_retopts(ErlNifEnv* env, ESockDescriptor* descP, ERL_NIF_TERM eVal); #endif +#if defined(IP_ROUTER_ALERT) +static ERL_NIF_TERM esock_setopt_lvl_ip_router_alert(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); +#endif #if defined(IP_SENDSRCADDR) -static ERL_NIF_TERM nsetopt_lvl_ip_sendsrcaddr(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ip_sendsrcaddr(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IP_TOS) -static ERL_NIF_TERM nsetopt_lvl_ip_tos(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ip_tos(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IP_TRANSPARENT) -static ERL_NIF_TERM nsetopt_lvl_ip_transparent(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ip_transparent(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IP_TTL) -static ERL_NIF_TERM nsetopt_lvl_ip_ttl(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ip_ttl(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IP_UNBLOCK_SOURCE) -static ERL_NIF_TERM nsetopt_lvl_ip_unblock_source(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ip_unblock_source(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IP_DROP_MEMBERSHIP) || defined(IP_ADD_MEMBERSHIP) static -ERL_NIF_TERM nsetopt_lvl_ip_update_membership(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal, - int opt); +ERL_NIF_TERM esock_setopt_lvl_ip_update_membership(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal, + int opt); #endif #if defined(IP_ADD_SOURCE_MEMBERSHIP) || defined(IP_DROP_SOURCE_MEMBERSHIP) || defined(IP_BLOCK_SOURCE) || defined(IP_UNBLOCK_SOURCE) static -ERL_NIF_TERM nsetopt_lvl_ip_update_source(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal, - int opt); +ERL_NIF_TERM esock_setopt_lvl_ip_update_source(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal, + int opt); #endif /* *** Handling set of socket options for level = ipv6 *** */ #if defined(HAVE_IPV6) -static ERL_NIF_TERM nsetopt_lvl_ipv6(ErlNifEnv* env, - ESockDescriptor* descP, - int eOpt, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ipv6(ErlNifEnv* env, + ESockDescriptor* descP, + int eOpt, + ERL_NIF_TERM eVal); #if defined(IPV6_ADDRFORM) -static ERL_NIF_TERM nsetopt_lvl_ipv6_addrform(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ipv6_addrform(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IPV6_ADD_MEMBERSHIP) -static ERL_NIF_TERM nsetopt_lvl_ipv6_add_membership(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ipv6_add_membership(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IPV6_AUTHHDR) -static ERL_NIF_TERM nsetopt_lvl_ipv6_authhdr(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ipv6_authhdr(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IPV6_DROP_MEMBERSHIP) -static ERL_NIF_TERM nsetopt_lvl_ipv6_drop_membership(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ipv6_drop_membership(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IPV6_DSTOPTS) -static ERL_NIF_TERM nsetopt_lvl_ipv6_dstopts(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ipv6_dstopts(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IPV6_FLOWINFO) -static ERL_NIF_TERM nsetopt_lvl_ipv6_flowinfo(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ipv6_flowinfo(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IPV6_HOPLIMIT) -static ERL_NIF_TERM nsetopt_lvl_ipv6_hoplimit(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ipv6_hoplimit(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IPV6_HOPOPTS) -static ERL_NIF_TERM nsetopt_lvl_ipv6_hopopts(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ipv6_hopopts(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IPV6_MTU) -static ERL_NIF_TERM nsetopt_lvl_ipv6_mtu(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ipv6_mtu(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IPV6_MTU_DISCOVER) -static ERL_NIF_TERM nsetopt_lvl_ipv6_mtu_discover(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ipv6_mtu_discover(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IPV6_MULTICAST_HOPS) -static ERL_NIF_TERM nsetopt_lvl_ipv6_multicast_hops(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ipv6_multicast_hops(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IPV6_MULTICAST_IF) -static ERL_NIF_TERM nsetopt_lvl_ipv6_multicast_if(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ipv6_multicast_if(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IPV6_MULTICAST_LOOP) -static ERL_NIF_TERM nsetopt_lvl_ipv6_multicast_loop(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ipv6_multicast_loop(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IPV6_RECVERR) -static ERL_NIF_TERM nsetopt_lvl_ipv6_recverr(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ipv6_recverr(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IPV6_RECVPKTINFO) || defined(IPV6_PKTINFO) -static ERL_NIF_TERM nsetopt_lvl_ipv6_recvpktinfo(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ipv6_recvpktinfo(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IPV6_ROUTER_ALERT) -static ERL_NIF_TERM nsetopt_lvl_ipv6_router_alert(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ipv6_router_alert(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IPV6_RTHDR) -static ERL_NIF_TERM nsetopt_lvl_ipv6_rthdr(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ipv6_rthdr(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IPV6_UNICAST_HOPS) -static ERL_NIF_TERM nsetopt_lvl_ipv6_unicast_hops(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ipv6_unicast_hops(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IPV6_V6ONLY) -static ERL_NIF_TERM nsetopt_lvl_ipv6_v6only(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_ipv6_v6only(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(IPV6_ADD_MEMBERSHIP) || defined(IPV6_DROP_MEMBERSHIP) -static ERL_NIF_TERM nsetopt_lvl_ipv6_update_membership(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal, - int opt); +static ERL_NIF_TERM esock_setopt_lvl_ipv6_update_membership(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal, + int opt); #endif #endif // defined(HAVE_IPV6) -static ERL_NIF_TERM nsetopt_lvl_tcp(ErlNifEnv* env, - ESockDescriptor* descP, - int eOpt, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_tcp(ErlNifEnv* env, + ESockDescriptor* descP, + int eOpt, + ERL_NIF_TERM eVal); #if defined(TCP_CONGESTION) -static ERL_NIF_TERM nsetopt_lvl_tcp_congestion(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_tcp_congestion(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(TCP_MAXSEG) -static ERL_NIF_TERM nsetopt_lvl_tcp_maxseg(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_tcp_maxseg(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(TCP_NODELAY) -static ERL_NIF_TERM nsetopt_lvl_tcp_nodelay(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_tcp_nodelay(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif -static ERL_NIF_TERM nsetopt_lvl_udp(ErlNifEnv* env, - ESockDescriptor* descP, - int eOpt, - ERL_NIF_TERM eVal); -#if defined(UDP_CORK) -static ERL_NIF_TERM nsetopt_lvl_udp_cork(ErlNifEnv* env, +static ERL_NIF_TERM esock_setopt_lvl_udp(ErlNifEnv* env, ESockDescriptor* descP, + int eOpt, ERL_NIF_TERM eVal); +#if defined(UDP_CORK) +static ERL_NIF_TERM esock_setopt_lvl_udp_cork(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(HAVE_SCTP) -static ERL_NIF_TERM nsetopt_lvl_sctp(ErlNifEnv* env, - ESockDescriptor* descP, - int eOpt, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_sctp(ErlNifEnv* env, + ESockDescriptor* descP, + int eOpt, + ERL_NIF_TERM eVal); #if defined(SCTP_ASSOCINFO) -static ERL_NIF_TERM nsetopt_lvl_sctp_associnfo(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_sctp_associnfo(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(SCTP_AUTOCLOSE) -static ERL_NIF_TERM nsetopt_lvl_sctp_autoclose(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_sctp_autoclose(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(SCTP_DISABLE_FRAGMENTS) -static ERL_NIF_TERM nsetopt_lvl_sctp_disable_fragments(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_sctp_disable_fragments(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(SCTP_EVENTS) -static ERL_NIF_TERM nsetopt_lvl_sctp_events(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_sctp_events(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(SCTP_INITMSG) -static ERL_NIF_TERM nsetopt_lvl_sctp_initmsg(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_sctp_initmsg(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(SCTP_MAXSEG) -static ERL_NIF_TERM nsetopt_lvl_sctp_maxseg(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_sctp_maxseg(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(SCTP_NODELAY) -static ERL_NIF_TERM nsetopt_lvl_sctp_nodelay(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_sctp_nodelay(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #if defined(SCTP_RTOINFO) -static ERL_NIF_TERM nsetopt_lvl_sctp_rtoinfo(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_lvl_sctp_rtoinfo(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal); #endif #endif // defined(HAVE_SCTP) -static ERL_NIF_TERM ngetopt(ErlNifEnv* env, - ESockDescriptor* descP, - BOOLEAN_T isEncoded, - BOOLEAN_T isOTP, - int level, - ERL_NIF_TERM eOpt); +static ERL_NIF_TERM esock_getopt(ErlNifEnv* env, + ESockDescriptor* descP, + BOOLEAN_T isEncoded, + BOOLEAN_T isOTP, + int level, + ERL_NIF_TERM eOpt); -static ERL_NIF_TERM ngetopt_otp(ErlNifEnv* env, - ESockDescriptor* descP, - int eOpt); -/* *** ngetopt_otp_debug *** - * *** ngetopt_otp_iow *** - * *** ngetopt_otp_ctrl_proc *** - * *** ngetopt_otp_rcvbuf *** - * *** ngetopt_otp_rcvctrlbuf *** - * *** ngetopt_otp_sndctrlbuf *** - * *** ngetopt_otp_fd *** - * *** ngetopt_otp_domain *** - * *** ngetopt_otp_type *** - * *** ngetopt_otp_protocol *** - */ -#define NGETOPT_OTP_FUNCS \ - NGETOPT_OTP_FUNC_DEF(debug); \ - NGETOPT_OTP_FUNC_DEF(iow); \ - NGETOPT_OTP_FUNC_DEF(ctrl_proc); \ - NGETOPT_OTP_FUNC_DEF(rcvbuf); \ - NGETOPT_OTP_FUNC_DEF(rcvctrlbuf); \ - NGETOPT_OTP_FUNC_DEF(sndctrlbuf); \ - NGETOPT_OTP_FUNC_DEF(fd); \ - NGETOPT_OTP_FUNC_DEF(domain); \ - NGETOPT_OTP_FUNC_DEF(type); \ - NGETOPT_OTP_FUNC_DEF(protocol); -#define NGETOPT_OTP_FUNC_DEF(F) \ - static ERL_NIF_TERM ngetopt_otp_##F(ErlNifEnv* env, \ - ESockDescriptor* descP) -NGETOPT_OTP_FUNCS -#undef NGETOPT_OTP_FUNC_DEF +static ERL_NIF_TERM esock_getopt_otp(ErlNifEnv* env, + ESockDescriptor* descP, + int eOpt); +/* *** esock_getopt_otp_debug *** + * *** esock_getopt_otp_iow *** + * *** esock_getopt_otp_ctrl_proc *** + * *** esock_getopt_otp_rcvbuf *** + * *** esock_getopt_otp_rcvctrlbuf *** + * *** esock_getopt_otp_sndctrlbuf *** + * *** esock_getopt_otp_fd *** + * *** esock_getopt_otp_domain *** + * *** esock_getopt_otp_type *** + * *** esock_getopt_otp_protocol *** + */ +#define ESOCK_GETOPT_OTP_FUNCS \ + ESOCK_GETOPT_OTP_FUNC_DEF(debug); \ + ESOCK_GETOPT_OTP_FUNC_DEF(iow); \ + ESOCK_GETOPT_OTP_FUNC_DEF(ctrl_proc); \ + ESOCK_GETOPT_OTP_FUNC_DEF(rcvbuf); \ + ESOCK_GETOPT_OTP_FUNC_DEF(rcvctrlbuf); \ + ESOCK_GETOPT_OTP_FUNC_DEF(sndctrlbuf); \ + ESOCK_GETOPT_OTP_FUNC_DEF(fd); \ + ESOCK_GETOPT_OTP_FUNC_DEF(domain); \ + ESOCK_GETOPT_OTP_FUNC_DEF(type); \ + ESOCK_GETOPT_OTP_FUNC_DEF(protocol); +#define ESOCK_GETOPT_OTP_FUNC_DEF(F) \ + static ERL_NIF_TERM esock_getopt_otp_##F(ErlNifEnv* env, \ + ESockDescriptor* descP) +ESOCK_GETOPT_OTP_FUNCS +#undef ESOCK_GETOPT_OTP_FUNC_DEF -static ERL_NIF_TERM ngetopt_native(ErlNifEnv* env, - ESockDescriptor* descP, - int level, - ERL_NIF_TERM eOpt); -static ERL_NIF_TERM ngetopt_native_unspec(ErlNifEnv* env, - ESockDescriptor* descP, - int level, - int opt, - SOCKOPTLEN_T valueSz); -static ERL_NIF_TERM ngetopt_level(ErlNifEnv* env, - ESockDescriptor* descP, - int level, - int eOpt); -static ERL_NIF_TERM ngetopt_lvl_socket(ErlNifEnv* env, +static ERL_NIF_TERM esock_getopt_native(ErlNifEnv* env, + ESockDescriptor* descP, + int level, + ERL_NIF_TERM eOpt); +static ERL_NIF_TERM esock_getopt_native_unspec(ErlNifEnv* env, + ESockDescriptor* descP, + int level, + int opt, + SOCKOPTLEN_T valueSz); +static ERL_NIF_TERM esock_getopt_level(ErlNifEnv* env, ESockDescriptor* descP, + int level, int eOpt); +static ERL_NIF_TERM esock_getopt_lvl_socket(ErlNifEnv* env, + ESockDescriptor* descP, + int eOpt); #if defined(SO_ACCEPTCONN) -static ERL_NIF_TERM ngetopt_lvl_sock_acceptconn(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_sock_acceptconn(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(SO_BINDTODEVICE) -static ERL_NIF_TERM ngetopt_lvl_sock_bindtodevice(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_sock_bindtodevice(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(SO_BROADCAST) -static ERL_NIF_TERM ngetopt_lvl_sock_broadcast(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_sock_broadcast(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(SO_DEBUG) -static ERL_NIF_TERM ngetopt_lvl_sock_debug(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_sock_debug(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(SO_DOMAIN) -static ERL_NIF_TERM ngetopt_lvl_sock_domain(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_sock_domain(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(SO_DONTROUTE) -static ERL_NIF_TERM ngetopt_lvl_sock_dontroute(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_sock_dontroute(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(SO_KEEPALIVE) -static ERL_NIF_TERM ngetopt_lvl_sock_keepalive(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_sock_keepalive(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(SO_LINGER) -static ERL_NIF_TERM ngetopt_lvl_sock_linger(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_sock_linger(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(SO_OOBINLINE) -static ERL_NIF_TERM ngetopt_lvl_sock_oobinline(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_sock_oobinline(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(SO_PEEK_OFF) -static ERL_NIF_TERM ngetopt_lvl_sock_peek_off(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_sock_peek_off(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(SO_PRIORITY) -static ERL_NIF_TERM ngetopt_lvl_sock_priority(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_sock_priority(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(SO_PROTOCOL) -static ERL_NIF_TERM ngetopt_lvl_sock_protocol(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_sock_protocol(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(SO_RCVBUF) -static ERL_NIF_TERM ngetopt_lvl_sock_rcvbuf(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_sock_rcvbuf(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(SO_RCVLOWAT) -static ERL_NIF_TERM ngetopt_lvl_sock_rcvlowat(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_sock_rcvlowat(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(SO_RCVTIMEO) -static ERL_NIF_TERM ngetopt_lvl_sock_rcvtimeo(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_sock_rcvtimeo(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(SO_REUSEADDR) -static ERL_NIF_TERM ngetopt_lvl_sock_reuseaddr(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_sock_reuseaddr(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(SO_REUSEPORT) -static ERL_NIF_TERM ngetopt_lvl_sock_reuseport(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_sock_reuseport(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(SO_SNDBUF) -static ERL_NIF_TERM ngetopt_lvl_sock_sndbuf(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_sock_sndbuf(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(SO_SNDLOWAT) -static ERL_NIF_TERM ngetopt_lvl_sock_sndlowat(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_sock_sndlowat(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(SO_SNDTIMEO) -static ERL_NIF_TERM ngetopt_lvl_sock_sndtimeo(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_sock_sndtimeo(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(SO_TIMESTAMP) -static ERL_NIF_TERM ngetopt_lvl_sock_timestamp(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_sock_timestamp(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(SO_TYPE) -static ERL_NIF_TERM ngetopt_lvl_sock_type(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_sock_type(ErlNifEnv* env, + ESockDescriptor* descP); #endif -static ERL_NIF_TERM ngetopt_lvl_ip(ErlNifEnv* env, - ESockDescriptor* descP, - int eOpt); +static ERL_NIF_TERM esock_getopt_lvl_ip(ErlNifEnv* env, + ESockDescriptor* descP, + int eOpt); #if defined(IP_FREEBIND) -static ERL_NIF_TERM ngetopt_lvl_ip_freebind(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_ip_freebind(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(IP_HDRINCL) -static ERL_NIF_TERM ngetopt_lvl_ip_hdrincl(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_ip_hdrincl(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(IP_MINTTL) -static ERL_NIF_TERM ngetopt_lvl_ip_minttl(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_ip_minttl(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(IP_MTU) -static ERL_NIF_TERM ngetopt_lvl_ip_mtu(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_ip_mtu(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(IP_MTU_DISCOVER) -static ERL_NIF_TERM ngetopt_lvl_ip_mtu_discover(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_ip_mtu_discover(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(IP_MULTICAST_ALL) -static ERL_NIF_TERM ngetopt_lvl_ip_multicast_all(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_ip_multicast_all(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(IP_MULTICAST_IF) -static ERL_NIF_TERM ngetopt_lvl_ip_multicast_if(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_ip_multicast_if(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(IP_MULTICAST_LOOP) -static ERL_NIF_TERM ngetopt_lvl_ip_multicast_loop(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_ip_multicast_loop(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(IP_MULTICAST_TTL) -static ERL_NIF_TERM ngetopt_lvl_ip_multicast_ttl(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_ip_multicast_ttl(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(IP_NODEFRAG) -static ERL_NIF_TERM ngetopt_lvl_ip_nodefrag(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_ip_nodefrag(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(IP_PKTINFO) -static ERL_NIF_TERM ngetopt_lvl_ip_pktinfo(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_ip_pktinfo(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(IP_RECVDSTADDR) -static ERL_NIF_TERM ngetopt_lvl_ip_recvdstaddr(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_ip_recvdstaddr(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(IP_RECVERR) -static ERL_NIF_TERM ngetopt_lvl_ip_recverr(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_ip_recverr(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(IP_RECVIF) -static ERL_NIF_TERM ngetopt_lvl_ip_recvif(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_ip_recvif(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(IP_RECVOPTS) -static ERL_NIF_TERM ngetopt_lvl_ip_recvopts(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_ip_recvopts(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(IP_RECVORIGDSTADDR) -static ERL_NIF_TERM ngetopt_lvl_ip_recvorigdstaddr(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_ip_recvorigdstaddr(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(IP_RECVTOS) -static ERL_NIF_TERM ngetopt_lvl_ip_recvtos(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_ip_recvtos(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(IP_RECVTTL) -static ERL_NIF_TERM ngetopt_lvl_ip_recvttl(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_ip_recvttl(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(IP_RETOPTS) -static ERL_NIF_TERM ngetopt_lvl_ip_retopts(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_ip_retopts(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(IP_ROUTER_ALERT) -static ERL_NIF_TERM ngetopt_lvl_ip_router_alert(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_ip_router_alert(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(IP_SENDSRCADDR) -static ERL_NIF_TERM ngetopt_lvl_ip_sendsrcaddr(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_ip_sendsrcaddr(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(IP_TOS) -static ERL_NIF_TERM ngetopt_lvl_ip_tos(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_ip_tos(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(IP_TRANSPARENT) -static ERL_NIF_TERM ngetopt_lvl_ip_transparent(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_ip_transparent(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(IP_TTL) -static ERL_NIF_TERM ngetopt_lvl_ip_ttl(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_ip_ttl(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(HAVE_IPV6) -static ERL_NIF_TERM ngetopt_lvl_ipv6(ErlNifEnv* env, - ESockDescriptor* descP, - int eOpt); +static ERL_NIF_TERM esock_getopt_lvl_ipv6(ErlNifEnv* env, + ESockDescriptor* descP, + int eOpt); #if defined(IPV6_AUTHHDR) -static ERL_NIF_TERM ngetopt_lvl_ipv6_authhdr(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_ipv6_authhdr(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(IPV6_DSTOPTS) -static ERL_NIF_TERM ngetopt_lvl_ipv6_dstopts(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_ipv6_dstopts(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(IPV6_FLOWINFO) -static ERL_NIF_TERM ngetopt_lvl_ipv6_flowinfo(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_ipv6_flowinfo(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(IPV6_HOPLIMIT) -static ERL_NIF_TERM ngetopt_lvl_ipv6_hoplimit(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_ipv6_hoplimit(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(IPV6_HOPOPTS) -static ERL_NIF_TERM ngetopt_lvl_ipv6_hopopts(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_ipv6_hopopts(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(IPV6_MTU) -static ERL_NIF_TERM ngetopt_lvl_ipv6_mtu(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_ipv6_mtu(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(IPV6_MTU_DISCOVER) -static ERL_NIF_TERM ngetopt_lvl_ipv6_mtu_discover(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_ipv6_mtu_discover(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(IPV6_MULTICAST_HOPS) -static ERL_NIF_TERM ngetopt_lvl_ipv6_multicast_hops(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_ipv6_multicast_hops(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(IPV6_MULTICAST_IF) -static ERL_NIF_TERM ngetopt_lvl_ipv6_multicast_if(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_ipv6_multicast_if(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(IPV6_MULTICAST_LOOP) -static ERL_NIF_TERM ngetopt_lvl_ipv6_multicast_loop(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_ipv6_multicast_loop(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(IPV6_RECVERR) -static ERL_NIF_TERM ngetopt_lvl_ipv6_recverr(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_ipv6_recverr(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(IPV6_RECVPKTINFO) || defined(IPV6_PKTINFO) -static ERL_NIF_TERM ngetopt_lvl_ipv6_recvpktinfo(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_ipv6_recvpktinfo(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(IPV6_ROUTER_ALERT) -static ERL_NIF_TERM ngetopt_lvl_ipv6_router_alert(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_ipv6_router_alert(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(IPV6_RTHDR) -static ERL_NIF_TERM ngetopt_lvl_ipv6_rthdr(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_ipv6_rthdr(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(IPV6_UNICAST_HOPS) -static ERL_NIF_TERM ngetopt_lvl_ipv6_unicast_hops(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_ipv6_unicast_hops(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(IPV6_V6ONLY) -static ERL_NIF_TERM ngetopt_lvl_ipv6_v6only(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_ipv6_v6only(ErlNifEnv* env, + ESockDescriptor* descP); #endif #endif // defined(HAVE_IPV6) -static ERL_NIF_TERM ngetopt_lvl_tcp(ErlNifEnv* env, - ESockDescriptor* descP, - int eOpt); +static ERL_NIF_TERM esock_getopt_lvl_tcp(ErlNifEnv* env, + ESockDescriptor* descP, + int eOpt); #if defined(TCP_CONGESTION) -static ERL_NIF_TERM ngetopt_lvl_tcp_congestion(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_tcp_congestion(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(TCP_MAXSEG) -static ERL_NIF_TERM ngetopt_lvl_tcp_maxseg(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_tcp_maxseg(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(TCP_NODELAY) -static ERL_NIF_TERM ngetopt_lvl_tcp_nodelay(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_tcp_nodelay(ErlNifEnv* env, + ESockDescriptor* descP); #endif -static ERL_NIF_TERM ngetopt_lvl_udp(ErlNifEnv* env, - ESockDescriptor* descP, - int eOpt); +static ERL_NIF_TERM esock_getopt_lvl_udp(ErlNifEnv* env, + ESockDescriptor* descP, + int eOpt); #if defined(UDP_CORK) -static ERL_NIF_TERM ngetopt_lvl_udp_cork(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_udp_cork(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(HAVE_SCTP) -static ERL_NIF_TERM ngetopt_lvl_sctp(ErlNifEnv* env, - ESockDescriptor* descP, - int eOpt); +static ERL_NIF_TERM esock_getopt_lvl_sctp(ErlNifEnv* env, + ESockDescriptor* descP, + int eOpt); #if defined(SCTP_ASSOCINFO) -static ERL_NIF_TERM ngetopt_lvl_sctp_associnfo(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_sctp_associnfo(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(SCTP_AUTOCLOSE) -static ERL_NIF_TERM ngetopt_lvl_sctp_autoclose(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_sctp_autoclose(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(SCTP_DISABLE_FRAGMENTS) -static ERL_NIF_TERM ngetopt_lvl_sctp_disable_fragments(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_sctp_disable_fragments(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(SCTP_MAXSEG) -static ERL_NIF_TERM ngetopt_lvl_sctp_maxseg(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_sctp_maxseg(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(SCTP_INITMSG) -static ERL_NIF_TERM ngetopt_lvl_sctp_initmsg(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_sctp_initmsg(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(SCTP_NODELAY) -static ERL_NIF_TERM ngetopt_lvl_sctp_nodelay(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_sctp_nodelay(ErlNifEnv* env, + ESockDescriptor* descP); #endif #if defined(SCTP_RTOINFO) -static ERL_NIF_TERM ngetopt_lvl_sctp_rtoinfo(ErlNifEnv* env, - ESockDescriptor* descP); +static ERL_NIF_TERM esock_getopt_lvl_sctp_rtoinfo(ErlNifEnv* env, + ESockDescriptor* descP); #endif #endif // defined(HAVE_SCTP) -static ERL_NIF_TERM nsockname(ErlNifEnv* env, - ESockDescriptor* descP); -static ERL_NIF_TERM npeername(ErlNifEnv* env, - ESockDescriptor* descP); -static ERL_NIF_TERM ncancel(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM op, - ERL_NIF_TERM sockRef, - ERL_NIF_TERM opRef); -static ERL_NIF_TERM ncancel_connect(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM opRef); -static ERL_NIF_TERM ncancel_accept(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM sockRef, - ERL_NIF_TERM opRef); -static ERL_NIF_TERM ncancel_accept_current(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM sockRef); -static ERL_NIF_TERM ncancel_accept_waiting(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM opRef); -static ERL_NIF_TERM ncancel_send(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM sockRef, - ERL_NIF_TERM opRef); -static ERL_NIF_TERM ncancel_send_current(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM sockRef); -static ERL_NIF_TERM ncancel_send_waiting(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM opRef); -static ERL_NIF_TERM ncancel_recv(ErlNifEnv* env, +static ERL_NIF_TERM esock_sockname(ErlNifEnv* env, + ESockDescriptor* descP); +static ERL_NIF_TERM esock_peername(ErlNifEnv* env, + ESockDescriptor* descP); +static ERL_NIF_TERM esock_cancel(ErlNifEnv* env, ESockDescriptor* descP, + ERL_NIF_TERM op, ERL_NIF_TERM sockRef, ERL_NIF_TERM opRef); -static ERL_NIF_TERM ncancel_recv_current(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM sockRef); -static ERL_NIF_TERM ncancel_recv_waiting(ErlNifEnv* env, +static ERL_NIF_TERM esock_cancel_connect(ErlNifEnv* env, ESockDescriptor* descP, ERL_NIF_TERM opRef); -static ERL_NIF_TERM ncancel_read_select(ErlNifEnv* env, +static ERL_NIF_TERM esock_cancel_accept(ErlNifEnv* env, ESockDescriptor* descP, + ERL_NIF_TERM sockRef, ERL_NIF_TERM opRef); -static ERL_NIF_TERM ncancel_write_select(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM opRef); -static ERL_NIF_TERM ncancel_mode_select(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM opRef, - int smode, - int rmode); +static ERL_NIF_TERM esock_cancel_accept_current(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM sockRef); +static ERL_NIF_TERM esock_cancel_accept_waiting(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM opRef); +static ERL_NIF_TERM esock_cancel_send(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM sockRef, + ERL_NIF_TERM opRef); +static ERL_NIF_TERM esock_cancel_send_current(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM sockRef); +static ERL_NIF_TERM esock_cancel_send_waiting(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM opRef); +static ERL_NIF_TERM esock_cancel_recv(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM sockRef, + ERL_NIF_TERM opRef); +static ERL_NIF_TERM esock_cancel_recv_current(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM sockRef); +static ERL_NIF_TERM esock_cancel_recv_waiting(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM opRef); +static ERL_NIF_TERM esock_cancel_read_select(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM opRef); +static ERL_NIF_TERM esock_cancel_write_select(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM opRef); +static ERL_NIF_TERM esock_cancel_mode_select(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM opRef, + int smode, + int rmode); #if defined(USE_SETOPT_STR_OPT) -static ERL_NIF_TERM nsetopt_str_opt(ErlNifEnv* env, - ESockDescriptor* descP, - int level, - int opt, - int max, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_str_opt(ErlNifEnv* env, + ESockDescriptor* descP, + int level, + int opt, + int max, + ERL_NIF_TERM eVal); #endif -static ERL_NIF_TERM nsetopt_bool_opt(ErlNifEnv* env, - ESockDescriptor* descP, - int level, - int opt, - ERL_NIF_TERM eVal); -static ERL_NIF_TERM nsetopt_int_opt(ErlNifEnv* env, - ESockDescriptor* descP, - int level, - int opt, - ERL_NIF_TERM eVal); -static ERL_NIF_TERM nsetopt_timeval_opt(ErlNifEnv* env, - ESockDescriptor* descP, - int level, - int opt, - ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_bool_opt(ErlNifEnv* env, + ESockDescriptor* descP, + int level, + int opt, + ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_int_opt(ErlNifEnv* env, + ESockDescriptor* descP, + int level, + int opt, + ERL_NIF_TERM eVal); +static ERL_NIF_TERM esock_setopt_timeval_opt(ErlNifEnv* env, + ESockDescriptor* descP, + int level, + int opt, + ERL_NIF_TERM eVal); #if defined(USE_GETOPT_STR_OPT) -static ERL_NIF_TERM ngetopt_str_opt(ErlNifEnv* env, - ESockDescriptor* descP, - int level, - int opt, - int max); +static ERL_NIF_TERM esock_getopt_str_opt(ErlNifEnv* env, + ESockDescriptor* descP, + int level, + int opt, + int max); #endif -static ERL_NIF_TERM ngetopt_bool_opt(ErlNifEnv* env, - ESockDescriptor* descP, - int level, - int opt); -static ERL_NIF_TERM ngetopt_int_opt(ErlNifEnv* env, - ESockDescriptor* descP, - int level, - int opt); -static ERL_NIF_TERM ngetopt_timeval_opt(ErlNifEnv* env, - ESockDescriptor* descP, - int level, - int opt); +static ERL_NIF_TERM esock_getopt_bool_opt(ErlNifEnv* env, + ESockDescriptor* descP, + int level, + int opt); +static ERL_NIF_TERM esock_getopt_int_opt(ErlNifEnv* env, + ESockDescriptor* descP, + int level, + int opt); +static ERL_NIF_TERM esock_getopt_timeval_opt(ErlNifEnv* env, + ESockDescriptor* descP, + int level, + int opt); static BOOLEAN_T send_check_writer(ErlNifEnv* env, ESockDescriptor* descP, @@ -2281,10 +2281,10 @@ static ERL_NIF_TERM recvmsg_check_msg(ErlNifEnv* env, ErlNifBinary* ctrlBufP, ERL_NIF_TERM sockRef); -static ERL_NIF_TERM nfinalize_connection(ErlNifEnv* env, +static ERL_NIF_TERM esock_finalize_connection(ErlNifEnv* env, + ESockDescriptor* descP); +static ERL_NIF_TERM esock_finalize_close(ErlNifEnv* env, ESockDescriptor* descP); -static ERL_NIF_TERM nfinalize_close(ErlNifEnv* env, - ESockDescriptor* descP); extern char* encode_msghdr(ErlNifEnv* env, ESockDescriptor* descP, @@ -3297,7 +3297,7 @@ ERL_NIF_TERM nif_command(ErlNifEnv* env, "\r\n (e) command data: %T" "\r\n", cmd, ecdata) ); - result = ncommand(env, cmd, ecdata); + result = esock_command(env, cmd, ecdata); SGDBG( ("SOCKET", "nif_command -> done with result: " "\r\n %T" @@ -3311,15 +3311,15 @@ ERL_NIF_TERM nif_command(ErlNifEnv* env, #if !defined(__WIN32__) static -ERL_NIF_TERM ncommand(ErlNifEnv* env, Uint16 cmd, ERL_NIF_TERM ecdata) +ERL_NIF_TERM esock_command(ErlNifEnv* env, Uint16 cmd, ERL_NIF_TERM ecdata) { ERL_NIF_TERM result; - SGDBG( ("SOCKET", "ncommand -> entry with 0x%lX\r\n", cmd) ); + SGDBG( ("SOCKET", "esock_command -> entry with 0x%lX\r\n", cmd) ); switch (cmd) { case SOCKET_CMD_DEBUG: - result = ncommand_debug(env, ecdata); + result = esock_command_debug(env, ecdata); break; default: @@ -3333,7 +3333,7 @@ ERL_NIF_TERM ncommand(ErlNifEnv* env, Uint16 cmd, ERL_NIF_TERM ecdata) static -ERL_NIF_TERM ncommand_debug(ErlNifEnv* env, ERL_NIF_TERM ecdata) +ERL_NIF_TERM esock_command_debug(ErlNifEnv* env, ERL_NIF_TERM ecdata) { ERL_NIF_TERM result; @@ -3346,7 +3346,7 @@ ERL_NIF_TERM ncommand_debug(ErlNifEnv* env, ERL_NIF_TERM ecdata) data.dbg = FALSE; result = esock_atom_ok; } else { - SGDBG( ("SOCKET", "ncommand_debug -> invalid debug value: %T\r\n", + SGDBG( ("SOCKET", "esock_command_debug -> invalid debug value: %T\r\n", ecdata) ); result = esock_make_error(env, esock_atom_einval); } @@ -3461,40 +3461,40 @@ ERL_NIF_TERM nif_supports(ErlNifEnv* env, return enif_make_badarg(env); } - return nsupports(env, key); + return esock_supports(env, key); #endif } -/* nsupports - what features do we support +/* esock_supports - what features do we support * * This is to prove information about what features actually * work on the current platform. */ #if !defined(__WIN32__) static -ERL_NIF_TERM nsupports(ErlNifEnv* env, int key) +ERL_NIF_TERM esock_supports(ErlNifEnv* env, int key) { ERL_NIF_TERM result; - SGDBG( ("SOCKET", "nsupports -> entry with 0x%lX\r\n", key) ); + SGDBG( ("SOCKET", "esock_supports -> entry with 0x%lX\r\n", key) ); switch (key) { case SOCKET_SUPPORTS_OPTIONS: - result = nsupports_options(env); + result = esock_supports_options(env); break; case SOCKET_SUPPORTS_SCTP: - result = nsupports_sctp(env); + result = esock_supports_sctp(env); break; case SOCKET_SUPPORTS_IPV6: - result = nsupports_ipv6(env); + result = esock_supports_ipv6(env); break; case SOCKET_SUPPORTS_LOCAL: - result = nsupports_local(env); + result = esock_supports_local(env); break; default: @@ -3509,19 +3509,19 @@ ERL_NIF_TERM nsupports(ErlNifEnv* env, int key) #if !defined(__WIN32__) static -ERL_NIF_TERM nsupports_options(ErlNifEnv* env) +ERL_NIF_TERM esock_supports_options(ErlNifEnv* env) { - ERL_NIF_TERM sockOpts = nsupports_options_socket(env); + ERL_NIF_TERM sockOpts = esock_supports_options_socket(env); ERL_NIF_TERM sockOptsT = MKT2(env, esock_atom_socket, sockOpts); - ERL_NIF_TERM ipOpts = nsupports_options_ip(env); + ERL_NIF_TERM ipOpts = esock_supports_options_ip(env); ERL_NIF_TERM ipOptsT = MKT2(env, esock_atom_ip, ipOpts); - ERL_NIF_TERM ipv6Opts = nsupports_options_ipv6(env); + ERL_NIF_TERM ipv6Opts = esock_supports_options_ipv6(env); ERL_NIF_TERM ipv6OptsT = MKT2(env, esock_atom_ipv6, ipv6Opts); - ERL_NIF_TERM tcpOpts = nsupports_options_tcp(env); + ERL_NIF_TERM tcpOpts = esock_supports_options_tcp(env); ERL_NIF_TERM tcpOptsT = MKT2(env, esock_atom_tcp, tcpOpts); - ERL_NIF_TERM udpOpts = nsupports_options_udp(env); + ERL_NIF_TERM udpOpts = esock_supports_options_udp(env); ERL_NIF_TERM udpOptsT = MKT2(env, esock_atom_udp, udpOpts); - ERL_NIF_TERM sctpOpts = nsupports_options_sctp(env); + ERL_NIF_TERM sctpOpts = esock_supports_options_sctp(env); ERL_NIF_TERM sctpOptsT = MKT2(env, esock_atom_sctp, sctpOpts); ERL_NIF_TERM optsA[] = {sockOptsT, ipOptsT, ipv6OptsT, @@ -3537,7 +3537,7 @@ ERL_NIF_TERM nsupports_options(ErlNifEnv* env) #if !defined(__WIN32__) static -ERL_NIF_TERM nsupports_options_socket(ErlNifEnv* env) +ERL_NIF_TERM esock_supports_options_socket(ErlNifEnv* env) { SocketTArray opts = TARRAY_CREATE(128); ERL_NIF_TERM tmp, optsL; @@ -3801,7 +3801,7 @@ ERL_NIF_TERM nsupports_options_socket(ErlNifEnv* env) #if !defined(__WIN32__) static -ERL_NIF_TERM nsupports_options_ip(ErlNifEnv* env) +ERL_NIF_TERM esock_supports_options_ip(ErlNifEnv* env) { SocketTArray opts = TARRAY_CREATE(128); ERL_NIF_TERM tmp, optsL; @@ -4102,7 +4102,7 @@ ERL_NIF_TERM nsupports_options_ip(ErlNifEnv* env) #if !defined(__WIN32__) static -ERL_NIF_TERM nsupports_options_ipv6(ErlNifEnv* env) +ERL_NIF_TERM esock_supports_options_ipv6(ErlNifEnv* env) { SocketTArray opts = TARRAY_CREATE(128); ERL_NIF_TERM tmp, optsL; @@ -4354,7 +4354,7 @@ ERL_NIF_TERM nsupports_options_ipv6(ErlNifEnv* env) #if !defined(__WIN32__) static -ERL_NIF_TERM nsupports_options_tcp(ErlNifEnv* env) +ERL_NIF_TERM esock_supports_options_tcp(ErlNifEnv* env) { SocketTArray opts = TARRAY_CREATE(32); ERL_NIF_TERM tmp, optsL; @@ -4451,7 +4451,7 @@ ERL_NIF_TERM nsupports_options_tcp(ErlNifEnv* env) #if !defined(__WIN32__) static -ERL_NIF_TERM nsupports_options_udp(ErlNifEnv* env) +ERL_NIF_TERM esock_supports_options_udp(ErlNifEnv* env) { SocketTArray opts = TARRAY_CREATE(8); ERL_NIF_TERM tmp, optsL; @@ -4476,7 +4476,7 @@ ERL_NIF_TERM nsupports_options_udp(ErlNifEnv* env) #if !defined(__WIN32__) static -ERL_NIF_TERM nsupports_options_sctp(ErlNifEnv* env) +ERL_NIF_TERM esock_supports_options_sctp(ErlNifEnv* env) { SocketTArray opts = TARRAY_CREATE(64); ERL_NIF_TERM tmp, optsL; @@ -4684,7 +4684,7 @@ ERL_NIF_TERM nsupports_options_sctp(ErlNifEnv* env) #if !defined(__WIN32__) static -ERL_NIF_TERM nsupports_sctp(ErlNifEnv* env) +ERL_NIF_TERM esock_supports_sctp(ErlNifEnv* env) { ERL_NIF_TERM supports; @@ -4702,7 +4702,7 @@ ERL_NIF_TERM nsupports_sctp(ErlNifEnv* env) #if !defined(__WIN32__) static -ERL_NIF_TERM nsupports_ipv6(ErlNifEnv* env) +ERL_NIF_TERM esock_supports_ipv6(ErlNifEnv* env) { ERL_NIF_TERM supports; @@ -4721,7 +4721,7 @@ ERL_NIF_TERM nsupports_ipv6(ErlNifEnv* env) #if !defined(__WIN32__) static -ERL_NIF_TERM nsupports_local(ErlNifEnv* env) +ERL_NIF_TERM esock_supports_local(ErlNifEnv* env) { ERL_NIF_TERM supports; @@ -4813,7 +4813,7 @@ ERL_NIF_TERM nif_open(ErlNifEnv* env, #endif - result = nopen(env, domain, type, proto, netns); + result = esock_open(env, domain, type, proto, netns); SGDBG( ("SOCKET", "nif_open -> done with result: " "\r\n %T" @@ -4825,7 +4825,7 @@ ERL_NIF_TERM nif_open(ErlNifEnv* env, } -/* nopen - create an endpoint for communication +/* esock_open - create an endpoint for communication * * Assumes the input has been validated. * @@ -4836,9 +4836,9 @@ ERL_NIF_TERM nif_open(ErlNifEnv* env, #if !defined(__WIN32__) static -ERL_NIF_TERM nopen(ErlNifEnv* env, - int domain, int type, int protocol, - char* netns) +ERL_NIF_TERM esock_open(ErlNifEnv* env, + int domain, int type, int protocol, + char* netns) { ESockDescriptor* descP; ERL_NIF_TERM res; @@ -4849,7 +4849,7 @@ ERL_NIF_TERM nopen(ErlNifEnv* env, int current_ns = 0; #endif - SGDBG( ("SOCKET", "nopen -> entry with" + SGDBG( ("SOCKET", "esock_open -> entry with" "\r\n domain: %d" "\r\n type: %d" "\r\n protocol: %d" @@ -4865,7 +4865,7 @@ ERL_NIF_TERM nopen(ErlNifEnv* env, if ((sock = sock_open(domain, type, proto)) == INVALID_SOCKET) return esock_make_error_errno(env, sock_errno()); - SGDBG( ("SOCKET", "nopen -> open success: %d\r\n", sock) ); + SGDBG( ("SOCKET", "esock_open -> open success: %d\r\n", sock) ); /* NOTE that if the protocol = 0 (default) and the domain is not @@ -4877,7 +4877,7 @@ ERL_NIF_TERM nopen(ErlNifEnv* env, && (domain != AF_LOCAL) #endif ) - if (!nopen_which_protocol(sock, &proto)) { + if (!esock_open_which_protocol(sock, &proto)) { if (proto == ESOCK_WHICH_PROTO_ERROR) { save_errno = sock_errno(); while ((sock_close(sock) == INVALID_SOCKET) && @@ -4907,7 +4907,7 @@ ERL_NIF_TERM nopen(ErlNifEnv* env, return esock_make_error_errno(env, save_errno); } - SGDBG( ("SOCKET", "nopen -> event success: %d\r\n", event) ); + SGDBG( ("SOCKET", "esock_open -> event success: %d\r\n", event) ); SET_NONBLOCKING(sock); @@ -4948,7 +4948,7 @@ ERL_NIF_TERM nopen(ErlNifEnv* env, if (enif_self(env, &descP->ctrlPid) == NULL) return esock_make_error(env, atom_exself); - if (MONP("nopen -> ctrl", + if (MONP("esock_open -> ctrl", env, descP, &descP->ctrlPid, &descP->ctrlMon) != 0) @@ -4962,7 +4962,7 @@ ERL_NIF_TERM nopen(ErlNifEnv* env, static -BOOLEAN_T nopen_which_protocol(SOCKET sock, int* proto) +BOOLEAN_T esock_open_which_protocol(SOCKET sock, int* proto) { #if defined(SO_PROTOCOL) int val; @@ -5144,7 +5144,7 @@ ERL_NIF_TERM nif_bind(ErlNifEnv* env, if ((xres = esock_decode_sockaddr(env, eSockAddr, &sockAddr, &addrLen)) != NULL) return esock_make_error_str(env, xres); - return nbind(env, descP, &sockAddr, addrLen); + return esock_bind(env, descP, &sockAddr, addrLen); #endif // if defined(__WIN32__) } @@ -5152,24 +5152,24 @@ ERL_NIF_TERM nif_bind(ErlNifEnv* env, #if !defined(__WIN32__) static -ERL_NIF_TERM nbind(ErlNifEnv* env, - ESockDescriptor* descP, - ESockAddress* sockAddrP, - unsigned int addrLen) +ERL_NIF_TERM esock_bind(ErlNifEnv* env, + ESockDescriptor* descP, + ESockAddress* sockAddrP, + unsigned int addrLen) { int port, ntohs_port; - SSDBG( descP, ("SOCKET", "nbind -> try bind\r\n") ); + SSDBG( descP, ("SOCKET", "esock_bind -> try bind\r\n") ); if (IS_SOCKET_ERROR(sock_bind(descP->sock, (struct sockaddr*) sockAddrP, addrLen))) { return esock_make_error_errno(env, sock_errno()); } - SSDBG( descP, ("SOCKET", "nbind -> bound - get port\r\n") ); + SSDBG( descP, ("SOCKET", "esock_bind -> bound - get port\r\n") ); port = which_address_port(sockAddrP); - SSDBG( descP, ("SOCKET", "nbind -> port: %d\r\n", port) ); + SSDBG( descP, ("SOCKET", "esock_bind -> port: %d\r\n", port) ); if (port == 0) { SOCKLEN_T len = sizeof(ESockAddress); sys_memzero((char *) sockAddrP, len); @@ -5181,7 +5181,8 @@ ERL_NIF_TERM nbind(ErlNifEnv* env, ntohs_port = sock_ntohs(port); - SSDBG( descP, ("SOCKET", "nbind -> done with port = %d\r\n", ntohs_port) ); + SSDBG( descP, ("SOCKET", + "esock_bind -> done with port = %d\r\n", ntohs_port) ); return esock_make_ok2(env, MKI(env, ntohs_port)); @@ -5248,7 +5249,7 @@ ERL_NIF_TERM nif_connect(ErlNifEnv* env, MLOCK(descP->writeMtx); MLOCK(descP->cfgMtx); - res = nconnect(env, descP, sockRef); + res = esock_connect(env, descP, sockRef); MUNLOCK(descP->cfgMtx); MUNLOCK(descP->writeMtx); @@ -5262,9 +5263,9 @@ ERL_NIF_TERM nif_connect(ErlNifEnv* env, #if !defined(__WIN32__) static -ERL_NIF_TERM nconnect(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM sockRef) +ERL_NIF_TERM esock_connect(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM sockRef) { ERL_NIF_TERM res, ref; int code, sres, save_errno = 0; @@ -5277,17 +5278,17 @@ ERL_NIF_TERM nconnect(ErlNifEnv* env, return esock_make_error(env, atom_closed); if (!IS_OPEN(descP)) { - SSDBG( descP, ("SOCKET", "nconnect -> not open\r\n") ); + SSDBG( descP, ("SOCKET", "esock_connect -> not open\r\n") ); return esock_make_error(env, atom_exbadstate); } if (IS_CONNECTED(descP)) { - SSDBG( descP, ("SOCKET", "nconnect -> already connected\r\n") ); + SSDBG( descP, ("SOCKET", "esock_connect -> already connected\r\n") ); return esock_make_error(env, atom_eisconn); } if (IS_CONNECTING(descP) && !is_connector(env, descP)) { - SSDBG( descP, ("SOCKET", "nconnect -> already connecting\r\n") ); + SSDBG( descP, ("SOCKET", "esock_connect -> already connecting\r\n") ); return esock_make_error(env, esock_atom_einval); } @@ -5301,14 +5302,15 @@ ERL_NIF_TERM nconnect(ErlNifEnv* env, descP->addrLen); save_errno = sock_errno(); - SSDBG( descP, ("SOCKET", "nconnect -> connect result: %d, %d\r\n", + SSDBG( descP, ("SOCKET", "esock_connect -> connect result: %d, %d\r\n", code, save_errno) ); if (IS_SOCKET_ERROR(code)) { switch (save_errno) { case ERRNO_BLOCK: /* Winsock2 */ case EINPROGRESS: /* Unix & OSE!! */ - SSDBG( descP, ("SOCKET", "nconnect -> would block => select\r\n") ); + SSDBG( descP, ("SOCKET", + "esock_connect -> would block => select\r\n") ); ref = MKREF(env); @@ -5322,7 +5324,7 @@ ERL_NIF_TERM nconnect(ErlNifEnv* env, if (enif_self(env, &descP->connPid) == NULL) return esock_make_error(env, atom_exself); - if (MONP("nconnect -> conn", + if (MONP("esock_connect -> conn", env, descP, &descP->connPid, &descP->connMon) != 0) @@ -5343,7 +5345,8 @@ ERL_NIF_TERM nconnect(ErlNifEnv* env, break; case EISCONN: - SSDBG( descP, ("SOCKET", "nconnect -> *already* connected\r\n") ); + SSDBG( descP, ("SOCKET", + "esock_connect -> *already* connected\r\n") ); { /* This is ***strange*** so make sure */ int err = 0; @@ -5354,7 +5357,7 @@ ERL_NIF_TERM nconnect(ErlNifEnv* env, descP->state = SOCKET_STATE_CONNECTED; /* And just to be on the safe side, reset these */ enif_set_pid_undefined(&descP->connPid); - DEMONP("nconnect -> connected", + DEMONP("esock_connect -> connected", env, descP, &descP->connMon); descP->isReadable = TRUE; descP->isWritable = TRUE; @@ -5364,7 +5367,7 @@ ERL_NIF_TERM nconnect(ErlNifEnv* env, break; default: - SSDBG( descP, ("SOCKET", "nconnect -> other error(1): %d\r\n", + SSDBG( descP, ("SOCKET", "esock_connect -> other error(1): %d\r\n", save_errno) ); res = esock_make_error_errno(env, save_errno); break; @@ -5372,11 +5375,11 @@ ERL_NIF_TERM nconnect(ErlNifEnv* env, } else if (code == 0) { /* ok we are connected */ - SSDBG( descP, ("SOCKET", "nconnect -> connected\r\n") ); + SSDBG( descP, ("SOCKET", "esock_connect -> connected\r\n") ); descP->state = SOCKET_STATE_CONNECTED; enif_set_pid_undefined(&descP->connPid); - DEMONP("nconnect -> connected", env, descP, &descP->connMon); + DEMONP("esock_connect -> connected", env, descP, &descP->connMon); descP->isReadable = TRUE; descP->isWritable = TRUE; @@ -5385,7 +5388,7 @@ ERL_NIF_TERM nconnect(ErlNifEnv* env, } else { /* Do we really need this case? */ - SSDBG( descP, ("SOCKET", "nconnect -> other error(2): %d\r\n", + SSDBG( descP, ("SOCKET", "esock_connect -> other error(2): %d\r\n", save_errno) ); res = esock_make_error_errno(env, save_errno); @@ -5426,19 +5429,19 @@ ERL_NIF_TERM nif_finalize_connection(ErlNifEnv* env, return enif_make_badarg(env); } - return nfinalize_connection(env, descP); + return esock_finalize_connection(env, descP); #endif } -/* *** nfinalize_connection *** +/* *** esock_finalize_connection *** * Perform the final check to verify a connection. */ #if !defined(__WIN32__) static -ERL_NIF_TERM nfinalize_connection(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_finalize_connection(ErlNifEnv* env, + ESockDescriptor* descP) { int error; @@ -5452,7 +5455,8 @@ ERL_NIF_TERM nfinalize_connection(ErlNifEnv* env, descP->state = SOCKET_STATE_CONNECTED; enif_set_pid_undefined(&descP->connPid); - DEMONP("nfinalize_connection -> connected", env, descP, &descP->connMon); + DEMONP("esock_finalize_connection -> connected", + env, descP, &descP->connMon); descP->isReadable = TRUE; descP->isWritable = TRUE; @@ -5576,7 +5580,7 @@ ERL_NIF_TERM nif_listen(ErlNifEnv* env, "\r\n backlog: %d" "\r\n", descP->sock, argv[0], backlog) ); - return nlisten(env, descP, backlog); + return esock_listen(env, descP, backlog); #endif // if defined(__WIN32__) } @@ -5585,9 +5589,9 @@ ERL_NIF_TERM nif_listen(ErlNifEnv* env, #if !defined(__WIN32__) static -ERL_NIF_TERM nlisten(ErlNifEnv* env, - ESockDescriptor* descP, - int backlog) +ERL_NIF_TERM esock_listen(ErlNifEnv* env, + ESockDescriptor* descP, + int backlog) { /* @@ -5677,7 +5681,7 @@ ERL_NIF_TERM nif_accept(ErlNifEnv* env, descP->currentAcceptor.env, descP->currentAcceptor.ref) ); - res = naccept(env, descP, sockRef, ref); + res = esock_accept(env, descP, sockRef, ref); MUNLOCK(descP->accMtx); @@ -5689,10 +5693,10 @@ ERL_NIF_TERM nif_accept(ErlNifEnv* env, #if !defined(__WIN32__) static -ERL_NIF_TERM naccept(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM sockRef, - ERL_NIF_TERM ref) +ERL_NIF_TERM esock_accept(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM sockRef, + ERL_NIF_TERM ref) { ERL_NIF_TERM res; @@ -5701,11 +5705,11 @@ ERL_NIF_TERM naccept(ErlNifEnv* env, switch (descP->state) { case SOCKET_STATE_LISTENING: - res = naccept_listening(env, descP, sockRef, ref); + res = esock_accept_listening(env, descP, sockRef, ref); break; case SOCKET_STATE_ACCEPTING: - res = naccept_accepting(env, descP, sockRef, ref); + res = esock_accept_accepting(env, descP, sockRef, ref); break; default: @@ -5718,16 +5722,16 @@ ERL_NIF_TERM naccept(ErlNifEnv* env, #endif // if !defined(__WIN32__) -/* *** naccept_listening *** +/* *** esock_accept_listening *** * * We have no active acceptor (and therefor no acceptors in queue). */ #if !defined(__WIN32__) static -ERL_NIF_TERM naccept_listening(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM sockRef, - ERL_NIF_TERM accRef) +ERL_NIF_TERM esock_accept_listening(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM sockRef, + ERL_NIF_TERM accRef) { ESockAddress remote; unsigned int n; @@ -5736,14 +5740,14 @@ ERL_NIF_TERM naccept_listening(ErlNifEnv* env, ErlNifPid caller; ERL_NIF_TERM res; - SSDBG( descP, ("SOCKET", "naccept_listening -> get caller\r\n") ); + SSDBG( descP, ("SOCKET", "esock_accept_listening -> get caller\r\n") ); if (enif_self(env, &caller) == NULL) return esock_make_error(env, atom_exself); n = sizeof(remote); sys_memzero((char *) &remote, n); - SSDBG( descP, ("SOCKET", "naccept_listening -> try accept\r\n") ); + SSDBG( descP, ("SOCKET", "esock_accept_listening -> try accept\r\n") ); accSock = sock_accept(descP->sock, (struct sockaddr*) &remote, &n); if (accSock == INVALID_SOCKET) { @@ -5751,10 +5755,11 @@ ERL_NIF_TERM naccept_listening(ErlNifEnv* env, SSDBG( descP, ("SOCKET", - "naccept_listening -> accept failed (%d)\r\n", save_errno) ); + "esock_accept_listening -> accept failed (%d)\r\n", + save_errno) ); - res = naccept_listening_error(env, descP, sockRef, accRef, - caller, save_errno); + res = esock_accept_listening_error(env, descP, sockRef, accRef, + caller, save_errno); } else { @@ -5762,9 +5767,9 @@ ERL_NIF_TERM naccept_listening(ErlNifEnv* env, * We got one */ - SSDBG( descP, ("SOCKET", "naccept_listening -> success\r\n") ); + SSDBG( descP, ("SOCKET", "esock_accept_listening -> success\r\n") ); - res = naccept_listening_accept(env, descP, accSock, caller, &remote); + res = esock_accept_listening_accept(env, descP, accSock, caller, &remote); } @@ -5772,7 +5777,7 @@ ERL_NIF_TERM naccept_listening(ErlNifEnv* env, } -/* *** naccept_listening_error *** +/* *** esock_accept_listening_error *** * * The accept call resultet in an error - handle it. * There are only two cases: @@ -5780,12 +5785,12 @@ ERL_NIF_TERM naccept_listening(ErlNifEnv* env, * 2) Other => Return the value (converted to an atom) */ static -ERL_NIF_TERM naccept_listening_error(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM sockRef, - ERL_NIF_TERM accRef, - ErlNifPid caller, - int save_errno) +ERL_NIF_TERM esock_accept_listening_error(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM sockRef, + ERL_NIF_TERM accRef, + ErlNifPid caller, + int save_errno) { ERL_NIF_TERM res; @@ -5794,10 +5799,10 @@ ERL_NIF_TERM naccept_listening_error(ErlNifEnv* env, /* *** Try again later *** */ SSDBG( descP, - ("SOCKET", "naccept_listening_error -> would block\r\n") ); + ("SOCKET", "esock_accept_listening_error -> would block\r\n") ); descP->currentAcceptor.pid = caller; - if (MONP("naccept_listening -> current acceptor", + if (MONP("esock_accept_listening -> current acceptor", env, descP, &descP->currentAcceptor.pid, &descP->currentAcceptor.mon) != 0) { @@ -5809,14 +5814,14 @@ ERL_NIF_TERM naccept_listening_error(ErlNifEnv* env, descP->currentAcceptor.ref = CP_TERM(descP->currentAcceptor.env, accRef); descP->currentAcceptorP = &descP->currentAcceptor; - res = naccept_busy_retry(env, descP, - sockRef, accRef, - NULL, SOCKET_STATE_ACCEPTING); + res = esock_accept_busy_retry(env, descP, + sockRef, accRef, + NULL, SOCKET_STATE_ACCEPTING); } } else { SSDBG( descP, ("SOCKET", - "naccept_listening -> errno: %d\r\n", save_errno) ); + "esock_accept_listening -> errno: %d\r\n", save_errno) ); res = esock_make_error_errno(env, save_errno); } @@ -5824,20 +5829,20 @@ ERL_NIF_TERM naccept_listening_error(ErlNifEnv* env, } -/* *** naccept_listening_accept *** +/* *** esock_accept_listening_accept *** * * The accept call was successful (accepted) - handle the new connection. */ static -ERL_NIF_TERM naccept_listening_accept(ErlNifEnv* env, - ESockDescriptor* descP, - SOCKET accSock, - ErlNifPid caller, - ESockAddress* remote) +ERL_NIF_TERM esock_accept_listening_accept(ErlNifEnv* env, + ESockDescriptor* descP, + SOCKET accSock, + ErlNifPid caller, + ESockAddress* remote) { ERL_NIF_TERM res; - naccept_accepted(env, descP, accSock, caller, remote, &res); + esock_accept_accepted(env, descP, accSock, caller, remote, &res); return res; } @@ -5845,7 +5850,7 @@ ERL_NIF_TERM naccept_listening_accept(ErlNifEnv* env, -/* *** naccept_accepting *** +/* *** esock_accept_accepting *** * * We have an active acceptor and possibly acceptors waiting in queue. * If the pid of the calling process is not the pid of the "current process", @@ -5853,20 +5858,20 @@ ERL_NIF_TERM naccept_listening_accept(ErlNifEnv* env, */ #if !defined(__WIN32__) static -ERL_NIF_TERM naccept_accepting(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM sockRef, - ERL_NIF_TERM ref) +ERL_NIF_TERM esock_accept_accepting(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM sockRef, + ERL_NIF_TERM ref) { ErlNifPid caller; ERL_NIF_TERM res; - SSDBG( descP, ("SOCKET", "naccept_accepting -> get caller\r\n") ); + SSDBG( descP, ("SOCKET", "esock_accept_accepting -> get caller\r\n") ); if (enif_self(env, &caller) == NULL) return esock_make_error(env, atom_exself); - SSDBG( descP, ("SOCKET", "naccept_accepting -> check: " + SSDBG( descP, ("SOCKET", "esock_accept_accepting -> check: " "are caller current acceptor:" "\r\n Caller: %T" "\r\n Current: %T" @@ -5875,18 +5880,19 @@ ERL_NIF_TERM naccept_accepting(ErlNifEnv* env, if (COMPARE_PIDS(&descP->currentAcceptor.pid, &caller) == 0) { SSDBG( descP, - ("SOCKET", "naccept_accepting -> current acceptor\r\n") ); + ("SOCKET", "esock_accept_accepting -> current acceptor\r\n") ); - res = naccept_accepting_current(env, descP, sockRef, ref); + res = esock_accept_accepting_current(env, descP, sockRef, ref); } else { /* Not the "current acceptor", so (maybe) push onto queue */ SSDBG( descP, - ("SOCKET", "naccept_accepting -> *not* current acceptor\r\n") ); + ("SOCKET", + "esock_accept_accepting -> *not* current acceptor\r\n") ); - res = naccept_accepting_other(env, descP, ref, caller); + res = esock_accept_accepting_other(env, descP, ref, caller); } @@ -5896,14 +5902,14 @@ ERL_NIF_TERM naccept_accepting(ErlNifEnv* env, -/* *** naccept_accepting_current *** +/* *** esock_accept_accepting_current *** * Handles when the current acceptor makes another attempt. */ static -ERL_NIF_TERM naccept_accepting_current(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM sockRef, - ERL_NIF_TERM accRef) +ERL_NIF_TERM esock_accept_accepting_current(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM sockRef, + ERL_NIF_TERM accRef) { ESockAddress remote; unsigned int n; @@ -5911,7 +5917,8 @@ ERL_NIF_TERM naccept_accepting_current(ErlNifEnv* env, int save_errno; ERL_NIF_TERM res; - SSDBG( descP, ("SOCKET", "naccept_accepting_current -> try accept\r\n") ); + SSDBG( descP, ("SOCKET", + "esock_accept_accepting_current -> try accept\r\n") ); n = sizeof(descP->remote); sys_memzero((char *) &remote, n); accSock = sock_accept(descP->sock, (struct sockaddr*) &remote, &n); @@ -5921,18 +5928,19 @@ ERL_NIF_TERM naccept_accepting_current(ErlNifEnv* env, SSDBG( descP, ("SOCKET", - "naccept_accepting_current -> accept failed: %d\r\n", + "esock_accept_accepting_current -> accept failed: %d\r\n", save_errno) ); - res = naccept_accepting_current_error(env, descP, sockRef, - accRef, save_errno); + res = esock_accept_accepting_current_error(env, descP, sockRef, + accRef, save_errno); } else { - SSDBG( descP, ("SOCKET", "naccept_accepting_current -> accepted\r\n") ); + SSDBG( descP, ("SOCKET", + "esock_accept_accepting_current -> accepted\r\n") ); - res = naccept_accepting_current_accept(env, descP, sockRef, - accSock, &remote); + res = esock_accept_accepting_current_accept(env, descP, sockRef, + accSock, &remote); } @@ -5940,27 +5948,27 @@ ERL_NIF_TERM naccept_accepting_current(ErlNifEnv* env, } -/* *** naccept_accepting_current_accept *** +/* *** esock_accept_accepting_current_accept *** * Handles when the current acceptor succeeded in its accept call - * handle the new connection. */ static -ERL_NIF_TERM naccept_accepting_current_accept(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM sockRef, - SOCKET accSock, - ESockAddress* remote) +ERL_NIF_TERM esock_accept_accepting_current_accept(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM sockRef, + SOCKET accSock, + ESockAddress* remote) { ERL_NIF_TERM res; - if (naccept_accepted(env, descP, accSock, - descP->currentAcceptor.pid, remote, &res)) { + if (esock_accept_accepted(env, descP, accSock, + descP->currentAcceptor.pid, remote, &res)) { /* Clean out the old cobweb's before trying to invite a new spider */ descP->currentAcceptor.ref = esock_atom_undefined; enif_set_pid_undefined(&descP->currentAcceptor.pid); - esock_free_env("naccept_accepting_current_accept - " + esock_free_env("esock_accept_accepting_current_accept - " "current-accept-env", descP->currentAcceptor.env); descP->currentAcceptor.env = NULL; @@ -5969,7 +5977,7 @@ ERL_NIF_TERM naccept_accepting_current_accept(ErlNifEnv* env, SSDBG( descP, ("SOCKET", - "naccept_accepting_current_accept -> " + "esock_accept_accepting_current_accept -> " "no more writers\r\n") ); descP->state = SOCKET_STATE_LISTENING; @@ -5986,18 +5994,18 @@ ERL_NIF_TERM naccept_accepting_current_accept(ErlNifEnv* env, } -/* *** naccept_accepting_current_error *** +/* *** esock_accept_accepting_current_error *** * The accept call of current acceptor resultet in an error - handle it. * There are only two cases: * 1) BLOCK => Attempt a "retry" * 2) Other => Return the value (converted to an atom) */ static -ERL_NIF_TERM naccept_accepting_current_error(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM sockRef, - ERL_NIF_TERM opRef, - int save_errno) +ERL_NIF_TERM esock_accept_accepting_current_error(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM sockRef, + ERL_NIF_TERM opRef, + int save_errno) { ESockRequestor req; ERL_NIF_TERM res, reason; @@ -6011,13 +6019,13 @@ ERL_NIF_TERM naccept_accepting_current_error(ErlNifEnv* env, SSDBG( descP, ("SOCKET", - "naccept_accepting_current_error -> " + "esock_accept_accepting_current_error -> " "would block: try again\r\n") ); - res = naccept_busy_retry(env, descP, sockRef, opRef, - &descP->currentAcceptor.pid, - /* No state change */ - descP->state); + res = esock_accept_busy_retry(env, descP, sockRef, opRef, + &descP->currentAcceptor.pid, + /* No state change */ + descP->state); } else { @@ -6026,12 +6034,13 @@ ERL_NIF_TERM naccept_accepting_current_error(ErlNifEnv* env, while (acceptor_pop(env, descP, &req)) { SSDBG( descP, - ("SOCKET", "naccept_accepting_current_error -> abort %T\r\n", + ("SOCKET", + "esock_accept_accepting_current_error -> abort %T\r\n", req.pid) ); esock_send_abort_msg(env, sockRef, req.ref, req.env, reason, &req.pid); req.env = NULL; - DEMONP("naccept_accepting_current_error -> pop'ed writer", + DEMONP("esock_accept_accepting_current_error -> pop'ed writer", env, descP, &req.mon); } @@ -6041,16 +6050,16 @@ ERL_NIF_TERM naccept_accepting_current_error(ErlNifEnv* env, } -/* *** naccept_accepting_other *** +/* *** esock_accept_accepting_other *** * Handles when the another acceptor makes an attempt, which * results (maybe) in the request beeing pushed onto the * acceptor queue. */ static -ERL_NIF_TERM naccept_accepting_other(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM ref, - ErlNifPid caller) +ERL_NIF_TERM esock_accept_accepting_other(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM ref, + ErlNifPid caller) { ERL_NIF_TERM result; @@ -6065,18 +6074,18 @@ ERL_NIF_TERM naccept_accepting_other(ErlNifEnv* env, -/* *** naccept_busy_retry *** +/* *** esock_accept_busy_retry *** * * Perform a retry select. If successful, set nextState. */ #if !defined(__WIN32__) static -ERL_NIF_TERM naccept_busy_retry(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM sockRef, - ERL_NIF_TERM accRef, - ErlNifPid* pid, - unsigned int nextState) +ERL_NIF_TERM esock_accept_busy_retry(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM sockRef, + ERL_NIF_TERM accRef, + ErlNifPid* pid, + unsigned int nextState) { int sres; ERL_NIF_TERM res, reason; @@ -6095,17 +6104,17 @@ ERL_NIF_TERM naccept_busy_retry(ErlNifEnv* env, -/* *** naccept_accepted *** +/* *** esock_accept_accepted *** * * Generic function handling a successful accept. */ static -BOOLEAN_T naccept_accepted(ErlNifEnv* env, - ESockDescriptor* descP, - SOCKET accSock, - ErlNifPid pid, - ESockAddress* remote, - ERL_NIF_TERM* result) +BOOLEAN_T esock_accept_accepted(ErlNifEnv* env, + ESockDescriptor* descP, + SOCKET accSock, + ErlNifPid pid, + ESockAddress* remote, + ERL_NIF_TERM* result) { ESockDescriptor* accDescP; HANDLE accEvent; @@ -6143,7 +6152,7 @@ BOOLEAN_T naccept_accepted(ErlNifEnv* env, enif_release_resource(accDescP); accDescP->ctrlPid = pid; - if (MONP("naccept_accepted -> ctrl", + if (MONP("esock_accept_accepted -> ctrl", env, accDescP, &accDescP->ctrlPid, &accDescP->ctrlMon) != 0) { @@ -6234,7 +6243,7 @@ ERL_NIF_TERM nif_send(ErlNifEnv* env, * is done! */ - res = nsend(env, descP, sockRef, sendRef, &sndData, flags); + res = esock_send(env, descP, sockRef, sendRef, &sndData, flags); MUNLOCK(descP->writeMtx); @@ -6245,7 +6254,7 @@ ERL_NIF_TERM nif_send(ErlNifEnv* env, -/* *** nsend *** +/* *** esock_send *** * * Do the actual send. * Do some initial writer checks, do the actual send and then @@ -6254,12 +6263,12 @@ ERL_NIF_TERM nif_send(ErlNifEnv* env, */ #if !defined(__WIN32__) static -ERL_NIF_TERM nsend(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM sockRef, - ERL_NIF_TERM sendRef, - ErlNifBinary* sndDataP, - int flags) +ERL_NIF_TERM esock_send(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM sockRef, + ERL_NIF_TERM sendRef, + ErlNifBinary* sndDataP, + int flags) { int save_errno; ssize_t written; @@ -6369,8 +6378,8 @@ ERL_NIF_TERM nif_sendto(ErlNifEnv* env, MLOCK(descP->writeMtx); - res = nsendto(env, descP, sockRef, sendRef, &sndData, flags, - &remoteAddr, remoteAddrLen); + res = esock_sendto(env, descP, sockRef, sendRef, &sndData, flags, + &remoteAddr, remoteAddrLen); MUNLOCK(descP->writeMtx); @@ -6386,14 +6395,14 @@ ERL_NIF_TERM nif_sendto(ErlNifEnv* env, #if !defined(__WIN32__) static -ERL_NIF_TERM nsendto(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM sockRef, - ERL_NIF_TERM sendRef, - ErlNifBinary* dataP, - int flags, - ESockAddress* toAddrP, - unsigned int toAddrLen) +ERL_NIF_TERM esock_sendto(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM sockRef, + ERL_NIF_TERM sendRef, + ErlNifBinary* dataP, + int flags, + ESockAddress* toAddrP, + unsigned int toAddrLen) { int save_errno; ssize_t written; @@ -6489,7 +6498,7 @@ ERL_NIF_TERM nif_sendmsg(ErlNifEnv* env, MLOCK(descP->writeMtx); - res = nsendmsg(env, descP, sockRef, sendRef, eMsgHdr, flags); + res = esock_sendmsg(env, descP, sockRef, sendRef, eMsgHdr, flags); MUNLOCK(descP->writeMtx); @@ -6506,12 +6515,12 @@ ERL_NIF_TERM nif_sendmsg(ErlNifEnv* env, #if !defined(__WIN32__) static -ERL_NIF_TERM nsendmsg(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM sockRef, - ERL_NIF_TERM sendRef, - ERL_NIF_TERM eMsgHdr, - int flags) +ERL_NIF_TERM esock_sendmsg(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM sockRef, + ERL_NIF_TERM sendRef, + ERL_NIF_TERM eMsgHdr, + int flags) { ERL_NIF_TERM res, eAddr, eIOV, eCtrl; ESockAddress addr; @@ -6540,7 +6549,8 @@ ERL_NIF_TERM nsendmsg(ErlNifEnv* env, /* We don't need the address */ - SSDBG( descP, ("SOCKET", "nsendmsg -> connected: no address\r\n") ); + SSDBG( descP, ("SOCKET", + "esock_sendmsg -> connected: no address\r\n") ); msgHdr.msg_name = NULL; msgHdr.msg_namelen = 0; @@ -6555,7 +6565,7 @@ ERL_NIF_TERM nsendmsg(ErlNifEnv* env, if (!GET_MAP_VAL(env, eMsgHdr, esock_atom_addr, &eAddr)) return esock_make_error(env, esock_atom_einval); - SSDBG( descP, ("SOCKET", "nsendmsg -> not connected: " + SSDBG( descP, ("SOCKET", "esock_sendmsg -> not connected: " "\r\n address: %T" "\r\n", eAddr) ); @@ -6575,7 +6585,7 @@ ERL_NIF_TERM nsendmsg(ErlNifEnv* env, if (!GET_LIST_LEN(env, eIOV, &iovLen) && (iovLen > 0)) return esock_make_error(env, esock_atom_einval); - SSDBG( descP, ("SOCKET", "nsendmsg -> iov length: %d\r\n", iovLen) ); + SSDBG( descP, ("SOCKET", "esock_sendmsg -> iov length: %d\r\n", iovLen) ); iovBins = MALLOC(iovLen * sizeof(ErlNifBinary)); ESOCK_ASSERT( (iovBins != NULL) ); @@ -6593,7 +6603,7 @@ ERL_NIF_TERM nsendmsg(ErlNifEnv* env, ctrlBufLen = 0; ctrlBuf = NULL; } - SSDBG( descP, ("SOCKET", "nsendmsg -> optional ctrl: " + SSDBG( descP, ("SOCKET", "esock_sendmsg -> optional ctrl: " "\r\n ctrlBuf: 0x%lX" "\r\n ctrlBufLen: %d" "\r\n eCtrl: %T\r\n", ctrlBuf, ctrlBufLen, eCtrl) ); @@ -6611,7 +6621,8 @@ ERL_NIF_TERM nsendmsg(ErlNifEnv* env, SSDBG( descP, ("SOCKET", - "nsendmsg -> total (iov) data size: %d\r\n", dataSize) ); + "esock_sendmsg -> " + "total (iov) data size: %d\r\n", dataSize) ); /* Decode the ctrl and initiate that part of the msghdr. @@ -6789,7 +6800,7 @@ ERL_NIF_TERM nif_recv(ErlNifEnv* env, * is done! */ - res = nrecv(env, descP, sockRef, recvRef, len, flags); + res = esock_recv(env, descP, sockRef, recvRef, len, flags); MUNLOCK(descP->readMtx); @@ -6806,12 +6817,12 @@ ERL_NIF_TERM nif_recv(ErlNifEnv* env, */ #if !defined(__WIN32__) static -ERL_NIF_TERM nrecv(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM sockRef, - ERL_NIF_TERM recvRef, - int len, - int flags) +ERL_NIF_TERM esock_recv(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM sockRef, + ERL_NIF_TERM recvRef, + int len, + int flags) { ssize_t read; ErlNifBinary buf; @@ -6819,7 +6830,7 @@ ERL_NIF_TERM nrecv(ErlNifEnv* env, int save_errno; int bufSz = (len ? len : descP->rBufSz); - SSDBG( descP, ("SOCKET", "nrecv -> entry with" + SSDBG( descP, ("SOCKET", "esock_recv -> entry with" "\r\n len: %d (%d:%d)" "\r\n flags: %d" "\r\n", len, descP->rNumCnt, bufSz, flags) ); @@ -6842,7 +6853,7 @@ ERL_NIF_TERM nrecv(ErlNifEnv* env, SOCK_CNT_INC(env, descP, sockRef, atom_read_tries, &descP->readTries, 1); // If it fails (read = -1), we need errno... - SSDBG( descP, ("SOCKET", "nrecv -> try read (%d)\r\n", buf.size) ); + SSDBG( descP, ("SOCKET", "esock_recv -> try read (%d)\r\n", buf.size) ); read = sock_recv(descP->sock, buf.data, buf.size, flags); if (IS_SOCKET_ERROR(read)) { save_errno = sock_errno(); @@ -6850,7 +6861,8 @@ ERL_NIF_TERM nrecv(ErlNifEnv* env, save_errno = -1; // The value does not actually matter in this case } - SSDBG( descP, ("SOCKET", "nrecv -> read: %d (%d)\r\n", read, save_errno) ); + SSDBG( descP, ("SOCKET", + "esock_recv -> read: %d (%d)\r\n", read, save_errno) ); return recv_check_result(env, descP, read, len, @@ -6951,7 +6963,7 @@ ERL_NIF_TERM nif_recvfrom(ErlNifEnv* env, * */ - res = nrecvfrom(env, descP, sockRef, recvRef, bufSz, flags); + res = esock_recvfrom(env, descP, sockRef, recvRef, bufSz, flags); MUNLOCK(descP->readMtx); @@ -6967,12 +6979,12 @@ ERL_NIF_TERM nif_recvfrom(ErlNifEnv* env, */ #if !defined(__WIN32__) static -ERL_NIF_TERM nrecvfrom(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM sockRef, - ERL_NIF_TERM recvRef, - Uint16 len, - int flags) +ERL_NIF_TERM esock_recvfrom(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM sockRef, + ERL_NIF_TERM recvRef, + Uint16 len, + int flags) { ESockAddress fromAddr; unsigned int addrLen; @@ -6982,7 +6994,7 @@ ERL_NIF_TERM nrecvfrom(ErlNifEnv* env, ERL_NIF_TERM readerCheck; int bufSz = (len ? len : descP->rBufSz); - SSDBG( descP, ("SOCKET", "nrecvfrom -> entry with" + SSDBG( descP, ("SOCKET", "esock_recvfrom -> entry with" "\r\n len: %d (%d)" "\r\n flags: %d" "\r\n", len, bufSz, flags) ); @@ -7121,7 +7133,7 @@ ERL_NIF_TERM nif_recvmsg(ErlNifEnv* env, * */ - res = nrecvmsg(env, descP, sockRef, recvRef, bufSz, ctrlSz, flags); + res = esock_recvmsg(env, descP, sockRef, recvRef, bufSz, ctrlSz, flags); MUNLOCK(descP->readMtx); @@ -7137,13 +7149,13 @@ ERL_NIF_TERM nif_recvmsg(ErlNifEnv* env, */ #if !defined(__WIN32__) static -ERL_NIF_TERM nrecvmsg(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM sockRef, - ERL_NIF_TERM recvRef, - Uint16 bufLen, - Uint16 ctrlLen, - int flags) +ERL_NIF_TERM esock_recvmsg(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM sockRef, + ERL_NIF_TERM recvRef, + Uint16 bufLen, + Uint16 ctrlLen, + int flags) { unsigned int addrLen; ssize_t read; @@ -7157,7 +7169,7 @@ ERL_NIF_TERM nrecvmsg(ErlNifEnv* env, ERL_NIF_TERM readerCheck; ESockAddress addr; - SSDBG( descP, ("SOCKET", "nrecvmsg -> entry with" + SSDBG( descP, ("SOCKET", "esock_recvmsg -> entry with" "\r\n bufSz: %d (%d)" "\r\n ctrlSz: %d (%d)" "\r\n flags: %d" @@ -7253,21 +7265,21 @@ ERL_NIF_TERM nif_close(ErlNifEnv* env, if (IS_CLOSED(descP) || IS_CLOSING(descP)) return esock_make_error(env, atom_closed); - return nclose(env, descP); + return esock_close(env, descP); #endif // if defined(__WIN32__) } #if !defined(__WIN32__) static -ERL_NIF_TERM nclose(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_close(ErlNifEnv* env, + ESockDescriptor* descP) { ERL_NIF_TERM reply, reason; BOOLEAN_T doClose; SSDBG( descP, ("SOCKET", - "nclose -> [%d] entry (0x%lX, 0x%lX, 0x%lX, 0x%lX)\r\n", + "esock_close -> [%d] entry (0x%lX, 0x%lX, 0x%lX, 0x%lX)\r\n", descP->sock, descP->state, descP->currentWriterP, @@ -7276,10 +7288,10 @@ ERL_NIF_TERM nclose(ErlNifEnv* env, MLOCK(descP->closeMtx); - doClose = nclose_check(env, descP, &reason); + doClose = esock_close_check(env, descP, &reason); if (doClose) { - reply = nclose_do(env, descP); + reply = esock_close_do(env, descP); } else { reply = esock_make_error(env, reason); } @@ -7287,7 +7299,7 @@ ERL_NIF_TERM nclose(ErlNifEnv* env, MUNLOCK(descP->closeMtx); SSDBG( descP, - ("SOCKET", "nclose -> [%d] done when: " + ("SOCKET", "esock_close -> [%d] done when: " "\r\n state: 0x%lX" "\r\n reply: %T" "\r\n", descP->sock, descP->state, reply) ); @@ -7297,14 +7309,14 @@ ERL_NIF_TERM nclose(ErlNifEnv* env, -/* *** nclose_check *** +/* *** esock_close_check *** * * Check if we should try to perform the first stage close. */ static -BOOLEAN_T nclose_check(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM* reason) +BOOLEAN_T esock_close_check(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM* reason) { BOOLEAN_T doClose; @@ -7343,7 +7355,7 @@ BOOLEAN_T nclose_check(ErlNifEnv* env, * */ - if (MONP("nclose_check -> closer", + if (MONP("esock_close_check -> closer", env, descP, &descP->closerPid, &descP->closerMon) != 0) { @@ -7370,13 +7382,13 @@ BOOLEAN_T nclose_check(ErlNifEnv* env, -/* *** nclose_do *** +/* *** esock_close_do *** * * Perform (do) the first stage close. */ static -ERL_NIF_TERM nclose_do(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_close_do(ErlNifEnv* env, + ESockDescriptor* descP) { int domain = descP->domain; int type = descP->type; @@ -7384,7 +7396,7 @@ ERL_NIF_TERM nclose_do(ErlNifEnv* env, int sres; ERL_NIF_TERM reply, reason; - descP->closeEnv = esock_alloc_env("nclose-do - close-env"); + descP->closeEnv = esock_alloc_env("esock_close_do - close-env"); descP->closeRef = MKREF(descP->closeEnv); sres = esock_select_stop(env, descP->sock, descP); @@ -7393,7 +7405,8 @@ ERL_NIF_TERM nclose_do(ErlNifEnv* env, /* Prep done - inform the caller it can finalize (close) directly */ SSDBG( descP, - ("SOCKET", "nclose -> [%d] stop was called\r\n", descP->sock) ); + ("SOCKET", + "esock_close -> [%d] stop was called\r\n", descP->sock) ); dec_socket(domain, type, protocol); reply = esock_atom_ok; @@ -7403,7 +7416,7 @@ ERL_NIF_TERM nclose_do(ErlNifEnv* env, /* The stop callback function has been *scheduled* which means that we * have to wait for it to complete. */ SSDBG( descP, - ("SOCKET", "nclose -> [%d] stop was scheduled\r\n", + ("SOCKET", "esock_close -> [%d] stop was scheduled\r\n", descP->sock) ); dec_socket(domain, type, protocol); // SHALL WE DO THIS AT finalize? @@ -7412,7 +7425,7 @@ ERL_NIF_TERM nclose_do(ErlNifEnv* env, } else { SSDBG( descP, - ("SOCKET", "nclose -> [%d] stop failed: %d\r\n", + ("SOCKET", "esock_close -> [%d] stop failed: %d\r\n", descP->sock, sres) ); /* @@ -7426,7 +7439,7 @@ ERL_NIF_TERM nclose_do(ErlNifEnv* env, */ // Do we need this? - DEMONP("nclose_do -> closer", env, descP, &descP->closerMon); + DEMONP("esock_close_do -> closer", env, descP, &descP->closerMon); reason = MKT2(env, esock_atom_select_failed, MKI(env, sres)); reply = esock_make_error(env, reason); @@ -7468,18 +7481,18 @@ ERL_NIF_TERM nif_finalize_close(ErlNifEnv* env, return enif_make_badarg(env); } - return nfinalize_close(env, descP); + return esock_finalize_close(env, descP); #endif // if defined(__WIN32__) } -/* *** nfinalize_close *** +/* *** esock_finalize_close *** * Perform the final step in the socket close. */ #if !defined(__WIN32__) static -ERL_NIF_TERM nfinalize_close(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_finalize_close(ErlNifEnv* env, + ESockDescriptor* descP) { ERL_NIF_TERM reply; @@ -7559,7 +7572,7 @@ ERL_NIF_TERM nif_shutdown(ErlNifEnv* env, if (!ehow2how(ehow, &how)) return enif_make_badarg(env); - return nshutdown(env, descP, how); + return esock_shutdown(env, descP, how); #endif // if defined(__WIN32__) } @@ -7567,9 +7580,9 @@ ERL_NIF_TERM nif_shutdown(ErlNifEnv* env, #if !defined(__WIN32__) static -ERL_NIF_TERM nshutdown(ErlNifEnv* env, - ESockDescriptor* descP, - int how) +ERL_NIF_TERM esock_shutdown(ErlNifEnv* env, + ESockDescriptor* descP, + int how) { ERL_NIF_TERM reply; @@ -7674,7 +7687,7 @@ ERL_NIF_TERM nif_setopt(ErlNifEnv* env, MLOCK(descP->cfgMtx); - result = nsetopt(env, descP, isEncoded, isOTP, level, eOpt, eVal); + result = esock_setopt(env, descP, isEncoded, isOTP, level, eOpt, eVal); MUNLOCK(descP->cfgMtx); @@ -7691,13 +7704,13 @@ ERL_NIF_TERM nif_setopt(ErlNifEnv* env, #if !defined(__WIN32__) static -ERL_NIF_TERM nsetopt(ErlNifEnv* env, - ESockDescriptor* descP, - BOOLEAN_T isEncoded, - BOOLEAN_T isOTP, - int level, - int eOpt, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt(ErlNifEnv* env, + ESockDescriptor* descP, + BOOLEAN_T isEncoded, + BOOLEAN_T isOTP, + int level, + int eOpt, + ERL_NIF_TERM eVal) { ERL_NIF_TERM result; @@ -7705,11 +7718,11 @@ ERL_NIF_TERM nsetopt(ErlNifEnv* env, /* These are not actual socket options, * but options for our implementation. */ - result = nsetopt_otp(env, descP, eOpt, eVal); + result = esock_setopt_otp(env, descP, eOpt, eVal); } else if (!isEncoded) { - result = nsetopt_native(env, descP, level, eOpt, eVal); + result = esock_setopt_native(env, descP, level, eOpt, eVal); } else { - result = nsetopt_level(env, descP, level, eOpt, eVal); + result = esock_setopt_level(env, descP, level, eOpt, eVal); } return result; @@ -7717,45 +7730,45 @@ ERL_NIF_TERM nsetopt(ErlNifEnv* env, -/* nsetopt_otp - Handle OTP (level) options +/* esock_setopt_otp - Handle OTP (level) options */ static -ERL_NIF_TERM nsetopt_otp(ErlNifEnv* env, - ESockDescriptor* descP, - int eOpt, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_otp(ErlNifEnv* env, + ESockDescriptor* descP, + int eOpt, + ERL_NIF_TERM eVal) { ERL_NIF_TERM result; SSDBG( descP, - ("SOCKET", "nsetopt_otp -> entry with" + ("SOCKET", "esock_setopt_otp -> entry with" "\r\n eOpt: %d" "\r\n eVal: %T" "\r\n", eOpt, eVal) ); switch (eOpt) { case SOCKET_OPT_OTP_DEBUG: - result = nsetopt_otp_debug(env, descP, eVal); + result = esock_setopt_otp_debug(env, descP, eVal); break; case SOCKET_OPT_OTP_IOW: - result = nsetopt_otp_iow(env, descP, eVal); + result = esock_setopt_otp_iow(env, descP, eVal); break; case SOCKET_OPT_OTP_CTRL_PROC: - result = nsetopt_otp_ctrl_proc(env, descP, eVal); + result = esock_setopt_otp_ctrl_proc(env, descP, eVal); break; case SOCKET_OPT_OTP_RCVBUF: - result = nsetopt_otp_rcvbuf(env, descP, eVal); + result = esock_setopt_otp_rcvbuf(env, descP, eVal); break; case SOCKET_OPT_OTP_RCVCTRLBUF: - result = nsetopt_otp_rcvctrlbuf(env, descP, eVal); + result = esock_setopt_otp_rcvctrlbuf(env, descP, eVal); break; case SOCKET_OPT_OTP_SNDCTRLBUF: - result = nsetopt_otp_sndctrlbuf(env, descP, eVal); + result = esock_setopt_otp_sndctrlbuf(env, descP, eVal); break; default: @@ -7767,12 +7780,12 @@ ERL_NIF_TERM nsetopt_otp(ErlNifEnv* env, } -/* nsetopt_otp_debug - Handle the OTP (level) debug options +/* esock_setopt_otp_debug - Handle the OTP (level) debug options */ static -ERL_NIF_TERM nsetopt_otp_debug(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_otp_debug(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { descP->dbg = esock_decode_bool(eVal); @@ -7780,12 +7793,12 @@ ERL_NIF_TERM nsetopt_otp_debug(ErlNifEnv* env, } -/* nsetopt_otp_iow - Handle the OTP (level) iow options +/* esock_setopt_otp_iow - Handle the OTP (level) iow options */ static -ERL_NIF_TERM nsetopt_otp_iow(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_otp_iow(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { descP->iow = esock_decode_bool(eVal); @@ -7794,19 +7807,20 @@ ERL_NIF_TERM nsetopt_otp_iow(ErlNifEnv* env, -/* nsetopt_otp_ctrl_proc - Handle the OTP (level) controlling_process options +/* esock_setopt_otp_ctrl_proc - Handle the OTP (level) + * controlling_process options */ static -ERL_NIF_TERM nsetopt_otp_ctrl_proc(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_otp_ctrl_proc(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { ErlNifPid caller, newCtrlPid; ESockMonitor newCtrlMon; int xres; SSDBG( descP, - ("SOCKET", "nsetopt_otp_ctrl_proc -> entry with" + ("SOCKET", "esock_setopt_otp_ctrl_proc -> entry with" "\r\n eVal: %T" "\r\n", eVal) ); @@ -7815,7 +7829,8 @@ ERL_NIF_TERM nsetopt_otp_ctrl_proc(ErlNifEnv* env, return esock_make_error(env, atom_exself); if (COMPARE_PIDS(&descP->ctrlPid, &caller) != 0) { - SSDBG( descP, ("SOCKET", "nsetopt_otp_ctrl_proc -> not owner (%T)\r\n", + SSDBG( descP, ("SOCKET", + "esock_setopt_otp_ctrl_proc -> not owner (%T)\r\n", descP->ctrlPid) ); return esock_make_error(env, esock_atom_not_owner); } @@ -7825,13 +7840,14 @@ ERL_NIF_TERM nsetopt_otp_ctrl_proc(ErlNifEnv* env, return esock_make_error(env, esock_atom_einval); } - if ((xres = MONP("nsetopt_otp_ctrl_proc -> (new) ctrl", + if ((xres = MONP("esock_setopt_otp_ctrl_proc -> (new) ctrl", env, descP, &newCtrlPid, &newCtrlMon)) != 0) { - esock_warning_msg("Failed monitor %d) (new) controlling process\r\n", xres); + esock_warning_msg("Failed monitor (%d) (new) controlling process\r\n", + xres); return esock_make_error(env, esock_atom_einval); } - if ((xres = DEMONP("nsetopt_otp_ctrl_proc -> (old) ctrl", + if ((xres = DEMONP("esock_setopt_otp_ctrl_proc -> (old) ctrl", env, descP, &descP->ctrlMon)) != 0) { esock_warning_msg("Failed demonitor (%d) " "old controlling process %T (%T)\r\n", @@ -7841,14 +7857,14 @@ ERL_NIF_TERM nsetopt_otp_ctrl_proc(ErlNifEnv* env, descP->ctrlPid = newCtrlPid; descP->ctrlMon = newCtrlMon; - SSDBG( descP, ("SOCKET", "nsetopt_otp_ctrl_proc -> done\r\n") ); + SSDBG( descP, ("SOCKET", "esock_setopt_otp_ctrl_proc -> done\r\n") ); return esock_atom_ok; } -/* nsetopt_otp_rcvbuf - Handle the OTP (level) rcvbuf option +/* esock_setopt_otp_rcvbuf - Handle the OTP (level) rcvbuf option * The (otp) rcvbuf option is provided as: * * BufSz :: integer() | {N :: pos_integer(), BufSz :: pod_integer()} @@ -7856,9 +7872,9 @@ ERL_NIF_TERM nsetopt_otp_ctrl_proc(ErlNifEnv* env, * Where N is the max number of reads. */ static -ERL_NIF_TERM nsetopt_otp_rcvbuf(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_otp_rcvbuf(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { const ERL_NIF_TERM* t; // The array of the elements of the tuple int tsz; // The size of the tuple - should be 2 @@ -7908,12 +7924,12 @@ ERL_NIF_TERM nsetopt_otp_rcvbuf(ErlNifEnv* env, -/* nsetopt_otp_rcvctrlbuf - Handle the OTP (level) rcvctrlbuf option +/* esock_setopt_otp_rcvctrlbuf - Handle the OTP (level) rcvctrlbuf option */ static -ERL_NIF_TERM nsetopt_otp_rcvctrlbuf(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_otp_rcvctrlbuf(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { size_t val; char* xres; @@ -7931,12 +7947,12 @@ ERL_NIF_TERM nsetopt_otp_rcvctrlbuf(ErlNifEnv* env, -/* nsetopt_otp_sndctrlbuf - Handle the OTP (level) sndctrlbuf option +/* esock_setopt_otp_sndctrlbuf - Handle the OTP (level) sndctrlbuf option */ static -ERL_NIF_TERM nsetopt_otp_sndctrlbuf(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_otp_sndctrlbuf(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { size_t val; char* xres; @@ -7958,17 +7974,17 @@ ERL_NIF_TERM nsetopt_otp_sndctrlbuf(ErlNifEnv* env, * in "native mode" (option is provided as is and value as a binary). */ static -ERL_NIF_TERM nsetopt_native(ErlNifEnv* env, - ESockDescriptor* descP, - int level, - int opt, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_native(ErlNifEnv* env, + ESockDescriptor* descP, + int level, + int opt, + ERL_NIF_TERM eVal) { ErlNifBinary val; ERL_NIF_TERM result; SSDBG( descP, - ("SOCKET", "nsetopt_native -> entry with" + ("SOCKET", "esock_setopt_native -> entry with" "\r\n level: %d" "\r\n opt: %d" "\r\n eVal: %T" @@ -7986,7 +8002,7 @@ ERL_NIF_TERM nsetopt_native(ErlNifEnv* env, } SSDBG( descP, - ("SOCKET", "nsetopt_native -> done when" + ("SOCKET", "esock_setopt_native -> done when" "\r\n result: %T" "\r\n", result) ); @@ -7995,25 +8011,25 @@ ERL_NIF_TERM nsetopt_native(ErlNifEnv* env, -/* nsetopt_level - A "proper" level (option) has been specified +/* esock_setopt_level - A "proper" level (option) has been specified */ static -ERL_NIF_TERM nsetopt_level(ErlNifEnv* env, - ESockDescriptor* descP, - int level, - int eOpt, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_level(ErlNifEnv* env, + ESockDescriptor* descP, + int level, + int eOpt, + ERL_NIF_TERM eVal) { ERL_NIF_TERM result; SSDBG( descP, - ("SOCKET", "nsetopt_level -> entry with" + ("SOCKET", "esock_setopt_level -> entry with" "\r\n level: %d" "\r\n", level) ); switch (level) { case SOL_SOCKET: - result = nsetopt_lvl_socket(env, descP, eOpt, eVal); + result = esock_setopt_lvl_socket(env, descP, eOpt, eVal); break; #if defined(SOL_IP) @@ -8021,7 +8037,7 @@ ERL_NIF_TERM nsetopt_level(ErlNifEnv* env, #else case IPPROTO_IP: #endif - result = nsetopt_lvl_ip(env, descP, eOpt, eVal); + result = esock_setopt_lvl_ip(env, descP, eOpt, eVal); break; #if defined(HAVE_IPV6) @@ -8030,33 +8046,34 @@ ERL_NIF_TERM nsetopt_level(ErlNifEnv* env, #else case IPPROTO_IPV6: #endif - result = nsetopt_lvl_ipv6(env, descP, eOpt, eVal); + result = esock_setopt_lvl_ipv6(env, descP, eOpt, eVal); break; #endif case IPPROTO_TCP: - result = nsetopt_lvl_tcp(env, descP, eOpt, eVal); + result = esock_setopt_lvl_tcp(env, descP, eOpt, eVal); break; case IPPROTO_UDP: - result = nsetopt_lvl_udp(env, descP, eOpt, eVal); + result = esock_setopt_lvl_udp(env, descP, eOpt, eVal); break; #if defined(HAVE_SCTP) case IPPROTO_SCTP: - result = nsetopt_lvl_sctp(env, descP, eOpt, eVal); + result = esock_setopt_lvl_sctp(env, descP, eOpt, eVal); break; #endif default: SSDBG( descP, - ("SOCKET", "nsetopt_level -> unknown level (%d)\r\n", level) ); + ("SOCKET", + "esock_setopt_level -> unknown level (%d)\r\n", level) ); result = esock_make_error(env, esock_atom_einval); break; } SSDBG( descP, - ("SOCKET", "nsetopt_level -> done when" + ("SOCKET", "esock_setopt_level -> done when" "\r\n result: %T" "\r\n", result) ); @@ -8065,139 +8082,140 @@ ERL_NIF_TERM nsetopt_level(ErlNifEnv* env, -/* nsetopt_lvl_socket - Level *SOCKET* option +/* esock_setopt_lvl_socket - Level *SOCKET* option */ static -ERL_NIF_TERM nsetopt_lvl_socket(ErlNifEnv* env, - ESockDescriptor* descP, - int eOpt, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_socket(ErlNifEnv* env, + ESockDescriptor* descP, + int eOpt, + ERL_NIF_TERM eVal) { ERL_NIF_TERM result; SSDBG( descP, - ("SOCKET", "nsetopt_lvl_socket -> entry with" + ("SOCKET", "esock_setopt_lvl_socket -> entry with" "\r\n opt: %d" "\r\n", eOpt) ); switch (eOpt) { #if defined(SO_BINDTODEVICE) case SOCKET_OPT_SOCK_BINDTODEVICE: - result = nsetopt_lvl_sock_bindtodevice(env, descP, eVal); + result = esock_setopt_lvl_sock_bindtodevice(env, descP, eVal); break; #endif #if defined(SO_BROADCAST) case SOCKET_OPT_SOCK_BROADCAST: - result = nsetopt_lvl_sock_broadcast(env, descP, eVal); + result = esock_setopt_lvl_sock_broadcast(env, descP, eVal); break; #endif #if defined(SO_DEBUG) case SOCKET_OPT_SOCK_DEBUG: - result = nsetopt_lvl_sock_debug(env, descP, eVal); + result = esock_setopt_lvl_sock_debug(env, descP, eVal); break; #endif #if defined(SO_DONTROUTE) case SOCKET_OPT_SOCK_DONTROUTE: - result = nsetopt_lvl_sock_dontroute(env, descP, eVal); + result = esock_setopt_lvl_sock_dontroute(env, descP, eVal); break; #endif #if defined(SO_KEEPALIVE) case SOCKET_OPT_SOCK_KEEPALIVE: - result = nsetopt_lvl_sock_keepalive(env, descP, eVal); + result = esock_setopt_lvl_sock_keepalive(env, descP, eVal); break; #endif #if defined(SO_LINGER) case SOCKET_OPT_SOCK_LINGER: - result = nsetopt_lvl_sock_linger(env, descP, eVal); + result = esock_setopt_lvl_sock_linger(env, descP, eVal); break; #endif #if defined(SO_PEEK_OFF) case SOCKET_OPT_SOCK_PEEK_OFF: - result = nsetopt_lvl_sock_peek_off(env, descP, eVal); + result = esock_setopt_lvl_sock_peek_off(env, descP, eVal); break; #endif #if defined(SO_OOBINLINE) case SOCKET_OPT_SOCK_OOBINLINE: - result = nsetopt_lvl_sock_oobinline(env, descP, eVal); + result = esock_setopt_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); + result = esock_setopt_lvl_sock_priority(env, descP, eVal); break; #endif #if defined(SO_RCVBUF) case SOCKET_OPT_SOCK_RCVBUF: - result = nsetopt_lvl_sock_rcvbuf(env, descP, eVal); + result = esock_setopt_lvl_sock_rcvbuf(env, descP, eVal); break; #endif #if defined(SO_RCVLOWAT) case SOCKET_OPT_SOCK_RCVLOWAT: - result = nsetopt_lvl_sock_rcvlowat(env, descP, eVal); + result = esock_setopt_lvl_sock_rcvlowat(env, descP, eVal); break; #endif #if defined(SO_RCVTIMEO) case SOCKET_OPT_SOCK_RCVTIMEO: - result = nsetopt_lvl_sock_rcvtimeo(env, descP, eVal); + result = esock_setopt_lvl_sock_rcvtimeo(env, descP, eVal); break; #endif #if defined(SO_REUSEADDR) case SOCKET_OPT_SOCK_REUSEADDR: - result = nsetopt_lvl_sock_reuseaddr(env, descP, eVal); + result = esock_setopt_lvl_sock_reuseaddr(env, descP, eVal); break; #endif #if defined(SO_REUSEPORT) case SOCKET_OPT_SOCK_REUSEPORT: - result = nsetopt_lvl_sock_reuseport(env, descP, eVal); + result = esock_setopt_lvl_sock_reuseport(env, descP, eVal); break; #endif #if defined(SO_SNDBUF) case SOCKET_OPT_SOCK_SNDBUF: - result = nsetopt_lvl_sock_sndbuf(env, descP, eVal); + result = esock_setopt_lvl_sock_sndbuf(env, descP, eVal); break; #endif #if defined(SO_SNDLOWAT) case SOCKET_OPT_SOCK_SNDLOWAT: - result = nsetopt_lvl_sock_sndlowat(env, descP, eVal); + result = esock_setopt_lvl_sock_sndlowat(env, descP, eVal); break; #endif #if defined(SO_SNDTIMEO) case SOCKET_OPT_SOCK_SNDTIMEO: - result = nsetopt_lvl_sock_sndtimeo(env, descP, eVal); + result = esock_setopt_lvl_sock_sndtimeo(env, descP, eVal); break; #endif #if defined(SO_TIMESTAMP) case SOCKET_OPT_SOCK_TIMESTAMP: - result = nsetopt_lvl_sock_timestamp(env, descP, eVal); + result = esock_setopt_lvl_sock_timestamp(env, descP, eVal); break; #endif default: SSDBG( descP, - ("SOCKET", "nsetopt_lvl_socket -> unknown opt (%d)\r\n", eOpt) ); + ("SOCKET", + "esock_setopt_lvl_socket -> unknown opt (%d)\r\n", eOpt) ); result = esock_make_error(env, esock_atom_einval); break; } SSDBG( descP, - ("SOCKET", "nsetopt_lvl_socket -> done when" + ("SOCKET", "esock_setopt_lvl_socket -> done when" "\r\n result: %T" "\r\n", result) ); @@ -8207,66 +8225,66 @@ ERL_NIF_TERM nsetopt_lvl_socket(ErlNifEnv* env, #if defined(SO_BINDTODEVICE) static -ERL_NIF_TERM nsetopt_lvl_sock_bindtodevice(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_sock_bindtodevice(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { - return nsetopt_str_opt(env, descP, - SOL_SOCKET, SO_BINDTODEVICE, - IFNAMSIZ, eVal); + return esock_setopt_str_opt(env, descP, + SOL_SOCKET, SO_BINDTODEVICE, + IFNAMSIZ, eVal); } #endif #if defined(SO_BROADCAST) static -ERL_NIF_TERM nsetopt_lvl_sock_broadcast(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_sock_broadcast(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { - return nsetopt_bool_opt(env, descP, SOL_SOCKET, SO_BROADCAST, eVal); + return esock_setopt_bool_opt(env, descP, SOL_SOCKET, SO_BROADCAST, eVal); } #endif #if defined(SO_DEBUG) static -ERL_NIF_TERM nsetopt_lvl_sock_debug(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_sock_debug(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { - return nsetopt_int_opt(env, descP, SOL_SOCKET, SO_DEBUG, eVal); + return esock_setopt_int_opt(env, descP, SOL_SOCKET, SO_DEBUG, eVal); } #endif #if defined(SO_DONTROUTE) static -ERL_NIF_TERM nsetopt_lvl_sock_dontroute(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_sock_dontroute(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { - return nsetopt_bool_opt(env, descP, SOL_SOCKET, SO_DONTROUTE, eVal); + return esock_setopt_bool_opt(env, descP, SOL_SOCKET, SO_DONTROUTE, eVal); } #endif #if defined(SO_KEEPALIVE) static -ERL_NIF_TERM nsetopt_lvl_sock_keepalive(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_sock_keepalive(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { - return nsetopt_bool_opt(env, descP, SOL_SOCKET, SO_KEEPALIVE, eVal); + return esock_setopt_bool_opt(env, descP, SOL_SOCKET, SO_KEEPALIVE, eVal); } #endif #if defined(SO_LINGER) static -ERL_NIF_TERM nsetopt_lvl_sock_linger(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_sock_linger(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { ERL_NIF_TERM result; struct linger val; @@ -8290,346 +8308,347 @@ ERL_NIF_TERM nsetopt_lvl_sock_linger(ErlNifEnv* env, #if defined(SO_OOBINLINE) static -ERL_NIF_TERM nsetopt_lvl_sock_oobinline(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_sock_oobinline(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { - return nsetopt_bool_opt(env, descP, SOL_SOCKET, SO_OOBINLINE, eVal); + return esock_setopt_bool_opt(env, descP, SOL_SOCKET, SO_OOBINLINE, eVal); } #endif #if defined(SO_PEEK_OFF) static -ERL_NIF_TERM nsetopt_lvl_sock_peek_off(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_sock_peek_off(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { - return nsetopt_int_opt(env, descP, SOL_SOCKET, SO_PEEK_OFF, eVal); + return esock_setopt_int_opt(env, descP, SOL_SOCKET, SO_PEEK_OFF, eVal); } #endif #if defined(SO_PRIORITY) static -ERL_NIF_TERM nsetopt_lvl_sock_priority(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_sock_priority(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { - return nsetopt_int_opt(env, descP, SOL_SOCKET, SO_PRIORITY, eVal); + return esock_setopt_int_opt(env, descP, SOL_SOCKET, SO_PRIORITY, eVal); } #endif #if defined(SO_RCVBUF) static -ERL_NIF_TERM nsetopt_lvl_sock_rcvbuf(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_sock_rcvbuf(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { - return nsetopt_int_opt(env, descP, SOL_SOCKET, SO_RCVBUF, eVal); + return esock_setopt_int_opt(env, descP, SOL_SOCKET, SO_RCVBUF, eVal); } #endif #if defined(SO_RCVLOWAT) static -ERL_NIF_TERM nsetopt_lvl_sock_rcvlowat(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_sock_rcvlowat(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { - return nsetopt_int_opt(env, descP, SOL_SOCKET, SO_RCVLOWAT, eVal); + return esock_setopt_int_opt(env, descP, SOL_SOCKET, SO_RCVLOWAT, eVal); } #endif #if defined(SO_RCVTIMEO) static -ERL_NIF_TERM nsetopt_lvl_sock_rcvtimeo(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_sock_rcvtimeo(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { - return nsetopt_timeval_opt(env, descP, SOL_SOCKET, SO_RCVTIMEO, eVal); + return esock_setopt_timeval_opt(env, descP, SOL_SOCKET, SO_RCVTIMEO, eVal); } #endif #if defined(SO_REUSEADDR) static -ERL_NIF_TERM nsetopt_lvl_sock_reuseaddr(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_sock_reuseaddr(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { - return nsetopt_bool_opt(env, descP, SOL_SOCKET, SO_REUSEADDR, eVal); + return esock_setopt_bool_opt(env, descP, SOL_SOCKET, SO_REUSEADDR, eVal); } #endif #if defined(SO_REUSEPORT) static -ERL_NIF_TERM nsetopt_lvl_sock_reuseport(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_sock_reuseport(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { - return nsetopt_bool_opt(env, descP, SOL_SOCKET, SO_REUSEPORT, eVal); + return esock_setopt_bool_opt(env, descP, SOL_SOCKET, SO_REUSEPORT, eVal); } #endif #if defined(SO_SNDBUF) static -ERL_NIF_TERM nsetopt_lvl_sock_sndbuf(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_sock_sndbuf(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { - return nsetopt_int_opt(env, descP, SOL_SOCKET, SO_SNDBUF, eVal); + return esock_setopt_int_opt(env, descP, SOL_SOCKET, SO_SNDBUF, eVal); } #endif #if defined(SO_SNDLOWAT) static -ERL_NIF_TERM nsetopt_lvl_sock_sndlowat(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_sock_sndlowat(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { - return nsetopt_int_opt(env, descP, SOL_SOCKET, SO_SNDLOWAT, eVal); + return esock_setopt_int_opt(env, descP, SOL_SOCKET, SO_SNDLOWAT, eVal); } #endif #if defined(SO_SNDTIMEO) static -ERL_NIF_TERM nsetopt_lvl_sock_sndtimeo(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_sock_sndtimeo(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { SSDBG( descP, - ("SOCKET", "nsetopt_lvl_sock_sndtimeo -> entry with" + ("SOCKET", "esock_setopt_lvl_sock_sndtimeo -> entry with" "\r\n eVal: %T" "\r\n", eVal) ); - return nsetopt_timeval_opt(env, descP, SOL_SOCKET, SO_SNDTIMEO, eVal); + return esock_setopt_timeval_opt(env, descP, SOL_SOCKET, SO_SNDTIMEO, eVal); } #endif #if defined(SO_TIMESTAMP) static -ERL_NIF_TERM nsetopt_lvl_sock_timestamp(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_sock_timestamp(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { - return nsetopt_bool_opt(env, descP, SOL_SOCKET, SO_TIMESTAMP, eVal); + return esock_setopt_bool_opt(env, descP, SOL_SOCKET, SO_TIMESTAMP, eVal); } #endif -/* nsetopt_lvl_ip - Level *IP* option(s) +/* esock_setopt_lvl_ip - Level *IP* option(s) */ static -ERL_NIF_TERM nsetopt_lvl_ip(ErlNifEnv* env, - ESockDescriptor* descP, - int eOpt, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ip(ErlNifEnv* env, + ESockDescriptor* descP, + int eOpt, + ERL_NIF_TERM eVal) { ERL_NIF_TERM result; SSDBG( descP, - ("SOCKET", "nsetopt_lvl_ip -> entry with" + ("SOCKET", "esock_setopt_lvl_ip -> entry with" "\r\n opt: %d" "\r\n", eOpt) ); switch (eOpt) { #if defined(IP_ADD_MEMBERSHIP) case SOCKET_OPT_IP_ADD_MEMBERSHIP: - result = nsetopt_lvl_ip_add_membership(env, descP, eVal); + result = esock_setopt_lvl_ip_add_membership(env, descP, eVal); break; #endif #if defined(IP_ADD_SOURCE_MEMBERSHIP) case SOCKET_OPT_IP_ADD_SOURCE_MEMBERSHIP: - result = nsetopt_lvl_ip_add_source_membership(env, descP, eVal); + result = esock_setopt_lvl_ip_add_source_membership(env, descP, eVal); break; #endif #if defined(IP_BLOCK_SOURCE) case SOCKET_OPT_IP_BLOCK_SOURCE: - result = nsetopt_lvl_ip_block_source(env, descP, eVal); + result = esock_setopt_lvl_ip_block_source(env, descP, eVal); break; #endif #if defined(IP_DROP_MEMBERSHIP) case SOCKET_OPT_IP_DROP_MEMBERSHIP: - result = nsetopt_lvl_ip_drop_membership(env, descP, eVal); + result = esock_setopt_lvl_ip_drop_membership(env, descP, eVal); break; #endif #if defined(IP_DROP_SOURCE_MEMBERSHIP) case SOCKET_OPT_IP_DROP_SOURCE_MEMBERSHIP: - result = nsetopt_lvl_ip_drop_source_membership(env, descP, eVal); + result = esock_setopt_lvl_ip_drop_source_membership(env, descP, eVal); break; #endif #if defined(IP_FREEBIND) case SOCKET_OPT_IP_FREEBIND: - result = nsetopt_lvl_ip_freebind(env, descP, eVal); + result = esock_setopt_lvl_ip_freebind(env, descP, eVal); break; #endif #if defined(IP_HDRINCL) case SOCKET_OPT_IP_HDRINCL: - result = nsetopt_lvl_ip_hdrincl(env, descP, eVal); + result = esock_setopt_lvl_ip_hdrincl(env, descP, eVal); break; #endif #if defined(IP_MINTTL) case SOCKET_OPT_IP_MINTTL: - result = nsetopt_lvl_ip_minttl(env, descP, eVal); + result = esock_setopt_lvl_ip_minttl(env, descP, eVal); break; #endif #if defined(IP_MSFILTER) && defined(IP_MSFILTER_SIZE) case SOCKET_OPT_IP_MSFILTER: - result = nsetopt_lvl_ip_msfilter(env, descP, eVal); + result = esock_setopt_lvl_ip_msfilter(env, descP, eVal); break; #endif #if defined(IP_MTU_DISCOVER) case SOCKET_OPT_IP_MTU_DISCOVER: - result = nsetopt_lvl_ip_mtu_discover(env, descP, eVal); + result = esock_setopt_lvl_ip_mtu_discover(env, descP, eVal); break; #endif #if defined(IP_MULTICAST_ALL) case SOCKET_OPT_IP_MULTICAST_ALL: - result = nsetopt_lvl_ip_multicast_all(env, descP, eVal); + result = esock_setopt_lvl_ip_multicast_all(env, descP, eVal); break; #endif #if defined(IP_MULTICAST_IF) case SOCKET_OPT_IP_MULTICAST_IF: - result = nsetopt_lvl_ip_multicast_if(env, descP, eVal); + result = esock_setopt_lvl_ip_multicast_if(env, descP, eVal); break; #endif #if defined(IP_MULTICAST_LOOP) case SOCKET_OPT_IP_MULTICAST_LOOP: - result = nsetopt_lvl_ip_multicast_loop(env, descP, eVal); + result = esock_setopt_lvl_ip_multicast_loop(env, descP, eVal); break; #endif #if defined(IP_MULTICAST_TTL) case SOCKET_OPT_IP_MULTICAST_TTL: - result = nsetopt_lvl_ip_multicast_ttl(env, descP, eVal); + result = esock_setopt_lvl_ip_multicast_ttl(env, descP, eVal); break; #endif #if defined(IP_NODEFRAG) case SOCKET_OPT_IP_NODEFRAG: - result = nsetopt_lvl_ip_nodefrag(env, descP, eVal); + result = esock_setopt_lvl_ip_nodefrag(env, descP, eVal); break; #endif #if defined(IP_PKTINFO) case SOCKET_OPT_IP_PKTINFO: - result = nsetopt_lvl_ip_pktinfo(env, descP, eVal); + result = esock_setopt_lvl_ip_pktinfo(env, descP, eVal); break; #endif #if defined(IP_RECVDSTADDR) case SOCKET_OPT_IP_RECVDSTADDR: - result = nsetopt_lvl_ip_recvdstaddr(env, descP, eVal); + result = esock_setopt_lvl_ip_recvdstaddr(env, descP, eVal); break; #endif #if defined(IP_RECVERR) case SOCKET_OPT_IP_RECVERR: - result = nsetopt_lvl_ip_recverr(env, descP, eVal); + result = esock_setopt_lvl_ip_recverr(env, descP, eVal); break; #endif #if defined(IP_RECVIF) case SOCKET_OPT_IP_RECVIF: - result = nsetopt_lvl_ip_recvif(env, descP, eVal); + result = esock_setopt_lvl_ip_recvif(env, descP, eVal); break; #endif #if defined(IP_RECVOPTS) case SOCKET_OPT_IP_RECVOPTS: - result = nsetopt_lvl_ip_recvopts(env, descP, eVal); + result = esock_setopt_lvl_ip_recvopts(env, descP, eVal); break; #endif #if defined(IP_RECVORIGDSTADDR) case SOCKET_OPT_IP_RECVORIGDSTADDR: - result = nsetopt_lvl_ip_recvorigdstaddr(env, descP, eVal); + result = esock_setopt_lvl_ip_recvorigdstaddr(env, descP, eVal); break; #endif #if defined(IP_RECVTOS) case SOCKET_OPT_IP_RECVTOS: - result = nsetopt_lvl_ip_recvtos(env, descP, eVal); + result = esock_setopt_lvl_ip_recvtos(env, descP, eVal); break; #endif #if defined(IP_RECVTTL) case SOCKET_OPT_IP_RECVTTL: - result = nsetopt_lvl_ip_recvttl(env, descP, eVal); + result = esock_setopt_lvl_ip_recvttl(env, descP, eVal); break; #endif #if defined(IP_RETOPTS) case SOCKET_OPT_IP_RETOPTS: - result = nsetopt_lvl_ip_retopts(env, descP, eVal); + result = esock_setopt_lvl_ip_retopts(env, descP, eVal); break; #endif #if defined(IP_ROUTER_ALERT) case SOCKET_OPT_IP_ROUTER_ALERT: - result = nsetopt_lvl_ip_router_alert(env, descP, eVal); + result = esock_setopt_lvl_ip_router_alert(env, descP, eVal); break; #endif #if defined(IP_SENDSRCADDR) case SOCKET_OPT_IP_SENDSRCADDR: - result = nsetopt_lvl_ip_sendsrcaddr(env, descP, eVal); + result = esock_setopt_lvl_ip_sendsrcaddr(env, descP, eVal); break; #endif #if defined(IP_TOS) case SOCKET_OPT_IP_TOS: - result = nsetopt_lvl_ip_tos(env, descP, eVal); + result = esock_setopt_lvl_ip_tos(env, descP, eVal); break; #endif #if defined(IP_TRANSPARENT) case SOCKET_OPT_IP_TRANSPARENT: - result = nsetopt_lvl_ip_transparent(env, descP, eVal); + result = esock_setopt_lvl_ip_transparent(env, descP, eVal); break; #endif #if defined(IP_TTL) case SOCKET_OPT_IP_TTL: - result = nsetopt_lvl_ip_ttl(env, descP, eVal); + result = esock_setopt_lvl_ip_ttl(env, descP, eVal); break; #endif #if defined(IP_UNBLOCK_SOURCE) case SOCKET_OPT_IP_UNBLOCK_SOURCE: - result = nsetopt_lvl_ip_unblock_source(env, descP, eVal); + result = esock_setopt_lvl_ip_unblock_source(env, descP, eVal); break; #endif default: - SSDBG( descP, ("SOCKET", "nsetopt_lvl_ip -> unknown opt (%d)\r\n", eOpt) ); + SSDBG( descP, ("SOCKET", + "esock_setopt_lvl_ip -> unknown opt (%d)\r\n", eOpt) ); result = esock_make_error(env, esock_atom_einval); break; } SSDBG( descP, - ("SOCKET", "nsetopt_lvl_ip -> done when" + ("SOCKET", "esock_setopt_lvl_ip -> done when" "\r\n result: %T" "\r\n", result) ); @@ -8637,7 +8656,7 @@ ERL_NIF_TERM nsetopt_lvl_ip(ErlNifEnv* env, } -/* nsetopt_lvl_ip_add_membership - Level IP ADD_MEMBERSHIP option +/* esock_setopt_lvl_ip_add_membership - Level IP ADD_MEMBERSHIP option * * The value is a map with two attributes: multiaddr and interface. * The attribute 'multiaddr' is always a 4-tuple (IPv4 address). @@ -8646,16 +8665,18 @@ ERL_NIF_TERM nsetopt_lvl_ip(ErlNifEnv* env, */ #if defined(IP_ADD_MEMBERSHIP) static -ERL_NIF_TERM nsetopt_lvl_ip_add_membership(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ip_add_membership(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { - return nsetopt_lvl_ip_update_membership(env, descP, eVal, IP_ADD_MEMBERSHIP); + return esock_setopt_lvl_ip_update_membership(env, descP, eVal, + IP_ADD_MEMBERSHIP); } #endif -/* nsetopt_lvl_ip_add_source_membership - Level IP ADD_SOURCE_MEMBERSHIP option +/* esock_setopt_lvl_ip_add_source_membership - + * Level IP ADD_SOURCE_MEMBERSHIP option * * The value is a map with three attributes: multiaddr, interface and * sourceaddr. @@ -8666,17 +8687,17 @@ ERL_NIF_TERM nsetopt_lvl_ip_add_membership(ErlNifEnv* env, */ #if defined(IP_ADD_SOURCE_MEMBERSHIP) static -ERL_NIF_TERM nsetopt_lvl_ip_add_source_membership(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ip_add_source_membership(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { - return nsetopt_lvl_ip_update_source(env, descP, eVal, - IP_ADD_SOURCE_MEMBERSHIP); + return esock_setopt_lvl_ip_update_source(env, descP, eVal, + IP_ADD_SOURCE_MEMBERSHIP); } #endif -/* nsetopt_lvl_ip_block_source - Level IP BLOCK_SOURCE option +/* esock_setopt_lvl_ip_block_source - Level IP BLOCK_SOURCE option * * The value is a map with three attributes: multiaddr, interface and * sourceaddr. @@ -8687,16 +8708,16 @@ ERL_NIF_TERM nsetopt_lvl_ip_add_source_membership(ErlNifEnv* env, */ #if defined(IP_BLOCK_SOURCE) static -ERL_NIF_TERM nsetopt_lvl_ip_block_source(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ip_block_source(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { - return nsetopt_lvl_ip_update_source(env, descP, eVal, IP_BLOCK_SOURCE); + return esock_setopt_lvl_ip_update_source(env, descP, eVal, IP_BLOCK_SOURCE); } #endif -/* nsetopt_lvl_ip_drop_membership - Level IP DROP_MEMBERSHIP option +/* esock_setopt_lvl_ip_drop_membership - Level IP DROP_MEMBERSHIP option * * The value is a map with two attributes: multiaddr and interface. * The attribute 'multiaddr' is always a 4-tuple (IPv4 address). @@ -8709,18 +8730,19 @@ ERL_NIF_TERM nsetopt_lvl_ip_block_source(ErlNifEnv* env, */ #if defined(IP_DROP_MEMBERSHIP) static -ERL_NIF_TERM nsetopt_lvl_ip_drop_membership(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ip_drop_membership(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { - return nsetopt_lvl_ip_update_membership(env, descP, eVal, - IP_DROP_MEMBERSHIP); + return esock_setopt_lvl_ip_update_membership(env, descP, eVal, + IP_DROP_MEMBERSHIP); } #endif -/* nsetopt_lvl_ip_drop_source_membership - Level IP DROP_SOURCE_MEMBERSHIP option +/* esock_setopt_lvl_ip_drop_source_membership - + * Level IP DROP_SOURCE_MEMBERSHIP option * * The value is a map with three attributes: multiaddr, interface and * sourceaddr. @@ -8730,25 +8752,25 @@ ERL_NIF_TERM nsetopt_lvl_ip_drop_membership(ErlNifEnv* env, * (IPv4 address). */ #if defined(IP_DROP_SOURCE_MEMBERSHIP) -static -ERL_NIF_TERM nsetopt_lvl_ip_drop_source_membership(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +static +ERL_NIF_TERM esock_setopt_lvl_ip_drop_source_membership(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { - return nsetopt_lvl_ip_update_source(env, descP, eVal, - IP_DROP_SOURCE_MEMBERSHIP); + return esock_setopt_lvl_ip_update_source(env, descP, eVal, + IP_DROP_SOURCE_MEMBERSHIP); } #endif -/* nsetopt_lvl_ip_freebind - Level IP FREEBIND option +/* esock_setopt_lvl_ip_freebind - Level IP FREEBIND option */ #if defined(IP_FREEBIND) static -ERL_NIF_TERM nsetopt_lvl_ip_freebind(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ip_freebind(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { #if defined(SOL_IP) int level = SOL_IP; @@ -8756,19 +8778,19 @@ ERL_NIF_TERM nsetopt_lvl_ip_freebind(ErlNifEnv* env, int level = IPPROTO_IP; #endif - return nsetopt_bool_opt(env, descP, level, IP_FREEBIND, eVal); + return esock_setopt_bool_opt(env, descP, level, IP_FREEBIND, eVal); } #endif -/* nsetopt_lvl_ip_hdrincl - Level IP HDRINCL option +/* esock_setopt_lvl_ip_hdrincl - Level IP HDRINCL option */ #if defined(IP_HDRINCL) static -ERL_NIF_TERM nsetopt_lvl_ip_hdrincl(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ip_hdrincl(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { #if defined(SOL_IP) int level = SOL_IP; @@ -8776,19 +8798,19 @@ ERL_NIF_TERM nsetopt_lvl_ip_hdrincl(ErlNifEnv* env, int level = IPPROTO_IP; #endif - return nsetopt_bool_opt(env, descP, level, IP_HDRINCL, eVal); + return esock_setopt_bool_opt(env, descP, level, IP_HDRINCL, eVal); } #endif -/* nsetopt_lvl_ip_minttl - Level IP MINTTL option +/* esock_setopt_lvl_ip_minttl - Level IP MINTTL option */ #if defined(IP_MINTTL) static -ERL_NIF_TERM nsetopt_lvl_ip_minttl(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ip_minttl(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { #if defined(SOL_IP) int level = SOL_IP; @@ -8796,26 +8818,26 @@ ERL_NIF_TERM nsetopt_lvl_ip_minttl(ErlNifEnv* env, int level = IPPROTO_IP; #endif - return nsetopt_int_opt(env, descP, level, IP_MINTTL, eVal); + return esock_setopt_int_opt(env, descP, level, IP_MINTTL, eVal); } #endif -/* nsetopt_lvl_ip_msfilter - Level IP MSFILTER option +/* esock_setopt_lvl_ip_msfilter - Level IP MSFILTER option * * The value can be *either* the atom 'null' or a map of type ip_msfilter(). */ #if defined(IP_MSFILTER) && defined(IP_MSFILTER_SIZE) static -ERL_NIF_TERM nsetopt_lvl_ip_msfilter(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ip_msfilter(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { ERL_NIF_TERM result; if (COMPARE(eVal, atom_null) == 0) { - return nsetopt_lvl_ip_msfilter_set(env, descP->sock, NULL, 0); + return esock_setopt_lvl_ip_msfilter_set(env, descP->sock, NULL, 0); } else { struct ip_msfilter* msfP; Uint32 msfSz; @@ -8880,7 +8902,8 @@ ERL_NIF_TERM nsetopt_lvl_ip_msfilter(ErlNifEnv* env, } /* And now, finally, set the option */ - result = nsetopt_lvl_ip_msfilter_set(env, descP->sock, msfP, msfSz); + result = esock_setopt_lvl_ip_msfilter_set(env, descP->sock, + msfP, msfSz); FREE(msfP); return result; } @@ -8910,10 +8933,10 @@ BOOLEAN_T decode_ip_msfilter_mode(ErlNifEnv* env, static -ERL_NIF_TERM nsetopt_lvl_ip_msfilter_set(ErlNifEnv* env, - SOCKET sock, - struct ip_msfilter* msfP, - SOCKLEN_T optLen) +ERL_NIF_TERM esock_setopt_lvl_ip_msfilter_set(ErlNifEnv* env, + SOCKET sock, + struct ip_msfilter* msfP, + SOCKLEN_T optLen) { ERL_NIF_TERM result; int res; @@ -8935,15 +8958,15 @@ ERL_NIF_TERM nsetopt_lvl_ip_msfilter_set(ErlNifEnv* env, -/* nsetopt_lvl_ip_mtu_discover - Level IP MTU_DISCOVER option +/* esock_setopt_lvl_ip_mtu_discover - Level IP MTU_DISCOVER option * * The value is an atom of the type ip_pmtudisc(). */ #if defined(IP_MTU_DISCOVER) static -ERL_NIF_TERM nsetopt_lvl_ip_mtu_discover(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ip_mtu_discover(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { ERL_NIF_TERM result; int val; @@ -8976,13 +8999,13 @@ ERL_NIF_TERM nsetopt_lvl_ip_mtu_discover(ErlNifEnv* env, #endif -/* nsetopt_lvl_ip_multicast_all - Level IP MULTICAST_ALL option +/* esock_setopt_lvl_ip_multicast_all - Level IP MULTICAST_ALL option */ #if defined(IP_MULTICAST_ALL) static -ERL_NIF_TERM nsetopt_lvl_ip_multicast_all(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ip_multicast_all(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { #if defined(SOL_IP) int level = SOL_IP; @@ -8990,20 +9013,20 @@ ERL_NIF_TERM nsetopt_lvl_ip_multicast_all(ErlNifEnv* env, int level = IPPROTO_IP; #endif - return nsetopt_bool_opt(env, descP, level, IP_MULTICAST_ALL, eVal); + return esock_setopt_bool_opt(env, descP, level, IP_MULTICAST_ALL, eVal); } #endif -/* nsetopt_lvl_ip_multicast_if - Level IP MULTICAST_IF option +/* esock_setopt_lvl_ip_multicast_if - Level IP MULTICAST_IF option * * The value is either the atom 'any' or a 4-tuple. */ #if defined(IP_MULTICAST_IF) static -ERL_NIF_TERM nsetopt_lvl_ip_multicast_if(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ip_multicast_if(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { ERL_NIF_TERM result; struct in_addr ifAddr; @@ -9034,13 +9057,13 @@ ERL_NIF_TERM nsetopt_lvl_ip_multicast_if(ErlNifEnv* env, #endif -/* nsetopt_lvl_ip_multicast_loop - Level IP MULTICAST_LOOP option +/* esock_setopt_lvl_ip_multicast_loop - Level IP MULTICAST_LOOP option */ #if defined(IP_MULTICAST_LOOP) static -ERL_NIF_TERM nsetopt_lvl_ip_multicast_loop(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ip_multicast_loop(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { #if defined(SOL_IP) int level = SOL_IP; @@ -9048,18 +9071,18 @@ ERL_NIF_TERM nsetopt_lvl_ip_multicast_loop(ErlNifEnv* env, int level = IPPROTO_IP; #endif - return nsetopt_bool_opt(env, descP, level, IP_MULTICAST_LOOP, eVal); + return esock_setopt_bool_opt(env, descP, level, IP_MULTICAST_LOOP, eVal); } #endif -/* nsetopt_lvl_ip_multicast_ttl - Level IP MULTICAST_TTL option +/* esock_setopt_lvl_ip_multicast_ttl - Level IP MULTICAST_TTL option */ #if defined(IP_MULTICAST_TTL) static -ERL_NIF_TERM nsetopt_lvl_ip_multicast_ttl(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ip_multicast_ttl(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { #if defined(SOL_IP) int level = SOL_IP; @@ -9067,18 +9090,18 @@ ERL_NIF_TERM nsetopt_lvl_ip_multicast_ttl(ErlNifEnv* env, int level = IPPROTO_IP; #endif - return nsetopt_int_opt(env, descP, level, IP_MULTICAST_TTL, eVal); + return esock_setopt_int_opt(env, descP, level, IP_MULTICAST_TTL, eVal); } #endif -/* nsetopt_lvl_ip_nodefrag - Level IP NODEFRAG option +/* esock_setopt_lvl_ip_nodefrag - Level IP NODEFRAG option */ #if defined(IP_NODEFRAG) static -ERL_NIF_TERM nsetopt_lvl_ip_nodefrag(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ip_nodefrag(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { #if defined(SOL_IP) int level = SOL_IP; @@ -9086,18 +9109,18 @@ ERL_NIF_TERM nsetopt_lvl_ip_nodefrag(ErlNifEnv* env, int level = IPPROTO_IP; #endif - return nsetopt_bool_opt(env, descP, level, IP_NODEFRAG, eVal); + return esock_setopt_bool_opt(env, descP, level, IP_NODEFRAG, eVal); } #endif -/* nsetopt_lvl_ip_pktinfo - Level IP PKTINFO option +/* esock_setopt_lvl_ip_pktinfo - Level IP PKTINFO option */ #if defined(IP_PKTINFO) static -ERL_NIF_TERM nsetopt_lvl_ip_pktinfo(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ip_pktinfo(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { #if defined(SOL_IP) int level = SOL_IP; @@ -9105,18 +9128,18 @@ ERL_NIF_TERM nsetopt_lvl_ip_pktinfo(ErlNifEnv* env, int level = IPPROTO_IP; #endif - return nsetopt_bool_opt(env, descP, level, IP_PKTINFO, eVal); + return esock_setopt_bool_opt(env, descP, level, IP_PKTINFO, eVal); } #endif -/* nsetopt_lvl_ip_recvdstaddr - Level IP RECVDSTADDR option +/* esock_setopt_lvl_ip_recvdstaddr - Level IP RECVDSTADDR option */ #if defined(IP_RECVDSTADDR) static -ERL_NIF_TERM nsetopt_lvl_ip_recvdstaddr(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ip_recvdstaddr(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { #if defined(SOL_IP) int level = SOL_IP; @@ -9124,18 +9147,18 @@ ERL_NIF_TERM nsetopt_lvl_ip_recvdstaddr(ErlNifEnv* env, int level = IPPROTO_IP; #endif - return nsetopt_bool_opt(env, descP, level, IP_RECVDSTADDR, eVal); + return esock_setopt_bool_opt(env, descP, level, IP_RECVDSTADDR, eVal); } #endif -/* nsetopt_lvl_ip_recverr - Level IP RECVERR option +/* esock_setopt_lvl_ip_recverr - Level IP RECVERR option */ #if defined(IP_RECVERR) static -ERL_NIF_TERM nsetopt_lvl_ip_recverr(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ip_recverr(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { #if defined(SOL_IP) int level = SOL_IP; @@ -9143,18 +9166,18 @@ ERL_NIF_TERM nsetopt_lvl_ip_recverr(ErlNifEnv* env, int level = IPPROTO_IP; #endif - return nsetopt_bool_opt(env, descP, level, IP_RECVERR, eVal); + return esock_setopt_bool_opt(env, descP, level, IP_RECVERR, eVal); } #endif -/* nsetopt_lvl_ip_recvif - Level IP RECVIF option +/* esock_setopt_lvl_ip_recvif - Level IP RECVIF option */ #if defined(IP_RECVIF) static -ERL_NIF_TERM nsetopt_lvl_ip_recvif(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ip_recvif(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { #if defined(SOL_IP) int level = SOL_IP; @@ -9162,18 +9185,18 @@ ERL_NIF_TERM nsetopt_lvl_ip_recvif(ErlNifEnv* env, int level = IPPROTO_IP; #endif - return nsetopt_bool_opt(env, descP, level, IP_RECVIF, eVal); + return esock_setopt_bool_opt(env, descP, level, IP_RECVIF, eVal); } #endif -/* nsetopt_lvl_ip_recvopts - Level IP RECVOPTS option +/* esock_setopt_lvl_ip_recvopts - Level IP RECVOPTS option */ #if defined(IP_RECVOPTS) static -ERL_NIF_TERM nsetopt_lvl_ip_recvopts(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ip_recvopts(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { #if defined(SOL_IP) int level = SOL_IP; @@ -9181,18 +9204,18 @@ ERL_NIF_TERM nsetopt_lvl_ip_recvopts(ErlNifEnv* env, int level = IPPROTO_IP; #endif - return nsetopt_bool_opt(env, descP, level, IP_RECVOPTS, eVal); + return esock_setopt_bool_opt(env, descP, level, IP_RECVOPTS, eVal); } #endif -/* nsetopt_lvl_ip_recvorigdstaddr - Level IP RECVORIGDSTADDR option +/* esock_setopt_lvl_ip_recvorigdstaddr - Level IP RECVORIGDSTADDR option */ #if defined(IP_RECVORIGDSTADDR) static -ERL_NIF_TERM nsetopt_lvl_ip_recvorigdstaddr(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ip_recvorigdstaddr(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { #if defined(SOL_IP) int level = SOL_IP; @@ -9200,18 +9223,18 @@ ERL_NIF_TERM nsetopt_lvl_ip_recvorigdstaddr(ErlNifEnv* env, int level = IPPROTO_IP; #endif - return nsetopt_bool_opt(env, descP, level, IP_RECVORIGDSTADDR, eVal); + return esock_setopt_bool_opt(env, descP, level, IP_RECVORIGDSTADDR, eVal); } #endif -/* nsetopt_lvl_ip_recvtos - Level IP RECVTOS option +/* esock_setopt_lvl_ip_recvtos - Level IP RECVTOS option */ #if defined(IP_RECVTOS) static -ERL_NIF_TERM nsetopt_lvl_ip_recvtos(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ip_recvtos(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { #if defined(SOL_IP) int level = SOL_IP; @@ -9219,18 +9242,18 @@ ERL_NIF_TERM nsetopt_lvl_ip_recvtos(ErlNifEnv* env, int level = IPPROTO_IP; #endif - return nsetopt_bool_opt(env, descP, level, IP_RECVTOS, eVal); + return esock_setopt_bool_opt(env, descP, level, IP_RECVTOS, eVal); } #endif -/* nsetopt_lvl_ip_recvttl - Level IP RECVTTL option +/* esock_setopt_lvl_ip_recvttl - Level IP RECVTTL option */ #if defined(IP_RECVTTL) static -ERL_NIF_TERM nsetopt_lvl_ip_recvttl(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ip_recvttl(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { #if defined(SOL_IP) int level = SOL_IP; @@ -9238,18 +9261,18 @@ ERL_NIF_TERM nsetopt_lvl_ip_recvttl(ErlNifEnv* env, int level = IPPROTO_IP; #endif - return nsetopt_bool_opt(env, descP, level, IP_RECVTTL, eVal); + return esock_setopt_bool_opt(env, descP, level, IP_RECVTTL, eVal); } #endif -/* nsetopt_lvl_ip_retopts - Level IP RETOPTS option +/* esock_setopt_lvl_ip_retopts - Level IP RETOPTS option */ #if defined(IP_RETOPTS) static -ERL_NIF_TERM nsetopt_lvl_ip_retopts(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ip_retopts(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { #if defined(SOL_IP) int level = SOL_IP; @@ -9257,18 +9280,18 @@ ERL_NIF_TERM nsetopt_lvl_ip_retopts(ErlNifEnv* env, int level = IPPROTO_IP; #endif - return nsetopt_bool_opt(env, descP, level, IP_RETOPTS, eVal); + return esock_setopt_bool_opt(env, descP, level, IP_RETOPTS, eVal); } #endif -/* nsetopt_lvl_ip_router_alert - Level IP ROUTER_ALERT option +/* esock_setopt_lvl_ip_router_alert - Level IP ROUTER_ALERT option */ #if defined(IP_ROUTER_ALERT) static -ERL_NIF_TERM nsetopt_lvl_ip_router_alert(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ip_router_alert(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { #if defined(SOL_IP) int level = SOL_IP; @@ -9276,18 +9299,18 @@ ERL_NIF_TERM nsetopt_lvl_ip_router_alert(ErlNifEnv* env, int level = IPPROTO_IP; #endif - return nsetopt_int_opt(env, descP, level, IP_ROUTER_ALERT, eVal); + return esock_setopt_int_opt(env, descP, level, IP_ROUTER_ALERT, eVal); } #endif -/* nsetopt_lvl_ip_sendsrcaddr - Level IP SENDSRCADDR option +/* esock_setopt_lvl_ip_sendsrcaddr - Level IP SENDSRCADDR option */ #if defined(IP_SENDSRCADDR) static -ERL_NIF_TERM nsetopt_lvl_ip_sendsrcaddr(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ip_sendsrcaddr(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { #if defined(SOL_IP) int level = SOL_IP; @@ -9295,18 +9318,18 @@ ERL_NIF_TERM nsetopt_lvl_ip_sendsrcaddr(ErlNifEnv* env, int level = IPPROTO_IP; #endif - return nsetopt_bool_opt(env, descP, level, IP_SENDSRCADDR, eVal); + return esock_setopt_bool_opt(env, descP, level, IP_SENDSRCADDR, eVal); } #endif -/* nsetopt_lvl_ip_tos - Level IP TOS option +/* esock_setopt_lvl_ip_tos - Level IP TOS option */ #if defined(IP_TOS) static -ERL_NIF_TERM nsetopt_lvl_ip_tos(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ip_tos(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { #if defined(SOL_IP) int level = SOL_IP; @@ -9333,13 +9356,13 @@ ERL_NIF_TERM nsetopt_lvl_ip_tos(ErlNifEnv* env, #endif -/* nsetopt_lvl_ip_transparent - Level IP TRANSPARENT option +/* esock_setopt_lvl_ip_transparent - Level IP TRANSPARENT option */ #if defined(IP_TRANSPARENT) static -ERL_NIF_TERM nsetopt_lvl_ip_transparent(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ip_transparent(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { #if defined(SOL_IP) int level = SOL_IP; @@ -9347,19 +9370,19 @@ ERL_NIF_TERM nsetopt_lvl_ip_transparent(ErlNifEnv* env, int level = IPPROTO_IP; #endif - return nsetopt_bool_opt(env, descP, level, IP_TRANSPARENT, eVal); + return esock_setopt_bool_opt(env, descP, level, IP_TRANSPARENT, eVal); } #endif -/* nsetopt_lvl_ip_ttl - Level IP TTL option +/* esock_setopt_lvl_ip_ttl - Level IP TTL option */ #if defined(IP_TTL) static -ERL_NIF_TERM nsetopt_lvl_ip_ttl(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ip_ttl(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { #if defined(SOL_IP) int level = SOL_IP; @@ -9367,13 +9390,13 @@ ERL_NIF_TERM nsetopt_lvl_ip_ttl(ErlNifEnv* env, int level = IPPROTO_IP; #endif - return nsetopt_int_opt(env, descP, level, IP_TTL, eVal); + return esock_setopt_int_opt(env, descP, level, IP_TTL, eVal); } #endif -/* nsetopt_lvl_ip_unblock_source - Level IP UNBLOCK_SOURCE option +/* esock_setopt_lvl_ip_unblock_source - Level IP UNBLOCK_SOURCE option * * The value is a map with three attributes: multiaddr, interface and * sourceaddr. @@ -9384,11 +9407,12 @@ ERL_NIF_TERM nsetopt_lvl_ip_ttl(ErlNifEnv* env, */ #if defined(IP_UNBLOCK_SOURCE) static -ERL_NIF_TERM nsetopt_lvl_ip_unblock_source(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ip_unblock_source(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { - return nsetopt_lvl_ip_update_source(env, descP, eVal, IP_UNBLOCK_SOURCE); + return esock_setopt_lvl_ip_update_source(env, descP, eVal, + IP_UNBLOCK_SOURCE); } #endif @@ -9396,10 +9420,10 @@ ERL_NIF_TERM nsetopt_lvl_ip_unblock_source(ErlNifEnv* env, #if defined(IP_ADD_MEMBERSHIP) || defined(IP_DROP_MEMBERSHIP) static -ERL_NIF_TERM nsetopt_lvl_ip_update_membership(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal, - int opt) +ERL_NIF_TERM esock_setopt_lvl_ip_update_membership(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal, + int opt) { ERL_NIF_TERM result, eMultiAddr, eInterface; struct ip_mreq mreq; @@ -9415,7 +9439,7 @@ ERL_NIF_TERM nsetopt_lvl_ip_update_membership(ErlNifEnv* env, // It must be a map if (!IS_MAP(env, eVal)) { SSDBG( descP, - ("SOCKET", "nsetopt_lvl_ip_update_membership -> " + ("SOCKET", "esock_setopt_lvl_ip_update_membership -> " "value *not* a map\r\n") ); return enif_make_badarg(env); } @@ -9423,21 +9447,21 @@ ERL_NIF_TERM nsetopt_lvl_ip_update_membership(ErlNifEnv* env, // It must have atleast two attributes if (!enif_get_map_size(env, eVal, &sz) || (sz < 2)) { SSDBG( descP, - ("SOCKET", "nsetopt_lvl_ip_update_membership -> " + ("SOCKET", "esock_setopt_lvl_ip_update_membership -> " "invalid map value: %T\r\n", eVal) ); return enif_make_badarg(env); } if (!GET_MAP_VAL(env, eVal, atom_multiaddr, &eMultiAddr)) { SSDBG( descP, - ("SOCKET", "nsetopt_lvl_ip_update_membership -> " + ("SOCKET", "esock_setopt_lvl_ip_update_membership -> " "failed get multiaddr (map) attribute\r\n") ); return enif_make_badarg(env); } if (!GET_MAP_VAL(env, eVal, atom_interface, &eInterface)) { SSDBG( descP, - ("SOCKET", "nsetopt_lvl_ip_update_membership -> " + ("SOCKET", "esock_setopt_lvl_ip_update_membership -> " "failed get interface (map) attribute\r\n") ); return enif_make_badarg(env); } @@ -9446,7 +9470,7 @@ ERL_NIF_TERM nsetopt_lvl_ip_update_membership(ErlNifEnv* env, eMultiAddr, &mreq.imr_multiaddr)) != NULL) { SSDBG( descP, - ("SOCKET", "nsetopt_lvl_ip_update_membership -> " + ("SOCKET", "esock_setopt_lvl_ip_update_membership -> " "failed decode multiaddr %T: %s\r\n", eMultiAddr, xres) ); return esock_make_error_str(env, xres); } @@ -9455,7 +9479,7 @@ ERL_NIF_TERM nsetopt_lvl_ip_update_membership(ErlNifEnv* env, eInterface, &mreq.imr_interface)) != NULL) { SSDBG( descP, - ("SOCKET", "nsetopt_lvl_ip_update_membership -> " + ("SOCKET", "esock_setopt_lvl_ip_update_membership -> " "failed decode interface %T: %s\r\n", eInterface, xres) ); return esock_make_error_str(env, xres); } @@ -9468,7 +9492,7 @@ ERL_NIF_TERM nsetopt_lvl_ip_update_membership(ErlNifEnv* env, result = esock_make_error_errno(env, save_errno); SSDBG( descP, - ("SOCKET", "nsetopt_lvl_ip_update_membership -> " + ("SOCKET", "esock_setopt_lvl_ip_update_membership -> " "failed setopt: %T (%d)\r\n", result, save_errno) ); } else { @@ -9482,10 +9506,10 @@ ERL_NIF_TERM nsetopt_lvl_ip_update_membership(ErlNifEnv* env, #if defined(IP_ADD_SOURCE_MEMBERSHIP) || defined(IP_DROP_SOURCE_MEMBERSHIP) || defined(IP_BLOCK_SOURCE) || defined(IP_UNBLOCK_SOURCE) static -ERL_NIF_TERM nsetopt_lvl_ip_update_source(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal, - int opt) +ERL_NIF_TERM esock_setopt_lvl_ip_update_source(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal, + int opt) { ERL_NIF_TERM result, eMultiAddr, eInterface, eSourceAddr; struct ip_mreq_source mreq; @@ -9545,146 +9569,147 @@ ERL_NIF_TERM nsetopt_lvl_ip_update_source(ErlNifEnv* env, /* *** Handling set of socket options for level = ipv6 *** */ -/* nsetopt_lvl_ipv6 - Level *IPv6* option(s) +/* esock_setopt_lvl_ipv6 - Level *IPv6* option(s) */ #if defined(HAVE_IPV6) static -ERL_NIF_TERM nsetopt_lvl_ipv6(ErlNifEnv* env, - ESockDescriptor* descP, - int eOpt, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ipv6(ErlNifEnv* env, + ESockDescriptor* descP, + int eOpt, + ERL_NIF_TERM eVal) { ERL_NIF_TERM result; SSDBG( descP, - ("SOCKET", "nsetopt_lvl_ipv6 -> entry with" + ("SOCKET", "esock_setopt_lvl_ipv6 -> entry with" "\r\n opt: %d" "\r\n", eOpt) ); switch (eOpt) { #if defined(IPV6_ADDRFORM) case SOCKET_OPT_IPV6_ADDRFORM: - result = nsetopt_lvl_ipv6_addrform(env, descP, eVal); + result = esock_setopt_lvl_ipv6_addrform(env, descP, eVal); break; #endif #if defined(IPV6_ADD_MEMBERSHIP) case SOCKET_OPT_IPV6_ADD_MEMBERSHIP: - result = nsetopt_lvl_ipv6_add_membership(env, descP, eVal); + result = esock_setopt_lvl_ipv6_add_membership(env, descP, eVal); break; #endif #if defined(IPV6_AUTHHDR) case SOCKET_OPT_IPV6_AUTHHDR: - result = nsetopt_lvl_ipv6_authhdr(env, descP, eVal); + result = esock_setopt_lvl_ipv6_authhdr(env, descP, eVal); break; #endif #if defined(IPV6_DROP_MEMBERSHIP) case SOCKET_OPT_IPV6_DROP_MEMBERSHIP: - result = nsetopt_lvl_ipv6_drop_membership(env, descP, eVal); + result = esock_setopt_lvl_ipv6_drop_membership(env, descP, eVal); break; #endif #if defined(IPV6_DSTOPTS) case SOCKET_OPT_IPV6_DSTOPTS: - result = nsetopt_lvl_ipv6_dstopts(env, descP, eVal); + result = esock_setopt_lvl_ipv6_dstopts(env, descP, eVal); break; #endif #if defined(IPV6_FLOWINFO) case SOCKET_OPT_IPV6_FLOWINFO: - result = nsetopt_lvl_ipv6_flowinfo(env, descP, eVal); + result = esock_setopt_lvl_ipv6_flowinfo(env, descP, eVal); break; #endif #if defined(IPV6_HOPLIMIT) case SOCKET_OPT_IPV6_HOPLIMIT: - result = nsetopt_lvl_ipv6_hoplimit(env, descP, eVal); + result = esock_setopt_lvl_ipv6_hoplimit(env, descP, eVal); break; #endif #if defined(IPV6_HOPOPTS) case SOCKET_OPT_IPV6_HOPOPTS: - result = nsetopt_lvl_ipv6_hopopts(env, descP, eVal); + result = esock_setopt_lvl_ipv6_hopopts(env, descP, eVal); break; #endif #if defined(IPV6_MTU) case SOCKET_OPT_IPV6_MTU: - result = nsetopt_lvl_ipv6_mtu(env, descP, eVal); + result = esock_setopt_lvl_ipv6_mtu(env, descP, eVal); break; #endif #if defined(IPV6_MTU_DISCOVER) case SOCKET_OPT_IPV6_MTU_DISCOVER: - result = nsetopt_lvl_ipv6_mtu_discover(env, descP, eVal); + result = esock_setopt_lvl_ipv6_mtu_discover(env, descP, eVal); break; #endif #if defined(IPV6_MULTICAST_HOPS) case SOCKET_OPT_IPV6_MULTICAST_HOPS: - result = nsetopt_lvl_ipv6_multicast_hops(env, descP, eVal); + result = esock_setopt_lvl_ipv6_multicast_hops(env, descP, eVal); break; #endif #if defined(IPV6_MULTICAST_IF) case SOCKET_OPT_IPV6_MULTICAST_IF: - result = nsetopt_lvl_ipv6_multicast_if(env, descP, eVal); + result = esock_setopt_lvl_ipv6_multicast_if(env, descP, eVal); break; #endif #if defined(IPV6_MULTICAST_LOOP) case SOCKET_OPT_IPV6_MULTICAST_LOOP: - result = nsetopt_lvl_ipv6_multicast_loop(env, descP, eVal); + result = esock_setopt_lvl_ipv6_multicast_loop(env, descP, eVal); break; #endif #if defined(IPV6_RECVERR) case SOCKET_OPT_IPV6_RECVERR: - result = nsetopt_lvl_ipv6_recverr(env, descP, eVal); + result = esock_setopt_lvl_ipv6_recverr(env, descP, eVal); break; #endif #if defined(IPV6_RECVPKTINFO) || defined(IPV6_PKTINFO) case SOCKET_OPT_IPV6_RECVPKTINFO: - result = nsetopt_lvl_ipv6_recvpktinfo(env, descP, eVal); + result = esock_setopt_lvl_ipv6_recvpktinfo(env, descP, eVal); break; #endif #if defined(IPV6_ROUTER_ALERT) case SOCKET_OPT_IPV6_ROUTER_ALERT: - result = nsetopt_lvl_ipv6_router_alert(env, descP, eVal); + result = esock_setopt_lvl_ipv6_router_alert(env, descP, eVal); break; #endif #if defined(IPV6_RTHDR) case SOCKET_OPT_IPV6_RTHDR: - result = nsetopt_lvl_ipv6_rthdr(env, descP, eVal); + result = esock_setopt_lvl_ipv6_rthdr(env, descP, eVal); break; #endif #if defined(IPV6_UNICAST_HOPS) case SOCKET_OPT_IPV6_UNICAST_HOPS: - result = nsetopt_lvl_ipv6_unicast_hops(env, descP, eVal); + result = esock_setopt_lvl_ipv6_unicast_hops(env, descP, eVal); break; #endif #if defined(IPV6_V6ONLY) case SOCKET_OPT_IPV6_V6ONLY: - result = nsetopt_lvl_ipv6_v6only(env, descP, eVal); + result = esock_setopt_lvl_ipv6_v6only(env, descP, eVal); break; #endif default: SSDBG( descP, - ("SOCKET", "nsetopt_lvl_ipv6 -> unknown opt (%d)\r\n", eOpt) ); + ("SOCKET", + "esock_setopt_lvl_ipv6 -> unknown opt (%d)\r\n", eOpt) ); result = esock_make_error(env, esock_atom_einval); break; } SSDBG( descP, - ("SOCKET", "nsetopt_lvl_ipv6 -> done when" + ("SOCKET", "esock_setopt_lvl_ipv6 -> done when" "\r\n result: %T" "\r\n", result) ); @@ -9694,15 +9719,15 @@ ERL_NIF_TERM nsetopt_lvl_ipv6(ErlNifEnv* env, #if defined(IPV6_ADDRFORM) static -ERL_NIF_TERM nsetopt_lvl_ipv6_addrform(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ipv6_addrform(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { ERL_NIF_TERM result; int res, edomain, domain; SSDBG( descP, - ("SOCKET", "nsetopt_lvl_ipv6_addrform -> entry with" + ("SOCKET", "esock_setopt_lvl_ipv6_addrform -> entry with" "\r\n eVal: %T" "\r\n", eVal) ); @@ -9710,14 +9735,15 @@ ERL_NIF_TERM nsetopt_lvl_ipv6_addrform(ErlNifEnv* env, return esock_make_error(env, esock_atom_einval); SSDBG( descP, - ("SOCKET", "nsetopt_lvl_ipv6_addrform -> decode" + ("SOCKET", "esock_setopt_lvl_ipv6_addrform -> decode" "\r\n edomain: %d" "\r\n", edomain) ); if (!edomain2domain(edomain, &domain)) return esock_make_error(env, esock_atom_einval); - SSDBG( descP, ("SOCKET", "nsetopt_lvl_ipv6_addrform -> try set opt to %d\r\n", + SSDBG( descP, ("SOCKET", + "esock_setopt_lvl_ipv6_addrform -> try set opt to %d\r\n", domain) ); res = socket_setopt(descP->sock, @@ -9736,11 +9762,11 @@ ERL_NIF_TERM nsetopt_lvl_ipv6_addrform(ErlNifEnv* env, #if defined(IPV6_ADD_MEMBERSHIP) static -ERL_NIF_TERM nsetopt_lvl_ipv6_add_membership(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ipv6_add_membership(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { - return nsetopt_lvl_ipv6_update_membership(env, descP, eVal, + return esock_setopt_lvl_ipv6_update_membership(env, descP, eVal, IPV6_ADD_MEMBERSHIP); } #endif @@ -9748,22 +9774,22 @@ ERL_NIF_TERM nsetopt_lvl_ipv6_add_membership(ErlNifEnv* env, #if defined(IPV6_AUTHHDR) static -ERL_NIF_TERM nsetopt_lvl_ipv6_authhdr(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ipv6_authhdr(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { - return nsetopt_bool_opt(env, descP, SOL_IPV6, IPV6_AUTHHDR, eVal); + return esock_setopt_bool_opt(env, descP, SOL_IPV6, IPV6_AUTHHDR, eVal); } #endif #if defined(IPV6_DROP_MEMBERSHIP) static -ERL_NIF_TERM nsetopt_lvl_ipv6_drop_membership(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ipv6_drop_membership(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { - return nsetopt_lvl_ipv6_update_membership(env, descP, eVal, + return esock_setopt_lvl_ipv6_update_membership(env, descP, eVal, IPV6_DROP_MEMBERSHIP); } #endif @@ -9771,9 +9797,9 @@ ERL_NIF_TERM nsetopt_lvl_ipv6_drop_membership(ErlNifEnv* env, #if defined(IPV6_DSTOPTS) static -ERL_NIF_TERM nsetopt_lvl_ipv6_dstopts(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ipv6_dstopts(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { #if defined(SOL_IPV6) int level = SOL_IPV6; @@ -9781,16 +9807,16 @@ ERL_NIF_TERM nsetopt_lvl_ipv6_dstopts(ErlNifEnv* env, int level = IPPROTO_IPV6; #endif - return nsetopt_bool_opt(env, descP, level, IPV6_DSTOPTS, eVal); + return esock_setopt_bool_opt(env, descP, level, IPV6_DSTOPTS, eVal); } #endif #if defined(IPV6_FLOWINFO) static -ERL_NIF_TERM nsetopt_lvl_ipv6_flowinfo(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ipv6_flowinfo(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { #if defined(SOL_IPV6) int level = SOL_IPV6; @@ -9798,16 +9824,16 @@ ERL_NIF_TERM nsetopt_lvl_ipv6_flowinfo(ErlNifEnv* env, int level = IPPROTO_IPV6; #endif - return nsetopt_bool_opt(env, descP, level, IPV6_FLOWINFO, eVal); + return esock_setopt_bool_opt(env, descP, level, IPV6_FLOWINFO, eVal); } #endif #if defined(IPV6_HOPLIMIT) static -ERL_NIF_TERM nsetopt_lvl_ipv6_hoplimit(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ipv6_hoplimit(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { #if defined(SOL_IPV6) int level = SOL_IPV6; @@ -9815,16 +9841,16 @@ ERL_NIF_TERM nsetopt_lvl_ipv6_hoplimit(ErlNifEnv* env, int level = IPPROTO_IPV6; #endif - return nsetopt_bool_opt(env, descP, level, IPV6_HOPLIMIT, eVal); + return esock_setopt_bool_opt(env, descP, level, IPV6_HOPLIMIT, eVal); } #endif #if defined(IPV6_HOPOPTS) static -ERL_NIF_TERM nsetopt_lvl_ipv6_hopopts(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ipv6_hopopts(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { #if defined(SOL_IPV6) int level = SOL_IPV6; @@ -9832,14 +9858,14 @@ ERL_NIF_TERM nsetopt_lvl_ipv6_hopopts(ErlNifEnv* env, int level = IPPROTO_IPV6; #endif - return nsetopt_bool_opt(env, descP, level, IPV6_HOPOPTS, eVal); + return esock_setopt_bool_opt(env, descP, level, IPV6_HOPOPTS, eVal); } #endif #if defined(IPV6_MTU) static -ERL_NIF_TERM nsetopt_lvl_ipv6_mtu(ErlNifEnv* env, +ERL_NIF_TERM esock_setopt_lvl_ipv6_mtu(ErlNifEnv* env, ESockDescriptor* descP, ERL_NIF_TERM eVal) { @@ -9849,20 +9875,20 @@ ERL_NIF_TERM nsetopt_lvl_ipv6_mtu(ErlNifEnv* env, int level = IPPROTO_IPV6; #endif - return nsetopt_int_opt(env, descP, level, IPV6_MTU, eVal); + return esock_setopt_int_opt(env, descP, level, IPV6_MTU, eVal); } #endif -/* nsetopt_lvl_ipv6_mtu_discover - Level IPv6 MTU_DISCOVER option +/* esock_setopt_lvl_ipv6_mtu_discover - Level IPv6 MTU_DISCOVER option * * The value is an atom of the type ipv6_pmtudisc(). */ #if defined(IPV6_MTU_DISCOVER) static -ERL_NIF_TERM nsetopt_lvl_ipv6_mtu_discover(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ipv6_mtu_discover(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { ERL_NIF_TERM result; int val; @@ -9898,9 +9924,9 @@ ERL_NIF_TERM nsetopt_lvl_ipv6_mtu_discover(ErlNifEnv* env, #if defined(IPV6_MULTICAST_HOPS) static -ERL_NIF_TERM nsetopt_lvl_ipv6_multicast_hops(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ipv6_multicast_hops(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { #if defined(SOL_IPV6) int level = SOL_IPV6; @@ -9908,7 +9934,7 @@ ERL_NIF_TERM nsetopt_lvl_ipv6_multicast_hops(ErlNifEnv* env, int level = IPPROTO_IPV6; #endif - return nsetopt_int_opt(env, descP, level, IPV6_MULTICAST_HOPS, eVal); + return esock_setopt_int_opt(env, descP, level, IPV6_MULTICAST_HOPS, eVal); } #endif @@ -9916,9 +9942,9 @@ ERL_NIF_TERM nsetopt_lvl_ipv6_multicast_hops(ErlNifEnv* env, #if defined(IPV6_MULTICAST_IF) static -ERL_NIF_TERM nsetopt_lvl_ipv6_multicast_if(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ipv6_multicast_if(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { #if defined(SOL_IPV6) int level = SOL_IPV6; @@ -9926,7 +9952,7 @@ ERL_NIF_TERM nsetopt_lvl_ipv6_multicast_if(ErlNifEnv* env, int level = IPPROTO_IPV6; #endif - return nsetopt_int_opt(env, descP, level, IPV6_MULTICAST_IF, eVal); + return esock_setopt_int_opt(env, descP, level, IPV6_MULTICAST_IF, eVal); } #endif @@ -9934,9 +9960,9 @@ ERL_NIF_TERM nsetopt_lvl_ipv6_multicast_if(ErlNifEnv* env, #if defined(IPV6_MULTICAST_LOOP) static -ERL_NIF_TERM nsetopt_lvl_ipv6_multicast_loop(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ipv6_multicast_loop(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { #if defined(SOL_IPV6) int level = SOL_IPV6; @@ -9944,16 +9970,16 @@ ERL_NIF_TERM nsetopt_lvl_ipv6_multicast_loop(ErlNifEnv* env, int level = IPPROTO_IPV6; #endif - return nsetopt_bool_opt(env, descP, level, IPV6_MULTICAST_LOOP, eVal); + return esock_setopt_bool_opt(env, descP, level, IPV6_MULTICAST_LOOP, eVal); } #endif #if defined(IPV6_RECVERR) static -ERL_NIF_TERM nsetopt_lvl_ipv6_recverr(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ipv6_recverr(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { #if defined(SOL_IPV6) int level = SOL_IPV6; @@ -9961,16 +9987,16 @@ ERL_NIF_TERM nsetopt_lvl_ipv6_recverr(ErlNifEnv* env, int level = IPPROTO_IPV6; #endif - return nsetopt_bool_opt(env, descP, level, IPV6_RECVERR, eVal); + return esock_setopt_bool_opt(env, descP, level, IPV6_RECVERR, eVal); } #endif #if defined(IPV6_RECVPKTINFO) || defined(IPV6_PKTINFO) static -ERL_NIF_TERM nsetopt_lvl_ipv6_recvpktinfo(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ipv6_recvpktinfo(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { #if defined(SOL_IPV6) int level = SOL_IPV6; @@ -9983,16 +10009,16 @@ ERL_NIF_TERM nsetopt_lvl_ipv6_recvpktinfo(ErlNifEnv* env, int opt = IPV6_PKTINFO; #endif - return nsetopt_bool_opt(env, descP, level, opt, eVal); + return esock_setopt_bool_opt(env, descP, level, opt, eVal); } #endif #if defined(IPV6_ROUTER_ALERT) static -ERL_NIF_TERM nsetopt_lvl_ipv6_router_alert(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ipv6_router_alert(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { #if defined(SOL_IPV6) int level = SOL_IPV6; @@ -10000,7 +10026,7 @@ ERL_NIF_TERM nsetopt_lvl_ipv6_router_alert(ErlNifEnv* env, int level = IPPROTO_IPV6; #endif - return nsetopt_int_opt(env, descP, level, IPV6_ROUTER_ALERT, eVal); + return esock_setopt_int_opt(env, descP, level, IPV6_ROUTER_ALERT, eVal); } #endif @@ -10008,9 +10034,9 @@ ERL_NIF_TERM nsetopt_lvl_ipv6_router_alert(ErlNifEnv* env, #if defined(IPV6_RTHDR) static -ERL_NIF_TERM nsetopt_lvl_ipv6_rthdr(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ipv6_rthdr(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { #if defined(SOL_IPV6) int level = SOL_IPV6; @@ -10018,16 +10044,16 @@ ERL_NIF_TERM nsetopt_lvl_ipv6_rthdr(ErlNifEnv* env, int level = IPPROTO_IPV6; #endif - return nsetopt_bool_opt(env, descP, level, IPV6_RTHDR, eVal); + return esock_setopt_bool_opt(env, descP, level, IPV6_RTHDR, eVal); } #endif #if defined(IPV6_UNICAST_HOPS) static -ERL_NIF_TERM nsetopt_lvl_ipv6_unicast_hops(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ipv6_unicast_hops(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { #if defined(SOL_IPV6) int level = SOL_IPV6; @@ -10035,7 +10061,7 @@ ERL_NIF_TERM nsetopt_lvl_ipv6_unicast_hops(ErlNifEnv* env, int level = IPPROTO_IPV6; #endif - return nsetopt_int_opt(env, descP, level, IPV6_UNICAST_HOPS, eVal); + return esock_setopt_int_opt(env, descP, level, IPV6_UNICAST_HOPS, eVal); } #endif @@ -10043,9 +10069,9 @@ ERL_NIF_TERM nsetopt_lvl_ipv6_unicast_hops(ErlNifEnv* env, #if defined(IPV6_V6ONLY) static -ERL_NIF_TERM nsetopt_lvl_ipv6_v6only(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_ipv6_v6only(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { #if defined(SOL_IPV6) int level = SOL_IPV6; @@ -10053,17 +10079,17 @@ ERL_NIF_TERM nsetopt_lvl_ipv6_v6only(ErlNifEnv* env, int level = IPPROTO_IPV6; #endif - return nsetopt_bool_opt(env, descP, level, IPV6_V6ONLY, eVal); + return esock_setopt_bool_opt(env, descP, level, IPV6_V6ONLY, eVal); } #endif #if defined(IPV6_ADD_MEMBERSHIP) || defined(IPV6_DROP_MEMBERSHIP) static -ERL_NIF_TERM nsetopt_lvl_ipv6_update_membership(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal, - int opt) +ERL_NIF_TERM esock_setopt_lvl_ipv6_update_membership(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal, + int opt) { ERL_NIF_TERM result, eMultiAddr, eInterface; struct ipv6_mreq mreq; @@ -10079,7 +10105,7 @@ ERL_NIF_TERM nsetopt_lvl_ipv6_update_membership(ErlNifEnv* env, // It must be a map if (!IS_MAP(env, eVal)) { SSDBG( descP, - ("SOCKET", "nsetopt_lvl_ipv6_update_membership -> " + ("SOCKET", "esock_setopt_lvl_ipv6_update_membership -> " "value *not* a map\r\n") ); return enif_make_badarg(env); } @@ -10087,21 +10113,21 @@ ERL_NIF_TERM nsetopt_lvl_ipv6_update_membership(ErlNifEnv* env, // It must have atleast two attributes if (!enif_get_map_size(env, eVal, &sz) || (sz < 2)) { SSDBG( descP, - ("SOCKET", "nsetopt_lvl_ipv6_update_membership -> " + ("SOCKET", "esock_setopt_lvl_ipv6_update_membership -> " "invalid map value: %T\r\n", eVal) ); return enif_make_badarg(env); } if (!GET_MAP_VAL(env, eVal, atom_multiaddr, &eMultiAddr)) { SSDBG( descP, - ("SOCKET", "nsetopt_lvl_ipv6_update_membership -> " + ("SOCKET", "esock_setopt_lvl_ipv6_update_membership -> " "failed get multiaddr (map) attribute\r\n") ); return enif_make_badarg(env); } if (!GET_MAP_VAL(env, eVal, atom_interface, &eInterface)) { SSDBG( descP, - ("SOCKET", "nsetopt_lvl_ipv6_update_membership -> " + ("SOCKET", "esock_setopt_lvl_ipv6_update_membership -> " "failed get interface (map) attribute\r\n") ); return enif_make_badarg(env); } @@ -10110,14 +10136,14 @@ ERL_NIF_TERM nsetopt_lvl_ipv6_update_membership(ErlNifEnv* env, eMultiAddr, &mreq.ipv6mr_multiaddr)) != NULL) { SSDBG( descP, - ("SOCKET", "nsetopt_lvl_ipv6_update_membership -> " + ("SOCKET", "esock_setopt_lvl_ipv6_update_membership -> " "failed decode multiaddr %T: %s\r\n", eMultiAddr, xres) ); return esock_make_error_str(env, xres); } if (!GET_UINT(env, eInterface, &mreq.ipv6mr_interface)) { SSDBG( descP, - ("SOCKET", "nsetopt_lvl_ip_update_membership -> " + ("SOCKET", "esock_setopt_lvl_ip_update_membership -> " "failed decode interface %T: %s\r\n", eInterface, xres) ); return esock_make_error(env, esock_atom_einval); } @@ -10130,7 +10156,7 @@ ERL_NIF_TERM nsetopt_lvl_ipv6_update_membership(ErlNifEnv* env, result = esock_make_error_errno(env, save_errno); SSDBG( descP, - ("SOCKET", "nsetopt_lvl_ipv6_update_membership -> " + ("SOCKET", "esock_setopt_lvl_ipv6_update_membership -> " "failed setopt: %T (%d)\r\n", result, save_errno) ); } else { @@ -10147,37 +10173,37 @@ ERL_NIF_TERM nsetopt_lvl_ipv6_update_membership(ErlNifEnv* env, -/* nsetopt_lvl_tcp - Level *TCP* option(s) +/* esock_setopt_lvl_tcp - Level *TCP* option(s) */ static -ERL_NIF_TERM nsetopt_lvl_tcp(ErlNifEnv* env, - ESockDescriptor* descP, - int eOpt, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_tcp(ErlNifEnv* env, + ESockDescriptor* descP, + int eOpt, + ERL_NIF_TERM eVal) { ERL_NIF_TERM result; SSDBG( descP, - ("SOCKET", "nsetopt_lvl_tcp -> entry with" + ("SOCKET", "esock_setopt_lvl_tcp -> entry with" "\r\n opt: %d" "\r\n", eOpt) ); switch (eOpt) { #if defined(TCP_CONGESTION) case SOCKET_OPT_TCP_CONGESTION: - result = nsetopt_lvl_tcp_congestion(env, descP, eVal); + result = esock_setopt_lvl_tcp_congestion(env, descP, eVal); break; #endif #if defined(TCP_MAXSEG) case SOCKET_OPT_TCP_MAXSEG: - result = nsetopt_lvl_tcp_maxseg(env, descP, eVal); + result = esock_setopt_lvl_tcp_maxseg(env, descP, eVal); break; #endif #if defined(TCP_NODELAY) case SOCKET_OPT_TCP_NODELAY: - result = nsetopt_lvl_tcp_nodelay(env, descP, eVal); + result = esock_setopt_lvl_tcp_nodelay(env, descP, eVal); break; #endif @@ -10190,67 +10216,68 @@ ERL_NIF_TERM nsetopt_lvl_tcp(ErlNifEnv* env, } -/* nsetopt_lvl_tcp_congestion - Level TCP CONGESTION option +/* esock_setopt_lvl_tcp_congestion - Level TCP CONGESTION option */ #if defined(TCP_CONGESTION) static -ERL_NIF_TERM nsetopt_lvl_tcp_congestion(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_tcp_congestion(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { int max = SOCKET_OPT_TCP_CONGESTION_NAME_MAX+1; - return nsetopt_str_opt(env, descP, IPPROTO_TCP, TCP_CONGESTION, max, eVal); + return esock_setopt_str_opt(env, descP, + IPPROTO_TCP, TCP_CONGESTION, max, eVal); } #endif -/* nsetopt_lvl_tcp_maxseg - Level TCP MAXSEG option +/* esock_setopt_lvl_tcp_maxseg - Level TCP MAXSEG option */ #if defined(TCP_MAXSEG) static -ERL_NIF_TERM nsetopt_lvl_tcp_maxseg(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_tcp_maxseg(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { - return nsetopt_int_opt(env, descP, IPPROTO_TCP, TCP_MAXSEG, eVal); + return esock_setopt_int_opt(env, descP, IPPROTO_TCP, TCP_MAXSEG, eVal); } #endif -/* nsetopt_lvl_tcp_nodelay - Level TCP NODELAY option +/* esock_setopt_lvl_tcp_nodelay - Level TCP NODELAY option */ #if defined(TCP_NODELAY) static -ERL_NIF_TERM nsetopt_lvl_tcp_nodelay(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_tcp_nodelay(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { - return nsetopt_bool_opt(env, descP, IPPROTO_TCP, TCP_NODELAY, eVal); + return esock_setopt_bool_opt(env, descP, IPPROTO_TCP, TCP_NODELAY, eVal); } #endif -/* nsetopt_lvl_udp - Level *UDP* option(s) +/* esock_setopt_lvl_udp - Level *UDP* option(s) */ static -ERL_NIF_TERM nsetopt_lvl_udp(ErlNifEnv* env, - ESockDescriptor* descP, - int eOpt, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_udp(ErlNifEnv* env, + ESockDescriptor* descP, + int eOpt, + ERL_NIF_TERM eVal) { ERL_NIF_TERM result; SSDBG( descP, - ("SOCKET", "nsetopt_lvl_udp -> entry with" + ("SOCKET", "esock_setopt_lvl_udp -> entry with" "\r\n opt: %d" "\r\n", eOpt) ); switch (eOpt) { #if defined(UDP_CORK) case SOCKET_OPT_UDP_CORK: - result = nsetopt_lvl_udp_cork(env, descP, eVal); + result = esock_setopt_lvl_udp_cork(env, descP, eVal); break; #endif @@ -10263,83 +10290,83 @@ ERL_NIF_TERM nsetopt_lvl_udp(ErlNifEnv* env, } -/* nsetopt_lvl_udp_cork - Level UDP CORK option +/* esock_setopt_lvl_udp_cork - Level UDP CORK option */ #if defined(UDP_CORK) static -ERL_NIF_TERM nsetopt_lvl_udp_cork(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_udp_cork(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { - return nsetopt_bool_opt(env, descP, IPPROTO_UDP, UDP_CORK, eVal); + return esock_setopt_bool_opt(env, descP, IPPROTO_UDP, UDP_CORK, eVal); } #endif -/* nsetopt_lvl_sctp - Level *SCTP* option(s) +/* esock_setopt_lvl_sctp - Level *SCTP* option(s) */ #if defined(HAVE_SCTP) static -ERL_NIF_TERM nsetopt_lvl_sctp(ErlNifEnv* env, - ESockDescriptor* descP, - int eOpt, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_sctp(ErlNifEnv* env, + ESockDescriptor* descP, + int eOpt, + ERL_NIF_TERM eVal) { ERL_NIF_TERM result; SSDBG( descP, - ("SOCKET", "nsetopt_lvl_sctp -> entry with" + ("SOCKET", "esock_setopt_lvl_sctp -> entry with" "\r\n opt: %d" "\r\n", eOpt) ); switch (eOpt) { #if defined(SCTP_ASSOCINFO) case SOCKET_OPT_SCTP_ASSOCINFO: - result = nsetopt_lvl_sctp_associnfo(env, descP, eVal); + result = esock_setopt_lvl_sctp_associnfo(env, descP, eVal); break; #endif #if defined(SCTP_AUTOCLOSE) case SOCKET_OPT_SCTP_AUTOCLOSE: - result = nsetopt_lvl_sctp_autoclose(env, descP, eVal); + result = esock_setopt_lvl_sctp_autoclose(env, descP, eVal); break; #endif #if defined(SCTP_DISABLE_FRAGMENTS) case SOCKET_OPT_SCTP_DISABLE_FRAGMENTS: - result = nsetopt_lvl_sctp_disable_fragments(env, descP, eVal); + result = esock_setopt_lvl_sctp_disable_fragments(env, descP, eVal); break; #endif #if defined(SCTP_EVENTS) case SOCKET_OPT_SCTP_EVENTS: - result = nsetopt_lvl_sctp_events(env, descP, eVal); + result = esock_setopt_lvl_sctp_events(env, descP, eVal); break; #endif #if defined(SCTP_INITMSG) case SOCKET_OPT_SCTP_INITMSG: - result = nsetopt_lvl_sctp_initmsg(env, descP, eVal); + result = esock_setopt_lvl_sctp_initmsg(env, descP, eVal); break; #endif #if defined(SCTP_MAXSEG) case SOCKET_OPT_SCTP_MAXSEG: - result = nsetopt_lvl_sctp_maxseg(env, descP, eVal); + result = esock_setopt_lvl_sctp_maxseg(env, descP, eVal); break; #endif #if defined(SCTP_NODELAY) case SOCKET_OPT_SCTP_NODELAY: - result = nsetopt_lvl_sctp_nodelay(env, descP, eVal); + result = esock_setopt_lvl_sctp_nodelay(env, descP, eVal); break; #endif #if defined(SCTP_RTOINFO) case SOCKET_OPT_SCTP_RTOINFO: - result = nsetopt_lvl_sctp_rtoinfo(env, descP, eVal); + result = esock_setopt_lvl_sctp_rtoinfo(env, descP, eVal); break; #endif @@ -10352,13 +10379,13 @@ ERL_NIF_TERM nsetopt_lvl_sctp(ErlNifEnv* env, } -/* nsetopt_lvl_sctp_associnfo - Level SCTP ASSOCINFO option +/* esock_setopt_lvl_sctp_associnfo - Level SCTP ASSOCINFO option */ #if defined(SCTP_ASSOCINFO) static -ERL_NIF_TERM nsetopt_lvl_sctp_associnfo(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_sctp_associnfo(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { ERL_NIF_TERM result; ERL_NIF_TERM eAssocId, eMaxRxt, eNumPeerDests; @@ -10369,7 +10396,7 @@ ERL_NIF_TERM nsetopt_lvl_sctp_associnfo(ErlNifEnv* env, unsigned int tmp; SSDBG( descP, - ("SOCKET", "nsetopt_lvl_sctp_associnfo -> entry with" + ("SOCKET", "esock_setopt_lvl_sctp_associnfo -> entry with" "\r\n eVal: %T" "\r\n", eVal) ); @@ -10382,7 +10409,8 @@ ERL_NIF_TERM nsetopt_lvl_sctp_associnfo(ErlNifEnv* env, return esock_make_error(env, esock_atom_einval); SSDBG( descP, - ("SOCKET", "nsetopt_lvl_sctp_associnfo -> extract attributes\r\n") ); + ("SOCKET", + "esock_setopt_lvl_sctp_associnfo -> extract attributes\r\n") ); if (!GET_MAP_VAL(env, eVal, atom_assoc_id, &eAssocId)) return esock_make_error(env, esock_atom_einval); @@ -10403,7 +10431,8 @@ ERL_NIF_TERM nsetopt_lvl_sctp_associnfo(ErlNifEnv* env, return esock_make_error(env, esock_atom_einval); SSDBG( descP, - ("SOCKET", "nsetopt_lvl_sctp_associnfo -> decode attributes\r\n") ); + ("SOCKET", + "esock_setopt_lvl_sctp_associnfo -> decode attributes\r\n") ); /* On some platforms the assoc id is typed as an unsigned integer (uint32) * So, to avoid warnings there, we always make an explicit cast... @@ -10456,7 +10485,8 @@ ERL_NIF_TERM nsetopt_lvl_sctp_associnfo(ErlNifEnv* env, return esock_make_error(env, esock_atom_einval); SSDBG( descP, - ("SOCKET", "nsetopt_lvl_sctp_associnfo -> set associnfo option\r\n") ); + ("SOCKET", + "esock_setopt_lvl_sctp_associnfo -> set associnfo option\r\n") ); res = socket_setopt(descP->sock, IPPROTO_SCTP, SCTP_ASSOCINFO, &assocParams, sizeof(assocParams)); @@ -10467,7 +10497,7 @@ ERL_NIF_TERM nsetopt_lvl_sctp_associnfo(ErlNifEnv* env, result = esock_atom_ok; SSDBG( descP, - ("SOCKET", "nsetopt_lvl_sctp_associnfo -> done with" + ("SOCKET", "esock_setopt_lvl_sctp_associnfo -> done with" "\r\n result: %T" "\r\n", result) ); @@ -10477,39 +10507,42 @@ ERL_NIF_TERM nsetopt_lvl_sctp_associnfo(ErlNifEnv* env, #endif -/* nsetopt_lvl_sctp_autoclose - Level SCTP AUTOCLOSE option +/* esock_setopt_lvl_sctp_autoclose - Level SCTP AUTOCLOSE option */ #if defined(SCTP_AUTOCLOSE) static -ERL_NIF_TERM nsetopt_lvl_sctp_autoclose(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_sctp_autoclose(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { - return nsetopt_int_opt(env, descP, IPPROTO_SCTP, SCTP_AUTOCLOSE, eVal); + return esock_setopt_int_opt(env, descP, + IPPROTO_SCTP, SCTP_AUTOCLOSE, eVal); } #endif -/* nsetopt_lvl_sctp_disable_fragments - Level SCTP DISABLE_FRAGMENTS option +/* esock_setopt_lvl_sctp_disable_fragments - + * Level SCTP DISABLE_FRAGMENTS option */ #if defined(SCTP_DISABLE_FRAGMENTS) static -ERL_NIF_TERM nsetopt_lvl_sctp_disable_fragments(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_sctp_disable_fragments(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { - return nsetopt_bool_opt(env, descP, IPPROTO_SCTP, SCTP_DISABLE_FRAGMENTS, eVal); + return esock_setopt_bool_opt(env, descP, + IPPROTO_SCTP, SCTP_DISABLE_FRAGMENTS, eVal); } #endif -/* nsetopt_lvl_sctp_events - Level SCTP EVENTS option +/* esock_setopt_lvl_sctp_events - Level SCTP EVENTS option */ #if defined(SCTP_EVENTS) static -ERL_NIF_TERM nsetopt_lvl_sctp_events(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_sctp_events(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { ERL_NIF_TERM result; ERL_NIF_TERM eDataIn, eAssoc, eAddr, eSndFailure; @@ -10526,7 +10559,7 @@ ERL_NIF_TERM nsetopt_lvl_sctp_events(ErlNifEnv* env, size_t sz; SSDBG( descP, - ("SOCKET", "nsetopt_lvl_sctp_events -> entry with" + ("SOCKET", "esock_setopt_lvl_sctp_events -> entry with" "\r\n eVal: %T" "\r\n", eVal) ); @@ -10539,7 +10572,8 @@ ERL_NIF_TERM nsetopt_lvl_sctp_events(ErlNifEnv* env, return esock_make_error(env, esock_atom_einval); SSDBG( descP, - ("SOCKET", "nsetopt_lvl_sctp_events -> extract attributes\r\n") ); + ("SOCKET", + "esock_setopt_lvl_sctp_events -> extract attributes\r\n") ); if (!GET_MAP_VAL(env, eVal, atom_data_in, &eDataIn)) return esock_make_error(env, esock_atom_einval); @@ -10576,7 +10610,8 @@ ERL_NIF_TERM nsetopt_lvl_sctp_events(ErlNifEnv* env, #endif SSDBG( descP, - ("SOCKET", "nsetopt_lvl_sctp_events -> decode attributes\r\n") ); + ("SOCKET", + "esock_setopt_lvl_sctp_events -> decode attributes\r\n") ); events.sctp_data_io_event = esock_decode_bool(eDataIn); events.sctp_association_event = esock_decode_bool(eAssoc); @@ -10594,7 +10629,8 @@ ERL_NIF_TERM nsetopt_lvl_sctp_events(ErlNifEnv* env, #endif SSDBG( descP, - ("SOCKET", "nsetopt_lvl_sctp_events -> set events option\r\n") ); + ("SOCKET", + "esock_setopt_lvl_sctp_events -> set events option\r\n") ); res = socket_setopt(descP->sock, IPPROTO_SCTP, SCTP_EVENTS, &events, sizeof(events)); @@ -10605,7 +10641,7 @@ ERL_NIF_TERM nsetopt_lvl_sctp_events(ErlNifEnv* env, result = esock_atom_ok; SSDBG( descP, - ("SOCKET", "nsetopt_lvl_sctp_events -> done with" + ("SOCKET", "esock_setopt_lvl_sctp_events -> done with" "\r\n result: %T" "\r\n", result) ); @@ -10615,13 +10651,13 @@ ERL_NIF_TERM nsetopt_lvl_sctp_events(ErlNifEnv* env, #endif -/* nsetopt_lvl_sctp_initmsg - Level SCTP INITMSG option +/* esock_setopt_lvl_sctp_initmsg - Level SCTP INITMSG option */ #if defined(SCTP_INITMSG) static -ERL_NIF_TERM nsetopt_lvl_sctp_initmsg(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_sctp_initmsg(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { ERL_NIF_TERM result; ERL_NIF_TERM eNumOut, eMaxIn, eMaxAttempts, eMaxInitTO; @@ -10631,7 +10667,7 @@ ERL_NIF_TERM nsetopt_lvl_sctp_initmsg(ErlNifEnv* env, unsigned int tmp; SSDBG( descP, - ("SOCKET", "nsetopt_lvl_sctp_initmsg -> entry with" + ("SOCKET", "esock_setopt_lvl_sctp_initmsg -> entry with" "\r\n eVal: %T" "\r\n", eVal) ); @@ -10644,7 +10680,8 @@ ERL_NIF_TERM nsetopt_lvl_sctp_initmsg(ErlNifEnv* env, return esock_make_error(env, esock_atom_einval); SSDBG( descP, - ("SOCKET", "nsetopt_lvl_sctp_initmsg -> extract attributes\r\n") ); + ("SOCKET", + "esock_setopt_lvl_sctp_initmsg -> extract attributes\r\n") ); if (!GET_MAP_VAL(env, eVal, atom_num_outstreams, &eNumOut)) return esock_make_error(env, esock_atom_einval); @@ -10659,7 +10696,8 @@ ERL_NIF_TERM nsetopt_lvl_sctp_initmsg(ErlNifEnv* env, return esock_make_error(env, esock_atom_einval); SSDBG( descP, - ("SOCKET", "nsetopt_lvl_sctp_initmsg -> decode attributes\r\n") ); + ("SOCKET", + "esock_setopt_lvl_sctp_initmsg -> decode attributes\r\n") ); if (!GET_UINT(env, eNumOut, &tmp)) return esock_make_error(env, esock_atom_einval); @@ -10678,7 +10716,8 @@ ERL_NIF_TERM nsetopt_lvl_sctp_initmsg(ErlNifEnv* env, initMsg.sinit_max_init_timeo = (Uint16) tmp; SSDBG( descP, - ("SOCKET", "nsetopt_lvl_sctp_initmsg -> set initmsg option\r\n") ); + ("SOCKET", + "esock_setopt_lvl_sctp_initmsg -> set initmsg option\r\n") ); res = socket_setopt(descP->sock, IPPROTO_SCTP, SCTP_INITMSG, &initMsg, sizeof(initMsg)); @@ -10689,7 +10728,7 @@ ERL_NIF_TERM nsetopt_lvl_sctp_initmsg(ErlNifEnv* env, result = esock_atom_ok; SSDBG( descP, - ("SOCKET", "nsetopt_lvl_sctp_initmsg -> done with" + ("SOCKET", "esock_setopt_lvl_sctp_initmsg -> done with" "\r\n result: %T" "\r\n", result) ); @@ -10699,39 +10738,39 @@ ERL_NIF_TERM nsetopt_lvl_sctp_initmsg(ErlNifEnv* env, #endif -/* nsetopt_lvl_sctp_maxseg - Level SCTP MAXSEG option +/* esock_setopt_lvl_sctp_maxseg - Level SCTP MAXSEG option */ #if defined(SCTP_MAXSEG) static -ERL_NIF_TERM nsetopt_lvl_sctp_maxseg(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_sctp_maxseg(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { - return nsetopt_int_opt(env, descP, IPPROTO_SCTP, SCTP_MAXSEG, eVal); + return esock_setopt_int_opt(env, descP, IPPROTO_SCTP, SCTP_MAXSEG, eVal); } #endif -/* nsetopt_lvl_sctp_nodelay - Level SCTP NODELAY option +/* esock_setopt_lvl_sctp_nodelay - Level SCTP NODELAY option */ #if defined(SCTP_NODELAY) static -ERL_NIF_TERM nsetopt_lvl_sctp_nodelay(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_sctp_nodelay(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { - return nsetopt_bool_opt(env, descP, IPPROTO_SCTP, SCTP_NODELAY, eVal); + return esock_setopt_bool_opt(env, descP, IPPROTO_SCTP, SCTP_NODELAY, eVal); } #endif -/* nsetopt_lvl_sctp_rtoinfo - Level SCTP RTOINFO option +/* esock_setopt_lvl_sctp_rtoinfo - Level SCTP RTOINFO option */ #if defined(SCTP_RTOINFO) static -ERL_NIF_TERM nsetopt_lvl_sctp_rtoinfo(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_lvl_sctp_rtoinfo(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM eVal) { ERL_NIF_TERM result; ERL_NIF_TERM eAssocId, eInitial, eMax, eMin; @@ -10740,7 +10779,7 @@ ERL_NIF_TERM nsetopt_lvl_sctp_rtoinfo(ErlNifEnv* env, size_t sz; SSDBG( descP, - ("SOCKET", "nsetopt_lvl_sctp_rtoinfo -> entry with" + ("SOCKET", "esock_setopt_lvl_sctp_rtoinfo -> entry with" "\r\n eVal: %T" "\r\n", eVal) ); @@ -10753,7 +10792,8 @@ ERL_NIF_TERM nsetopt_lvl_sctp_rtoinfo(ErlNifEnv* env, return esock_make_error(env, esock_atom_einval); SSDBG( descP, - ("SOCKET", "nsetopt_lvl_sctp_rtoinfo -> extract attributes\r\n") ); + ("SOCKET", + "esock_setopt_lvl_sctp_rtoinfo -> extract attributes\r\n") ); if (!GET_MAP_VAL(env, eVal, atom_assoc_id, &eAssocId)) return esock_make_error(env, esock_atom_einval); @@ -10768,7 +10808,8 @@ ERL_NIF_TERM nsetopt_lvl_sctp_rtoinfo(ErlNifEnv* env, return esock_make_error(env, esock_atom_einval); SSDBG( descP, - ("SOCKET", "nsetopt_lvl_sctp_rtoinfo -> decode attributes\r\n") ); + ("SOCKET", + "esock_setopt_lvl_sctp_rtoinfo -> decode attributes\r\n") ); /* On some platforms the assoc id is typed as an unsigned integer (uint32) * So, to avoid warnings there, we always make an explicit cast... @@ -10803,7 +10844,8 @@ ERL_NIF_TERM nsetopt_lvl_sctp_rtoinfo(ErlNifEnv* env, return esock_make_error(env, esock_atom_einval); SSDBG( descP, - ("SOCKET", "nsetopt_lvl_sctp_rtoinfo -> set associnfo option\r\n") ); + ("SOCKET", + "esock_setopt_lvl_sctp_rtoinfo -> set associnfo option\r\n") ); res = socket_setopt(descP->sock, IPPROTO_SCTP, SCTP_RTOINFO, &rtoInfo, sizeof(rtoInfo)); @@ -10814,7 +10856,7 @@ ERL_NIF_TERM nsetopt_lvl_sctp_rtoinfo(ErlNifEnv* env, result = esock_atom_ok; SSDBG( descP, - ("SOCKET", "nsetopt_lvl_sctp_rtoinfo -> done with" + ("SOCKET", "esock_setopt_lvl_sctp_rtoinfo -> done with" "\r\n result: %T" "\r\n", result) ); @@ -10830,14 +10872,14 @@ ERL_NIF_TERM nsetopt_lvl_sctp_rtoinfo(ErlNifEnv* env, -/* nsetopt_bool_opt - set an option that has an (integer) bool value +/* esock_setopt_bool_opt - set an option that has an (integer) bool value */ static -ERL_NIF_TERM nsetopt_bool_opt(ErlNifEnv* env, - ESockDescriptor* descP, - int level, - int opt, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_bool_opt(ErlNifEnv* env, + ESockDescriptor* descP, + int level, + int opt, + ERL_NIF_TERM eVal) { ERL_NIF_TERM result; BOOLEAN_T val; @@ -10857,14 +10899,14 @@ ERL_NIF_TERM nsetopt_bool_opt(ErlNifEnv* env, } -/* nsetopt_int_opt - set an option that has an integer value +/* esock_setopt_int_opt - set an option that has an integer value */ static -ERL_NIF_TERM nsetopt_int_opt(ErlNifEnv* env, - ESockDescriptor* descP, - int level, - int opt, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_int_opt(ErlNifEnv* env, + ESockDescriptor* descP, + int level, + int opt, + ERL_NIF_TERM eVal) { ERL_NIF_TERM result; int val; @@ -10874,7 +10916,7 @@ ERL_NIF_TERM nsetopt_int_opt(ErlNifEnv* env, /* SSDBG( descP, - ("SOCKET", "nsetopt_int_opt -> set option" + ("SOCKET", "esock_setopt_int_opt -> set option" "\r\n opt: %d" "\r\n val: %d" "\r\n", opt, val) ); @@ -10895,16 +10937,16 @@ ERL_NIF_TERM nsetopt_int_opt(ErlNifEnv* env, } -/* nsetopt_str_opt - set an option that has an string value +/* esock_setopt_str_opt - set an option that has an string value */ #if defined(USE_SETOPT_STR_OPT) static -ERL_NIF_TERM nsetopt_str_opt(ErlNifEnv* env, - ESockDescriptor* descP, - int level, - int opt, - int max, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_str_opt(ErlNifEnv* env, + ESockDescriptor* descP, + int level, + int opt, + int max, + ERL_NIF_TERM eVal) { ERL_NIF_TERM result; char* val = MALLOC(max); @@ -10929,14 +10971,14 @@ ERL_NIF_TERM nsetopt_str_opt(ErlNifEnv* env, #endif -/* nsetopt_timeval_opt - set an option that has an (timeval) bool value +/* esock_setopt_timeval_opt - set an option that has an (timeval) bool value */ static -ERL_NIF_TERM nsetopt_timeval_opt(ErlNifEnv* env, - ESockDescriptor* descP, - int level, - int opt, - ERL_NIF_TERM eVal) +ERL_NIF_TERM esock_setopt_timeval_opt(ErlNifEnv* env, + ESockDescriptor* descP, + int level, + int opt, + ERL_NIF_TERM eVal) { ERL_NIF_TERM result; struct timeval timeVal; @@ -10944,7 +10986,7 @@ ERL_NIF_TERM nsetopt_timeval_opt(ErlNifEnv* env, char* xres; SSDBG( descP, - ("SOCKET", "nsetopt_timeval_opt -> entry with" + ("SOCKET", "esock_setopt_timeval_opt -> entry with" "\r\n eVal: %T" "\r\n", eVal) ); @@ -10952,7 +10994,7 @@ ERL_NIF_TERM nsetopt_timeval_opt(ErlNifEnv* env, return esock_make_error_str(env, xres); SSDBG( descP, - ("SOCKET", "nsetopt_timeval_opt -> set timeval option\r\n") ); + ("SOCKET", "esock_setopt_timeval_opt -> set timeval option\r\n") ); res = socket_setopt(descP->sock, level, opt, &timeVal, sizeof(timeVal)); @@ -10962,7 +11004,7 @@ ERL_NIF_TERM nsetopt_timeval_opt(ErlNifEnv* env, result = esock_atom_ok; SSDBG( descP, - ("SOCKET", "nsetopt_timeval_opt -> done with" + ("SOCKET", "esock_setopt_timeval_opt -> done with" "\r\n result: %T" "\r\n", result) ); @@ -11200,7 +11242,7 @@ ERL_NIF_TERM nif_getopt(ErlNifEnv* env, MLOCK(descP->cfgMtx); - result = ngetopt(env, descP, isEncoded, isOTP, level, eOpt); + result = esock_getopt(env, descP, isEncoded, isOTP, level, eOpt); MUNLOCK(descP->cfgMtx); @@ -11213,18 +11255,18 @@ ERL_NIF_TERM nif_getopt(ErlNifEnv* env, #if !defined(__WIN32__) static -ERL_NIF_TERM ngetopt(ErlNifEnv* env, - ESockDescriptor* descP, - BOOLEAN_T isEncoded, - BOOLEAN_T isOTP, - int level, - ERL_NIF_TERM eOpt) +ERL_NIF_TERM esock_getopt(ErlNifEnv* env, + ESockDescriptor* descP, + BOOLEAN_T isEncoded, + BOOLEAN_T isOTP, + int level, + ERL_NIF_TERM eOpt) { ERL_NIF_TERM result; int opt; SSDBG( descP, - ("SOCKET", "ngetopt -> entry with" + ("SOCKET", "esock_getopt -> entry with" "\r\n isEncoded: %s" "\r\n isOTP: %s" "\r\n level: %d" @@ -11236,20 +11278,20 @@ ERL_NIF_TERM ngetopt(ErlNifEnv* env, * but options for our implementation. */ if (GET_INT(env, eOpt, &opt)) - result = ngetopt_otp(env, descP, opt); + result = esock_getopt_otp(env, descP, opt); else result = esock_make_error(env, esock_atom_einval); } else if (!isEncoded) { - result = ngetopt_native(env, descP, level, eOpt); + result = esock_getopt_native(env, descP, level, eOpt); } else { if (GET_INT(env, eOpt, &opt)) - result = ngetopt_level(env, descP, level, opt); + result = esock_getopt_level(env, descP, level, opt); else result = esock_make_error(env, esock_atom_einval); } SSDBG( descP, - ("SOCKET", "ngetopt -> done when" + ("SOCKET", "esock_getopt -> done when" "\r\n result: %T" "\r\n", result) ); @@ -11258,60 +11300,60 @@ ERL_NIF_TERM ngetopt(ErlNifEnv* env, -/* ngetopt_otp - Handle OTP (level) options +/* esock_getopt_otp - Handle OTP (level) options */ static -ERL_NIF_TERM ngetopt_otp(ErlNifEnv* env, - ESockDescriptor* descP, - int eOpt) +ERL_NIF_TERM esock_getopt_otp(ErlNifEnv* env, + ESockDescriptor* descP, + int eOpt) { ERL_NIF_TERM result; SSDBG( descP, - ("SOCKET", "ngetopt_otp -> entry with" + ("SOCKET", "esock_getopt_otp -> entry with" "\r\n eOpt: %d" "\r\n", eOpt) ); switch (eOpt) { case SOCKET_OPT_OTP_DEBUG: - result = ngetopt_otp_debug(env, descP); + result = esock_getopt_otp_debug(env, descP); break; case SOCKET_OPT_OTP_IOW: - result = ngetopt_otp_iow(env, descP); + result = esock_getopt_otp_iow(env, descP); break; case SOCKET_OPT_OTP_CTRL_PROC: - result = ngetopt_otp_ctrl_proc(env, descP); + result = esock_getopt_otp_ctrl_proc(env, descP); break; case SOCKET_OPT_OTP_RCVBUF: - result = ngetopt_otp_rcvbuf(env, descP); + result = esock_getopt_otp_rcvbuf(env, descP); break; case SOCKET_OPT_OTP_RCVCTRLBUF: - result = ngetopt_otp_rcvctrlbuf(env, descP); + result = esock_getopt_otp_rcvctrlbuf(env, descP); break; case SOCKET_OPT_OTP_SNDCTRLBUF: - result = ngetopt_otp_sndctrlbuf(env, descP); + result = esock_getopt_otp_sndctrlbuf(env, descP); break; case SOCKET_OPT_OTP_FD: - result = ngetopt_otp_fd(env, descP); + result = esock_getopt_otp_fd(env, descP); break; /* *** INTERNAL *** */ case SOCKET_OPT_OTP_DOMAIN: - result = ngetopt_otp_domain(env, descP); + result = esock_getopt_otp_domain(env, descP); break; case SOCKET_OPT_OTP_TYPE: - result = ngetopt_otp_type(env, descP); + result = esock_getopt_otp_type(env, descP); break; case SOCKET_OPT_OTP_PROTOCOL: - result = ngetopt_otp_protocol(env, descP); + result = esock_getopt_otp_protocol(env, descP); break; default: @@ -11320,7 +11362,7 @@ ERL_NIF_TERM ngetopt_otp(ErlNifEnv* env, } SSDBG( descP, - ("SOCKET", "ngetopt_otp -> done when" + ("SOCKET", "esock_getopt_otp -> done when" "\r\n result: %T" "\r\n", result) ); @@ -11328,11 +11370,11 @@ ERL_NIF_TERM ngetopt_otp(ErlNifEnv* env, } -/* ngetopt_otp_debug - Handle the OTP (level) debug option +/* esock_getopt_otp_debug - Handle the OTP (level) debug option */ static -ERL_NIF_TERM ngetopt_otp_debug(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_otp_debug(ErlNifEnv* env, + ESockDescriptor* descP) { ERL_NIF_TERM eVal = esock_encode_bool(descP->dbg); @@ -11340,11 +11382,11 @@ ERL_NIF_TERM ngetopt_otp_debug(ErlNifEnv* env, } -/* ngetopt_otp_iow - Handle the OTP (level) iow option +/* esock_getopt_otp_iow - Handle the OTP (level) iow option */ static -ERL_NIF_TERM ngetopt_otp_iow(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_otp_iow(ErlNifEnv* env, + ESockDescriptor* descP) { ERL_NIF_TERM eVal = esock_encode_bool(descP->iow); @@ -11352,11 +11394,11 @@ ERL_NIF_TERM ngetopt_otp_iow(ErlNifEnv* env, } -/* ngetopt_otp_ctrl_proc - Handle the OTP (level) controlling_process option +/* esock_getopt_otp_ctrl_proc - Handle the OTP (level) controlling_process option */ static -ERL_NIF_TERM ngetopt_otp_ctrl_proc(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_otp_ctrl_proc(ErlNifEnv* env, + ESockDescriptor* descP) { ERL_NIF_TERM eVal = MKPID(env, &descP->ctrlPid); @@ -11365,11 +11407,11 @@ ERL_NIF_TERM ngetopt_otp_ctrl_proc(ErlNifEnv* env, -/* ngetopt_otp_rcvbuf - Handle the OTP (level) rcvbuf option +/* esock_getopt_otp_rcvbuf - Handle the OTP (level) rcvbuf option */ static -ERL_NIF_TERM ngetopt_otp_rcvbuf(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_otp_rcvbuf(ErlNifEnv* env, + ESockDescriptor* descP) { ERL_NIF_TERM eVal; @@ -11383,11 +11425,11 @@ ERL_NIF_TERM ngetopt_otp_rcvbuf(ErlNifEnv* env, } -/* ngetopt_otp_rcvctrlbuf - Handle the OTP (level) rcvctrlbuf option +/* esock_getopt_otp_rcvctrlbuf - Handle the OTP (level) rcvctrlbuf option */ static -ERL_NIF_TERM ngetopt_otp_rcvctrlbuf(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_otp_rcvctrlbuf(ErlNifEnv* env, + ESockDescriptor* descP) { ERL_NIF_TERM eVal = MKI(env, descP->rCtrlSz); @@ -11395,11 +11437,11 @@ ERL_NIF_TERM ngetopt_otp_rcvctrlbuf(ErlNifEnv* env, } -/* ngetopt_otp_sndctrlbuf - Handle the OTP (level) sndctrlbuf option +/* esock_getopt_otp_sndctrlbuf - Handle the OTP (level) sndctrlbuf option */ static -ERL_NIF_TERM ngetopt_otp_sndctrlbuf(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_otp_sndctrlbuf(ErlNifEnv* env, + ESockDescriptor* descP) { ERL_NIF_TERM eVal = MKI(env, descP->wCtrlSz); @@ -11407,11 +11449,11 @@ ERL_NIF_TERM ngetopt_otp_sndctrlbuf(ErlNifEnv* env, } -/* ngetopt_otp_fd - Handle the OTP (level) fd option +/* esock_getopt_otp_fd - Handle the OTP (level) fd option */ static -ERL_NIF_TERM ngetopt_otp_fd(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_otp_fd(ErlNifEnv* env, + ESockDescriptor* descP) { ERL_NIF_TERM eVal = MKI(env, descP->sock); @@ -11419,11 +11461,11 @@ ERL_NIF_TERM ngetopt_otp_fd(ErlNifEnv* env, } -/* ngetopt_otp_domain - Handle the OTP (level) domain option +/* esock_getopt_otp_domain - Handle the OTP (level) domain option */ static -ERL_NIF_TERM ngetopt_otp_domain(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_otp_domain(ErlNifEnv* env, + ESockDescriptor* descP) { ERL_NIF_TERM result, reason; int val = descP->domain; @@ -11455,11 +11497,11 @@ ERL_NIF_TERM ngetopt_otp_domain(ErlNifEnv* env, } -/* ngetopt_otp_type - Handle the OTP (level) type options. +/* esock_getopt_otp_type - Handle the OTP (level) type options. */ static -ERL_NIF_TERM ngetopt_otp_type(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_otp_type(ErlNifEnv* env, + ESockDescriptor* descP) { ERL_NIF_TERM result, reason; int val = descP->type; @@ -11496,11 +11538,11 @@ ERL_NIF_TERM ngetopt_otp_type(ErlNifEnv* env, } -/* ngetopt_otp_protocol - Handle the OTP (level) protocol options. +/* esock_getopt_otp_protocol - Handle the OTP (level) protocol options. */ static -ERL_NIF_TERM ngetopt_otp_protocol(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_otp_protocol(ErlNifEnv* env, + ESockDescriptor* descP) { ERL_NIF_TERM result, reason; int val = descP->protocol; @@ -11548,10 +11590,10 @@ ERL_NIF_TERM ngetopt_otp_protocol(ErlNifEnv* env, * format: {NativeOpt :: integer(), ValueSize :: non_neg_integer()} */ static -ERL_NIF_TERM ngetopt_native(ErlNifEnv* env, - ESockDescriptor* descP, - int level, - ERL_NIF_TERM eOpt) +ERL_NIF_TERM esock_getopt_native(ErlNifEnv* env, + ESockDescriptor* descP, + int level, + ERL_NIF_TERM eOpt) { ERL_NIF_TERM result = enif_make_badarg(env); int opt; @@ -11559,7 +11601,7 @@ ERL_NIF_TERM ngetopt_native(ErlNifEnv* env, SOCKOPTLEN_T valueSz; SSDBG( descP, - ("SOCKET", "ngetopt_native -> entry with" + ("SOCKET", "esock_getopt_native -> entry with" "\r\n level: %d" "\r\n eOpt: %T" "\r\n", level, eOpt) ); @@ -11573,20 +11615,21 @@ ERL_NIF_TERM ngetopt_native(ErlNifEnv* env, if (decode_native_get_opt(env, eOpt, &opt, &valueType, (int*) &valueSz)) { SSDBG( descP, - ("SOCKET", "ngetopt_native -> decoded opt" + ("SOCKET", "esock_getopt_native -> decoded opt" "\r\n valueType: %d (%s)" "\r\n ValueSize: %d" "\r\n", valueType, VT2S(valueType), valueSz) ); switch (valueType) { case SOCKET_OPT_VALUE_TYPE_UNSPEC: - result = ngetopt_native_unspec(env, descP, level, opt, valueSz); + result = esock_getopt_native_unspec(env, descP, + level, opt, valueSz); break; case SOCKET_OPT_VALUE_TYPE_INT: - result = ngetopt_int_opt(env, descP, level, opt); + result = esock_getopt_int_opt(env, descP, level, opt); break; case SOCKET_OPT_VALUE_TYPE_BOOL: - result = ngetopt_bool_opt(env, descP, level, opt); + result = esock_getopt_bool_opt(env, descP, level, opt); break; default: result = esock_make_error(env, esock_atom_einval); @@ -11597,7 +11640,7 @@ ERL_NIF_TERM ngetopt_native(ErlNifEnv* env, } SSDBG( descP, - ("SOCKET", "ngetopt_native -> done when" + ("SOCKET", "esock_getopt_native -> done when" "\r\n result: %T" "\r\n", result) ); @@ -11606,17 +11649,17 @@ ERL_NIF_TERM ngetopt_native(ErlNifEnv* env, static -ERL_NIF_TERM ngetopt_native_unspec(ErlNifEnv* env, - ESockDescriptor* descP, - int level, - int opt, - SOCKOPTLEN_T valueSz) +ERL_NIF_TERM esock_getopt_native_unspec(ErlNifEnv* env, + ESockDescriptor* descP, + int level, + int opt, + SOCKOPTLEN_T valueSz) { ERL_NIF_TERM result = esock_make_error(env, esock_atom_einval); int res; SSDBG( descP, - ("SOCKET", "ngetopt_native_unspec -> entry with" + ("SOCKET", "esock_getopt_native_unspec -> entry with" "\r\n level: %d" "\r\n opt: %d" "\r\n valueSz: %d" @@ -11632,7 +11675,8 @@ ERL_NIF_TERM ngetopt_native_unspec(ErlNifEnv* env, SOCKOPTLEN_T vsz = valueSz; ErlNifBinary val; - SSDBG( descP, ("SOCKET", "ngetopt_native_unspec -> try alloc buffer\r\n") ); + SSDBG( descP, ("SOCKET", + "esock_getopt_native_unspec -> try alloc buffer\r\n") ); if (ALLOC_BIN(vsz, &val)) { int saveErrno; @@ -11664,7 +11708,7 @@ ERL_NIF_TERM ngetopt_native_unspec(ErlNifEnv* env, } SSDBG( descP, - ("SOCKET", "ngetopt_native_unspec -> done when" + ("SOCKET", "esock_getopt_native_unspec -> done when" "\r\n result: %T" "\r\n", result) ); @@ -11673,25 +11717,25 @@ ERL_NIF_TERM ngetopt_native_unspec(ErlNifEnv* env, -/* ngetopt_level - A "proper" level (option) has been specified +/* esock_getopt_level - A "proper" level (option) has been specified */ static -ERL_NIF_TERM ngetopt_level(ErlNifEnv* env, - ESockDescriptor* descP, - int level, - int eOpt) +ERL_NIF_TERM esock_getopt_level(ErlNifEnv* env, + ESockDescriptor* descP, + int level, + int eOpt) { ERL_NIF_TERM result; SSDBG( descP, - ("SOCKET", "ngetopt_level -> entry with" + ("SOCKET", "esock_getopt_level -> entry with" "\r\n level: %d" "\r\n eOpt: %d" "\r\n", level, eOpt) ); switch (level) { case SOL_SOCKET: - result = ngetopt_lvl_socket(env, descP, eOpt); + result = esock_getopt_lvl_socket(env, descP, eOpt); break; #if defined(SOL_IP) @@ -11699,7 +11743,7 @@ ERL_NIF_TERM ngetopt_level(ErlNifEnv* env, #else case IPPROTO_IP: #endif - result = ngetopt_lvl_ip(env, descP, eOpt); + result = esock_getopt_lvl_ip(env, descP, eOpt); break; #if defined(HAVE_IPV6) @@ -11708,21 +11752,21 @@ ERL_NIF_TERM ngetopt_level(ErlNifEnv* env, #else case IPPROTO_IPV6: #endif - result = ngetopt_lvl_ipv6(env, descP, eOpt); + result = esock_getopt_lvl_ipv6(env, descP, eOpt); break; #endif case IPPROTO_TCP: - result = ngetopt_lvl_tcp(env, descP, eOpt); + result = esock_getopt_lvl_tcp(env, descP, eOpt); break; case IPPROTO_UDP: - result = ngetopt_lvl_udp(env, descP, eOpt); + result = esock_getopt_lvl_udp(env, descP, eOpt); break; #if defined(HAVE_SCTP) case IPPROTO_SCTP: - result = ngetopt_lvl_sctp(env, descP, eOpt); + result = esock_getopt_lvl_sctp(env, descP, eOpt); break; #endif @@ -11732,7 +11776,7 @@ ERL_NIF_TERM ngetopt_level(ErlNifEnv* env, } SSDBG( descP, - ("SOCKET", "ngetopt_level -> done when" + ("SOCKET", "esock_getopt_level -> done when" "\r\n result: %T" "\r\n", result) ); @@ -11740,150 +11784,150 @@ ERL_NIF_TERM ngetopt_level(ErlNifEnv* env, } -/* ngetopt_lvl_socket - Level *SOCKET* option +/* esock_getopt_lvl_socket - Level *SOCKET* option */ static -ERL_NIF_TERM ngetopt_lvl_socket(ErlNifEnv* env, - ESockDescriptor* descP, - int eOpt) +ERL_NIF_TERM esock_getopt_lvl_socket(ErlNifEnv* env, + ESockDescriptor* descP, + int eOpt) { ERL_NIF_TERM result; SSDBG( descP, - ("SOCKET", "ngetopt_lvl_socket -> entry with" + ("SOCKET", "esock_getopt_lvl_socket -> entry with" "\r\n eOpt: %d" "\r\n", eOpt) ); switch (eOpt) { #if defined(SO_ACCEPTCONN) case SOCKET_OPT_SOCK_ACCEPTCONN: - result = ngetopt_lvl_sock_acceptconn(env, descP); + result = esock_getopt_lvl_sock_acceptconn(env, descP); break; #endif #if defined(SO_BINDTODEVICE) case SOCKET_OPT_SOCK_BINDTODEVICE: - result = ngetopt_lvl_sock_bindtodevice(env, descP); + result = esock_getopt_lvl_sock_bindtodevice(env, descP); break; #endif #if defined(SO_BROADCAST) case SOCKET_OPT_SOCK_BROADCAST: - result = ngetopt_lvl_sock_broadcast(env, descP); + result = esock_getopt_lvl_sock_broadcast(env, descP); break; #endif #if defined(SO_DEBUG) case SOCKET_OPT_SOCK_DEBUG: - result = ngetopt_lvl_sock_debug(env, descP); + result = esock_getopt_lvl_sock_debug(env, descP); break; #endif #if defined(SO_DOMAIN) case SOCKET_OPT_SOCK_DOMAIN: - result = ngetopt_lvl_sock_domain(env, descP); + result = esock_getopt_lvl_sock_domain(env, descP); break; #endif #if defined(SO_DONTROUTE) case SOCKET_OPT_SOCK_DONTROUTE: - result = ngetopt_lvl_sock_dontroute(env, descP); + result = esock_getopt_lvl_sock_dontroute(env, descP); break; #endif #if defined(SO_KEEPALIVE) case SOCKET_OPT_SOCK_KEEPALIVE: - result = ngetopt_lvl_sock_keepalive(env, descP); + result = esock_getopt_lvl_sock_keepalive(env, descP); break; #endif #if defined(SO_LINGER) case SOCKET_OPT_SOCK_LINGER: - result = ngetopt_lvl_sock_linger(env, descP); + result = esock_getopt_lvl_sock_linger(env, descP); break; #endif #if defined(SO_OOBINLINE) case SOCKET_OPT_SOCK_OOBINLINE: - result = ngetopt_lvl_sock_oobinline(env, descP); + result = esock_getopt_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); + result = esock_getopt_lvl_sock_peek_off(env, descP); break; #endif #if defined(SO_PRIORITY) case SOCKET_OPT_SOCK_PRIORITY: - result = ngetopt_lvl_sock_priority(env, descP); + result = esock_getopt_lvl_sock_priority(env, descP); break; #endif #if defined(SO_PROTOCOL) case SOCKET_OPT_SOCK_PROTOCOL: - result = ngetopt_lvl_sock_protocol(env, descP); + result = esock_getopt_lvl_sock_protocol(env, descP); break; #endif #if defined(SO_RCVBUF) case SOCKET_OPT_SOCK_RCVBUF: - result = ngetopt_lvl_sock_rcvbuf(env, descP); + result = esock_getopt_lvl_sock_rcvbuf(env, descP); break; #endif #if defined(SO_RCVLOWAT) case SOCKET_OPT_SOCK_RCVLOWAT: - result = ngetopt_lvl_sock_rcvlowat(env, descP); + result = esock_getopt_lvl_sock_rcvlowat(env, descP); break; #endif #if defined(SO_RCVTIMEO) case SOCKET_OPT_SOCK_RCVTIMEO: - result = ngetopt_lvl_sock_rcvtimeo(env, descP); + result = esock_getopt_lvl_sock_rcvtimeo(env, descP); break; #endif #if defined(SO_REUSEADDR) case SOCKET_OPT_SOCK_REUSEADDR: - result = ngetopt_lvl_sock_reuseaddr(env, descP); + result = esock_getopt_lvl_sock_reuseaddr(env, descP); break; #endif #if defined(SO_REUSEPORT) case SOCKET_OPT_SOCK_REUSEPORT: - result = ngetopt_lvl_sock_reuseport(env, descP); + result = esock_getopt_lvl_sock_reuseport(env, descP); break; #endif #if defined(SO_SNDBUF) case SOCKET_OPT_SOCK_SNDBUF: - result = ngetopt_lvl_sock_sndbuf(env, descP); + result = esock_getopt_lvl_sock_sndbuf(env, descP); break; #endif #if defined(SO_SNDLOWAT) case SOCKET_OPT_SOCK_SNDLOWAT: - result = ngetopt_lvl_sock_sndlowat(env, descP); + result = esock_getopt_lvl_sock_sndlowat(env, descP); break; #endif #if defined(SO_SNDTIMEO) case SOCKET_OPT_SOCK_SNDTIMEO: - result = ngetopt_lvl_sock_sndtimeo(env, descP); + result = esock_getopt_lvl_sock_sndtimeo(env, descP); break; #endif #if defined(SO_TIMESTAMP) case SOCKET_OPT_SOCK_TIMESTAMP: - result = ngetopt_lvl_sock_timestamp(env, descP); + result = esock_getopt_lvl_sock_timestamp(env, descP); break; #endif #if defined(SO_TYPE) case SOCKET_OPT_SOCK_TYPE: - result = ngetopt_lvl_sock_type(env, descP); + result = esock_getopt_lvl_sock_type(env, descP); break; #endif @@ -11893,7 +11937,7 @@ ERL_NIF_TERM ngetopt_lvl_socket(ErlNifEnv* env, } SSDBG( descP, - ("SOCKET", "ngetopt_lvl_socket -> done when" + ("SOCKET", "esock_getopt_lvl_socket -> done when" "\r\n result: %T" "\r\n", result) ); @@ -11903,51 +11947,52 @@ ERL_NIF_TERM ngetopt_lvl_socket(ErlNifEnv* env, #if defined(SO_ACCEPTCONN) static -ERL_NIF_TERM ngetopt_lvl_sock_acceptconn(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_sock_acceptconn(ErlNifEnv* env, + ESockDescriptor* descP) { - return ngetopt_bool_opt(env, descP, SOL_SOCKET, SO_ACCEPTCONN); + return esock_getopt_bool_opt(env, descP, SOL_SOCKET, SO_ACCEPTCONN); } #endif #if defined(SO_BINDTODEVICE) static -ERL_NIF_TERM ngetopt_lvl_sock_bindtodevice(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_sock_bindtodevice(ErlNifEnv* env, + ESockDescriptor* descP) { SSDBG( descP, - ("SOCKET", "ngetopt_lvl_sock_bindtodevice -> entry with\r\n") ); + ("SOCKET", "esock_getopt_lvl_sock_bindtodevice -> entry with\r\n") ); - return ngetopt_str_opt(env, descP, SOL_SOCKET, SO_BINDTODEVICE, IFNAMSIZ+1); + return esock_getopt_str_opt(env, descP, + SOL_SOCKET, SO_BINDTODEVICE, IFNAMSIZ+1); } #endif #if defined(SO_BROADCAST) static -ERL_NIF_TERM ngetopt_lvl_sock_broadcast(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_sock_broadcast(ErlNifEnv* env, + ESockDescriptor* descP) { - return ngetopt_bool_opt(env, descP, SOL_SOCKET, SO_BROADCAST); + return esock_getopt_bool_opt(env, descP, SOL_SOCKET, SO_BROADCAST); } #endif #if defined(SO_DEBUG) static -ERL_NIF_TERM ngetopt_lvl_sock_debug(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_sock_debug(ErlNifEnv* env, + ESockDescriptor* descP) { - return ngetopt_int_opt(env, descP, SOL_SOCKET, SO_DEBUG); + return esock_getopt_int_opt(env, descP, SOL_SOCKET, SO_DEBUG); } #endif #if defined(SO_DOMAIN) static -ERL_NIF_TERM ngetopt_lvl_sock_domain(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_sock_domain(ErlNifEnv* env, + ESockDescriptor* descP) { ERL_NIF_TERM result, reason; int val; @@ -11991,28 +12036,28 @@ ERL_NIF_TERM ngetopt_lvl_sock_domain(ErlNifEnv* env, #if defined(SO_DONTROUTE) static -ERL_NIF_TERM ngetopt_lvl_sock_dontroute(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_sock_dontroute(ErlNifEnv* env, + ESockDescriptor* descP) { - return ngetopt_bool_opt(env, descP, SOL_SOCKET, SO_DONTROUTE); + return esock_getopt_bool_opt(env, descP, SOL_SOCKET, SO_DONTROUTE); } #endif #if defined(SO_KEEPALIVE) static -ERL_NIF_TERM ngetopt_lvl_sock_keepalive(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_sock_keepalive(ErlNifEnv* env, + ESockDescriptor* descP) { - return ngetopt_bool_opt(env, descP, SOL_SOCKET, SO_KEEPALIVE); + return esock_getopt_bool_opt(env, descP, SOL_SOCKET, SO_KEEPALIVE); } #endif #if defined(SO_LINGER) static -ERL_NIF_TERM ngetopt_lvl_sock_linger(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_sock_linger(ErlNifEnv* env, + ESockDescriptor* descP) { ERL_NIF_TERM result; struct linger val; @@ -12041,38 +12086,38 @@ ERL_NIF_TERM ngetopt_lvl_sock_linger(ErlNifEnv* env, #if defined(SO_OOBINLINE) static -ERL_NIF_TERM ngetopt_lvl_sock_oobinline(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_sock_oobinline(ErlNifEnv* env, + ESockDescriptor* descP) { - return ngetopt_bool_opt(env, descP, SOL_SOCKET, SO_OOBINLINE); + return esock_getopt_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, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_sock_peek_off(ErlNifEnv* env, + ESockDescriptor* descP) { - return ngetopt_int_opt(env, descP, SOL_SOCKET, SO_PEEK_OFF); + return esock_getopt_int_opt(env, descP, SOL_SOCKET, SO_PEEK_OFF); } #endif #if defined(SO_PRIORITY) static -ERL_NIF_TERM ngetopt_lvl_sock_priority(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_sock_priority(ErlNifEnv* env, + ESockDescriptor* descP) { - return ngetopt_int_opt(env, descP, SOL_SOCKET, SO_PRIORITY); + return esock_getopt_int_opt(env, descP, SOL_SOCKET, SO_PRIORITY); } #endif #if defined(SO_PROTOCOL) static -ERL_NIF_TERM ngetopt_lvl_sock_protocol(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_sock_protocol(ErlNifEnv* env, + ESockDescriptor* descP) { ERL_NIF_TERM result, reason; int val; @@ -12125,98 +12170,98 @@ ERL_NIF_TERM ngetopt_lvl_sock_protocol(ErlNifEnv* env, #if defined(SO_RCVBUF) static -ERL_NIF_TERM ngetopt_lvl_sock_rcvbuf(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_sock_rcvbuf(ErlNifEnv* env, + ESockDescriptor* descP) { - return ngetopt_int_opt(env, descP, SOL_SOCKET, SO_RCVBUF); + return esock_getopt_int_opt(env, descP, SOL_SOCKET, SO_RCVBUF); } #endif #if defined(SO_RCVLOWAT) static -ERL_NIF_TERM ngetopt_lvl_sock_rcvlowat(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_sock_rcvlowat(ErlNifEnv* env, + ESockDescriptor* descP) { - return ngetopt_int_opt(env, descP, SOL_SOCKET, SO_RCVLOWAT); + return esock_getopt_int_opt(env, descP, SOL_SOCKET, SO_RCVLOWAT); } #endif #if defined(SO_RCVTIMEO) static -ERL_NIF_TERM ngetopt_lvl_sock_rcvtimeo(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_sock_rcvtimeo(ErlNifEnv* env, + ESockDescriptor* descP) { - return ngetopt_timeval_opt(env, descP, SOL_SOCKET, SO_RCVTIMEO); + return esock_getopt_timeval_opt(env, descP, SOL_SOCKET, SO_RCVTIMEO); } #endif #if defined(SO_REUSEADDR) static -ERL_NIF_TERM ngetopt_lvl_sock_reuseaddr(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_sock_reuseaddr(ErlNifEnv* env, + ESockDescriptor* descP) { - return ngetopt_bool_opt(env, descP, SOL_SOCKET, SO_REUSEADDR); + return esock_getopt_bool_opt(env, descP, SOL_SOCKET, SO_REUSEADDR); } #endif #if defined(SO_REUSEPORT) static -ERL_NIF_TERM ngetopt_lvl_sock_reuseport(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_sock_reuseport(ErlNifEnv* env, + ESockDescriptor* descP) { - return ngetopt_bool_opt(env, descP, SOL_SOCKET, SO_REUSEPORT); + return esock_getopt_bool_opt(env, descP, SOL_SOCKET, SO_REUSEPORT); } #endif #if defined(SO_SNDBUF) static -ERL_NIF_TERM ngetopt_lvl_sock_sndbuf(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_sock_sndbuf(ErlNifEnv* env, + ESockDescriptor* descP) { - return ngetopt_int_opt(env, descP, SOL_SOCKET, SO_SNDBUF); + return esock_getopt_int_opt(env, descP, SOL_SOCKET, SO_SNDBUF); } #endif #if defined(SO_SNDLOWAT) static -ERL_NIF_TERM ngetopt_lvl_sock_sndlowat(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_sock_sndlowat(ErlNifEnv* env, + ESockDescriptor* descP) { - return ngetopt_int_opt(env, descP, SOL_SOCKET, SO_SNDLOWAT); + return esock_getopt_int_opt(env, descP, SOL_SOCKET, SO_SNDLOWAT); } #endif #if defined(SO_SNDTIMEO) static -ERL_NIF_TERM ngetopt_lvl_sock_sndtimeo(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_sock_sndtimeo(ErlNifEnv* env, + ESockDescriptor* descP) { - return ngetopt_timeval_opt(env, descP, SOL_SOCKET, SO_SNDTIMEO); + return esock_getopt_timeval_opt(env, descP, SOL_SOCKET, SO_SNDTIMEO); } #endif #if defined(SO_TIMESTAMP) static -ERL_NIF_TERM ngetopt_lvl_sock_timestamp(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_sock_timestamp(ErlNifEnv* env, + ESockDescriptor* descP) { - return ngetopt_bool_opt(env, descP, SOL_SOCKET, SO_TIMESTAMP); + return esock_getopt_bool_opt(env, descP, SOL_SOCKET, SO_TIMESTAMP); } #endif #if defined(SO_TYPE) static -ERL_NIF_TERM ngetopt_lvl_sock_type(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_sock_type(ErlNifEnv* env, + ESockDescriptor* descP) { ERL_NIF_TERM result, reason; int val; @@ -12258,174 +12303,174 @@ ERL_NIF_TERM ngetopt_lvl_sock_type(ErlNifEnv* env, #endif -/* ngetopt_lvl_ip - Level *IP* option(s) +/* esock_getopt_lvl_ip - Level *IP* option(s) */ static -ERL_NIF_TERM ngetopt_lvl_ip(ErlNifEnv* env, - ESockDescriptor* descP, - int eOpt) +ERL_NIF_TERM esock_getopt_lvl_ip(ErlNifEnv* env, + ESockDescriptor* descP, + int eOpt) { ERL_NIF_TERM result; SSDBG( descP, - ("SOCKET", "ngetopt_lvl_ip -> entry with" + ("SOCKET", "esock_getopt_lvl_ip -> entry with" "\r\n eOpt: %d" "\r\n", eOpt) ); switch (eOpt) { #if defined(IP_FREEBIND) case SOCKET_OPT_IP_FREEBIND: - result = ngetopt_lvl_ip_freebind(env, descP); + result = esock_getopt_lvl_ip_freebind(env, descP); break; #endif #if defined(IP_HDRINCL) case SOCKET_OPT_IP_HDRINCL: - result = ngetopt_lvl_ip_hdrincl(env, descP); + result = esock_getopt_lvl_ip_hdrincl(env, descP); break; #endif #if defined(IP_MINTTL) case SOCKET_OPT_IP_MINTTL: - result = ngetopt_lvl_ip_minttl(env, descP); + result = esock_getopt_lvl_ip_minttl(env, descP); break; #endif #if defined(IP_MTU) case SOCKET_OPT_IP_MTU: - result = ngetopt_lvl_ip_mtu(env, descP); + result = esock_getopt_lvl_ip_mtu(env, descP); break; #endif #if defined(IP_MTU_DISCOVER) case SOCKET_OPT_IP_MTU_DISCOVER: - result = ngetopt_lvl_ip_mtu_discover(env, descP); + result = esock_getopt_lvl_ip_mtu_discover(env, descP); break; #endif #if defined(IP_MULTICAST_ALL) case SOCKET_OPT_IP_MULTICAST_ALL: - result = ngetopt_lvl_ip_multicast_all(env, descP); + result = esock_getopt_lvl_ip_multicast_all(env, descP); break; #endif #if defined(IP_MULTICAST_IF) case SOCKET_OPT_IP_MULTICAST_IF: - result = ngetopt_lvl_ip_multicast_if(env, descP); + result = esock_getopt_lvl_ip_multicast_if(env, descP); break; #endif #if defined(IP_MULTICAST_LOOP) case SOCKET_OPT_IP_MULTICAST_LOOP: - result = ngetopt_lvl_ip_multicast_loop(env, descP); + result = esock_getopt_lvl_ip_multicast_loop(env, descP); break; #endif #if defined(IP_MULTICAST_TTL) case SOCKET_OPT_IP_MULTICAST_TTL: - result = ngetopt_lvl_ip_multicast_ttl(env, descP); + result = esock_getopt_lvl_ip_multicast_ttl(env, descP); break; #endif #if defined(IP_NODEFRAG) case SOCKET_OPT_IP_NODEFRAG: - result = ngetopt_lvl_ip_nodefrag(env, descP); + result = esock_getopt_lvl_ip_nodefrag(env, descP); break; #endif #if defined(IP_PKTINFO) case SOCKET_OPT_IP_PKTINFO: - result = ngetopt_lvl_ip_pktinfo(env, descP); + result = esock_getopt_lvl_ip_pktinfo(env, descP); break; #endif #if defined(IP_RECVDSTADDR) case SOCKET_OPT_IP_RECVDSTADDR: - result = ngetopt_lvl_ip_recvdstaddr(env, descP); + result = esock_getopt_lvl_ip_recvdstaddr(env, descP); break; #endif #if defined(IP_RECVERR) case SOCKET_OPT_IP_RECVERR: - result = ngetopt_lvl_ip_recverr(env, descP); + result = esock_getopt_lvl_ip_recverr(env, descP); break; #endif #if defined(IP_RECVIF) case SOCKET_OPT_IP_RECVIF: - result = ngetopt_lvl_ip_recvif(env, descP); + result = esock_getopt_lvl_ip_recvif(env, descP); break; #endif #if defined(IP_RECVOPTS) case SOCKET_OPT_IP_RECVOPTS: - result = ngetopt_lvl_ip_recvopts(env, descP); + result = esock_getopt_lvl_ip_recvopts(env, descP); break; #endif #if defined(IP_RECVORIGDSTADDR) case SOCKET_OPT_IP_RECVORIGDSTADDR: - result = ngetopt_lvl_ip_recvorigdstaddr(env, descP); + result = esock_getopt_lvl_ip_recvorigdstaddr(env, descP); break; #endif #if defined(IP_RECVTOS) case SOCKET_OPT_IP_RECVTOS: - result = ngetopt_lvl_ip_recvtos(env, descP); + result = esock_getopt_lvl_ip_recvtos(env, descP); break; #endif #if defined(IP_RECVTTL) case SOCKET_OPT_IP_RECVTTL: - result = ngetopt_lvl_ip_recvttl(env, descP); + result = esock_getopt_lvl_ip_recvttl(env, descP); break; #endif #if defined(IP_RETOPTS) case SOCKET_OPT_IP_RETOPTS: - result = ngetopt_lvl_ip_retopts(env, descP); + result = esock_getopt_lvl_ip_retopts(env, descP); break; #endif #if defined(IP_ROUTER_ALERT) case SOCKET_OPT_IP_ROUTER_ALERT: - result = ngetopt_lvl_ip_router_alert(env, descP); + result = esock_getopt_lvl_ip_router_alert(env, descP); break; #endif #if defined(IP_SENDSRCADDR) case SOCKET_OPT_IP_SENDSRCADDR: - result = ngetopt_lvl_ip_sendsrcaddr(env, descP); + result = esock_getopt_lvl_ip_sendsrcaddr(env, descP); break; #endif #if defined(IP_TOS) case SOCKET_OPT_IP_TOS: - result = ngetopt_lvl_ip_tos(env, descP); + result = esock_getopt_lvl_ip_tos(env, descP); break; #endif #if defined(IP_TRANSPARENT) case SOCKET_OPT_IP_TRANSPARENT: - result = ngetopt_lvl_ip_transparent(env, descP); + result = esock_getopt_lvl_ip_transparent(env, descP); break; #endif #if defined(IP_TTL) case SOCKET_OPT_IP_TTL: - result = ngetopt_lvl_ip_ttl(env, descP); + result = esock_getopt_lvl_ip_ttl(env, descP); break; #endif default: SSDBG( descP, - ("SOCKET", "ngetopt_lvl_ip -> unknown opt %d\r\n", eOpt) ); + ("SOCKET", "esock_getopt_lvl_ip -> unknown opt %d\r\n", eOpt) ); result = esock_make_error(env, esock_atom_einval); break; } SSDBG( descP, - ("SOCKET", "ngetopt_lvl_ip -> done when" + ("SOCKET", "esock_getopt_lvl_ip -> done when" "\r\n result: %T" "\r\n", result) ); @@ -12433,12 +12478,12 @@ ERL_NIF_TERM ngetopt_lvl_ip(ErlNifEnv* env, } -/* ngetopt_lvl_ip_minttl - Level IP MINTTL option +/* esock_getopt_lvl_ip_minttl - Level IP MINTTL option */ #if defined(IP_MINTTL) static -ERL_NIF_TERM ngetopt_lvl_ip_minttl(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_ip_minttl(ErlNifEnv* env, + ESockDescriptor* descP) { #if defined(SOL_IP) int level = SOL_IP; @@ -12446,17 +12491,17 @@ ERL_NIF_TERM ngetopt_lvl_ip_minttl(ErlNifEnv* env, int level = IPPROTO_IP; #endif - return ngetopt_int_opt(env, descP, level, IP_MINTTL); + return esock_getopt_int_opt(env, descP, level, IP_MINTTL); } #endif -/* ngetopt_lvl_ip_freebind - Level IP FREEBIND option +/* esock_getopt_lvl_ip_freebind - Level IP FREEBIND option */ #if defined(IP_FREEBIND) static -ERL_NIF_TERM ngetopt_lvl_ip_freebind(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_ip_freebind(ErlNifEnv* env, + ESockDescriptor* descP) { #if defined(SOL_IP) int level = SOL_IP; @@ -12464,17 +12509,17 @@ ERL_NIF_TERM ngetopt_lvl_ip_freebind(ErlNifEnv* env, int level = IPPROTO_IP; #endif - return ngetopt_bool_opt(env, descP, level, IP_FREEBIND); + return esock_getopt_bool_opt(env, descP, level, IP_FREEBIND); } #endif -/* ngetopt_lvl_ip_hdrincl - Level IP HDRINCL option +/* esock_getopt_lvl_ip_hdrincl - Level IP HDRINCL option */ #if defined(IP_HDRINCL) static -ERL_NIF_TERM ngetopt_lvl_ip_hdrincl(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_ip_hdrincl(ErlNifEnv* env, + ESockDescriptor* descP) { #if defined(SOL_IP) int level = SOL_IP; @@ -12482,17 +12527,17 @@ ERL_NIF_TERM ngetopt_lvl_ip_hdrincl(ErlNifEnv* env, int level = IPPROTO_IP; #endif - return ngetopt_bool_opt(env, descP, level, IP_HDRINCL); + return esock_getopt_bool_opt(env, descP, level, IP_HDRINCL); } #endif -/* ngetopt_lvl_ip_mtu - Level IP MTU option +/* esock_getopt_lvl_ip_mtu - Level IP MTU option */ #if defined(IP_MTU) static -ERL_NIF_TERM ngetopt_lvl_ip_mtu(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_ip_mtu(ErlNifEnv* env, + ESockDescriptor* descP) { #if defined(SOL_IP) int level = SOL_IP; @@ -12500,17 +12545,17 @@ ERL_NIF_TERM ngetopt_lvl_ip_mtu(ErlNifEnv* env, int level = IPPROTO_IP; #endif - return ngetopt_int_opt(env, descP, level, IP_MTU); + return esock_getopt_int_opt(env, descP, level, IP_MTU); } #endif -/* ngetopt_lvl_ip_mtu_discover - Level IP MTU_DISCOVER option +/* esock_getopt_lvl_ip_mtu_discover - Level IP MTU_DISCOVER option */ #if defined(IP_MTU_DISCOVER) static -ERL_NIF_TERM ngetopt_lvl_ip_mtu_discover(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_ip_mtu_discover(ErlNifEnv* env, + ESockDescriptor* descP) { ERL_NIF_TERM result; ERL_NIF_TERM eMtuDisc; @@ -12539,12 +12584,12 @@ ERL_NIF_TERM ngetopt_lvl_ip_mtu_discover(ErlNifEnv* env, #endif -/* ngetopt_lvl_ip_multicast_all - Level IP MULTICAST_ALL option +/* esock_getopt_lvl_ip_multicast_all - Level IP MULTICAST_ALL option */ #if defined(IP_MULTICAST_ALL) static -ERL_NIF_TERM ngetopt_lvl_ip_multicast_all(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_ip_multicast_all(ErlNifEnv* env, + ESockDescriptor* descP) { #if defined(SOL_IP) int level = SOL_IP; @@ -12552,17 +12597,17 @@ ERL_NIF_TERM ngetopt_lvl_ip_multicast_all(ErlNifEnv* env, int level = IPPROTO_IP; #endif - return ngetopt_bool_opt(env, descP, level, IP_MULTICAST_ALL); + return esock_getopt_bool_opt(env, descP, level, IP_MULTICAST_ALL); } #endif -/* ngetopt_lvl_ip_multicast_if - Level IP MULTICAST_IF option +/* esock_getopt_lvl_ip_multicast_if - Level IP MULTICAST_IF option */ #if defined(IP_MULTICAST_IF) static -ERL_NIF_TERM ngetopt_lvl_ip_multicast_if(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_ip_multicast_if(ErlNifEnv* env, + ESockDescriptor* descP) { ERL_NIF_TERM result; ERL_NIF_TERM eAddr; @@ -12594,12 +12639,12 @@ ERL_NIF_TERM ngetopt_lvl_ip_multicast_if(ErlNifEnv* env, #endif -/* ngetopt_lvl_ip_multicast_loop - Level IP MULTICAST_LOOP option +/* esock_getopt_lvl_ip_multicast_loop - Level IP MULTICAST_LOOP option */ #if defined(IP_MULTICAST_LOOP) static -ERL_NIF_TERM ngetopt_lvl_ip_multicast_loop(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_ip_multicast_loop(ErlNifEnv* env, + ESockDescriptor* descP) { #if defined(SOL_IP) int level = SOL_IP; @@ -12607,17 +12652,17 @@ ERL_NIF_TERM ngetopt_lvl_ip_multicast_loop(ErlNifEnv* env, int level = IPPROTO_IP; #endif - return ngetopt_bool_opt(env, descP, level, IP_MULTICAST_LOOP); + return esock_getopt_bool_opt(env, descP, level, IP_MULTICAST_LOOP); } #endif -/* ngetopt_lvl_ip_multicast_ttl - Level IP MULTICAST_TTL option +/* esock_getopt_lvl_ip_multicast_ttl - Level IP MULTICAST_TTL option */ #if defined(IP_MULTICAST_TTL) static -ERL_NIF_TERM ngetopt_lvl_ip_multicast_ttl(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_ip_multicast_ttl(ErlNifEnv* env, + ESockDescriptor* descP) { #if defined(SOL_IP) int level = SOL_IP; @@ -12625,17 +12670,17 @@ ERL_NIF_TERM ngetopt_lvl_ip_multicast_ttl(ErlNifEnv* env, int level = IPPROTO_IP; #endif - return ngetopt_int_opt(env, descP, level, IP_MULTICAST_TTL); + return esock_getopt_int_opt(env, descP, level, IP_MULTICAST_TTL); } #endif -/* ngetopt_lvl_ip_nodefrag - Level IP NODEFRAG option +/* esock_getopt_lvl_ip_nodefrag - Level IP NODEFRAG option */ #if defined(IP_NODEFRAG) static -ERL_NIF_TERM ngetopt_lvl_ip_nodefrag(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_ip_nodefrag(ErlNifEnv* env, + ESockDescriptor* descP) { #if defined(SOL_IP) int level = SOL_IP; @@ -12643,17 +12688,17 @@ ERL_NIF_TERM ngetopt_lvl_ip_nodefrag(ErlNifEnv* env, int level = IPPROTO_IP; #endif - return ngetopt_bool_opt(env, descP, level, IP_NODEFRAG); + return esock_getopt_bool_opt(env, descP, level, IP_NODEFRAG); } #endif -/* ngetopt_lvl_ip_pktinfo - Level IP PKTINFO option +/* esock_getopt_lvl_ip_pktinfo - Level IP PKTINFO option */ #if defined(IP_PKTINFO) static -ERL_NIF_TERM ngetopt_lvl_ip_pktinfo(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_ip_pktinfo(ErlNifEnv* env, + ESockDescriptor* descP) { #if defined(SOL_IP) int level = SOL_IP; @@ -12661,17 +12706,17 @@ ERL_NIF_TERM ngetopt_lvl_ip_pktinfo(ErlNifEnv* env, int level = IPPROTO_IP; #endif - return ngetopt_bool_opt(env, descP, level, IP_PKTINFO); + return esock_getopt_bool_opt(env, descP, level, IP_PKTINFO); } #endif -/* ngetopt_lvl_ip_recvtos - Level IP RECVTOS option +/* esock_getopt_lvl_ip_recvtos - Level IP RECVTOS option */ #if defined(IP_RECVTOS) static -ERL_NIF_TERM ngetopt_lvl_ip_recvtos(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_ip_recvtos(ErlNifEnv* env, + ESockDescriptor* descP) { #if defined(SOL_IP) int level = SOL_IP; @@ -12679,17 +12724,17 @@ ERL_NIF_TERM ngetopt_lvl_ip_recvtos(ErlNifEnv* env, int level = IPPROTO_IP; #endif - return ngetopt_bool_opt(env, descP, level, IP_RECVTOS); + return esock_getopt_bool_opt(env, descP, level, IP_RECVTOS); } #endif -/* ngetopt_lvl_ip_recvdstaddr - Level IP RECVDSTADDR option +/* esock_getopt_lvl_ip_recvdstaddr - Level IP RECVDSTADDR option */ #if defined(IP_RECVDSTADDR) static -ERL_NIF_TERM ngetopt_lvl_ip_recvdstaddr(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_ip_recvdstaddr(ErlNifEnv* env, + ESockDescriptor* descP) { #if defined(SOL_IP) int level = SOL_IP; @@ -12697,17 +12742,17 @@ ERL_NIF_TERM ngetopt_lvl_ip_recvdstaddr(ErlNifEnv* env, int level = IPPROTO_IP; #endif - return ngetopt_bool_opt(env, descP, level, IP_RECVDSTADDR); + return esock_getopt_bool_opt(env, descP, level, IP_RECVDSTADDR); } #endif -/* ngetopt_lvl_ip_recverr - Level IP RECVERR option +/* esock_getopt_lvl_ip_recverr - Level IP RECVERR option */ #if defined(IP_RECVERR) static -ERL_NIF_TERM ngetopt_lvl_ip_recverr(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_ip_recverr(ErlNifEnv* env, + ESockDescriptor* descP) { #if defined(SOL_IP) int level = SOL_IP; @@ -12715,17 +12760,17 @@ ERL_NIF_TERM ngetopt_lvl_ip_recverr(ErlNifEnv* env, int level = IPPROTO_IP; #endif - return ngetopt_bool_opt(env, descP, level, IP_RECVERR); + return esock_getopt_bool_opt(env, descP, level, IP_RECVERR); } #endif -/* ngetopt_lvl_ip_recvif - Level IP RECVIF option +/* esock_getopt_lvl_ip_recvif - Level IP RECVIF option */ #if defined(IP_RECVIF) static -ERL_NIF_TERM ngetopt_lvl_ip_recvif(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_ip_recvif(ErlNifEnv* env, + ESockDescriptor* descP) { #if defined(SOL_IP) int level = SOL_IP; @@ -12733,17 +12778,17 @@ ERL_NIF_TERM ngetopt_lvl_ip_recvif(ErlNifEnv* env, int level = IPPROTO_IP; #endif - return ngetopt_bool_opt(env, descP, level, IP_RECVIF); + return esock_getopt_bool_opt(env, descP, level, IP_RECVIF); } #endif -/* ngetopt_lvl_ip_recvopt - Level IP RECVOPTS option +/* esock_getopt_lvl_ip_recvopt - Level IP RECVOPTS option */ #if defined(IP_RECVOPTS) static -ERL_NIF_TERM ngetopt_lvl_ip_recvopts(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_ip_recvopts(ErlNifEnv* env, + ESockDescriptor* descP) { #if defined(SOL_IP) int level = SOL_IP; @@ -12751,17 +12796,17 @@ ERL_NIF_TERM ngetopt_lvl_ip_recvopts(ErlNifEnv* env, int level = IPPROTO_IP; #endif - return ngetopt_bool_opt(env, descP, level, IP_RECVOPTS); + return esock_getopt_bool_opt(env, descP, level, IP_RECVOPTS); } #endif -/* ngetopt_lvl_ip_recvorigdstaddr - Level IP RECVORIGDSTADDR option +/* esock_getopt_lvl_ip_recvorigdstaddr - Level IP RECVORIGDSTADDR option */ #if defined(IP_RECVORIGDSTADDR) static -ERL_NIF_TERM ngetopt_lvl_ip_recvorigdstaddr(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_ip_recvorigdstaddr(ErlNifEnv* env, + ESockDescriptor* descP) { #if defined(SOL_IP) int level = SOL_IP; @@ -12769,17 +12814,17 @@ ERL_NIF_TERM ngetopt_lvl_ip_recvorigdstaddr(ErlNifEnv* env, int level = IPPROTO_IP; #endif - return ngetopt_bool_opt(env, descP, level, IP_RECVORIGDSTADDR); + return esock_getopt_bool_opt(env, descP, level, IP_RECVORIGDSTADDR); } #endif -/* ngetopt_lvl_ip_recvttl - Level IP RECVTTL option +/* esock_getopt_lvl_ip_recvttl - Level IP RECVTTL option */ #if defined(IP_RECVTTL) static -ERL_NIF_TERM ngetopt_lvl_ip_recvttl(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_ip_recvttl(ErlNifEnv* env, + ESockDescriptor* descP) { #if defined(SOL_IP) int level = SOL_IP; @@ -12787,17 +12832,17 @@ ERL_NIF_TERM ngetopt_lvl_ip_recvttl(ErlNifEnv* env, int level = IPPROTO_IP; #endif - return ngetopt_bool_opt(env, descP, level, IP_RECVTTL); + return esock_getopt_bool_opt(env, descP, level, IP_RECVTTL); } #endif -/* ngetopt_lvl_ip_retopts - Level IP RETOPTS option +/* esock_getopt_lvl_ip_retopts - Level IP RETOPTS option */ #if defined(IP_RETOPTS) static -ERL_NIF_TERM ngetopt_lvl_ip_retopts(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_ip_retopts(ErlNifEnv* env, + ESockDescriptor* descP) { #if defined(SOL_IP) int level = SOL_IP; @@ -12805,17 +12850,17 @@ ERL_NIF_TERM ngetopt_lvl_ip_retopts(ErlNifEnv* env, int level = IPPROTO_IP; #endif - return ngetopt_bool_opt(env, descP, level, IP_RETOPTS); + return esock_getopt_bool_opt(env, descP, level, IP_RETOPTS); } #endif -/* ngetopt_lvl_ip_router_alert - Level IP ROUTER_ALERT option +/* esock_getopt_lvl_ip_router_alert - Level IP ROUTER_ALERT option */ #if defined(IP_ROUTER_ALERT) static -ERL_NIF_TERM ngetopt_lvl_ip_router_alert(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_ip_router_alert(ErlNifEnv* env, + ESockDescriptor* descP) { #if defined(SOL_IP) int level = SOL_IP; @@ -12823,17 +12868,17 @@ ERL_NIF_TERM ngetopt_lvl_ip_router_alert(ErlNifEnv* env, int level = IPPROTO_IP; #endif - return ngetopt_int_opt(env, descP, level, IP_ROUTER_ALERT); + return esock_getopt_int_opt(env, descP, level, IP_ROUTER_ALERT); } #endif -/* ngetopt_lvl_ip_sendsrcaddr - Level IP SENDSRCADDR option +/* esock_getopt_lvl_ip_sendsrcaddr - Level IP SENDSRCADDR option */ #if defined(IP_SENDSRCADDR) static -ERL_NIF_TERM ngetopt_lvl_ip_sendsrcaddr(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_ip_sendsrcaddr(ErlNifEnv* env, + ESockDescriptor* descP) { #if defined(SOL_IP) int level = SOL_IP; @@ -12841,17 +12886,17 @@ ERL_NIF_TERM ngetopt_lvl_ip_sendsrcaddr(ErlNifEnv* env, int level = IPPROTO_IP; #endif - return ngetopt_bool_opt(env, descP, level, IP_SENDSRCADDR); + return esock_getopt_bool_opt(env, descP, level, IP_SENDSRCADDR); } #endif -/* ngetopt_lvl_ip_tos - Level IP TOS option +/* esock_getopt_lvl_ip_tos - Level IP TOS option */ #if defined(IP_TOS) static -ERL_NIF_TERM ngetopt_lvl_ip_tos(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_ip_tos(ErlNifEnv* env, + ESockDescriptor* descP) { #if defined(SOL_IP) int level = SOL_IP; @@ -12876,12 +12921,12 @@ ERL_NIF_TERM ngetopt_lvl_ip_tos(ErlNifEnv* env, #endif -/* ngetopt_lvl_ip_transparent - Level IP TRANSPARENT option +/* esock_getopt_lvl_ip_transparent - Level IP TRANSPARENT option */ #if defined(IP_TRANSPARENT) static -ERL_NIF_TERM ngetopt_lvl_ip_transparent(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_ip_transparent(ErlNifEnv* env, + ESockDescriptor* descP) { #if defined(SOL_IP) int level = SOL_IP; @@ -12889,18 +12934,18 @@ ERL_NIF_TERM ngetopt_lvl_ip_transparent(ErlNifEnv* env, int level = IPPROTO_IP; #endif - return ngetopt_bool_opt(env, descP, level, IP_TRANSPARENT); + return esock_getopt_bool_opt(env, descP, level, IP_TRANSPARENT); } #endif -/* ngetopt_lvl_ip_ttl - Level IP TTL option +/* esock_getopt_lvl_ip_ttl - Level IP TTL option */ #if defined(IP_TTL) static -ERL_NIF_TERM ngetopt_lvl_ip_ttl(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_ip_ttl(ErlNifEnv* env, + ESockDescriptor* descP) { #if defined(SOL_IP) int level = SOL_IP; @@ -12908,121 +12953,121 @@ ERL_NIF_TERM ngetopt_lvl_ip_ttl(ErlNifEnv* env, int level = IPPROTO_IP; #endif - return ngetopt_int_opt(env, descP, level, IP_TTL); + return esock_getopt_int_opt(env, descP, level, IP_TTL); } #endif -/* ngetopt_lvl_ipv6 - Level *IPv6* option(s) +/* esock_getopt_lvl_ipv6 - Level *IPv6* option(s) */ #if defined(HAVE_IPV6) static -ERL_NIF_TERM ngetopt_lvl_ipv6(ErlNifEnv* env, - ESockDescriptor* descP, - int eOpt) +ERL_NIF_TERM esock_getopt_lvl_ipv6(ErlNifEnv* env, + ESockDescriptor* descP, + int eOpt) { ERL_NIF_TERM result; SSDBG( descP, - ("SOCKET", "ngetopt_lvl_ipv6 -> entry with" + ("SOCKET", "esock_getopt_lvl_ipv6 -> entry with" "\r\n eOpt: %d" "\r\n", eOpt) ); switch (eOpt) { #if defined(IPV6_AUTHHDR) case SOCKET_OPT_IPV6_AUTHHDR: - result = ngetopt_lvl_ipv6_authhdr(env, descP); + result = esock_getopt_lvl_ipv6_authhdr(env, descP); break; #endif #if defined(IPV6_DSTOPTS) case SOCKET_OPT_IPV6_DSTOPTS: - result = ngetopt_lvl_ipv6_dstopts(env, descP); + result = esock_getopt_lvl_ipv6_dstopts(env, descP); break; #endif #if defined(IPV6_FLOWINFO) case SOCKET_OPT_IPV6_FLOWINFO: - result = ngetopt_lvl_ipv6_flowinfo(env, descP); + result = esock_getopt_lvl_ipv6_flowinfo(env, descP); break; #endif #if defined(IPV6_HOPLIMIT) case SOCKET_OPT_IPV6_HOPLIMIT: - result = ngetopt_lvl_ipv6_hoplimit(env, descP); + result = esock_getopt_lvl_ipv6_hoplimit(env, descP); break; #endif #if defined(IPV6_HOPOPTS) case SOCKET_OPT_IPV6_HOPOPTS: - result = ngetopt_lvl_ipv6_hopopts(env, descP); + result = esock_getopt_lvl_ipv6_hopopts(env, descP); break; #endif #if defined(IPV6_MTU) case SOCKET_OPT_IPV6_MTU: - result = ngetopt_lvl_ipv6_mtu(env, descP); + result = esock_getopt_lvl_ipv6_mtu(env, descP); break; #endif #if defined(IPV6_MTU_DISCOVER) case SOCKET_OPT_IPV6_MTU_DISCOVER: - result = ngetopt_lvl_ipv6_mtu_discover(env, descP); + result = esock_getopt_lvl_ipv6_mtu_discover(env, descP); break; #endif #if defined(IPV6_MULTICAST_HOPS) case SOCKET_OPT_IPV6_MULTICAST_HOPS: - result = ngetopt_lvl_ipv6_multicast_hops(env, descP); + result = esock_getopt_lvl_ipv6_multicast_hops(env, descP); break; #endif #if defined(IPV6_MULTICAST_IF) case SOCKET_OPT_IPV6_MULTICAST_IF: - result = ngetopt_lvl_ipv6_multicast_if(env, descP); + result = esock_getopt_lvl_ipv6_multicast_if(env, descP); break; #endif #if defined(IPV6_MULTICAST_LOOP) case SOCKET_OPT_IPV6_MULTICAST_LOOP: - result = ngetopt_lvl_ipv6_multicast_loop(env, descP); + result = esock_getopt_lvl_ipv6_multicast_loop(env, descP); break; #endif #if defined(IPV6_RECVERR) case SOCKET_OPT_IPV6_RECVERR: - result = ngetopt_lvl_ipv6_recverr(env, descP); + result = esock_getopt_lvl_ipv6_recverr(env, descP); break; #endif #if defined(IPV6_RECVPKTINFO) || defined(IPV6_PKTINFO) case SOCKET_OPT_IPV6_RECVPKTINFO: - result = ngetopt_lvl_ipv6_recvpktinfo(env, descP); + result = esock_getopt_lvl_ipv6_recvpktinfo(env, descP); break; #endif #if defined(IPV6_ROUTER_ALERT) case SOCKET_OPT_IPV6_ROUTER_ALERT: - result = ngetopt_lvl_ipv6_router_alert(env, descP); + result = esock_getopt_lvl_ipv6_router_alert(env, descP); break; #endif #if defined(IPV6_RTHDR) case SOCKET_OPT_IPV6_RTHDR: - result = ngetopt_lvl_ipv6_rthdr(env, descP); + result = esock_getopt_lvl_ipv6_rthdr(env, descP); break; #endif #if defined(IPV6_UNICAST_HOPS) case SOCKET_OPT_IPV6_UNICAST_HOPS: - result = ngetopt_lvl_ipv6_unicast_hops(env, descP); + result = esock_getopt_lvl_ipv6_unicast_hops(env, descP); break; #endif #if defined(IPV6_V6ONLY) case SOCKET_OPT_IPV6_V6ONLY: - result = ngetopt_lvl_ipv6_v6only(env, descP); + result = esock_getopt_lvl_ipv6_v6only(env, descP); break; #endif @@ -13032,7 +13077,7 @@ ERL_NIF_TERM ngetopt_lvl_ipv6(ErlNifEnv* env, } SSDBG( descP, - ("SOCKET", "ngetopt_lvl_ipv6 -> done when" + ("SOCKET", "esock_getopt_lvl_ipv6 -> done when" "\r\n result: %T" "\r\n", result) ); @@ -13042,33 +13087,33 @@ ERL_NIF_TERM ngetopt_lvl_ipv6(ErlNifEnv* env, #if defined(IPV6_AUTHHDR) static -ERL_NIF_TERM ngetopt_lvl_ipv6_authhdr(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_ipv6_authhdr(ErlNifEnv* env, + ESockDescriptor* descP) { - return ngetopt_bool_opt(env, descP, SOL_IPV6, IPV6_AUTHHDR); + return esock_getopt_bool_opt(env, descP, SOL_IPV6, IPV6_AUTHHDR); } #endif #if defined(IPV6_DSTOPTS) static -ERL_NIF_TERM ngetopt_lvl_ipv6_dstopts(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_ipv6_dstopts(ErlNifEnv* env, + ESockDescriptor* descP) { #if defined(SOL_IPV6) int level = SOL_IPV6; #else int level = IPPROTO_IPV6; #endif - return ngetopt_bool_opt(env, descP, level, IPV6_DSTOPTS); + return esock_getopt_bool_opt(env, descP, level, IPV6_DSTOPTS); } #endif #if defined(IPV6_FLOWINFO) static -ERL_NIF_TERM ngetopt_lvl_ipv6_flowinfo(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_ipv6_flowinfo(ErlNifEnv* env, + ESockDescriptor* descP) { #if defined(SOL_IPV6) int level = SOL_IPV6; @@ -13076,15 +13121,15 @@ ERL_NIF_TERM ngetopt_lvl_ipv6_flowinfo(ErlNifEnv* env, int level = IPPROTO_IPV6; #endif - return ngetopt_bool_opt(env, descP, level, IPV6_FLOWINFO); + return esock_getopt_bool_opt(env, descP, level, IPV6_FLOWINFO); } #endif #if defined(IPV6_HOPLIMIT) static -ERL_NIF_TERM ngetopt_lvl_ipv6_hoplimit(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_ipv6_hoplimit(ErlNifEnv* env, + ESockDescriptor* descP) { #if defined(SOL_IPV6) int level = SOL_IPV6; @@ -13092,15 +13137,15 @@ ERL_NIF_TERM ngetopt_lvl_ipv6_hoplimit(ErlNifEnv* env, int level = IPPROTO_IPV6; #endif - return ngetopt_bool_opt(env, descP, level, IPV6_HOPLIMIT); + return esock_getopt_bool_opt(env, descP, level, IPV6_HOPLIMIT); } #endif #if defined(IPV6_HOPOPTS) static -ERL_NIF_TERM ngetopt_lvl_ipv6_hopopts(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_ipv6_hopopts(ErlNifEnv* env, + ESockDescriptor* descP) { #if defined(SOL_IPV6) int level = SOL_IPV6; @@ -13108,15 +13153,15 @@ ERL_NIF_TERM ngetopt_lvl_ipv6_hopopts(ErlNifEnv* env, int level = IPPROTO_IPV6; #endif - return ngetopt_bool_opt(env, descP, level, IPV6_HOPOPTS); + return esock_getopt_bool_opt(env, descP, level, IPV6_HOPOPTS); } #endif #if defined(IPV6_MTU) static -ERL_NIF_TERM ngetopt_lvl_ipv6_mtu(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_ipv6_mtu(ErlNifEnv* env, + ESockDescriptor* descP) { #if defined(SOL_IPV6) int level = SOL_IPV6; @@ -13124,17 +13169,17 @@ ERL_NIF_TERM ngetopt_lvl_ipv6_mtu(ErlNifEnv* env, int level = IPPROTO_IPV6; #endif - return ngetopt_int_opt(env, descP, level, IPV6_MTU); + return esock_getopt_int_opt(env, descP, level, IPV6_MTU); } #endif -/* ngetopt_lvl_ipv6_mtu_discover - Level IPv6 MTU_DISCOVER option +/* esock_getopt_lvl_ipv6_mtu_discover - Level IPv6 MTU_DISCOVER option */ #if defined(IPV6_MTU_DISCOVER) static -ERL_NIF_TERM ngetopt_lvl_ipv6_mtu_discover(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_ipv6_mtu_discover(ErlNifEnv* env, + ESockDescriptor* descP) { ERL_NIF_TERM result; ERL_NIF_TERM eMtuDisc; @@ -13165,8 +13210,8 @@ ERL_NIF_TERM ngetopt_lvl_ipv6_mtu_discover(ErlNifEnv* env, #if defined(IPV6_MULTICAST_HOPS) static -ERL_NIF_TERM ngetopt_lvl_ipv6_multicast_hops(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_ipv6_multicast_hops(ErlNifEnv* env, + ESockDescriptor* descP) { #if defined(SOL_IPV6) int level = SOL_IPV6; @@ -13174,15 +13219,15 @@ ERL_NIF_TERM ngetopt_lvl_ipv6_multicast_hops(ErlNifEnv* env, int level = IPPROTO_IPV6; #endif - return ngetopt_int_opt(env, descP, level, IPV6_MULTICAST_HOPS); + return esock_getopt_int_opt(env, descP, level, IPV6_MULTICAST_HOPS); } #endif #if defined(IPV6_MULTICAST_IF) static -ERL_NIF_TERM ngetopt_lvl_ipv6_multicast_if(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_ipv6_multicast_if(ErlNifEnv* env, + ESockDescriptor* descP) { #if defined(SOL_IPV6) int level = SOL_IPV6; @@ -13190,15 +13235,15 @@ ERL_NIF_TERM ngetopt_lvl_ipv6_multicast_if(ErlNifEnv* env, int level = IPPROTO_IPV6; #endif - return ngetopt_int_opt(env, descP, level, IPV6_MULTICAST_IF); + return esock_getopt_int_opt(env, descP, level, IPV6_MULTICAST_IF); } #endif #if defined(IPV6_MULTICAST_LOOP) static -ERL_NIF_TERM ngetopt_lvl_ipv6_multicast_loop(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_ipv6_multicast_loop(ErlNifEnv* env, + ESockDescriptor* descP) { #if defined(SOL_IPV6) int level = SOL_IPV6; @@ -13206,15 +13251,15 @@ ERL_NIF_TERM ngetopt_lvl_ipv6_multicast_loop(ErlNifEnv* env, int level = IPPROTO_IPV6; #endif - return ngetopt_bool_opt(env, descP, level, IPV6_MULTICAST_LOOP); + return esock_getopt_bool_opt(env, descP, level, IPV6_MULTICAST_LOOP); } #endif #if defined(IPV6_RECVERR) static -ERL_NIF_TERM ngetopt_lvl_ipv6_recverr(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_ipv6_recverr(ErlNifEnv* env, + ESockDescriptor* descP) { #if defined(SOL_IPV6) int level = SOL_IPV6; @@ -13222,15 +13267,15 @@ ERL_NIF_TERM ngetopt_lvl_ipv6_recverr(ErlNifEnv* env, int level = IPPROTO_IPV6; #endif - return ngetopt_bool_opt(env, descP, level, IPV6_RECVERR); + return esock_getopt_bool_opt(env, descP, level, IPV6_RECVERR); } #endif #if defined(IPV6_RECVPKTINFO) || defined(IPV6_PKTINFO) static -ERL_NIF_TERM ngetopt_lvl_ipv6_recvpktinfo(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_ipv6_recvpktinfo(ErlNifEnv* env, + ESockDescriptor* descP) { #if defined(SOL_IPV6) int level = SOL_IPV6; @@ -13243,15 +13288,15 @@ ERL_NIF_TERM ngetopt_lvl_ipv6_recvpktinfo(ErlNifEnv* env, int opt = IPV6_PKTINFO; #endif - return ngetopt_bool_opt(env, descP, level, opt); + return esock_getopt_bool_opt(env, descP, level, opt); } #endif #if defined(IPV6_ROUTER_ALERT) static -ERL_NIF_TERM ngetopt_lvl_ipv6_router_alert(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_ipv6_router_alert(ErlNifEnv* env, + ESockDescriptor* descP) { #if defined(SOL_IPV6) int level = SOL_IPV6; @@ -13259,15 +13304,15 @@ ERL_NIF_TERM ngetopt_lvl_ipv6_router_alert(ErlNifEnv* env, int level = IPPROTO_IPV6; #endif - return ngetopt_int_opt(env, descP, level, IPV6_ROUTER_ALERT); + return esock_getopt_int_opt(env, descP, level, IPV6_ROUTER_ALERT); } #endif #if defined(IPV6_RTHDR) static -ERL_NIF_TERM ngetopt_lvl_ipv6_rthdr(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_ipv6_rthdr(ErlNifEnv* env, + ESockDescriptor* descP) { #if defined(SOL_IPV6) int level = SOL_IPV6; @@ -13275,15 +13320,15 @@ ERL_NIF_TERM ngetopt_lvl_ipv6_rthdr(ErlNifEnv* env, int level = IPPROTO_IPV6; #endif - return ngetopt_bool_opt(env, descP, level, IPV6_RTHDR); + return esock_getopt_bool_opt(env, descP, level, IPV6_RTHDR); } #endif #if defined(IPV6_UNICAST_HOPS) static -ERL_NIF_TERM ngetopt_lvl_ipv6_unicast_hops(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_ipv6_unicast_hops(ErlNifEnv* env, + ESockDescriptor* descP) { #if defined(SOL_IPV6) int level = SOL_IPV6; @@ -13291,15 +13336,15 @@ ERL_NIF_TERM ngetopt_lvl_ipv6_unicast_hops(ErlNifEnv* env, int level = IPPROTO_IPV6; #endif - return ngetopt_int_opt(env, descP, level, IPV6_UNICAST_HOPS); + return esock_getopt_int_opt(env, descP, level, IPV6_UNICAST_HOPS); } #endif #if defined(IPV6_V6ONLY) static -ERL_NIF_TERM ngetopt_lvl_ipv6_v6only(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_ipv6_v6only(ErlNifEnv* env, + ESockDescriptor* descP) { #if defined(SOL_IPV6) int level = SOL_IPV6; @@ -13307,7 +13352,7 @@ ERL_NIF_TERM ngetopt_lvl_ipv6_v6only(ErlNifEnv* env, int level = IPPROTO_IPV6; #endif - return ngetopt_bool_opt(env, descP, level, IPV6_V6ONLY); + return esock_getopt_bool_opt(env, descP, level, IPV6_V6ONLY); } #endif @@ -13316,31 +13361,31 @@ ERL_NIF_TERM ngetopt_lvl_ipv6_v6only(ErlNifEnv* env, -/* ngetopt_lvl_tcp - Level *TCP* option(s) +/* esock_getopt_lvl_tcp - Level *TCP* option(s) */ static -ERL_NIF_TERM ngetopt_lvl_tcp(ErlNifEnv* env, - ESockDescriptor* descP, - int eOpt) +ERL_NIF_TERM esock_getopt_lvl_tcp(ErlNifEnv* env, + ESockDescriptor* descP, + int eOpt) { ERL_NIF_TERM result; switch (eOpt) { #if defined(TCP_CONGESTION) case SOCKET_OPT_TCP_CONGESTION: - result = ngetopt_lvl_tcp_congestion(env, descP); + result = esock_getopt_lvl_tcp_congestion(env, descP); break; #endif #if defined(TCP_MAXSEG) case SOCKET_OPT_TCP_MAXSEG: - result = ngetopt_lvl_tcp_maxseg(env, descP); + result = esock_getopt_lvl_tcp_maxseg(env, descP); break; #endif #if defined(TCP_NODELAY) case SOCKET_OPT_TCP_NODELAY: - result = ngetopt_lvl_tcp_nodelay(env, descP); + result = esock_getopt_lvl_tcp_nodelay(env, descP); break; #endif @@ -13353,58 +13398,58 @@ ERL_NIF_TERM ngetopt_lvl_tcp(ErlNifEnv* env, } -/* ngetopt_lvl_tcp_congestion - Level TCP CONGESTION option +/* esock_getopt_lvl_tcp_congestion - Level TCP CONGESTION option */ #if defined(TCP_CONGESTION) static -ERL_NIF_TERM ngetopt_lvl_tcp_congestion(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_tcp_congestion(ErlNifEnv* env, + ESockDescriptor* descP) { int max = SOCKET_OPT_TCP_CONGESTION_NAME_MAX+1; - return ngetopt_str_opt(env, descP, IPPROTO_TCP, TCP_CONGESTION, max); + return esock_getopt_str_opt(env, descP, IPPROTO_TCP, TCP_CONGESTION, max); } #endif -/* ngetopt_lvl_tcp_maxseg - Level TCP MAXSEG option +/* esock_getopt_lvl_tcp_maxseg - Level TCP MAXSEG option */ #if defined(TCP_MAXSEG) static -ERL_NIF_TERM ngetopt_lvl_tcp_maxseg(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_tcp_maxseg(ErlNifEnv* env, + ESockDescriptor* descP) { - return ngetopt_int_opt(env, descP, IPPROTO_TCP, TCP_MAXSEG); + return esock_getopt_int_opt(env, descP, IPPROTO_TCP, TCP_MAXSEG); } #endif -/* ngetopt_lvl_tcp_nodelay - Level TCP NODELAY option +/* esock_getopt_lvl_tcp_nodelay - Level TCP NODELAY option */ #if defined(TCP_NODELAY) static -ERL_NIF_TERM ngetopt_lvl_tcp_nodelay(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_tcp_nodelay(ErlNifEnv* env, + ESockDescriptor* descP) { - return ngetopt_bool_opt(env, descP, IPPROTO_TCP, TCP_NODELAY); + return esock_getopt_bool_opt(env, descP, IPPROTO_TCP, TCP_NODELAY); } #endif -/* ngetopt_lvl_udp - Level *UDP* option(s) +/* esock_getopt_lvl_udp - Level *UDP* option(s) */ static -ERL_NIF_TERM ngetopt_lvl_udp(ErlNifEnv* env, - ESockDescriptor* descP, - int eOpt) +ERL_NIF_TERM esock_getopt_lvl_udp(ErlNifEnv* env, + ESockDescriptor* descP, + int eOpt) { ERL_NIF_TERM result; switch (eOpt) { #if defined(UDP_CORK) case SOCKET_OPT_UDP_CORK: - result = ngetopt_lvl_udp_cork(env, descP); + result = esock_getopt_lvl_udp_cork(env, descP); break; #endif @@ -13417,74 +13462,74 @@ ERL_NIF_TERM ngetopt_lvl_udp(ErlNifEnv* env, } -/* ngetopt_lvl_udp_cork - Level UDP CORK option +/* esock_getopt_lvl_udp_cork - Level UDP CORK option */ #if defined(UDP_CORK) static -ERL_NIF_TERM ngetopt_lvl_udp_cork(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_udp_cork(ErlNifEnv* env, + ESockDescriptor* descP) { - return ngetopt_bool_opt(env, descP, IPPROTO_UDP, UDP_CORK); + return esock_getopt_bool_opt(env, descP, IPPROTO_UDP, UDP_CORK); } #endif -/* ngetopt_lvl_sctp - Level *SCTP* option(s) +/* esock_getopt_lvl_sctp - Level *SCTP* option(s) */ #if defined(HAVE_SCTP) static -ERL_NIF_TERM ngetopt_lvl_sctp(ErlNifEnv* env, - ESockDescriptor* descP, - int eOpt) +ERL_NIF_TERM esock_getopt_lvl_sctp(ErlNifEnv* env, + ESockDescriptor* descP, + int eOpt) { ERL_NIF_TERM result; SSDBG( descP, - ("SOCKET", "ngetopt_lvl_sctp -> entry with" + ("SOCKET", "esock_getopt_lvl_sctp -> entry with" "\r\n opt: %d" "\r\n", eOpt) ); switch (eOpt) { #if defined(SCTP_ASSOCINFO) case SOCKET_OPT_SCTP_ASSOCINFO: - result = ngetopt_lvl_sctp_associnfo(env, descP); + result = esock_getopt_lvl_sctp_associnfo(env, descP); break; #endif #if defined(SCTP_AUTOCLOSE) case SOCKET_OPT_SCTP_AUTOCLOSE: - result = ngetopt_lvl_sctp_autoclose(env, descP); + result = esock_getopt_lvl_sctp_autoclose(env, descP); break; #endif #if defined(SCTP_DISABLE_FRAGMENTS) case SOCKET_OPT_SCTP_DISABLE_FRAGMENTS: - result = ngetopt_lvl_sctp_disable_fragments(env, descP); + result = esock_getopt_lvl_sctp_disable_fragments(env, descP); break; #endif #if defined(SCTP_INITMSG) case SOCKET_OPT_SCTP_INITMSG: - result = ngetopt_lvl_sctp_initmsg(env, descP); + result = esock_getopt_lvl_sctp_initmsg(env, descP); break; #endif #if defined(SCTP_MAXSEG) case SOCKET_OPT_SCTP_MAXSEG: - result = ngetopt_lvl_sctp_maxseg(env, descP); + result = esock_getopt_lvl_sctp_maxseg(env, descP); break; #endif #if defined(SCTP_NODELAY) case SOCKET_OPT_SCTP_NODELAY: - result = ngetopt_lvl_sctp_nodelay(env, descP); + result = esock_getopt_lvl_sctp_nodelay(env, descP); break; #endif #if defined(SCTP_RTOINFO) case SOCKET_OPT_SCTP_RTOINFO: - result = ngetopt_lvl_sctp_rtoinfo(env, descP); + result = esock_getopt_lvl_sctp_rtoinfo(env, descP); break; #endif @@ -13494,7 +13539,7 @@ ERL_NIF_TERM ngetopt_lvl_sctp(ErlNifEnv* env, } SSDBG( descP, - ("SOCKET", "ngetopt_lvl_sctp -> done when" + ("SOCKET", "esock_getopt_lvl_sctp -> done when" "\r\n result: %T" "\r\n", result) ); @@ -13502,7 +13547,7 @@ ERL_NIF_TERM ngetopt_lvl_sctp(ErlNifEnv* env, } -/* ngetopt_lvl_sctp_associnfo - Level SCTP ASSOCINFO option +/* esock_getopt_lvl_sctp_associnfo - Level SCTP ASSOCINFO option * * * @@ -13517,15 +13562,15 @@ ERL_NIF_TERM ngetopt_lvl_sctp(ErlNifEnv* env, */ #if defined(SCTP_ASSOCINFO) static -ERL_NIF_TERM ngetopt_lvl_sctp_associnfo(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_sctp_associnfo(ErlNifEnv* env, + ESockDescriptor* descP) { ERL_NIF_TERM result; struct sctp_assocparams val; SOCKOPTLEN_T valSz = sizeof(val); int res; - SSDBG( descP, ("SOCKET", "ngetopt_lvl_sctp_associnfo -> entry\r\n") ); + SSDBG( descP, ("SOCKET", "esock_getopt_lvl_sctp_associnfo -> entry\r\n") ); sys_memzero((char*) &val, valSz); res = sock_getopt(descP->sock, IPPROTO_SCTP, SCTP_ASSOCINFO, &val, &valSz); @@ -13554,7 +13599,7 @@ ERL_NIF_TERM ngetopt_lvl_sctp_associnfo(ErlNifEnv* env, } SSDBG( descP, - ("SOCKET", "ngetopt_lvl_sctp_associnfo -> done with" + ("SOCKET", "esock_getopt_lvl_sctp_associnfo -> done with" "\r\n res: %d" "\r\n result: %T" "\r\n", res, result) ); @@ -13564,44 +13609,45 @@ ERL_NIF_TERM ngetopt_lvl_sctp_associnfo(ErlNifEnv* env, #endif -/* ngetopt_lvl_sctp_autoclose - Level SCTP AUTOCLOSE option +/* esock_getopt_lvl_sctp_autoclose - Level SCTP AUTOCLOSE option */ #if defined(SCTP_AUTOCLOSE) static -ERL_NIF_TERM ngetopt_lvl_sctp_autoclose(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_sctp_autoclose(ErlNifEnv* env, + ESockDescriptor* descP) { - return ngetopt_int_opt(env, descP, IPPROTO_SCTP, SCTP_AUTOCLOSE); + return esock_getopt_int_opt(env, descP, IPPROTO_SCTP, SCTP_AUTOCLOSE); } #endif -/* ngetopt_lvl_sctp_disable_fragments - Level SCTP DISABLE:FRAGMENTS option +/* esock_getopt_lvl_sctp_disable_fragments - Level SCTP DISABLE:FRAGMENTS option */ #if defined(SCTP_DISABLE_FRAGMENTS) static -ERL_NIF_TERM ngetopt_lvl_sctp_disable_fragments(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_sctp_disable_fragments(ErlNifEnv* env, + ESockDescriptor* descP) { - return ngetopt_bool_opt(env, descP, IPPROTO_SCTP, SCTP_DISABLE_FRAGMENTS); + return esock_getopt_bool_opt(env, descP, + IPPROTO_SCTP, SCTP_DISABLE_FRAGMENTS); } #endif -/* ngetopt_lvl_sctp_initmsg - Level SCTP INITMSG option +/* esock_getopt_lvl_sctp_initmsg - Level SCTP INITMSG option * */ #if defined(SCTP_INITMSG) static -ERL_NIF_TERM ngetopt_lvl_sctp_initmsg(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_sctp_initmsg(ErlNifEnv* env, + ESockDescriptor* descP) { ERL_NIF_TERM result; struct sctp_initmsg val; SOCKOPTLEN_T valSz = sizeof(val); int res; - SSDBG( descP, ("SOCKET", "ngetopt_lvl_sctp_initmsg -> entry\r\n") ); + SSDBG( descP, ("SOCKET", "esock_getopt_lvl_sctp_initmsg -> entry\r\n") ); sys_memzero((char*) &val, valSz); res = sock_getopt(descP->sock, IPPROTO_SCTP, SCTP_INITMSG, &val, &valSz); @@ -13628,7 +13674,7 @@ ERL_NIF_TERM ngetopt_lvl_sctp_initmsg(ErlNifEnv* env, } SSDBG( descP, - ("SOCKET", "ngetopt_lvl_sctp_initmsg -> done with" + ("SOCKET", "esock_getopt_lvl_sctp_initmsg -> done with" "\r\n res: %d" "\r\n result: %T" "\r\n", res, result) ); @@ -13638,31 +13684,31 @@ ERL_NIF_TERM ngetopt_lvl_sctp_initmsg(ErlNifEnv* env, #endif -/* ngetopt_lvl_sctp_maxseg - Level SCTP MAXSEG option +/* esock_getopt_lvl_sctp_maxseg - Level SCTP MAXSEG option */ #if defined(SCTP_MAXSEG) static -ERL_NIF_TERM ngetopt_lvl_sctp_maxseg(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_sctp_maxseg(ErlNifEnv* env, + ESockDescriptor* descP) { - return ngetopt_int_opt(env, descP, IPPROTO_SCTP, SCTP_MAXSEG); + return esock_getopt_int_opt(env, descP, IPPROTO_SCTP, SCTP_MAXSEG); } #endif -/* ngetopt_lvl_sctp_nodelay - Level SCTP NODELAY option +/* esock_getopt_lvl_sctp_nodelay - Level SCTP NODELAY option */ #if defined(SCTP_NODELAY) static -ERL_NIF_TERM ngetopt_lvl_sctp_nodelay(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_sctp_nodelay(ErlNifEnv* env, + ESockDescriptor* descP) { - return ngetopt_bool_opt(env, descP, IPPROTO_SCTP, SCTP_NODELAY); + return esock_getopt_bool_opt(env, descP, IPPROTO_SCTP, SCTP_NODELAY); } #endif -/* ngetopt_lvl_sctp_associnfo - Level SCTP ASSOCINFO option +/* esock_getopt_lvl_sctp_associnfo - Level SCTP ASSOCINFO option * * * @@ -13677,15 +13723,15 @@ ERL_NIF_TERM ngetopt_lvl_sctp_nodelay(ErlNifEnv* env, */ #if defined(SCTP_RTOINFO) static -ERL_NIF_TERM ngetopt_lvl_sctp_rtoinfo(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_getopt_lvl_sctp_rtoinfo(ErlNifEnv* env, + ESockDescriptor* descP) { ERL_NIF_TERM result; struct sctp_rtoinfo val; SOCKOPTLEN_T valSz = sizeof(val); int res; - SSDBG( descP, ("SOCKET", "ngetopt_lvl_sctp_rtoinfo -> entry\r\n") ); + SSDBG( descP, ("SOCKET", "esock_getopt_lvl_sctp_rtoinfo -> entry\r\n") ); sys_memzero((char*) &val, valSz); res = sock_getopt(descP->sock, IPPROTO_SCTP, SCTP_RTOINFO, &val, &valSz); @@ -13711,7 +13757,7 @@ ERL_NIF_TERM ngetopt_lvl_sctp_rtoinfo(ErlNifEnv* env, } SSDBG( descP, - ("SOCKET", "ngetopt_lvl_sctp_rtoinfo -> done with" + ("SOCKET", "esock_getopt_lvl_sctp_rtoinfo -> done with" "\r\n res: %d" "\r\n result: %T" "\r\n", res, result) ); @@ -13726,13 +13772,13 @@ ERL_NIF_TERM ngetopt_lvl_sctp_rtoinfo(ErlNifEnv* env, -/* ngetopt_bool_opt - get an (integer) bool option +/* esock_getopt_bool_opt - get an (integer) bool option */ static -ERL_NIF_TERM ngetopt_bool_opt(ErlNifEnv* env, - ESockDescriptor* descP, - int level, - int opt) +ERL_NIF_TERM esock_getopt_bool_opt(ErlNifEnv* env, + ESockDescriptor* descP, + int level, + int opt) { ERL_NIF_TERM result; int val; @@ -13740,7 +13786,7 @@ ERL_NIF_TERM ngetopt_bool_opt(ErlNifEnv* env, int res; /* - SSDBG( descP, ("SOCKET", "ngetopt_bool_opt -> entry with" + SSDBG( descP, ("SOCKET", "esock_getopt_bool_opt -> entry with" "\r\n: level: %d" "\r\n: opt: %d" "\r\n", level, opt) ); @@ -13757,7 +13803,7 @@ ERL_NIF_TERM ngetopt_bool_opt(ErlNifEnv* env, } /* - SSDBG( descP, ("SOCKET", "ngetopt_bool_opt -> done when" + SSDBG( descP, ("SOCKET", "esock_getopt_bool_opt -> done when" "\r\n: res: %d" "\r\n: result: %T" "\r\n", res, result) ); @@ -13767,13 +13813,13 @@ ERL_NIF_TERM ngetopt_bool_opt(ErlNifEnv* env, } -/* ngetopt_int_opt - get an integer option +/* esock_getopt_int_opt - get an integer option */ static -ERL_NIF_TERM ngetopt_int_opt(ErlNifEnv* env, - ESockDescriptor* descP, - int level, - int opt) +ERL_NIF_TERM esock_getopt_int_opt(ErlNifEnv* env, + ESockDescriptor* descP, + int level, + int opt) { ERL_NIF_TERM result; int val; @@ -13793,13 +13839,13 @@ ERL_NIF_TERM ngetopt_int_opt(ErlNifEnv* env, -/* ngetopt_timeval_opt - get an timeval option +/* esock_getopt_timeval_opt - get an timeval option */ static -ERL_NIF_TERM ngetopt_timeval_opt(ErlNifEnv* env, - ESockDescriptor* descP, - int level, - int opt) +ERL_NIF_TERM esock_getopt_timeval_opt(ErlNifEnv* env, + ESockDescriptor* descP, + int level, + int opt) { ERL_NIF_TERM result; struct timeval val; @@ -13807,7 +13853,7 @@ ERL_NIF_TERM ngetopt_timeval_opt(ErlNifEnv* env, int res; SSDBG( descP, - ("SOCKET", "ngetopt_timeval_opt -> entry with" + ("SOCKET", "esock_getopt_timeval_opt -> entry with" "\r\n level: %d" "\r\n opt: %d" "\r\n", level, opt) ); @@ -13828,7 +13874,7 @@ ERL_NIF_TERM ngetopt_timeval_opt(ErlNifEnv* env, } SSDBG( descP, - ("SOCKET", "ngetopt_timeval_opt -> done when" + ("SOCKET", "esock_getopt_timeval_opt -> done when" "\r\n result: %T" "\r\n", result) ); @@ -13837,7 +13883,7 @@ ERL_NIF_TERM ngetopt_timeval_opt(ErlNifEnv* env, -/* ngetopt_str_opt - get an string option +/* esock_getopt_str_opt - get an string option * * We provide the max size of the string. This is the * size of the buffer we allocate for the value. @@ -13846,11 +13892,11 @@ ERL_NIF_TERM ngetopt_timeval_opt(ErlNifEnv* env, */ #if defined(USE_GETOPT_STR_OPT) static -ERL_NIF_TERM ngetopt_str_opt(ErlNifEnv* env, - ESockDescriptor* descP, - int level, - int opt, - int max) +ERL_NIF_TERM esock_getopt_str_opt(ErlNifEnv* env, + ESockDescriptor* descP, + int level, + int opt, + int max) { ERL_NIF_TERM result; char* val = MALLOC(max); @@ -13858,7 +13904,7 @@ ERL_NIF_TERM ngetopt_str_opt(ErlNifEnv* env, int res; SSDBG( descP, - ("SOCKET", "ngetopt_str_opt -> entry with" + ("SOCKET", "esock_getopt_str_opt -> entry with" "\r\n level: %d" "\r\n opt: %d" "\r\n max: %d" @@ -13875,7 +13921,7 @@ ERL_NIF_TERM ngetopt_str_opt(ErlNifEnv* env, } SSDBG( descP, - ("SOCKET", "ngetopt_str_opt -> done when" + ("SOCKET", "esock_getopt_str_opt -> done when" "\r\n result: %T" "\r\n", result) ); @@ -13926,7 +13972,7 @@ ERL_NIF_TERM nif_sockname(ErlNifEnv* env, "\r\n Socket: %T" "\r\n", descP->sock, argv[0]) ); - res = nsockname(env, descP); + res = esock_sockname(env, descP); SSDBG( descP, ("SOCKET", "nif_sockname -> done with res = %T\r\n", res) ); @@ -13938,8 +13984,8 @@ ERL_NIF_TERM nif_sockname(ErlNifEnv* env, #if !defined(__WIN32__) static -ERL_NIF_TERM nsockname(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_sockname(ErlNifEnv* env, + ESockDescriptor* descP) { ESockAddress sa; ESockAddress* saP = &sa; @@ -14000,7 +14046,7 @@ ERL_NIF_TERM nif_peername(ErlNifEnv* env, "\r\n Socket: %T" "\r\n", descP->sock, argv[0]) ); - res = npeername(env, descP); + res = esock_peername(env, descP); SSDBG( descP, ("SOCKET", "nif_peername -> done with res = %T\r\n", res) ); @@ -14012,8 +14058,8 @@ ERL_NIF_TERM nif_peername(ErlNifEnv* env, #if !defined(__WIN32__) static -ERL_NIF_TERM npeername(ErlNifEnv* env, - ESockDescriptor* descP) +ERL_NIF_TERM esock_peername(ErlNifEnv* env, + ESockDescriptor* descP) { ESockAddress sa; ESockAddress* saP = &sa; @@ -14079,7 +14125,7 @@ ERL_NIF_TERM nif_cancel(ErlNifEnv* env, "\r\n opRef: %T" "\r\n", descP->sock, op, opRef) ); - result = ncancel(env, descP, op, sockRef, opRef); + result = esock_cancel(env, descP, op, sockRef, opRef); SSDBG( descP, ("SOCKET", "nif_cancel -> done with result: " @@ -14093,11 +14139,11 @@ ERL_NIF_TERM nif_cancel(ErlNifEnv* env, #if !defined(__WIN32__) static -ERL_NIF_TERM ncancel(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM op, - ERL_NIF_TERM sockRef, - ERL_NIF_TERM opRef) +ERL_NIF_TERM esock_cancel(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM op, + ERL_NIF_TERM sockRef, + ERL_NIF_TERM opRef) { /* * @@ -14108,21 +14154,21 @@ ERL_NIF_TERM ncancel(ErlNifEnv* env, * */ if (COMPARE(op, esock_atom_connect) == 0) { - return ncancel_connect(env, descP, opRef); + return esock_cancel_connect(env, descP, opRef); } else if (COMPARE(op, esock_atom_accept) == 0) { - return ncancel_accept(env, descP, sockRef, opRef); + return esock_cancel_accept(env, descP, sockRef, opRef); } else if (COMPARE(op, esock_atom_send) == 0) { - return ncancel_send(env, descP, sockRef, opRef); + return esock_cancel_send(env, descP, sockRef, opRef); } else if (COMPARE(op, esock_atom_sendto) == 0) { - return ncancel_send(env, descP, sockRef, opRef); + return esock_cancel_send(env, descP, sockRef, opRef); } else if (COMPARE(op, esock_atom_sendmsg) == 0) { - return ncancel_send(env, descP, sockRef, opRef); + return esock_cancel_send(env, descP, sockRef, opRef); } else if (COMPARE(op, esock_atom_recv) == 0) { - return ncancel_recv(env, descP, sockRef, opRef); + return esock_cancel_recv(env, descP, sockRef, opRef); } else if (COMPARE(op, esock_atom_recvfrom) == 0) { - return ncancel_recv(env, descP, sockRef, opRef); + return esock_cancel_recv(env, descP, sockRef, opRef); } else if (COMPARE(op, esock_atom_recvmsg) == 0) { - return ncancel_recv(env, descP, sockRef, opRef); + return esock_cancel_recv(env, descP, sockRef, opRef); } else { return esock_make_error(env, esock_atom_einval); } @@ -14130,20 +14176,20 @@ ERL_NIF_TERM ncancel(ErlNifEnv* env, -/* *** ncancel_connect *** +/* *** esock_cancel_connect *** * * */ static -ERL_NIF_TERM ncancel_connect(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM opRef) +ERL_NIF_TERM esock_cancel_connect(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM opRef) { - return ncancel_write_select(env, descP, opRef); + return esock_cancel_write_select(env, descP, opRef); } -/* *** ncancel_accept *** +/* *** esock_cancel_accept *** * * We have two different cases: * *) Its the current acceptor @@ -14154,15 +14200,15 @@ ERL_NIF_TERM ncancel_connect(ErlNifEnv* env, * */ static -ERL_NIF_TERM ncancel_accept(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM sockRef, - ERL_NIF_TERM opRef) +ERL_NIF_TERM esock_cancel_accept(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM sockRef, + ERL_NIF_TERM opRef) { ERL_NIF_TERM res; SSDBG( descP, - ("SOCKET", "ncancel_accept -> entry with" + ("SOCKET", "esock_cancel_accept -> entry with" "\r\n opRef: %T" "\r\n %s" "\r\n", opRef, @@ -14172,9 +14218,9 @@ ERL_NIF_TERM ncancel_accept(ErlNifEnv* env, if (descP->currentAcceptorP != NULL) { if (COMPARE(opRef, descP->currentAcceptor.ref) == 0) { - res = ncancel_accept_current(env, descP, sockRef); + res = esock_cancel_accept_current(env, descP, sockRef); } else { - res = ncancel_accept_waiting(env, descP, opRef); + res = esock_cancel_accept_waiting(env, descP, opRef); } } else { /* Or badarg? */ @@ -14184,7 +14230,7 @@ ERL_NIF_TERM ncancel_accept(ErlNifEnv* env, MUNLOCK(descP->accMtx); SSDBG( descP, - ("SOCKET", "ncancel_accept -> done with result:" + ("SOCKET", "esock_cancel_accept -> done with result:" "\r\n %T" "\r\n", res) ); @@ -14197,25 +14243,25 @@ ERL_NIF_TERM ncancel_accept(ErlNifEnv* env, * in the acceptor queue). */ static -ERL_NIF_TERM ncancel_accept_current(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM sockRef) +ERL_NIF_TERM esock_cancel_accept_current(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM sockRef) { ERL_NIF_TERM res; - SSDBG( descP, ("SOCKET", "ncancel_accept_current -> entry\r\n") ); + SSDBG( descP, ("SOCKET", "esock_cancel_accept_current -> entry\r\n") ); - DEMONP("ncancel_accept_current -> current acceptor", + DEMONP("esock_cancel_accept_current -> current acceptor", env, descP, &descP->currentAcceptor.mon); - res = ncancel_read_select(env, descP, descP->currentAcceptor.ref); + res = esock_cancel_read_select(env, descP, descP->currentAcceptor.ref); SSDBG( descP, ("SOCKET", - "ncancel_accept_current -> cancel res: %T\r\n", res) ); + "esock_cancel_accept_current -> cancel res: %T\r\n", res) ); if (!activate_next_acceptor(env, descP, sockRef)) { SSDBG( descP, - ("SOCKET", "ncancel_accept_current -> no more writers\r\n") ); + ("SOCKET", "esock_cancel_accept_current -> no more writers\r\n") ); descP->state = SOCKET_STATE_LISTENING; @@ -14225,7 +14271,7 @@ ERL_NIF_TERM ncancel_accept_current(ErlNifEnv* env, esock_monitor_init(&descP->currentAcceptor.mon); } - SSDBG( descP, ("SOCKET", "ncancel_accept_current -> done with result:" + SSDBG( descP, ("SOCKET", "esock_cancel_accept_current -> done with result:" "\r\n %T" "\r\n", res) ); @@ -14237,9 +14283,9 @@ ERL_NIF_TERM ncancel_accept_current(ErlNifEnv* env, * remove them from the acceptor queue. */ static -ERL_NIF_TERM ncancel_accept_waiting(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM opRef) +ERL_NIF_TERM esock_cancel_accept_waiting(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM opRef) { ErlNifPid caller; @@ -14258,23 +14304,23 @@ ERL_NIF_TERM ncancel_accept_waiting(ErlNifEnv* env, -/* *** ncancel_send *** +/* *** esock_cancel_send *** * * Cancel a send operation. * Its either the current writer or one of the waiting writers. */ static -ERL_NIF_TERM ncancel_send(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM sockRef, - ERL_NIF_TERM opRef) +ERL_NIF_TERM esock_cancel_send(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM sockRef, + ERL_NIF_TERM opRef) { ERL_NIF_TERM res; MLOCK(descP->writeMtx); SSDBG( descP, - ("SOCKET", "ncancel_send -> entry with" + ("SOCKET", "esock_cancel_send -> entry with" "\r\n opRef: %T" "\r\n %s" "\r\n", opRef, @@ -14282,9 +14328,9 @@ ERL_NIF_TERM ncancel_send(ErlNifEnv* env, if (descP->currentWriterP != NULL) { if (COMPARE(opRef, descP->currentWriter.ref) == 0) { - res = ncancel_send_current(env, descP, sockRef); + res = esock_cancel_send_current(env, descP, sockRef); } else { - res = ncancel_send_waiting(env, descP, opRef); + res = esock_cancel_send_waiting(env, descP, opRef); } } else { /* Or badarg? */ @@ -14294,7 +14340,7 @@ ERL_NIF_TERM ncancel_send(ErlNifEnv* env, MUNLOCK(descP->writeMtx); SSDBG( descP, - ("SOCKET", "ncancel_send -> done with result:" + ("SOCKET", "esock_cancel_send -> done with result:" "\r\n %T" "\r\n", res) ); @@ -14308,31 +14354,31 @@ ERL_NIF_TERM ncancel_send(ErlNifEnv* env, * in the writer queue). */ static -ERL_NIF_TERM ncancel_send_current(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM sockRef) +ERL_NIF_TERM esock_cancel_send_current(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM sockRef) { ERL_NIF_TERM res; - SSDBG( descP, ("SOCKET", "ncancel_send_current -> entry\r\n") ); + SSDBG( descP, ("SOCKET", "esock_cancel_send_current -> entry\r\n") ); - DEMONP("ncancel_send_current -> current writer", + DEMONP("esock_cancel_send_current -> current writer", env, descP, &descP->currentWriter.mon); - res = ncancel_write_select(env, descP, descP->currentWriter.ref); + res = esock_cancel_write_select(env, descP, descP->currentWriter.ref); SSDBG( descP, - ("SOCKET", "ncancel_send_current -> cancel res: %T\r\n", res) ); + ("SOCKET", "esock_cancel_send_current -> cancel res: %T\r\n", res) ); if (!activate_next_writer(env, descP, sockRef)) { SSDBG( descP, - ("SOCKET", "ncancel_send_current -> no more writers\r\n") ); + ("SOCKET", "esock_cancel_send_current -> no more writers\r\n") ); descP->currentWriterP = NULL; descP->currentWriter.ref = esock_atom_undefined; enif_set_pid_undefined(&descP->currentWriter.pid); esock_monitor_init(&descP->currentWriter.mon); } - SSDBG( descP, ("SOCKET", "ncancel_send_current -> done with result:" + SSDBG( descP, ("SOCKET", "esock_cancel_send_current -> done with result:" "\r\n %T" "\r\n", res) ); @@ -14344,9 +14390,9 @@ ERL_NIF_TERM ncancel_send_current(ErlNifEnv* env, * remove them from the writer queue. */ static -ERL_NIF_TERM ncancel_send_waiting(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM opRef) +ERL_NIF_TERM esock_cancel_send_waiting(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM opRef) { ErlNifPid caller; @@ -14365,23 +14411,23 @@ ERL_NIF_TERM ncancel_send_waiting(ErlNifEnv* env, -/* *** ncancel_recv *** +/* *** esock_cancel_recv *** * * Cancel a read operation. * Its either the current reader or one of the waiting readers. */ static -ERL_NIF_TERM ncancel_recv(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM sockRef, - ERL_NIF_TERM opRef) +ERL_NIF_TERM esock_cancel_recv(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM sockRef, + ERL_NIF_TERM opRef) { ERL_NIF_TERM res; MLOCK(descP->readMtx); SSDBG( descP, - ("SOCKET", "ncancel_recv -> entry with" + ("SOCKET", "esock_cancel_recv -> entry with" "\r\n opRef: %T" "\r\n %s" "\r\n", opRef, @@ -14389,9 +14435,9 @@ ERL_NIF_TERM ncancel_recv(ErlNifEnv* env, if (descP->currentReaderP != NULL) { if (COMPARE(opRef, descP->currentReader.ref) == 0) { - res = ncancel_recv_current(env, descP, sockRef); + res = esock_cancel_recv_current(env, descP, sockRef); } else { - res = ncancel_recv_waiting(env, descP, opRef); + res = esock_cancel_recv_waiting(env, descP, opRef); } } else { /* Or badarg? */ @@ -14401,7 +14447,7 @@ ERL_NIF_TERM ncancel_recv(ErlNifEnv* env, MUNLOCK(descP->readMtx); SSDBG( descP, - ("SOCKET", "ncancel_recv -> done with result:" + ("SOCKET", "esock_cancel_recv -> done with result:" "\r\n %T" "\r\n", res) ); @@ -14414,31 +14460,31 @@ ERL_NIF_TERM ncancel_recv(ErlNifEnv* env, * in the reader queue). */ static -ERL_NIF_TERM ncancel_recv_current(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM sockRef) +ERL_NIF_TERM esock_cancel_recv_current(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM sockRef) { ERL_NIF_TERM res; - SSDBG( descP, ("SOCKET", "ncancel_recv_current -> entry\r\n") ); + SSDBG( descP, ("SOCKET", "esock_cancel_recv_current -> entry\r\n") ); - DEMONP("ncancel_recv_current -> current reader", + DEMONP("esock_cancel_recv_current -> current reader", env, descP, &descP->currentReader.mon); - res = ncancel_read_select(env, descP, descP->currentReader.ref); + res = esock_cancel_read_select(env, descP, descP->currentReader.ref); SSDBG( descP, - ("SOCKET", "ncancel_recv_current -> cancel res: %T\r\n", res) ); + ("SOCKET", "esock_cancel_recv_current -> cancel res: %T\r\n", res) ); if (!activate_next_reader(env, descP, sockRef)) { SSDBG( descP, - ("SOCKET", "ncancel_recv_current -> no more readers\r\n") ); + ("SOCKET", "esock_cancel_recv_current -> no more readers\r\n") ); descP->currentReaderP = NULL; descP->currentReader.ref = esock_atom_undefined; enif_set_pid_undefined(&descP->currentReader.pid); esock_monitor_init(&descP->currentReader.mon); } - SSDBG( descP, ("SOCKET", "ncancel_recv_current -> done with result:" + SSDBG( descP, ("SOCKET", "esock_cancel_recv_current -> done with result:" "\r\n %T" "\r\n", res) ); @@ -14450,9 +14496,9 @@ ERL_NIF_TERM ncancel_recv_current(ErlNifEnv* env, * remove them from the reader queue. */ static -ERL_NIF_TERM ncancel_recv_waiting(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM opRef) +ERL_NIF_TERM esock_cancel_recv_waiting(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM opRef) { ErlNifPid caller; @@ -14472,33 +14518,33 @@ ERL_NIF_TERM ncancel_recv_waiting(ErlNifEnv* env, static -ERL_NIF_TERM ncancel_read_select(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM opRef) +ERL_NIF_TERM esock_cancel_read_select(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM opRef) { - return ncancel_mode_select(env, descP, opRef, - ERL_NIF_SELECT_READ, - ERL_NIF_SELECT_READ_CANCELLED); + return esock_cancel_mode_select(env, descP, opRef, + ERL_NIF_SELECT_READ, + ERL_NIF_SELECT_READ_CANCELLED); } static -ERL_NIF_TERM ncancel_write_select(ErlNifEnv* env, +ERL_NIF_TERM esock_cancel_write_select(ErlNifEnv* env, ESockDescriptor* descP, ERL_NIF_TERM opRef) { - return ncancel_mode_select(env, descP, opRef, - ERL_NIF_SELECT_WRITE, - ERL_NIF_SELECT_WRITE_CANCELLED); + return esock_cancel_mode_select(env, descP, opRef, + ERL_NIF_SELECT_WRITE, + ERL_NIF_SELECT_WRITE_CANCELLED); } static -ERL_NIF_TERM ncancel_mode_select(ErlNifEnv* env, - ESockDescriptor* descP, - ERL_NIF_TERM opRef, - int smode, - int rmode) +ERL_NIF_TERM esock_cancel_mode_select(ErlNifEnv* env, + ESockDescriptor* descP, + ERL_NIF_TERM opRef, + int smode, + int rmode) { int selectRes = esock_select_cancel(env, descP->sock, smode, descP); @@ -14510,7 +14556,8 @@ ERL_NIF_TERM ncancel_mode_select(ErlNifEnv* env, return esock_make_error(env, esock_atom_select_sent); } else { /* Stopped? */ - SSDBG( descP, ("SOCKET", "ncancel_mode_select -> failed: %d (0x%lX)" + SSDBG( descP, ("SOCKET", + "esock_cancel_mode_select -> failed: %d (0x%lX)" "\r\n", selectRes, selectRes) ); return esock_make_error(env, esock_atom_einval); } @@ -19484,7 +19531,8 @@ void socket_down_reader(ErlNifEnv* env, if (!activate_next_reader(env, descP, sockRef)) { SSDBG( descP, - ("SOCKET", "ncancel_recv_current -> no more readers\r\n") ); + ("SOCKET", + "socket_down_reader -> no more readers\r\n") ); descP->currentReaderP = NULL; descP->currentReader.ref = esock_atom_undefined; enif_set_pid_undefined(&descP->currentReader.pid); -- cgit v1.2.3