From 60231f0600461a9593a8f876518874866df3387a Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sat, 16 Feb 2019 12:40:41 -0800 Subject: fixes #879 Desire NNG_OPT_TCP_BOUND_PORT We also have made some support changes, including new APIs for printing URLs, and some improvements to the NNG_OPT_URL to make use of this new property. --- include/nng/nng.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/nng/nng.h b/include/nng/nng.h index eb50599a..4c29e476 100644 --- a/include/nng/nng.h +++ b/include/nng/nng.h @@ -754,6 +754,14 @@ enum nng_flag_enum { // state current). This is a boolean. #define NNG_OPT_TCP_KEEPALIVE "tcp-keepalive" +// Local TCP port number. This is used on a listener, and is intended +// to be used after starting the listener in combination with a wildcard +// (0) local port. This determines the actual ephemeral port that was +// selected and bound. The value is provied as an int, but only the +// low order 16 bits will be set. This is provided in native byte order, +// which makes it more convienent than using the NNG_OPT_LOCADDR option. +#define NNG_OPT_TCP_BOUND_PORT "tcp-bound-port" + // IPC options. These will largely vary depending on the platform, // as POSIX systems have very different options than Windows. @@ -1115,7 +1123,8 @@ NNG_DECL int nng_stream_listener_get_addr( nng_stream_listener *, const char *, nng_sockaddr *); NNG_DECL int nng_stream_listener_set_bool( nng_stream_listener *, const char *, bool); -NNG_DECL int nng_stream_listener_set_int(nng_stream_listener *, const char *, int); +NNG_DECL int nng_stream_listener_set_int( + nng_stream_listener *, const char *, int); NNG_DECL int nng_stream_listener_set_ms( nng_stream_listener *, const char *, nng_duration); NNG_DECL int nng_stream_listener_set_size( -- cgit v1.2.3-70-g09d2