From e236dc8141f4d00dc926fbfba7739dabf96ebcdd Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Wed, 20 Sep 2017 12:11:53 -0700 Subject: More pipe option handling, pipe API support. Url option. This fleshes most of the pipe API out, making it available to end user code. It also adds a URL option that is independent of the address options (which would be sockaddrs.) Also, we are now setting the pipe for req/rep. The other protocols need to have the same logic added to set the receive pipe on the message. (Pair is already done.) --- src/core/options.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/core/options.c') diff --git a/src/core/options.c b/src/core/options.c index 76025710..b7934a06 100644 --- a/src/core/options.c +++ b/src/core/options.c @@ -135,6 +135,19 @@ nni_getopt_usec(nni_duration u, void *val, size_t *sizep) return (0); } +int +nni_getopt_sockaddr(const nng_sockaddr *sa, void *val, size_t *sizep) +{ + size_t sz = sizeof(*sa); + + if (sz > *sizep) { + sz = *sizep; + } + *sizep = sizeof(*sa); + memcpy(val, sa, sz); + return (0); +} + int nni_getopt_int(int i, void *val, size_t *sizep) { @@ -403,6 +416,7 @@ nni_option_sys_init(void) ((rv = OPT_REGISTER(remaddr)) != 0) || ((rv = OPT_REGISTER(recvfd)) != 0) || ((rv = OPT_REGISTER(sendfd)) != 0) || + ((rv = OPT_REGISTER(url)) != 0) || ((rv = OPT_REGISTER(req_resendtime)) != 0) || ((rv = OPT_REGISTER(sub_subscribe)) != 0) || ((rv = OPT_REGISTER(sub_unsubscribe)) != 0) || -- cgit v1.2.3-70-g09d2