diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-07-21 14:03:08 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-07-25 12:17:06 -0700 |
| commit | 9e5149973d5d16efec14ee12e62de23198b325ce (patch) | |
| tree | c5392103d62d185016666f5bb7d1f447e2686389 /src/core | |
| parent | 2579a853e6db72ba75a1e3e6c30997364b9df32d (diff) | |
| download | nng-9e5149973d5d16efec14ee12e62de23198b325ce.tar.gz nng-9e5149973d5d16efec14ee12e62de23198b325ce.tar.bz2 nng-9e5149973d5d16efec14ee12e62de23198b325ce.zip | |
Initial swag at UDP (POSIX only) low level handling.
This includes async send and recv, driven from the poller. This will
be requierd to support the underlying UDP and ZeroTier transports in
the future. (ZeroTier is getting done first.)
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/platform.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/core/platform.h b/src/core/platform.h index ed32c550..fa93916c 100644 --- a/src/core/platform.h +++ b/src/core/platform.h @@ -289,6 +289,35 @@ extern void nni_plat_ipc_pipe_send(nni_plat_ipc_pipe *, nni_aio *); extern void nni_plat_ipc_pipe_recv(nni_plat_ipc_pipe *, nni_aio *); // +// UDP support. UDP is not connection oriented, and only has the notion +// of being bound, sendto, and recvfrom. (It is possible to set up a +// connect call that semantically acts as a filter on recvfrom, but we +// don't use that.) Outbound packets will include the destination address +// in the AIO, and inbound packets include the source address in the AIO. +// For now we don't have more sophisticated options like setting the TTL. +// +typedef struct nni_plat_udp nni_plat_udp; + +// nni_plat_udp_open initializes a UDP socket, binding to the local +// address specified specified in the AIO. The remote address is +// not used. The resulting nni_plat_udp structure is returned in the +// the aio's a_pipe. +extern int nni_plat_udp_open(nni_plat_udp **, nni_sockaddr *); + +// nni_plat_udp_close closes the underlying UDP socket. +extern void nni_plat_udp_close(nni_plat_udp *); + +// nni_plat_udp_send sends the data in the aio to the the +// destination specified in the nni_aio. The iovs are the +// UDP payload. +extern void nni_plat_udp_send(nni_plat_udp *, nni_aio *); + +// nni_plat_udp_pipe_recv recvs a message, storing it in the iovs +// from the UDP payload. If the UDP payload will not fit, then +// NNG_EMSGSIZE results. +extern void nni_plat_udp_recv(nni_plat_udp *, nni_aio *); + +// // Notification Pipe Pairs // |
