From e9a30a8185560a579c9f27b1a94b8ed5f0243d6d Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sat, 2 Nov 2024 19:17:48 -0700 Subject: [PATCH] Remove nng_ctx/socket_set/get_addr Support for setting or getting sockaddrs on sockets or on contexts makes little sense, since these are always transport specific. --- include/nng/nng.h | 5 ----- src/nng.c | 24 ------------------------ 2 files changed, 29 deletions(-) diff --git a/include/nng/nng.h b/include/nng/nng.h index 11729e283..ac82954aa 100644 --- a/include/nng/nng.h +++ b/include/nng/nng.h @@ -242,8 +242,6 @@ NNG_DECL int nng_socket_set_uint64(nng_socket, const char *, uint64_t); NNG_DECL int nng_socket_set_string(nng_socket, const char *, const char *); NNG_DECL int nng_socket_set_ptr(nng_socket, const char *, void *); NNG_DECL int nng_socket_set_ms(nng_socket, const char *, nng_duration); -NNG_DECL int nng_socket_set_addr( - nng_socket, const char *, const nng_sockaddr *); NNG_DECL int nng_socket_get(nng_socket, const char *, void *, size_t *); NNG_DECL int nng_socket_get_bool(nng_socket, const char *, bool *); @@ -253,7 +251,6 @@ NNG_DECL int nng_socket_get_uint64(nng_socket, const char *, uint64_t *); NNG_DECL int nng_socket_get_string(nng_socket, const char *, char **); NNG_DECL int nng_socket_get_ptr(nng_socket, const char *, void **); NNG_DECL int nng_socket_get_ms(nng_socket, const char *, nng_duration *); -NNG_DECL int nng_socket_get_addr(nng_socket, const char *, nng_sockaddr *); // These functions are used to obtain a file descriptor that will poll // as readable if the socket can receive or send. Applications must never @@ -485,7 +482,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); @@ -495,7 +491,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(). diff --git a/src/nng.c b/src/nng.c index 08c70857c..1707ce9f3 100644 --- a/src/nng.c +++ b/src/nng.c @@ -469,12 +469,6 @@ nng_ctx_get_ms(nng_ctx id, const char *n, nng_duration *v) return (ctx_get(id, n, v, NULL, NNI_TYPE_DURATION)); } -int -nng_ctx_get_addr(nng_ctx id, const char *n, nng_sockaddr *v) -{ - return (ctx_get(id, n, v, NULL, NNI_TYPE_SOCKADDR)); -} - static int ctx_set(nng_ctx id, const char *n, const void *v, size_t sz, nni_type t) { @@ -541,12 +535,6 @@ 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)); } -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)); -} - int nng_dial(nng_socket sid, const char *addr, nng_dialer *dp, int flags) { @@ -1065,12 +1053,6 @@ nng_socket_set_string(nng_socket id, const char *n, const char *v) id, n, v, v == NULL ? 0 : strlen(v) + 1, NNI_TYPE_STRING)); } -int -nng_socket_set_addr(nng_socket id, const char *n, const nng_sockaddr *v) -{ - return (socket_set(id, n, v, sizeof(*v), NNI_TYPE_SOCKADDR)); -} - static int socket_get(nng_socket s, const char *name, void *val, size_t *szp, nni_type t) { @@ -1136,12 +1118,6 @@ nng_socket_get_ms(nng_socket id, const char *n, nng_duration *v) return (socket_get(id, n, v, NULL, NNI_TYPE_DURATION)); } -int -nng_socket_get_addr(nng_socket id, const char *n, nng_sockaddr *v) -{ - return (socket_get(id, n, v, NULL, NNI_TYPE_SOCKADDR)); -} - int nng_socket_get_recv_poll_fd(nng_socket id, int *fdp) {