From f4908daaaad443834d9f270e7ddc5e2e23d0f7a5 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sat, 6 Jan 2024 19:22:56 -0800 Subject: [PATCH] fix idhash not public We accidentally made idhash not public by not publishing its header in the right place. This is really generic utility stuff, so we have posted it in the nng/supplemental/util/ directory. We've also removed the ability to remove this -- its a very small amount of additional code, as its just a wrapper on top of mandatory functionality. --- cmake/NNGOptions.cmake | 7 +------ docs/man/nng_id_map.3supp.adoc | 4 ++-- .../idhash => include/nng/supplemental/util}/idhash.h | 6 +++--- src/supplemental/CMakeLists.txt | 5 ++--- src/supplemental/idhash/CMakeLists.txt | 11 ----------- src/supplemental/util/CMakeLists.txt | 10 +++++++--- src/supplemental/{idhash => util}/idhash.c | 6 ++++-- src/supplemental/{idhash => util}/idhash_test.c | 4 ++-- 8 files changed, 21 insertions(+), 32 deletions(-) rename {src/supplemental/idhash => include/nng/supplemental/util}/idhash.h (84%) delete mode 100644 src/supplemental/idhash/CMakeLists.txt rename src/supplemental/{idhash => util}/idhash.c (89%) rename src/supplemental/{idhash => util}/idhash_test.c (98%) diff --git a/cmake/NNGOptions.cmake b/cmake/NNGOptions.cmake index d6240bc8b..6335fc639 100644 --- a/cmake/NNGOptions.cmake +++ b/cmake/NNGOptions.cmake @@ -1,5 +1,5 @@ # -# Copyright 2023 Staysail Systems, Inc. +# Copyright 2024 Staysail Systems, Inc. # # This software is supplied under the terms of the MIT License, a # copy of which should be located in the distribution where this @@ -141,8 +141,3 @@ if (NNG_TRANSPORT_WS OR NNG_TRANSPORT_WSS) set(NNG_SUPP_BASE64 ON) set(NNG_SUPP_SHA1 ON) endif() - -# ID hash API is small wrapper around core, probably should always be enabled unless memory -# is extraordinarily constrained. -option(NNG_SUPP_IDHASH "Enable application IDHASH API" ON) -mark_as_advanced(NNG_SUPP_IDHASH) \ No newline at end of file diff --git a/docs/man/nng_id_map.3supp.adoc b/docs/man/nng_id_map.3supp.adoc index bd5dace30..343c0667a 100644 --- a/docs/man/nng_id_map.3supp.adoc +++ b/docs/man/nng_id_map.3supp.adoc @@ -1,6 +1,6 @@ = nng_id_map(3supp) // -// Copyright 2023 Staysail Systems, Inc. +// Copyright 2024 Staysail Systems, Inc. // // This document is supplied under the terms of the MIT License, a // copy of which should be located in the distribution where this @@ -17,7 +17,7 @@ nng_id_map - identifier based mapping table [source, c] ---- #include -#include +#include typedef struct nng_id_map_s nng_id_map; diff --git a/src/supplemental/idhash/idhash.h b/include/nng/supplemental/util/idhash.h similarity index 84% rename from src/supplemental/idhash/idhash.h rename to include/nng/supplemental/util/idhash.h index 5fd8f235c..7939ab1c4 100644 --- a/src/supplemental/idhash/idhash.h +++ b/include/nng/supplemental/util/idhash.h @@ -1,5 +1,5 @@ // -// Copyright 2023 Staysail Systems, Inc. +// Copyright 2024 Staysail Systems, Inc. // // This software is supplied under the terms of the MIT License, a // copy of which should be located in the distribution where this @@ -7,8 +7,8 @@ // found online at https://opensource.org/licenses/MIT. // -#ifndef NNG_SUPPLEMENTAL_IDHASH_IDHASH_H -#define NNG_SUPPLEMENTAL_IDHASH_IDHASH_H +#ifndef NNG_SUPPLEMENTAL_UTIL_IDHASH_H +#define NNG_SUPPLEMENTAL_UTIL_IDHASH_H #include diff --git a/src/supplemental/CMakeLists.txt b/src/supplemental/CMakeLists.txt index 3fa254e79..2dcf228e8 100644 --- a/src/supplemental/CMakeLists.txt +++ b/src/supplemental/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright 2021 Staysail Systems, Inc. +# Copyright 2024 Staysail Systems, Inc. # # This software is supplied under the terms of the MIT License, a # copy of which should be located in the distribution where this @@ -11,8 +11,7 @@ nng_directory(supplemental) add_subdirectory(base64) add_subdirectory(http) -add_subdirectory(idhash) add_subdirectory(sha1) add_subdirectory(tls) add_subdirectory(util) -add_subdirectory(websocket) \ No newline at end of file +add_subdirectory(websocket) diff --git a/src/supplemental/idhash/CMakeLists.txt b/src/supplemental/idhash/CMakeLists.txt deleted file mode 100644 index 3a9bbb0bd..000000000 --- a/src/supplemental/idhash/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -# -# Copyright 2023 Staysail Systems, Inc. -# -# 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. -# - -nng_sources_if(NNG_SUPP_IDHASH idhash.c idhash.h) -nng_test_if(NNG_SUPP_IDHASH idhash_test) diff --git a/src/supplemental/util/CMakeLists.txt b/src/supplemental/util/CMakeLists.txt index 5a144da96..f62026fbe 100644 --- a/src/supplemental/util/CMakeLists.txt +++ b/src/supplemental/util/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright 2019 Staysail Systems, Inc. +# Copyright 2024 Staysail Systems, Inc. # # This software is supplied under the terms of the MIT License, a # copy of which should be located in the distribution where this @@ -7,5 +7,9 @@ # found online at https://opensource.org/licenses/MIT. # -nng_sources(options.c platform.c) -nng_headers(nng/supplemental/util/options.h nng/supplemental/util/platform.h) +nng_sources(idhash.c options.c platform.c) +nng_headers( + nng/supplemental/util/idhash.h + nng/supplemental/util/options.h + nng/supplemental/util/platform.h) +nng_test(idhash_test) diff --git a/src/supplemental/idhash/idhash.c b/src/supplemental/util/idhash.c similarity index 89% rename from src/supplemental/idhash/idhash.c rename to src/supplemental/util/idhash.c index 051b686ac..cf48df3e1 100644 --- a/src/supplemental/idhash/idhash.c +++ b/src/supplemental/util/idhash.c @@ -1,5 +1,5 @@ // -// Copyright 2023 Staysail Systems, Inc. +// Copyright 2024 Staysail Systems, Inc. // // This software is supplied under the terms of the MIT License, a // copy of which should be located in the distribution where this @@ -7,7 +7,9 @@ // found online at https://opensource.org/licenses/MIT. // -#include "supplemental/idhash/idhash.h" +#include +#include + #include "core/nng_impl.h" struct nng_id_map_s { diff --git a/src/supplemental/idhash/idhash_test.c b/src/supplemental/util/idhash_test.c similarity index 98% rename from src/supplemental/idhash/idhash_test.c rename to src/supplemental/util/idhash_test.c index 367f34bcc..5bbdc4fb7 100644 --- a/src/supplemental/idhash/idhash_test.c +++ b/src/supplemental/util/idhash_test.c @@ -1,5 +1,5 @@ // -// Copyright 2023 Staysail Systems, Inc. +// Copyright 2024 Staysail Systems, Inc. // // This software is supplied under the terms of the MIT License, a // copy of which should be located in the distribution where this @@ -9,7 +9,7 @@ #include -#include "idhash.h" +#include void test_id_basic(void)