aboutsummaryrefslogtreecommitdiff
path: root/src/nng_compat.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-10-06 12:26:42 -0700
committerGarrett D'Amore <garrett@damore.org>2017-10-06 12:26:42 -0700
commit52d37858451ad23f077294fc78b1a3f56255c32f (patch)
tree25bbdd0e995ca3af389697801f284d583e70a130 /src/nng_compat.c
parentb0f31f578b0669b598d3ded3a625685b125bef1d (diff)
downloadnng-52d37858451ad23f077294fc78b1a3f56255c32f.tar.gz
nng-52d37858451ad23f077294fc78b1a3f56255c32f.tar.bz2
nng-52d37858451ad23f077294fc78b1a3f56255c32f.zip
Add NNG_OPT_DOMAIN and NNG_OPT_SOCKNAME support for legacy compat.
The NNG_OPT_SOCKNAME option is settable, to a limit of 64 bytes. The NNG_OPT_DOMAIN is read-only, but changes to match the setting of the NNG_OPT_RAW field. New applications should not use the NNG_OPT_DOMAIN option -- it is provided solely for use with the legacy NN_DOMAIN option in the compatibility layer.
Diffstat (limited to 'src/nng_compat.c')
-rw-r--r--src/nng_compat.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/nng_compat.c b/src/nng_compat.c
index 994c1332..dedbda0d 100644
--- a/src/nng_compat.c
+++ b/src/nng_compat.c
@@ -583,11 +583,13 @@ static struct {
{ NN_SOL_SOCKET, NN_MAXTTL },
{ NN_SOL_SOCKET, NN_RCVTIMEO },
{ NN_SOL_SOCKET, NN_SNDTIMEO },
+ { NN_SOL_SOCKET, NN_DOMAIN },
+ { NN_SOL_SOCKET, NN_SOCKET_NAME },
{ NN_REQ, NN_REQ_RESEND_IVL },
{ NN_SUB, NN_SUB_SUBSCRIBE },
{ NN_SUB, NN_SUB_UNSUBSCRIBE },
{ NN_SURVEYOR, NN_SURVEYOR_DEADLINE },
- // XXX: DOMAIN, IPV4ONLY, SOCKETNAME, SNDPRIO, RCVPRIO
+ // XXX: IPV4ONLY, SNDPRIO, RCVPRIO
// clang-format on
};
@@ -642,6 +644,12 @@ init_opts(void)
case NN_SNDTIMEO:
SETOPT(NNG_OPT_SENDTIMEO, 1);
break;
+ case NN_SOCKET_NAME:
+ SETOPT(NNG_OPT_SOCKNAME, 0);
+ break;
+ case NN_DOMAIN:
+ SETOPT(NNG_OPT_DOMAIN, 0);
+ break;
}
break;
case NN_REQ:
@@ -693,7 +701,8 @@ nn_getsockopt(int s, int nnlevel, int nnopt, void *valp, size_t *szp)
}
if (name == NULL) {
- return (ENOPROTOOPT);
+ errno = ENOPROTOOPT;
+ return (-1);
}
if (mscvt) {