llarp::net::IPRangeMap

a container that maps an ip range to a value that allows you to lookup key by range hit More...

#include <ip_range_map.hpp>

Public Classes

Name
struct CompareEntry

Public Types

Name
using IPRange Range_t
using Range_t::Addr_t IP_t
using std::pair< Range_t, Value_t > Entry_t
using std::vector< Entry_t > Container_t

Public Functions

Name
std::set< Value_t > Values() const
get a set of all values
bool Empty() const
bool ContainsValue(const Value_t & val) const
void ForEachValue(std::function< void(const Value_t &)> functor) const
template <typename Visit_t >
void
ForEachEntry(Visit_t visit) const
template <typename T ,typename Transformer >
std::set< T >
TransformValues(Transformer transform) const
convert all values into type T using a transformer
std::optional< Value_t > GetExact(Range_t range) const
std::set< Entry_t > FindAllEntries(const IP_t & addr) const
return a set of all entries who's range contains this IP
void Insert(const Range_t & addr, const Value_t & val)
template <typename Visit_t >
void
RemoveIf(Visit_t visit)

Detailed Description

template <typename Value_t >
struct llarp::net::IPRangeMap;

a container that maps an ip range to a value that allows you to lookup key by range hit

in the future we should do some kind of magic shit to ensure near constant time for lookups

Public Types Documentation

using Range_t

using llarp::net::IPRangeMap< Value_t >::Range_t =  IPRange;

using IP_t

using llarp::net::IPRangeMap< Value_t >::IP_t =  Range_t::Addr_t;

using Entry_t

using llarp::net::IPRangeMap< Value_t >::Entry_t =  std::pair<Range_t, Value_t>;

using Container_t

using llarp::net::IPRangeMap< Value_t >::Container_t =  std::vector<Entry_t>;

Public Functions Documentation

function Values

inline std::set< Value_t > Values() const

get a set of all values

function Empty

inline bool Empty() const

function ContainsValue

inline bool ContainsValue(
    const Value_t & val
) const

function ForEachValue

inline void ForEachValue(
    std::function< void(const Value_t &)> functor
) const

function ForEachEntry

template <typename Visit_t >
inline void ForEachEntry(
    Visit_t visit
) const

function TransformValues

template <typename T ,
typename Transformer >
inline std::set< T > TransformValues(
    Transformer transform
) const

convert all values into type T using a transformer

function GetExact

inline std::optional< Value_t > GetExact(
    Range_t range
) const

function FindAllEntries

inline std::set< Entry_t > FindAllEntries(
    const IP_t & addr
) const

return a set of all entries who's range contains this IP

function Insert

inline void Insert(
    const Range_t & addr,
    const Value_t & val
)

function RemoveIf

template <typename Visit_t >
inline void RemoveIf(
    Visit_t visit
)

Updated on 2026-01-10 at 22:49:45 +0000