asmap.h raw

   1  // Copyright (c) 2019-present The Bitcoin Core developers
   2  // Distributed under the MIT software license, see the accompanying
   3  // file COPYING or http://www.opensource.org/licenses/mit-license.php.
   4  
   5  #ifndef BITCOIN_UTIL_ASMAP_H
   6  #define BITCOIN_UTIL_ASMAP_H
   7  
   8  #include <uint256.h>
   9  #include <util/fs.h>
  10  
  11  #include <cstddef>
  12  #include <cstdint>
  13  #include <span>
  14  #include <vector>
  15  
  16  uint32_t Interpret(std::span<const std::byte> asmap, std::span<const std::byte> ip);
  17  
  18  bool SanityCheckAsmap(std::span<const std::byte> asmap, int bits);
  19  /** Check standard asmap data (128 bits for IPv6) */
  20  bool CheckStandardAsmap(std::span<const std::byte> data);
  21  
  22  /** Read and check asmap from provided binary file */
  23  std::vector<std::byte> DecodeAsmap(fs::path path);
  24  /** Calculate the asmap version, a checksum identifying the asmap being used. */
  25  uint256 AsmapVersion(std::span<const std::byte> data);
  26  
  27  #endif // BITCOIN_UTIL_ASMAP_H
  28