From de8aca84eba4f52741fd49d1a57d1fe20a2ec7f5 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Mon, 27 Aug 2018 11:14:33 -0700 Subject: fixes #673 transports could benefit from access to upper layer --- src/core/transport.h | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/core/transport.h') 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 -- cgit v1.2.3-70-g09d2