Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gdamore/stable wip #1921

Merged
merged 3 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/man/nng_dialer_get.3.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ It is acceptable to pass `NULL` for _val_ if the value in _valszp_ is zero.
This can be used to determine the size of the buffer needed to receive
the object.

TIP: It may be easier to use one of the typed forms of this function.
NOTE: This function is deprecated. Use one of the typed functions listed below instead.

`nng_dialer_get_bool()`::
This function is for options which take a Boolean (`bool`).
Expand Down
4 changes: 2 additions & 2 deletions docs/man/nng_dialer_set.3.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ nng_dialer_set - set dialer option
----
#include <nng/nng.h>
int nng_dialer_set(nng_dialer d, const char *opt, const void *val,
int nng_dialer_set(nng_dialer d, const char *opt, const void *val,
size_t valsz);
int nng_dialer_set_bool(nng_dialer d, const char *opt, bool bval);
Expand Down Expand Up @@ -63,7 +63,7 @@ This function is untyped, and can be used to configure any arbitrary data.
The _val_ pointer addresses the data to copy, and _valsz_ is the
size of the objected located at _val_.

TIP: It may be easier to use one of the typed forms of this function.
NOTE: This function is deprecated. Use of the typed functions below instead.

`nng_dialer_set_bool()`::
This function is for options which take a Boolean (`bool`).
Expand Down
6 changes: 3 additions & 3 deletions docs/man/nng_listener_set.3.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ nng_listener_set - set listener option
----
#include <nng/nng.h>

int nng_listener_set(nng_listener l, const char *opt, const void *val,
int nng_listener_set(nng_listener l, const char *opt, const void *val,
size_t valsz);

int nng_listener_set_bool(nng_listener l, const char *opt, bool bval);
Expand Down Expand Up @@ -58,13 +58,13 @@ In all of these forms, the option _opt_ is configured on the listener _l_.
The details of the type, size, and semantics of the option will depend
on the actual option, and will be documented with the option itself.

TIP: It may be easier to use one of the typed forms of this function.

`nng_listener_set()`::
This function is untyped, and can be used to configure any arbitrary data.
The _val_ pointer addresses the data to copy, and _valsz_ is the
size of the objected located at _val_.

NOTE: This function is deprecated. Use one of the typed functions beelow instead.

`nng_listener_set_bool()`::
This function is for options which take a Boolean (`bool`).
The _bval_ is passed to the option.
Expand Down
2 changes: 0 additions & 2 deletions docs/man/nng_socket_get.3.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ int nng_socket_get_ptr(nng_socket s, const char *opt, void **ptr);

int nng_socket_get_ms(nng_socket s, const char *opt, nng_duration *durp);

int nng_socket_get_addr(nng_socket s, const char *opt, nng_sockaddr *addrp);

----

== DESCRIPTION
Expand Down
6 changes: 3 additions & 3 deletions docs/man/nng_stream_dialer_get.3str.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
= nng_stream_dialer_get(3str)
//
// Copyright 2020 Staysail Systems, Inc. <[email protected]>
// Copyright 2024 Staysail Systems, Inc. <[email protected]>
// Copyright 2018 Capitar IT Group BV <[email protected]>
// Copyright 2019 Devolutions <[email protected]>
//
Expand Down Expand Up @@ -42,7 +42,7 @@ int nng_stream_dialer_get_uint64(nng_stream_dialer *d, const char *opt, uint64_t
== DESCRIPTION


The `nng_stream_dialer_get()` functions are used to retrieve option values for the
The `nng_stream_dialer_get()` functions are used to retrieve option values for the
xref:nng_stream_dialer.5.adoc[byte stream dialer] _d_.

The actual options that may be retrieved in this way vary.
Expand Down Expand Up @@ -76,7 +76,7 @@ It is acceptable to pass `NULL` for _val_ if the value in _sizep_ is zero.
This can be used to determine the size of the buffer needed to receive
the object.
+
TIP: It may be easier to use one of the typed forms of this function.
NOTE: This function is deprecated. Use one of the typed functions instead.

`nng_stream_dialer_get_bool()`::
This function is for options which take a Boolean (`bool`).
Expand Down
5 changes: 3 additions & 2 deletions docs/man/nng_stream_dialer_set.3str.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ This function is untyped, and can be used to configure any arbitrary data.
The _val_ pointer addresses the data to copy, and _size_ is the
size of the objected located at _val_.
+
TIP: It may be easier to use one of the typed forms of this function.
NOTE: This function is deprecated and will be removed in a future release.
Use one of the typed functions below instead.

`nng_stream_dialer_set_bool()`::
This function is for options which take a Boolean (`bool`).
Expand Down Expand Up @@ -130,4 +131,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_dialer.5.adoc[nng_stream_dialer(5)]
xref:nng_stream_dialer.5.adoc[nng_stream_dialer(5)]
6 changes: 3 additions & 3 deletions docs/man/nng_stream_listener_get.3str.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
= nng_stream_listener_get(3str)
//
// Copyright 2019 Staysail Systems, Inc. <[email protected]>
// Copyright 2024 Staysail Systems, Inc. <[email protected]>
// Copyright 2018 Capitar IT Group BV <[email protected]>
// Copyright 2019 Devolutions <[email protected]>
//
Expand Down Expand Up @@ -43,7 +43,7 @@ int nng_stream_listener_get_uint64(nng_stream_listener *l, const char *opt, uint


The `nng_stream_listener_get()` functions are used to retrieve option values
for the
for the
xref:nng_stream_listener.5.adoc[byte stream listener] _l_.

The actual options that may be retrieved in this way vary.
Expand Down Expand Up @@ -77,7 +77,7 @@ It is acceptable to pass `NULL` for _val_ if the value in _sizep_ is zero.
This can be used to determine the size of the buffer needed to receive
the object.
+
TIP: It may be easier to use one of the typed forms of this function.
NOTE: This function is deprecated. Use one of the typed functions below instead.

`nng_stream_listener_get_bool()`::
This function is for options which take a Boolean (`bool`).
Expand Down
6 changes: 3 additions & 3 deletions docs/man/nng_stream_listener_set.3str.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
= nng_stream_listener_set(3str)
//
// Copyright 2020 Staysail Systems, Inc. <[email protected]>
// Copyright 2024 Staysail Systems, Inc. <[email protected]>
// Copyright 2018 Capitar IT Group BV <[email protected]>
// Copyright 2019 Devolutions <[email protected]>
//
Expand Down Expand Up @@ -62,7 +62,7 @@ This function is untyped, and can be used to configure any arbitrary data.
The _val_ pointer addresses the data to copy, and _size_ is the
size of the objected located at _val_.
+
TIP: It may be easier to use one of the typed forms of this function.
NOTE: This function is deprecated. Use one of the typed forms instead.

`nng_stream_listener_set_bool()`::
This function is for options which take a Boolean (`bool`).
Expand Down Expand Up @@ -130,4 +130,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_listener.5.adoc[nng_stream_listener(5)]
xref:nng_stream_listener.5.adoc[nng_stream_listener(5)]
12 changes: 5 additions & 7 deletions docs/man/nng_stream_set.3str.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
= nng_stream_set(3str)
//
// Copyright 2020 Staysail Systems, Inc. <[email protected]>
// Copyright 2024 Staysail Systems, Inc. <[email protected]>
// Copyright 2018 Capitar IT Group BV <[email protected]>
// Copyright 2019 Devolutions <[email protected]>
//
Expand Down Expand Up @@ -62,7 +62,7 @@ This function is untyped, and can be used to configure any arbitrary data.
The _val_ pointer addresses the data to copy, and _size_ is the
size of the objected located at _val_.
+
TIP: It may be easier to use one of the typed forms of this function.
NOTE: This function is deprecated. Callers should use one of the typed functions instead.

`nng_stream_set_bool()`::
This function is for options which take a Boolean (`bool`).
Expand Down Expand Up @@ -104,10 +104,8 @@ 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.
This function performs no useful function, and will be removed in
in a future release.

== RETURN VALUES

Expand All @@ -130,4 +128,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)]
xref:nng_stream.5.adoc[nng_stream(5)]
11 changes: 8 additions & 3 deletions docs/man/nng_tls_options.5.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
= nng_tls_options(5)
//
// Copyright 2020 Staysail Systems, Inc. <[email protected]>
// Copyright 2024 Staysail Systems, Inc. <[email protected]>
// Copyright 2018 Capitar IT Group BV <[email protected]>
// Copyright 2019 Devolutions <[email protected]>
//
Expand Down Expand Up @@ -47,6 +47,13 @@ description of the option.

=== TLS Options

NOTE: Options for configuring TLS are deprecated and may
not be present in a future release. These options are
`NNG_OPT_TLS_AUTH_MODE`, `NNG_OPT_TLS_CA_FILE`, `NNG_OPT_TLS_CERT_KEY_FILE`,
and `NNG_OPT_TLS_SERVER_NAME`. Applications should switch to using the
`NNG_OPT_TLS_CONFIG` option and working with `nng_tls_config` objects.


[[NNG_OPT_TLS_AUTH_MODE]]((`NNG_OPT_TLS_AUTH_MODE`))::
(`int`)
Write-only option used to configure the authentication mode used.
Expand Down Expand Up @@ -76,8 +83,6 @@ configuration object before returning it.
NOTE: The caller should release the hold with
xref:nng_tls_config_free.3tls.adoc[`nng_tls_config_free()`] when it no
longer needs the TLS configuration object.
+
TIP: Use this option when more advanced TLS configuration is required.

[[NNG_OPT_TLS_SERVER_NAME]]((`NNG_OPT_TLS_SERVER_NAME`))::
(string)
Expand Down
16 changes: 9 additions & 7 deletions include/nng/nng.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ extern "C" {
// We use SemVer, and these versions are about the API, and
// may not necessarily match the ABI versions.
#define NNG_MAJOR_VERSION 1
#define NNG_MINOR_VERSION 8
#define NNG_PATCH_VERSION 0
#define NNG_MINOR_VERSION 9
#define NNG_PATCH_VERSION 1
#define NNG_RELEASE_SUFFIX \
"" // if non-empty (i.e. "pre"), this is a pre-release
"pre" // if non-empty (i.e. "pre"), this is a pre-release

// Maximum length of a socket address. This includes the terminating NUL.
// This limit is built into other implementations, so do not change it.
Expand Down Expand Up @@ -468,7 +468,6 @@ NNG_DECL int nng_ctx_get_uint64(nng_ctx, const char *, uint64_t *);
NNG_DECL int nng_ctx_get_string(nng_ctx, const char *, char **);
NNG_DECL int nng_ctx_get_ptr(nng_ctx, const char *, void **);
NNG_DECL int nng_ctx_get_ms(nng_ctx, const char *, nng_duration *);
NNG_DECL int nng_ctx_get_addr(nng_ctx, const char *, nng_sockaddr *);

NNG_DECL int nng_ctx_set(nng_ctx, const char *, const void *, size_t);
NNG_DECL int nng_ctx_set_bool(nng_ctx, const char *, bool);
Expand All @@ -478,7 +477,6 @@ NNG_DECL int nng_ctx_set_uint64(nng_ctx, const char *, uint64_t);
NNG_DECL int nng_ctx_set_string(nng_ctx, const char *, const char *);
NNG_DECL int nng_ctx_set_ptr(nng_ctx, const char *, void *);
NNG_DECL int nng_ctx_set_ms(nng_ctx, const char *, nng_duration);
NNG_DECL int nng_ctx_set_addr(nng_ctx, const char *, const nng_sockaddr *);

// nng_alloc is used to allocate memory. It's intended purpose is for
// allocating memory suitable for message buffers with nng_send().
Expand Down Expand Up @@ -1173,8 +1171,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(
Expand Down Expand Up @@ -1442,6 +1438,12 @@ NNG_DECL int nng_pipe_getopt_string(
// a library; it will affect all sockets.
NNG_DECL void nng_closeall(void) NNG_DEPRECATED;

// THese functions are deprecated, but they really serve no useful purpose.
NNG_DECL int nng_stream_set_addr(
nng_stream *, const char *, const nng_sockaddr *) NNG_DEPRECATED;
NNG_DECL int nng_ctx_get_addr(nng_ctx, const char *, nng_sockaddr *) NNG_DEPRECATED;
NNG_DECL int nng_ctx_set_addr(nng_ctx, const char *, const nng_sockaddr *) NNG_DEPRECATED;

#endif // NNG_ELIDE_DEPRECATED

// nng_init_parameter is used by applications to change a tunable setting.
Expand Down
2 changes: 2 additions & 0 deletions src/core/stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -513,11 +513,13 @@ 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));
}

#ifndef NNG_ELIDE_DEPRECATED
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));
}
#endif

