![]() |
Bitcoin Core 31.1.0
P2P Digital Currency
|
#include <util/asmap.h>#include <clientversion.h>#include <hash.h>#include <serialize.h>#include <streams.h>#include <uint256.h>#include <util/fs.h>#include <util/log.h>#include <algorithm>#include <bit>#include <cassert>#include <cstddef>#include <cstdio>#include <span>#include <utility>#include <vector>Go to the source code of this file.
Functions | |
| uint32_t | Interpret (const std::span< const std::byte > asmap, const std::span< const std::byte > ip) |
| Execute the ASMap bytecode to find the ASN for an IP. | |
| bool | SanityCheckAsmap (const std::span< const std::byte > asmap, int bits) |
| Validates ASMap structure by simulating all possible execution paths. | |
| bool | CheckStandardAsmap (const std::span< const std::byte > data) |
| Provides a safe interface for validating ASMap data before use. | |
| std::vector< std::byte > | DecodeAsmap (fs::path path) |
| Loads an ASMap file from disk and validates it. | |
| uint256 | AsmapVersion (const std::span< const std::byte > data) |
| Computes SHA256 hash of ASMap data for versioning and consistency checks. | |
| uint256 AsmapVersion | ( | std::span< const std::byte > | data | ) |
Computes SHA256 hash of ASMap data for versioning and consistency checks.
Calculate the asmap version, a checksum identifying the asmap being used.
Computes SHA256 hash of ASMap data for versioning and consistency checks.
Definition at line 348 of file asmap.cpp.
| bool CheckStandardAsmap | ( | std::span< const std::byte > | data | ) |
Provides a safe interface for validating ASMap data before use.
Check standard asmap data (128 bits for IPv6).
Returns true if the data is valid for 128 bits long inputs.
Provides a safe interface for validating ASMap data before use.
Definition at line 310 of file asmap.cpp.
| std::vector< std::byte > DecodeAsmap | ( | fs::path | path | ) |
| uint32_t Interpret | ( | const std::span< const std::byte > | asmap, |
| const std::span< const std::byte > | ip ) |
Execute the ASMap bytecode to find the ASN for an IP.
This function interprets the asmap bytecode and uses bits from the IP address to navigate through the encoded trie structure, ultimately returning an ASN value.
Definition at line 182 of file asmap.cpp.