diff options
Diffstat (limited to 'telemetry/vpp-collectd/vpp-hicn')
-rw-r--r-- | telemetry/vpp-collectd/vpp-hicn/CMakeLists.txt | 9 | ||||
-rw-r--r-- | telemetry/vpp-collectd/vpp-hicn/vpp_hicn.c | 30 |
2 files changed, 18 insertions, 21 deletions
diff --git a/telemetry/vpp-collectd/vpp-hicn/CMakeLists.txt b/telemetry/vpp-collectd/vpp-hicn/CMakeLists.txt index fc39b9385..3703515dc 100644 --- a/telemetry/vpp-collectd/vpp-hicn/CMakeLists.txt +++ b/telemetry/vpp-collectd/vpp-hicn/CMakeLists.txt @@ -18,7 +18,7 @@ find_package(Collectd REQUIRED) find_package(Vpp REQUIRED) if(${CMAKE_SOURCE_DIR}/vpp-collectd STREQUAL ${PROJECT_SOURCE_DIR}) - message (STATUS "not compiling in the same folder") + message (STATUS "not compiling in the same folder") find_package(HicnPlugin REQUIRED) find_package(VapiSafe REQUIRED) else() @@ -29,17 +29,16 @@ else() endif() list(APPEND SOURCE_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/vpp_hicn.c -) + ${CMAKE_CURRENT_SOURCE_DIR}/vpp_hicn.c) -list (APPEND INCLUDE_DIRS +list(APPEND INCLUDE_DIRS ${COLLECTD_INCLUDE_DIRS} ${HICNPLUGIN_INCLUDE_DIRS} ${SAFE_VAPI_INCLUDE_DIRS} ${VPP_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}) -list (APPEND LIBRARIES +list(APPEND LIBRARIES ${VPP_LIBRARY_VAPICLIENT} ${SAFE_VAPI_LIBRARIES}) diff --git a/telemetry/vpp-collectd/vpp-hicn/vpp_hicn.c b/telemetry/vpp-collectd/vpp-hicn/vpp_hicn.c index 591b8f584..4228ac6e6 100644 --- a/telemetry/vpp-collectd/vpp-hicn/vpp_hicn.c +++ b/telemetry/vpp-collectd/vpp-hicn/vpp_hicn.c @@ -13,25 +13,9 @@ * limitations under the License. */ -#if !HAVE_CONFIG_H -#include <stdlib.h> -#include <string.h> - -#ifndef __USE_ISOC99 /* required for NAN */ -#define DISABLE_ISOC99 1 -#define __USE_ISOC99 1 -#endif /* !defined(__USE_ISOC99) */ - -#if DISABLE_ISOC99 -#undef DISABLE_ISOC99 -#undef __USE_ISOC99 -#endif /* DISABLE_ISOC99 */ -#endif /* ! HAVE_CONFIG */ - /* Keep order as it is */ #include <config.h> #include <collectd.h> -#include <common.h> #include <plugin.h> #define counter_t vpp_counter_t @@ -42,6 +26,15 @@ DEFINE_VAPI_MSG_IDS_HICN_API_JSON vapi_ctx_t vapi_ctx; +#define STATIC_ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a))) + +#define IS_TRUE(s) \ + ((strcasecmp("true", (s)) == 0) || (strcasecmp("yes", (s)) == 0) || \ + (strcasecmp("on", (s)) == 0)) +#define IS_FALSE(s) \ + ((strcasecmp("false", (s)) == 0) || (strcasecmp("no", (s)) == 0) || \ + (strcasecmp("off", (s)) == 0)) + /************** OPTIONS ***********************************/ static const char *config_keys[2] = { "Verbose", @@ -188,6 +181,11 @@ static data_set_t dtx_ds = { /**********************************************************/ /********** UTILITY FUNCTIONS *****************************/ /**********************************************************/ +char *sstrncpy(char *dest, const char *src, size_t n) { + strncpy(dest, src, n); + dest[n - 1] = '\0'; + return dest; +} /* * Utility function used by the read callback to populate a |