Bitcoin Core 30.99.0
P2P Digital Currency
asmap.h
Go to the documentation of this file.
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
16uint32_t Interpret(std::span<const std::byte> asmap, std::span<const std::byte> ip);
17
18bool SanityCheckAsmap(std::span<const std::byte> asmap, int bits);
20bool CheckStandardAsmap(std::span<const std::byte> data);
21
23std::vector<std::byte> DecodeAsmap(fs::path path);
25uint256 AsmapVersion(std::span<const std::byte> data);
26
27#endif // BITCOIN_UTIL_ASMAP_H
std::vector< std::byte > DecodeAsmap(fs::path path)
Read and check asmap from provided binary file.
Definition: asmap.cpp:322
uint32_t Interpret(std::span< const std::byte > asmap, std::span< const std::byte > ip)
Execute the ASMap bytecode to find the ASN for an IP.
Definition: asmap.cpp:182
bool CheckStandardAsmap(std::span< const std::byte > data)
Check standard asmap data (128 bits for IPv6)
Definition: asmap.cpp:310
uint256 AsmapVersion(std::span< const std::byte > data)
Calculate the asmap version, a checksum identifying the asmap being used.
Definition: asmap.cpp:348
bool SanityCheckAsmap(std::span< const std::byte > asmap, int bits)
Validates ASMap structure by simulating all possible execution paths.
Definition: asmap.cpp:239
256-bit opaque blob.
Definition: uint256.h:195
static CService ip(uint32_t i)