aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2025-04-27 23:35:25 -0700
committerGarrett D'Amore <garrett@damore.org>2025-04-27 23:35:25 -0700
commit7bb5ab9c4f70c9fa0a67a22c4aee83b0109318c4 (patch)
tree5a3036d609404ee5218b6189a89799e70f4623df /src
parent70ae513e4dda50864f7d45b6676549ed5246144d (diff)
downloadnng-7bb5ab9c4f70c9fa0a67a22c4aee83b0109318c4.tar.gz
nng-7bb5ab9c4f70c9fa0a67a22c4aee83b0109318c4.tar.bz2
nng-7bb5ab9c4f70c9fa0a67a22c4aee83b0109318c4.zip
Converted property functions to use nng_err.
Diffstat (limited to 'src')
-rw-r--r--src/core/listener.c2
-rw-r--r--src/core/listener.h2
-rw-r--r--src/core/options.c52
-rw-r--r--src/core/options.h38
-rw-r--r--src/core/pollable.c8
-rw-r--r--src/core/pollable.h6
-rw-r--r--src/core/protocol.h4
-rw-r--r--src/core/socket.c40
-rw-r--r--src/core/sockfd.c14
-rw-r--r--src/core/stream.c102
-rw-r--r--src/core/stream.h46
-rw-r--r--src/core/tcp.c4
-rw-r--r--src/platform/posix/posix_ipcconn.c28
-rw-r--r--src/platform/posix/posix_ipcdial.c8
-rw-r--r--src/platform/posix/posix_ipclisten.c28
-rw-r--r--src/platform/posix/posix_sockfd.c30
-rw-r--r--src/platform/posix/posix_tcpconn.c18
-rw-r--r--src/platform/posix/posix_tcpdial.c28
-rw-r--r--src/platform/posix/posix_tcplisten.c42
-rw-r--r--src/platform/windows/win_ipcconn.c8
-rw-r--r--src/platform/windows/win_ipcdial.c6
-rw-r--r--src/platform/windows/win_ipclisten.c4
-rw-r--r--src/platform/windows/win_tcpconn.c8
-rw-r--r--src/platform/windows/win_tcpdial.c28
-rw-r--r--src/platform/windows/win_tcplisten.c41
-rw-r--r--src/sp/protocol/bus0/bus.c22
-rw-r--r--src/sp/protocol/pair0/pair.c20
-rw-r--r--src/sp/protocol/pair1/pair.c33
-rw-r--r--src/sp/protocol/pair1/pair1_poly.c11
-rw-r--r--src/sp/protocol/pipeline0/pull.c2
-rw-r--r--src/sp/protocol/pipeline0/push.c10
-rw-r--r--src/sp/protocol/pubsub0/pub.c10
-rw-r--r--src/sp/protocol/pubsub0/sub.c40
-rw-r--r--src/sp/protocol/reqrep0/rep.c13
-rw-r--r--src/sp/protocol/reqrep0/req.c31
-rw-r--r--src/sp/protocol/reqrep0/xrep.c9
-rw-r--r--src/sp/protocol/reqrep0/xreq.c9
-rw-r--r--src/sp/protocol/survey0/respond.c13
-rw-r--r--src/sp/protocol/survey0/survey.c20
-rw-r--r--src/sp/protocol/survey0/xrespond.c9
-rw-r--r--src/sp/protocol/survey0/xsurvey.c9
-rw-r--r--src/sp/transport.h2
-rw-r--r--src/sp/transport/inproc/inproc.c14
-rw-r--r--src/sp/transport/ipc/ipc.c12
-rw-r--r--src/sp/transport/socket/sockfd.c10
-rw-r--r--src/sp/transport/tcp/tcp.c10
-rw-r--r--src/sp/transport/tls/tls.c10
-rw-r--r--src/sp/transport/udp/udp.c38
-rw-r--r--src/supplemental/tls/tls_dialer.c12
-rw-r--r--src/supplemental/tls/tls_listener.c12
-rw-r--r--src/supplemental/tls/tls_stream.c12
-rw-r--r--src/supplemental/websocket/websocket.c172
52 files changed, 590 insertions, 570 deletions
diff --git a/src/core/listener.c b/src/core/listener.c
index 0ba745c9..d1f3b497 100644
--- a/src/core/listener.c
+++ b/src/core/listener.c
@@ -557,7 +557,7 @@ nni_listener_set_tls(nni_listener *l, nng_tls_config *cfg)
return (l->l_ops.l_set_tls(l->l_data, cfg));
}
-int
+nng_err
nni_listener_set_security_descriptor(nni_listener *l, void *desc)
{
if (l->l_ops.l_set_security_descriptor == NULL) {
diff --git a/src/core/listener.h b/src/core/listener.h
index e1f83685..8b9a4c03 100644
--- a/src/core/listener.h
+++ b/src/core/listener.h
@@ -32,7 +32,7 @@ extern int nni_listener_getopt(
nni_listener *, const char *, void *, size_t *, nni_type);
extern int nni_listener_get_tls(nni_listener *, nng_tls_config **);
extern int nni_listener_set_tls(nni_listener *, nng_tls_config *);
-extern int nni_listener_set_security_descriptor(nni_listener *, void *);
+extern nng_err nni_listener_set_security_descriptor(nni_listener *, void *);
extern nng_url *nni_listener_url(nni_listener *);
extern void nni_listener_add_stat(nni_listener *, nni_stat_item *);
extern void nni_listener_bump_error(nni_listener *, int);
diff --git a/src/core/options.c b/src/core/options.c
index 7e05c23e..23e63d1c 100644
--- a/src/core/options.c
+++ b/src/core/options.c
@@ -16,7 +16,7 @@
#include <stdio.h>
#include <string.h>
-int
+nng_err
nni_copyin_ms(nni_duration *dp, const void *v, size_t sz, nni_type t)
{
nni_duration dur;
@@ -33,10 +33,10 @@ nni_copyin_ms(nni_duration *dp, const void *v, size_t sz, nni_type t)
if (dp != NULL) {
*dp = dur;
}
- return (0);
+ return (NNG_OK);
}
-int
+nng_err
nni_copyin_bool(bool *bp, const void *v, size_t sz, nni_type t)
{
NNI_ARG_UNUSED(sz);
@@ -45,10 +45,10 @@ nni_copyin_bool(bool *bp, const void *v, size_t sz, nni_type t)
return (NNG_EBADTYPE);
}
*bp = *(bool *) v;
- return (0);
+ return (NNG_OK);
}
-int
+nng_err
nni_copyin_int(
int *ip, const void *v, size_t sz, int minv, int maxv, nni_type t)
{
@@ -66,10 +66,10 @@ nni_copyin_int(
return (NNG_EINVAL);
}
*ip = i;
- return (0);
+ return (NNG_OK);
}
-int
+nng_err
nni_copyin_size(
size_t *sp, const void *v, size_t sz, size_t minv, size_t maxv, nni_type t)
{
@@ -85,10 +85,10 @@ nni_copyin_size(
return (NNG_EINVAL);
}
*sp = val;
- return (0);
+ return (NNG_OK);
}
-int
+nng_err
nni_copyin_str(char *s, const void *v, size_t maxsz, nni_type t)
{
size_t z;
@@ -102,20 +102,20 @@ nni_copyin_str(char *s, const void *v, size_t maxsz, nni_type t)
}
memcpy(s, v, z);
s[z] = 0;
- return (0);
+ return (NNG_OK);
}
-int
+nng_err
nni_copyin_sockaddr(nng_sockaddr *ap, const void *v, nni_type t)
{
if (t != NNI_TYPE_SOCKADDR) {
return (NNG_EBADTYPE);
}
*ap = *(nng_sockaddr *) v;
- return (0);
+ return (NNG_OK);
}
-int
+nng_err
nni_copyout_bool(bool b, void *dst, size_t *szp, nni_type t)
{
NNI_ARG_UNUSED(szp);
@@ -123,10 +123,10 @@ nni_copyout_bool(bool b, void *dst, size_t *szp, nni_type t)
return (NNG_EBADTYPE);
}
*(bool *) dst = b;
- return (0);
+ return (NNG_OK);
}
-int
+nng_err
nni_copyout_int(int i, void *dst, size_t *szp, nni_type t)
{
NNI_ARG_UNUSED(szp);
@@ -134,10 +134,10 @@ nni_copyout_int(int i, void *dst, size_t *szp, nni_type t)
return (NNG_EBADTYPE);
}
*(int *) dst = i;
- return (0);
+ return (NNG_OK);
}
-int
+nng_err
nni_copyout_ms(nng_duration d, void *dst, size_t *szp, nni_type t)
{
NNI_ARG_UNUSED(szp);
@@ -145,10 +145,10 @@ nni_copyout_ms(nng_duration d, void *dst, size_t *szp, nni_type t)
return (NNG_EBADTYPE);
}
*(nng_duration *) dst = d;
- return (0);
+ return (NNG_OK);
}
-int
+nng_err
nni_copyout_size(size_t s, void *dst, size_t *szp, nni_type t)
{
NNI_ARG_UNUSED(szp);
@@ -156,10 +156,10 @@ nni_copyout_size(size_t s, void *dst, size_t *szp, nni_type t)
return (NNG_EBADTYPE);
}
*(size_t *) dst = s;
- return (0);
+ return (NNG_OK);
}
-int
+nng_err
nni_copyout_sockaddr(
const nng_sockaddr *sap, void *dst, size_t *szp, nni_type t)
{
@@ -168,10 +168,10 @@ nni_copyout_sockaddr(
return (NNG_EBADTYPE);
}
*(nng_sockaddr *) dst = *sap;
- return (0);
+ return (NNG_OK);
}
-int
+nng_err
nni_copyout_str(const char *str, void *dst, size_t *szp, nni_type t)
{
char *s;
@@ -184,10 +184,10 @@ nni_copyout_str(const char *str, void *dst, size_t *szp, nni_type t)
return (NNG_ENOMEM);
}
*(char **) dst = s;
- return (0);
+ return (NNG_OK);
}
-int
+nng_err
nni_getopt(const nni_option *opts, const char *nm, void *arg, void *buf,
size_t *szp, nni_type otype)
{
@@ -203,7 +203,7 @@ nni_getopt(const nni_option *opts, const char *nm, void *arg, void *buf,
return (NNG_ENOTSUP);
}
-int
+nng_err
nni_setopt(const nni_option *opts, const char *nm, void *arg, const void *buf,
size_t sz, nni_type otype)
{
diff --git a/src/core/options.h b/src/core/options.h
index 71fa4d36..fb326b6a 100644
--- a/src/core/options.h
+++ b/src/core/options.h
@@ -28,29 +28,29 @@
// in their own option handling, centralizing the logic for dealing with
// variable sized options.
-extern int nni_copyin_ms(nni_duration *, const void *, size_t, nni_type);
-extern int nni_copyin_bool(bool *, const void *, size_t, nni_type);
-extern int nni_copyin_int(int *, const void *, size_t, int, int, nni_type);
-extern int nni_copyin_size(
+extern nng_err nni_copyin_ms(nni_duration *, const void *, size_t, nni_type);
+extern nng_err nni_copyin_bool(bool *, const void *, size_t, nni_type);
+extern nng_err nni_copyin_int(int *, const void *, size_t, int, int, nni_type);
+extern nng_err nni_copyin_size(
size_t *, const void *, size_t, size_t, size_t, nni_type);
-extern int nni_copyin_str(char *, const void *, size_t, nni_type);
-extern int nni_copyin_ptr(void **, const void *, size_t, nni_type);
-extern int nni_copyin_sockaddr(nng_sockaddr *, const void *, nni_type);
+extern nng_err nni_copyin_str(char *, const void *, size_t, nni_type);
+extern nng_err nni_copyin_ptr(void **, const void *, size_t, nni_type);
+extern nng_err nni_copyin_sockaddr(nng_sockaddr *, const void *, nni_type);
// nni_copyout_xxx copies out a type of the named value. It assumes that
// the type is aligned and the size correct.
-extern int nni_copyout(const void *, size_t, void *, size_t *);
-extern int nni_copyout_bool(bool, void *, size_t *, nni_type);
-extern int nni_copyout_int(int, void *, size_t *, nni_type);
-extern int nni_copyout_ms(nng_duration, void *, size_t *, nni_type);
-extern int nni_copyout_ptr(void *, void *, size_t *, nni_type);
-extern int nni_copyout_size(size_t, void *, size_t *, nni_type);
-extern int nni_copyout_sockaddr(
+extern nng_err nni_copyout(const void *, size_t, void *, size_t *);
+extern nng_err nni_copyout_bool(bool, void *, size_t *, nni_type);
+extern nng_err nni_copyout_int(int, void *, size_t *, nni_type);
+extern nng_err nni_copyout_ms(nng_duration, void *, size_t *, nni_type);
+extern nng_err nni_copyout_ptr(void *, void *, size_t *, nni_type);
+extern nng_err nni_copyout_size(size_t, void *, size_t *, nni_type);
+extern nng_err nni_copyout_sockaddr(
const nng_sockaddr *, void *, size_t *, nni_type);
// nni_copyout_str copies out a string. If the type is NNI_TYPE_STRING,
// then it passes through a pointer, created by nni_strdup().
-extern int nni_copyout_str(const char *, void *, size_t *, nni_type);
+extern nng_err nni_copyout_str(const char *, void *, size_t *, nni_type);
// nni_option is used for socket, protocol, transport, and similar options.
// Note that only for transports, the o_set member may be called with a NULL
@@ -66,20 +66,20 @@ struct nni_option_s {
// the actual size of the object that would have been copied
// is supplied by the function in the size. If the object did
// not fit, then NNG_EINVAL is returned.
- int (*o_get)(void *, void *, size_t *, nni_type);
+ nng_err (*o_get)(void *, void *, size_t *, nni_type);
// o_set is used to set the value of the option. For transport
// endpoints only, the instance parameter (first argument) may be
// NULL, in which case only a generic validation of the parameters
// is performed. (This is used when setting socket options before
- int (*o_set)(void *, const void *, size_t, nni_type);
+ nng_err (*o_set)(void *, const void *, size_t, nni_type);
};
// nni_getopt and nni_setopt are helper functions to implement options
// based on arrays of nni_option structures.
-extern int nni_getopt(
+extern nng_err nni_getopt(
const nni_option *, const char *, void *, void *, size_t *, nni_type);
-extern int nni_setopt(
+extern nng_err nni_setopt(
const nni_option *, const char *, void *, const void *, size_t, nni_type);
#endif // CORE_OPTIONS_H
diff --git a/src/core/pollable.c b/src/core/pollable.c
index 8e5ad7c1..d07c9b10 100644
--- a/src/core/pollable.c
+++ b/src/core/pollable.c
@@ -14,7 +14,7 @@
// atomically and use nni_atomic_cas64, to be lock free.
#define WFD(fds) ((int) ((fds) &0xffffffffu))
#define RFD(fds) ((int) (((fds) >> 32u) & 0xffffffffu))
-#define FD_JOIN(wfd, rfd) ((uint64_t)(wfd) + ((uint64_t)(rfd) << 32u))
+#define FD_JOIN(wfd, rfd) ((uint64_t) (wfd) + ((uint64_t) (rfd) << 32u))
void
nni_pollable_init(nni_pollable *p)
@@ -60,7 +60,7 @@ nni_pollable_clear(nni_pollable *p)
}
}
-int
+nng_err
nni_pollable_getfd(nni_pollable *p, int *fdp)
{
if (p == NULL) {
@@ -75,7 +75,7 @@ nni_pollable_getfd(nni_pollable *p, int *fdp)
if ((fds = nni_atomic_get64(&p->p_fds)) != (uint64_t) -1) {
*fdp = RFD(fds);
- return (0);
+ return (NNG_OK);
}
if ((rv = nni_plat_pipe_open(&wfd, &rfd)) != 0) {
return (rv);
@@ -87,7 +87,7 @@ nni_pollable_getfd(nni_pollable *p, int *fdp)
nni_plat_pipe_raise(wfd);
}
*fdp = rfd;
- return (0);
+ return (NNG_OK);
}
// Someone beat us. Close ours, and try again.
diff --git a/src/core/pollable.h b/src/core/pollable.h
index 099ab8b7..1be8b034 100644
--- a/src/core/pollable.h
+++ b/src/core/pollable.h
@@ -16,9 +16,9 @@
typedef struct nni_pollable nni_pollable;
-extern void nni_pollable_raise(nni_pollable *);
-extern void nni_pollable_clear(nni_pollable *);
-extern int nni_pollable_getfd(nni_pollable *, int *);
+extern void nni_pollable_raise(nni_pollable *);
+extern void nni_pollable_clear(nni_pollable *);
+extern nng_err nni_pollable_getfd(nni_pollable *, int *);
// nni_pollable implementation details are private. Only here for inlining.
// We have joined the write and read file descriptors into a single
diff --git a/src/core/protocol.h b/src/core/protocol.h
index 5231c8f4..109ec5ef 100644
--- a/src/core/protocol.h
+++ b/src/core/protocol.h
@@ -109,10 +109,10 @@ struct nni_proto_sock_ops {
void (*sock_recv)(void *, nni_aio *);
// Return the receive poll FD.
- int (*sock_recv_poll_fd)(void *, int *);
+ nng_err (*sock_recv_poll_fd)(void *, int *);
// Return the send poll FD.
- int (*sock_send_poll_fd)(void *, int *);
+ nng_err (*sock_send_poll_fd)(void *, int *);
// Options. Must not be NULL. Final entry should have NULL name.
nni_option *sock_options;
diff --git a/src/core/socket.c b/src/core/socket.c
index 0dfdb183..0e2e72ea 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -153,80 +153,80 @@ sock_get_fd(nni_sock *s, unsigned flag, int *fdp)
return (rv);
}
-static int
+static nng_err
sock_set_recvtimeo(void *s, const void *buf, size_t sz, nni_type t)
{
return (nni_copyin_ms(&SOCK(s)->s_rcvtimeo, buf, sz, t));
}
-static int
+static nng_err
sock_get_recvtimeo(void *s, void *buf, size_t *szp, nni_type t)
{
return (nni_copyout_ms(SOCK(s)->s_rcvtimeo, buf, szp, t));
}
-static int
+static nng_err
sock_set_sendtimeo(void *s, const void *buf, size_t sz, nni_type t)
{
return (nni_copyin_ms(&SOCK(s)->s_sndtimeo, buf, sz, t));
}
-static int
+static nng_err
sock_get_sendtimeo(void *s, void *buf, size_t *szp, nni_type t)
{
return (nni_copyout_ms(SOCK(s)->s_sndtimeo, buf, szp, t));
}
-static int
+static nng_err
sock_set_reconnmint(void *s, const void *buf, size_t sz, nni_type t)
{
return (nni_copyin_ms(&SOCK(s)->s_reconn, buf, sz, t));
}
-static int
+static nng_err
sock_get_reconnmint(void *s, void *buf, size_t *szp, nni_type t)
{
return (nni_copyout_ms(SOCK(s)->s_reconn, buf, szp, t));
}
-static int
+static nng_err
sock_set_reconnmaxt(void *s, const void *buf, size_t sz, nni_type t)
{
return (nni_copyin_ms(&SOCK(s)->s_reconnmax, buf, sz, t));
}
-static int
+static nng_err
sock_get_reconnmaxt(void *s, void *buf, size_t *szp, nni_type t)
{
return (nni_copyout_ms(SOCK(s)->s_reconnmax, buf, szp, t));
}
-static int
+static nng_err
sock_set_recvmaxsz(void *s, const void *buf, size_t sz, nni_type t)
{
return (
nni_copyin_size(&SOCK(s)->s_rcvmaxsz, buf, sz, 0, NNI_MAXSZ, t));
}
-static int
+static nng_err
sock_get_recvmaxsz(void *s, void *buf, size_t *szp, nni_type t)
{
return (nni_copyout_size(SOCK(s)->s_rcvmaxsz, buf, szp, t));
}
-static int
+static nng_err
sock_set_recvbuf(void *s, const void *buf, size_t sz, nni_type t)
{
- int len;
- int rv;
+ int len;
+ nng_err rv;
- if ((rv = nni_copyin_int(&len, buf, sz, 0, 8192, t)) != 0) {
+ if ((rv = nni_copyin_int(&len, buf, sz, 0, 8192, t)) != NNG_OK) {
return (rv);
}
return (nni_msgq_resize(SOCK(s)->s_urq, len));
}
-static int
+static nng_err
sock_get_recvbuf(void *s, void *buf, size_t *szp, nni_type t)
{
int len = nni_msgq_cap(SOCK(s)->s_urq);
@@ -234,19 +234,19 @@ sock_get_recvbuf(void *s, void *buf, size_t *szp, nni_type t)
return (nni_copyout_int(len, buf, szp, t));
}
-static int
+static nng_err
sock_set_sendbuf(void *s, const void *buf, size_t sz, nni_type t)
{
- int len;
- int rv;
+ int len;
+ nng_err rv;
- if ((rv = nni_copyin_int(&len, buf, sz, 0, 8192, t)) != 0) {
+ if ((rv = nni_copyin_int(&len, buf, sz, 0, 8192, t)) != NNG_OK) {
return (rv);
}
return (nni_msgq_resize(SOCK(s)->s_uwq, len));
}
-static int
+static nng_err
sock_get_sendbuf(void *s, void *buf, size_t *szp, nni_type t)
{
int len = nni_msgq_cap(SOCK(s)->s_uwq);
diff --git a/src/core/sockfd.c b/src/core/sockfd.c
index 3a43359d..651fcd63 100644
--- a/src/core/sockfd.c
+++ b/src/core/sockfd.c
@@ -135,15 +135,15 @@ sfd_listener_accept(void *arg, nng_aio *aio)
nni_mtx_unlock(&l->mtx);
}
-static int
+static nng_err
sfd_listener_set_fd(void *arg, const void *buf, size_t sz, nni_type t)
{
sfd_listener *l = arg;
nni_aio *aio;
int fd;
- int rv;
+ nng_err rv;
- if ((rv = nni_copyin_int(&fd, buf, sz, 0, NNI_MAXINT, t)) != 0) {
+ if ((rv = nni_copyin_int(&fd, buf, sz, 0, NNI_MAXINT, t)) != NNG_OK) {
return (rv);
}
@@ -167,10 +167,10 @@ sfd_listener_set_fd(void *arg, const void *buf, size_t sz, nni_type t)
}
nni_mtx_unlock(&l->mtx);
- return (0);
+ return (NNG_OK);
}
-static int
+static nng_err
sfd_listener_get_addr(void *arg, void *buf, size_t *szp, nni_type t)
{
NNI_ARG_UNUSED(arg);
@@ -193,7 +193,7 @@ static const nni_option sfd_listener_options[] = {
},
};
-static int
+static nng_err
sfd_listener_get(
void *arg, const char *name, void *buf, size_t *szp, nni_type t)
{
@@ -201,7 +201,7 @@ sfd_listener_get(
return (nni_getopt(sfd_listener_options, name, l, buf, szp, t));
}
-static int
+static nng_err
sfd_listener_set(
void *arg, const char *name, const void *buf, size_t sz, nni_type t)
{
diff --git a/src/core/stream.c b/src/core/stream.c
index d8111c7a..e0da3582 100644
--- a/src/core/stream.c
+++ b/src/core/stream.c
@@ -150,7 +150,7 @@ nng_stream_recv(nng_stream *s, nng_aio *aio)
s->s_recv(s, aio);
}
-int
+nng_err
nni_stream_get(
nng_stream *s, const char *nm, void *data, size_t *szp, nni_type t)
{
@@ -187,7 +187,7 @@ nng_stream_dialer_dial(nng_stream_dialer *d, nng_aio *aio)
d->sd_dial(d, aio);
}
-int
+nng_err
nng_stream_dialer_alloc_url(nng_stream_dialer **dp, const nng_url *url)
{
for (int i = 0; stream_drivers[i].scheme != NULL; i++) {
@@ -198,7 +198,7 @@ nng_stream_dialer_alloc_url(nng_stream_dialer **dp, const nng_url *url)
return (NNG_ENOTSUP);
}
-int
+nng_err
nng_stream_dialer_alloc(nng_stream_dialer **dp, const char *uri)
{
nng_url *url;
@@ -212,21 +212,21 @@ nng_stream_dialer_alloc(nng_stream_dialer **dp, const char *uri)
return (rv);
}
-int
+nng_err
nni_stream_dialer_get(
nng_stream_dialer *d, const char *nm, void *data, size_t *szp, nni_type t)
{
return (d->sd_get(d, nm, data, szp, t));
}
-int
+nng_err
nni_stream_dialer_set(nng_stream_dialer *d, const char *nm, const void *data,
size_t sz, nni_type t)
{
return (d->sd_set(d, nm, data, sz, t));
}
-int
+nng_err
nni_stream_dialer_get_tls(nng_stream_dialer *d, nng_tls_config **cfgp)
{
if (d->sd_get_tls == NULL) {
@@ -235,7 +235,7 @@ nni_stream_dialer_get_tls(nng_stream_dialer *d, nng_tls_config **cfgp)
return (d->sd_get_tls(d, cfgp));
}
-int
+nng_err
nni_stream_dialer_set_tls(nng_stream_dialer *d, nng_tls_config *cfg)
{
if (d->sd_set_tls == NULL) {
@@ -267,7 +267,7 @@ nng_stream_listener_free(nng_stream_listener *l)
l->sl_free(l);
}
}
-int
+nng_err
nng_stream_listener_listen(nng_stream_listener *l)
{
return (l->sl_listen(l));
@@ -279,21 +279,21 @@ nng_stream_listener_accept(nng_stream_listener *l, nng_aio *aio)
l->sl_accept(l, aio);
}
-int
+nng_err
nni_stream_listener_get(nng_stream_listener *l, const char *nm, void *data,
size_t *szp, nni_type t)
{
return (l->sl_get(l, nm, data, szp, t));
}
-int
+nng_err
nni_stream_listener_set(nng_stream_listener *l, const char *nm,
const void *data, size_t sz, nni_type t)
{
return (l->sl_set(l, nm, data, sz, t));
}
-int
+nng_err
nni_stream_listener_get_tls(nng_stream_listener *l, nng_tls_config **cfgp)
{
if (l->sl_get_tls == NULL) {
@@ -302,7 +302,7 @@ nni_stream_listener_get_tls(nng_stream_listener *l, nng_tls_config **cfgp)
return (l->sl_get_tls(l, cfgp));
}
-int
+nng_err
nni_stream_listener_set_tls(nng_stream_listener *l, nng_tls_config *cfg)
{
if (l->sl_set_tls == NULL) {
@@ -311,7 +311,7 @@ nni_stream_listener_set_tls(nng_stream_listener *l, nng_tls_config *cfg)
return (l->sl_set_tls(l, cfg));
}
-int
+nng_err
nng_stream_listener_set_security_descriptor(
nng_stream_listener *l, void *pdesc)
{
@@ -321,7 +321,7 @@ nng_stream_listener_set_security_descriptor(
return (l->sl_set_security_descriptor(l, pdesc));
}
-int
+nng_err
nng_stream_listener_alloc_url(nng_stream_listener **lp, const nng_url *url)
{
for (int i = 0; stream_drivers[i].scheme != NULL; i++) {
@@ -332,13 +332,13 @@ nng_stream_listener_alloc_url(nng_stream_listener **lp, const nng_url *url)
return (NNG_ENOTSUP);
}
-int
+nng_err
nng_stream_listener_alloc(nng_stream_listener **lp, const char *uri)
{
nng_url *url;
- int rv;
+ nng_err rv;
- if ((rv = nng_url_parse(&url, uri)) != 0) {
+ if ((rv = nng_url_parse(&url, uri)) != NNG_OK) {
return (rv);
}
rv = nng_stream_listener_alloc_url(lp, url);
@@ -348,154 +348,154 @@ nng_stream_listener_alloc(nng_stream_listener **lp, const char *uri)
// Public stream options.
-int
+nng_err
nng_stream_get_int(nng_stream *s, const char *n, int *v)
{
return (nni_stream_get(s, n, v, NULL, NNI_TYPE_INT32));
}
-int
+nng_err
nng_stream_get_bool(nng_stream *s, const char *n, bool *v)
{
return (nni_stream_get(s, n, v, NULL, NNI_TYPE_BOOL));
}
-int
+nng_err
nng_stream_get_size(nng_stream *s, const char *n, size_t *v)
{
return (nni_stream_get(s, n, v, NULL, NNI_TYPE_SIZE));
}
-int
+nng_err
nng_stream_get_string(nng_stream *s, const char *n, char **v)
{
return (nni_stream_get(s, n, v, NULL, NNI_TYPE_STRING));
}
-int
+nng_err
nng_stream_get_ms(nng_stream *s, const char *n, nng_duration *v)
{
return (nni_stream_get(s, n, v, NULL, NNI_TYPE_DURATION));
}
-int
+nng_err
nng_stream_get_addr(nng_stream *s, const char *n, nng_sockaddr *v)
{
return (nni_stream_get(s, n, v, NULL, NNI_TYPE_SOCKADDR));
}
-int
+nng_err
nng_stream_dialer_get_int(nng_stream_dialer *d, const char *n, int *v)
{
return (nni_stream_dialer_get(d, n, v, NULL, NNI_TYPE_INT32));
}
-int
+nng_err
nng_stream_dialer_get_bool(nng_stream_dialer *d, const char *n, bool *v)
{
return (nni_stream_dialer_get(d, n, v, NULL, NNI_TYPE_BOOL));
}
-int
+nng_err
nng_stream_dialer_get_size(nng_stream_dialer *d, const char *n, size_t *v)
{
return (nni_stream_dialer_get(d, n, v, NULL, NNI_TYPE_SIZE));
}
-int
+nng_err
nng_stream_dialer_get_string(nng_stream_dialer *d, const char *n, char **v)
{
return (nni_stream_dialer_get(d, n, v, NULL, NNI_TYPE_STRING));
}
-int
+nng_err
nng_stream_dialer_get_ms(nng_stream_dialer *d, const char *n, nng_duration *v)
{
return (nni_stream_dialer_get(d, n, v, NULL, NNI_TYPE_DURATION));
}
-int
+nng_err
nng_stream_dialer_get_addr(
nng_stream_dialer *d, const char *n, nng_sockaddr *v)
{
return (nni_stream_dialer_get(d, n, v, NULL, NNI_TYPE_SOCKADDR));
}
-int
+nng_err
nng_stream_dialer_get_tls(nng_stream_dialer *d, nng_tls_config **cfgp)
{
return (nni_stream_dialer_get_tls(d, cfgp));
}
-int
+nng_err
nng_stream_listener_get_int(nng_stream_listener *l, const char *n, int *v)
{
return (nni_stream_listener_get(l, n, v, NULL, NNI_TYPE_INT32));
}
-int
+nng_err
nng_stream_listener_get_bool(nng_stream_listener *l, const char *n, bool *v)
{
return (nni_stream_listener_get(l, n, v, NULL, NNI_TYPE_BOOL));
}
-int
+nng_err
nng_stream_listener_get_size(nng_stream_listener *l, const char *n, size_t *v)
{
return (nni_stream_listener_get(l, n, v, NULL, NNI_TYPE_SIZE));
}
-int
+nng_err
nng_stream_listener_get_string(nng_stream_listener *l, const char *n, char **v)
{
return (nni_stream_listener_get(l, n, v, NULL, NNI_TYPE_STRING));
}
-int
+nng_err
nng_stream_listener_get_ms(
nng_stream_listener *l, const char *n, nng_duration *v)
{
return (nni_stream_listener_get(l, n, v, NULL, NNI_TYPE_DURATION));
}
-int
+nng_err
nng_stream_listener_get_addr(
nng_stream_listener *l, const char *n, nng_sockaddr *v)
{
return (nni_stream_listener_get(l, n, v, NULL, NNI_TYPE_SOCKADDR));
}
-int
+nng_err
nng_stream_listener_get_tls(nng_stream_listener *l, nng_tls_config **cfgp)
{
return (nni_stream_listener_get_tls(l, cfgp));
}
-int
+nng_err
nng_stream_dialer_set_int(nng_stream_dialer *d, const char *n, int v)
{
return (nni_stream_dialer_set(d, n, &v, sizeof(v), NNI_TYPE_INT32));
}
-int
+nng_err
nng_stream_dialer_set_bool(nng_stream_dialer *d, const char *n, bool v)
{
return (nni_stream_dialer_set(d, n, &v, sizeof(v), NNI_TYPE_BOOL));
}
-int
+nng_err
nng_stream_dialer_set_size(nng_stream_dialer *d, const char *n, size_t v)
{
return (nni_stream_dialer_set(d, n, &v, sizeof(v), NNI_TYPE_SIZE));
}
-int
+nng_err
nng_stream_dialer_set_ms(nng_stream_dialer *d, const char *n, nng_duration v)
{
return (nni_stream_dialer_set(d, n, &v, sizeof(v), NNI_TYPE_DURATION));
}
-int
+nng_err
nng_stream_dialer_set_string(
nng_stream_dialer *d, const char *n, const char *v)
{
@@ -503,38 +503,38 @@ nng_stream_dialer_set_string(
d, n, v, v == NULL ? 0 : strlen(v) + 1, NNI_TYPE_STRING));
}
-int
+nng_err
nng_stream_dialer_set_addr(
nng_stream_dialer *d, const char *n, const nng_sockaddr *v)
{
return (nni_stream_dialer_set(d, n, v, sizeof(*v), NNI_TYPE_SOCKADDR));
}
-int
+nng_err
nng_stream_dialer_set_tls(nng_stream_dialer *d, nng_tls_config *cfg)
{
return (nni_stream_dialer_set_tls(d, cfg));
}
-int
+nng_err
nng_stream_listener_set_int(nng_stream_listener *l, const char *n, int v)
{
return (nni_stream_listener_set(l, n, &v, sizeof(v), NNI_TYPE_INT32));
}
-int
+nng_err
nng_stream_listener_set_bool(nng_stream_listener *l, const char *n, bool v)
{
return (nni_stream_listener_set(l, n, &v, sizeof(v), NNI_TYPE_BOOL));
}
-int
+nng_err
nng_stream_listener_set_size(nng_stream_listener *l, const char *n, size_t v)
{
return (nni_stream_listener_set(l, n, &v, sizeof(v), NNI_TYPE_SIZE));
}
-int
+nng_err
nng_stream_listener_set_ms(
nng_stream_listener *l, const char *n, nng_duration v)
{
@@ -542,7 +542,7 @@ nng_stream_listener_set_ms(
nni_stream_listener_set(l, n, &v, sizeof(v), NNI_TYPE_DURATION));
}
-int
+nng_err
nng_stream_listener_set_string(
nng_stream_listener *l, const char *n, const char *v)
{
@@ -550,7 +550,7 @@ nng_stream_listener_set_string(
l, n, v, v == NULL ? 0 : strlen(v) + 1, NNI_TYPE_STRING));
}
-int
+nng_err
nng_stream_listener_set_addr(
nng_stream_listener *l, const char *n, const nng_sockaddr *v)
{
@@ -558,7 +558,7 @@ nng_stream_listener_set_addr(
nni_stream_listener_set(l, n, v, sizeof(*v), NNI_TYPE_SOCKADDR));
}
-int
+nng_err
nng_stream_listener_set_tls(nng_stream_listener *l, nng_tls_config *cfg)
{
return (nni_stream_listener_set_tls(l, cfg));
diff --git a/src/core/stream.h b/src/core/stream.h
index 5a07e5e5..83c121cd 100644
--- a/src/core/stream.h
+++ b/src/core/stream.h
@@ -16,25 +16,27 @@
#include "defs.h"
// Private property operations (these include the types.)
-extern int nni_stream_get(
+extern nng_err nni_stream_get(
nng_stream *, const char *, void *, size_t *, nni_type);
-extern int nni_stream_set(
+extern nng_err nni_stream_set(
nng_stream *, const char *, const void *, size_t, nni_type);
-extern int nni_stream_dialer_get(
+extern nng_err nni_stream_dialer_get(
nng_stream_dialer *, const char *, void *, size_t *, nni_type);
-extern int nni_stream_dialer_set(
+extern nng_err nni_stream_dialer_set(
nng_stream_dialer *, const char *, const void *, size_t, nni_type);
-extern int nni_stream_dialer_set_tls(nng_stream_dialer *, nng_tls_config *);
-extern int nni_stream_dialer_get_tls(nng_stream_dialer *, nng_tls_config **);
+extern nng_err nni_stream_dialer_set_tls(
+ nng_stream_dialer *, nng_tls_config *);
+extern nng_err nni_stream_dialer_get_tls(
+ nng_stream_dialer *, nng_tls_config **);
-extern int nni_stream_listener_get(
+extern nng_err nni_stream_listener_get(
nng_stream_listener *, const char *, void *, size_t *, nni_type);
-extern int nni_stream_listener_set(
+extern nng_err nni_stream_listener_set(
nng_stream_listener *, const char *, const void *, size_t, nni_type);
-extern int nni_stream_listener_set_tls(
+extern nng_err nni_stream_listener_set_tls(
nng_stream_listener *, nng_tls_config *);
-extern int nni_stream_listener_get_tls(
+extern nng_err nni_stream_listener_get_tls(
nng_stream_listener *, nng_tls_config **);
// This is the common implementation of a connected byte stream. It should be
@@ -46,8 +48,8 @@ struct nng_stream {
void (*s_stop)(void *);
void (*s_recv)(void *, nng_aio *);
void (*s_send)(void *, nng_aio *);
- int (*s_get)(void *, const char *, void *, size_t *, nni_type);
- int (*s_set)(void *, const char *, const void *, size_t, nni_type);
+ nng_err (*s_get)(void *, const char *, void *, size_t *, nni_type);
+ nng_err (*s_set)(void *, const char *, const void *, size_t, nni_type);
};
// Dialer implementation. Stream dialers create streams.
@@ -56,10 +58,11 @@ struct nng_stream_dialer {
void (*sd_close)(void *);
void (*sd_stop)(void *);
void (*sd_dial)(void *, nng_aio *);
- int (*sd_get)(void *, const char *, void *, size_t *, nni_type);
- int (*sd_set)(void *, const char *, const void *, size_t, nni_type);
- int (*sd_get_tls)(void *, nng_tls_config **);
- int (*sd_set_tls)(void *, nng_tls_config *);
+ nng_err (*sd_get)(void *, const char *, void *, size_t *, nni_type);
+ nng_err (*sd_set)(
+ void *, const char *, const void *, size_t, nni_type);
+ nng_err (*sd_get_tls)(void *, nng_tls_config **);
+ nng_err (*sd_set_tls)(void *, nng_tls_config *);
};
// Listener implementation. Stream listeners accept connections and create
@@ -70,11 +73,12 @@ struct nng_stream_listener {
void (*sl_stop)(void *);
nng_err (*sl_listen)(void *);
void (*sl_accept)(void *, nng_aio *);
- int (*sl_get)(void *, const char *, void *, size_t *, nni_type);
- int (*sl_set)(void *, const char *, const void *, size_t, nni_type);
- int (*sl_get_tls)(void *, nng_tls_config **);
- int (*sl_set_tls)(void *, nng_tls_config *);
- int (*sl_set_security_descriptor)(void *, void *);
+ nng_err (*sl_get)(void *, const char *, void *, size_t *, nni_type);
+ nng_err (*sl_set)(
+ void *, const char *, const void *, size_t, nni_type);
+ nng_err (*sl_get_tls)(void *, nng_tls_config **);
+ nng_err (*sl_set_tls)(void *, nng_tls_config *);
+ nng_err (*sl_set_security_descriptor)(void *, void *);
};
#endif // CORE_STREAM_H
diff --git a/src/core/tcp.c b/src/core/tcp.c
index 2017452b..5f663c19 100644
--- a/src/core/tcp.c
+++ b/src/core/tcp.c
@@ -204,14 +204,14 @@ tcp_dialer_dial(void *arg, nng_aio *aio)
nni_mtx_unlock(&d->mtx);
}
-static int
+static nng_err
tcp_dialer_get(void *arg, const char *name, void *buf, size_t *szp, nni_type t)
{
tcp_dialer *d = arg;
return (nni_tcp_dialer_get(d->d, name, buf, szp, t));
}
-static int
+static nng_err
tcp_dialer_set(
void *arg, const char *name, const void *buf, size_t sz, nni_type t)
{
diff --git a/src/platform/posix/posix_ipcconn.c b/src/platform/posix/posix_ipcconn.c
index a585bafd..fd3cdbd8 100644
--- a/src/platform/posix/posix_ipcconn.c
+++ b/src/platform/posix/posix_ipcconn.c
@@ -299,26 +299,26 @@ ipc_recv(void *arg, nni_aio *aio)
nni_mtx_unlock(&c->mtx);
}
-static int
+static nng_err
ipc_get_peer_uid(void *arg, void *buf, size_t *szp, nni_type t)
{
ipc_conn *c = arg;
- int rv;
+ nng_err rv;
int ignore;
int id = 0;
if ((rv = nni_posix_peerid(nni_posix_pfd_fd(&c->pfd), &id, &ignore,
- &ignore, &ignore)) != 0) {
+ &ignore, &ignore)) != NNG_OK) {
return (rv);
}
return (nni_copyout_int(id, buf, szp, t));
}
-static int
+static nng_err
ipc_get_peer_gid(void *arg, void *buf, size_t *szp, nni_type t)
{
ipc_conn *c = arg;
- int rv;
+ nng_err rv;
int ignore;
int id = 0;
@@ -329,16 +329,16 @@ ipc_get_peer_gid(void *arg, void *buf, size_t *szp, nni_type t)
return (nni_copyout_int(id, buf, szp, t));
}
-static int
+static nng_err
ipc_get_peer_zoneid(void *arg, void *buf, size_t *szp, nni_type t)
{
ipc_conn *c = arg;
- int rv;
+ nng_err rv;
int ignore;
int id = 0;
if ((rv = nni_posix_peerid(nni_posix_pfd_fd(&c->pfd), &ignore, &ignore,
- &ignore, &id)) != 0) {
+ &ignore, &id)) != NNG_OK) {
return (rv);
}
if (id == -1) {
@@ -348,16 +348,16 @@ ipc_get_peer_zoneid(void *arg, void *buf, size_t *szp, nni_type t)
return (nni_copyout_int(id, buf, szp, t));
}
-static int
+static nng_err
ipc_get_peer_pid(void *arg, void *buf, size_t *szp, nni_type t)
{
ipc_conn *c = arg;
- int rv;
+ nng_err rv;
int ignore;
int id = 0;
if ((rv = nni_posix_peerid(nni_posix_pfd_fd(&c->pfd), &ignore, &ignore,
- &id, &ignore)) != 0) {
+ &id, &ignore)) != NNG_OK) {
return (rv);
}
if (id == -1) {
@@ -367,7 +367,7 @@ ipc_get_peer_pid(void *arg, void *buf, size_t *szp, nni_type t)
return (nni_copyout_int(id, buf, szp, t));
}
-static int
+static nng_err
ipc_get_addr(void *arg, void *buf, size_t *szp, nni_type t)
{
ipc_conn *c = arg;
@@ -441,14 +441,14 @@ static const nni_option ipc_options[] = {
},
};
-static int
+static nng_err
ipc_get(void *arg, const char *name, void *val, size_t *szp, nni_type t)
{
ipc_conn *c = arg;
return (nni_getopt(ipc_options, name, c, val, szp, t));
}
-static int
+static nng_err
ipc_set(void *arg, const char *name, const void *val, size_t sz, nni_type t)
{
ipc_conn *c = arg;
diff --git a/src/platform/posix/posix_ipcdial.c b/src/platform/posix/posix_ipcdial.c
index f9e87b72..a570bc4f 100644
--- a/src/platform/posix/posix_ipcdial.c
+++ b/src/platform/posix/posix_ipcdial.c
@@ -249,7 +249,7 @@ error:
nni_aio_finish_error(aio, rv);
}
-static int
+static nng_err
ipc_dialer_get_remaddr(void *arg, void *buf, size_t *szp, nni_type t)
{
ipc_dialer *d = arg;
@@ -258,7 +258,7 @@ ipc_dialer_get_remaddr(void *arg, void *buf, size_t *szp, nni_type t)
}
#ifdef NNG_TEST_LIB
-static int
+static nng_err
ipc_dialer_set_test_no_connect(
void *arg, const void *buf, size_t sz, nni_type t)
{
@@ -289,14 +289,14 @@ static const nni_option ipc_dialer_options[] = {
},
};
-static int
+static nng_err
ipc_dialer_get(void *arg, const char *nm, void *buf, size_t *szp, nni_type t)
{
ipc_dialer *d = arg;
return (nni_getopt(ipc_dialer_options, nm, d, buf, szp, t));
}
-static int
+static nng_err
ipc_dialer_set(
void *arg, const char *nm, const void *buf, size_t sz, nni_type t)
{
diff --git a/src/platform/posix/posix_ipclisten.c b/src/platform/posix/posix_ipclisten.c
index c651b9ab..6254bf81 100644
--- a/src/platform/posix/posix_ipclisten.c
+++ b/src/platform/posix/posix_ipclisten.c
@@ -179,7 +179,7 @@ ipc_listener_cancel(nni_aio *aio, void *arg, nng_err rv)
nni_mtx_unlock(&l->mtx);
}
-static int
+static nng_err
ipc_remove_stale(const char *path)
{
int fd;
@@ -213,24 +213,24 @@ ipc_remove_stale(const char *path)
}
}
(void) close(fd);
- return (0);
+ return (NNG_OK);
}
-static int
+static nng_err
ipc_listener_get_addr(void *arg, void *buf, size_t *szp, nni_type t)
{
ipc_listener *l = arg;
return (nni_copyout_sockaddr(&l->sa, buf, szp, t));
}
-static int
+static nng_err
ipc_listener_set_perms(void *arg, const void *buf, size_t sz, nni_type t)
{
ipc_listener *l = arg;
int mode;
- int rv;
+ nng_err rv;
- if ((rv = nni_copyin_int(&mode, buf, sz, 0, S_IFMT, t)) != 0) {
+ if ((rv = nni_copyin_int(&mode, buf, sz, 0, S_IFMT, t)) != NNG_OK) {
return (rv);
}
if (l->sa.s_family == NNG_AF_ABSTRACT) {
@@ -249,10 +249,10 @@ ipc_listener_set_perms(void *arg, const void *buf, size_t sz, nni_type t)
}
l->perms = mode;
nni_mtx_unlock(&l->mtx);
- return (0);
+ return (NNG_OK);
}
-static int
+static nng_err
ipc_listener_set_listen_fd(void *arg, const void *buf, size_t sz, nni_type t)
{
ipc_listener *l = arg;
@@ -261,7 +261,7 @@ ipc_listener_set_listen_fd(void *arg, const void *buf, size_t sz, nni_type t)
socklen_t len = sizeof(ss);
int rv;
- if ((rv = nni_copyin_int(&fd, buf, sz, 0, NNI_MAXINT, t)) != 0) {
+ if ((rv = nni_copyin_int(&fd, buf, sz, 0, NNI_MAXINT, t)) != NNG_OK) {
return (rv);
}
@@ -286,15 +286,15 @@ ipc_listener_set_listen_fd(void *arg, const void *buf, size_t sz, nni_type t)
nni_posix_pfd_init(&l->pfd, fd, ipc_listener_cb, l);
l->started = true;
nni_mtx_unlock(&l->mtx);
- return (0);
+ return (NNG_OK);
}
#ifdef NNG_TEST_LIB
// this is readable only for test code -- user code should never rely on this
-static int
+static nng_err
ipc_listener_get_listen_fd(void *arg, void *buf, size_t *szp, nni_type t)
{
- int rv;
+ nng_err rv;
ipc_listener *l = arg;
nni_mtx_lock(&l->mtx);
@@ -327,7 +327,7 @@ static const nni_option ipc_listener_options[] = {
},
};
-static int
+static nng_err
ipc_listener_get(
void *arg, const char *name, void *buf, size_t *szp, nni_type t)
{
@@ -335,7 +335,7 @@ ipc_listener_get(
return (nni_getopt(ipc_listener_options, name, l, buf, szp, t));
}
-static int
+static nng_err
ipc_listener_set(
void *arg, const char *name, const void *buf, size_t sz, nni_type t)
{
diff --git a/src/platform/posix/posix_sockfd.c b/src/platform/posix/posix_sockfd.c
index a76ef85f..6762987b 100644
--- a/src/platform/posix/posix_sockfd.c
+++ b/src/platform/posix/posix_sockfd.c
@@ -327,7 +327,7 @@ sfd_recv(void *arg, nni_aio *aio)
nni_mtx_unlock(&c->mtx);
}
-static int
+static nng_err
sfd_get_addr(void *arg, void *buf, size_t *szp, nni_type t)
{
NNI_ARG_UNUSED(arg);
@@ -336,46 +336,46 @@ sfd_get_addr(void *arg, void *buf, size_t *szp, nni_type t)
return (nni_copyout_sockaddr(&sa, buf, szp, t));
}
-static int
+static nng_err
sfd_get_peer_uid(void *arg, void *buf, size_t *szp, nni_type t)
{
nni_sfd_conn *c = arg;
- int rv;
+ nng_err rv;
int ignore;
int id = 0;
rv = nni_posix_peerid(c->fd, &id, &ignore, &ignore, &ignore);
- if (rv != 0) {
+ if (rv != NNG_OK) {
return (rv);
}
return (nni_copyout_int(id, buf, szp, t));
}
-static int
+static nng_err
sfd_get_peer_gid(void *arg, void *buf, size_t *szp, nni_type t)
{
nni_sfd_conn *c = arg;
- int rv;
+ nng_err rv;
int ignore;
int id = 0;
rv = nni_posix_peerid(c->fd, &ignore, &id, &ignore, &ignore);
- if (rv != 0) {
+ if (rv != NNG_OK) {
return (rv);
}
return (nni_copyout_int(id, buf, szp, t));
}
-static int
+static nng_err
sfd_get_peer_zoneid(void *arg, void *buf, size_t *szp, nni_type t)
{
nni_sfd_conn *c = arg;
- int rv;
+ nng_err rv;
int ignore;
int id = 0;
rv = nni_posix_peerid(c->fd, &ignore, &ignore, &ignore, &id);
- if (rv != 0) {
+ if (rv != NNG_OK) {
return (rv);
}
if (id == -1) {
@@ -385,16 +385,16 @@ sfd_get_peer_zoneid(void *arg, void *buf, size_t *szp, nni_type t)
return (nni_copyout_int(id, buf, szp, t));
}
-static int
+static nng_err
sfd_get_peer_pid(void *arg, void *buf, size_t *szp, nni_type t)
{
nni_sfd_conn *c = arg;
- int rv;
+ nng_err rv;
int ignore;
int id = 0;
rv = nni_posix_peerid(c->fd, &ignore, &ignore, &id, &ignore);
- if (rv != 0) {
+ if (rv != NNG_OK) {
return (rv);
}
if (id == -1) {
@@ -434,14 +434,14 @@ static const nni_option sfd_options[] = {
},
};
-static int
+static nng_err
sfd_get(void *arg, const char *name, void *buf, size_t *szp, nni_type t)
{
nni_sfd_conn *c = arg;
return (nni_getopt(sfd_options, name, c, buf, szp, t));
}
-static int
+static nng_err
sfd_set(void *arg, const char *name, const void *buf, size_t sz, nni_type t)
{
nni_sfd_conn *c = arg;
diff --git a/src/platform/posix/posix_tcpconn.c b/src/platform/posix/posix_tcpconn.c
index 9b61a68e..674e3f46 100644
--- a/src/platform/posix/posix_tcpconn.c
+++ b/src/platform/posix/posix_tcpconn.c
@@ -332,26 +332,26 @@ tcp_recv(void *arg, nni_aio *aio)
nni_mtx_unlock(&c->mtx);
}
-static int
+static nng_err
tcp_get_peername(void *arg, void *buf, size_t *szp, nni_type t)
{
nni_tcp_conn *c = arg;
struct sockaddr_storage ss;
socklen_t len = sizeof(ss);
int fd = nni_posix_pfd_fd(&c->pfd);
- int rv;
+ nng_err rv;
nng_sockaddr sa;
if (getpeername(fd, (void *) &ss, &len) != 0) {
return (nni_plat_errno(errno));
}
- if ((rv = nni_posix_sockaddr2nn(&sa, &ss, len)) == 0) {
+ if ((rv = nni_posix_sockaddr2nn(&sa, &ss, len)) == NNG_OK) {
rv = nni_copyout_sockaddr(&sa, buf, szp, t);
}
return (rv);
}
-static int
+static nng_err
tcp_get_sockname(void *arg, void *buf, size_t *szp, nni_type t)
{
nni_tcp_conn *c = arg;
@@ -364,13 +364,13 @@ tcp_get_sockname(void *arg, void *buf, size_t *szp, nni_type t)
if (getsockname(fd, (void *) &ss, &len) != 0) {
return (nni_plat_errno(errno));
}
- if ((rv = nni_posix_sockaddr2nn(&sa, &ss, len)) == 0) {
+ if ((rv = nni_posix_sockaddr2nn(&sa, &ss, len)) == NNG_OK) {
rv = nni_copyout_sockaddr(&sa, buf, szp, t);
}
return (rv);
}
-static int
+static nng_err
tcp_get_nodelay(void *arg, void *buf, size_t *szp, nni_type t)
{
nni_tcp_conn *c = arg;
@@ -385,7 +385,7 @@ tcp_get_nodelay(void *arg, void *buf, size_t *szp, nni_type t)
return (nni_copyout_bool(val, buf, szp, t));
}
-static int
+static nng_err
tcp_get_keepalive(void *arg, void *buf, size_t *szp, nni_type t)
{
nni_tcp_conn *c = arg;
@@ -422,14 +422,14 @@ static const nni_option tcp_options[] = {
},
};
-static int
+static nng_err
tcp_get(void *arg, const char *name, void *buf, size_t *szp, nni_type t)
{
nni_tcp_conn *c = arg;
return (nni_getopt(tcp_options, name, c, buf, szp, t));
}
-static int
+static nng_err
tcp_set(void *arg, const char *name, const void *buf, size_t sz, nni_type t)
{
nni_tcp_conn *c = arg;
diff --git a/src/platform/posix/posix_tcpdial.c b/src/platform/posix/posix_tcpdial.c
index 52807892..181a667f 100644
--- a/src/platform/posix/posix_tcpdial.c
+++ b/src/platform/posix/posix_tcpdial.c
@@ -280,14 +280,15 @@ error:
nni_aio_finish_error(aio, rv);
}
-static int
+static nng_err
tcp_dialer_set_nodelay(void *arg, const void *buf, size_t sz, nni_type t)
{
nni_tcp_dialer *d = arg;
- int rv;
+ nng_err rv;
bool b;
- if (((rv = nni_copyin_bool(&b, buf, sz, t)) != 0) || (d == NULL)) {
+ if (((rv = nni_copyin_bool(&b, buf, sz, t)) != NNG_OK) ||
+ (d == NULL)) {
return (rv);
}
nni_mtx_lock(&d->mtx);
@@ -296,7 +297,7 @@ tcp_dialer_set_nodelay(void *arg, const void *buf, size_t sz, nni_type t)
return (0);
}
-static int
+static nng_err
tcp_dialer_get_nodelay(void *arg, void *buf, size_t *szp, nni_type t)
{
bool b;
@@ -307,14 +308,15 @@ tcp_dialer_get_nodelay(void *arg, void *buf, size_t *szp, nni_type t)
return (nni_copyout_bool(b, buf, szp, t));
}
-static int
+static nng_err
tcp_dialer_set_keepalive(void *arg, const void *buf, size_t sz, nni_type t)
{
nni_tcp_dialer *d = arg;
- int rv;
+ nng_err rv;
bool b;
- if (((rv = nni_copyin_bool(&b, buf, sz, t)) != 0) || (d == NULL)) {
+ if (((rv = nni_copyin_bool(&b, buf, sz, t)) != NNG_OK) ||
+ (d == NULL)) {
return (rv);
}
nni_mtx_lock(&d->mtx);
@@ -323,7 +325,7 @@ tcp_dialer_set_keepalive(void *arg, const void *buf, size_t sz, nni_type t)
return (0);
}
-static int
+static nng_err
tcp_dialer_get_keepalive(void *arg, void *buf, size_t *szp, nni_type t)
{
bool b;
@@ -334,7 +336,7 @@ tcp_dialer_get_keepalive(void *arg, void *buf, size_t *szp, nni_type t)
return (nni_copyout_bool(b, buf, szp, t));
}
-static int
+static nng_err
tcp_dialer_get_locaddr(void *arg, void *buf, size_t *szp, nni_type t)
{
nni_tcp_dialer *d = arg;
@@ -348,7 +350,7 @@ tcp_dialer_get_locaddr(void *arg, void *buf, size_t *szp, nni_type t)
return (nni_copyout_sockaddr(&sa, buf, szp, t));
}
-static int
+static nng_err
tcp_dialer_set_locaddr(void *arg, const void *buf, size_t sz, nni_type t)
{
nni_tcp_dialer *d = arg;
@@ -356,13 +358,13 @@ tcp_dialer_set_locaddr(void *arg, const void *buf, size_t sz, nni_type t)
struct sockaddr_storage ss;
struct sockaddr_in *sin;
size_t len;
- int rv;
+ nng_err rv;
#ifdef NNG_ENABLE_IPV6
struct sockaddr_in6 *sin6;
#endif
NNI_ARG_UNUSED(sz);
- if ((rv = nni_copyin_sockaddr(&sa, buf, t)) != 0) {
+ if ((rv = nni_copyin_sockaddr(&sa, buf, t)) != NNG_OK) {
return (rv);
}
if ((len = nni_posix_nn2sockaddr(&ss, &sa)) == 0) {
@@ -400,7 +402,7 @@ tcp_dialer_set_locaddr(void *arg, const void *buf, size_t sz, nni_type t)
d->srclen = len;
nni_mtx_unlock(&d->mtx);
}
- return (0);
+ return (NNG_OK);
}
static const nni_option tcp_dialer_options[] = {
diff --git a/src/platform/posix/posix_tcplisten.c b/src/platform/posix/posix_tcplisten.c
index 29255df2..508f4d1e 100644
--- a/src/platform/posix/posix_tcplisten.c
+++ b/src/platform/posix/posix_tcplisten.c
@@ -301,7 +301,7 @@ tcp_listener_accept(void *arg, nni_aio *aio)
nni_mtx_unlock(&l->mtx);
}
-static int
+static nng_err
tcp_listener_get_locaddr(void *arg, void *buf, size_t *szp, nni_type t)
{
tcp_listener *l = arg;
@@ -320,23 +320,24 @@ tcp_listener_get_locaddr(void *arg, void *buf, size_t *szp, nni_type t)
return (nni_copyout_sockaddr(&sa, buf, szp, t));
}
-static int
+static nng_err
tcp_listener_set_nodelay(void *arg, const void *buf, size_t sz, nni_type t)
{
tcp_listener *l = arg;
- int rv;
+ nng_err rv;
bool b;
- if (((rv = nni_copyin_bool(&b, buf, sz, t)) != 0) || (l == NULL)) {
+ if (((rv = nni_copyin_bool(&b, buf, sz, t)) != NNG_OK) ||
+ (l == NULL)) {
return (rv);
}
nni_mtx_lock(&l->mtx);
l->nodelay = b;
nni_mtx_unlock(&l->mtx);
- return (0);
+ return (NNG_OK);
}
-static int
+static nng_err
tcp_listener_get_nodelay(void *arg, void *buf, size_t *szp, nni_type t)
{
bool b;
@@ -347,23 +348,24 @@ tcp_listener_get_nodelay(void *arg, void *buf, size_t *szp, nni_type t)
return (nni_copyout_bool(b, buf, szp, t));
}
-static int
+static nng_err
tcp_listener_set_keepalive(void *arg, const void *buf, size_t sz, nni_type t)
{
tcp_listener *l = arg;
- int rv;
+ nng_err rv;
bool b;
- if (((rv = nni_copyin_bool(&b, buf, sz, t)) != 0) || (l == NULL)) {
+ if (((rv = nni_copyin_bool(&b, buf, sz, t)) != NNG_OK) ||
+ (l == NULL)) {
return (rv);
}
nni_mtx_lock(&l->mtx);
l->keepalive = b;
nni_mtx_unlock(&l->mtx);
- return (0);
+ return (NNG_OK);
}
-static int
+static nng_err
tcp_listener_get_keepalive(void *arg, void *buf, size_t *szp, nni_type t)
{
bool b;
@@ -374,7 +376,7 @@ tcp_listener_get_keepalive(void *arg, void *buf, size_t *szp, nni_type t)
return (nni_copyout_bool(b, buf, szp, t));
}
-static int
+static nng_err
tcp_listener_get_port(void *arg, void *buf, size_t *szp, nni_type t)
{
tcp_listener *l = arg;
@@ -403,16 +405,16 @@ tcp_listener_get_port(void *arg, void *buf, size_t *szp, nni_type t)
return (nni_copyout_int(port, buf, szp, t));
}
-static int
+static nng_err
tcp_listener_set_listen_fd(void *arg, const void *buf, size_t sz, nni_type t)
{
tcp_listener *l = arg;
int fd;
struct sockaddr_storage ss;
socklen_t len = sizeof(ss);
- int rv;
+ nng_err rv;
- if ((rv = nni_copyin_int(&fd, buf, sz, 0, NNI_MAXINT, t)) != 0) {
+ if ((rv = nni_copyin_int(&fd, buf, sz, 0, NNI_MAXINT, t)) != NNG_OK) {
return (rv);
}
@@ -442,15 +444,15 @@ tcp_listener_set_listen_fd(void *arg, const void *buf, size_t sz, nni_type t)
nni_posix_pfd_init(&l->pfd, fd, tcp_listener_cb, l);
l->started = true;
nni_mtx_unlock(&l->mtx);
- return (0);
+ return (NNG_OK);
}
#ifdef NNG_TEST_LIB
// this is readable only for test code -- user code should never rely on this
-static int
+static nng_err
tcp_listener_get_listen_fd(void *arg, void *buf, size_t *szp, nni_type t)
{
- int rv;
+ nng_err rv;
tcp_listener *l = arg;
nni_mtx_lock(&l->mtx);
NNI_ASSERT(l->started);
@@ -492,14 +494,14 @@ static const nni_option tcp_listener_options[] = {
},
};
-static int
+static nng_err
tcp_listener_get(
void *arg, const char *name, void *buf, size_t *szp, nni_type t)
{
return (nni_getopt(tcp_listener_options, name, arg, buf, szp, t));
}
-static int
+static nng_err
tcp_listener_set(
void *arg, const char *name, const void *buf, size_t sz, nni_type t)
{
diff --git a/src/platform/windows/win_ipcconn.c b/src/platform/windows/win_ipcconn.c
index 5493d32f..45235387 100644
--- a/src/platform/windows/win_ipcconn.c
+++ b/src/platform/windows/win_ipcconn.c
@@ -387,13 +387,13 @@ ipc_free(void *arg)
NNI_FREE_STRUCT(c);
}
-static int
+static nng_err
ipc_conn_get_addr(void *c, void *buf, size_t *szp, nni_opt_type t)
{
return (nni_copyout_sockaddr(&(CONN(c))->sa, buf, szp, t));
}
-static int
+static nng_err
ipc_conn_get_peer_pid(void *c, void *buf, size_t *szp, nni_opt_type t)
{
ULONG id;
@@ -431,14 +431,14 @@ static const nni_option ipc_conn_options[] = {
},
};
-static int
+static nng_err
ipc_set(void *arg, const char *nm, const void *val, size_t sz, nni_opt_type t)
{
ipc_conn *c = arg;
return (nni_setopt(ipc_conn_options, nm, c, val, sz, t));
}
-static int
+static nng_err
ipc_get(void *arg, const char *nm, void *val, size_t *szp, nni_opt_type t)
{
ipc_conn *c = arg;
diff --git a/src/platform/windows/win_ipcdial.c b/src/platform/windows/win_ipcdial.c
index ae42837c..04ee5829 100644
--- a/src/platform/windows/win_ipcdial.c
+++ b/src/platform/windows/win_ipcdial.c
@@ -205,7 +205,7 @@ ipc_dialer_free(void *arg)
NNI_FREE_STRUCT(d);
}
-static int
+static nng_err
ipc_dialer_get_remaddr(void *arg, void *buf, size_t *szp, nni_type t)
{
ipc_dialer *d = arg;
@@ -223,7 +223,7 @@ static const nni_option ipc_dialer_options[] = {
},
};
-static int
+static nng_err
ipc_dialer_set(
void *arg, const char *nm, const void *buf, size_t sz, nni_type t)
{
@@ -231,7 +231,7 @@ ipc_dialer_set(
return (nni_setopt(ipc_dialer_options, nm, d, buf, sz, t));
}
-static int
+static nng_err
ipc_dialer_get(void *arg, const char *nm, void *buf, size_t *szp, nni_type t)
{
ipc_dialer *d = arg;
diff --git a/src/platform/windows/win_ipclisten.c b/src/platform/windows/win_ipclisten.c
index e8670afe..3bb71c7d 100644
--- a/src/platform/windows/win_ipclisten.c
+++ b/src/platform/windows/win_ipclisten.c
@@ -139,7 +139,7 @@ ipc_accept_cb(nni_win_io *io, int rv, size_t cnt)
nni_mtx_unlock(&l->mtx);
}
-static int
+static nng_err
ipc_listener_set_sec_desc(void *arg, void *desc)
{
ipc_listener *l = arg;
@@ -155,7 +155,7 @@ ipc_listener_set_sec_desc(void *arg, void *desc)
}
l->sec_attr.lpSecurityDescriptor = desc;
nni_mtx_unlock(&l->mtx);
- return (0);
+ return (NNG_OK);
}
static int
diff --git a/src/platform/windows/win_tcpconn.c b/src/platform/windows/win_tcpconn.c
index e6d30b7a..102700ec 100644
--- a/src/platform/windows/win_tcpconn.c
+++ b/src/platform/windows/win_tcpconn.c
@@ -262,7 +262,7 @@ tcp_close(void *arg)
nni_mtx_unlock(&c->mtx);
}
-static int
+static nng_err
tcp_get_peername(void *arg, void *buf, size_t *szp, nni_type t)
{
nni_tcp_conn *c = arg;
@@ -274,7 +274,7 @@ tcp_get_peername(void *arg, void *buf, size_t *szp, nni_type t)
return (nni_copyout_sockaddr(&sa, buf, szp, t));
}
-static int
+static nng_err
tcp_get_sockname(void *arg, void *buf, size_t *szp, nni_type t)
{
nni_tcp_conn *c = arg;
@@ -286,7 +286,7 @@ tcp_get_sockname(void *arg, void *buf, size_t *szp, nni_type t)
return (nni_copyout_sockaddr(&sa, buf, szp, t));
}
-static int
+static nng_err
tcp_get_nodelay(void *arg, void *buf, size_t *szp, nni_type t)
{
nni_tcp_conn *c = arg;
@@ -300,7 +300,7 @@ tcp_get_nodelay(void *arg, void *buf, size_t *szp, nni_type t)
return (nni_copyout_bool(b, buf, szp, t));
}
-static int
+static nng_err
tcp_get_keepalive(void *arg, void *buf, size_t *szp, nni_type t)
{
nni_tcp_conn *c = arg;
diff --git a/src/platform/windows/win_tcpdial.c b/src/platform/windows/win_tcpdial.c
index 4d3771f2..72e4f8a7 100644
--- a/src/platform/windows/win_tcpdial.c
+++ b/src/platform/windows/win_tcpdial.c
@@ -246,14 +246,15 @@ nni_tcp_dial(nni_tcp_dialer *d, const nni_sockaddr *sa, nni_aio *aio)
nni_mtx_unlock(&d->mtx);
}
-static int
+static nng_err
tcp_dialer_set_nodelay(void *arg, const void *buf, size_t sz, nni_type t)
{
nni_tcp_dialer *d = arg;
- int rv;
+ nng_err rv;
bool b;
- if (((rv = nni_copyin_bool(&b, buf, sz, t)) != 0) || (d == NULL)) {
+ if (((rv = nni_copyin_bool(&b, buf, sz, t)) != NNG_OK) ||
+ (d == NULL)) {
return (rv);
}
nni_mtx_lock(&d->mtx);
@@ -262,7 +263,7 @@ tcp_dialer_set_nodelay(void *arg, const void *buf, size_t sz, nni_type t)
return (0);
}
-static int
+static nng_err
tcp_dialer_get_nodelay(void *arg, void *buf, size_t *szp, nni_type t)
{
bool b;
@@ -273,14 +274,15 @@ tcp_dialer_get_nodelay(void *arg, void *buf, size_t *szp, nni_type t)
return (nni_copyout_bool(b, buf, szp, t));
}
-static int
+static nng_err
tcp_dialer_set_keepalive(void *arg, const void *buf, size_t sz, nni_type t)
{
nni_tcp_dialer *d = arg;
- int rv;
+ nng_err rv;
bool b;
- if (((rv = nni_copyin_bool(&b, buf, sz, t)) != 0) || (d == NULL)) {
+ if (((rv = nni_copyin_bool(&b, buf, sz, t)) != NNG_OK) ||
+ (d == NULL)) {
return (rv);
}
nni_mtx_lock(&d->mtx);
@@ -289,7 +291,7 @@ tcp_dialer_set_keepalive(void *arg, const void *buf, size_t sz, nni_type t)
return (0);
}
-static int
+static nng_err
tcp_dialer_get_keepalive(void *arg, void *buf, size_t *szp, nni_type t)
{
bool b;
@@ -300,7 +302,7 @@ tcp_dialer_get_keepalive(void *arg, void *buf, size_t *szp, nni_type t)
return (nni_copyout_bool(b, buf, szp, t));
}
-static int
+static nng_err
tcp_dialer_get_locaddr(void *arg, void *buf, size_t *szp, nni_type t)
{
nni_tcp_dialer *d = arg;
@@ -314,7 +316,7 @@ tcp_dialer_get_locaddr(void *arg, void *buf, size_t *szp, nni_type t)
return (nni_copyout_sockaddr(&sa, buf, szp, t));
}
-static int
+static nng_err
tcp_dialer_set_locaddr(void *arg, const void *buf, size_t sz, nni_type t)
{
nni_tcp_dialer *d = arg;
@@ -322,13 +324,13 @@ tcp_dialer_set_locaddr(void *arg, const void *buf, size_t sz, nni_type t)
SOCKADDR_STORAGE ss;
struct sockaddr_in *sin;
size_t sslen;
- int rv;
+ nng_err rv;
#ifdef NNG_ENABLE_IPV6
struct sockaddr_in6 *sin6;
#endif
NNI_ARG_UNUSED(sz);
- if ((rv = nni_copyin_sockaddr(&sa, buf, t)) != 0) {
+ if ((rv = nni_copyin_sockaddr(&sa, buf, t)) != NNG_OK) {
return (rv);
}
if ((sslen = nni_win_nn2sockaddr(&ss, &sa)) == 0) {
@@ -364,7 +366,7 @@ tcp_dialer_set_locaddr(void *arg, const void *buf, size_t sz, nni_type t)
d->srclen = sslen;
nni_mtx_unlock(&d->mtx);
}
- return (0);
+ return (NNG_OK);
}
static const nni_option tcp_dialer_options[] = {
diff --git a/src/platform/windows/win_tcplisten.c b/src/platform/windows/win_tcplisten.c
index b92470ca..563cbcf0 100644
--- a/src/platform/windows/win_tcplisten.c
+++ b/src/platform/windows/win_tcplisten.c
@@ -330,7 +330,7 @@ tcp_listener_accept(void *arg, nni_aio *aio)
nni_mtx_unlock(&l->mtx);
}
-static int
+static nng_err
tcp_listener_get_locaddr(void *arg, void *buf, size_t *szp, nni_type t)
{
tcp_listener *l = arg;
@@ -345,14 +345,15 @@ tcp_listener_get_locaddr(void *arg, void *buf, size_t *szp, nni_type t)
return (nni_copyout_sockaddr(&sa, buf, szp, t));
}
-static int
+static nng_err
tcp_listener_set_nodelay(void *arg, const void *buf, size_t sz, nni_type t)
{
tcp_listener *l = arg;
- int rv;
+ nng_err rv;
bool b;
- if (((rv = nni_copyin_bool(&b, buf, sz, t)) != 0) || (l == NULL)) {
+ if (((rv = nni_copyin_bool(&b, buf, sz, t)) != NNG_OK) ||
+ (l == NULL)) {
return (rv);
}
nni_mtx_lock(&l->mtx);
@@ -361,7 +362,7 @@ tcp_listener_set_nodelay(void *arg, const void *buf, size_t sz, nni_type t)
return (0);
}
-static int
+static nng_err
tcp_listener_get_nodelay(void *arg, void *buf, size_t *szp, nni_type t)
{
bool b;
@@ -372,14 +373,15 @@ tcp_listener_get_nodelay(void *arg, void *buf, size_t *szp, nni_type t)
return (nni_copyout_bool(b, buf, szp, t));
}
-static int
+static nng_err
tcp_listener_set_keepalive(void *arg, const void *buf, size_t sz, nni_type t)
{
tcp_listener *l = arg;
- int rv;
+ nng_err rv;
bool b;
- if (((rv = nni_copyin_bool(&b, buf, sz, t)) != 0) || (l == NULL)) {
+ if (((rv = nni_copyin_bool(&b, buf, sz, t)) != NNG_OK) ||
+ (l == NULL)) {
return (rv);
}
nni_mtx_lock(&l->mtx);
@@ -388,7 +390,7 @@ tcp_listener_set_keepalive(void *arg, const void *buf, size_t sz, nni_type t)
return (0);
}
-static int
+static nng_err
tcp_listener_get_keepalive(void *arg, void *buf, size_t *szp, nni_type t)
{
bool b;
@@ -399,11 +401,10 @@ tcp_listener_get_keepalive(void *arg, void *buf, size_t *szp, nni_type t)
return (nni_copyout_bool(b, buf, szp, t));
}
-static int
+static nng_err
tcp_listener_get_port(void *arg, void *buf, size_t *szp, nni_type t)
{
tcp_listener *l = arg;
- int rv;
nng_sockaddr sa;
size_t sz;
int port;
@@ -429,16 +430,16 @@ tcp_listener_get_port(void *arg, void *buf, size_t *szp, nni_type t)
return (nni_copyout_int(port, buf, szp, t));
}
-static int
+static nng_err
tcp_listener_set_listen_fd(void *arg, const void *buf, size_t sz, nni_type t)
{
tcp_listener *l = arg;
int fd;
SOCKADDR_STORAGE ss;
int len = sizeof(ss);
- int rv;
+ nng_err rv;
- if ((rv = nni_copyin_int(&fd, buf, sz, 0, NNI_MAXINT, t)) != 0) {
+ if ((rv = nni_copyin_int(&fd, buf, sz, 0, NNI_MAXINT, t)) != NNG_OK) {
return (rv);
}
@@ -472,22 +473,22 @@ tcp_listener_set_listen_fd(void *arg, const void *buf, size_t sz, nni_type t)
l->ss = ss;
l->s = (SOCKET) fd;
- if ((rv = nni_win_io_register((HANDLE) l->s)) != 0) {
+ if ((rv = nni_win_io_register((HANDLE) l->s)) != NNG_OK) {
l->s = INVALID_SOCKET;
nni_mtx_unlock(&l->mtx);
return (rv);
}
l->started = true;
nni_mtx_unlock(&l->mtx);
- return (0);
+ return (NNG_OK);
}
#ifdef NNG_TEST_LIB
// this is readable only for test code -- user code should never rely on this
-static int
+static nng_err
tcp_listener_get_listen_fd(void *arg, void *buf, size_t *szp, nni_type t)
{
- int rv;
+ nng_err rv;
tcp_listener *l = arg;
nni_mtx_lock(&l->mtx);
NNI_ASSERT(l->started);
@@ -529,14 +530,14 @@ static const nni_option tcp_listener_options[] = {
},
};
-static int
+static nng_err
tcp_listener_get(
void *arg, const char *name, void *buf, size_t *szp, nni_type t)
{
return (nni_getopt(tcp_listener_options, name, arg, buf, szp, t));
}
-static int
+static nng_err
tcp_listener_set(
void *arg, const char *name, const void *buf, size_t sz, nni_type t)
{
diff --git a/src/sp/protocol/bus0/bus.c b/src/sp/protocol/bus0/bus.c
index 13abfd6b..4f946365 100644
--- a/src/sp/protocol/bus0/bus.c
+++ b/src/sp/protocol/bus0/bus.c
@@ -360,7 +360,7 @@ again:
nni_aio_finish(aio, 0, nni_msg_len(msg));
}
-static int
+static nng_err
bus0_sock_get_send_fd(void *arg, int *fdp)
{
bus0_sock *sock = arg;
@@ -369,7 +369,7 @@ bus0_sock_get_send_fd(void *arg, int *fdp)
return (nni_pollable_getfd(&sock->can_send, fdp));
}
-static int
+static nng_err
bus0_sock_get_recv_fd(void *arg, int *fdp)
{
bus0_sock *s = arg;
@@ -377,7 +377,7 @@ bus0_sock_get_recv_fd(void *arg, int *fdp)
return (nni_pollable_getfd(&s->can_recv, fdp));
}
-static int
+static nng_err
bus0_sock_get_recv_buf_len(void *arg, void *buf, size_t *szp, nni_type t)
{
bus0_sock *s = arg;
@@ -389,7 +389,7 @@ bus0_sock_get_recv_buf_len(void *arg, void *buf, size_t *szp, nni_type t)
return (nni_copyout_int(val, buf, szp, t));
}
-static int
+static nng_err
bus0_sock_get_send_buf_len(void *arg, void *buf, size_t *szp, nni_type t)
{
bus0_sock *s = arg;
@@ -400,14 +400,14 @@ bus0_sock_get_send_buf_len(void *arg, void *buf, size_t *szp, nni_type t)
return (nni_copyout_int(val, buf, szp, t));
}
-static int
+static nng_err
bus0_sock_set_recv_buf_len(void *arg, const void *buf, size_t sz, nni_type t)
{
bus0_sock *s = arg;
int val;
- int rv;
+ nng_err rv;
- if ((rv = nni_copyin_int(&val, buf, sz, 1, 8192, t)) != 0) {
+ if ((rv = nni_copyin_int(&val, buf, sz, 1, 8192, t)) != NNG_OK) {
return (rv);
}
nni_mtx_lock(&s->mtx);
@@ -417,18 +417,18 @@ bus0_sock_set_recv_buf_len(void *arg, const void *buf, size_t sz, nni_type t)
}
nni_mtx_unlock(&s->mtx);
- return (0);
+ return (NNG_OK);
}
-static int
+static nng_err
bus0_sock_set_send_buf_len(void *arg, const void *buf, size_t sz, nni_type t)
{
bus0_sock *s = arg;
bus0_pipe *p;
int val;
- int rv;
+ nng_err rv;
- if ((rv = nni_copyin_int(&val, buf, sz, 1, 8192, t)) != 0) {
+ if ((rv = nni_copyin_int(&val, buf, sz, 1, 8192, t)) != NNG_OK) {
return (rv);
}
diff --git a/src/sp/protocol/pair0/pair.c b/src/sp/protocol/pair0/pair.c
index 5dc7f67a..89bff7ce 100644
--- a/src/sp/protocol/pair0/pair.c
+++ b/src/sp/protocol/pair0/pair.c
@@ -430,14 +430,14 @@ pair0_sock_recv(void *arg, nni_aio *aio)
nni_mtx_unlock(&s->mtx);
}
-static int
+static nng_err
pair0_set_send_buf_len(void *arg, const void *buf, size_t sz, nni_type t)
{
pair0_sock *s = arg;
int val;
- int rv;
+ nng_err rv;
- if ((rv = nni_copyin_int(&val, buf, sz, 0, 8192, t)) != 0) {
+ if ((rv = nni_copyin_int(&val, buf, sz, 0, 8192, t)) != NNG_OK) {
return (rv);
}
nni_mtx_lock(&s->mtx);
@@ -452,7 +452,7 @@ pair0_set_send_buf_len(void *arg, const void *buf, size_t sz, nni_type t)
return (rv);
}
-static int
+static nng_err
pair0_get_send_buf_len(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
pair0_sock *s = arg;
@@ -465,14 +465,14 @@ pair0_get_send_buf_len(void *arg, void *buf, size_t *szp, nni_opt_type t)
return (nni_copyout_int(val, buf, szp, t));
}
-static int
+static nng_err
pair0_set_recv_buf_len(void *arg, const void *buf, size_t sz, nni_type t)
{
pair0_sock *s = arg;
int val;
- int rv;
+ nng_err rv;
- if ((rv = nni_copyin_int(&val, buf, sz, 0, 8192, t)) != 0) {
+ if ((rv = nni_copyin_int(&val, buf, sz, 0, 8192, t)) != NNG_OK) {
return (rv);
}
nni_mtx_lock(&s->mtx);
@@ -487,7 +487,7 @@ pair0_set_recv_buf_len(void *arg, const void *buf, size_t sz, nni_type t)
return (rv);
}
-static int
+static nng_err
pair0_get_recv_buf_len(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
pair0_sock *s = arg;
@@ -500,7 +500,7 @@ pair0_get_recv_buf_len(void *arg, void *buf, size_t *szp, nni_opt_type t)
return (nni_copyout_int(val, buf, szp, t));
}
-static int
+static nng_err
pair0_sock_get_recv_fd(void *arg, int *fdp)
{
pair0_sock *s = arg;
@@ -508,7 +508,7 @@ pair0_sock_get_recv_fd(void *arg, int *fdp)
return (nni_pollable_getfd(&s->readable, fdp));
}
-static int
+static nng_err
pair0_sock_get_send_fd(void *arg, int *fdp)
{
pair0_sock *s = arg;
diff --git a/src/sp/protocol/pair1/pair.c b/src/sp/protocol/pair1/pair.c
index 35e87b7b..3aa9b4c7 100644
--- a/src/sp/protocol/pair1/pair.c
+++ b/src/sp/protocol/pair1/pair.c
@@ -467,21 +467,22 @@ pair1_sock_close(void *arg)
nni_mtx_unlock(&s->mtx);
}
-static int
+static nng_err
pair1_sock_set_max_ttl(void *arg, const void *buf, size_t sz, nni_opt_type t)
{
pair1_sock *s = arg;
- int rv;
+ nng_err rv;
int ttl;
- if ((rv = nni_copyin_int(&ttl, buf, sz, 1, NNI_MAX_MAX_TTL, t)) == 0) {
+ if ((rv = nni_copyin_int(&ttl, buf, sz, 1, NNI_MAX_MAX_TTL, t)) ==
+ NNG_OK) {
nni_atomic_set(&s->ttl, ttl);
}
return (rv);
}
-static int
+static nng_err
pair1_sock_get_max_ttl(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
pair1_sock *s = arg;
@@ -489,11 +490,11 @@ pair1_sock_get_max_ttl(void *arg, void *buf, size_t *szp, nni_opt_type t)
}
#ifdef NNG_TEST_LIB
-static int
+static nng_err
pair1_set_test_inject_header(void *arg, const void *buf, size_t sz, nni_type t)
{
pair1_sock *s = arg;
- int rv;
+ nng_err rv;
nni_mtx_lock(&s->mtx);
rv = nni_copyin_bool(&s->inject_header, buf, sz, t);
nni_mtx_unlock(&s->mtx);
@@ -646,14 +647,14 @@ pair1_sock_recv(void *arg, nni_aio *aio)
nni_mtx_unlock(&s->mtx);
}
-static int
+static nng_err
pair1_set_send_buf_len(void *arg, const void *buf, size_t sz, nni_type t)
{
pair1_sock *s = arg;
int val;
- int rv;
+ nng_err rv;
- if ((rv = nni_copyin_int(&val, buf, sz, 0, 8192, t)) != 0) {
+ if ((rv = nni_copyin_int(&val, buf, sz, 0, 8192, t)) != NNG_OK) {
return (rv);
}
nni_mtx_lock(&s->mtx);
@@ -668,7 +669,7 @@ pair1_set_send_buf_len(void *arg, const void *buf, size_t sz, nni_type t)
return (rv);
}
-static int
+static nng_err
pair1_get_send_buf_len(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
pair1_sock *s = arg;
@@ -681,14 +682,14 @@ pair1_get_send_buf_len(void *arg, void *buf, size_t *szp, nni_opt_type t)
return (nni_copyout_int(val, buf, szp, t));
}
-static int
+static nng_err
pair1_set_recv_buf_len(void *arg, const void *buf, size_t sz, nni_type t)
{
pair1_sock *s = arg;
int val;
- int rv;
+ nng_err rv;
- if ((rv = nni_copyin_int(&val, buf, sz, 0, 8192, t)) != 0) {
+ if ((rv = nni_copyin_int(&val, buf, sz, 0, 8192, t)) != NNG_OK) {
return (rv);
}
nni_mtx_lock(&s->mtx);
@@ -703,7 +704,7 @@ pair1_set_recv_buf_len(void *arg, const void *buf, size_t sz, nni_type t)
return (rv);
}
-static int
+static nng_err
pair1_get_recv_buf_len(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
pair1_sock *s = arg;
@@ -716,7 +717,7 @@ pair1_get_recv_buf_len(void *arg, void *buf, size_t *szp, nni_opt_type t)
return (nni_copyout_int(val, buf, szp, t));
}
-static int
+static nng_err
pair1_sock_get_recv_fd(void *arg, int *fdp)
{
pair1_sock *s = arg;
@@ -724,7 +725,7 @@ pair1_sock_get_recv_fd(void *arg, int *fdp)
return (nni_pollable_getfd(&s->readable, fdp));
}
-static int
+static nng_err
pair1_sock_get_send_fd(void *arg, int *fdp)
{
pair1_sock *s = arg;
diff --git a/src/sp/protocol/pair1/pair1_poly.c b/src/sp/protocol/pair1/pair1_poly.c
index 0e8a93f3..af3ede3b 100644
--- a/src/sp/protocol/pair1/pair1_poly.c
+++ b/src/sp/protocol/pair1/pair1_poly.c
@@ -443,28 +443,29 @@ pair1poly_sock_close(void *arg)
nni_aio_close(&s->aio_get);
}
-static int
+static nng_err
pair1poly_set_max_ttl(void *arg, const void *buf, size_t sz, nni_opt_type t)
{
pair1poly_sock *s = arg;
- int rv;
+ nng_err rv;
int ttl;
- if ((rv = nni_copyin_int(&ttl, buf, sz, 1, NNI_MAX_MAX_TTL, t)) == 0) {
+ if ((rv = nni_copyin_int(&ttl, buf, sz, 1, NNI_MAX_MAX_TTL, t)) ==
+ NNG_OK) {
nni_atomic_set(&s->ttl, ttl);
}
return (rv);
}
-static int
+static nng_err
pair1poly_get_max_ttl(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
pair1poly_sock *s = arg;
return (nni_copyout_int(nni_atomic_get(&s->ttl), buf, szp, t));
}
-static int
+static nng_err
pair1poly_get_poly(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
NNI_ARG_UNUSED(arg);
diff --git a/src/sp/protocol/pipeline0/pull.c b/src/sp/protocol/pipeline0/pull.c
index d808180a..559935b0 100644
--- a/src/sp/protocol/pipeline0/pull.c
+++ b/src/sp/protocol/pipeline0/pull.c
@@ -245,7 +245,7 @@ pull0_sock_recv(void *arg, nni_aio *aio)
nni_mtx_unlock(&s->m);
}
-static int
+static nng_err
pull0_sock_get_recv_fd(void *arg, int *fdp)
{
pull0_sock *s = arg;
diff --git a/src/sp/protocol/pipeline0/push.c b/src/sp/protocol/pipeline0/push.c
index 4260f333..cd710480 100644
--- a/src/sp/protocol/pipeline0/push.c
+++ b/src/sp/protocol/pipeline0/push.c
@@ -321,14 +321,14 @@ push0_sock_recv(void *arg, nni_aio *aio)
nni_aio_finish_error(aio, NNG_ENOTSUP);
}
-static int
+static nng_err
push0_set_send_buf_len(void *arg, const void *buf, size_t sz, nni_type t)
{
push0_sock *s = arg;
int val;
- int rv;
+ nng_err rv;
- if ((rv = nni_copyin_int(&val, buf, sz, 0, 8192, t)) != 0) {
+ if ((rv = nni_copyin_int(&val, buf, sz, 0, 8192, t)) != NNG_OK) {
return (rv);
}
nni_mtx_lock(&s->m);
@@ -343,7 +343,7 @@ push0_set_send_buf_len(void *arg, const void *buf, size_t sz, nni_type t)
return (rv);
}
-static int
+static nng_err
push0_get_send_buf_len(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
push0_sock *s = arg;
@@ -356,7 +356,7 @@ push0_get_send_buf_len(void *arg, void *buf, size_t *szp, nni_opt_type t)
return (nni_copyout_int(val, buf, szp, t));
}
-static int
+static nng_err
push0_sock_get_send_fd(void *arg, int *fdp)
{
push0_sock *s = arg;
diff --git a/src/sp/protocol/pubsub0/pub.c b/src/sp/protocol/pubsub0/pub.c
index db449cde..5104162b 100644
--- a/src/sp/protocol/pubsub0/pub.c
+++ b/src/sp/protocol/pubsub0/pub.c
@@ -249,7 +249,7 @@ pub0_sock_send(void *arg, nni_aio *aio)
nni_aio_finish(aio, 0, len);
}
-static int
+static nng_err
pub0_sock_get_sendfd(void *arg, int *fdp)
{
pub0_sock *sock = arg;
@@ -259,15 +259,15 @@ pub0_sock_get_sendfd(void *arg, int *fdp)
return (nni_pollable_getfd(&sock->sendable, fdp));
}
-static int
+static nng_err
pub0_sock_set_sendbuf(void *arg, const void *buf, size_t sz, nni_type t)
{
pub0_sock *sock = arg;
pub0_pipe *p;
int val;
- int rv;
+ nng_err rv;
- if ((rv = nni_copyin_int(&val, buf, sz, 1, 8192, t)) != 0) {
+ if ((rv = nni_copyin_int(&val, buf, sz, 1, 8192, t)) != NNG_OK) {
return (rv);
}
@@ -287,7 +287,7 @@ pub0_sock_set_sendbuf(void *arg, const void *buf, size_t sz, nni_type t)
return (rv);
}
-static int
+static nng_err
pub0_sock_get_sendbuf(void *arg, void *buf, size_t *szp, nni_type t)
{
pub0_sock *sock = arg;
diff --git a/src/sp/protocol/pubsub0/sub.c b/src/sp/protocol/pubsub0/sub.c
index 6744e909..c426d46c 100644
--- a/src/sp/protocol/pubsub0/sub.c
+++ b/src/sp/protocol/pubsub0/sub.c
@@ -400,7 +400,7 @@ sub0_recv_cb(void *arg)
nni_pipe_recv(p->pipe, &p->aio_recv);
}
-static int
+static nng_err
sub0_ctx_get_recv_buf_len(void *arg, void *buf, size_t *szp, nni_type t)
{
sub0_ctx *ctx = arg;
@@ -413,15 +413,15 @@ sub0_ctx_get_recv_buf_len(void *arg, void *buf, size_t *szp, nni_type t)
return (nni_copyout_int(val, buf, szp, t));
}
-static int
+static nng_err
sub0_ctx_set_recv_buf_len(void *arg, const void *buf, size_t sz, nni_type t)
{
sub0_ctx *ctx = arg;
sub0_sock *sock = ctx->sock;
int val;
- int rv;
+ nng_err rv;
- if ((rv = nni_copyin_int(&val, buf, sz, 1, 8192, t)) != 0) {
+ if ((rv = nni_copyin_int(&val, buf, sz, 1, 8192, t)) != NNG_OK) {
return (rv);
}
nni_mtx_lock(&sock->lk);
@@ -436,7 +436,7 @@ sub0_ctx_set_recv_buf_len(void *arg, const void *buf, size_t sz, nni_type t)
sock->recv_buf_len = (size_t) val;
}
nni_mtx_unlock(&sock->lk);
- return (0);
+ return (NNG_OK);
}
// For now, we maintain subscriptions on a sorted linked list. As we do not
@@ -444,7 +444,7 @@ sub0_ctx_set_recv_buf_len(void *arg, const void *buf, size_t sz, nni_type t)
// really O(n), we think this is acceptable. In the future we might decide
// to replace this with a patricia trie, like old nanomsg had.
-static int
+static nng_err
sub0_ctx_subscribe(sub0_ctx *ctx, const void *buf, size_t sz)
{
sub0_sock *sock = ctx->sock;
@@ -459,7 +459,7 @@ sub0_ctx_subscribe(sub0_ctx *ctx, const void *buf, size_t sz)
if (memcmp(topic->buf, buf, sz) == 0) {
// Already have it.
nni_mtx_unlock(&sock->lk);
- return (0);
+ return (NNG_OK);
}
}
if ((new_topic = NNI_ALLOC_STRUCT(new_topic)) == NULL) {
@@ -477,10 +477,10 @@ sub0_ctx_subscribe(sub0_ctx *ctx, const void *buf, size_t sz)
new_topic->len = sz;
nni_list_append(&ctx->topics, new_topic);
nni_mtx_unlock(&sock->lk);
- return (0);
+ return (NNG_OK);
}
-static int
+static nng_err
sub0_ctx_unsubscribe(sub0_ctx *ctx, const void *buf, size_t sz)
{
sub0_sock *sock = ctx->sock;
@@ -521,10 +521,10 @@ sub0_ctx_unsubscribe(sub0_ctx *ctx, const void *buf, size_t sz)
nni_free(topic->buf, topic->len);
NNI_FREE_STRUCT(topic);
- return (0);
+ return (NNG_OK);
}
-static int
+static nng_err
sub0_ctx_get_prefer_new(void *arg, void *buf, size_t *szp, nni_type t)
{
sub0_ctx *ctx = arg;
@@ -538,15 +538,15 @@ sub0_ctx_get_prefer_new(void *arg, void *buf, size_t *szp, nni_type t)
return (nni_copyout_bool(val, buf, szp, t));
}
-static int
+static nng_err
sub0_ctx_set_prefer_new(void *arg, const void *buf, size_t sz, nni_type t)
{
sub0_ctx *ctx = arg;
sub0_sock *sock = ctx->sock;
bool val;
- int rv;
+ nng_err rv;
- if ((rv = nni_copyin_bool(&val, buf, sz, t)) != 0) {
+ if ((rv = nni_copyin_bool(&val, buf, sz, t)) != NNG_OK) {
return (rv);
}
@@ -557,7 +557,7 @@ sub0_ctx_set_prefer_new(void *arg, const void *buf, size_t sz, nni_type t)
}
nni_mtx_unlock(&sock->lk);
- return (0);
+ return (NNG_OK);
}
static nni_option sub0_ctx_options[] = {
@@ -591,7 +591,7 @@ sub0_sock_recv(void *arg, nni_aio *aio)
sub0_ctx_recv(&sock->master, aio);
}
-static int
+static nng_err
sub0_sock_get_recv_fd(void *arg, int *fdp)
{
sub0_sock *sock = arg;
@@ -599,28 +599,28 @@ sub0_sock_get_recv_fd(void *arg, int *fdp)
return (nni_pollable_getfd(&sock->readable, fdp));
}
-static int
+static nng_err
sub0_sock_get_recv_buf_len(void *arg, void *buf, size_t *szp, nni_type t)
{
sub0_sock *sock = arg;
return (sub0_ctx_get_recv_buf_len(&sock->master, buf, szp, t));
}
-static int
+static nng_err
sub0_sock_set_recv_buf_len(void *arg, const void *buf, size_t sz, nni_type t)
{
sub0_sock *sock = arg;
return (sub0_ctx_set_recv_buf_len(&sock->master, buf, sz, t));
}
-static int
+static nng_err
sub0_sock_get_prefer_new(void *arg, void *buf, size_t *szp, nni_type t)
{
sub0_sock *sock = arg;
return (sub0_ctx_get_prefer_new(&sock->master, buf, szp, t));
}
-static int
+static nng_err
sub0_sock_set_prefer_new(void *arg, const void *buf, size_t sz, nni_type t)
{
sub0_sock *sock = arg;
diff --git a/src/sp/protocol/reqrep0/rep.c b/src/sp/protocol/reqrep0/rep.c
index e84440a7..6df65df3 100644
--- a/src/sp/protocol/reqrep0/rep.c
+++ b/src/sp/protocol/reqrep0/rep.c
@@ -567,20 +567,21 @@ drop:
nni_pipe_recv(p->pipe, &p->aio_recv);
}
-static int
+static nng_err
rep0_sock_set_max_ttl(void *arg, const void *buf, size_t sz, nni_opt_type t)
{
rep0_sock *s = arg;
int ttl;
- int rv;
+ nng_err rv;
- if ((rv = nni_copyin_int(&ttl, buf, sz, 1, NNI_MAX_MAX_TTL, t)) == 0) {
+ if ((rv = nni_copyin_int(&ttl, buf, sz, 1, NNI_MAX_MAX_TTL, t)) ==
+ NNG_OK) {
nni_atomic_set(&s->ttl, ttl);
}
return (rv);
}
-static int
+static nng_err
rep0_sock_get_max_ttl(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
rep0_sock *s = arg;
@@ -588,7 +589,7 @@ rep0_sock_get_max_ttl(void *arg, void *buf, size_t *szp, nni_opt_type t)
return (nni_copyout_int(nni_atomic_get(&s->ttl), buf, szp, t));
}
-static int
+static nng_err
rep0_sock_get_sendfd(void *arg, int *fdp)
{
rep0_sock *s = arg;
@@ -596,7 +597,7 @@ rep0_sock_get_sendfd(void *arg, int *fdp)
return (nni_pollable_getfd(&s->writable, fdp));
}
-static int
+static nng_err
rep0_sock_get_recvfd(void *arg, int *fdp)
{
rep0_sock *s = arg;
diff --git a/src/sp/protocol/reqrep0/req.c b/src/sp/protocol/reqrep0/req.c
index 52f97d3a..85c2dfa4 100644
--- a/src/sp/protocol/reqrep0/req.c
+++ b/src/sp/protocol/reqrep0/req.c
@@ -465,14 +465,14 @@ req0_ctx_fini(void *arg)
nni_mtx_unlock(&s->mtx);
}
-static int
+static nng_err
req0_ctx_set_resend_time(void *arg, const void *buf, size_t sz, nni_opt_type t)
{
req0_ctx *ctx = arg;
return (nni_copyin_ms(&ctx->retry, buf, sz, t));
}
-static int
+static nng_err
req0_ctx_get_resend_time(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
req0_ctx *ctx = arg;
@@ -777,52 +777,53 @@ req0_sock_recv(void *arg, nni_aio *aio)
req0_ctx_recv(&s->master, aio);
}
-static int
+static nng_err
req0_sock_set_max_ttl(void *arg, const void *buf, size_t sz, nni_opt_type t)
{
req0_sock *s = arg;
int ttl;
- int rv;
- if ((rv = nni_copyin_int(&ttl, buf, sz, 1, NNI_MAX_MAX_TTL, t)) == 0) {
+ nng_err rv;
+ if ((rv = nni_copyin_int(&ttl, buf, sz, 1, NNI_MAX_MAX_TTL, t)) ==
+ NNG_OK) {
nni_atomic_set(&s->ttl, ttl);
}
return (rv);
}
-static int
+static nng_err
req0_sock_get_max_ttl(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
req0_sock *s = arg;
return (nni_copyout_int(nni_atomic_get(&s->ttl), buf, szp, t));
}
-static int
+static nng_err
req0_sock_set_resend_time(
void *arg, const void *buf, size_t sz, nni_opt_type t)
{
req0_sock *s = arg;
- int rv;
+ nng_err rv;
rv = req0_ctx_set_resend_time(&s->master, buf, sz, t);
s->retry = s->master.retry;
return (rv);
}
-static int
+static nng_err
req0_sock_get_resend_time(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
req0_sock *s = arg;
return (req0_ctx_get_resend_time(&s->master, buf, szp, t));
}
-static int
+static nng_err
req0_sock_set_resend_tick(
void *arg, const void *buf, size_t sz, nni_opt_type t)
{
req0_sock *s = arg;
nng_duration tick;
- int rv;
+ nng_err rv;
- if ((rv = nni_copyin_ms(&tick, buf, sz, t)) == 0) {
+ if ((rv = nni_copyin_ms(&tick, buf, sz, t)) == NNG_OK) {
nni_mtx_lock(&s->mtx);
s->retry_tick = tick;
nni_mtx_unlock(&s->mtx);
@@ -830,7 +831,7 @@ req0_sock_set_resend_tick(
return (rv);
}
-static int
+static nng_err
req0_sock_get_resend_tick(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
req0_sock *s = arg;
@@ -842,7 +843,7 @@ req0_sock_get_resend_tick(void *arg, void *buf, size_t *szp, nni_opt_type t)
return (nni_copyout_ms(tick, buf, szp, t));
}
-static int
+static nng_err
req0_sock_get_send_fd(void *arg, int *fdp)
{
req0_sock *s = arg;
@@ -850,7 +851,7 @@ req0_sock_get_send_fd(void *arg, int *fdp)
return (nni_pollable_getfd(&s->writable, fdp));
}
-static int
+static nng_err
req0_sock_get_recv_fd(void *arg, int *fdp)
{
req0_sock *s = arg;
diff --git a/src/sp/protocol/reqrep0/xrep.c b/src/sp/protocol/reqrep0/xrep.c
index 1a5f6e24..fe6c9fde 100644
--- a/src/sp/protocol/reqrep0/xrep.c
+++ b/src/sp/protocol/reqrep0/xrep.c
@@ -353,19 +353,20 @@ xrep0_pipe_putq_cb(void *arg)
nni_pipe_recv(p->pipe, &p->aio_recv);
}
-static int
+static nng_err
xrep0_sock_set_maxttl(void *arg, const void *buf, size_t sz, nni_opt_type t)
{
xrep0_sock *s = arg;
int ttl;
- int rv;
- if ((rv = nni_copyin_int(&ttl, buf, sz, 1, NNI_MAX_MAX_TTL, t)) == 0) {
+ nng_err rv;
+ if ((rv = nni_copyin_int(&ttl, buf, sz, 1, NNI_MAX_MAX_TTL, t)) ==
+ NNG_OK) {
nni_atomic_set(&s->ttl, ttl);
}
return (rv);
}
-static int
+static nng_err
xrep0_sock_get_maxttl(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
xrep0_sock *s = arg;
diff --git a/src/sp/protocol/reqrep0/xreq.c b/src/sp/protocol/reqrep0/xreq.c
index 2bf3b95e..f80391dd 100644
--- a/src/sp/protocol/reqrep0/xreq.c
+++ b/src/sp/protocol/reqrep0/xreq.c
@@ -256,19 +256,20 @@ xreq0_sock_recv(void *arg, nni_aio *aio)
nni_msgq_aio_get(s->urq, aio);
}
-static int
+static nng_err
xreq0_sock_set_max_ttl(void *arg, const void *buf, size_t sz, nni_opt_type t)
{
xreq0_sock *s = arg;
int ttl;
- int rv;
- if ((rv = nni_copyin_int(&ttl, buf, sz, 1, NNI_MAX_MAX_TTL, t)) == 0) {
+ nng_err rv;
+ if ((rv = nni_copyin_int(&ttl, buf, sz, 1, NNI_MAX_MAX_TTL, t)) ==
+ NNG_OK) {
nni_atomic_set(&s->ttl, ttl);
}
return (rv);
}
-static int
+static nng_err
xreq0_sock_get_max_ttl(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
xreq0_sock *s = arg;
diff --git a/src/sp/protocol/survey0/respond.c b/src/sp/protocol/survey0/respond.c
index ace2962a..f50ccb6b 100644
--- a/src/sp/protocol/survey0/respond.c
+++ b/src/sp/protocol/survey0/respond.c
@@ -557,27 +557,28 @@ drop:
nni_pipe_recv(p->npipe, &p->aio_recv);
}
-static int
+static nng_err
resp0_sock_set_max_ttl(void *arg, const void *buf, size_t sz, nni_opt_type t)
{
resp0_sock *s = arg;
int ttl;
- int rv;
+ nng_err rv;
- if ((rv = nni_copyin_int(&ttl, buf, sz, 1, NNI_MAX_MAX_TTL, t)) == 0) {
+ if ((rv = nni_copyin_int(&ttl, buf, sz, 1, NNI_MAX_MAX_TTL, t)) ==
+ NNG_OK) {
nni_atomic_set(&s->ttl, ttl);
}
return (rv);
}
-static int
+static nng_err
resp0_sock_get_max_ttl(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
resp0_sock *s = arg;
return (nni_copyout_int(nni_atomic_get(&s->ttl), buf, szp, t));
}
-static int
+static nng_err
resp0_sock_get_sendfd(void *arg, int *fdp)
{
resp0_sock *s = arg;
@@ -585,7 +586,7 @@ resp0_sock_get_sendfd(void *arg, int *fdp)
return (nni_pollable_getfd(&s->writable, fdp));
}
-static int
+static nng_err
resp0_sock_get_recvfd(void *arg, int *fdp)
{
resp0_sock *s = arg;
diff --git a/src/sp/protocol/survey0/survey.c b/src/sp/protocol/survey0/survey.c
index c64f0bb0..716375a9 100644
--- a/src/sp/protocol/survey0/survey.c
+++ b/src/sp/protocol/survey0/survey.c
@@ -462,20 +462,20 @@ surv0_pipe_recv_cb(void *arg)
nni_pipe_recv(p->pipe, &p->aio_recv);
}
-static int
+static nng_err
surv0_ctx_set_survey_time(
void *arg, const void *buf, size_t sz, nni_opt_type t)
{
surv0_ctx *ctx = arg;
nng_duration expire;
- int rv;
- if ((rv = nni_copyin_ms(&expire, buf, sz, t)) == 0) {
+ nng_err rv;
+ if ((rv = nni_copyin_ms(&expire, buf, sz, t)) == NNG_OK) {
nni_atomic_set(&ctx->survey_time, expire);
}
return (rv);
}
-static int
+static nng_err
surv0_ctx_get_survey_time(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
surv0_ctx *ctx = arg;
@@ -483,21 +483,21 @@ surv0_ctx_get_survey_time(void *arg, void *buf, size_t *szp, nni_opt_type t)
nni_copyout_ms(nni_atomic_get(&ctx->survey_time), buf, szp, t));
}
-static int
+static nng_err
surv0_sock_set_max_ttl(void *arg, const void *buf, size_t sz, nni_opt_type t)
{
surv0_sock *s = arg;
return (nni_copyin_int(&s->ttl, buf, sz, 1, NNI_MAX_MAX_TTL, t));
}
-static int
+static nng_err
surv0_sock_get_max_ttl(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
surv0_sock *s = arg;
return (nni_copyout_int(s->ttl, buf, szp, t));
}
-static int
+static nng_err
surv0_sock_set_survey_time(
void *arg, const void *buf, size_t sz, nni_opt_type t)
{
@@ -505,14 +505,14 @@ surv0_sock_set_survey_time(
return (surv0_ctx_set_survey_time(&s->ctx, buf, sz, t));
}
-static int
+static nng_err
surv0_sock_get_survey_time(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
surv0_sock *s = arg;
return (surv0_ctx_get_survey_time(&s->ctx, buf, szp, t));
}
-static int
+static nng_err
surv0_sock_get_send_fd(void *arg, int *fdp)
{
surv0_sock *sock = arg;
@@ -520,7 +520,7 @@ surv0_sock_get_send_fd(void *arg, int *fdp)
return (nni_pollable_getfd(&sock->writable, fdp));
}
-static int
+static nng_err
surv0_sock_get_recv_fd(void *arg, int *fdp)
{
surv0_sock *sock = arg;
diff --git a/src/sp/protocol/survey0/xrespond.c b/src/sp/protocol/survey0/xrespond.c
index ceddc118..0e04b516 100644
--- a/src/sp/protocol/survey0/xrespond.c
+++ b/src/sp/protocol/survey0/xrespond.c
@@ -334,19 +334,20 @@ xresp0_putq_cb(void *arg)
nni_pipe_recv(p->npipe, &p->aio_recv);
}
-static int
+static nng_err
xresp0_sock_set_maxttl(void *arg, const void *buf, size_t sz, nni_opt_type t)
{
xresp0_sock *s = arg;
int ttl;
- int rv;
- if ((rv = nni_copyin_int(&ttl, buf, sz, 1, NNI_MAX_MAX_TTL, t)) == 0) {
+ nng_err rv;
+ if ((rv = nni_copyin_int(&ttl, buf, sz, 1, NNI_MAX_MAX_TTL, t)) ==
+ NNG_OK) {
nni_atomic_set(&s->ttl, ttl);
}
return (rv);
}
-static int
+static nng_err
xresp0_sock_get_maxttl(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
xresp0_sock *s = arg;
diff --git a/src/sp/protocol/survey0/xsurvey.c b/src/sp/protocol/survey0/xsurvey.c
index 2891fba5..3c78c392 100644
--- a/src/sp/protocol/survey0/xsurvey.c
+++ b/src/sp/protocol/survey0/xsurvey.c
@@ -272,19 +272,20 @@ xsurv0_recv_cb(void *arg)
nni_msgq_aio_put(p->psock->urq, &p->aio_putq);
}
-static int
+static nng_err
xsurv0_sock_set_max_ttl(void *arg, const void *buf, size_t sz, nni_opt_type t)
{
xsurv0_sock *s = arg;
int ttl;
- int rv;
- if ((rv = nni_copyin_int(&ttl, buf, sz, 1, NNI_MAX_MAX_TTL, t)) == 0) {
+ nng_err rv;
+ if ((rv = nni_copyin_int(&ttl, buf, sz, 1, NNI_MAX_MAX_TTL, t)) ==
+ NNG_OK) {
nni_atomic_set(&s->ttl, ttl);
}
return (rv);
}
-static int
+static nng_err
xsurv0_sock_get_max_ttl(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
xsurv0_sock *s = arg;
diff --git a/src/sp/transport.h b/src/sp/transport.h
index 733388e8..e4e3e156 100644
--- a/src/sp/transport.h
+++ b/src/sp/transport.h
@@ -120,7 +120,7 @@ struct nni_sp_listener_ops {
int (*l_set_tls)(void *, nng_tls_config *);
// l_set_security_descriptor is used exclusively on Windows.
- int (*l_set_security_descriptor)(void *, void *);
+ nng_err (*l_set_security_descriptor)(void *, void *);
// l_options is an array of listener options. The final
// element must have a NULL name. If this member is NULL, then
diff --git a/src/sp/transport/inproc/inproc.c b/src/sp/transport/inproc/inproc.c
index 8c662ca3..95500932 100644
--- a/src/sp/transport/inproc/inproc.c
+++ b/src/sp/transport/inproc/inproc.c
@@ -247,7 +247,7 @@ inproc_pipe_peer(void *arg)
return (pipe->peer);
}
-static int
+static nng_err
inproc_pipe_get_addr(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
inproc_pipe *p = arg;
@@ -526,24 +526,24 @@ inproc_ep_accept(void *arg, nni_aio *aio)
nni_mtx_unlock(&nni_inproc.mx);
}
-static int
+static nng_err
inproc_ep_get_recvmaxsz(void *arg, void *v, size_t *szp, nni_opt_type t)
{
inproc_ep *ep = arg;
- int rv;
+ nng_err rv;
nni_mtx_lock(&ep->mtx);
rv = nni_copyout_size(ep->rcvmax, v, szp, t);
nni_mtx_unlock(&ep->mtx);
return (rv);
}
-static int
+static nng_err
inproc_ep_set_recvmaxsz(void *arg, const void *v, size_t sz, nni_opt_type t)
{
inproc_ep *ep = arg;
size_t val;
- int rv;
- if ((rv = nni_copyin_size(&val, v, sz, 0, NNI_MAXSZ, t)) == 0) {
+ nng_err rv;
+ if ((rv = nni_copyin_size(&val, v, sz, 0, NNI_MAXSZ, t)) == NNG_OK) {
nni_mtx_lock(&ep->mtx);
ep->rcvmax = val;
nni_mtx_unlock(&ep->mtx);
@@ -551,7 +551,7 @@ inproc_ep_set_recvmaxsz(void *arg, const void *v, size_t sz, nni_opt_type t)
return (rv);
}
-static int
+static nng_err
inproc_ep_get_addr(void *arg, void *v, size_t *szp, nni_opt_type t)
{
inproc_ep *ep = arg;
diff --git a/src/sp/transport/ipc/ipc.c b/src/sp/transport/ipc/ipc.c
index 0163767b..35d4cc97 100644
--- a/src/sp/transport/ipc/ipc.c
+++ b/src/sp/transport/ipc/ipc.c
@@ -873,24 +873,24 @@ ipc_ep_connect(void *arg, nni_aio *aio)
nni_mtx_unlock(&ep->mtx);
}
-static int
+static nng_err
ipc_ep_get_recv_max_sz(void *arg, void *v, size_t *szp, nni_type t)
{
ipc_ep *ep = arg;
- int rv;
+ nng_err rv;
nni_mtx_lock(&ep->mtx);
rv = nni_copyout_size(ep->rcv_max, v, szp, t);
nni_mtx_unlock(&ep->mtx);
return (rv);
}
-static int
+static nng_err
ipc_ep_set_recv_max_sz(void *arg, const void *v, size_t sz, nni_type t)
{
ipc_ep *ep = arg;
size_t val;
- int rv;
- if ((rv = nni_copyin_size(&val, v, sz, 0, NNI_MAXSZ, t)) == 0) {
+ nng_err rv;
+ if ((rv = nni_copyin_size(&val, v, sz, 0, NNI_MAXSZ, t)) == NNG_OK) {
nni_mtx_lock(&ep->mtx);
ep->rcv_max = val;
@@ -1034,7 +1034,7 @@ ipc_listener_set(
return (rv);
}
-static int
+static nng_err
ipc_listener_set_sec_desc(void *arg, void *pdesc)
{
ipc_ep *ep = arg;
diff --git a/src/sp/transport/socket/sockfd.c b/src/sp/transport/socket/sockfd.c
index e7b25d8b..c50360af 100644
--- a/src/sp/transport/socket/sockfd.c
+++ b/src/sp/transport/socket/sockfd.c
@@ -739,11 +739,11 @@ sfd_tran_ep_cancel(nni_aio *aio, void *arg, nng_err rv)
nni_mtx_unlock(&ep->mtx);
}
-static int
+static nng_err
sfd_tran_ep_get_recvmaxsz(void *arg, void *v, size_t *szp, nni_opt_type t)
{
sfd_tran_ep *ep = arg;
- int rv;
+ nng_err rv;
nni_mtx_lock(&ep->mtx);
rv = nni_copyout_size(ep->rcvmax, v, szp, t);
@@ -751,13 +751,13 @@ sfd_tran_ep_get_recvmaxsz(void *arg, void *v, size_t *szp, nni_opt_type t)
return (rv);
}
-static int
+static nng_err
sfd_tran_ep_set_recvmaxsz(void *arg, const void *v, size_t sz, nni_opt_type t)
{
sfd_tran_ep *ep = arg;
size_t val;
- int rv;
- if ((rv = nni_copyin_size(&val, v, sz, 0, NNI_MAXSZ, t)) == 0) {
+ nng_err rv;
+ if ((rv = nni_copyin_size(&val, v, sz, 0, NNI_MAXSZ, t)) == NNG_OK) {
nni_mtx_lock(&ep->mtx);
ep->rcvmax = val;
nni_mtx_unlock(&ep->mtx);
diff --git a/src/sp/transport/tcp/tcp.c b/src/sp/transport/tcp/tcp.c
index 6bcbca9e..897d8ed6 100644
--- a/src/sp/transport/tcp/tcp.c
+++ b/src/sp/transport/tcp/tcp.c
@@ -884,11 +884,11 @@ tcptran_ep_connect(void *arg, nni_aio *aio)
nni_mtx_unlock(&ep->mtx);
}
-static int
+static nng_err
tcptran_ep_get_recvmaxsz(void *arg, void *v, size_t *szp, nni_opt_type t)
{
tcptran_ep *ep = arg;
- int rv;
+ nng_err rv;
nni_mtx_lock(&ep->mtx);
rv = nni_copyout_size(ep->rcvmax, v, szp, t);
@@ -896,13 +896,13 @@ tcptran_ep_get_recvmaxsz(void *arg, void *v, size_t *szp, nni_opt_type t)
return (rv);
}
-static int
+static nng_err
tcptran_ep_set_recvmaxsz(void *arg, const void *v, size_t sz, nni_opt_type t)
{
tcptran_ep *ep = arg;
size_t val;
- int rv;
- if ((rv = nni_copyin_size(&val, v, sz, 0, NNI_MAXSZ, t)) == 0) {
+ nng_err rv;
+ if ((rv = nni_copyin_size(&val, v, sz, 0, NNI_MAXSZ, t)) == NNG_OK) {
nni_mtx_lock(&ep->mtx);
ep->rcvmax = val;
nni_mtx_unlock(&ep->mtx);
diff --git a/src/sp/transport/tls/tls.c b/src/sp/transport/tls/tls.c
index 5d2e6d9e..78e8ef35 100644
--- a/src/sp/transport/tls/tls.c
+++ b/src/sp/transport/tls/tls.c
@@ -903,13 +903,13 @@ tlstran_ep_accept(void *arg, nni_aio *aio)
nni_mtx_unlock(&ep->mtx);
}
-static int
+static nng_err
tlstran_ep_set_recvmaxsz(void *arg, const void *v, size_t sz, nni_type t)
{
tlstran_ep *ep = arg;
size_t val;
- int rv;
- if ((rv = nni_copyin_size(&val, v, sz, 0, NNI_MAXSZ, t)) == 0) {
+ nng_err rv;
+ if ((rv = nni_copyin_size(&val, v, sz, 0, NNI_MAXSZ, t)) == NNG_OK) {
nni_mtx_lock(&ep->mtx);
ep->rcvmax = val;
nni_mtx_unlock(&ep->mtx);
@@ -920,11 +920,11 @@ tlstran_ep_set_recvmaxsz(void *arg, const void *v, size_t sz, nni_type t)
return (rv);
}
-static int
+static nng_err
tlstran_ep_get_recvmaxsz(void *arg, void *v, size_t *szp, nni_type t)
{
tlstran_ep *ep = arg;
- int rv;
+ nng_err rv;
nni_mtx_lock(&ep->mtx);
rv = nni_copyout_size(ep->rcvmax, v, szp, t);
nni_mtx_unlock(&ep->mtx);
diff --git a/src/sp/transport/udp/udp.c b/src/sp/transport/udp/udp.c
index 43fbabe1..fd13461b 100644
--- a/src/sp/transport/udp/udp.c
+++ b/src/sp/transport/udp/udp.c
@@ -1044,24 +1044,24 @@ udp_pipe_peer(void *arg)
return (p->peer);
}
-static int
+static nng_err
udp_pipe_get_recvmax(void *arg, void *v, size_t *szp, nni_type t)
{
udp_pipe *p = arg;
udp_ep *ep = p->ep;
- int rv;
+ nng_err rv;
nni_mtx_lock(&ep->mtx);
rv = nni_copyout_size(p->rcvmax, v, szp, t);
nni_mtx_unlock(&ep->mtx);
return (rv);
}
-static int
+static nng_err
udp_pipe_get_remaddr(void *arg, void *v, size_t *szp, nni_type t)
{
udp_pipe *p = arg;
udp_ep *ep = p->ep;
- int rv;
+ nng_err rv;
nni_mtx_lock(&ep->mtx);
rv = nni_copyout_sockaddr(&p->peer_addr, v, szp, t);
nni_mtx_unlock(&ep->mtx);
@@ -1549,7 +1549,7 @@ udp_ep_connect(void *arg, nni_aio *aio)
nni_mtx_unlock(&ep->mtx);
}
-static int
+static nng_err
udp_ep_get_port(void *arg, void *buf, size_t *szp, nni_type t)
{
udp_ep *ep = arg;
@@ -1586,11 +1586,11 @@ udp_ep_get_port(void *arg, void *buf, size_t *szp, nni_type t)
return (nni_copyout_int(port, buf, szp, t));
}
-static int
+static nng_err
udp_ep_get_locaddr(void *arg, void *v, size_t *szp, nni_opt_type t)
{
udp_ep *ep = arg;
- int rv;
+ nng_err rv;
nng_sockaddr sa;
if (ep->udp != NULL) {
@@ -1603,11 +1603,11 @@ udp_ep_get_locaddr(void *arg, void *v, size_t *szp, nni_opt_type t)
return (rv);
}
-static int
+static nng_err
udp_ep_get_remaddr(void *arg, void *v, size_t *szp, nni_opt_type t)
{
udp_ep *ep = arg;
- int rv;
+ nng_err rv;
nng_sockaddr sa;
if (!ep->dialer) {
@@ -1619,11 +1619,11 @@ udp_ep_get_remaddr(void *arg, void *v, size_t *szp, nni_opt_type t)
return (rv);
}
-static int
+static nng_err
udp_ep_get_recvmaxsz(void *arg, void *v, size_t *szp, nni_opt_type t)
{
udp_ep *ep = arg;
- int rv;
+ nng_err rv;
nni_mtx_lock(&ep->mtx);
rv = nni_copyout_size(ep->rcvmax, v, szp, t);
@@ -1631,13 +1631,13 @@ udp_ep_get_recvmaxsz(void *arg, void *v, size_t *szp, nni_opt_type t)
return (rv);
}
-static int
+static nng_err
udp_ep_set_recvmaxsz(void *arg, const void *v, size_t sz, nni_opt_type t)
{
udp_ep *ep = arg;
size_t val;
- int rv;
- if ((rv = nni_copyin_size(&val, v, sz, 0, 65000, t)) == 0) {
+ nng_err rv;
+ if ((rv = nni_copyin_size(&val, v, sz, 0, 65000, t)) == NNG_OK) {
if ((val == 0) || (val > 65000)) {
val = 65000;
}
@@ -1653,11 +1653,11 @@ udp_ep_set_recvmaxsz(void *arg, const void *v, size_t sz, nni_opt_type t)
return (rv);
}
-static int
+static nng_err
udp_ep_get_copymax(void *arg, void *v, size_t *szp, nni_opt_type t)
{
udp_ep *ep = arg;
- int rv;
+ nng_err rv;
nni_mtx_lock(&ep->mtx);
rv = nni_copyout_size(ep->copymax, v, szp, t);
@@ -1665,13 +1665,13 @@ udp_ep_get_copymax(void *arg, void *v, size_t *szp, nni_opt_type t)
return (rv);
}
-static int
+static nng_err
udp_ep_set_copymax(void *arg, const void *v, size_t sz, nni_opt_type t)
{
udp_ep *ep = arg;
size_t val;
- int rv;
- if ((rv = nni_copyin_size(&val, v, sz, 0, 65000, t)) == 0) {
+ nng_err rv;
+ if ((rv = nni_copyin_size(&val, v, sz, 0, 65000, t)) == NNG_OK) {
nni_mtx_lock(&ep->mtx);
if (ep->started) {
nni_mtx_unlock(&ep->mtx);
diff --git a/src/supplemental/tls/tls_dialer.c b/src/supplemental/tls/tls_dialer.c
index 5927edd8..0b2acee7 100644
--- a/src/supplemental/tls/tls_dialer.c
+++ b/src/supplemental/tls/tls_dialer.c
@@ -92,7 +92,7 @@ tls_dialer_dial(void *arg, nng_aio *aio)
nng_stream_dialer_dial(d->d, &ts->conn_aio);
}
-static int
+static nng_err
tls_dialer_set_tls(void *arg, nng_tls_config *cfg)
{
tls_dialer *d = arg;
@@ -114,20 +114,20 @@ tls_dialer_set_tls(void *arg, nng_tls_config *cfg)
nni_mtx_unlock(&d->lk);
nng_tls_config_free(old);
- return (0);
+ return (NNG_OK);
}
-static int
+static nng_err
tls_dialer_get_tls(void *arg, nng_tls_config **cfg)
{
tls_dialer *d = arg;
nni_mtx_lock(&d->lk);
*cfg = d->cfg;
nni_mtx_unlock(&d->lk);
- return (0);
+ return (NNG_OK);
}
-static int
+static nng_err
tls_dialer_get(void *arg, const char *name, void *buf, size_t *szp, nni_type t)
{
tls_dialer *d = arg;
@@ -135,7 +135,7 @@ tls_dialer_get(void *arg, const char *name, void *buf, size_t *szp, nni_type t)
return (nni_stream_dialer_get(d->d, name, buf, szp, t));
}
-static int
+static nng_err
tls_dialer_set(
void *arg, const char *name, const void *buf, size_t sz, nni_type t)
{
diff --git a/src/supplemental/tls/tls_listener.c b/src/supplemental/tls/tls_listener.c
index 0ab0f57b..5d2d8599 100644
--- a/src/supplemental/tls/tls_listener.c
+++ b/src/supplemental/tls/tls_listener.c
@@ -99,7 +99,7 @@ tls_listener_accept(void *arg, nng_aio *aio)
nng_stream_listener_accept(l->l, &ts->conn_aio);
}
-static int
+static nng_err
tls_listener_set_tls(void *arg, nng_tls_config *cfg)
{
tls_listener *l = arg;
@@ -120,20 +120,20 @@ tls_listener_set_tls(void *arg, nng_tls_config *cfg)
nni_mtx_unlock(&l->lk);
nng_tls_config_free(old);
- return (0);
+ return (NNG_OK);
}
-static int
+static nng_err
tls_listener_get_tls(void *arg, nng_tls_config **cfg)
{
tls_listener *l = arg;
nni_mtx_lock(&l->lk);
*cfg = l->cfg;
nni_mtx_unlock(&l->lk);
- return (0);
+ return (NNG_OK);
}
-static int
+static nng_err
tls_listener_get(
void *arg, const char *name, void *buf, size_t *szp, nni_type t)
{
@@ -142,7 +142,7 @@ tls_listener_get(
return (nni_stream_listener_get(l->l, name, buf, szp, t));
}
-static int
+static nng_err
tls_listener_set(
void *arg, const char *name, const void *buf, size_t sz, nni_type t)
{
diff --git a/src/supplemental/tls/tls_stream.c b/src/supplemental/tls/tls_stream.c
index 7ac8d5b9..8a7f26d8 100644
--- a/src/supplemental/tls/tls_stream.c
+++ b/src/supplemental/tls/tls_stream.c
@@ -134,7 +134,7 @@ tls_stream_conn_cb(void *arg)
nni_aio_finish(ts->user_aio, 0, 0);
}
-static int tls_stream_get(
+static nng_err tls_stream_get(
void *arg, const char *name, void *buf, size_t *szp, nni_type t);
int
@@ -173,7 +173,7 @@ nni_tls_stream_alloc(tls_stream **tsp, nng_tls_config *cfg, nng_aio *user_aio)
return (0);
}
-static int
+static nng_err
tls_get_verified(void *arg, void *buf, size_t *szp, nni_type t)
{
tls_stream *ts = arg;
@@ -181,7 +181,7 @@ tls_get_verified(void *arg, void *buf, size_t *szp, nni_type t)
return (nni_copyout_bool(nni_tls_verified(&ts->conn), buf, szp, t));
}
-static int
+static nng_err
tls_get_peer_cn(void *arg, void *buf, size_t *szp, nni_type t)
{
NNI_ARG_UNUSED(szp);
@@ -192,7 +192,7 @@ tls_get_peer_cn(void *arg, void *buf, size_t *szp, nni_type t)
tls_stream *ts = arg;
*(char **) buf = (char *) nni_tls_peer_cn(&ts->conn);
- return (0);
+ return (NNG_OK);
}
static const nni_option tls_stream_options[] = {
@@ -209,11 +209,11 @@ static const nni_option tls_stream_options[] = {
},
};
-static int
+static nng_err
tls_stream_get(void *arg, const char *name, void *buf, size_t *szp, nni_type t)
{
tls_stream *ts = arg;
- int rv;
+ nng_err rv;
if ((rv = nni_stream_get(ts->conn.bio, name, buf, szp, t)) !=
NNG_ENOTSUP) {
diff --git a/src/supplemental/websocket/websocket.c b/src/supplemental/websocket/websocket.c
index 36312b69..4ddf8918 100644
--- a/src/supplemental/websocket/websocket.c
+++ b/src/supplemental/websocket/websocket.c
@@ -181,11 +181,11 @@ static void ws_read_cb(void *);
static void ws_write_cb(void *);
static void ws_close_error(nni_ws *ws, uint16_t code);
-static void ws_str_free(void *);
-static void ws_str_close(void *);
-static void ws_str_send(void *, nng_aio *);
-static void ws_str_recv(void *, nng_aio *);
-static int ws_str_get(void *, const char *, void *, size_t *, nni_type);
+static void ws_str_free(void *);
+static void ws_str_close(void *);
+static void ws_str_send(void *, nng_aio *);
+static void ws_str_recv(void *, nng_aio *);
+static nng_err ws_str_get(void *, const char *, void *, size_t *, nni_type);
static void ws_listener_close(void *);
static void ws_listener_free(void *);
@@ -1726,17 +1726,17 @@ ws_listener_listen(void *arg)
return (NNG_OK);
}
-static int
+static nng_err
ws_listener_set_size(
nni_ws_listener *l, size_t *valp, const void *buf, size_t sz, nni_type t)
{
- size_t val;
- int rv;
+ size_t val;
+ nng_err rv;
// Max size is limited to 4 GB, but you really never want to have
// to have a larger value. If you think you need that, you're doing it
// wrong. You *can* set the size to 0 for unlimited.
- if ((rv = nni_copyin_size(&val, buf, sz, 0, NNI_MAXSZ, t)) == 0) {
+ if ((rv = nni_copyin_size(&val, buf, sz, 0, NNI_MAXSZ, t)) == NNG_OK) {
nni_mtx_lock(&l->mtx);
*valp = val;
nni_mtx_unlock(&l->mtx);
@@ -1744,7 +1744,7 @@ ws_listener_set_size(
return (rv);
}
-static int
+static nng_err
ws_listener_get_size(
nni_ws_listener *l, size_t *valp, void *buf, size_t *szp, nni_type t)
{
@@ -1755,55 +1755,55 @@ ws_listener_get_size(
return (nni_copyout_size(val, buf, szp, t));
}
-static int
+static nng_err
ws_listener_set_maxframe(void *arg, const void *buf, size_t sz, nni_type t)
{
nni_ws_listener *l = arg;
return (ws_listener_set_size(l, &l->maxframe, buf, sz, t));
}
-static int
+static nng_err
ws_listener_get_maxframe(void *arg, void *buf, size_t *szp, nni_type t)
{
nni_ws_listener *l = arg;
return (ws_listener_get_size(l, &l->maxframe, buf, szp, t));
}
-static int
+static nng_err
ws_listener_set_fragsize(void *arg, const void *buf, size_t sz, nni_type t)
{
nni_ws_listener *l = arg;
return (ws_listener_set_size(l, &l->fragsize, buf, sz, t));
}
-static int
+static nng_err
ws_listener_get_fragsize(void *arg, void *buf, size_t *szp, nni_type t)
{
nni_ws_listener *l = arg;
return (ws_listener_get_size(l, &l->fragsize, buf, szp, t));
}
-static int
+static nng_err
ws_listener_set_recvmax(void *arg, const void *buf, size_t sz, nni_type t)
{
nni_ws_listener *l = arg;
return (ws_listener_set_size(l, &l->recvmax, buf, sz, t));
}
-static int
+static nng_err
ws_listener_get_recvmax(void *arg, void *buf, size_t *szp, nni_type t)
{
nni_ws_listener *l = arg;
return (ws_listener_get_size(l, &l->recvmax, buf, szp, t));
}
-static int
+static nng_err
ws_listener_set_proto(void *arg, const void *buf, size_t sz, nni_type t)
{
nni_ws_listener *l = arg;
- int rv;
+ nng_err rv;
- if ((rv = ws_check_string(buf, sz, t)) == 0) {
+ if ((rv = ws_check_string(buf, sz, t)) == NNG_OK) {
char *ns;
if ((ns = nni_strdup(buf)) == NULL) {
rv = NNG_ENOMEM;
@@ -1819,25 +1819,25 @@ ws_listener_set_proto(void *arg, const void *buf, size_t sz, nni_type t)
return (rv);
}
-static int
+static nng_err
ws_listener_get_proto(void *arg, void *buf, size_t *szp, nni_type t)
{
nni_ws_listener *l = arg;
- int rv;
+ nng_err rv;
nni_mtx_lock(&l->mtx);
rv = nni_copyout_str(l->proto != NULL ? l->proto : "", buf, szp, t);
nni_mtx_unlock(&l->mtx);
return (rv);
}
-static int
+static nng_err
ws_listener_set_msgmode(void *arg, const void *buf, size_t sz, nni_type t)
{
nni_ws_listener *l = arg;
- int rv;
+ nng_err rv;
bool b;
- if ((rv = nni_copyin_bool(&b, buf, sz, t)) == 0) {
+ if ((rv = nni_copyin_bool(&b, buf, sz, t)) == NNG_OK) {
nni_mtx_lock(&l->mtx);
l->isstream = !b;
nni_mtx_unlock(&l->mtx);
@@ -1845,14 +1845,14 @@ ws_listener_set_msgmode(void *arg, const void *buf, size_t sz, nni_type t)
return (rv);
}
-static int
+static nng_err
ws_listener_set_recv_text(void *arg, const void *buf, size_t sz, nni_type t)
{
nni_ws_listener *l = arg;
- int rv;
+ nng_err rv;
bool b;
- if ((rv = nni_copyin_bool(&b, buf, sz, t)) == 0) {
+ if ((rv = nni_copyin_bool(&b, buf, sz, t)) == NNG_OK) {
nni_mtx_lock(&l->mtx);
l->recv_text = b;
nni_mtx_unlock(&l->mtx);
@@ -1860,14 +1860,14 @@ ws_listener_set_recv_text(void *arg, const void *buf, size_t sz, nni_type t)
return (rv);
}
-static int
+static nng_err
ws_listener_set_send_text(void *arg, const void *buf, size_t sz, nni_type t)
{
nni_ws_listener *l = arg;
- int rv;
+ nng_err rv;
bool b;
- if ((rv = nni_copyin_bool(&b, buf, sz, t)) == 0) {
+ if ((rv = nni_copyin_bool(&b, buf, sz, t)) == NNG_OK) {
nni_mtx_lock(&l->mtx);
l->send_text = b;
nni_mtx_unlock(&l->mtx);
@@ -1875,22 +1875,22 @@ ws_listener_set_send_text(void *arg, const void *buf, size_t sz, nni_type t)
return (rv);
}
-static int
+static nng_err
ws_listener_get_recv_text(void *arg, void *buf, size_t *szp, nni_type t)
{
nni_ws_listener *l = arg;
- int rv;
+ nng_err rv;
nni_mtx_lock(&l->mtx);
rv = nni_copyout_bool(l->recv_text, buf, szp, t);
nni_mtx_unlock(&l->mtx);
return (rv);
}
-static int
+static nng_err
ws_listener_get_send_text(void *arg, void *buf, size_t *szp, nni_type t)
{
nni_ws_listener *l = arg;
- int rv;
+ nng_err rv;
nni_mtx_lock(&l->mtx);
rv = nni_copyout_bool(l->send_text, buf, szp, t);
nni_mtx_unlock(&l->mtx);
@@ -1937,13 +1937,13 @@ static const nni_option ws_listener_options[] = {
},
};
-static int
+static nng_err
ws_listener_set_header(nni_ws_listener *l, const char *name, const void *buf,
size_t sz, nni_type t)
{
- int rv;
+ nng_err rv;
name += strlen(NNG_OPT_WS_HEADER);
- if ((rv = ws_check_string(buf, sz, t)) == 0) {
+ if ((rv = ws_check_string(buf, sz, t)) == NNG_OK) {
nni_mtx_lock(&l->mtx);
rv = ws_set_header(&l->headers, name, buf);
nni_mtx_unlock(&l->mtx);
@@ -1951,12 +1951,12 @@ ws_listener_set_header(nni_ws_listener *l, const char *name, const void *buf,
return (rv);
}
-static int
+static nng_err
ws_listener_set(
void *arg, const char *name, const void *buf, size_t sz, nni_type t)
{
nni_ws_listener *l = arg;
- int rv;
+ nng_err rv;
rv = nni_setopt(ws_listener_options, name, l, buf, sz, t);
if (rv == NNG_ENOTSUP) {
@@ -1971,12 +1971,12 @@ ws_listener_set(
return (rv);
}
-static int
+static nng_err
ws_listener_get(
void *arg, const char *name, void *buf, size_t *szp, nni_type t)
{
nni_ws_listener *l = arg;
- int rv;
+ nng_err rv;
rv = nni_getopt(ws_listener_options, name, l, buf, szp, t);
if (rv == NNG_ENOTSUP) {
@@ -1985,14 +1985,14 @@ ws_listener_get(
return (rv);
}
-static int
+static nng_err
ws_listener_get_tls(void *arg, nng_tls_config **cfgp)
{
nni_ws_listener *l = arg;
return (nni_http_server_get_tls(l->server, cfgp));
}
-static int
+static nng_err
ws_listener_set_tls(void *arg, nng_tls_config *cfg)
{
nni_ws_listener *l = arg;
@@ -2254,11 +2254,11 @@ ws_dialer_dial(void *arg, nni_aio *aio)
nni_mtx_unlock(&d->mtx);
}
-static int
+static nng_err
ws_dialer_set_msgmode(void *arg, const void *buf, size_t sz, nni_type t)
{
nni_ws_dialer *d = arg;
- int rv;
+ nng_err rv;
bool b;
if ((rv = nni_copyin_bool(&b, buf, sz, t)) == 0) {
@@ -2269,14 +2269,14 @@ ws_dialer_set_msgmode(void *arg, const void *buf, size_t sz, nni_type t)
return (rv);
}
-static int
+static nng_err
ws_dialer_set_recv_text(void *arg, const void *buf, size_t sz, nni_type t)
{
nni_ws_dialer *d = arg;
- int rv;
+ nng_err rv;
bool b;
- if ((rv = nni_copyin_bool(&b, buf, sz, t)) == 0) {
+ if ((rv = nni_copyin_bool(&b, buf, sz, t)) == NNG_OK) {
nni_mtx_lock(&d->mtx);
d->recv_text = b;
nni_mtx_unlock(&d->mtx);
@@ -2284,14 +2284,14 @@ ws_dialer_set_recv_text(void *arg, const void *buf, size_t sz, nni_type t)
return (rv);
}
-static int
+static nng_err
ws_dialer_set_send_text(void *arg, const void *buf, size_t sz, nni_type t)
{
nni_ws_dialer *d = arg;
- int rv;
+ nng_err rv;
bool b;
- if ((rv = nni_copyin_bool(&b, buf, sz, t)) == 0) {
+ if ((rv = nni_copyin_bool(&b, buf, sz, t)) == NNG_OK) {
nni_mtx_lock(&d->mtx);
d->send_text = b;
nni_mtx_unlock(&d->mtx);
@@ -2299,17 +2299,17 @@ ws_dialer_set_send_text(void *arg, const void *buf, size_t sz, nni_type t)
return (rv);
}
-static int
+static nng_err
ws_dialer_set_size(
nni_ws_dialer *d, size_t *valp, const void *buf, size_t sz, nni_type t)
{
- size_t val;
- int rv;
+ size_t val;
+ nng_err rv;
// Max size is limited to 4 GB, but you really never want to have
// to have a larger value. If you think you need that, you're doing it
// wrong. You *can* set the size to 0 for unlimited.
- if ((rv = nni_copyin_size(&val, buf, sz, 0, NNI_MAXSZ, t)) == 0) {
+ if ((rv = nni_copyin_size(&val, buf, sz, 0, NNI_MAXSZ, t)) == NNG_OK) {
nni_mtx_lock(&d->mtx);
*valp = val;
nni_mtx_unlock(&d->mtx);
@@ -2317,7 +2317,7 @@ ws_dialer_set_size(
return (rv);
}
-static int
+static nng_err
ws_dialer_get_size(
nni_ws_dialer *d, size_t *valp, void *buf, size_t *szp, nni_type t)
{
@@ -2328,55 +2328,55 @@ ws_dialer_get_size(
return (nni_copyout_size(val, buf, szp, t));
}
-static int
+static nng_err
ws_dialer_set_maxframe(void *arg, const void *buf, size_t sz, nni_type t)
{
nni_ws_dialer *d = arg;
return (ws_dialer_set_size(d, &d->maxframe, buf, sz, t));
}
-static int
+static nng_err
ws_dialer_get_maxframe(void *arg, void *buf, size_t *szp, nni_type t)
{
nni_ws_dialer *d = arg;
return (ws_dialer_get_size(d, &d->maxframe, buf, szp, t));
}
-static int
+static nng_err
ws_dialer_set_fragsize(void *arg, const void *buf, size_t sz, nni_type t)
{
nni_ws_dialer *d = arg;
return (ws_dialer_set_size(d, &d->fragsize, buf, sz, t));
}
-static int
+static nng_err
ws_dialer_get_fragsize(void *arg, void *buf, size_t *szp, nni_type t)
{
nni_ws_dialer *d = arg;
return (ws_dialer_get_size(d, &d->fragsize, buf, szp, t));
}
-static int
+static nng_err
ws_dialer_set_recvmax(void *arg, const void *buf, size_t sz, nni_type t)
{
nni_ws_dialer *d = arg;
return (ws_dialer_set_size(d, &d->recvmax, buf, sz, t));
}
-static int
+static nng_err
ws_dialer_get_recvmax(void *arg, void *buf, size_t *szp, nni_type t)
{
nni_ws_dialer *d = arg;
return (ws_dialer_get_size(d, &d->recvmax, buf, szp, t));
}
-static int
+static nng_err
ws_dialer_set_proto(void *arg, const void *buf, size_t sz, nni_type t)
{
nni_ws_dialer *d = arg;
- int rv;
+ nng_err rv;
- if ((rv = ws_check_string(buf, sz, t)) == 0) {
+ if ((rv = ws_check_string(buf, sz, t)) == NNG_OK) {
char *ns;
if ((ns = nni_strdup(buf)) == NULL) {
rv = NNG_ENOMEM;
@@ -2392,33 +2392,33 @@ ws_dialer_set_proto(void *arg, const void *buf, size_t sz, nni_type t)
return (rv);
}
-static int
+static nng_err
ws_dialer_get_proto(void *arg, void *buf, size_t *szp, nni_type t)
{
nni_ws_dialer *d = arg;
- int rv;
+ nng_err rv;
nni_mtx_lock(&d->mtx);
rv = nni_copyout_str(d->proto != NULL ? d->proto : "", buf, szp, t);
nni_mtx_unlock(&d->mtx);
return (rv);
}
-static int
+static nng_err
ws_dialer_get_recv_text(void *arg, void *buf, size_t *szp, nni_type t)
{
nni_ws_dialer *d = arg;
- int rv;
+ nng_err rv;
nni_mtx_lock(&d->mtx);
rv = nni_copyout_bool(d->recv_text, buf, szp, t);
nni_mtx_unlock(&d->mtx);
return (rv);
}
-static int
+static nng_err
ws_dialer_get_send_text(void *arg, void *buf, size_t *szp, nni_type t)
{
nni_ws_dialer *d = arg;
- int rv;
+ nng_err rv;
nni_mtx_lock(&d->mtx);
rv = nni_copyout_bool(d->send_text, buf, szp, t);
nni_mtx_unlock(&d->mtx);
@@ -2466,13 +2466,13 @@ static const nni_option ws_dialer_options[] = {
},
};
-static int
+static nng_err
ws_dialer_set_header(
nni_ws_dialer *d, const char *name, const void *buf, size_t sz, nni_type t)
{
- int rv;
+ nng_err rv;
name += strlen(NNG_OPT_WS_HEADER);
- if ((rv = ws_check_string(buf, sz, t)) == 0) {
+ if ((rv = ws_check_string(buf, sz, t)) == NNG_OK) {
nni_mtx_lock(&d->mtx);
rv = ws_set_header(&d->headers, name, buf);
nni_mtx_unlock(&d->mtx);
@@ -2480,12 +2480,12 @@ ws_dialer_set_header(
return (rv);
}
-static int
+static nng_err
ws_dialer_set(
void *arg, const char *name, const void *buf, size_t sz, nni_type t)
{
nni_ws_dialer *d = arg;
- int rv;
+ nng_err rv;
rv = nni_setopt(ws_dialer_options, name, d, buf, sz, t);
if (rv == NNG_ENOTSUP) {
@@ -2500,11 +2500,11 @@ ws_dialer_set(
return (rv);
}
-static int
+static nng_err
ws_dialer_get(void *arg, const char *name, void *buf, size_t *szp, nni_type t)
{
nni_ws_dialer *d = arg;
- int rv;
+ nng_err rv;
rv = nni_getopt(ws_dialer_options, name, d, buf, szp, t);
if (rv == NNG_ENOTSUP) {
@@ -2513,14 +2513,14 @@ ws_dialer_get(void *arg, const char *name, void *buf, size_t *szp, nni_type t)
return (rv);
}
-static int
+static nng_err
ws_dialer_get_tls(void *arg, nng_tls_config **cfgp)
{
nni_ws_dialer *d = arg;
return (nni_http_client_get_tls(d->client, cfgp));
}
-static int
+static nng_err
ws_dialer_set_tls(void *arg, nng_tls_config *cfg)
{
nni_ws_dialer *d = arg;
@@ -2669,14 +2669,14 @@ ws_str_recv(void *arg, nng_aio *aio)
nni_mtx_unlock(&ws->mtx);
}
-static int
+static nng_err
ws_get_request_uri(void *arg, void *buf, size_t *szp, nni_type t)
{
nni_ws *ws = arg;
return (nni_copyout_str(nni_http_get_uri(ws->http), buf, szp, t));
}
-static int
+static nng_err
ws_get_recv_text(void *arg, void *buf, size_t *szp, nni_type t)
{
nni_ws *ws = arg;
@@ -2688,7 +2688,7 @@ ws_get_recv_text(void *arg, void *buf, size_t *szp, nni_type t)
return (nni_copyout_bool(b, buf, szp, t));
}
-static int
+static nng_err
ws_get_send_text(void *arg, void *buf, size_t *szp, nni_type t)
{
nni_ws *ws = arg;
@@ -2718,7 +2718,7 @@ static const nni_option ws_options[] = {
},
};
-static int
+static nng_err
ws_get_header(nni_ws *ws, const char *nm, void *buf, size_t *szp, nni_type t)
{
const char *s;
@@ -2730,11 +2730,11 @@ ws_get_header(nni_ws *ws, const char *nm, void *buf, size_t *szp, nni_type t)
return (nni_copyout_str(s, buf, szp, t));
}
-static int
+static nng_err
ws_str_get(void *arg, const char *nm, void *buf, size_t *szp, nni_type t)
{
nni_ws *ws = arg;
- int rv;
+ nng_err rv;
nni_mtx_lock(&ws->mtx);
if (ws->closed) {