diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-12-31 14:52:49 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2024-12-31 14:52:49 -0800 |
| commit | f0cf75a487aff2ecaeda290b51d77c4e8cccb061 (patch) | |
| tree | 42dca046cc108bf63905751373ae9f96d69c82d3 /docs/ref/api | |
| parent | 5fb0d00d9e69e80fe8dc65270316bfc416a0e0d3 (diff) | |
| download | nng-f0cf75a487aff2ecaeda290b51d77c4e8cccb061.tar.gz nng-f0cf75a487aff2ecaeda290b51d77c4e8cccb061.tar.bz2 nng-f0cf75a487aff2ecaeda290b51d77c4e8cccb061.zip | |
docs: convert nng_stream_get family
Diffstat (limited to 'docs/ref/api')
| -rw-r--r-- | docs/ref/api/stream.md | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/docs/ref/api/stream.md b/docs/ref/api/stream.md index 9609ef7b..37275c93 100644 --- a/docs/ref/api/stream.md +++ b/docs/ref/api/stream.md @@ -76,4 +76,32 @@ stream itself. > or be aborted, these functions are unsafe to call from functions that may not block, such as the > completion function registered with an [`nng_aio`] when it is created. +## Getting Stream Options + +```c +int nng_stream_get_bool(nng_stream *s, const char *opt, bool *valp); +int nng_stream_get_int(nng_stream *s, const char *opt, int *valp); +int nng_stream_get_ms(nng_stream *s, const char *opt, nng_duration *valp); +int nng_stream_get_size(nng_stream *s, const char *opt, size_t *valp); +int nng_stream_get_addr(nng_stream *s, const char *opt, nng_sockaddr *valp); +int nng_stream_get_string(nng_stream *s, const char *opt, char **valp); +int nng_stream_get_uint64(nng_stream *s, const char *opt, uint64_t *valp); +``` + +{{hi:`nng_stream_get_bool`}} +{{hi:`nng_stream_get_int`}} +{{hi:`nng_stream_get_ms`}} +{{hi:`nng_stream_get_size`}} +{{hi:`nng_stream_get_addr`}} +{{hi:`nng_stream_get_string`}} +{{hi:`nng_stream_get_uint64`}} +These functions are used to obtain value of an option named _opt_ from the stream _s_, and store it in the location +referenced by _valp_. + +These functions access an option as a specific type. The transport layer will have details about which options +are available, and which type they may be accessed using. + +In the case of `nng_stream_get_string`, the string is created as if by [`nng_strdup`], and must be freed by +the caller using [`nng_strfree`] when no longer needed. + {{#include ../xref.md}} |
