aboutsummaryrefslogtreecommitdiff
path: root/src/core/protocol.h
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2016-12-29 23:49:05 -0800
committerGarrett D'Amore <garrett@damore.org>2016-12-29 23:49:05 -0800
commit0f5ed9c09bcbe0c0dabdf48ea14e85d418b3d8b6 (patch)
treeb2ea7f56ae0dc6d32219e695725f55d78b9e0b34 /src/core/protocol.h
parent5d90b485fdb39cac7d1aac2ab8958ecd585ac69b (diff)
downloadnng-0f5ed9c09bcbe0c0dabdf48ea14e85d418b3d8b6.tar.gz
nng-0f5ed9c09bcbe0c0dabdf48ea14e85d418b3d8b6.tar.bz2
nng-0f5ed9c09bcbe0c0dabdf48ea14e85d418b3d8b6.zip
Factor out repeated protocol code into common.
Diffstat (limited to 'src/core/protocol.h')
-rw-r--r--src/core/protocol.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/core/protocol.h b/src/core/protocol.h
index 63683a6b..a8e93ea7 100644
--- a/src/core/protocol.h
+++ b/src/core/protocol.h
@@ -20,9 +20,10 @@
// As a consequence, most of the concurrency in nng exists in the protocol
// implementations.
struct nni_protocol {
- uint16_t proto_self; // our 16-bit protocol ID
- uint16_t proto_peer; // who we peer with (protocol ID)
- const char * proto_name; // string version of our name
+ uint16_t proto_self; // our 16-bit protocol ID
+ uint16_t proto_peer; // who we peer with (ID)
+ const char * proto_name; // string version of our name
+ size_t proto_pipe_size; // pipe private data size
//Create protocol instance, which will be stored on the socket.
int (*proto_create)(void **, nni_socket *);
@@ -32,11 +33,17 @@ struct nni_protocol {
// Add and remove pipes. These are called as connections are
// created or destroyed.
- int (*proto_add_pipe)(void *, nni_pipe *, void **);
+ int (*proto_add_pipe)(void *, nni_pipe *, void *);
void (*proto_rem_pipe)(void *, void *);
+ // Thread functions for processing send & receive sides of
+ // protocol pipes. Send may be NULL, but recv should should not.
+ // (Recv needs to detect a closed pipe, if nothing else.)
+ void (*proto_pipe_send)(void *);
+ void (*proto_pipe_recv)(void *);
+
// Option manipulation. These may be NULL.
- int (*proto_setopt)(void *, int, const void *, size_t);
+ int (*proto_setopt)(void *, int, const void *, size_t);
int (*proto_getopt)(void *, int, void *, size_t *);
// Receive filter. This may be NULL, but if it isn't, then