| /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| /* |
| * Copyright (c) 2014-2020, The University of Memphis |
| * |
| * This file is part of PSync. |
| * See AUTHORS.md for complete list of PSync authors and contributors. |
| * |
| * PSync is free software: you can redistribute it and/or modify it under the terms |
| * of the GNU Lesser General Public License as published by the Free Software Foundation, |
| * either version 3 of the License, or (at your option) any later version. |
| * |
| * PSync is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
| * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| * PURPOSE. See the GNU Lesser General Public License for more details. |
| * |
| * You should have received a copy of the GNU Lesser General Public License along with |
| * PSync, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
| */ |
| |
| #ifndef PSYNC_DETAIL_UTIL_HPP |
| #define PSYNC_DETAIL_UTIL_HPP |
| |
| #include "PSync/common.hpp" |
| |
| #include <ndn-cxx/encoding/buffer.hpp> |
| |
| #include <string> |
| |
| namespace psync { |
| namespace detail { |
| |
| uint32_t |
| murmurHash3(const void* key, size_t len, uint32_t seed); |
| |
| inline uint32_t |
| murmurHash3(uint32_t seed, const std::string& str) |
| { |
| return murmurHash3(str.data(), str.size(), seed); |
| } |
| |
| inline uint32_t |
| murmurHash3(uint32_t seed, uint32_t value) |
| { |
| return murmurHash3(&value, sizeof(value), seed); |
| } |
| |
| std::shared_ptr<ndn::Buffer> |
| compress(CompressionScheme scheme, const uint8_t* buffer, size_t bufferSize); |
| |
| std::shared_ptr<ndn::Buffer> |
| decompress(CompressionScheme scheme, const uint8_t* buffer, size_t bufferSize); |
| |
| } // namespace detail |
| } // namespace psync |
| |
| #endif // PSYNC_DETAIL_UTIL_HPP |