aboutsummaryrefslogtreecommitdiff
path: root/src/transport/ipc
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-08-20 10:45:27 -0700
committerGarrett D'Amore <garrett@damore.org>2017-08-21 07:18:31 -0700
commit75adda86be49e6839e50443f0bae5875d9910897 (patch)
treee29b8b449c863be01e5f02945940dc390b239462 /src/transport/ipc
parent6305e16ab64e42fd9791819d416a6e3534439b0b (diff)
downloadnng-75adda86be49e6839e50443f0bae5875d9910897.tar.gz
nng-75adda86be49e6839e50443f0bae5875d9910897.tar.bz2
nng-75adda86be49e6839e50443f0bae5875d9910897.zip
fixes #41 Move DNS out of tcp transport
This moves the DNS related functionality into common code, and also removes all the URL parsing stuff out of the platform specific code and into the transports. Now the transports just take sockaddr's on initialization. (We may want to move this until later.) We also add UDP resolution as another separate API.
Diffstat (limited to 'src/transport/ipc')
-rw-r--r--src/transport/ipc/ipc.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/transport/ipc/ipc.c b/src/transport/ipc/ipc.c
index 11bfceb9..3430ceb3 100644
--- a/src/transport/ipc/ipc.c
+++ b/src/transport/ipc/ipc.c
@@ -485,18 +485,24 @@ nni_ipc_ep_fini(void *arg)
static int
nni_ipc_ep_init(void **epp, const char *url, nni_sock *sock, int mode)
{
- nni_ipc_ep *ep;
- int rv;
+ nni_ipc_ep * ep;
+ int rv;
+ nni_sockaddr sa;
if ((strlen(url) > NNG_MAXADDRLEN - 1) ||
(strncmp(url, "ipc://", strlen("ipc://")) != 0)) {
return (NNG_EADDRINVAL);
}
+ sa.s_un.s_path.sa_family = NNG_AF_IPC;
+ (void) snprintf(sa.s_un.s_path.sa_path, sizeof(sa.s_un.s_path.sa_path),
+ "%s", url + strlen("ipc://"));
+
if ((ep = NNI_ALLOC_STRUCT(ep)) == NULL) {
return (NNG_ENOMEM);
}
- if ((rv = nni_plat_ipc_ep_init(&ep->iep, url, mode)) != 0) {
+ url += strlen("ipc://");
+ if ((rv = nni_plat_ipc_ep_init(&ep->iep, &sa, mode)) != 0) {
NNI_FREE_STRUCT(ep);
return (rv);
}