aboutsummaryrefslogtreecommitdiff
path: root/src/compat
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2018-03-19 16:02:37 -0700
committerGarrett D'Amore <garrett@damore.org>2018-03-20 09:53:58 -0700
commit9ca901c1b70b17d851426483d9f54611cfa8e395 (patch)
treea26b11e16f505ccdc77b5ac6681e0f9de705ff20 /src/compat
parent9b886a9999247d87c9f6d389c3e65a4bd39be010 (diff)
downloadnng-9ca901c1b70b17d851426483d9f54611cfa8e395.tar.gz
nng-9ca901c1b70b17d851426483d9f54611cfa8e395.tar.bz2
nng-9ca901c1b70b17d851426483d9f54611cfa8e395.zip
fixes #296 Typed options should validate option type
fixes #302 nng_dialer/listener/pipe_getopt_sockaddr desired This adds plumbing to pass and check the type of options all the way through. NNG_ZT_OPT_ORBIT is type UINT64, but you can use the untyped form to pass two of them if needed. No typed access for retrieving strings yet. I think this should allocate a pointer and copy that out, but that's for later.
Diffstat (limited to 'src/compat')
-rw-r--r--src/compat/nanomsg/nn.c11
-rw-r--r--src/compat/nanomsg/nn.h11
2 files changed, 19 insertions, 3 deletions
diff --git a/src/compat/nanomsg/nn.c b/src/compat/nanomsg/nn.c
index fc29083e..caa02c72 100644
--- a/src/compat/nanomsg/nn.c
+++ b/src/compat/nanomsg/nn.c
@@ -1,5 +1,5 @@
//
-// Copyright 2018 Garrett D'Amore <garrett@damore.org>
+// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech>
// Copyright 2018 Capitar IT Group BV <info@capitar.com>
//
// This software is supplied under the terms of the MIT License, a
@@ -52,6 +52,15 @@ static const struct {
{ NNG_ECONNABORTED, ECONNABORTED },
{ NNG_ECONNRESET, ECONNRESET },
{ NNG_ECANCELED, EBADF },
+ { NNG_EEXIST, EEXIST },
+ { NNG_EWRITEONLY, EACCES },
+ { NNG_EREADONLY, EACCES },
+ { NNG_ECRYPTO, EACCES },
+ { NNG_EPEERAUTH, EACCES },
+ { NNG_EBADTYPE, EINVAL },
+ { NNG_EAMBIGUOUS, EINVAL },
+ { NNG_ENOFILES, EMFILE },
+ { NNG_ENOSPC, ENOSPC },
{ 0, 0 },
// clang-format on
};
diff --git a/src/compat/nanomsg/nn.h b/src/compat/nanomsg/nn.h
index 8c5cee6f..be98ec2f 100644
--- a/src/compat/nanomsg/nn.h
+++ b/src/compat/nanomsg/nn.h
@@ -1,6 +1,6 @@
//
-// Copyright 2017 Garrett D'Amore <garrett@damore.org>
-// Copyright 2017 Capitar IT Group BV <info@capitar.com>
+// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2018 Capitar IT Group BV <info@capitar.com>
//
// This software is supplied under the terms of the MIT License, a
// copy of which should be located in the distribution where this
@@ -196,6 +196,13 @@ extern "C" {
#ifndef EIO
#define EIO (NN_ERRBASE+32)
#endif
+#ifndef EEXIST
+#define EEXIST (NN_ERRBASE+33)
+#endif
+#ifndef ENOSPC
+#define ENOSPC (NN_ERRBASE+34)
+#endif
+
// Socket options
#define NN_LINGER 1