From 561fc87c4ae15d2349d9169fbd340d649a364ebd Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sat, 4 Jan 2025 18:22:27 -0800 Subject: api: introduce NNG 2.0 compatible nng_dialer_get_url and nng_listener_get_url This is meant to help applications start adopting new interfaces before converting to NNG 2.0 --- docs/man/nng_dialer_get.3.adoc | 5 +++++ docs/man/nng_listener_get.3.adoc | 11 ++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/man/nng_dialer_get.3.adoc b/docs/man/nng_dialer_get.3.adoc index 5084c1b3..6750a535 100644 --- a/docs/man/nng_dialer_get.3.adoc +++ b/docs/man/nng_dialer_get.3.adoc @@ -37,6 +37,8 @@ int nng_dialer_get_string(nng_dialer d, const char *opt, char **strp); int nng_dialer_get_uint64(nng_dialer d, const char *opt, uint64_t *u64p); +int nng_dialer_get_url(nng_dialer d, const nng_url **url); + ---- == DESCRIPTION @@ -117,6 +119,9 @@ referenced by _u64p_. This is typically used for options related to identifiers, network numbers, and similar. +`nng_dialer_get_url()`:: +This function is used to obtain the URL that dialer is configured for. + == RETURN VALUES These functions returns 0 on success, and non-zero otherwise. diff --git a/docs/man/nng_listener_get.3.adoc b/docs/man/nng_listener_get.3.adoc index 83ae6986..3be8cfd9 100644 --- a/docs/man/nng_listener_get.3.adoc +++ b/docs/man/nng_listener_get.3.adoc @@ -1,6 +1,6 @@ = nng_listener_get(3) // -// Copyright 2020 Staysail Systems, Inc. +// Copyright 2025 Staysail Systems, Inc. // Copyright 2018 Capitar IT Group BV // // This document is supplied under the terms of the MIT License, a @@ -37,6 +37,8 @@ int nng_listener_get_string(nng_listener l, const char *opt, char **strp); int nng_listener_get_uint64(nng_listener l, const char *opt, uint64_t *u64p); +int nng_listener_get_url(nng_listener l, const nng_url **url); + ---- == DESCRIPTION @@ -115,6 +117,13 @@ referenced by _u64p_. This is typically used for options related to identifiers, network numbers, and similar. +`nng_listener_get_url()`:: +This function is used to obtain the URL that listener is configured for. +This is the actual URL, and may different that what was requested. +For example, when using TCP, if port 0 was requested, but then the listener +was started, a real port will have been chosen by the operating system. +This URL will reflect that final port, so it can be used for dialing. + == RETURN VALUES These functions return 0 on success, and non-zero otherwise. -- cgit v1.2.3-70-g09d2