aboutsummaryrefslogtreecommitdiff
path: root/src/protocol/pipeline0
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2018-03-18 12:46:31 -0700
committerGarrett D'Amore <garrett@damore.org>2018-03-18 12:46:31 -0700
commit8b979454d891b84da727a329906c4293fadc5f3c (patch)
treecb491c476080de11c7fc5b5868579f4ef86f4df4 /src/protocol/pipeline0
parent3a2af394a7d94ac5f924aaea6cbad825a9b05d75 (diff)
downloadnng-8b979454d891b84da727a329906c4293fadc5f3c.tar.gz
nng-8b979454d891b84da727a329906c4293fadc5f3c.tar.bz2
nng-8b979454d891b84da727a329906c4293fadc5f3c.zip
fixes #295 boolean options should use C99 bool type
fixes #275 nng_pipe_getopt_ptr() missing? fixes #285 nng_setopt_ptr MIS fixes #297 nng_listener/dialer_close does not validate mode This change adds some missing APIs, and changes others. In particular, certain options are now of type bool, with size of just one. This is a *breaking* change for code that uses those options -- NNG_OPT_RAW, NNG_OPT_PAIR1_POLY, NNG_OPT_TLS_VERIFIED.
Diffstat (limited to 'src/protocol/pipeline0')
-rw-r--r--src/protocol/pipeline0/pull.c8
-rw-r--r--src/protocol/pipeline0/push.c8
2 files changed, 8 insertions, 8 deletions
diff --git a/src/protocol/pipeline0/pull.c b/src/protocol/pipeline0/pull.c
index ccc1ef40..5e0a9d00 100644
--- a/src/protocol/pipeline0/pull.c
+++ b/src/protocol/pipeline0/pull.c
@@ -34,7 +34,7 @@ static void pull0_putq(pull0_pipe *, nni_msg *);
// pull0_sock is our per-socket protocol private structure.
struct pull0_sock {
nni_msgq *urq;
- int raw;
+ bool raw;
};
// pull0_pipe is our per-pipe protocol private structure.
@@ -53,7 +53,7 @@ pull0_sock_init(void **sp, nni_sock *sock)
if ((s = NNI_ALLOC_STRUCT(s)) == NULL) {
return (NNG_ENOMEM);
}
- s->raw = 0;
+ s->raw = false;
s->urq = nni_sock_recvq(sock);
*sp = s;
@@ -184,14 +184,14 @@ static int
pull0_sock_setopt_raw(void *arg, const void *buf, size_t sz)
{
pull0_sock *s = arg;
- return (nni_setopt_int(&s->raw, buf, sz, 0, 1));
+ return (nni_setopt_bool(&s->raw, buf, sz));
}
static int
pull0_sock_getopt_raw(void *arg, void *buf, size_t *szp)
{
pull0_sock *s = arg;
- return (nni_getopt_int(s->raw, buf, szp));
+ return (nni_getopt_bool(s->raw, buf, szp));
}
static void
diff --git a/src/protocol/pipeline0/push.c b/src/protocol/pipeline0/push.c
index e77bfe99..a0dfa397 100644
--- a/src/protocol/pipeline0/push.c
+++ b/src/protocol/pipeline0/push.c
@@ -36,7 +36,7 @@ static void push0_getq_cb(void *);
// push0_sock is our per-socket protocol private structure.
struct push0_sock {
nni_msgq *uwq;
- int raw;
+ bool raw;
};
// push0_pipe is our per-pipe protocol private structure.
@@ -58,7 +58,7 @@ push0_sock_init(void **sp, nni_sock *sock)
if ((s = NNI_ALLOC_STRUCT(s)) == NULL) {
return (NNG_ENOMEM);
}
- s->raw = 0;
+ s->raw = false;
s->uwq = nni_sock_sendq(sock);
*sp = s;
return (0);
@@ -201,14 +201,14 @@ static int
push0_sock_setopt_raw(void *arg, const void *buf, size_t sz)
{
push0_sock *s = arg;
- return (nni_setopt_int(&s->raw, buf, sz, 0, 1));
+ return (nni_setopt_bool(&s->raw, buf, sz));
}
static int
push0_sock_getopt_raw(void *arg, void *buf, size_t *szp)
{
push0_sock *s = arg;
- return (nni_getopt_int(s->raw, buf, szp));
+ return (nni_getopt_bool(s->raw, buf, szp));
}
static void