From 925ac884f8bce34ad27fe18e851ebcecfe311356 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Thu, 21 Nov 2024 22:48:32 -0800 Subject: Collect the bound port as part of the URL at bind time. This is a step on cleaning up our logic around NNG_OPT_URL. --- include/nng/nng.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include') diff --git a/include/nng/nng.h b/include/nng/nng.h index f6b0a179..49b5da05 100644 --- a/include/nng/nng.h +++ b/include/nng/nng.h @@ -270,6 +270,11 @@ NNG_DECL int nng_socket_raw(nng_socket id, bool *rawp); NNG_DECL const char *nng_str_sockaddr( const nng_sockaddr *sa, char *buf, size_t bufsz); +// Obtain a port number (for NNG_AF_INET and NNG_AF_INET6this will be 16 bits +// maximum, but other address familiies may have larger port numbers.) For +// address that don't have the concept of port numbers, zero will be returned. +uint32_t nng_sockaddr_port(const nng_sockaddr *sa); + // Arguably the pipe callback functions could be handled as an option, // but with the need to specify an argument, we find it best to unify // this as a separate function to pass in the argument and the callback. -- cgit v1.2.3-70-g09d2