int
nng_stream_dialer_set(
Expand Down
4 changes: 4 additions & 0 deletions src/nng.c
Original file line number Diff line number Diff line change
Expand Up @@ -468,11 +468,13 @@ nng_ctx_get_ms(nng_ctx id, const char *n, nng_duration *v)
return (ctx_get(id, n, v, NULL, NNI_TYPE_DURATION));
}

#ifndef NNG_ELIDE_DEPRECATED
int
nng_ctx_get_addr(nng_ctx id, const char *n, nng_sockaddr *v)
{
return (ctx_get(id, n, v, NULL, NNI_TYPE_SOCKADDR));
}
#endif

static int
ctx_set(nng_ctx id, const char *n, const void *v, size_t sz, nni_type t)
Expand Down Expand Up @@ -540,11 +542,13 @@ nng_ctx_set_string(nng_ctx id, const char *n, const char *v)
ctx_set(id, n, v, v == NULL ? 0 : strlen(v) + 1, NNI_TYPE_STRING));
}

#ifndef NNG_ELIDE_DEPRECATED
int
nng_ctx_set_addr(nng_ctx id, const char *n, const nng_sockaddr *v)
{
return (ctx_set(id, n, v, sizeof(*v), NNI_TYPE_SOCKADDR));
}
#endif

int
nng_dial(nng_socket sid, const char *addr, nng_dialer *dp, int flags)
Expand Down
Loading