aboutsummaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/inproc/CMakeLists.txt18
-rw-r--r--src/transport/inproc/inproc.c3
-rw-r--r--src/transport/ipc/CMakeLists.txt18
-rw-r--r--src/transport/ipc/ipc.c10
-rw-r--r--src/transport/ipc/ipc.h19
-rw-r--r--src/transport/tcp/CMakeLists.txt18
-rw-r--r--src/transport/tcp/tcp.c10
-rw-r--r--src/transport/tcp/tcp.h18
-rw-r--r--src/transport/zerotier/CMakeLists.txt50
9 files changed, 156 insertions, 8 deletions
diff --git a/src/transport/inproc/CMakeLists.txt b/src/transport/inproc/CMakeLists.txt
new file mode 100644
index 00000000..a445da85
--- /dev/null
+++ b/src/transport/inproc/CMakeLists.txt
@@ -0,0 +1,18 @@
+#
+# Copyright 2017 Garrett D'Amore <garrett@damore.org>
+# Copyright 2017 Capitar IT Group BV <info@capitar.com>
+#
+# This software is supplied under the terms of the MIT License, a
+# copy of which should be located in the distribution where this
+# file was obtained (LICENSE.txt). A copy of the license may also be
+# found online at https://opensource.org/licenses/MIT.
+#
+
+# inproc protocol
+
+if (NNG_TRANSPORT_INPROC)
+ set(INPROC_SOURCES transport/inproc/inproc.c transport/inproc/inproc.h)
+ install(FILES inproc.h DESTINATION include/nng/transport/inproc)
+endif()
+
+set(NNG_SOURCES ${NNG_SOURCES} ${INPROC_SOURCES} PARENT_SCOPE)
diff --git a/src/transport/inproc/inproc.c b/src/transport/inproc/inproc.c
index c747f7dc..ae64263c 100644
--- a/src/transport/inproc/inproc.c
+++ b/src/transport/inproc/inproc.c
@@ -475,9 +475,8 @@ struct nni_tran nni_inproc_tran = {
.tran_fini = nni_inproc_fini,
};
-
int
nng_inproc_register(void)
{
- return (nni_tran_register(&nni_inproc_tran));
+ return (nni_tran_register(&nni_inproc_tran));
}
diff --git a/src/transport/ipc/CMakeLists.txt b/src/transport/ipc/CMakeLists.txt
new file mode 100644
index 00000000..1a5496cf
--- /dev/null
+++ b/src/transport/ipc/CMakeLists.txt
@@ -0,0 +1,18 @@
+#
+# Copyright 2017 Garrett D'Amore <garrett@damore.org>
+# Copyright 2017 Capitar IT Group BV <info@capitar.com>
+#
+# This software is supplied under the terms of the MIT License, a
+# copy of which should be located in the distribution where this
+# file was obtained (LICENSE.txt). A copy of the license may also be
+# found online at https://opensource.org/licenses/MIT.
+#
+
+# ipc protocol
+
+if (NNG_TRANSPORT_IPC)
+ set(IPC_SOURCES transport/ipc/ipc.c transport/ipc/ipc.h)
+ install(FILES ipc.h DESTINATION include/nng/transport/ipc)
+endif()
+
+set(NNG_SOURCES ${NNG_SOURCES} ${IPC_SOURCES} PARENT_SCOPE)
diff --git a/src/transport/ipc/ipc.c b/src/transport/ipc/ipc.c
index afe8afa8..c13dbd34 100644
--- a/src/transport/ipc/ipc.c
+++ b/src/transport/ipc/ipc.c
@@ -704,9 +704,7 @@ static nni_tran_ep nni_ipc_ep_ops = {
.ep_options = nni_ipc_ep_options,
};
-// This is the IPC transport linkage, and should be the only global
-// symbol in this entire file.
-struct nni_tran nni_ipc_tran = {
+static nni_tran nni_ipc_tran = {
.tran_version = NNI_TRANSPORT_VERSION,
.tran_scheme = "ipc",
.tran_ep = &nni_ipc_ep_ops,
@@ -714,3 +712,9 @@ struct nni_tran nni_ipc_tran = {
.tran_init = nni_ipc_tran_init,
.tran_fini = nni_ipc_tran_fini,
};
+
+int
+nng_ipc_register(void)
+{
+ return (nni_tran_register(&nni_ipc_tran));
+}
diff --git a/src/transport/ipc/ipc.h b/src/transport/ipc/ipc.h
new file mode 100644
index 00000000..f19762c7
--- /dev/null
+++ b/src/transport/ipc/ipc.h
@@ -0,0 +1,19 @@
+//
+// Copyright 2017 Garrett D'Amore <garrett@damore.org>
+// Copyright 2017 Capitar IT Group BV <info@capitar.com>
+//
+// This software is supplied under the terms of the MIT License, a
+// copy of which should be located in the distribution where this
+// file was obtained (LICENSE.txt). A copy of the license may also be
+// found online at https://opensource.org/licenses/MIT.
+//
+
+#ifndef NNG_TRANSPORT_IPC_IPC_H
+#define NNG_TRANSPORT_IPC_IPC_H
+
+// ipc transport. This is used for inter-process communication on
+// the same host computer.
+
+extern int nng_ipc_register(void);
+
+#endif // NNG_TRANSPORT_IPC_IPC_H
diff --git a/src/transport/tcp/CMakeLists.txt b/src/transport/tcp/CMakeLists.txt
new file mode 100644
index 00000000..305c357a
--- /dev/null
+++ b/src/transport/tcp/CMakeLists.txt
@@ -0,0 +1,18 @@
+#
+# Copyright 2017 Garrett D'Amore <garrett@damore.org>
+# Copyright 2017 Capitar IT Group BV <info@capitar.com>
+#
+# This software is supplied under the terms of the MIT License, a
+# copy of which should be located in the distribution where this
+# file was obtained (LICENSE.txt). A copy of the license may also be
+# found online at https://opensource.org/licenses/MIT.
+#
+
+# TCP protocol
+
+if (NNG_TRANSPORT_TCP)
+ set(TCP_SOURCES transport/tcp/tcp.c transport/tcp/tcp.h)
+ install(FILES tcp.h DESTINATION include/nng/transport/tcp)
+endif()
+
+set(NNG_SOURCES ${NNG_SOURCES} ${TCP_SOURCES} PARENT_SCOPE)
diff --git a/src/transport/tcp/tcp.c b/src/transport/tcp/tcp.c
index 43b2890d..e33db865 100644
--- a/src/transport/tcp/tcp.c
+++ b/src/transport/tcp/tcp.c
@@ -854,9 +854,7 @@ static nni_tran_ep nni_tcp_ep_ops = {
.ep_options = nni_tcp_ep_options,
};
-// This is the TCP transport linkage, and should be the only global
-// symbol in this entire file.
-struct nni_tran nni_tcp_tran = {
+static nni_tran nni_tcp_tran = {
.tran_version = NNI_TRANSPORT_VERSION,
.tran_scheme = "tcp",
.tran_ep = &nni_tcp_ep_ops,
@@ -864,3 +862,9 @@ struct nni_tran nni_tcp_tran = {
.tran_init = nni_tcp_tran_init,
.tran_fini = nni_tcp_tran_fini,
};
+
+int
+nng_tcp_register(void)
+{
+ return (nni_tran_register(&nni_tcp_tran));
+}
diff --git a/src/transport/tcp/tcp.h b/src/transport/tcp/tcp.h
new file mode 100644
index 00000000..b4c79461
--- /dev/null
+++ b/src/transport/tcp/tcp.h
@@ -0,0 +1,18 @@
+//
+// Copyright 2017 Garrett D'Amore <garrett@damore.org>
+// Copyright 2017 Capitar IT Group BV <info@capitar.com>
+//
+// This software is supplied under the terms of the MIT License, a
+// copy of which should be located in the distribution where this
+// file was obtained (LICENSE.txt). A copy of the license may also be
+// found online at https://opensource.org/licenses/MIT.
+//
+
+#ifndef NNG_TRANSPORT_TCP_TCP_H
+#define NNG_TRANSPORT_TCP_TCP_H
+
+// TCP transport. This is used for communication over TCP/IP.
+
+extern int nng_tcp_register(void);
+
+#endif // NNG_TRANSPORT_TCP_TCP_H
diff --git a/src/transport/zerotier/CMakeLists.txt b/src/transport/zerotier/CMakeLists.txt
new file mode 100644
index 00000000..c1bb0c35
--- /dev/null
+++ b/src/transport/zerotier/CMakeLists.txt
@@ -0,0 +1,50 @@
+#
+# Copyright 2017 Garrett D'Amore <garrett@damore.org>
+# Copyright 2017 Capitar IT Group BV <info@capitar.com>
+#
+# This software is supplied under the terms of the MIT License, a
+# copy of which should be located in the distribution where this
+# file was obtained (LICENSE.txt). A copy of the license may also be
+# found online at https://opensource.org/licenses/MIT.
+#
+
+# ZeroTier protocol
+
+set (NNG_TRANSPORT_ZEROTIER_SOURCE "" CACHE PATH "Location of ZeroTier source tree.")
+
+if (NNG_TRANSPORT_ZEROTIER)
+
+ # We use the libzerotiercore.a library, which is unfortunately a C++ object
+ # even though it exposes only public C symbols. It would be extremely
+ # helpful if libzerotiercore didn't make us carry the whole C++ runtime
+ # behind us. The user must specify the location of the ZeroTier source
+ # tree (dev branch for now, and already compiled please) by setting the
+ # NNG_ZEROTIER_SOURCE macro.
+ # NB: This needs to be the zerotierone tree, not the libzt library.
+ # This is because we don't access the API, but instead use the low
+ # level zerotiercore functionality directly.
+ # NB: As we wind up linking libzerotiercore.a into the application,
+ # this means that your application will *also* need to either be licensed
+ # under the GPLv3, or you will need to have a commercial license from
+ # ZeroTier permitting its use elsewhere.
+
+ enable_language(CXX)
+ find_library(NNG_LIBZTCORE zerotiercore PATHS ${NNG_TRANSPORT_ZEROTIER_SOURCE})
+ if (NNG_LIBZTCORE)
+ set(CMAKE_REQUIRED_INCLUDES ${NNG_TRANSPORT_ZEROTIER_SOURCE}/include)
+ message(STATUS "C++ ${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES}")
+ set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${NNG_LIBZTCORE} ${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES})
+ set(NNG_REQUIRED_LIBRARIES ${NNG_REQUIRED_LIBRARIES} ${NNG_LIBZTCORE} ${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES} PARENT_SCOPE)
+ set(NNG_REQUIRED_INCLUDES ${NNG_REQUIRED_INCLUDES} ${NNG_TRANSPORT_ZEROTIER_SOURCE}/include PARENT_SCOPE)
+ nng_check_sym(ZT_Node_join ZeroTierOne.h HAVE_ZTCORE)
+ endif()
+ if (NOT HAVE_ZTCORE)
+ message (FATAL_ERROR "Cannot find ZeroTier components")
+ endif()
+ message(STATUS "Found ZeroTier at ${NNG_LIBZTCORE}")
+
+ set(ZT_SOURCES transport/zerotier/zerotier.c transport/zerotier/zerotier.h)
+ install(FILES zerotier.h DESTINATION include/nng/transport/zerotier)
+endif()
+
+set(NNG_SOURCES ${NNG_SOURCES} ${ZT_SOURCES} PARENT_SCOPE)