summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2018-02-23 14:48:46 -0800
committerGarrett D'Amore <garrett@damore.org>2018-02-23 14:48:46 -0800
commitc457bddfae64521ea9861f2211e6cb25858559b3 (patch)
tree4c0ef1c7450198ce14ef4fbcdddb5d47e911fb4f
parentc31c9147320741904b604e2172f99d5ca08eb417 (diff)
downloadnng-c457bddfae64521ea9861f2211e6cb25858559b3.tar.gz
nng-c457bddfae64521ea9861f2211e6cb25858559b3.tar.bz2
nng-c457bddfae64521ea9861f2211e6cb25858559b3.zip
Move compatibility header so that <nanomsg/nn.h> works.
Basically, we have moved the compat stuff into a separate directory. Compatibility layer users will have to update their compile flags, but should be able to avoid changing any *source* files with this change.
-rw-r--r--src/CMakeLists.txt5
-rw-r--r--src/compat/nanomsg/CMakeLists.txt15
-rw-r--r--src/compat/nanomsg/nn.c (renamed from src/nng_compat.c)6
-rw-r--r--src/compat/nanomsg/nn.h (renamed from src/nng_compat.h)0
-rw-r--r--tests/CMakeLists.txt15
-rw-r--r--tests/compat_block.c2
-rw-r--r--tests/compat_bug777.c7
-rw-r--r--tests/compat_bus.c2
-rw-r--r--tests/compat_cmsg.c4
-rw-r--r--tests/compat_device.c2
-rw-r--r--tests/compat_iovec.c2
-rw-r--r--tests/compat_msg.c2
-rw-r--r--tests/compat_pair.c2
-rw-r--r--tests/compat_pipeline.c2
-rw-r--r--tests/compat_reqrep.c6
-rw-r--r--tests/compat_reqttl.c4
-rw-r--r--tests/compat_shutdown.c2
-rw-r--r--tests/compat_survey.c2
-rw-r--r--tests/compat_testutil.c4
19 files changed, 45 insertions, 39 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2cf03e45..52f4f354 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -28,9 +28,6 @@ set (NNG_SOURCES
nng.c
nng.h
- nng_compat.c
- nng_compat.h
-
core/defs.h
core/aio.c
@@ -128,6 +125,8 @@ endif()
set (NNG_HEADERS nng.h)
+add_subdirectory(compat/nanomsg)
+
add_subdirectory(supplemental/base64)
add_subdirectory(supplemental/http)
add_subdirectory(supplemental/sha1)
diff --git a/src/compat/nanomsg/CMakeLists.txt b/src/compat/nanomsg/CMakeLists.txt
new file mode 100644
index 00000000..d1a692b7
--- /dev/null
+++ b/src/compat/nanomsg/CMakeLists.txt
@@ -0,0 +1,15 @@
+#
+# Copyright 2018 Capitar IT Group BV <info@capitar.com>
+# Copyright 2018 Staysail Systems, Inc. <info@staysail.tech>
+#
+# 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.
+#
+
+set(COMPAT_SOURCES compat/nanomsg/nn.c)
+set(COMPAT_HEADERS compat/nanomsg/nn.h)
+
+set(NNG_SOURCES ${NNG_SOURCES} ${COMPAT_SOURCES} PARENT_SCOPE)
+set(NNG_HEADERS ${NNG_HEADERS} ${COMPAT_HEADERS} PARENT_SCOPE)
diff --git a/src/nng_compat.c b/src/compat/nanomsg/nn.c
index 35bacb6f..1d5bcfbb 100644
--- a/src/nng_compat.c
+++ b/src/compat/nanomsg/nn.c
@@ -1,6 +1,6 @@
//
-// Copyright 2017 Garrett D'Amore <garrett@damore.org>
-// Copyright 2017 Capitar IT Group BV <info@capitar.com>
+// Copyright 2018 Garrett D'Amore <garrett@damore.org>
+// Copyright 2018 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
@@ -8,7 +8,7 @@
// found online at https://opensource.org/licenses/MIT.
//
-#include "nng_compat.h"
+#include "nn.h"
#include "nng.h"
#include "protocol/bus0/bus.h"
#include "protocol/pair0/pair.h"
diff --git a/src/nng_compat.h b/src/compat/nanomsg/nn.h
index 8c5cee6f..8c5cee6f 100644
--- a/src/nng_compat.h
+++ b/src/compat/nanomsg/nn.h
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 51903572..df7e5701 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -3,7 +3,7 @@
# Copyright (c) 2013 GoPivotal, Inc. All rights reserved.
# Copyright (c) 2015-2016 Jack R. Dunaway. All rights reserved.
# Copyright 2016 Franklin "Snaipe" Mathieu <franklinmathieu@gmail.com>
-# Copyright 2018 Garrett D'Amore <garrett@damore.org>
+# Copyright 2018 Staysail Systems, Inc. <info@staysail.tech>
# Copyright 2018 Capitar IT Group BV <info@capitar.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -53,9 +53,6 @@ if (NNG_TESTS)
target_link_libraries (${NAME} ${PROJECT_NAME}_static)
target_link_libraries (${NAME} ${NNG_REQUIRED_LIBRARIES})
target_compile_definitions(${NAME} PUBLIC -DNNG_STATIC_LIB)
- if (CMAKE_THREAD_LIBS_INIT)
- target_link_libraries (${NAME} "${CMAKE_THREAD_LIBS_INIT}")
- endif()
add_test (NAME ${NAME} COMMAND ${NAME} -v -p TEST_PORT=${TEST_PORT})
set_tests_properties (${NAME} PROPERTIES TIMEOUT ${TIMEOUT})
@@ -81,9 +78,8 @@ if (NNG_TESTS)
target_link_libraries (${NAME} ${PROJECT_NAME}_static)
target_link_libraries (${NAME} ${NNG_REQUIRED_LIBRARIES})
target_compile_definitions(${NAME} PUBLIC -DNNG_STATIC_LIB)
- if (CMAKE_THREAD_LIBS_INIT)
- target_link_libraries (${NAME} "${CMAKE_THREAD_LIBS_INIT}")
- endif()
+ target_include_directories(${NAME} PUBLIC
+ ${PROJECT_SOURCE_DIR}/src/compat)
add_test (NAME ${NAME} COMMAND ${NAME} ${TEST_PORT})
set_tests_properties (${NAME} PROPERTIES TIMEOUT ${TIMEOUT})
@@ -92,7 +88,7 @@ if (NNG_TESTS)
else ()
macro (add_nng_compat_test NAME TIMEOUT)
endmacro (add_nng_compat_test)
- message (STATUS "Compatibility tests disabled (unconfigured legacy protocols)")
+ message (STATUS "Compatibility tests disabled (unconfigured protocols)")
endif ()
macro (add_nng_cpp_test NAME TIMEOUT)
@@ -103,9 +99,6 @@ if (NNG_TESTS)
target_link_libraries (${NAME} ${PROJECT_NAME}_static)
target_link_libraries (${NAME} ${NNG_REQUIRED_LIBRARIES})
target_compile_definitions(${NAME} PUBLIC -DNNG_STATIC_LIB)
- if (CMAKE_THREAD_LIBS_INIT)
- target_link_libraries (${NAME} "${CMAKE_THREAD_LIBS_INIT}")
- endif()
add_test (NAME ${NAME} COMMAND ${NAME} ${TEST_PORT})
set_tests_properties (${NAME} PROPERTIES TIMEOUT ${TIMEOUT})
diff --git a/tests/compat_block.c b/tests/compat_block.c
index e873cc86..65bd123c 100644
--- a/tests/compat_block.c
+++ b/tests/compat_block.c
@@ -20,7 +20,7 @@
IN THE SOFTWARE.
*/
-#include "nng_compat.h"
+#include <nanomsg/nn.h>
#include "compat_testutil.h"
/* This test checks whether blocking on send/recv works as expected. */
diff --git a/tests/compat_bug777.c b/tests/compat_bug777.c
index ba4a8b02..f5cfde6a 100644
--- a/tests/compat_bug777.c
+++ b/tests/compat_bug777.c
@@ -1,6 +1,6 @@
/*
- Copyright 2017 Garrett D'Amore <garrett@damore.org>
- Copyright 2017 Capitar IT Group BV <info@capitar.com>
+ Copyright 2018 Staysail Systems, Inc. <info@staysail.tech>
+ Copyright 2018 Capitar IT Group BV <info@capitar.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"),
@@ -21,8 +21,7 @@
IN THE SOFTWARE.
*/
-#include "nng_compat.h"
-#include "nng.h"
+#include <nanomsg/nn.h>
#include "compat_testutil.h"
int main (NN_UNUSED int argc, NN_UNUSED const char *argv[])
diff --git a/tests/compat_bus.c b/tests/compat_bus.c
index ac4cc030..a8b380ab 100644
--- a/tests/compat_bus.c
+++ b/tests/compat_bus.c
@@ -20,7 +20,7 @@
IN THE SOFTWARE.
*/
-#include "nng_compat.h"
+#include <nanomsg/nn.h>
#include "compat_testutil.h"
#define SOCKET_ADDRESS_A "inproc://a"
diff --git a/tests/compat_cmsg.c b/tests/compat_cmsg.c
index 4d70dabe..9484161b 100644
--- a/tests/compat_cmsg.c
+++ b/tests/compat_cmsg.c
@@ -1,6 +1,6 @@
/*
Copyright (c) 2014 Martin Sustrik All rights reserved.
- Copyright 2015 Garrett D'Amore <garrett@damore.org>
+ Copyright 2018 Garrett D'Amore <garrett@damore.org>
Copyright 2016 Franklin "Snaipe" Mathieu <franklinmathieu@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -22,7 +22,7 @@
IN THE SOFTWARE.
*/
-#include "nng_compat.h"
+#include <nanomsg/nn.h>
#include "compat_testutil.h"
int main (int argc, const char *argv[])
diff --git a/tests/compat_device.c b/tests/compat_device.c
index e04839ef..21b9c16e 100644
--- a/tests/compat_device.c
+++ b/tests/compat_device.c
@@ -21,7 +21,7 @@
* IN THE SOFTWARE.
*/
-#include "nng_compat.h"
+#include <nanomsg/nn.h>
#include "compat_testutil.h"
#define SOCKET_ADDRESS_A "inproc://a"
diff --git a/tests/compat_iovec.c b/tests/compat_iovec.c
index 44cb5deb..6a68e1ba 100644
--- a/tests/compat_iovec.c
+++ b/tests/compat_iovec.c
@@ -20,7 +20,7 @@
IN THE SOFTWARE.
*/
-#include "nng_compat.h"
+#include <nanomsg/nn.h>
#include "compat_testutil.h"
diff --git a/tests/compat_msg.c b/tests/compat_msg.c
index 683739d3..7618ea0a 100644
--- a/tests/compat_msg.c
+++ b/tests/compat_msg.c
@@ -23,7 +23,7 @@
IN THE SOFTWARE.
*/
-#include "nng_compat.h"
+#include <nanomsg/nn.h>
#include "compat_testutil.h"
#include <string.h>
diff --git a/tests/compat_pair.c b/tests/compat_pair.c
index d12e135e..769b99fa 100644
--- a/tests/compat_pair.c
+++ b/tests/compat_pair.c
@@ -20,7 +20,7 @@
IN THE SOFTWARE.
*/
-#include "nng_compat.h"
+#include <nanomsg/nn.h>
#include "compat_testutil.h"
diff --git a/tests/compat_pipeline.c b/tests/compat_pipeline.c
index 4ed58af7..2e5b0de9 100644
--- a/tests/compat_pipeline.c
+++ b/tests/compat_pipeline.c
@@ -21,7 +21,7 @@
IN THE SOFTWARE.
*/
-#include "nng_compat.h"
+#include <nanomsg/nn.h>
#include "compat_testutil.h"
#define SOCKET_ADDRESS "inproc://a"
diff --git a/tests/compat_reqrep.c b/tests/compat_reqrep.c
index 046955cf..79bb74bb 100644
--- a/tests/compat_reqrep.c
+++ b/tests/compat_reqrep.c
@@ -1,7 +1,7 @@
/*
Copyright (c) 2012 Martin Sustrik All rights reserved.
- Copyright 2017 Garrett D'Amore <garrett@damore.org>
- Copyright 2017 Capitar IT Group BV <info@capitar.com>
+ Copyright 2018 Staysail Systems, Inc. <info@staysail.tech>
+ Copyright 2018 Capitar IT Group BV <info@capitar.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"),
@@ -22,7 +22,7 @@
IN THE SOFTWARE.
*/
-#include "nng_compat.h"
+#include <nanomsg/nn.h>
#include "compat_testutil.h"
diff --git a/tests/compat_reqttl.c b/tests/compat_reqttl.c
index c758f92e..84c73e09 100644
--- a/tests/compat_reqttl.c
+++ b/tests/compat_reqttl.c
@@ -2,7 +2,7 @@
Copyright (c) 2012 Martin Sustrik All rights reserved.
Copyright (c) 2013 GoPivotal, Inc. All rights reserved.
Copyright 2016 Franklin "Snaipe" Mathieu <franklinmathieu@gmail.com>
- Copyright 2017 Garrett D'Amore <garrett@damore.org>
+ Copyright 2018 Garrett D'Amore <garrett@damore.org>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"),
@@ -23,7 +23,7 @@
IN THE SOFTWARE.
*/
-#include "nng_compat.h"
+#include <nanomsg/nn.h>
#include "compat_testutil.h"
diff --git a/tests/compat_shutdown.c b/tests/compat_shutdown.c
index 834eacee..6d078ee2 100644
--- a/tests/compat_shutdown.c
+++ b/tests/compat_shutdown.c
@@ -21,7 +21,7 @@
IN THE SOFTWARE.
*/
-#include "nng_compat.h"
+#include <nanomsg/nn.h>
#include "compat_testutil.h"
int main (int argc, const char *argv[])
diff --git a/tests/compat_survey.c b/tests/compat_survey.c
index fc5f8091..30b7ae68 100644
--- a/tests/compat_survey.c
+++ b/tests/compat_survey.c
@@ -21,7 +21,7 @@
DEALINGS IN THE SOFTWARE.
*/
-#include "nng_compat.h"
+#include <nanomsg/nn.h>
#include "compat_testutil.h"
diff --git a/tests/compat_testutil.c b/tests/compat_testutil.c
index e24f31fc..ef17cb3f 100644
--- a/tests/compat_testutil.c
+++ b/tests/compat_testutil.c
@@ -32,8 +32,8 @@
#include <stdlib.h>
#include <string.h>
+#include <nanomsg/nn.h>
#include "compat_testutil.h"
-#include "nng_compat.h"
int test_socket_impl(char *file, int line, int family, int protocol);
int test_connect_impl(char *file, int line, int sock, char *address);
@@ -226,4 +226,4 @@ void
nn_sleep(int ms)
{
nng_msleep(ms);
-} \ No newline at end of file
+}