Skip to content

Commit

Permalink
Remove nng_ctx/socket_set/get_addr
Browse files Browse the repository at this point in the history
Support for setting or getting sockaddrs on sockets or on
contexts makes little sense, since these are always transport specific.
  • Loading branch information
gdamore committed Nov 3, 2024
1 parent 279180c commit e9a30a8
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 29 deletions.
5 changes: 0 additions & 5 deletions include/nng/nng.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 *);
Expand All @@ -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
Expand Down Expand Up @@ -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);
Expand All @@ -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().
Expand Down
24 changes: 0 additions & 24 deletions src/nng.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand Down

0 comments on commit e9a30a8

Please sign in to comment.