diff options
| author | Garrett D'Amore <garrett@damore.org> | 2025-04-27 23:35:25 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2025-04-27 23:35:25 -0700 |
| commit | 7bb5ab9c4f70c9fa0a67a22c4aee83b0109318c4 (patch) | |
| tree | 5a3036d609404ee5218b6189a89799e70f4623df /src/platform/windows | |
| parent | 70ae513e4dda50864f7d45b6676549ed5246144d (diff) | |
| download | nng-7bb5ab9c4f70c9fa0a67a22c4aee83b0109318c4.tar.gz nng-7bb5ab9c4f70c9fa0a67a22c4aee83b0109318c4.tar.bz2 nng-7bb5ab9c4f70c9fa0a67a22c4aee83b0109318c4.zip | |
Converted property functions to use nng_err.
Diffstat (limited to 'src/platform/windows')
| -rw-r--r-- | src/platform/windows/win_ipcconn.c | 8 | ||||
| -rw-r--r-- | src/platform/windows/win_ipcdial.c | 6 | ||||
| -rw-r--r-- | src/platform/windows/win_ipclisten.c | 4 | ||||
| -rw-r--r-- | src/platform/windows/win_tcpconn.c | 8 | ||||
| -rw-r--r-- | src/platform/windows/win_tcpdial.c | 28 | ||||
| -rw-r--r-- | src/platform/windows/win_tcplisten.c | 41 |
6 files changed, 49 insertions, 46 deletions
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) { |
