diff options
| author | Garrett D'Amore <garrett@damore.org> | 2018-12-29 18:54:22 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2018-12-29 18:54:22 -0800 |
| commit | 27b7827532abcbdbecc54795da5b5ac66e7f5e9f (patch) | |
| tree | 7c8fad19dbb874af35324603204aae87f93d63b8 /src/core | |
| parent | 5b35daaf2fe6c6fbe0b15740efbffe16ff278e6c (diff) | |
| download | nng-27b7827532abcbdbecc54795da5b5ac66e7f5e9f.tar.gz nng-27b7827532abcbdbecc54795da5b5ac66e7f5e9f.tar.bz2 nng-27b7827532abcbdbecc54795da5b5ac66e7f5e9f.zip | |
progress on IPC endpoints
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/dialer.c | 14 | ||||
| -rw-r--r-- | src/core/listener.c | 1 | ||||
| -rw-r--r-- | src/core/platform.h | 29 |
3 files changed, 41 insertions, 3 deletions
diff --git a/src/core/dialer.c b/src/core/dialer.c index a74f30f0..0c800333 100644 --- a/src/core/dialer.c +++ b/src/core/dialer.c @@ -1,6 +1,7 @@ // // Copyright 2018 Staysail Systems, Inc. <info@staysail.tech> // Copyright 2018 Capitar IT Group BV <info@capitar.com> +// Copyright 2018 Devolutions <info@devolutions.net> // // This software is supplied under the terms of the MIT License, a // copy of which should be located in the distribution where this @@ -412,6 +413,13 @@ nni_dialer_setopt(nni_dialer *d, const char *name, const void *val, size_t sz, return (rv); } + if (d->d_ops.d_setopt != NULL) { + int rv = d->d_ops.d_setopt(d->d_data, name, val, sz, t); + if (rv != NNG_ENOTSUP) { + return (rv); + } + } + for (o = d->d_ops.d_options; o && o->o_name; o++) { if (strcmp(o->o_name, name) != 0) { continue; @@ -447,6 +455,12 @@ nni_dialer_getopt( return (rv); } + if (d->d_ops.d_getopt != NULL) { + int rv = d->d_ops.d_getopt(d->d_data, name, valp, szp, t); + if (rv != NNG_ENOTSUP) { + return (rv); + } + } for (o = d->d_ops.d_options; o && o->o_name; o++) { if (strcmp(o->o_name, name) != 0) { continue; diff --git a/src/core/listener.c b/src/core/listener.c index 83f6ca41..bb46b6cb 100644 --- a/src/core/listener.c +++ b/src/core/listener.c @@ -1,6 +1,7 @@ // // Copyright 2018 Staysail Systems, Inc. <info@staysail.tech> // Copyright 2018 Capitar IT Group BV <info@capitar.com> +// Copyright 2018 Devolutions <info@devolutions.net> // // This software is supplied under the terms of the MIT License, a // copy of which should be located in the distribution where this diff --git a/src/core/platform.h b/src/core/platform.h index a512c39f..b6916b2e 100644 --- a/src/core/platform.h +++ b/src/core/platform.h @@ -1,7 +1,7 @@ // // Copyright 2018 Staysail Systems, Inc. <info@staysail.tech> // Copyright 2018 Capitar IT Group BV <info@capitar.com> -// Copyright 2018 Devolutions <infos@devolutions.net> +// Copyright 2018 Devolutions <info@devolutions.net> // // This software is supplied under the terms of the MIT License, a // copy of which should be located in the distribution where this @@ -380,14 +380,14 @@ extern int nni_ipc_conn_get_peer_zoneid(nni_ipc_conn *, uint64_t *); // are the same names from the IPC transport, generally. There are no // options that are generally settable on an IPC connection. extern int nni_ipc_conn_setopt( - nni_ipc_conn *, const char *, const void *, size_t, nni_opt_type); + nni_ipc_conn *, const char *, const void *, size_t, nni_type); // nni_ipc_conn_getopt is like getsockopt, but uses string names. // We support NNG_OPT_REMADDR and NNG_OPT_LOCADDR (with argument type // nng_sockaddr), and on some platforms NNG_OPT_IPC_PEER_[UID,GID,ZONEID] // (with type uint64_t.) extern int nni_ipc_conn_getopt( - nni_ipc_conn *, const char *, void *, size_t *, nni_opt_type); + nni_ipc_conn *, const char *, void *, size_t *, nni_type); // nni_ipc_dialer_init creates a new dialer object. extern int nni_ipc_dialer_init(nni_ipc_dialer **); @@ -407,6 +407,16 @@ extern void nni_ipc_dialer_close(nni_ipc_dialer *); extern void nni_ipc_dialer_dial( nni_ipc_dialer *, const nni_sockaddr *, nni_aio *); +// nni_ipc_dialer_getopt is used to get options from the dialer. +// At present there aren't any defined options. +extern int nni_ipc_dialer_getopt( + nni_ipc_dialer *, const char *, void *, size_t *, nni_type); + +// nni_ipc_dialer_setopt sets an option for the dialer. There aren't +// any options defined at present. +extern int nni_ipc_dialer_setopt( + nni_ipc_dialer *, const char *, const void *, size_t, nni_type); + // nni_ipc_listener_init creates a new listener object, unbound. extern int nni_ipc_listener_init(nni_ipc_listener **); @@ -445,6 +455,19 @@ extern int nni_ipc_listener_set_permissions(nni_ipc_listener *, int); extern int nni_ipc_listener_set_security_descriptor( nni_ipc_listener *, void *); +// nni_ipc_listener_getopt is used to get options from the listener. +// The only valid option is NNG_OPT_LOCADDR, which will only have +// a valid value if the socket is bound, otherwise the value returned +// will be of type NNG_AF_UNSPEC. +extern int nni_ipc_listener_getopt( + nni_ipc_listener *, const char *, void *, size_t *, nni_type); + +// nni_ipc_listener_setopt sets an option for the listener. The only +// valid options are NNG_OPT_IPC_SECURITY_DESCRIPTORS (Windows) and +// NNG_OPT_IPC_PERMISSIONS (POSIX). +extern int nni_ipc_listener_setopt( + nni_ipc_listener *, const char *, const void *, size_t, nni_type); + // // UDP support. UDP is not connection oriented, and only has the notion // of being bound, sendto, and recvfrom. (It is possible to set up a |
