diff options
| author | Garrett D'Amore <garrett@damore.org> | 2025-10-26 10:54:58 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2025-10-27 07:13:40 -0700 |
| commit | be13c2e8845423cec17af429fc4e16a5d9749e47 (patch) | |
| tree | 82614e403a41aac6581a9a223ef9eba5be557222 /docs/ref/api | |
| parent | 11c53f3d7f747d14fd69ce98c63d629bc821ef68 (diff) | |
| download | nng-be13c2e8845423cec17af429fc4e16a5d9749e47.tar.gz nng-be13c2e8845423cec17af429fc4e16a5d9749e47.tar.bz2 nng-be13c2e8845423cec17af429fc4e16a5d9749e47.zip | |
Replace nng_pipe_get_addr, nng_stream_get_addr, and the NNG_OPT_REMADDR option.
More direct access methods are provided instead.
This results in much lower friction when using, and is a step on the path
to removing NNG_OPT_LOCADDR as well.
We need to figure a solution for NNG_OPT_LOCADDR for dialers; for
listeners there is little use in it either, and it will be removed.
(Dialers will probably get a new NNG_OPT_BIND_IP option.)
Diffstat (limited to 'docs/ref/api')
| -rw-r--r-- | docs/ref/api/pipe.md | 12 | ||||
| -rw-r--r-- | docs/ref/api/stream.md | 5 |
2 files changed, 10 insertions, 7 deletions
diff --git a/docs/ref/api/pipe.md b/docs/ref/api/pipe.md index 4fae1d06..97540908 100644 --- a/docs/ref/api/pipe.md +++ b/docs/ref/api/pipe.md @@ -84,6 +84,16 @@ either [`nng_dialer_id`] or [`nng_listener_id`] for the returned object will ret > The socket, or the endpoint, returned by these functions may be in the process of closing, > and might not be further usable as a result. (Other functions will result in [`NNG_ECLOSED`].) +## Pipe Socket Addresses + +```c +nng_err nng_pipe_peer_addr(nng_pipe p, nng_sockaddr *sap); +nng_err nng_pipe_self_addr(nng_pipe p, nng_sockaddr *sap); +``` + +The [`nng_sockaddr`] for the local (self) or remote (peer) of the pipe is available using these +functions. The associated address will be stored in the location pointed to by _sap_. + ## Pipe Options ```c @@ -91,7 +101,6 @@ nng_err nng_pipe_get_bool(nng_pipe p, const char *opt, bool *valp); nng_err nng_pipe_get_int(nng_pipe p, const char *opt, int *valp); nng_err nng_pipe_get_ms(nng_pipe p, const char *opt, nng_duration *valp); nng_err nng_pipe_get_size(nng_pipe p, const char *opt, size_t *valp); -nng_err nng_pipe_get_addr(nng_pipe p, const char *opt, nng_sockaddr *valp); nng_err nng_pipe_get_string(nng_pipe p, const char *opt, const char **valp); nng_err nng_pipe_get_strcpy(nng_pipe p, const char *opt, char *val, size_t len); nng_err nng_pipe_get_strdup(nng_pipe p, const char *opt, char **valp); @@ -102,7 +111,6 @@ nng_err nng_pipe_get_strlen(nng_pipe p, const char *opt, size_t *lenp); {{hi:`nng_pipe_get_int`}} {{hi:`nng_pipe_get_ms`}} {{hi:`nng_pipe_get_size`}} -{{hi:`nng_pipe_get_addr`}} {{hi:`nng_pipe_get_string`}} {{hi:`nng_pipe_get_strcpy`}} {{hi:`nng_pipe_get_strdup`}} diff --git a/docs/ref/api/stream.md b/docs/ref/api/stream.md index a2f29238..3bed7923 100644 --- a/docs/ref/api/stream.md +++ b/docs/ref/api/stream.md @@ -103,7 +103,6 @@ nng_err nng_stream_get_string(nng_stream *s, const char *opt, const char **valp) {{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`}} 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_. @@ -114,10 +113,6 @@ are available, and which type they may be accessed using. In the case of `nng_stream_get_string`, the string pointer is only guaranteed to be valid while the stream exists. Callers should make a copy of the data if required before closing the stream. -> [!NOTE]: -> The `nng_stream_get_addr` function is deprecated and will be removed. Use the -> [`nng_stream_peer_addr`] or [`nng_stream_self_addr`] functions instead. - ## Stream Factories ```c |
