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 /docs | |
| 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 'docs')
| -rw-r--r-- | docs/man/nng_dialer_getopt.3.adoc | 11 | ||||
| -rw-r--r-- | docs/man/nng_listener_getopt.3.adoc | 19 | ||||
| -rw-r--r-- | docs/man/nng_listener_setopt.3.adoc | 1 | ||||
| -rw-r--r-- | docs/man/nng_pipe_getopt.3.adoc | 10 |
4 files changed, 33 insertions, 8 deletions
diff --git a/docs/man/nng_dialer_getopt.3.adoc b/docs/man/nng_dialer_getopt.3.adoc index 61aaa576..3fde89d6 100644 --- a/docs/man/nng_dialer_getopt.3.adoc +++ b/docs/man/nng_dialer_getopt.3.adoc @@ -29,7 +29,9 @@ int nng_dialer_getopt_ms(nng_dialer d, const char *opt, nng_duration *durp); int nng_dialer_getopt_ptr(nng_dialer d, const char *opt, void **ptr); -int nng_dialer_setopt_size(nng_dialer d, const char *opt, size_t *zp); +int nng_dialer_getopt_size(nng_dialer d, const char *opt, size_t *zp); + +int nng_dialer_getopt_sockaddr(nng_dialer d, const char *opt, nng_sockaddr *sap); int nng_dialer_getopt_uint64(nng_dialer d, const char *opt, uint64_t *u64p); ---- @@ -79,7 +81,7 @@ the object. ==== `nng_dialer_getopt_bool()` This function is for options which take a boolean (`bool`). -The value will be stored at _ivalp_. +The value will be stored at _bvalp_. ==== `nng_dialer_getopt_int()` This function is for options which take an integer (`int`). @@ -101,6 +103,10 @@ not copied, but instead the *pointer* to the object is copied. This function is used to retrieve a size into the pointer _zp_, typically for buffer sizes, message maximum sizes, and similar options. +==== `nng_dialer_getopt_sockaddr()` +This function is used to retrieve an <<nng_sockaddr.5#,`nng_sockaddr`>> +into the value referenced by _sap_. + ==== `nng_dialer_getopt_uint64()` This function is used to retrieve a 64-bit unsigned value into the value referenced by _u64p_. @@ -125,4 +131,5 @@ These functions returns 0 on success, and non-zero otherwise. <<nng_dialer.5#,nng_dialer(5)>>, <<nng_duration.5#,nng_duration(5)>>, <<nng_options.5#,nng_options(5)>>, +<<nng_sockaddr.5#,nng_sockaddr(5)>>, <<nng.7#,nng(7)>> diff --git a/docs/man/nng_listener_getopt.3.adoc b/docs/man/nng_listener_getopt.3.adoc index 6b2c2fde..1bafd1d6 100644 --- a/docs/man/nng_listener_getopt.3.adoc +++ b/docs/man/nng_listener_getopt.3.adoc @@ -19,8 +19,7 @@ nng_listener_getopt - get listener option ---- #include <nng/nng.h> -int nng_listener_getopt(nng_listener l, const char *opt, void *val, - size_t *valszp); +int nng_listener_getopt(nng_listener l, const char *opt, void *val, size_t *valszp); int nng_listener_getopt_bool(nng_listener l, const char *opt, bool *bvalp); @@ -30,7 +29,9 @@ int nng_listener_getopt_ms(nng_listener l, const char *opt, nng_duration *durp); int nng_listener_getopt_ptr(nng_listener l, const char *opt, void **ptr); -int nng_listener_setopt_size(nng_listener l, const char *opt, size_t *zp); +int nng_listener_getopt_size(nng_listener l, const char *opt, size_t *zp); + +int nng_listener_getopt_sockaddr(nng_listener l, const char *opt, nng_sockaddr *sap); int nng_listener_getopt_uint64(nng_listener l, const char *opt, uint64_t *u64p); ---- @@ -80,7 +81,7 @@ the object. ==== `nng_listener_getopt_bool()` This function is for options which take a boolean (`bool`). -The value will be stored at _ivalp_. +The value will be stored at _bvalp_. ==== `nng_listener_getopt_int()` This function is for options which take an integer (`int`). @@ -89,8 +90,6 @@ The value will be stored at _ivalp_. ==== `nng_listener_getopt_ms()` This function is used to retrieve time <<nng_duration.5#,durations>> (such as timeouts), stored in _durp_ as a number of milliseconds. -(The special value ((`NNG_DUR_INFINITE`)) means an infinite amount of time, and -the special value ((`NNG_DUR_DEFAULT`)) means a context-specific default.) ==== `nng_listener_getopt_ptr()` This function is used to retrieve a pointer, _ptr_, to structured data. @@ -102,6 +101,10 @@ not copied, but instead the *pointer* to the object is copied. This function is used to retrieve a size into the pointer _zp_, typically for buffer sizes, message maximum sizes, and similar options. +==== `nng_listener_getopt_sockaddr()` +This function is used to retrieve an <<nng_sockaddr.5#,`nng_sockaddr`>> +into the value referenced by _sap_. + ==== `nng_listener_getopt_uint64()` This function is used to retrieve a 64-bit unsigned value into the value referenced by _u64p_. @@ -125,4 +128,8 @@ These functions return 0 on success, and non-zero otherwise. <<nng_listener_setopt.3#,nng_listener_setopt(3)>> <<nng_getopt.3#,nng_getopt(3)>>, <<nng_strerror.3#,nng_strerror(3)>>, +<<nng_duration.5#,nng_duration(5)>>, +<<nng_listener.5#,nng_listener(5)>>, +<<nng_options.5#,nng_options(5)>>, +<<nng_sockaddr.5#,nng_sockaddr(5)>>, <<nng.7#,nng(7)>> diff --git a/docs/man/nng_listener_setopt.3.adoc b/docs/man/nng_listener_setopt.3.adoc index 93cae9ab..03a33a57 100644 --- a/docs/man/nng_listener_setopt.3.adoc +++ b/docs/man/nng_listener_setopt.3.adoc @@ -123,6 +123,7 @@ These functions return 0 on success, and non-zero otherwise. <<nng_listener_getopt.3#,nng_listener_getopt(3)>> <<nng_setopt.3#,nng_setopt(3)>>, <<nng_strerror.3#,nng_strerror(3)>>, +<<nng_duration.5#,nng_duration(5)>>, <<nng_listener.5#,nng_listener(5)>>, <<nng_options.5#,nng_options(5)>>, <<nng.7#,nng(7)>> diff --git a/docs/man/nng_pipe_getopt.3.adoc b/docs/man/nng_pipe_getopt.3.adoc index 3198fc21..fd607198 100644 --- a/docs/man/nng_pipe_getopt.3.adoc +++ b/docs/man/nng_pipe_getopt.3.adoc @@ -29,6 +29,8 @@ int nng_pipe_getopt_ms(nng_pipe p, const char *opt, nng_duration *durp); int nng_dialer_getopt_ptr(nng_pipe p, const char *opt, void **ptr); +int nng_pipe_getopt_sockaddr(nng_pipe p, const char *opt, nng_sockaddr *sap); + int nng_pipe_getopt_size(nng_pipe p, const char *opt, size_t *zp); int nng_pipe_getopt_uint64(nng_pipe p, const char *opt, uint64_t *u64p); @@ -110,6 +112,11 @@ not copied, but instead the *pointer* to the object is copied. This function is used to retrieve a size into the pointer _zp_, typically for buffer sizes, message maximum sizes, and similar options. +==== `nng_pipe_getopt_sockaddr()` + +This function is used to retrieve an <<nng_sockaddr.5#,`nng_sockaddr`>> +into _sap_. + ==== `nng_pipe_getopt_uint64()` This function is used to retriev a 64-bit unsigned value into the value @@ -134,5 +141,8 @@ These functions return 0 on success, and non-zero otherwise. <<nng_listener_setopt.3#,nng_listener_setopt(3)>> <<nng_msg_get_pipe.3#,nng_msg_get_pipe(3)>> <<nng_strerror.3#,nng_strerror(3)>>, +<<nng_duration.5#,nng_duration(5)>>, <<nng_options.5#,nng_options(5)>>, +<<nng_pipe.5#,nng_pipe(5)>>, +<<nng_sockaddr.5#,nng_sockaddr(5)>>, <<nng.7#,nng(7)>> |
