Skip to content

Commit 4970422

Browse files
committed
+++ xxx
1 parent c14e5d4 commit 4970422

File tree

87 files changed

+862
-977
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+862
-977
lines changed

CMakeLists.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,13 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
3434

3535
option(ENABLE_RPMBUILD "Enable support for building RPM packages" ON)
3636

37-
option(ENABLE_INPUT_PCAP "Enable build of input PCAP plugin" ON)
38-
option(ENABLE_INPUT_DPDK "Enable build of input DPDK plugin" ON)
39-
option(ENABLE_INPUT_NFB "Enable build of input NFB plugin" ON)
40-
37+
option(ENABLE_INPUT_PCAP "Enable build of input PCAP plugin" ON)
38+
option(ENABLE_INPUT_DPDK "Enable build of input DPDK plugin" ON)
39+
option(ENABLE_INPUT_NFB "Enable build of input NFB plugin" ON)
40+
option(ENABLE_RPMBUILD "RPM build" ON)
41+
option(ENABLE_PROCESS_NETTISA "Enable build of nettisa process plugin" ON)
42+
option(ENABLE_PROCESS_EXPERIMENTAL "Enable build of additional process plugins" ON)
43+
option(ENABLE_OUTPUT_UNIREC "Enable build of unirec output plugin" ON)
4144

4245
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g")
4346
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -g -O3")

cmake/dependencies.cmake

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
find_package(PkgConfig REQUIRED)
22

3+
find_package(unwind REQUIRED)
4+
find_package(atomic REQUIRED)
5+
find_package(lz4 REQUIRED)
6+
find_package(OpenSSL REQUIRED)
7+
8+
find_package(Threads REQUIRED)
9+
if(NOT CMAKE_USE_PTHREADS_INIT)
10+
message(FATAL_ERROR "pthreads not found!")
11+
endif()
12+
313
if (ENABLE_INPUT_PCAP)
414
pkg_check_modules(PCAP REQUIRED libpcap)
515
endif()
@@ -11,3 +21,7 @@ endif()
1121
if (ENABLE_INPUT_NFB)
1222
find_package(NFB REQUIRED)
1323
endif()
24+
25+
if (ENABLE_OUTPUT_UNIREC)
26+
find_package(Nemea REQUIRED)
27+
endif()

cmake/modules/FindNemea.cmake

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# TODO
2+
# Find the nfb-framework includes and library
3+
#
4+
# This module defines the following IMPORTED targets:
5+
#
6+
# nfb::nfb - The "nfb" library, if found.
7+
#
8+
# This module will set the following variables in your project:
9+
#
10+
# NFB_INCLUDE_DIRS - where to find <nfb/nfb.h>, etc.
11+
# NFB_LIBRARIES - List of libraries when using nfb-framework.
12+
# NFB_FOUND - True if the framework has been found.
13+
14+
# Use pkg-config (if available) to get the library directories and then use
15+
# these values as hints for find_path() and find_library() functions.
16+
find_package(PkgConfig QUIET)
17+
if (PKG_CONFIG_FOUND)
18+
pkg_check_modules(PC_NEMEA QUIET nemea)
19+
endif()
20+
21+
find_path(
22+
NEMEA_INCLUDE_DIR unirec/unirec.h
23+
HINTS ${PC_NEMEA_INCLUDEDIR} ${PC_NEMEA_INCLUDE_DIRS}
24+
PATH_SUFFIXES include
25+
)
26+
27+
message(STATUS "NEMEA_INCLUDE_DIR: ${NEMEA_INCLUDE_DIR}")
28+
29+
find_library(
30+
NEMEA_LIBRARY NAMES unirec++
31+
HINTS ${PC_NEMEA_LIBDIR} ${PC_NEMEA_LIBRARY_DIRS}
32+
PATH_SUFFIXES lib lib64
33+
)
34+
35+
message(STATUS "NEMEA_LIBRARY: ${NEMEA_LIBRARY}")
36+
37+
if (PC_NEMEA_VERSION)
38+
set(NEMEA_VERSION_STRING ${PC_NEMEA_VERSION})
39+
endif()
40+
41+
# Handle find_package() arguments (i.e. QUIETLY and REQUIRED) and set
42+
# NEMEA_FOUND to TRUE if all listed variables are filled.
43+
include(FindPackageHandleStandardArgs)
44+
find_package_handle_standard_args(
45+
Nemea
46+
REQUIRED_VARS NEMEA_LIBRARY NEMEA_INCLUDE_DIR
47+
VERSION_VAR NEMEA_VERSION_STRING
48+
)
49+
50+
set(NEMEA_INCLUDE_DIRS ${NFB_INCLUDE_DIR})
51+
set(NEMEA_LIBRARIES ${NFB_LIBRARY})
52+
mark_as_advanced(NEMEA_INCLUDE_DIR NEMEA_LIBRARY)
53+
54+
if (NEMEA_FOUND)
55+
# Create imported library with all dependencies
56+
if (NOT TARGET nemea::nemea AND EXISTS "${NEMEA_LIBRARIES}")
57+
add_library(nemea::nemea UNKNOWN IMPORTED)
58+
set_target_properties(nemea::nemea PROPERTIES
59+
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
60+
IMPORTED_LOCATION "${NEMEA_LIBRARIES}"
61+
INTERFACE_INCLUDE_DIRECTORIES "${NEMEA_INCLUDE_DIRS}")
62+
endif()
63+
else()
64+
message(FATAL_ERROR "Nemea not found")
65+
add_library(nfb::nfb INTERFACE IMPORTED)
66+
endif()

