aboutsummaryrefslogtreecommitdiff
path: root/src/sp
diff options
context:
space:
mode:
Diffstat (limited to 'src/sp')
-rw-r--r--src/sp/transport.h22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/sp/transport.h b/src/sp/transport.h
index b7134595..10207f28 100644
--- a/src/sp/transport.h
+++ b/src/sp/transport.h
@@ -12,6 +12,7 @@
#ifndef PROTOCOL_SP_TRANSPORT_H
#define PROTOCOL_SP_TRANSPORT_H
+#include "core/defs.h"
#include "core/options.h"
// Endpoint operations are called by the socket in a
@@ -25,6 +26,10 @@
// against any asynchronous operations they manage themselves, though.)
struct nni_sp_dialer_ops {
+ // d_size is the size of transport specific data allocated
+ // to the listener.
+ size_t d_size;
+
// d_init creates a vanilla dialer. The value created is
// used for the first argument for all other dialer functions.
int (*d_init)(void **, nng_url *, nni_dialer *);
@@ -64,6 +69,10 @@ struct nni_sp_dialer_ops {
};
struct nni_sp_listener_ops {
+ // l_size is the size of transport specific data allocated
+ // to the listener.
+ size_t l_size;
+
// l_init creates a vanilla listener. The value created is
// used for the first argument for all other listener functions.
int (*l_init)(void **, nng_url *, nni_listener *);
@@ -121,20 +130,27 @@ struct nni_sp_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.
+ size_t p_size;
+
+ // p_init initializes the transport's pipe data structure.
+ // The pipe MUST be left in a state that p_fini can be safely
+ // called on it, even if it does not succeed. (The upper layers
+ // will call p_fini as part of the cleanup of a failure.)
+ // This function should not acquire any locks.
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
- // make further calls on the same pipe.
+ // make further calls on the same pipe. This call should not block.
void (*p_fini)(void *);
// p_stop stops the pipe, waiting for any callbacks that are
// outstanding to complete. This is done before tearing down
- // resources with p_fini.
+ // resources with p_fini. Unlike p_fini, p_stop may block.
void (*p_stop)(void *);
- // p_aio_send queues the message for transmit. If this fails,
+ // p_send queues the message for transmit. If this fails,
// then the caller may try again with the same message (or free
// it). If the call succeeds, then the transport has taken
// ownership of the message, and the caller may not use it