aboutsummaryrefslogtreecommitdiff
path: root/src/core/options.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-09-20 12:11:53 -0700
committerGarrett D'Amore <garrett@damore.org>2017-09-22 12:33:50 -0700
commite236dc8141f4d00dc926fbfba7739dabf96ebcdd (patch)
tree3c88190966eac4d888008d5076e7edd1817f64a2 /src/core/options.c
parentf04cfd27e2d67b0fc89b079410fc11b55b6d1979 (diff)
downloadnng-e236dc8141f4d00dc926fbfba7739dabf96ebcdd.tar.gz
nng-e236dc8141f4d00dc926fbfba7739dabf96ebcdd.tar.bz2
nng-e236dc8141f4d00dc926fbfba7739dabf96ebcdd.zip
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.)
Diffstat (limited to 'src/core/options.c')
-rw-r--r--src/core/options.c14
1 files changed, 14 insertions, 0 deletions
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
@@ -136,6 +136,19 @@ nni_getopt_usec(nni_duration u, void *val, size_t *sizep)
}
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)
{
size_t sz = sizeof(i);
@@ -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) ||