diff options
| author | Garrett D'Amore <garrett@damore.org> | 2025-10-25 11:43:59 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2025-10-25 20:11:51 -0700 |
| commit | cc419cf01d9c060a3bd3fc318f9b9bc9e736dae9 (patch) | |
| tree | 2f26cd782a54bed35e03b451003deee5df701983 /docs | |
| parent | ebc479a61b8f2d2f3a6d846d18debfb9022e6010 (diff) | |
| download | nng-cc419cf01d9c060a3bd3fc318f9b9bc9e736dae9.tar.gz nng-cc419cf01d9c060a3bd3fc318f9b9bc9e736dae9.tar.bz2 nng-cc419cf01d9c060a3bd3fc318f9b9bc9e736dae9.zip | |
Add stream direct address functions for socket addresses.
This is going to be used to facilitate debugging, and eliminate some
inconveniences around these things. We plan to move the pipe functions
to use these directly, hopefully moving away from the pipe_getopt hack.
(The transport API will need to grow these. For now this is just the
streams.)
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/api/stream.md | 16 | ||||
| -rw-r--r-- | docs/ref/xref.md | 2 |
2 files changed, 18 insertions, 0 deletions
diff --git a/docs/ref/api/stream.md b/docs/ref/api/stream.md index 38c6adb8..6b02d8db 100644 --- a/docs/ref/api/stream.md +++ b/docs/ref/api/stream.md @@ -76,6 +76,18 @@ 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. +## Stream Addresses + +```c +nng_err nng_stream_peer_addr(nng_stream *s, const nng_sockaddr **valp); +nng_err nng_stream_self_addr(nng_stream *s, const nng_sockaddr **valp); +``` + +{{hi:`nng_stream_peer_addr`}} +{{hi:`nng_stream_self_addr`}} +These functions are used to obtain value of the local (self) or remote (peer) addresses +for the given stream _s_. + ## Getting Stream Options ```c @@ -102,6 +114,10 @@ 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 diff --git a/docs/ref/xref.md b/docs/ref/xref.md index 8ac6e2f5..d64840cb 100644 --- a/docs/ref/xref.md +++ b/docs/ref/xref.md @@ -170,6 +170,8 @@ [`nng_stream_listener_set_size`]: ../api/stream.md#stream-factory-options [`nng_stream_listener_set_addr`]: ../api/stream.md#stream-factory-options [`nng_stream_listener_set_string`]: ../api/stream.md#stream-factory-options +[`nng_stream_peer_addr`]: ../api/stream.md#stream-addresses +[`nng_stream_self_addr`]: ../api/stream.md#stream-addresses [`nng_init`]: ../api/init.md#initialization [`nng_fini`]: ../api/init.md#finalization [`nng_sub0_ctx_subscribe`]: ../proto/sub.md#context-operations |
