diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-06-02 23:33:27 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-02 23:33:27 -0700 |
| commit | 603282f28e6f2e1b32d3a587d8de761f9f94ad45 (patch) | |
| tree | b90b5f4c057979524e6b4a12a74742c7da25c484 /src/nng.c | |
| parent | 890d4899138ff497a48ba4aaa2385b3ed2b84ac4 (diff) | |
| download | nng-603282f28e6f2e1b32d3a587d8de761f9f94ad45.tar.gz nng-603282f28e6f2e1b32d3a587d8de761f9f94ad45.tar.bz2 nng-603282f28e6f2e1b32d3a587d8de761f9f94ad45.zip | |
UDP: Introduce an experimental (undocumented for now) public API for UDP. (#1838)
This exposes the UDP methods as nng_ methods, and adds support for Multicast Membership,
which is useful in a variety of situations.
No documentation is provided, and applications should consider thios API experimental.
Diffstat (limited to 'src/nng.c')
| -rw-r--r-- | src/nng.c | 39 |
1 files changed, 39 insertions, 0 deletions
@@ -10,6 +10,7 @@ #include "nng/nng.h" #include "core/nng_impl.h" +#include "core/platform.h" // This file provides the "public" API. This is a thin wrapper around // internal API functions. We use the public prefix instead of internal, @@ -2174,3 +2175,41 @@ nng_socket_pair(int fds[2]) { return (nni_socket_pair(fds)); } + +int +nng_udp_open(nng_udp **udp, nng_sockaddr *sa) +{ + (void) nni_init(); + return (nni_plat_udp_open((nni_plat_udp **) udp, sa)); +} + +void +nng_udp_close(nng_udp *udp) +{ + nni_plat_udp_close((nni_plat_udp *) udp); +} + +int +nng_udp_sockname(nng_udp *udp, nng_sockaddr *sa) +{ + return (nni_plat_udp_sockname((nni_plat_udp *) udp, sa)); +} + +void +nng_udp_send(nng_udp *udp, nng_aio *aio) +{ + nni_plat_udp_send((nni_plat_udp *) udp, aio); +} + +void +nng_udp_recv(nng_udp *udp, nng_aio *aio) +{ + nni_plat_udp_recv((nni_plat_udp *) udp, aio); +} + +int +nng_udp_multicast_membership(nng_udp *udp, nng_sockaddr *sa, bool join) +{ + return ( + nni_plat_udp_multicast_membership((nni_plat_udp *) udp, sa, join)); +} |
