From 9ca901c1b70b17d851426483d9f54611cfa8e395 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Mon, 19 Mar 2018 16:02:37 -0700 Subject: 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. --- src/compat/nanomsg/nn.c | 11 ++++++++++- src/compat/nanomsg/nn.h | 11 +++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) (limited to 'src/compat') 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 +// Copyright 2018 Staysail Systems, Inc. // Copyright 2018 Capitar IT Group BV // // 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 -// Copyright 2017 Capitar IT Group BV +// Copyright 2018 Staysail Systems, Inc. +// Copyright 2018 Capitar IT Group BV // // 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 -- cgit v1.2.3-70-g09d2