aboutsummaryrefslogtreecommitdiff
path: root/src/core/transport.h
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2018-08-27 11:14:33 -0700
committerGarrett D'Amore <garrett@damore.org>2018-08-27 15:33:29 -0700
commitde8aca84eba4f52741fd49d1a57d1fe20a2ec7f5 (patch)
tree32ceb0fb7da277c9ac45529afd06b84edba5c35a /src/core/transport.h
parent84a1e7455c158441dd7b33d2eb296cc33dd5a6df (diff)
downloadnng-de8aca84eba4f52741fd49d1a57d1fe20a2ec7f5.tar.gz
nng-de8aca84eba4f52741fd49d1a57d1fe20a2ec7f5.tar.bz2
nng-de8aca84eba4f52741fd49d1a57d1fe20a2ec7f5.zip
fixes #673 transports could benefit from access to upper layer
Diffstat (limited to 'src/core/transport.h')
-rw-r--r--src/core/transport.h19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/core/transport.h b/src/core/transport.h
index 8b08e366..8e5bba48 100644
--- a/src/core/transport.h
+++ b/src/core/transport.h
@@ -11,13 +11,6 @@
#ifndef CORE_TRANSPORT_H
#define CORE_TRANSPORT_H
-// Endpoint modes. Currently used by transports. Remove this when we make
-// transport dialers and listeners explicit.
-enum nni_ep_mode {
- NNI_EP_MODE_DIAL = 1,
- NNI_EP_MODE_LISTEN = 2,
-};
-
// We quite intentionally use a signature where the upper word is nonzero,
// which ensures that if we get garbage we will reject it. This is more
// likely to mismatch than all zero bytes would. The actual version is
@@ -31,7 +24,8 @@ enum nni_ep_mode {
#define NNI_TRANSPORT_V2 0x54520002
#define NNI_TRANSPORT_V3 0x54520003
#define NNI_TRANSPORT_V4 0x54520004
-#define NNI_TRANSPORT_VERSION NNI_TRANSPORT_V4
+#define NNI_TRANSPORT_V5 0x54520005
+#define NNI_TRANSPORT_VERSION NNI_TRANSPORT_V5
// Option handlers.
struct nni_tran_option {
@@ -68,7 +62,7 @@ struct nni_tran_option {
struct nni_tran_dialer_ops {
// d_init creates a vanilla dialer. The value created is
// used for the first argument for all other dialer functions.
- int (*d_init)(void **, nni_url *, nni_sock *);
+ int (*d_init)(void **, nni_url *, nni_dialer *);
// d_fini frees the resources associated with the dialer.
// The dialer will already have been closed.
@@ -93,7 +87,7 @@ struct nni_tran_dialer_ops {
struct nni_tran_listener_ops {
// l_init creates a vanilla listener. The value created is
// used for the first argument for all other listener functions.
- int (*l_init)(void **, nni_url *, nni_sock *);
+ int (*l_init)(void **, nni_url *, nni_listener *);
// l_fini frees the resources associated with the listener.
// The listener will already have been closed.
@@ -126,6 +120,11 @@ struct nni_tran_listener_ops {
// pointers back to socket or even enclosing pipe state, are not
// provided.)
struct nni_tran_pipe_ops {
+ // p_init initializes the pipe data structures. The main
+ // purpose of this is so that the pipe will see the upper
+ // layer nni_pipe and get a chance to register stats and such.
+ int (*p_init)(void *, nni_pipe *);
+
// p_fini destroys the pipe. This should clean up all local
// resources, including closing files and freeing memory, used
// by the pipe. After this call returns, the system will not