aboutsummaryrefslogtreecommitdiff
path: root/src/core/protocol.h
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-01-21 20:16:02 -0800
committerGarrett D'Amore <garrett@damore.org>2017-01-21 20:16:02 -0800
commit68e2aea44d766c6dbe438642d2591875602c78b4 (patch)
tree5f5c2db8b976e940305ba8d911208b613e578476 /src/core/protocol.h
parentc9593dfc5796a98b94ef516fce662f2e040acffe (diff)
downloadnng-68e2aea44d766c6dbe438642d2591875602c78b4.tar.gz
nng-68e2aea44d766c6dbe438642d2591875602c78b4.tar.bz2
nng-68e2aea44d766c6dbe438642d2591875602c78b4.zip
Added protocol flags (which ones can send, and which can receive).
Diffstat (limited to 'src/core/protocol.h')
-rw-r--r--src/core/protocol.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/core/protocol.h b/src/core/protocol.h
index 11c4c304..82ebd88f 100644
--- a/src/core/protocol.h
+++ b/src/core/protocol.h
@@ -92,10 +92,18 @@ struct nni_proto {
uint16_t proto_self; // our 16-bit D
uint16_t proto_peer; // who we peer with (ID)
const char * proto_name; // Our name
+ uint16_t proto_flags; // Protocol flags
const nni_proto_sock_ops * proto_sock_ops; // Per-socket opeations
const nni_proto_pipe_ops * proto_pipe_ops; // Per-pipe operations.
};
+// These flags determine which operations make sense. We use them so that
+// we can reject attempts to create notification fds for operations that make
+// no sense.
+#define NNI_PROTO_FLAG_RECV 1 // Protocol can receive
+#define NNI_PROTO_FLAG_SEND 2 // Protocol can send
+#define NNI_PROTO_FLAG_SENDRECV 3 // Protocol can both send & recv
+
// These functions are not used by protocols, but rather by the socket
// core implementation. The lookups can be used by transports as well.
extern nni_proto *nni_proto_find(uint16_t);