cmake/modules/Findatomic.cmake

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Find the lbatomic includes and library
2+
#
3+
# ATOMIC_FOUND - system has libatomic
4+
# ATOMIC_LIBRARIES - libraries needed to use libatomic
5+
#
6+
7+
find_library(ATOMIC_LIBRARY
8+
NAMES atomic libatomic.so.1
9+
HINTS ${ATOMIC_ROOT}
10+
${CMAKE_INSTALL_LIBDIR})
11+
12+
include(FindPackageHandleStandardArgs)
13+
find_package_handle_standard_args (atomic
14+
REQUIRED_VARS ATOMIC_LIBRARY
15+
)
16+
17+
if (ATOMIC_FOUND AND NOT TARGET atomic::atomic)
18+
add_library(atomic::atomic STATIC IMPORTED)
19+
set_target_properties(atomic::atomic PROPERTIES
20+
IMPORTED_LOCATION "${ATOMIC_LIBRARY}"
21+
INTERFACE_INCLUDE_DIRECTORIES "${ATOMIC_INCLUDE_DIR}")
22+
target_compile_definitions(atomic::atomic INTERFACE UNWIND_FOUND)
23+
else()
24+
message(CRITICAL "Notice: atomic not found")
25+
add_library(atomic::atomic INTERFACE IMPORTED)
26+
endif()
27+
28+
unset(ATOMIC_LIBRARY)

cmake/modules/Findlz4.cmake

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Find lz4
2+
# Once done this will define
3+
#
4+
# LZ4_FOUND - system has liblz4
5+
# lz4::lz4 - cmake target
6+
7+
find_package(PkgConfig QUIET)
8+
if (PKG_CONFIG_FOUND)
9+
pkg_check_modules(PC_LZ4 QUIET lz4-devel)
10+
endif()
11+
12+
find_path (LZ4_INCLUDE_DIR
13+
NAMES lz4.h
14+
HINTS ${LZ4_ROOT} ${PC_LZ4_INCLUDEDIR} ${PC_LZ4_INCLUDE_DIRS}
15+
PATH_SUFFIXES ${CMAKE_INSTALL_LIBDIR}
16+
)
17+
18+
find_library (LZ4_LIBRARY
19+
NAMES lz4
20+
HINTS ${LZ4_ROOT} ${PC_LZ4_LIBDIR} ${PC_LZ4_LIBRARY_DIRS}
21+
PATH_SUFFIXES ${CMAKE_INSTALL_LIBDIR}
22+
)
23+
24+
mark_as_advanced (LZ4_INCLUDE_DIR LZ4_LIBRARY)
25+
26+
include (FindPackageHandleStandardArgs)
27+
# handle the QUIETLY and REQUIRED arguments and set Unwind_FOUND to TRUE
28+
# if all listed variables are TRUE
29+
find_package_handle_standard_args (lz4
30+
REQUIRED_VARS LZ4_INCLUDE_DIR LZ4_LIBRARY
31+
)
32+
33+
if (NOT TARGET lz4::lz4)
34+
add_library(lz4::lz4 STATIC IMPORTED)
35+
set_target_properties(lz4::lz4 PROPERTIES
36+
IMPORTED_LOCATION "${LZ4_LIBRARY}"
37+
INTERFACE_INCLUDE_DIRECTORIES "${LZ4_INCLUDE_DIR}")
38+
target_compile_definitions(lz4::lz4 INTERFACE LZ4_FOUND)
39+
else()
40+
message(CRITICAL "lz4 was not found")
41+
add_library(lz4::lz4 INTERFACE IMPORTED)
42+
endif()
43+
44+
unset(LZ4_INCLUDE_DIR)
45+
unset(LZ4_LIBRARY)

