From caa0c875339badd5a0da38aee9605a40cb7e9d83 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Mon, 28 Oct 2024 15:04:08 -0700 Subject: streams: drop some stream set functions We don't need nng_stream_set_addr nor nng_stream_set_ptr. These methods are simply not useful for streams, which have their properties established at creation time. Arguably in fact, all of nng_stream_set_* could go away -- the only properties it is implemented for are TCP keepalive and nodelay tuning, and those should be reasonably set by the creator of the stream. --- docs/man/nng_stream_set.3str.adoc | 25 ++----------------------- include/nng/nng.h | 2 -- src/core/stream.c | 6 ------ 3 files changed, 2 insertions(+), 31 deletions(-) diff --git a/docs/man/nng_stream_set.3str.adoc b/docs/man/nng_stream_set.3str.adoc index e4a82a1a..9386168e 100644 --- a/docs/man/nng_stream_set.3str.adoc +++ b/docs/man/nng_stream_set.3str.adoc @@ -1,6 +1,6 @@ = nng_stream_set(3str) // -// Copyright 2020 Staysail Systems, Inc. +// Copyright 2024 Staysail Systems, Inc. // Copyright 2018 Capitar IT Group BV // Copyright 2019 Devolutions // @@ -28,16 +28,12 @@ int nng_stream_set_int(nng_stream *s, const char *opt, int val); int nng_stream_set_ms(nng_stream *s, const char *opt, nng_duration val); -int nng_stream_set_ptr(nng_stream *s, const char *opt, void *val); - int nng_stream_set_size(nng_stream *s, const char *opt, size_t val); int nng_stream_set_string(nng_stream *s, const char *opt, const char *val); int nng_stream_set_uint64(nng_stream *s, const char *opt, uint64_t val); -int nng_stream_set_addr(nng_stream *s, const char *opt, const nng_sockaddr *val); - ---- == DESCRIPTION @@ -76,17 +72,6 @@ the type xref:nng_duration.5.adoc[`nng_duration`]. The duration is an integer number of milliseconds. -`nng_stream_set_ptr()`:: -This function is used to pass a pointer to structured data. -The data referenced by is generally managed by other functions. -For example, TLS configuration objects created with -xref:nng_tls_config_alloc.3tls.adoc[`nng_tls_config_alloc()`] -can be passed this way. -+ -NOTE: This form is somewhat special in that the object is generally -not copied, but instead the *pointer* to the object is copied. -Please see the documentation for the specific option for further details. - `nng_stream_set_size()`:: This function is used to configure a size, typically for buffer sizes, message maximum sizes, and similar options. @@ -103,12 +88,6 @@ This function is used to configure a 64-bit unsigned value/ This is typically used for identifiers, network numbers, and similar options. -`nng_stream_set_addr()`:: -This function is used to configure a -xref:nng_sockaddr.5.adoc[socket address]. -The value is copied, and thus the caller may discard the supplied -value immediately after this function returns. - == RETURN VALUES This function returns 0 on success, and non-zero otherwise. @@ -130,4 +109,4 @@ xref:nng_options.5.adoc[nng_options(5)], xref:nng_ipc_options.5.adoc[nng_ipc_options(5)], xref:nng_tcp_options.5.adoc[nng_tcp_options(5)], xref:nng_tls_options.5.adoc[nng_tls_options(5)], -xref:nng_stream.5.adoc[nng_stream(5)] \ No newline at end of file +xref:nng_stream.5.adoc[nng_stream(5)] diff --git a/include/nng/nng.h b/include/nng/nng.h index 5b1cdaeb..43d293dc 100644 --- a/include/nng/nng.h +++ b/include/nng/nng.h @@ -1159,8 +1159,6 @@ NNG_DECL int nng_stream_set_size(nng_stream *, const char *, size_t); NNG_DECL int nng_stream_set_uint64(nng_stream *, const char *, uint64_t); NNG_DECL int nng_stream_set_string(nng_stream *, const char *, const char *); NNG_DECL int nng_stream_set_ptr(nng_stream *, const char *, void *); -NNG_DECL int nng_stream_set_addr( - nng_stream *, const char *, const nng_sockaddr *); NNG_DECL int nng_stream_dialer_alloc(nng_stream_dialer **, const char *); NNG_DECL int nng_stream_dialer_alloc_url( diff --git a/src/core/stream.c b/src/core/stream.c index 2807f37f..fce1e45e 100644 --- a/src/core/stream.c +++ b/src/core/stream.c @@ -513,12 +513,6 @@ nng_stream_set_string(nng_stream *s, const char *n, const char *v) s, n, v, v == NULL ? 0 : strlen(v) + 1, NNI_TYPE_STRING)); } -int -nng_stream_set_addr(nng_stream *s, const char *n, const nng_sockaddr *v) -{ - return (nni_stream_set(s, n, v, sizeof(*v), NNI_TYPE_SOCKADDR)); -} - int nng_stream_dialer_set( nng_stream_dialer *d, const char *n, const void *v, size_t sz) -- cgit v1.2.3-70-g09d2