From 9ca901c1b70b17d851426483d9f54611cfa8e395 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Mon, 19 Mar 2018 16:02:37 -0700 Subject: 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. --- src/core/socket.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/core/socket.h') diff --git a/src/core/socket.h b/src/core/socket.h index 30561d49..3af6bb9e 100644 --- a/src/core/socket.h +++ b/src/core/socket.h @@ -24,8 +24,10 @@ extern uint16_t nni_sock_proto(nni_sock *); extern uint16_t nni_sock_peer(nni_sock *); extern const char *nni_sock_proto_name(nni_sock *); extern const char *nni_sock_peer_name(nni_sock *); -extern int nni_sock_setopt(nni_sock *, const char *, const void *, size_t); -extern int nni_sock_getopt(nni_sock *, const char *, void *, size_t *); + +extern int nni_sock_setopt( + nni_sock *, const char *, const void *, size_t, int); +extern int nni_sock_getopt(nni_sock *, const char *, void *, size_t *, int); extern int nni_sock_recvmsg(nni_sock *, nni_msg **, int); extern int nni_sock_sendmsg(nni_sock *, nni_msg *, int); extern void nni_sock_send(nni_sock *, nni_aio *); -- cgit v1.2.3-70-g09d2