cmake/modules/Findunwind.cmake

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Find unwind library
2+
# Once done this will define
3+
#
4+
# UNWIND_FOUND - system has libunwind
5+
# unwind::unwind - cmake target
6+
7+
find_package(PkgConfig QUIET)
8+
if (PKG_CONFIG_FOUND)
9+
pkg_check_modules(PC_UNWIND QUIET libunwind)
10+
endif()
11+
12+
find_path (UNWIND_INCLUDE_DIR
13+
NAMES unwind.h libunwind.h
14+
HINTS ${UNWIND_ROOT} ${PC_UNWIND_INCLUDEDIR} ${PC_UNWIND_INCLUDE_DIRS}
15+
PATH_SUFFIXES ${CMAKE_INSTALL_LIBDIR}
16+
)
17+
18+
find_library (UNWIND_LIBRARY
19+
NAMES unwind
20+
HINTS ${UNWIND_ROOT} ${PC_UNWIND_LIBDIR} ${PC_UNWIND_LIBRARY_DIRS}
21+
PATH_SUFFIXES ${CMAKE_INSTALL_LIBDIR}
22+
)
23+
24+
mark_as_advanced (UNWIND_INCLUDE_DIR UNWIND_LIBRARY)
25+
26+
include (FindPackageHandleStandardArgs)
27+
# handle the QUIETLY and REQUIRED arguments and set Unwind_FOUND to TRUE
28+
# if all listed variables are TRUE
29+
find_package_handle_standard_args (unwind
30+
REQUIRED_VARS UNWIND_INCLUDE_DIR UNWIND_LIBRARY
31+
)
32+
33+
if (UNWIND_FOUND AND NOT TARGET unwind::unwind)
34+
add_library(unwind::unwind STATIC IMPORTED)
35+
set_target_properties(unwind::unwind PROPERTIES
36+
IMPORTED_LOCATION "${UNWIND_LIBRARY}"
37+
INTERFACE_INCLUDE_DIRECTORIES "${UNWIND_INCLUDE_DIR}")
38+
target_compile_definitions(unwind::unwind INTERFACE UNWIND_FOUND)
39+
else()
40+
message(WARNING "Notice: UNWIND not found, no unwind support")
41+
add_library(unwind::unwind INTERFACE IMPORTED)
42+
endif()
43+
44+
unset(UNWIND_INCLUDE_DIR)
45+
unset(UNWIND_LIBRARY)

include/ipfixprobe/output.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ namespace ipxp {
4141
/**
4242
* \brief Base class for flow exporters.
4343
*/
44-
class OutputPlugin : public Plugin
44+
class IPXP_API OutputPlugin : public Plugin
4545
{
4646
public:
4747
typedef std::vector<std::pair<std::string, ProcessPlugin *>> Plugins;
@@ -79,7 +79,7 @@ class OutputPlugin : public Plugin
7979
* @tparam Args The argument types for the factory.
8080
*/
8181
template<typename Base, typename... Args>
82-
class PluginFactory;
82+
class IPXP_API PluginFactory;
8383

8484
/**
8585
* @brief Type alias for the OutputPlugin factory.

include/ipfixprobe/process.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ class ProcessPlugin : public Plugin
125125
* @tparam Args The argument types for the factory.
126126
*/
127127
template<typename Base, typename... Args>
128-
class PluginFactory;
128+
class IPXP_API PluginFactory;
129129

130130
/**
131131
* @brief Type alias for the ProcessPlugin factory.

include/ipfixprobe/storage.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ namespace ipxp {
4545
/**
4646
* \brief Base class for flow caches.
4747
*/
48-
class StoragePlugin : public Plugin
48+
class IPXP_API StoragePlugin : public Plugin
4949
{
5050
protected:
5151
ipx_ring_t *m_export_queue;
@@ -205,7 +205,7 @@ class StoragePlugin : public Plugin
205205
* @tparam Args The argument types for the factory.
206206
*/
207207
template<typename Base, typename... Args>
208-
class PluginFactory;
208+
class IPXP_API PluginFactory;
209209

210210
/**
211211
* @brief Type alias for the StoragePlugin factory.

pkg/rpm/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,18 @@ if (ENABLE_INPUT_NFB)
3030
list(APPEND RPMBUILD_ARGS "--with" "input_nfb")
3131
endif()
3232

33+
if (ENABLE_OUTPUT_UNIREC)
34+
list(APPEND RPMBUILD_ARGS "--with" "output_unirec")
35+
endif()
36+
37+
if (ENABLE_PROCESS_NETTISA)
38+
list(APPEND RPMBUILD_ARGS "--with" "process_nettisa")
39+
endif()
40+
41+
if (ENABLE_PROCESS_EXPERIMENTAL)
42+
list(APPEND RPMBUILD_ARGS "--with" "process_experimental")
43+
endif()
44+
3345
configure_file("${SPEC_FILE_IN}" "${SPEC_FILE}" @ONLY)
3446

3547
add_custom_target(rpm

0 commit comments

Comments
 (0)