aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-10-02 17:32:11 -0700
committerGarrett D'Amore <garrett@damore.org>2017-10-03 09:47:08 -0700
commit6fef4c1e5bf73ad76e7cdcfb65540f1308045339 (patch)
treeca50ca2c27fb2d0a44ee9dc317cc0b673eaf9e66 /src/core
parent6e945e18f3f3e9b7f9ee614eac6d3bf681f768d9 (diff)
downloadnng-6fef4c1e5bf73ad76e7cdcfb65540f1308045339.tar.gz
nng-6fef4c1e5bf73ad76e7cdcfb65540f1308045339.tar.bz2
nng-6fef4c1e5bf73ad76e7cdcfb65540f1308045339.zip
fixes #5 Address properties
Added TCP socket address properties on pipes. This adds the plumbing for the various platform specifics, and includes both v4 and v6 handling. We've included a TCPv6 test as well.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/platform.h6
-rw-r--r--src/core/strs.c4
2 files changed, 10 insertions, 0 deletions
diff --git a/src/core/platform.h b/src/core/platform.h
index 7bfb370a..10074677 100644
--- a/src/core/platform.h
+++ b/src/core/platform.h
@@ -233,6 +233,12 @@ extern void nni_plat_tcp_pipe_send(nni_plat_tcp_pipe *, nni_aio *);
// The platform may modify the iovs.
extern void nni_plat_tcp_pipe_recv(nni_plat_tcp_pipe *, nni_aio *);
+// nni_plat_tcp_pipe_peername gets the peer name.
+extern int nni_plat_tcp_pipe_peername(nni_plat_tcp_pipe *, nni_sockaddr *);
+
+// nni_plat_tcp_pipe_sockname gets the local name.
+extern int nni_plat_tcp_pipe_sockname(nni_plat_tcp_pipe *, nni_sockaddr *);
+
// 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
diff --git a/src/core/strs.c b/src/core/strs.c
index 08338499..6cee605b 100644
--- a/src/core/strs.c
+++ b/src/core/strs.c
@@ -21,7 +21,11 @@ char *
nni_strdup(const char *src)
{
#ifdef NNG_HAVE_STRDUP
+#ifdef _WIN32
+ return (_strdup(src));
+#else
return (strdup(src));
+#endif
#else
char * dst;
size_t len = strlen(src);