diff --git a/.github/actions/build-cpp/entrypoint.sh b/.github/actions/build-cpp/entrypoint.sh index 897aa2be8..ef5dee54b 100644 --- a/.github/actions/build-cpp/entrypoint.sh +++ b/.github/actions/build-cpp/entrypoint.sh @@ -20,8 +20,10 @@ function build() { cp -rf /github/workspace/CMakeLists.txt /pktvisor-src/ cp -rf /github/workspace/conanfile.py /pktvisor-src/ cp -rf /github/workspace/.conanrc /pktvisor-src/ + cp -rf /github/workspace/conan/ /pktvisor-src/conan/ cd /pktvisor-src/ conan profile detect -f + conan export /pktvisor-src/conan/corrade/ --name=corrade --version=cci.20260327 cd /pktvisor-src/build/ if [ "$INPUT_ARCH" == "amd64" ]; then PKG_CONFIG_PATH=/local/lib/pkgconfig cmake .. -DCMAKE_BUILD_TYPE=$INPUT_BUILD_TYPE \ diff --git a/.github/workflows/build-develop.yml b/.github/workflows/build-develop.yml index 58aaaec1e..f7bb72e25 100644 --- a/.github/workflows/build-develop.yml +++ b/.github/workflows/build-develop.yml @@ -43,16 +43,22 @@ jobs: uses: actions/cache@v5 with: path: ${{github.workspace}}/build/p/ - key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }} + key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py', 'conan/corrade/**') }} restore-keys: conan-${{ runner.os }}- - + - name: Detect Conan Profile - run: conan profile detect -f + run: | + conan profile detect -f + echo "[conf]" >> "$(conan profile path default)" + echo "tools.apple:sdk_path=$(xcrun --sdk macosx --show-sdk-path)" >> "$(conan profile path default)" + + - name: Export local Corrade recipe + run: conan export ${{github.workspace}}/conan/corrade/ --name=corrade --version=cci.20260327 - name: Configure CMake shell: bash working-directory: ${{github.workspace}}/build - run: PKG_CONFIG_PATH=${{github.workspace}}/local/lib/pkgconfig cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=./cmake/conan_provider.cmake -DCONAN_INSTALL_ARGS="--build=missing;-c=corrade/*:tools.build:cxxflags=['-include','vector']" + run: PKG_CONFIG_PATH=${{github.workspace}}/local/lib/pkgconfig cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=./cmake/conan_provider.cmake -DCONAN_INSTALL_ARGS="--build=missing" - name: Build working-directory: ${{github.workspace}}/build @@ -83,9 +89,12 @@ jobs: uses: actions/cache@v5 with: path: ${{github.workspace}}/build/p/ - key: conan-${{ runner.os }}-amd64-${{ hashFiles('conanfile.py', '*/conanfile.py') }} + key: conan-${{ runner.os }}-amd64-${{ hashFiles('conanfile.py', '*/conanfile.py', 'conan/corrade/**') }} restore-keys: conan-${{ runner.os }}-amd64- + - name: Export local Corrade recipe + run: conan export ${{github.workspace}}/conan/corrade/ --name=corrade --version=cci.20260327 + - name: Configure CMake shell: bash working-directory: ${{github.workspace}}/build @@ -131,9 +140,13 @@ jobs: uses: actions/cache@v5 with: path: ${{github.workspace}}/build/p/ - key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }} + key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py', 'conan/corrade/**') }} restore-keys: conan-${{ runner.os }}- + - name: Export local Corrade recipe + shell: bash + run: conan export $GITHUB_WORKSPACE/conan/corrade/ --name=corrade --version=cci.20260327 + - name: Configure CMake shell: bash working-directory: ${{github.workspace}}\build @@ -238,7 +251,7 @@ jobs: uses: actions/cache@v5 with: path: ${{github.workspace}}/build/p/ - key: conan-${{ runner.os }}-amd64-${{ hashFiles('conanfile.py', '*/conanfile.py') }} + key: conan-${{ runner.os }}-amd64-${{ hashFiles('conanfile.py', '*/conanfile.py', 'conan/corrade/**') }} restore-keys: conan-${{ runner.os }}-amd64- - name: Build pktvisord + push symbol to backtrace.io @@ -337,9 +350,12 @@ jobs: uses: actions/cache@v5 with: path: ${{github.workspace}}/build/p/ - key: conan-${{ runner.os }}-amd64-${{ hashFiles('conanfile.py', '*/conanfile.py') }} + key: conan-${{ runner.os }}-amd64-${{ hashFiles('conanfile.py', '*/conanfile.py', 'conan/corrade/**') }} restore-keys: conan-${{ runner.os }}-amd64- + - name: Export local Corrade recipe + run: conan export ${{github.workspace}}/conan/corrade/ --name=corrade --version=cci.20260327 + - name: Configure CMake to generate VERSION shell: bash working-directory: ${{github.workspace}}/build @@ -425,7 +441,7 @@ jobs: uses: actions/cache@v5 with: path: ${{github.workspace}}/build/p/ - key: conan-${{ runner.os }}-arm64-${{ hashFiles('conanfile.py', '*/conanfile.py') }} + key: conan-${{ runner.os }}-arm64-${{ hashFiles('conanfile.py', '*/conanfile.py', 'conan/corrade/**') }} restore-keys: conan-${{ runner.os }}-arm64- - name: Build pktvisord + push symbol to backtrace.io diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 19c036c5e..47f8062df 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -36,9 +36,12 @@ jobs: uses: actions/cache@v5 with: path: ${{github.workspace}}/build/p/ - key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }} + key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py', 'conan/corrade/**') }} restore-keys: conan-${{ runner.os }}- + - name: Export local Corrade recipe + run: conan export ${{github.workspace}}/conan/corrade/ --name=corrade --version=cci.20260327 + - name: Configure CMake shell: bash working-directory: ${{github.workspace}}/build @@ -76,6 +79,9 @@ jobs: id: conan uses: turtlebrowser/get-conan@c171f295f3f507360ee018736a6608731aa2109d #v1.2 + - name: Export local Corrade recipe + run: conan export ${{github.workspace}}/conan/corrade/ --name=corrade --version=cci.20260327 + - name: Configure CMake to generate VERSION shell: bash working-directory: ${{github.workspace}}/build @@ -120,11 +126,14 @@ jobs: id: conan uses: turtlebrowser/get-conan@c171f295f3f507360ee018736a6608731aa2109d #v1.2 + - name: Export local Corrade recipe + run: conan export ${{github.workspace}}/conan/corrade/ --name=corrade --version=cci.20260327 + - name: Configure CMake to generate VERSION shell: bash working-directory: ${{github.workspace}}/build run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=./cmake/conan_provider.cmake - + - name: Set variables run: | echo "LAST_TAG=`git tag --sort=committerdate | tail -1`" >> $GITHUB_ENV @@ -178,9 +187,13 @@ jobs: uses: actions/cache@v5 with: path: ${{github.workspace}}/build/p/ - key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }} + key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py', 'conan/corrade/**') }} restore-keys: conan-${{ runner.os }}- + - name: Export local Corrade recipe + shell: bash + run: conan export $GITHUB_WORKSPACE/conan/corrade/ --name=corrade --version=cci.20260327 + - name: Configure CMake shell: bash working-directory: ${{github.workspace}}\build @@ -288,7 +301,7 @@ jobs: uses: actions/cache@v5 with: path: ${{github.workspace}}/build/p/ - key: conan-${{ runner.os }}-arm64-${{ hashFiles('conanfile.py', '*/conanfile.py') }} + key: conan-${{ runner.os }}-arm64-${{ hashFiles('conanfile.py', '*/conanfile.py', 'conan/corrade/**') }} restore-keys: conan-${{ runner.os }}-arm64- - name: Build pktvisord + push symbol to backtrace.io @@ -407,7 +420,7 @@ jobs: uses: actions/cache@v5 with: path: ${{github.workspace}}/build/p/ - key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }} + key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py', 'conan/corrade/**') }} restore-keys: conan-${{ runner.os }}- - name: Build pktvisord + push symbol to backtrace.io diff --git a/.github/workflows/build_cross.yml b/.github/workflows/build_cross.yml index 1dda4a7a4..db798a474 100644 --- a/.github/workflows/build_cross.yml +++ b/.github/workflows/build_cross.yml @@ -119,9 +119,13 @@ jobs: uses: actions/cache@v5 with: path: ${{github.workspace}}/src/build/p/ - key: conan-${{ runner.os }}-${{matrix.arch}}-${{ hashFiles('**/conanfile.py') }} + key: conan-${{ runner.os }}-${{matrix.arch}}-${{ hashFiles('**/conanfile.py', 'src/conan/corrade/**') }} restore-keys: conan-${{ runner.os }}-${{matrix.arch}}- + - name: Export local Corrade recipe + working-directory: ${{github.workspace}}/src + run: conan export conan/corrade/ --name=corrade --version=cci.20260327 + - name: Install dependencies working-directory: ${{github.workspace}}/src run: | @@ -179,6 +183,12 @@ jobs: - name: Checkout sources uses: actions/checkout@v6 + - name: Install Conan + run: pip install --no-cache-dir conan --force-reinstall + + - name: Export local Corrade recipe + run: conan export ${{github.workspace}}/conan/corrade/ --name=corrade --version=cci.20260327 + - name: Configure CMake to generate VERSION shell: bash run: VERSION_ONLY=1 cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Release -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=./cmake/conan_provider.cmake diff --git a/.github/workflows/build_debug.yml b/.github/workflows/build_debug.yml index f9941dbe5..b6187a87d 100644 --- a/.github/workflows/build_debug.yml +++ b/.github/workflows/build_debug.yml @@ -28,7 +28,7 @@ jobs: uses: actions/cache@v5 with: path: ${{github.workspace}}/build/p/ - key: conan-${{ runner.os }}-amd64-${{ hashFiles('conanfile.py', '*/conanfile.py') }} + key: conan-${{ runner.os }}-amd64-${{ hashFiles('conanfile.py', '*/conanfile.py', 'conan/corrade/**') }} restore-keys: conan-${{ runner.os }}-amd64- - name: linux package install @@ -36,6 +36,9 @@ jobs: sudo apt-get update sudo apt-get install --yes --no-install-recommends jq lcov + - name: Export local Corrade recipe + run: conan export ${{github.workspace}}/conan/corrade/ --name=corrade --version=cci.20260327 + - name: Configure CMake shell: bash working-directory: ${{github.workspace}}/build @@ -79,7 +82,7 @@ jobs: uses: actions/cache@v5 with: path: ${{github.workspace}}/build/p/ - key: conan-${{ runner.os }}-amd64-${{ hashFiles('conanfile.py', '*/conanfile.py') }} + key: conan-${{ runner.os }}-amd64-${{ hashFiles('conanfile.py', '*/conanfile.py', 'conan/corrade/**') }} restore-keys: conan-${{ runner.os }}-amd64- - name: Build pktvisord + push symbol to backtrace.io diff --git a/.github/workflows/code-ql.yml b/.github/workflows/code-ql.yml index a9cf7fe05..d3bbae530 100644 --- a/.github/workflows/code-ql.yml +++ b/.github/workflows/code-ql.yml @@ -68,6 +68,8 @@ jobs: # clone the repository, not sure if this needs to be done git clone https://github.com/netboxlabs/pktvisor.git cd pktvisor + # export the local Corrade recipe so conan_provider can resolve it + conan export conan/corrade/ --name=corrade --version=cci.20260327 mkdir build && cd build # configure and handle dependencies cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=./cmake/conan_provider.cmake .. diff --git a/README.md b/README.md index c6a27f5b9..8010ded03 100644 --- a/README.md +++ b/README.md @@ -606,6 +606,8 @@ The general build steps are: git clone https://github.com/netboxlabs/pktvisor.git cd pktvisor/ conan profile detect -f +# export the vendored Corrade recipe (not in conan-center) +conan export conan/corrade/ --name=corrade --version=cci.20260327 cd build/ # configure and handle dependencies cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=./cmake/conan_provider.cmake .. diff --git a/cmd/pktvisord/main.cpp b/cmd/pktvisord/main.cpp index 60c3bbed9..2044f5d55 100644 --- a/cmd/pktvisord/main.cpp +++ b/cmd/pktvisord/main.cpp @@ -17,6 +17,7 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wattributes" #endif +#include #include #ifdef __GNUC__ #pragma GCC diagnostic pop @@ -652,13 +653,13 @@ int main(int argc, char *argv[]) for (auto &p : registry.input_plugin_registry()->pluginList()) { auto meta = registry.input_plugin_registry()->metadata(p); if (meta && meta->data().hasValue("type") && meta->data().value("type") == "input") { - logger->info("input: {}", p); + logger->info("input: {}", std::string(p)); } } for (auto &p : registry.handler_plugin_registry()->pluginList()) { auto meta = registry.handler_plugin_registry()->metadata(p); if (meta && meta->data().hasValue("type") && meta->data().value("type") == "handler") { - logger->info("handler: {}", p); + logger->info("handler: {}", std::string(p)); } } exit(EXIT_SUCCESS); diff --git a/conan/corrade/cmake/conan-corrade-vars.cmake b/conan/corrade/cmake/conan-corrade-vars.cmake new file mode 100644 index 000000000..dafa5c7df --- /dev/null +++ b/conan/corrade/cmake/conan-corrade-vars.cmake @@ -0,0 +1,64 @@ +# Here we are reproducing the variables and call performed by the FindCorrade.cmake provided by the library + +# Read flags from configuration +file(READ "${CMAKE_CURRENT_LIST_DIR}/../../include/Corrade/configure.h" _corradeConfigure) +string(REGEX REPLACE ";" "\\\\;" _corradeConfigure "${_corradeConfigure}") +string(REGEX REPLACE "\n" ";" _corradeConfigure "${_corradeConfigure}") +set(_corradeFlags + MSVC2015_COMPATIBILITY + MSVC2017_COMPATIBILITY + MSVC2019_COMPATIBILITY + BUILD_DEPRECATED + BUILD_STATIC + BUILD_STATIC_UNIQUE_GLOBALS + BUILD_MULTITHREADED + TARGET_UNIX + TARGET_APPLE + TARGET_IOS + TARGET_IOS_SIMULATOR + TARGET_WINDOWS + TARGET_WINDOWS_RT + TARGET_EMSCRIPTEN + TARGET_ANDROID + # TARGET_X86 etc and TARGET_LIBCXX are not exposed to CMake as the meaning + # is unclear on platforms with multi-arch binaries or when mixing different + # STL implementations. TARGET_GCC etc are figured out via UseCorrade.cmake, + # as the compiler can be different when compiling the lib & when using it. + PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT + TESTSUITE_TARGET_XCTEST + UTILITY_USE_ANSI_COLORS) +foreach(_corradeFlag ${_corradeFlags}) + list(FIND _corradeConfigure "#define CORRADE_${_corradeFlag}" _corrade_${_corradeFlag}) + if(NOT _corrade_${_corradeFlag} EQUAL -1) + set(CORRADE_${_corradeFlag} 1) + endif() +endforeach() + + +# Corrade::rc, a target with just an executable +if(NOT TARGET Corrade::rc) + if(CMAKE_CROSSCOMPILING) + find_program(CORRADE_RC_PROGRAM + NAMES corrade-rc + PATHS ENV PATH + NO_DEFAULT_PATH) + else() + find_program(CORRADE_RC_PROGRAM + NAMES corrade-rc + PATHS "${CMAKE_CURRENT_LIST_DIR}/../../bin/" + NO_DEFAULT_PATH) + endif() + + if(CORRADE_RC_PROGRAM STREQUAL "CORRADE_RC_PROGRAM-NOTFOUND") + message(FATAL_ERROR "Corrade: corrade-rc not found. Pass -DCORRADE_RC_PROGRAM=/path/to/corrade-rc.") + endif() + + get_filename_component(CORRADE_RC_PROGRAM "${CORRADE_RC_PROGRAM}" ABSOLUTE) + + add_executable(Corrade::rc IMPORTED) + set_property(TARGET Corrade::rc PROPERTY IMPORTED_LOCATION ${CORRADE_RC_PROGRAM}) +endif() + +# Include and declare other build modules +include("${CMAKE_CURRENT_LIST_DIR}/UseCorrade.cmake") +set(CORRADE_LIB_SUFFIX_MODULE "${CMAKE_CURRENT_LIST_DIR}/CorradeLibSuffix.cmake") diff --git a/conan/corrade/conandata.yml b/conan/corrade/conandata.yml new file mode 100644 index 000000000..04a27772f --- /dev/null +++ b/conan/corrade/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20260327": + sha256: d8f30e9a857172003b6b02304783f40e8038c36e4127a0cfec7fe14f41c13fd4 + url: https://github.com/mosra/corrade/archive/22e7ffc6fcdeaa0df96e0d8b3d482ad6abe7dc36.tar.gz diff --git a/conan/corrade/conanfile.py b/conan/corrade/conanfile.py new file mode 100644 index 000000000..847b88273 --- /dev/null +++ b/conan/corrade/conanfile.py @@ -0,0 +1,202 @@ +import os + +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import cross_building +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir +from conan.tools.microsoft import is_msvc, check_min_vs + +required_conan_version = ">=2.0" + + +class CorradeConan(ConanFile): + name = "corrade" + description = "Corrade is a multiplatform utility library written in C++11/C++14." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://magnum.graphics/corrade" + topics = ("magnum", "filesystem", "console", "environment", "os") + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "build_deprecated": [True, False], + "with_interconnect": [True, False], + "with_main": [True, False], + "with_pluginmanager": [True, False], + "with_testsuite": [True, False], + "with_utility": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "build_deprecated": True, + "with_interconnect": True, + "with_main": True, + "with_pluginmanager": True, + "with_testsuite": True, + "with_utility": True, + } + + def export_sources(self): + copy(self, "cmake/*", src=self.recipe_folder, dst=self.export_sources_folder) + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + check_min_vs(self, 190) + if not self.options.with_utility and ( + self.options.with_testsuite or self.options.with_interconnect or self.options.with_pluginmanager + ): + raise ConanInvalidConfiguration( + "Component 'utility' is required for 'test_suite', 'interconnect' and 'plugin_manager'" + ) + + def build_requirements(self): + if hasattr(self, "settings_build") and cross_building(self, skip_x64_x86=True): + self.tool_requires(f"corrade/{self.version}") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + # Fix strerror_r for non-glibc Linux (e.g. musl): always use POSIX XSI variant. + # GCC defines _GNU_SOURCE on Linux even for musl targets, so Corrade's preprocessor + # condition falls into the GNU branch (char* strerror_r) which musl doesn't provide. + replace_in_file( + self, + os.path.join(self.source_folder, "src/Corrade/Utility/Implementation/ErrorString.cpp"), + "#if ((_POSIX_C_SOURCE >= 200112L) && !_GNU_SOURCE) || defined(CORRADE_TARGET_EMSCRIPTEN) || defined(CORRADE_TARGET_APPLE) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)", + "#if ((_POSIX_C_SOURCE >= 200112L) && !_GNU_SOURCE) || defined(CORRADE_TARGET_EMSCRIPTEN) || defined(CORRADE_TARGET_APPLE) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || (defined(__linux__) && !defined(__GLIBC__))", + ) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_STATIC"] = not self.options.shared + tc.variables["BUILD_STATIC_PIC"] = self.options.get_safe("fPIC", False) + + tc.variables["BUILD_DEPRECATED"] = self.options.build_deprecated + tc.variables["WITH_INTERCONNECT"] = self.options.with_interconnect + tc.variables["WITH_MAIN"] = self.options.with_main + tc.variables["WITH_PLUGINMANAGER"] = self.options.with_pluginmanager + tc.variables["WITH_TESTSUITE"] = self.options.with_testsuite + tc.variables["WITH_UTILITY"] = self.options.with_utility + tc.variables["WITH_RC"] = self.options.with_utility + + # Corrade uses suffix on the resulting "lib"-folder when running cmake.install() + # Set it explicitly to empty, else Corrade might set it implicitly (eg. to "64") + tc.variables["LIB_SUFFIX"] = "" + + if is_msvc(self): + if check_min_vs(self, 193, raise_invalid=False): + tc.variables["MSVC2019_COMPATIBILITY"] = True + elif check_min_vs(self, 192, raise_invalid=False): + tc.variables["MSVC2017_COMPATIBILITY"] = True + elif check_min_vs(self, 191, raise_invalid=False): + tc.variables["MSVC2015_COMPATIBILITY"] = True + + tc.generate() + tc = CMakeDeps(self) + tc.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + share_cmake = os.path.join(self.package_folder, "share", "cmake", "Corrade") + copy(self, "UseCorrade.cmake", + src=share_cmake, + dst=os.path.join(self.package_folder, "lib", "cmake")) + copy(self, "CorradeLibSuffix.cmake", + src=share_cmake, + dst=os.path.join(self.package_folder, "lib", "cmake")) + copy(self, "*.cmake", + src=os.path.join(self.export_sources_folder, "cmake"), + dst=os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) + + def package_info(self): + self.cpp_info.set_property("cmake_find_mode", "both") + self.cpp_info.set_property("cmake_file_name", "Corrade") + self.cpp_info.set_property("cmake_target_name", "Corrade::Corrade") + + suffix = "-d" if self.settings.build_type == "Debug" else "" + + cmake_modules = [ + # Reproduces the variables and calls performed by the FindCorrade.cmake provided by the library + os.path.join("lib", "cmake", "conan-corrade-vars.cmake"), + # Autodetects LIB_SUFFIX (either "64" or "") + os.path.join("lib", "cmake", "CorradeLibSuffix.cmake"), + # Exports build flags and macros + os.path.join("lib", "cmake", "UseCorrade.cmake"), + ] + self.cpp_info.set_property("cmake_build_modules", cmake_modules) + self.cpp_info.components["_corrade"].build_modules["cmake_find_package"] = cmake_modules + self.cpp_info.components["_corrade"].build_modules["cmake_find_package_multi"] = cmake_modules + + if self.options.with_main: + self.cpp_info.components["main"].set_property("cmake_target_name", "Corrade::Main") + self.cpp_info.components["main"].names["cmake_find_package"] = "Main" + self.cpp_info.components["main"].names["cmake_find_package_multi"] = "Main" + if self.settings.os == "Windows": + self.cpp_info.components["main"].libs = ["CorradeMain" + suffix] + self.cpp_info.components["main"].requires = ["_corrade"] + + if self.options.with_utility: + self.cpp_info.components["utility"].set_property("cmake_target_name", "Corrade::Utility") + self.cpp_info.components["utility"].names["cmake_find_package"] = "Utility" + self.cpp_info.components["utility"].names["cmake_find_package_multi"] = "Utility" + self.cpp_info.components["utility"].libs = ["CorradeUtility" + suffix] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["utility"].system_libs = ["m", "dl"] + self.cpp_info.components["utility"].requires = ["_corrade"] + + if self.options.with_interconnect: + self.cpp_info.components["interconnect"].set_property("cmake_target_name", "Corrade::Interconnect") + self.cpp_info.components["interconnect"].names["cmake_find_package"] = "Interconnect" + self.cpp_info.components["interconnect"].names["cmake_find_package_multi"] = "Interconnect" + self.cpp_info.components["interconnect"].libs = ["CorradeInterconnect" + suffix] + self.cpp_info.components["interconnect"].requires = ["utility"] + + if self.options.with_pluginmanager: + self.cpp_info.components["plugin_manager"].set_property("cmake_target_name", "Corrade::PluginManager") + self.cpp_info.components["plugin_manager"].names["cmake_find_package"] = "PluginManager" + self.cpp_info.components["plugin_manager"].names["cmake_find_package_multi"] = "PluginManager" + self.cpp_info.components["plugin_manager"].libs = ["CorradePluginManager" + suffix] + self.cpp_info.components["plugin_manager"].requires = ["utility"] + + if self.options.with_testsuite: + self.cpp_info.components["test_suite"].set_property("cmake_target_name", "Corrade::TestSuite") + self.cpp_info.components["test_suite"].names["cmake_find_package"] = "TestSuite" + self.cpp_info.components["test_suite"].names["cmake_find_package_multi"] = "TestSuite" + self.cpp_info.components["test_suite"].libs = ["CorradeTestSuite" + suffix] + self.cpp_info.components["test_suite"].requires = ["utility"] + + if self.options.with_utility: + bindir = os.path.join(self.package_folder, "bin") + self.output.info(f"Appending PATH environment variable: {bindir}") + self.env_info.PATH.append(bindir) + + # pkg_config: Add more explicit naming to generated files (avoid filesystem collision). + for key, component in self.cpp_info.components.items(): + component.set_property("pkg_config_name", f"{self.name}_{key}") + + self.cpp_info.names["cmake_find_package"] = "Corrade" + self.cpp_info.names["cmake_find_package_multi"] = "Corrade" diff --git a/conanfile.py b/conanfile.py index ec77c2cbc..4c9b5aee3 100644 --- a/conanfile.py +++ b/conanfile.py @@ -8,7 +8,7 @@ class Pktvisor(ConanFile): def requirements(self): self.requires("catch2/3.14.0") - self.requires("corrade/2020.06") + self.requires("corrade/cci.20260327") self.requires("cpp-httplib/0.18.3") self.requires("docopt.cpp/0.6.3") self.requires("fast-cpp-csv-parser/cci.20240102") @@ -37,7 +37,7 @@ def requirements(self): self.requires("sentry-crashpad/0.6.5") def build_requirements(self): - self.tool_requires("corrade/2020.06") + self.tool_requires("corrade/cci.20260327") self.tool_requires("protobuf/6.33.5") def layout(self): diff --git a/docker/Dockerfile b/docker/Dockerfile index 7314fd173..b0c24a742 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -21,11 +21,13 @@ COPY ./cmake/ /pktvisor-src/cmake/ COPY ./CMakeLists.txt /pktvisor-src/ COPY ./conanfile.py /pktvisor-src/ COPY ./.conanrc /pktvisor-src/ +COPY ./conan/ /pktvisor-src/conan/ WORKDIR /pktvisor-src RUN \ conan profile detect -f && \ + conan export conan/corrade/ --name=corrade --version=cci.20260327 && \ cd build/ && \ PKG_CONFIG_PATH=/local/lib/pkgconfig cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=./cmake/conan_provider.cmake .. && \ make all -j 4 diff --git a/src/AbstractPlugin.cpp b/src/AbstractPlugin.cpp index d0edb22e0..f6d129d45 100644 --- a/src/AbstractPlugin.cpp +++ b/src/AbstractPlugin.cpp @@ -3,6 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ #include "AbstractPlugin.h" +#include #include #include @@ -12,15 +13,15 @@ void AbstractPlugin::check_schema(json obj, SchemaMap &required, SchemaMap &opti { for (const auto &[key, value] : required) { if (!obj.contains(key)) { - throw SchemaException(fmt::format("{}: required field is missing: {}", plugin(), key)); + throw SchemaException(fmt::format("{}: required field is missing: {}", std::string(plugin()), key)); } if (!std::regex_match(obj[key].get(), std::regex(value))) { - throw SchemaException(fmt::format("{}: required field fails input validation: {} requires {}", plugin(), key, value)); + throw SchemaException(fmt::format("{}: required field fails input validation: {} requires {}", std::string(plugin()), key, value)); } } for (const auto &[key, value] : optional) { if (obj.contains(key) && !std::regex_match(obj[key].get(), std::regex(value))) { - throw SchemaException(fmt::format("{}: optional field fails input validation: {} requires {}", plugin(), key, value)); + throw SchemaException(fmt::format("{}: optional field fails input validation: {} requires {}", std::string(plugin()), key, value)); } } } diff --git a/src/AbstractPlugin.h b/src/AbstractPlugin.h index 6377b6ac4..3461ac5b9 100644 --- a/src/AbstractPlugin.h +++ b/src/AbstractPlugin.h @@ -4,6 +4,8 @@ #pragma once +#include +#include #include #include #include @@ -69,12 +71,12 @@ class AbstractPlugin : public Corrade::PluginManager::AbstractPlugin } public: - static std::vector pluginSearchPaths() + static Corrade::Containers::Array pluginSearchPaths() { - return {""}; + return {Corrade::InPlaceInit, {""}}; } - explicit AbstractPlugin(Corrade::PluginManager::AbstractManager &manager, const std::string &plugin) + explicit AbstractPlugin(Corrade::PluginManager::AbstractManager &manager, const Corrade::Containers::StringView plugin) : Corrade::PluginManager::AbstractPlugin{manager, plugin} { } diff --git a/src/CoreRegistry.cpp b/src/CoreRegistry.cpp index 408f8c1dd..6690eb29a 100644 --- a/src/CoreRegistry.cpp +++ b/src/CoreRegistry.cpp @@ -8,6 +8,8 @@ #include "InputStreamManager.h" #include "Policies.h" #include "Taps.h" +#include +#include #include #include #include @@ -47,12 +49,12 @@ void CoreRegistry::start(HttpServer *svr) for (auto &s : plugin_list) { auto meta = _input_registry.metadata(s); if (!meta) { - _logger->error("failed to load plugin metadata: {}", s); + _logger->error("failed to load plugin metadata: {}", std::string(s)); continue; } if (meta->data().hasValue("type") && meta->data().value("type") == "input") { if (!meta->data().hasValue("version")) { - _logger->error("version field is mandatory and was not provided by '{}'", s); + _logger->error("version field is mandatory and was not provided by '{}'", std::string(s)); } auto version = meta->data().value("version"); if (_input_registry.loadState(s) == Corrade::PluginManager::LoadState::NotLoaded) { @@ -60,11 +62,11 @@ void CoreRegistry::start(HttpServer *svr) } for (const auto &alias : meta->provides()) { InputPluginPtr mod = _input_registry.instantiate(alias); - _logger->info("Load input stream plugin: {} version {} interface {}", alias, version, mod->pluginInterface()); + _logger->info("Load input stream plugin: {} version {} interface {}", std::string(alias), version, std::string(mod->pluginInterface())); mod->init_plugin(this, svr, &geo::GeoIP(), &geo::GeoASN()); - auto result = _input_plugins.insert({std::make_pair(alias, version), std::move(mod)}); + auto result = _input_plugins.insert({std::make_pair(std::string(alias), version), std::move(mod)}); if (!result.second) { - throw std::runtime_error(fmt::format("Input alias '{}' with version '{}' was already loaded.", alias, version)); + throw std::runtime_error(fmt::format("Input alias '{}' with version '{}' was already loaded.", std::string(alias), version)); } } } @@ -77,7 +79,7 @@ void CoreRegistry::start(HttpServer *svr) for (auto &s : plugin_list) { auto meta = _handler_registry.metadata(s); if (!meta) { - _logger->error("failed to load plugin metadata: {}", s); + _logger->error("failed to load plugin metadata: {}", std::string(s)); continue; } if (meta->data().hasValue("type") && meta->data().value("type") == "handler") { @@ -85,16 +87,16 @@ void CoreRegistry::start(HttpServer *svr) _handler_registry.load(s); } if (!meta->data().hasValue("version")) { - _logger->error("version field is mandatory and was not provided by '{}'", s); + _logger->error("version field is mandatory and was not provided by '{}'", std::string(s)); } auto version = meta->data().value("version"); for (const auto &alias : meta->provides()) { HandlerPluginPtr mod = _handler_registry.instantiate(s); - _logger->info("Load stream handler plugin: {} version {} interface {}", alias, version, mod->pluginInterface()); + _logger->info("Load stream handler plugin: {} version {} interface {}", std::string(alias), version, std::string(mod->pluginInterface())); mod->init_plugin(this, svr, &geo::GeoIP(), &geo::GeoASN()); - auto result = _handler_plugins.insert({std::make_pair(alias, version), std::move(mod)}); + auto result = _handler_plugins.insert({std::make_pair(std::string(alias), version), std::move(mod)}); if (!result.second) { - throw std::runtime_error(fmt::format("Handler alias '{}' with version '{}' was already loaded.", alias, version)); + throw std::runtime_error(fmt::format("Handler alias '{}' with version '{}' was already loaded.", std::string(alias), version)); } } } diff --git a/src/HandlerModulePlugin.h b/src/HandlerModulePlugin.h index 7e1d19f71..19339a690 100644 --- a/src/HandlerModulePlugin.h +++ b/src/HandlerModulePlugin.h @@ -5,6 +5,8 @@ #pragma once #include "AbstractPlugin.h" +#include +#include #include #include #include @@ -21,17 +23,18 @@ class HandlerModulePlugin : public AbstractPlugin static geo::MaxmindDB *asn; static geo::MaxmindDB *city; - static std::string pluginInterface() + static Corrade::Containers::StringView pluginInterface() { - return "visor.module.handler/1.0"; + using namespace Corrade::Containers::Literals; + return "visor.module.handler/1.0"_s; } - static std::vector pluginSearchPaths() + static Corrade::Containers::Array pluginSearchPaths() { - return {""}; + return {Corrade::InPlaceInit, {""}}; } - explicit HandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const std::string &plugin) + explicit HandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const Corrade::Containers::StringView plugin) : AbstractPlugin{manager, plugin} { } diff --git a/src/InputModulePlugin.h b/src/InputModulePlugin.h index d11ddbbcf..d71e214c9 100644 --- a/src/InputModulePlugin.h +++ b/src/InputModulePlugin.h @@ -5,6 +5,8 @@ #pragma once #include "AbstractPlugin.h" +#include +#include #include #include #include @@ -18,17 +20,18 @@ class InputModulePlugin : public AbstractPlugin { public: - static std::string pluginInterface() + static Corrade::Containers::StringView pluginInterface() { - return "visor.module.input/1.0"; + using namespace Corrade::Containers::Literals; + return "visor.module.input/1.0"_s; } - static std::vector pluginSearchPaths() + static Corrade::Containers::Array pluginSearchPaths() { - return {""}; + return {Corrade::InPlaceInit, {""}}; } - explicit InputModulePlugin(Corrade::PluginManager::AbstractManager &manager, const std::string &plugin) + explicit InputModulePlugin(Corrade::PluginManager::AbstractManager &manager, const Corrade::Containers::StringView plugin) : AbstractPlugin{manager, plugin} { } diff --git a/src/Policies.cpp b/src/Policies.cpp index b292be7f2..fe122fbad 100644 --- a/src/Policies.cpp +++ b/src/Policies.cpp @@ -3,6 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ #include "Policies.h" +#include #include "CoreRegistry.h" #include "HandlerManager.h" #include "InputStreamManager.h" @@ -89,7 +90,7 @@ std::vector PolicyManager::load(const YAML::Node &policy_yaml, bool si policy_ptr->add_tap(tap); // ensure tap input type matches policy input tap if (input_node["input_type"].as() != tap->input_plugin()->plugin()) { - throw PolicyException(fmt::format("input_type for policy specified tap '{}' doesn't match tap's defined input type: {}/{}", tap_name, input_node["input_type"].as(), tap->input_plugin()->plugin())); + throw PolicyException(fmt::format("input_type for policy specified tap '{}' doesn't match tap's defined input type: {}/{}", tap_name, input_node["input_type"].as(), std::string(tap->input_plugin()->plugin()))); } // handler internal config window_config.config_set("_internal_tap_name", tap_name); diff --git a/src/Taps.h b/src/Taps.h index 3f51f0d58..24b11d93a 100644 --- a/src/Taps.h +++ b/src/Taps.h @@ -8,6 +8,7 @@ #include "AbstractModule.h" #include "Configurable.h" #include "InputModulePlugin.h" +#include #include namespace visor { diff --git a/src/handlers/bgp/BgpHandlerModulePlugin.h b/src/handlers/bgp/BgpHandlerModulePlugin.h index 85206fd22..b90ce0e61 100644 --- a/src/handlers/bgp/BgpHandlerModulePlugin.h +++ b/src/handlers/bgp/BgpHandlerModulePlugin.h @@ -15,7 +15,7 @@ class BgpHandlerModulePlugin : public HandlerModulePlugin void setup_routes(HttpServer *svr) override; public: - explicit BgpHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const std::string &plugin) + explicit BgpHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const Corrade::Containers::StringView plugin) : visor::HandlerModulePlugin{manager, plugin} { } diff --git a/src/handlers/dhcp/DhcpHandlerModulePlugin.h b/src/handlers/dhcp/DhcpHandlerModulePlugin.h index 0f48f3298..5a8705b76 100644 --- a/src/handlers/dhcp/DhcpHandlerModulePlugin.h +++ b/src/handlers/dhcp/DhcpHandlerModulePlugin.h @@ -15,7 +15,7 @@ class DhcpHandlerModulePlugin : public HandlerModulePlugin void setup_routes(HttpServer *svr) override; public: - explicit DhcpHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const std::string &plugin) + explicit DhcpHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const Corrade::Containers::StringView plugin) : visor::HandlerModulePlugin{manager, plugin} { } diff --git a/src/handlers/dns/v1/DnsHandlerModulePlugin.h b/src/handlers/dns/v1/DnsHandlerModulePlugin.h index f6001f0dd..c2ff8579f 100644 --- a/src/handlers/dns/v1/DnsHandlerModulePlugin.h +++ b/src/handlers/dns/v1/DnsHandlerModulePlugin.h @@ -15,7 +15,7 @@ class DnsHandlerModulePlugin : public HandlerModulePlugin void setup_routes(HttpServer *svr) override; public: - explicit DnsHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const std::string &plugin) + explicit DnsHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const Corrade::Containers::StringView plugin) : visor::HandlerModulePlugin{manager, plugin} { } diff --git a/src/handlers/dns/v2/DnsHandlerModulePlugin.h b/src/handlers/dns/v2/DnsHandlerModulePlugin.h index 6cbebc92d..7182b5824 100644 --- a/src/handlers/dns/v2/DnsHandlerModulePlugin.h +++ b/src/handlers/dns/v2/DnsHandlerModulePlugin.h @@ -15,7 +15,7 @@ class DnsHandlerModulePlugin : public HandlerModulePlugin void setup_routes(HttpServer *svr) override; public: - explicit DnsHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const std::string &plugin) + explicit DnsHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const Corrade::Containers::StringView plugin) : visor::HandlerModulePlugin{manager, plugin} { } diff --git a/src/handlers/flow/FlowHandlerModulePlugin.h b/src/handlers/flow/FlowHandlerModulePlugin.h index ca1b6d742..80c1064fa 100644 --- a/src/handlers/flow/FlowHandlerModulePlugin.h +++ b/src/handlers/flow/FlowHandlerModulePlugin.h @@ -15,7 +15,7 @@ class FlowHandlerModulePlugin : public HandlerModulePlugin void setup_routes(HttpServer *svr) override; public: - explicit FlowHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const std::string &plugin) + explicit FlowHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const Corrade::Containers::StringView plugin) : visor::HandlerModulePlugin{manager, plugin} { } diff --git a/src/handlers/input_resources/InputResourcesHandlerModulePlugin.h b/src/handlers/input_resources/InputResourcesHandlerModulePlugin.h index f9958b27f..de3b9b81b 100644 --- a/src/handlers/input_resources/InputResourcesHandlerModulePlugin.h +++ b/src/handlers/input_resources/InputResourcesHandlerModulePlugin.h @@ -15,7 +15,7 @@ class InputResourcesHandlerModulePlugin : public HandlerModulePlugin void setup_routes(HttpServer *svr) override; public: - explicit InputResourcesHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const std::string &plugin) + explicit InputResourcesHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const Corrade::Containers::StringView plugin) : visor::HandlerModulePlugin{manager, plugin} { } diff --git a/src/handlers/mock/MockHandlerModulePlugin.h b/src/handlers/mock/MockHandlerModulePlugin.h index d75a83ab3..93aa9783f 100644 --- a/src/handlers/mock/MockHandlerModulePlugin.h +++ b/src/handlers/mock/MockHandlerModulePlugin.h @@ -15,7 +15,7 @@ class MockHandlerModulePlugin : public HandlerModulePlugin void setup_routes(HttpServer *svr) override; public: - explicit MockHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const std::string &plugin) + explicit MockHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const Corrade::Containers::StringView plugin) : visor::HandlerModulePlugin{manager, plugin} { } diff --git a/src/handlers/net/v1/NetHandlerModulePlugin.h b/src/handlers/net/v1/NetHandlerModulePlugin.h index b8cd02ca9..bd1667c10 100644 --- a/src/handlers/net/v1/NetHandlerModulePlugin.h +++ b/src/handlers/net/v1/NetHandlerModulePlugin.h @@ -15,7 +15,7 @@ class NetHandlerModulePlugin : public HandlerModulePlugin void setup_routes(HttpServer *svr) override; public: - explicit NetHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const std::string &plugin) + explicit NetHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const Corrade::Containers::StringView plugin) : visor::HandlerModulePlugin{manager, plugin} { } diff --git a/src/handlers/net/v2/NetHandlerModulePlugin.h b/src/handlers/net/v2/NetHandlerModulePlugin.h index 6ef260326..5b3d1fab8 100644 --- a/src/handlers/net/v2/NetHandlerModulePlugin.h +++ b/src/handlers/net/v2/NetHandlerModulePlugin.h @@ -15,7 +15,7 @@ class NetHandlerModulePlugin : public HandlerModulePlugin void setup_routes(HttpServer *svr) override; public: - explicit NetHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const std::string &plugin) + explicit NetHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const Corrade::Containers::StringView plugin) : visor::HandlerModulePlugin{manager, plugin} { } diff --git a/src/handlers/netprobe/NetProbeHandlerModulePlugin.h b/src/handlers/netprobe/NetProbeHandlerModulePlugin.h index ca510bb1e..a77bcb38d 100644 --- a/src/handlers/netprobe/NetProbeHandlerModulePlugin.h +++ b/src/handlers/netprobe/NetProbeHandlerModulePlugin.h @@ -15,7 +15,7 @@ class NetProbeHandlerModulePlugin : public HandlerModulePlugin void setup_routes(HttpServer *svr) override; public: - explicit NetProbeHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const std::string &plugin) + explicit NetProbeHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const Corrade::Containers::StringView plugin) : visor::HandlerModulePlugin{manager, plugin} { } diff --git a/src/handlers/pcap/PcapHandlerModulePlugin.h b/src/handlers/pcap/PcapHandlerModulePlugin.h index 71b286bb1..44a44c591 100644 --- a/src/handlers/pcap/PcapHandlerModulePlugin.h +++ b/src/handlers/pcap/PcapHandlerModulePlugin.h @@ -15,7 +15,7 @@ class PcapHandlerModulePlugin : public HandlerModulePlugin void setup_routes(HttpServer *svr) override; public: - explicit PcapHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const std::string &plugin) + explicit PcapHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const Corrade::Containers::StringView plugin) : visor::HandlerModulePlugin{manager, plugin} { } diff --git a/src/handlers/static_plugins.h b/src/handlers/static_plugins.h index 2a968cca2..063a36c33 100644 --- a/src/handlers/static_plugins.h +++ b/src/handlers/static_plugins.h @@ -1,5 +1,8 @@ #pragma once +#include +#include + static int import_handler_plugins() { CORRADE_PLUGIN_IMPORT(VisorHandlerNet); diff --git a/src/inputs/dnstap/DnstapInputModulePlugin.h b/src/inputs/dnstap/DnstapInputModulePlugin.h index ae5050502..e4183664b 100644 --- a/src/inputs/dnstap/DnstapInputModulePlugin.h +++ b/src/inputs/dnstap/DnstapInputModulePlugin.h @@ -15,7 +15,7 @@ class DnstapInputModulePlugin : public visor::InputModulePlugin void setup_routes(HttpServer *svr) override; public: - explicit DnstapInputModulePlugin(Corrade::PluginManager::AbstractManager &manager, const std::string &plugin) + explicit DnstapInputModulePlugin(Corrade::PluginManager::AbstractManager &manager, const Corrade::Containers::StringView plugin) : visor::InputModulePlugin{manager, plugin} { } diff --git a/src/inputs/flow/FlowInputModulePlugin.h b/src/inputs/flow/FlowInputModulePlugin.h index ee3d76028..9a8507ed7 100644 --- a/src/inputs/flow/FlowInputModulePlugin.h +++ b/src/inputs/flow/FlowInputModulePlugin.h @@ -16,7 +16,7 @@ class FlowInputModulePlugin : public visor::InputModulePlugin void setup_routes(HttpServer *svr) override; public: - explicit FlowInputModulePlugin(Corrade::PluginManager::AbstractManager &manager, const std::string &plugin) + explicit FlowInputModulePlugin(Corrade::PluginManager::AbstractManager &manager, const Corrade::Containers::StringView plugin) : visor::InputModulePlugin{manager, plugin} { } diff --git a/src/inputs/mock/MockInputModulePlugin.h b/src/inputs/mock/MockInputModulePlugin.h index 610a66ab0..d1cb0e8f8 100644 --- a/src/inputs/mock/MockInputModulePlugin.h +++ b/src/inputs/mock/MockInputModulePlugin.h @@ -16,7 +16,7 @@ class MockInputModulePlugin : public visor::InputModulePlugin void setup_routes(HttpServer *svr) override; public: - explicit MockInputModulePlugin(Corrade::PluginManager::AbstractManager &manager, const std::string &plugin) + explicit MockInputModulePlugin(Corrade::PluginManager::AbstractManager &manager, const Corrade::Containers::StringView plugin) : visor::InputModulePlugin{manager, plugin} { } diff --git a/src/inputs/netprobe/NetProbeInputModulePlugin.h b/src/inputs/netprobe/NetProbeInputModulePlugin.h index c5af5bec7..324e59404 100644 --- a/src/inputs/netprobe/NetProbeInputModulePlugin.h +++ b/src/inputs/netprobe/NetProbeInputModulePlugin.h @@ -16,7 +16,7 @@ class NetProbeInputModulePlugin : public visor::InputModulePlugin void setup_routes(HttpServer *svr) override; public: - explicit NetProbeInputModulePlugin(Corrade::PluginManager::AbstractManager &manager, const std::string &plugin) + explicit NetProbeInputModulePlugin(Corrade::PluginManager::AbstractManager &manager, const Corrade::Containers::StringView plugin) : visor::InputModulePlugin{manager, plugin} { } diff --git a/src/inputs/pcap/PcapInputModulePlugin.h b/src/inputs/pcap/PcapInputModulePlugin.h index 451c9b11d..4b48ce3be 100644 --- a/src/inputs/pcap/PcapInputModulePlugin.h +++ b/src/inputs/pcap/PcapInputModulePlugin.h @@ -17,7 +17,7 @@ class PcapInputModulePlugin : public visor::InputModulePlugin void setup_routes(HttpServer *svr) override; public: - explicit PcapInputModulePlugin(Corrade::PluginManager::AbstractManager &manager, const std::string &plugin) + explicit PcapInputModulePlugin(Corrade::PluginManager::AbstractManager &manager, const Corrade::Containers::StringView plugin) : visor::InputModulePlugin{manager, plugin} { } diff --git a/src/inputs/static_plugins.h b/src/inputs/static_plugins.h index 9d0e68d39..3ea5574c6 100644 --- a/src/inputs/static_plugins.h +++ b/src/inputs/static_plugins.h @@ -1,5 +1,8 @@ #pragma once +#include +#include + static int import_input_plugins() { CORRADE_PLUGIN_IMPORT(VisorInputMock);