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 --- src/core/dialer.c | 6 ++++++ src/core/dialer.h | 3 ++- src/core/listener.c | 6 ++++++ src/core/listener.h | 3 ++- 4 files changed, 16 insertions(+), 2 deletions(-) (limited to 'src/core') diff --git a/src/core/dialer.c b/src/core/dialer.c index 722a0868..8679e4a3 100644 --- a/src/core/dialer.c +++ b/src/core/dialer.c @@ -558,6 +558,12 @@ nni_dialer_getopt( return (nni_sock_getopt(d->d_sock, name, valp, szp, t)); } +const nng_url * +nni_dialer_url(nni_dialer *d) +{ + return (d->d_url); +} + void nni_dialer_add_stat(nni_dialer *d, nni_stat_item *item) { diff --git a/src/core/dialer.h b/src/core/dialer.h index 7bc1547d..619a2101 100644 --- a/src/core/dialer.h +++ b/src/core/dialer.h @@ -1,5 +1,5 @@ // -// Copyright 2021 Staysail Systems, Inc. +// Copyright 2025 Staysail Systems, Inc. // Copyright 2018 Capitar IT Group BV // Copyright 2018 Devolutions // @@ -25,6 +25,7 @@ extern int nni_dialer_setopt( nni_dialer *, const char *, const void *, size_t, nni_type); extern int nni_dialer_getopt( nni_dialer *, const char *, void *, size_t *, nni_type); +extern const nng_url *nni_dialer_url(nni_dialer *); extern void nni_dialer_add_stat(nni_dialer *, nni_stat_item *); extern void nni_dialer_bump_error(nni_dialer *, int); diff --git a/src/core/listener.c b/src/core/listener.c index 65fe5a9f..e0b1b5a2 100644 --- a/src/core/listener.c +++ b/src/core/listener.c @@ -507,6 +507,12 @@ nni_listener_getopt( return (nni_sock_getopt(l->l_sock, name, val, szp, t)); } +const nng_url * +nni_listener_url(nni_listener *l) +{ + return (l->l_url); +} + void nni_listener_add_stat(nni_listener *l, nni_stat_item *item) { diff --git a/src/core/listener.h b/src/core/listener.h index c6c0b5d3..0451f203 100644 --- a/src/core/listener.h +++ b/src/core/listener.h @@ -1,5 +1,5 @@ // -// Copyright 2021 Staysail Systems, Inc. +// Copyright 2025 Staysail Systems, Inc. // Copyright 2018 Capitar IT Group BV // Copyright 2018 Devolutions // @@ -25,6 +25,7 @@ extern int nni_listener_setopt( nni_listener *, const char *, const void *, size_t, nni_type); extern int nni_listener_getopt( nni_listener *, const char *, void *, size_t *, nni_type); +extern const nng_url *nni_listener_url(nni_listener *); extern void nni_listener_add_stat(nni_listener *, nni_stat_item *); extern void nni_listener_bump_error(nni_listener *, int); -- cgit v1.2.3-70-g09d2