diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-07-06 13:34:20 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-07-06 13:34:20 -0700 |
| commit | 82c70435ec9be9c607de4fbd62d4de9ae7d7c081 (patch) | |
| tree | 86b3edea0a1358395f417c689b7cb666fb77c890 /src/core | |
| parent | 8811317e2da3b5a21d6caab0cc0e12aad417edd6 (diff) | |
| download | nng-82c70435ec9be9c607de4fbd62d4de9ae7d7c081.tar.gz nng-82c70435ec9be9c607de4fbd62d4de9ae7d7c081.tar.bz2 nng-82c70435ec9be9c607de4fbd62d4de9ae7d7c081.zip | |
Initial swag at asynchronous name resolution.
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/aio.h | 6 | ||||
| -rw-r--r-- | src/core/defs.h | 6 | ||||
| -rw-r--r-- | src/core/platform.h | 9 |
3 files changed, 16 insertions, 5 deletions
diff --git a/src/core/aio.h b/src/core/aio.h index d3c238f6..ee2b084e 100644 --- a/src/core/aio.h +++ b/src/core/aio.h @@ -39,12 +39,12 @@ struct nni_aio { nni_msg * a_msg; // Connect/accept operations. - nni_sockaddr * a_remaddr; - nni_sockaddr * a_locaddr; void * a_endpt; // opaque endpoint handle void * a_pipe; // opaque pipe handle - // TBD: Resolver operations. + // Resolver operations. + nni_sockaddr * a_addrs; + int a_naddrs; // Provider-use fields. void (*a_prov_cancel)(nni_aio *); diff --git a/src/core/defs.h b/src/core/defs.h index 1c44e9af..5db68c1c 100644 --- a/src/core/defs.h +++ b/src/core/defs.h @@ -72,8 +72,10 @@ typedef struct { #define NNI_SECOND (1000000) // Structure allocation conveniences. -#define NNI_ALLOC_STRUCT(s) nni_alloc(sizeof (*s)) -#define NNI_FREE_STRUCT(s) nni_free((s), sizeof (*s)) +#define NNI_ALLOC_STRUCT(s) nni_alloc(sizeof (*s)) +#define NNI_FREE_STRUCT(s) nni_free((s), sizeof (*s)) +#define NNI_ALLOC_STRUCTS(s, n) nni_alloc(sizeof (*s) * n) +#define NNI_FREE_STRUCTS(s, n) nni_free(s, sizeof (*s) * n) #define NNI_PUT16(ptr, u) \ do { \ diff --git a/src/core/platform.h b/src/core/platform.h index 971c6a5d..0dcab40a 100644 --- a/src/core/platform.h +++ b/src/core/platform.h @@ -242,6 +242,15 @@ extern void nni_plat_tcp_aio_send(nni_plat_tcpsock *, nni_aio *); // full, or an error condition occurs. extern void nni_plat_tcp_aio_recv(nni_plat_tcpsock *, nni_aio *); +// nni_plat_tcp_resolv resolves a TCP name asynchronously. The family +// should be one of NNG_AF_INET, NNG_AF_INET6, or NNG_AF_UNSPEC. The +// first two constrain the name to those families, while the third will +// return names of either family. The passive flag indicates that the +// name will be used for bind(), otherwise the name will be used with +// connect(). The host part may be NULL only if passive is true. +extern void nni_plat_tcp_resolv(const char *, const char *, int, int, + nni_aio *); + // // IPC (UNIX Domain Sockets & Named Pipes) Support. // |
