aboutsummaryrefslogtreecommitdiff
path: root/src/transport/tcp
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/tcp')
-rw-r--r--src/transport/tcp/CMakeLists.txt18
-rw-r--r--src/transport/tcp/tcp.c10
-rw-r--r--src/transport/tcp/tcp.h18
3 files changed, 43 insertions, 3 deletions
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