aboutsummaryrefslogtreecommitdiff
path: root/src/protocol/pubsub/pub.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/protocol/pubsub/pub.c')
-rw-r--r--src/protocol/pubsub/pub.c43
1 files changed, 21 insertions, 22 deletions
diff --git a/src/protocol/pubsub/pub.c b/src/protocol/pubsub/pub.c
index 10a9760f..03f4603a 100644
--- a/src/protocol/pubsub/pub.c
+++ b/src/protocol/pubsub/pub.c
@@ -268,27 +268,17 @@ pub_pipe_send_cb(void *arg)
}
static int
-pub_sock_setopt(void *arg, int opt, const void *buf, size_t sz)
+pub_sock_setopt_raw(void *arg, const void *buf, size_t sz)
{
- pub_sock *s = arg;
- int rv = NNG_ENOTSUP;
-
- if (opt == nng_optid_raw) {
- rv = nni_setopt_int(&s->raw, buf, sz, 0, 1);
- }
- return (rv);
+ pub_sock *s = arg;
+ return (nni_setopt_int(&s->raw, buf, sz, 0, 1));
}
static int
-pub_sock_getopt(void *arg, int opt, void *buf, size_t *szp)
+pub_sock_getopt_raw(void *arg, void *buf, size_t *szp)
{
- pub_sock *s = arg;
- int rv = NNG_ENOTSUP;
-
- if (opt == nng_optid_raw) {
- rv = nni_getopt_int(s->raw, buf, szp);
- }
- return (rv);
+ pub_sock *s = arg;
+ return (nni_getopt_int(s->raw, buf, szp));
}
static nni_proto_pipe_ops pub_pipe_ops = {
@@ -298,13 +288,22 @@ static nni_proto_pipe_ops pub_pipe_ops = {
.pipe_stop = pub_pipe_stop,
};
+static nni_proto_sock_option pub_sock_options[] = {
+ {
+ .pso_name = NNG_OPT_RAW,
+ .pso_getopt = pub_sock_getopt_raw,
+ .pso_setopt = pub_sock_setopt_raw,
+ },
+ // terminate list
+ { NULL, NULL, NULL },
+};
+
static nni_proto_sock_ops pub_sock_ops = {
- .sock_init = pub_sock_init,
- .sock_fini = pub_sock_fini,
- .sock_open = pub_sock_open,
- .sock_close = pub_sock_close,
- .sock_setopt = pub_sock_setopt,
- .sock_getopt = pub_sock_getopt,
+ .sock_init = pub_sock_init,
+ .sock_fini = pub_sock_fini,
+ .sock_open = pub_sock_open,
+ .sock_close = pub_sock_close,
+ .sock_options = pub_sock_options,
};
static nni_proto pub_proto = {