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

Remove all the get_ptr option accessors. #1946

Merged
merged 1 commit into from
Nov 25, 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
8 changes: 0 additions & 8 deletions docs/man/nng_dialer_get.3.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ int nng_dialer_get_int(nng_dialer d, const char *opt, int *ivalp);

int nng_dialer_get_ms(nng_dialer d, const char *opt, nng_duration *durp);

int nng_dialer_get_ptr(nng_dialer d, const char *opt, void **ptr);

int nng_dialer_get_size(nng_dialer d, const char *opt, size_t *zp);

int nng_dialer_get_addr(nng_dialer d, const char *opt, nng_sockaddr *sap);
Expand Down Expand Up @@ -69,12 +67,6 @@ This function is used to retrieve time xref:nng_duration.5.adoc[durations]
(The special value ((`NNG_DURATION_INFINITE`)) means an infinite amount of time, and
the special value ((`NNG_DURATION_DEFAULT`)) means a context-specific default.)

`nng_dialer_get_ptr()`::
This function is used to retrieve a pointer, _ptr_, to structured data.
The data referenced by _ptr_ is generally managed using other functions.
Note that this form is somewhat special in that the object is generally
not copied, but instead the *pointer* to the object is copied.

`nng_dialer_get_size()`::
This function is used to retrieve a size into the pointer _zp_,
typically for buffer sizes, message maximum sizes, and similar options.
Expand Down
8 changes: 0 additions & 8 deletions docs/man/nng_listener_get.3.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ int nng_listener_get_int(nng_listener l, const char *opt, int *ivalp);

int nng_listener_get_ms(nng_listener l, const char *opt, nng_duration *durp);

int nng_listener_get_ptr(nng_listener l, const char *opt, void **ptr);

int nng_listener_get_size(nng_listener l, const char *opt, size_t *zp);

int nng_listener_get_addr(nng_listener l, const char *opt, nng_sockaddr *sap);
Expand Down Expand Up @@ -67,12 +65,6 @@ The value will be stored at _ivalp_.
This function is used to retrieve time xref:nng_duration.5.adoc[durations]
(such as timeouts), stored in _durp_ as a number of milliseconds.

`nng_listener_get_ptr()`::
This function is used to retrieve a pointer, _ptr_, to structured data.
The data referenced by _ptr_ is generally managed using other functions.
Note that this form is somewhat special in that the object is generally
not copied, but instead the *pointer* to the object is copied.

`nng_listener_get_size()`::
This function is used to retrieve a size into the pointer _zp_,
typically for buffer sizes, message maximum sizes, and similar options.
Expand Down
12 changes: 0 additions & 12 deletions docs/man/nng_stream_dialer_get.3str.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ int nng_stream_dialer_get_int(nng_stream_dialer *d, const char *opt, int *valp);

int nng_stream_dialer_get_ms(nng_stream_dialer *d, const char *opt, nng_duration *valp);

int nng_stream_dialer_get_ptr(nng_stream_dialer *d, const char *opt, void **valp);

int nng_stream_dialer_get_size(nng_stream_dialer *d, const char *opt, size_t *valp);

int nng_stream_dialer_get_addr(nng_stream_dialer *d, const char *opt, nng_sockaddr *valp);
Expand Down Expand Up @@ -69,16 +67,6 @@ xref:nng_duration.5.adoc[durations]
(The special value ((`NNG_DURATION_INFINITE`)) means an infinite amount of time, and
the special value ((`NNG_DURATION_DEFAULT`)) means a context-specific default.)

`nng_stream_dialer_get_ptr()`::
This function is used to retrieve a pointer to structured data.
The data referenced is generally managed using other functions.
Note that this form is somewhat special in that the object is generally
not copied, but instead the *pointer* to the object is copied.
+
NOTE: Care must be taken to ensure that the application respects any
considerations about the lifetime of the underlying object.
See the documentation for the option for more specific guidance.

`nng_stream_dialer_get_size()`::
This function is used to retrieve a size,
typically for buffer sizes, message maximum sizes, and similar options.
Expand Down
12 changes: 0 additions & 12 deletions docs/man/nng_stream_get.3str.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ int nng_stream_get_int(nng_stream *s, const char *opt, int *valp);

int nng_stream_get_ms(nng_stream *s, const char *opt, nng_duration *valp);

int nng_stream_get_ptr(nng_stream *s, const char *opt, void **valp);

int nng_stream_get_size(nng_stream *s, const char *opt, size_t *valp);

