forked from nanomsg/nng
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes nanomsg#289 nng_sockaddr could just be a union
fixes nanomsg#290 sockaddr improvements
- Loading branch information
Showing
25 changed files
with
241 additions
and
243 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
// | ||
// Copyright 2017 Garrett D'Amore <[email protected]> | ||
// Copyright 2018 Staysail Systems, Inc. <[email protected]> | ||
// Copyright 2018 Capitar IT Group BV <[email protected]> | ||
// | ||
// This software is supplied under the terms of the MIT License, a | ||
// copy of which should be located in the distribution where this | ||
|
@@ -145,19 +146,18 @@ nni_win_resolv_task(void *arg) | |
|
||
switch (probe->ai_addr->sa_family) { | ||
case AF_INET: | ||
rv = 0; | ||
sin = (void *) probe->ai_addr; | ||
sa->s_un.s_in.sa_family = NNG_AF_INET; | ||
sa->s_un.s_in.sa_port = sin->sin_port; | ||
sa->s_un.s_in.sa_addr = sin->sin_addr.s_addr; | ||
rv = 0; | ||
sin = (void *) probe->ai_addr; | ||
sa->s_in.sa_family = NNG_AF_INET; | ||
sa->s_in.sa_port = sin->sin_port; | ||
sa->s_in.sa_addr = sin->sin_addr.s_addr; | ||
break; | ||
case AF_INET6: | ||
rv = 0; | ||
sin6 = (void *) probe->ai_addr; | ||
sa->s_un.s_in6.sa_family = NNG_AF_INET6; | ||
sa->s_un.s_in6.sa_port = sin6->sin6_port; | ||
memcpy(sa->s_un.s_in6.sa_addr, sin6->sin6_addr.s6_addr, | ||
16); | ||
rv = 0; | ||
sin6 = (void *) probe->ai_addr; | ||
sa->s_in6.sa_family = NNG_AF_INET6; | ||
sa->s_in6.sa_port = sin6->sin6_port; | ||
memcpy(sa->s_in6.sa_addr, sin6->sin6_addr.s6_addr, 16); | ||
break; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// | ||
// Copyright 2017 Garrett D'Amore <[email protected]> | ||
// Copyright 2017 Capitar IT Group BV <[email protected]> | ||
// Copyright 2018 Staysail Systems, Inc. <[email protected]> | ||
// Copyright 2018 Capitar IT Group BV <[email protected]> | ||
// | ||
// This software is supplied under the terms of the MIT License, a | ||
// copy of which should be located in the distribution where this | ||
|
@@ -23,21 +23,21 @@ nni_win_nn2sockaddr(SOCKADDR_STORAGE *ss, const nni_sockaddr *sa) | |
if ((ss == NULL) || (sa == NULL)) { | ||
return (-1); | ||
} | ||
switch (sa->s_un.s_family) { | ||
switch (sa->s_family) { | ||
case NNG_AF_INET: | ||
sin = (void *) ss; | ||
memset(sin, 0, sizeof(*sin)); | ||
sin->sin_family = PF_INET; | ||
sin->sin_port = sa->s_un.s_in.sa_port; | ||
sin->sin_addr.s_addr = sa->s_un.s_in.sa_addr; | ||
sin->sin_port = sa->s_in.sa_port; | ||
sin->sin_addr.s_addr = sa->s_in.sa_addr; | ||
return (sizeof(*sin)); | ||
|
||
case NNG_AF_INET6: | ||
sin6 = (void *) ss; | ||
memset(sin6, 0, sizeof(*sin6)); | ||
sin6->sin6_family = PF_INET6; | ||
sin6->sin6_port = sa->s_un.s_in6.sa_port; | ||
memcpy(sin6->sin6_addr.s6_addr, sa->s_un.s_in6.sa_addr, 16); | ||
sin6->sin6_port = sa->s_in6.sa_port; | ||
memcpy(sin6->sin6_addr.s6_addr, sa->s_in6.sa_addr, 16); | ||
return (sizeof(*sin6)); | ||
} | ||
return (-1); | ||
|
@@ -54,17 +54,17 @@ nni_win_sockaddr2nn(nni_sockaddr *sa, const SOCKADDR_STORAGE *ss) | |
} | ||
switch (ss->ss_family) { | ||
case PF_INET: | ||
sin = (void *) ss; | ||
sa->s_un.s_in.sa_family = NNG_AF_INET; | ||
sa->s_un.s_in.sa_port = sin->sin_port; | ||
sa->s_un.s_in.sa_addr = sin->sin_addr.s_addr; | ||
sin = (void *) ss; | ||
sa->s_in.sa_family = NNG_AF_INET; | ||
sa->s_in.sa_port = sin->sin_port; | ||
sa->s_in.sa_addr = sin->sin_addr.s_addr; | ||
return (0); | ||
|
||
case PF_INET6: | ||
sin6 = (void *) ss; | ||
sa->s_un.s_in6.sa_family = NNG_AF_INET6; | ||
sa->s_un.s_in6.sa_port = sin6->sin6_port; | ||
memcpy(sa->s_un.s_in6.sa_addr, sin6->sin6_addr.s6_addr, 16); | ||
sin6 = (void *) ss; | ||
sa->s_in6.sa_family = NNG_AF_INET6; | ||
sa->s_in6.sa_port = sin6->sin6_port; | ||
memcpy(sa->s_in6.sa_addr, sin6->sin6_addr.s6_addr, 16); | ||
return (0); | ||
} | ||
return (-1); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.