aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/pipe.c10
-rw-r--r--src/core/pipe.h4
-rw-r--r--src/nng.c24
-rw-r--r--src/sp/transport.h2
-rw-r--r--src/sp/transport/inproc/inproc.c4
-rw-r--r--src/sp/transport/ipc/ipc.c2
-rw-r--r--src/sp/transport/socket/sockfd.c4
-rw-r--r--src/sp/transport/tcp/tcp.c2
-rw-r--r--src/sp/transport/tls/tls.c6
-rw-r--r--src/sp/transport/udp/udp.c4
-rw-r--r--src/sp/transport/ws/websocket.c4
11 files changed, 33 insertions, 33 deletions
diff --git a/src/core/pipe.c b/src/core/pipe.c
index d7cd6bc0..c57a8d43 100644
--- a/src/core/pipe.c
+++ b/src/core/pipe.c
@@ -1,5 +1,5 @@
//
-// Copyright 2024 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2025 Staysail Systems, Inc. <info@staysail.tech>
// Copyright 2018 Capitar IT Group BV <info@capitar.com>
// Copyright 2018 Devolutions <info@devolutions.net>
//
@@ -75,7 +75,7 @@ pipe_reap(void *arg)
nni_pipe_rele(p);
}
-int
+nng_err
nni_pipe_find(nni_pipe **pp, uint32_t id)
{
nni_pipe *p;
@@ -90,7 +90,7 @@ nni_pipe_find(nni_pipe **pp, uint32_t id)
*pp = p;
}
nni_mtx_unlock(&pipes_lk);
- return (p == NULL ? NNG_ENOENT : 0);
+ return (p == NULL ? NNG_ENOENT : NNG_OK);
}
void
@@ -330,11 +330,11 @@ nni_pipe_alloc_listener(void **datap, nni_listener *l)
return (0);
}
-int
+nng_err
nni_pipe_getopt(
nni_pipe *p, const char *name, void *val, size_t *szp, nni_opt_type t)
{
- int rv;
+ nng_err rv;
rv = p->p_tran_ops.p_getopt(p->p_tran_data, name, val, szp, t);
if (rv != NNG_ENOTSUP) {
diff --git a/src/core/pipe.h b/src/core/pipe.h
index dcdca418..aa7a0598 100644
--- a/src/core/pipe.h
+++ b/src/core/pipe.h
@@ -36,12 +36,12 @@ extern void nni_pipe_close(nni_pipe *);
extern uint16_t nni_pipe_peer(nni_pipe *);
// nni_pipe_getopt looks up the option.
-extern int nni_pipe_getopt(
+extern nng_err nni_pipe_getopt(
nni_pipe *, const char *, void *, size_t *, nni_opt_type);
// nni_pipe_find finds a pipe given its ID. It places a hold on the
// pipe, which must be released by the caller when it is done.
-extern int nni_pipe_find(nni_pipe **, uint32_t);
+extern nng_err nni_pipe_find(nni_pipe **, uint32_t);
// nni_pipe_sock_id returns the socket id for the pipe (used by public API).
extern uint32_t nni_pipe_sock_id(nni_pipe *);
diff --git a/src/nng.c b/src/nng.c
index d9b111a8..26f45f76 100644
--- a/src/nng.c
+++ b/src/nng.c
@@ -1,5 +1,5 @@
//
-// Copyright 2024 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2025 Staysail Systems, Inc. <info@staysail.tech>
// Copyright 2018 Capitar IT Group BV <info@capitar.com>
//
// This software is supplied under the terms of the MIT License, a
@@ -1301,10 +1301,10 @@ nng_strerror(nng_err num)
return (unknownerrbuf);
}
-static int
+static nng_err
pipe_get(nng_pipe p, const char *name, void *val, size_t *szp, nni_type t)
{
- int rv;
+ nng_err rv;
nni_pipe *pipe;
if ((rv = nni_pipe_find(&pipe, p.id)) != 0) {
@@ -1315,37 +1315,37 @@ pipe_get(nng_pipe p, const char *name, void *val, size_t *szp, nni_type t)
return (rv);
}
-int
+nng_err
nng_pipe_get_int(nng_pipe id, const char *n, int *v)
{
return (pipe_get(id, n, v, NULL, NNI_TYPE_INT32));
}
-int
+nng_err
nng_pipe_get_bool(nng_pipe id, const char *n, bool *v)
{
return (pipe_get(id, n, v, NULL, NNI_TYPE_BOOL));
}
-int
+nng_err
nng_pipe_get_size(nng_pipe id, const char *n, size_t *v)
{
return (pipe_get(id, n, v, NULL, NNI_TYPE_SIZE));
}
-int
+nng_err
nng_pipe_get_string(nng_pipe id, const char *n, char **v)
{
return (pipe_get(id, n, v, NULL, NNI_TYPE_STRING));
}
-int
+nng_err
nng_pipe_get_ms(nng_pipe id, const char *n, nng_duration *v)
{
return (pipe_get(id, n, v, NULL, NNI_TYPE_DURATION));
}
-int
+nng_err
nng_pipe_get_addr(nng_pipe id, const char *n, nng_sockaddr *v)
{
return (pipe_get(id, n, v, NULL, NNI_TYPE_SOCKADDR));
@@ -1388,10 +1388,10 @@ nng_pipe_listener(nng_pipe p)
return (l);
}
-int
+nng_err
nng_pipe_close(nng_pipe p)
{
- int rv;
+ nng_err rv;
nni_pipe *pipe;
if ((rv = nni_pipe_find(&pipe, p.id)) != 0) {
@@ -1399,7 +1399,7 @@ nng_pipe_close(nng_pipe p)
}
nni_pipe_close(pipe);
nni_pipe_rele(pipe);
- return (0);
+ return (NNG_OK);
}
int
diff --git a/src/sp/transport.h b/src/sp/transport.h
index 976068c8..1c9f930b 100644
--- a/src/sp/transport.h
+++ b/src/sp/transport.h
@@ -180,7 +180,7 @@ struct nni_sp_pipe_ops {
// p_getopt is used to obtain an option. Pipes don't implement
// option setting.
- int (*p_getopt)(void *, const char *, void *, size_t *, nni_type);
+ nng_err (*p_getopt)(void *, const char *, void *, size_t *, nni_type);
};
// Transport implementation details. Transports must implement the
diff --git a/src/sp/transport/inproc/inproc.c b/src/sp/transport/inproc/inproc.c
index e87e9c4b..672c4d33 100644
--- a/src/sp/transport/inproc/inproc.c
+++ b/src/sp/transport/inproc/inproc.c
@@ -1,5 +1,5 @@
//
-// Copyright 2024 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2025 Staysail Systems, Inc. <info@staysail.tech>
// Copyright 2018 Capitar IT Group BV <info@capitar.com>
// Copyright 2018 Devolutions <info@devolutions.net>
//
@@ -577,7 +577,7 @@ static const nni_option inproc_pipe_options[] = {
},
};
-static int
+static nng_err
inproc_pipe_getopt(
void *arg, const char *name, void *v, size_t *szp, nni_type t)
{
diff --git a/src/sp/transport/ipc/ipc.c b/src/sp/transport/ipc/ipc.c
index a7b816a6..5fea1632 100644
--- a/src/sp/transport/ipc/ipc.c
+++ b/src/sp/transport/ipc/ipc.c
@@ -947,7 +947,7 @@ ipc_ep_accept(void *arg, nni_aio *aio)
nni_mtx_unlock(&ep->mtx);
}
-static int
+static nng_err
ipc_pipe_get(void *arg, const char *name, void *buf, size_t *szp, nni_type t)
{
ipc_pipe *p = arg;
diff --git a/src/sp/transport/socket/sockfd.c b/src/sp/transport/socket/sockfd.c
index 82db1163..9eea18f6 100644
--- a/src/sp/transport/socket/sockfd.c
+++ b/src/sp/transport/socket/sockfd.c
@@ -1,5 +1,5 @@
//
-// Copyright 2024 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2025 Staysail Systems, Inc. <info@staysail.tech>
// Copyright 2018 Capitar IT Group BV <info@capitar.com>
// Copyright 2019 Devolutions <info@devolutions.net>
//
@@ -546,7 +546,7 @@ sfd_tran_pipe_peer(void *arg)
return (p->peer);
}
-static int
+static nng_err
sfd_tran_pipe_getopt(
void *arg, const char *name, void *buf, size_t *szp, nni_type t)
{
diff --git a/src/sp/transport/tcp/tcp.c b/src/sp/transport/tcp/tcp.c
index 3ce193c5..c59ec5aa 100644
--- a/src/sp/transport/tcp/tcp.c
+++ b/src/sp/transport/tcp/tcp.c
@@ -567,7 +567,7 @@ tcptran_pipe_peer(void *arg)
return (p->peer);
}
-static int
+static nng_err
tcptran_pipe_getopt(
void *arg, const char *name, void *buf, size_t *szp, nni_type t)
{
diff --git a/src/sp/transport/tls/tls.c b/src/sp/transport/tls/tls.c
index a0072ddd..ed4fad05 100644
--- a/src/sp/transport/tls/tls.c
+++ b/src/sp/transport/tls/tls.c
@@ -1,5 +1,5 @@
//
-// Copyright 2024 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2025 Staysail Systems, Inc. <info@staysail.tech>
// Copyright 2018 Capitar IT Group BV <info@capitar.com>
// Copyright 2019 Devolutions <info@devolutions.net>
//
@@ -938,12 +938,12 @@ static const nni_option tlstran_pipe_opts[] = {
},
};
-static int
+static nng_err
tlstran_pipe_getopt(
void *arg, const char *name, void *buf, size_t *szp, nni_type t)
{
tlstran_pipe *p = arg;
- int rv;
+ nng_err rv;
if ((rv = nni_stream_get(p->tls, name, buf, szp, t)) == NNG_ENOTSUP) {
rv = nni_getopt(tlstran_pipe_opts, name, p, buf, szp, t);
diff --git a/src/sp/transport/udp/udp.c b/src/sp/transport/udp/udp.c
index 45260a1b..b068be03 100644
--- a/src/sp/transport/udp/udp.c
+++ b/src/sp/transport/udp/udp.c
@@ -1,4 +1,4 @@
-// Copyright 2024 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2025 Staysail Systems, Inc. <info@staysail.tech>
//
// This software is supplied under the terms of the MIT License, a
// copy of which should be located in the distribution where this
@@ -1082,7 +1082,7 @@ static nni_option udp_pipe_options[] = {
},
};
-static int
+static nng_err
udp_pipe_getopt(
void *arg, const char *name, void *buf, size_t *szp, nni_type t)
{
diff --git a/src/sp/transport/ws/websocket.c b/src/sp/transport/ws/websocket.c
index e236a5d6..23256edc 100644
--- a/src/sp/transport/ws/websocket.c
+++ b/src/sp/transport/ws/websocket.c
@@ -315,12 +315,12 @@ static const nni_option ws_pipe_options[] = {
}
};
-static int
+static nng_err
wstran_pipe_getopt(
void *arg, const char *name, void *buf, size_t *szp, nni_type t)
{
ws_pipe *p = arg;
- int rv;
+ nng_err rv;
if ((rv = nni_stream_get(p->ws, name, buf, szp, t)) == NNG_ENOTSUP) {
rv = nni_getopt(ws_pipe_options, name, p, buf, szp, t);