From fb7f83b4c6f371372f742ff45f5efb8e83374f8c Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sun, 3 Nov 2024 08:57:35 -0800 Subject: Remove nng_ctx untyped option functions --- docs/man/nng_ctx_get.3.adoc | 26 ++------------------------ docs/man/nng_ctx_set.3.adoc | 15 ++------------- docs/ref/migrate/nng1.md | 2 ++ 3 files changed, 6 insertions(+), 37 deletions(-) (limited to 'docs') diff --git a/docs/man/nng_ctx_get.3.adoc b/docs/man/nng_ctx_get.3.adoc index 48237b23..92393e05 100644 --- a/docs/man/nng_ctx_get.3.adoc +++ b/docs/man/nng_ctx_get.3.adoc @@ -1,6 +1,6 @@ = nng_ctx_get(3) // -// Copyright 2019 Staysail Systems, Inc. +// Copyright 2024 Staysail Systems, Inc. // Copyright 2018 Capitar IT Group BV // // This document is supplied under the terms of the MIT License, a @@ -19,8 +19,6 @@ nng_ctx_get - get context option ---- #include -int nng_ctx_get(nng_ctx ctx, const char *opt, void *val, size_t *valszp); - int nng_ctx_get_bool(nng_ctx ctx, const char *opt, bool *bvalp); int nng_ctx_get_int(nng_ctx ctx, const char *opt, int *ivalp); @@ -38,7 +36,7 @@ int nng_ctx_get_uint64(nng_ctx ctx, const char *opt, uint64_t *u64p); == DESCRIPTION (((options, context))) -The `nng_ctx_get()` functions are used to retrieve option values for +The `nng_ctx_get` functions are used to retrieve option values for the xref:nng_ctx.5.adoc[context] _ctx_. The actual options that may be retrieved in this way vary. A number of them are documented in xref:nng_options.5.adoc[nng_options(5)]. @@ -54,26 +52,6 @@ The forms vary based on the type of the option they take. 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. -`nng_ctx_get()`:: -This function is untyped and can be used to retrieve the value of any option. -The caller must store a pointer to a buffer to receive the value in _val_, -and the size of the buffer shall be stored at the location referenced by -_valszp_. + - + -When the function returns, the actual size of the data copied (or that -would have been copied if sufficient space were present) is stored at -the location referenced by _valszp_. -If the caller's buffer is not large enough to hold the entire object, -then the copy is truncated. -Therefore the caller should check for truncation by verifying that the -returned size in _valszp_ does not exceed the original buffer size. + - + -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. - `nng_ctx_get_bool()`:: This function is for options which take a Boolean (`bool`). The value will be stored at _ivalp_. diff --git a/docs/man/nng_ctx_set.3.adoc b/docs/man/nng_ctx_set.3.adoc index 9bfeb43f..1a7f7033 100644 --- a/docs/man/nng_ctx_set.3.adoc +++ b/docs/man/nng_ctx_set.3.adoc @@ -1,6 +1,6 @@ = nng_ctx_set(3) // -// Copyright 2019 Staysail Systems, Inc. +// Copyright 2024 Staysail Systems, Inc. // Copyright 2018 Capitar IT Group BV // // This document is supplied under the terms of the MIT License, a @@ -19,8 +19,6 @@ nng_ctx_set - set context option ---- #include -int nng_ctx_set(nng_ctx ctx, const char *opt, const void *val, size_t valsz); - int nng_ctx_set_bool(nng_ctx ctx, const char *opt, int bval); int nng_ctx_set_int(nng_ctx ctx, const char *opt, int ival); @@ -36,10 +34,8 @@ int nng_ctx_set_uint64(nng_ctx ctx, const char *opt, uint64_t u64); == DESCRIPTION -NOTE: These functions are deprecated. Please see xref:nng_ctx_set.3.adoc[nng_ctx_set]. - (((options, context))) -The `nng_ctx_set()` functions are used to configure options for +The `nng_ctx_set` functions are used to configure options for the context _ctx_. The actual options that may be configured in this way vary, and are specified by _opt_. @@ -52,13 +48,6 @@ The details will be documented with the protocol. 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. -`nng_ctx_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_. - -TIP: It may be easier to use one of the typed forms of this function. - `nng_ctx_set_bool()`:: This function is for options which take a Boolean (`bool`). The _bval_ is passed to the option. diff --git a/docs/ref/migrate/nng1.md b/docs/ref/migrate/nng1.md index 9d9cd01b..f4c9c9f5 100644 --- a/docs/ref/migrate/nng1.md +++ b/docs/ref/migrate/nng1.md @@ -59,6 +59,8 @@ should be sufficient in most cases. The following functions are removed. To access options, use a proper typed access function, such as one ending in a suffix like `_bool` (to access a `bool` typed option). +- `nng_ctx_get` +- `nng_ctx_set` - `nng_pipe_get` - `nng_stream_get` - `nng_stream_set` -- cgit v1.2.3-70-g09d2