int nng_stream_get_addr(nng_stream *s, const char *opt, nng_sockaddr *valp);
Expand Down Expand Up @@ -68,16 +66,6 @@ xref:nng_duration.5.adoc[durations]
(The special value ((`NNG_DURATION_INFINITE`)) means an infinite amount of time, and
the special value ((`NNG_DURATION_DEFAULT`)) means a context-specific default.)

`nng_stream_get_ptr()`::
This function is used to retrieve a pointer to structured data.
The data referenced is generally managed using other functions.
Note that this form is somewhat special in that the object is generally
not copied, but instead the *pointer* to the object is copied.
+
NOTE: Care must be taken to ensure that the application respects any
considerations about the lifetime of the underyling object.
See the documentation for the option for more specific guidance.

`nng_stream_get_size()`::
This function is used to retrieve a size,
typically for buffer sizes, message maximum sizes, and similar options.
Expand Down
12 changes: 0 additions & 12 deletions docs/man/nng_stream_listener_get.3str.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ int nng_stream_listener_get_int(nng_stream_listener *l, const char *opt, int *va

int nng_stream_listener_get_ms(nng_stream_listener *l, const char *opt, nng_duration *valp);

int nng_stream_listener_get_ptr(nng_stream_listener *l, const char *opt, void **valp);

int nng_stream_listener_get_size(nng_stream_listener *l, const char *opt, size_t *valp);

int nng_stream_listener_get_addr(nng_stream_listener *l, const char *opt, nng_sockaddr *valp);
Expand Down Expand Up @@ -70,16 +68,6 @@ xref:nng_duration.5.adoc[durations]
(The special value ((`NNG_DURATION_INFINITE`)) means an infinite amount of time, and
the special value ((`NNG_DURATION_DEFAULT`)) means a context-specific default.)

`nng_stream_listener_get_ptr()`::
This function is used to retrieve a pointer to structured data.
The data referenced is generally managed using other functions.
Note that this form is somewhat special in that the object is generally
not copied, but instead the *pointer* to the object is copied.
+
NOTE: Care must be taken to ensure that the application respects any
considerations about the lifetime of the underyling object.
See the documentation for the option for more specific guidance.

`nng_stream_listener_get_size()`::
This function is used to retrieve a size,
typically for buffer sizes, message maximum sizes, and similar options.
Expand Down
5 changes: 5 additions & 0 deletions docs/ref/migrate/nng1.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,19 @@ and are thus removed:

- `nng_ctx_get_string`
- `nng_ctx_set_string`
- `nng_dialer_get_ptr`
- `nng_dialer_set_ptr`
- `nng_listener_get_ptr`
- `nng_listener_set_ptr`
- `nng_socket_get_ptr`
- `nng_socket_set_ptr`
- `nng_socket_get_string`
- `nng_socket_set_string`
- `nng_stream_get_ptr`
- `nng_stream_set_ptr`
- `nng_stream_dialer_get_ptr`
- `nng_stream_dialer_set_ptr`
- `nng_stream_listener_get_ptr`
- `nng_stream_listener_set_ptr`
- `nng_ctx_get_ptr` (not documented)
- `nng_ctx_set_ptr` (not documented)
Expand Down
8 changes: 0 additions & 8 deletions include/nng/nng.h
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,6 @@ NNG_DECL int nng_dialer_get_int(nng_dialer, const char *, int *);
NNG_DECL int nng_dialer_get_size(nng_dialer, const char *, size_t *);
NNG_DECL int nng_dialer_get_uint64(nng_dialer, const char *, uint64_t *);
NNG_DECL int nng_dialer_get_string(nng_dialer, const char *, char **);
NNG_DECL int nng_dialer_get_ptr(nng_dialer, const char *, void **);
NNG_DECL int nng_dialer_get_ms(nng_dialer, const char *, nng_duration *);
NNG_DECL int nng_dialer_get_addr(nng_dialer, const char *, nng_sockaddr *);
NNG_DECL int nng_dialer_get_tls(nng_dialer, nng_tls_config **);
Expand All @@ -384,7 +383,6 @@ NNG_DECL int nng_listener_get_int(nng_listener, const char *, int *);
NNG_DECL int nng_listener_get_size(nng_listener, const char *, size_t *);
NNG_DECL int nng_listener_get_uint64(nng_listener, const char *, uint64_t *);
NNG_DECL int nng_listener_get_string(nng_listener, const char *, char **);
NNG_DECL int nng_listener_get_ptr(nng_listener, const char *, void **);
NNG_DECL int nng_listener_get_ms(nng_listener, const char *, nng_duration *);
NNG_DECL int nng_listener_get_addr(nng_listener, const char *, nng_sockaddr *);
NNG_DECL int nng_listener_get_tls(nng_listener, nng_tls_config **);
Expand Down Expand Up @@ -705,7 +703,6 @@ NNG_DECL int nng_pipe_get_ms(nng_pipe, const char *, nng_duration *);
NNG_DECL int nng_pipe_get_size(nng_pipe, const char *, size_t *);
NNG_DECL int nng_pipe_get_uint64(nng_pipe, const char *, uint64_t *);
NNG_DECL int nng_pipe_get_string(nng_pipe, const char *, char **);
NNG_DECL int nng_pipe_get_ptr(nng_pipe, const char *, void **);
NNG_DECL int nng_pipe_get_addr(nng_pipe, const char *, nng_sockaddr *);

NNG_DECL int nng_pipe_close(nng_pipe);
Expand Down Expand Up @@ -1140,7 +1137,6 @@ NNG_DECL int nng_stream_get_ms(nng_stream *, const char *, nng_duration *);
NNG_DECL int nng_stream_get_size(nng_stream *, const char *, size_t *);
NNG_DECL int nng_stream_get_uint64(nng_stream *, const char *, uint64_t *);
NNG_DECL int nng_stream_get_string(nng_stream *, const char *, char **);
NNG_DECL int nng_stream_get_ptr(nng_stream *, const char *, void **);
NNG_DECL int nng_stream_get_addr(nng_stream *, const char *, nng_sockaddr *);

NNG_DECL int nng_stream_dialer_alloc(nng_stream_dialer **, const char *);
Expand All @@ -1161,8 +1157,6 @@ NNG_DECL int nng_stream_dialer_get_uint64(
nng_stream_dialer *, const char *, uint64_t *);
NNG_DECL int nng_stream_dialer_get_string(
nng_stream_dialer *, const char *, char **);
NNG_DECL int nng_stream_dialer_get_ptr(
nng_stream_dialer *, const char *, void **);
NNG_DECL int nng_stream_dialer_get_addr(
nng_stream_dialer *, const char *, nng_sockaddr *);
NNG_DECL int nng_stream_dialer_set_bool(
Expand Down Expand Up @@ -1205,8 +1199,6 @@ NNG_DECL int nng_stream_listener_get_uint64(
nng_stream_listener *, const char *, uint64_t *);
NNG_DECL int nng_stream_listener_get_string(
nng_stream_listener *, const char *, char **);
NNG_DECL int nng_stream_listener_get_ptr(
nng_stream_listener *, const char *, void **);
NNG_DECL int nng_stream_listener_get_addr(
nng_stream_listener *, const char *, nng_sockaddr *);
NNG_DECL int nng_stream_listener_set_bool(
Expand Down
3 changes: 0 additions & 3 deletions src/core/defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,11 @@ typedef enum {
NNI_TYPE_NONE, // DO NOT USE
NNI_TYPE_BOOL,
NNI_TYPE_INT32,
NNI_TYPE_UINT32,
NNI_TYPE_INT64,
NNI_TYPE_UINT64,
NNI_TYPE_SIZE,
NNI_TYPE_DURATION,
NNI_TYPE_STRING,
NNI_TYPE_SOCKADDR,
NNI_TYPE_POINTER,
} nni_type;

typedef nni_type nni_opt_type;
Expand Down
24 changes: 0 additions & 24 deletions src/core/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,6 @@ nni_copyin_size(
return (0);
}

int
nni_copyin_ptr(void **pp, const void *v, size_t sz, nni_type t)
{
NNI_ARG_UNUSED(sz);

if (t != NNI_TYPE_POINTER) {
return (NNG_EBADTYPE);
}

*pp = *(void **) v;
return (0);
}

int
nni_copyin_str(char *s, const void *v, size_t maxsz, nni_type t)
{
Expand Down Expand Up @@ -173,17 +160,6 @@ nni_copyout_ms(nng_duration d, void *dst, size_t *szp, nni_type t)
return (0);
}

int
nni_copyout_ptr(void *p, void *dst, size_t *szp, nni_type t)
{
NNI_ARG_UNUSED(szp);
if (t != NNI_TYPE_POINTER) {
return (NNG_EBADTYPE);
}
*(void **) dst = p;
return (0);
}

int
nni_copyout_size(size_t s, void *dst, size_t *szp, nni_type t)
{
Expand Down
18 changes: 0 additions & 18 deletions src/core/stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,12 +346,6 @@ nng_stream_get_string(nng_stream *s, const char *n, char **v)
return (nni_stream_get(s, n, v, NULL, NNI_TYPE_STRING));
}

int
nng_stream_get_ptr(nng_stream *s, const char *n, void **v)
{
return (nni_stream_get(s, n, v, NULL, NNI_TYPE_POINTER));
}

int
nng_stream_get_ms(nng_stream *s, const char *n, nng_duration *v)
{
Expand Down Expand Up @@ -394,12 +388,6 @@ nng_stream_dialer_get_string(nng_stream_dialer *d, const char *n, char **v)
return (nni_stream_dialer_get(d, n, v, NULL, NNI_TYPE_STRING));
}

int
nng_stream_dialer_get_ptr(nng_stream_dialer *d, const char *n, void **v)
{
return (nni_stream_dialer_get(d, n, v, NULL, NNI_TYPE_POINTER));
}

int
nng_stream_dialer_get_ms(nng_stream_dialer *d, const char *n, nng_duration *v)
{
Expand Down Expand Up @@ -450,12 +438,6 @@ nng_stream_listener_get_string(nng_stream_listener *l, const char *n, char **v)
return (nni_stream_listener_get(l, n, v, NULL, NNI_TYPE_STRING));
}

int
nng_stream_listener_get_ptr(nng_stream_listener *l, const char *n, void **v)
{
return (nni_stream_listener_get(l, n, v, NULL, NNI_TYPE_POINTER));
}

int
nng_stream_listener_get_ms(
nng_stream_listener *l, const char *n, nng_duration *v)
Expand Down
18 changes: 0 additions & 18 deletions src/nng.c
Original file line number Diff line number Diff line change
Expand Up @@ -820,12 +820,6 @@ nng_dialer_get_string(nng_dialer id, const char *n, char **v)
return (dialer_get(id, n, v, NULL, NNI_TYPE_STRING));
}

int
nng_dialer_get_ptr(nng_dialer id, const char *n, void **v)
{
return (dialer_get(id, n, v, NULL, NNI_TYPE_POINTER));
}

int
nng_dialer_get_ms(nng_dialer id, const char *n, nng_duration *v)
{
Expand Down Expand Up @@ -967,12 +961,6 @@ nng_listener_get_string(nng_listener id, const char *n, char **v)
return (listener_get(id, n, v, NULL, NNI_TYPE_STRING));
}

int
nng_listener_get_ptr(nng_listener id, const char *n, void **v)
{
return (listener_get(id, n, v, NULL, NNI_TYPE_POINTER));
}

int
nng_listener_get_ms(nng_listener id, const char *n, nng_duration *v)
{
Expand Down Expand Up @@ -1444,12 +1432,6 @@ nng_pipe_get_string(nng_pipe id, const char *n, char **v)
return (pipe_get(id, n, v, NULL, NNI_TYPE_STRING));
}

int
nng_pipe_get_ptr(nng_pipe id, const char *n, void **v)
{
return (pipe_get(id, n, v, NULL, NNI_TYPE_POINTER));
}

int
nng_pipe_get_ms(nng_pipe id, const char *n, nng_duration *v)
{
Expand Down
20 changes: 0 additions & 20 deletions src/supplemental/tls/tls_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -554,22 +554,6 @@ tls_get_peer_cn(void *arg, void *buf, size_t *szp, nni_type t)
return (0);
}

static int
tls_get_peer_alt_names(void *arg, void *buf, size_t *szp, nni_type t)
{
NNI_ARG_UNUSED(szp);

if (t != NNI_TYPE_POINTER) {
return (NNG_EBADTYPE);
}

tls_conn *conn = arg;
nni_mtx_lock(&conn->lock);
*(char ***) buf = conn->ops.peer_alt_names((void *) (conn + 1));
nni_mtx_unlock(&conn->lock);
return (0);
}

static const nni_option tls_options[] = {
{
.o_name = NNG_OPT_TLS_VERIFIED,
Expand All @@ -579,10 +563,6 @@ static const nni_option tls_options[] = {
.o_name = NNG_OPT_TLS_PEER_CN,
.o_get = tls_get_peer_cn,
},
{
.o_name = NNG_OPT_TLS_PEER_ALT_NAMES,
.o_get = tls_get_peer_alt_names,
},
{
.o_name = NULL,
},
Expand Down
Loading