From f352e837b6e20ec2280158766b9169f3afd48ef7 Mon Sep 17 00:00:00 2001 From: Jan Sobol Date: Fri, 13 Sep 2024 17:09:19 +0200 Subject: [PATCH] utils - introduce memcpy_le32toh function --- include/ipfixprobe/utils.hpp | 5 +++++ utils.cpp | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/include/ipfixprobe/utils.hpp b/include/ipfixprobe/utils.hpp index a473293d..2de018a9 100644 --- a/include/ipfixprobe/utils.hpp +++ b/include/ipfixprobe/utils.hpp @@ -171,6 +171,11 @@ std::string vec2str(const std::vector &vec) { return ss.str(); } +/** + * @brief Copy uint32 in little endian byte order to destination in host byte order + */ +void memcpy_le32toh(uint32_t* dest, const uint32_t* src); + } #endif /* IPXP_UTILS_HPP */ \ No newline at end of file diff --git a/utils.cpp b/utils.cpp index 773cc34e..72dac8c6 100644 --- a/utils.cpp +++ b/utils.cpp @@ -138,4 +138,9 @@ uint64_t timeval2usec(const struct timeval& tv) return tv.tv_sec * usec_in_sec + tv.tv_usec; } +void memcpy_le32toh(uint32_t* dest, const uint32_t* src) +{ + *dest = le32toh(*src); +} + } // namespace ipxp \ No newline at end of file