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 /src/core/pipe.c | |
| 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 'src/core/pipe.c')
| -rw-r--r-- | src/core/pipe.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/core/pipe.c b/src/core/pipe.c index db2c4d41..baa2d6f9 100644 --- a/src/core/pipe.c +++ b/src/core/pipe.c @@ -421,7 +421,7 @@ nni_pipe_bump_error(nni_pipe *p, int err) } char * -nni_pipe_peer_addr(nni_pipe *p, char buf[NNG_MAXADDRSTRLEN]) +nni_pipe_peer_str_addr(nni_pipe *p, char buf[NNG_MAXADDRSTRLEN]) { nng_sockaddr sa; size_t sz = sizeof(sa); @@ -431,6 +431,17 @@ nni_pipe_peer_addr(nni_pipe *p, char buf[NNG_MAXADDRSTRLEN]) return (buf); } +char * +nni_pipe_self_str_addr(nni_pipe *p, char buf[NNG_MAXADDRSTRLEN]) +{ + nng_sockaddr sa; + size_t sz = sizeof(sa); + sa.s_family = AF_UNSPEC; + nni_pipe_getopt(p, NNG_OPT_LOCADDR, &sa, &sz, NNI_TYPE_SOCKADDR); + nng_str_sockaddr(&sa, buf, NNG_MAXADDRSTRLEN); + return (buf); +} + nng_err nni_pipe_peer_cert(nni_pipe *p, nng_tls_cert **certp) { |
