aboutsummaryrefslogtreecommitdiff
path: root/src/core/socket.h
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2018-05-02 16:01:22 -0700
committerGarrett D'Amore <garrett@damore.org>2018-05-03 06:41:19 -0700
commit159dc95695515db767e208c41d5f44b334b71adc (patch)
tree5390251d939c33b1d274d0767861d2012673e258 /src/core/socket.h
parent649e5d5ca9a03cef766e944c7735aab50041c012 (diff)
downloadnng-159dc95695515db767e208c41d5f44b334b71adc.tar.gz
nng-159dc95695515db767e208c41d5f44b334b71adc.tar.bz2
nng-159dc95695515db767e208c41d5f44b334b71adc.zip
fixes #389 Need pipe notification callbacks
This adds a new pipe event notification API (callbacks called on either pipe add or remove), including both tests and docs. Also supporting APIs to get the socket or endpoint associated with a pipe are included (tested and documented as well.)
Diffstat (limited to 'src/core/socket.h')
-rw-r--r--src/core/socket.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/core/socket.h b/src/core/socket.h
index 87bf1374..bccda5b3 100644
--- a/src/core/socket.h
+++ b/src/core/socket.h
@@ -41,7 +41,7 @@ extern uint32_t nni_sock_id(nni_sock *);
// a pipe could wind up orphaned.
extern int nni_sock_pipe_add(nni_sock *, nni_pipe *);
extern void nni_sock_pipe_remove(nni_sock *, nni_pipe *);
-extern int nni_sock_pipe_start(nni_sock *, nni_pipe *p);
+extern int nni_sock_pipe_start(nni_sock *, nni_pipe *);
extern int nni_sock_ep_add(nni_sock *, nni_ep *);
extern void nni_sock_ep_remove(nni_sock *, nni_ep *);
@@ -64,6 +64,13 @@ extern void nni_sock_reconntimes(nni_sock *, nni_duration *, nni_duration *);
// and or write are appropriate for the protocol.
extern uint32_t nni_sock_flags(nni_sock *);
+// This function is used by the public API to set callbacks. It is
+// one of the only cases (the only?) where the socket core understands
+// the public data types. (Other solutions might exist, but they require
+// keeping extra state to support conversion between public and internal
+// types.)
+extern void nni_sock_set_pipe_cb(nni_sock *sock, nng_pipe_cb, void *);
+
// nni_ctx_open is used to open/create a new context structure.
// Contexts are not supported by most protocols, but for those that do,
// this can offer some improvements for massive concurrency/scalability.