Bitcoin Core 30.99.0
P2P Digital Currency
Functions
asmap.h File Reference
#include <uint256.h>
#include <util/fs.h>
#include <cstddef>
#include <cstdint>
#include <span>
#include <vector>
Include dependency graph for asmap.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

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. More...
 
bool SanityCheckAsmap (std::span< const std::byte > asmap, int bits)
 Validates ASMap structure by simulating all possible execution paths. More...
 
bool CheckStandardAsmap (std::span< const std::byte > data)
 Check standard asmap data (128 bits for IPv6) More...
 
std::vector< std::byte > DecodeAsmap (fs::path path)
 Read and check asmap from provided binary file. More...
 
uint256 AsmapVersion (std::span< const std::byte > data)
 Calculate the asmap version, a checksum identifying the asmap being used. More...
 

Function Documentation

◆ AsmapVersion()

uint256 AsmapVersion ( const std::span< const std::byte >  data)

Calculate the asmap version, a checksum identifying the asmap being used.

Calculate the asmap version, a checksum identifying the asmap being used.

Definition at line 348 of file asmap.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CheckStandardAsmap()

bool CheckStandardAsmap ( const std::span< const std::byte >  data)

Check standard asmap data (128 bits for IPv6)

Check standard asmap data (128 bits for IPv6)

Returns true if the data is valid for 128 bits long inputs.

Definition at line 310 of file asmap.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DecodeAsmap()

std::vector< std::byte > DecodeAsmap ( fs::path  path)

Read and check asmap from provided binary file.

Read and check asmap from provided binary file.

Definition at line 322 of file asmap.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Interpret()

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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SanityCheckAsmap()

bool SanityCheckAsmap ( const std::span< const std::byte >  asmap,
int  bits 
)

Validates ASMap structure by simulating all possible execution paths.

Ensures well-formed bytecode, valid jumps, and proper termination.

Definition at line 239 of file asmap.cpp.

Here is the caller graph for this function: