diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-11-09 09:25:22 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2024-11-11 10:31:44 -0800 |
| commit | 3163a56e06a58abb10c753fc77da388234d580c2 (patch) | |
| tree | a35a02af1590d94cedb5fbcaef7de535d8e5b73e /src/core | |
| parent | 18d7519234f456a487623d93bcb6daa121d0ce17 (diff) | |
| download | nng-3163a56e06a58abb10c753fc77da388234d580c2.tar.gz nng-3163a56e06a58abb10c753fc77da388234d580c2.tar.bz2 nng-3163a56e06a58abb10c753fc77da388234d580c2.zip | |
Add nng_sub0_subscribe and friends.
These are new functions that replace `NNG_OPT_SUBSCRIBE` and
`NNG_OPT_UNSUBSCRIBE`. They are provided here as a transition
aid before those options are removed in NNG 2.0.
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/socket.c | 18 | ||||
| -rw-r--r-- | src/core/socket.h | 6 |
2 files changed, 23 insertions, 1 deletions
diff --git a/src/core/socket.c b/src/core/socket.c index bf550a24..241b0401 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -889,12 +889,30 @@ nni_sock_proto_pipe_ops(nni_sock *sock) return (&sock->s_pipe_ops); } +struct nni_proto_sock_ops * +nni_sock_proto_ops(nni_sock *sock) +{ + return (&sock->s_sock_ops); +} + +struct nni_proto_ctx_ops * +nni_ctx_proto_ops(nni_ctx *ctx) +{ + return (&ctx->c_ops); +} + void * nni_sock_proto_data(nni_sock *sock) { return (sock->s_data); } +void * +nni_ctx_proto_data(nni_ctx *ctx) +{ + return (ctx->c_data); +} + int nni_sock_add_listener(nni_sock *s, nni_listener *l) { diff --git a/src/core/socket.h b/src/core/socket.h index 343310ca..d4bf1a97 100644 --- a/src/core/socket.h +++ b/src/core/socket.h @@ -1,5 +1,5 @@ // -// Copyright 2021 Staysail Systems, Inc. <info@staysail.tech> +// Copyright 2024 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 @@ -26,7 +26,9 @@ extern bool nni_sock_raw(nni_sock *); extern void *nni_sock_proto_data(nni_sock *); extern void nni_sock_add_stat(nni_sock *, nni_stat_item *); +extern struct nni_proto_sock_ops *nni_sock_proto_ops(nni_sock *); extern struct nni_proto_pipe_ops *nni_sock_proto_pipe_ops(nni_sock *); +extern struct nni_proto_ctx_ops *nni_ctx_proto_ops(nni_ctx *); extern int nni_sock_setopt( nni_sock *, const char *, const void *, size_t, nni_opt_type); @@ -89,6 +91,8 @@ extern void nni_ctx_close(nni_ctx *); // nni_ctx_id returns the context ID, which can be used with nni_ctx_find. extern uint32_t nni_ctx_id(nni_ctx *); +extern void *nni_ctx_proto_data(nni_ctx *); + // nni_ctx_recv receives asynchronously. extern void nni_ctx_recv(nni_ctx *, nni_aio *); |
