diff options
| author | Garrett D'Amore <garrett@damore.org> | 2018-03-19 16:02:37 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2018-03-20 09:53:58 -0700 |
| commit | 9ca901c1b70b17d851426483d9f54611cfa8e395 (patch) | |
| tree | a26b11e16f505ccdc77b5ac6681e0f9de705ff20 /src/transport/ipc | |
| parent | 9b886a9999247d87c9f6d389c3e65a4bd39be010 (diff) | |
| download | nng-9ca901c1b70b17d851426483d9f54611cfa8e395.tar.gz nng-9ca901c1b70b17d851426483d9f54611cfa8e395.tar.bz2 nng-9ca901c1b70b17d851426483d9f54611cfa8e395.zip | |
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.
Diffstat (limited to 'src/transport/ipc')
| -rw-r--r-- | src/transport/ipc/ipc.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/transport/ipc/ipc.c b/src/transport/ipc/ipc.c index fa59f0fe..9f95c2a9 100644 --- a/src/transport/ipc/ipc.c +++ b/src/transport/ipc/ipc.c @@ -703,10 +703,20 @@ nni_ipc_ep_get_addr(void *arg, void *data, size_t *szp) } static nni_tran_pipe_option nni_ipc_pipe_options[] = { - { NNG_OPT_REMADDR, nni_ipc_pipe_get_addr }, - { NNG_OPT_LOCADDR, nni_ipc_pipe_get_addr }, + { + .po_name = NNG_OPT_REMADDR, + .po_type = NNI_TYPE_SOCKADDR, + .po_getopt = nni_ipc_pipe_get_addr, + }, + { + .po_name = NNG_OPT_LOCADDR, + .po_type = NNI_TYPE_SOCKADDR, + .po_getopt = nni_ipc_pipe_get_addr, + }, // terminate list - { NULL, NULL }, + { + .po_name = NULL, + }, }; static nni_tran_pipe nni_ipc_pipe_ops = { @@ -722,16 +732,20 @@ static nni_tran_pipe nni_ipc_pipe_ops = { static nni_tran_ep_option nni_ipc_ep_options[] = { { .eo_name = NNG_OPT_RECVMAXSZ, + .eo_type = NNI_TYPE_SIZE, .eo_getopt = nni_ipc_ep_getopt_recvmaxsz, .eo_setopt = nni_ipc_ep_setopt_recvmaxsz, }, { .eo_name = NNG_OPT_LOCADDR, + .eo_type = NNI_TYPE_SOCKADDR, .eo_getopt = nni_ipc_ep_get_addr, .eo_setopt = NULL, }, // terminate list - { NULL, NULL, NULL }, + { + .eo_name = NULL, + }, }; static nni_tran_ep nni_ipc_ep_ops = { |
