aboutsummaryrefslogtreecommitdiff
path: root/src/protocol/pubsub0
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2018-03-19 16:02:37 -0700
committerGarrett D'Amore <garrett@damore.org>2018-03-20 09:53:58 -0700
commit9ca901c1b70b17d851426483d9f54611cfa8e395 (patch)
treea26b11e16f505ccdc77b5ac6681e0f9de705ff20 /src/protocol/pubsub0
parent9b886a9999247d87c9f6d389c3e65a4bd39be010 (diff)
downloadnng-9ca901c1b70b17d851426483d9f54611cfa8e395.tar.gz
nng-9ca901c1b70b17d851426483d9f54611cfa8e395.tar.bz2
nng-9ca901c1b70b17d851426483d9f54611cfa8e395.zip
fixes #296 Typed options should validate option type
fixes #302 nng_dialer/listener/pipe_getopt_sockaddr desired This adds plumbing to pass and check the type of options all the way through. NNG_ZT_OPT_ORBIT is type UINT64, but you can use the untyped form to pass two of them if needed. No typed access for retrieving strings yet. I think this should allocate a pointer and copy that out, but that's for later.
Diffstat (limited to 'src/protocol/pubsub0')
-rw-r--r--src/protocol/pubsub0/pub.c5
-rw-r--r--src/protocol/pubsub0/sub.c7
2 files changed, 10 insertions, 2 deletions
diff --git a/src/protocol/pubsub0/pub.c b/src/protocol/pubsub0/pub.c
index ff110d56..36c27e7f 100644
--- a/src/protocol/pubsub0/pub.c
+++ b/src/protocol/pubsub0/pub.c
@@ -312,11 +312,14 @@ static nni_proto_pipe_ops pub0_pipe_ops = {
static nni_proto_sock_option pub0_sock_options[] = {
{
.pso_name = NNG_OPT_RAW,
+ .pso_type = NNI_TYPE_BOOL,
.pso_getopt = pub0_sock_getopt_raw,
.pso_setopt = pub0_sock_setopt_raw,
},
// terminate list
- { NULL, NULL, NULL },
+ {
+ .pso_name = NULL,
+ },
};
static nni_proto_sock_ops pub0_sock_ops = {
diff --git a/src/protocol/pubsub0/sub.c b/src/protocol/pubsub0/sub.c
index d9d0d5f3..cb7b0509 100644
--- a/src/protocol/pubsub0/sub.c
+++ b/src/protocol/pubsub0/sub.c
@@ -361,21 +361,26 @@ static nni_proto_pipe_ops sub0_pipe_ops = {
static nni_proto_sock_option sub0_sock_options[] = {
{
.pso_name = NNG_OPT_RAW,
+ .pso_type = NNI_TYPE_BOOL,
.pso_getopt = sub0_sock_getopt_raw,
.pso_setopt = sub0_sock_setopt_raw,
},
{
.pso_name = NNG_OPT_SUB_SUBSCRIBE,
+ .pso_type = NNI_TYPE_OPAQUE,
.pso_getopt = NULL,
.pso_setopt = sub0_subscribe,
},
{
.pso_name = NNG_OPT_SUB_UNSUBSCRIBE,
+ .pso_type = NNI_TYPE_OPAQUE,
.pso_getopt = NULL,
.pso_setopt = sub0_unsubscribe,
},
// terminate list
- { NULL, NULL, NULL },
+ {
+ .pso_name = NULL,
+ },
};
static nni_proto_sock_ops sub0_sock_ops = {