diff options
| author | Garrett D'Amore <garrett@damore.org> | 2018-03-18 14:58:21 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2018-03-18 16:06:49 -0700 |
| commit | 8da1ec98c6d30b809ff09392ae2989a4de9ed71c (patch) | |
| tree | e3ed4bda8767e416286eec54b157ba256036e1e6 /docs/man/nng_pipe_getopt.3.adoc | |
| parent | 8b979454d891b84da727a329906c4293fadc5f3c (diff) | |
| download | nng-8da1ec98c6d30b809ff09392ae2989a4de9ed71c.tar.gz nng-8da1ec98c6d30b809ff09392ae2989a4de9ed71c.tar.bz2 nng-8da1ec98c6d30b809ff09392ae2989a4de9ed71c.zip | |
fixes #293 nng_listener_getopt doc needs updating
Actually I updated all the option related documents, and fixed minor
markup issues on several others.
Diffstat (limited to 'docs/man/nng_pipe_getopt.3.adoc')
| -rw-r--r-- | docs/man/nng_pipe_getopt.3.adoc | 52 |
1 files changed, 30 insertions, 22 deletions
diff --git a/docs/man/nng_pipe_getopt.3.adoc b/docs/man/nng_pipe_getopt.3.adoc index 598de053..3198fc21 100644 --- a/docs/man/nng_pipe_getopt.3.adoc +++ b/docs/man/nng_pipe_getopt.3.adoc @@ -16,31 +16,35 @@ nng_pipe_getopt - get pipe option == SYNOPSIS [source, c] ------------ +---- #include <nng/nng.h> int nng_pipe_getopt(nng_pipe p, const char *opt, void *val, size_t *valszp); +int nng_pipe_getopt_bool(nng_pipe p, const char *opt, int *bvalp); + int nng_pipe_getopt_int(nng_pipe p, const char *opt, int *ivalp); 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_size(nng_pipe p, const char *opt, size_t *zp); int nng_pipe_getopt_uint64(nng_pipe p, const char *opt, uint64_t *u64p); ------------ +---- == DESCRIPTION +(((options, pipe))) The `nng_pipe_getopt()` functions are used to retrieve option values for the <<nng_pipe.5#,pipe>> _p_. The actual options that may be retrieved in this way vary, and many are documented in <<nng_options.5#,nng_options(5)>>. -Additionally some transport-specific options are documented with the -transports themselves, and some protocol-specific options are documented -with the protocol. +Additionally some transport-specific options and protocol-specific options are +documented with the transports andp protocols themselves. -NOTE: All "options" on a pipe are read-only values, and intended to +NOTE: All "`options`" on a pipe are read-only values, and intended to facilitate understanding the identity of an associated peer. Modification of options must be done on the listener or dialer using either <<nng_listener_setopt.3#,`nng_listener_setopt()`>> or @@ -49,12 +53,14 @@ Modification of options must be done on the listener or dialer using either Any option that is set on a dialer or listener will normally be retrievable from pipes created by that dialer or listener. +=== Forms + In all of these forms, the option _opt_ is retrieved from the pipe _p_. The details of the type, size, and semantics of the option will depend on the actual option, and will be documented with the option itself. -=== `nng_pipe_getopt()`:: +==== `nng_pipe_getopt()` This is untyped, and can be used to retrieve the value of any option. A pointer to a buffer to receive the value in _val_, and the size of the @@ -76,42 +82,44 @@ TIP: Generally, it will be easier to use one of the typed forms instead. Note however that no validation that the option is actually of the associated type is performed, so the caller must take care to use the *correct* typed form. -=== `nng_pipe_getopt_int()`:: +==== `nng_pipe_getopt_bool()` + +This function is for options which take a boolean (`bool`). +The value will be stored at _bvalp_. + +==== `nng_pipe_getopt_int()` This function is for options which take an integer (`int`) or boolean (`bool`). The value will be stored at _ivalp_. For booleans the value will be eiher 0 (`false`) or 1 (`true`). -=== `nng_pipe_getopt_ms()`:: +==== `nng_pipe_getopt_ms()` This function is used to retrieve time durations -(<<nng_duration.5#,`nng_duration`) in milliseconds, which are stored in +(<<nng_duration.5#,`nng_duration`>>) in milliseconds, which are stored in _durp_. -=== `nng_pipe_getopt_size()`:: +==== `nng_pipe_getopt_ptr()` +This function is used to retrieve a pointer, _ptr_, to structured data. +The data referenced by _ptr_ is generally managed using other functions. +Note that this form is somewhat special in that the object is generally +not copied, but instead the *pointer* to the object is copied. + +==== `nng_pipe_getopt_size()` 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_uint64()`:: +==== `nng_pipe_getopt_uint64()` This function is used to retriev a 64-bit unsigned value into the value referenced by _u64p_. This is typically used for options related to identifiers, network numbers, and similar. -// XXX: nng_pipe_getopt_ptr is not supported, and would carry some risks, -// as the pipe may not survive, and the endpoint options may not survive, -// leading to questions about pointer validity. -// The last form, `nng_pipe_getopt_ptr()`, is used to retrieve a -// pointer _ptr_ to structured data. The data referenced by _ptr_ is -// generally managed using other functions. -// Note that this form is somewhat special in that the object is generally -// not copied, but instead the *pointer* to the object is copied. - == RETURN VALUES -This function returns 0 on success, and non-zero otherwise. +These functions return 0 on success, and non-zero otherwise. == ERRORS |
