16namespace swoc {
inline namespace SWOC_VERSION_NS {
18using std::string_view;
40 IP4Range(super_type
const &r) : super_type(r) {}
54 using super_type::super_type;
64 using super_type::assign;
75 bool load(string_view text);
83 IPMask network_mask()
const;
109 NetSource networks()
const;
173 void search_narrower();
198 using super_type::super_type;
208 using super_type::assign;
219 bool load(string_view text);
227 IPMask network_mask()
const;
253 NetSource networks()
const;
314 void search_narrower();
316 bool is_valid(
IPMask const &mask);
386 IPRange(string_view
const &text);
423 bool is(sa_family_t family)
const;
433 bool load(std::string_view
const &text);
440 bool contains(
IPAddr const& addr)
const;
447 bool contains(
IP6Addr const& addr)
const;
454 bool contains(
IP4Addr const& addr)
const;
475 sa_family_t family()
const;
483 IPMask network_mask()
const;
504 NetSource networks()
const;
520 } _range{std::monostate{}};
616 storage_type() =
default;
617 storage_type(std::monostate) {}
618 storage_type(storage_type
const &that);
619 storage_type &operator=(storage_type
const &rhs);
655 bool is(sa_family_t family)
const;
713 storage_type
_raw = {std::monostate()};
754 IPMask const &mask()
const;
829 IPMask const &mask()
const;
864 using self_type =
IPNet;
867 IPNet(self_type
const &that) =
default;
917 return _addr.is_ip4();
923 return _addr.is_ip6();
929 return _addr.family();
944 self_type &assign(
IPAddr const &addr,
IPMask const &mask);
979template <
typename PAYLOAD>
struct ip_space_const_value_type {
980 using self_type = ip_space_const_value_type;
985 ip_space_const_value_type() =
default;
1011 self_type &
assign(self_type
const &that);
1014 std::tuple<IPRangeView, PAYLOAD &>
1020 bool operator==(std::tuple<swoc::IPRange, PAYLOAD>
const &t)
const;
1055 using super_type = ip_space_const_value_type<PAYLOAD>;
1064template <
typename PAYLOAD>
1072template <
typename PAYLOAD>
1080template <
typename PAYLOAD>
1088template <
typename PAYLOAD>
1096template <
typename PAYLOAD>
1099 return _rv == std::get<0>(t) && std::get<1>(t) == *
_payload;
1200 template <
typename F,
typename U = PAYLOAD> self_type &
blend(
IPRange const &range, U
const &color, F &&blender);
1202 template <
typename F,
typename U = PAYLOAD> self_type &
blend(
IP4Range const &range, U
const &color, F &&blender);
1204 template <
typename F,
typename U = PAYLOAD> self_type &
blend(
IP6Range const &range, U
const &color, F &&blender);
1248 friend class IPSpace;
1254 using pointer = value_type
const *;
1255 using reference = value_type
const &;
1256 using difference_type = int;
1319 const_iterator(
typename IP4Space::const_iterator
const &iter4,
typename IP6Space::const_iterator
const &iter6);
1346 friend class IPSpace;
1349 using super_type::super_type;
1476 const_iterator
begin(sa_family_t family)
const;
1479 const_iterator
end(sa_family_t family)
const;
1486 std::pair<iterator, iterator>
1489 return {this->iterator_at(
begin), this->iterator_at(
end)};
1497 std::pair<iterator, iterator>
1500 return {this->iterator_at(
begin), this->iterator_at(
end)};
1508 std::pair<iterator, iterator>
1515 return {this->
end(), this->
end()};
1523 iterator_at(
typename IP4Space::const_iterator
const &spot) {
1524 return iterator(spot,
_ip6.begin());
1527 iterator_at(
typename IP6Space::const_iterator
const &spot) {
1528 return iterator(_ip4.
end(), spot);
1531 friend class IPRangeSet;
1548 static inline constexpr struct Mark {
1549 using self_type = Mark;
1585 size_t count()
const;
1595 using super_type = Space::const_iterator;
1596 friend class IPRangeSet;
1601 using iterator_category = std::bidirectional_iterator_tag;
1602 using pointer = value_type
const *;
1603 using reference = value_type
const &;
1604 using difference_type = int;
1644 bool operator==(self_type
const &that)
const;
1647 bool operator!=(self_type
const &that)
const;
1697IPRangeSet::empty()
const {
1698 return _addrs.empty();
1707IPRangeSet::Mark::operator==(IPRangeSet::Mark::self_type
const &) {
1712IPRangeSet::Mark::operator!=(IPRangeSet::Mark::self_type
const &) {
1716template <
typename PAYLOAD>
1718 typename IP6Space::const_iterator
const &iter6)
1722 _value.assign(this->r4(), _iter_4->payload());
1723 }
else if (
_iter_6.has_next()) {
1724 _value.assign(this->r6(), _iter_6->payload());
1728template <
typename PAYLOAD>
1733 _value.assign(that._value);
1737template <
typename PAYLOAD>
1740 bool incr_p =
false;
1751 if (incr_p || (++
_iter_6).has_next()) {
1760template <
typename PAYLOAD>
1763 self_type zret(*
this);
1768template <
typename PAYLOAD>
1785template <
typename PAYLOAD>
1788 self_type zret(*
this);
1793template <
typename PAYLOAD>
1799template <
typename PAYLOAD>
1813template <
typename PAYLOAD>
1819template <
typename PAYLOAD>
1825template <
typename PAYLOAD>
1832template <
typename PAYLOAD>
1834IPSpace<PAYLOAD>::iterator::value() const ->
value_type & {
1835 return reinterpret_cast<value_type &
>(
const_cast<self_type *
>(
this)->_value);
1838template <
typename PAYLOAD>
1841 return &(this->value());
1844template <
typename PAYLOAD>
1847 return this->value();
1850template <
typename PAYLOAD>
1857template <
typename PAYLOAD>
1860 self_type zret{*
this};
1865template <
typename PAYLOAD>
1872template <
typename PAYLOAD>
1875 self_type zret{*
this};
1884inline IPRangeView::storage_type::storage_type(IPRangeView::storage_type
const &that) : _void(that._void) {}
1886inline IPRangeView::storage_type &
1887IPRangeView::storage_type::operator=(IPRangeView::storage_type
const &rhs) {
1911 _range._ip4 = range;
1915 _range._ip6 = range;
1931 if (AF_INET == view.
_family) {
1932 *
this = *view.
_raw._4;
1933 }
else if (AF_INET6 == view.
_family) {
1934 *
this = *view.
_raw._6;
1940 _range._ip4.assign(
min,
max);
1947 _range._ip6.assign(
min,
max);
1954 if (AF_INET == rv._family) {
1955 *
this = *rv._raw._4;
1956 }
else if (AF_INET6 == rv._family) {
1957 *
this = *rv._raw._6;
1980 return !(*
this == that);
2011IPRangeView::empty()
const {
2014 }
else if (AF_INET ==
_family) {
2041 return _range._ip4.contains(addr.
ip4());
2042 }
else if (this->
is_ip6()) {
2043 return _range._ip6.contains(addr.
ip6());
2049 return this->
is_ip6() && _range._ip6.contains(addr);
2053 return this->
is_ip4() && _range._ip4.contains(addr);
2087 return !(*
this == that);
2111 return this->
is_ip6() &&
_raw._6->contains(addr);
2115 return this->
is_ip4() &&
_raw._4->contains(addr);
2129 return !
_mask.is_valid();
2144 return {this->
min(), this->
max()};
2157inline IP4Net::self_type &
2173 return !
_mask.is_valid();
2188 return {this->
min(), this->
max()};
2201inline IP6Net::self_type &
2216 return !
_mask.is_valid();
2231 return _mask.width();
2241 return {this->
min(), this->
max()};
2244inline IPNet::self_type &
2263 return lhs.
is_ip4() && lhs.
ip4() == rhs;
2267operator==(IP4Net
const &lhs, IPNet
const &rhs) {
2268 return rhs.is_ip4() && rhs.ip4() == lhs;
2273 return lhs.is_ip6() && lhs.ip6() == rhs;
2278 return rhs.is_ip6() && rhs.ip6() == lhs;
2346 return !(*
this == that);
2375IP6Range::NetSource::is_valid(
IPMask const &mask) {
2376 return ((_range.min() & mask) == _range.min()) && ((_range.min() | mask) <= _range.max());
2386 return !(*
this == that);
2403 }
else if (range.
is_ip6()) {
2413 }
else if (rv.
is_ip6()) {
2433 }
else if (AF_INET6 ==
_family) {
2443 }
else if (AF_INET6 ==
_family) {
2451 return {this->
addr(), this->mask()};
2458 }
else if (AF_INET6 ==
_family) {
2476 }
else if (AF_INET6 ==
_family) {
2478 }
else if (AF_UNSPEC ==
_family) {
2486 return !(*
this == that);
2491template <
typename PAYLOAD>
2494 _ip4.mark_bulk(range_payloads, size, is_sorted);
2498template <
typename PAYLOAD>
2501 _ip6.mark_bulk(range_payloads, size, is_sorted);
2505template <
typename PAYLOAD>
2508 _ip4.mark_bulk(range_payloads, is_sorted);
2512template <
typename PAYLOAD>
2515 _ip6.mark_bulk(range_payloads, is_sorted);
2519template <
typename PAYLOAD>
2522 if (range.is(AF_INET)) {
2523 _ip4.mark(range.ip4(), payload);
2524 }
else if (range.is(AF_INET6)) {
2525 _ip6.mark(range.ip6(), payload);
2530template <
typename PAYLOAD>
2533 if (range.is(AF_INET6)) {
2534 _ip6.fill(range.ip6(), payload);
2535 }
else if (range.is(AF_INET)) {
2536 _ip4.fill(range.ip4(), payload);
2541template <
typename PAYLOAD>
2544 if (range.is(AF_INET)) {
2545 _ip4.erase(range.ip4());
2546 }
else if (range.is(AF_INET6)) {
2547 _ip6.erase(range.ip6());
2552template <
typename PAYLOAD>
2553template <
typename F,
typename U>
2556 if (range.is(AF_INET)) {
2557 _ip4.blend(range.ip4(), color, blender);
2558 }
else if (range.is(AF_INET6)) {
2559 _ip6.blend(range.ip6(), color, blender);
2564template <
typename PAYLOAD>
2565template <
typename F,
typename U>
2568 _ip4.blend(range, color, std::forward<F>(blender));
2572template <
typename PAYLOAD>
2573template <
typename F,
typename U>
2576 _ip6.blend(range, color, std::forward<F>(blender));
2580template <
typename PAYLOAD>
2587template <
typename PAYLOAD>
2593template <
typename PAYLOAD>
2596 return const_cast<self_type *
>(
this)->
begin();
2599template <
typename PAYLOAD>
2605template <
typename PAYLOAD>
2608 return const_cast<self_type *
>(
this)->
end();
2611template <
typename PAYLOAD>
2614 return this->
begin();
2617template <
typename PAYLOAD>
2620 return this->
begin();
2623template <
typename PAYLOAD>
2629template <
typename PAYLOAD>
2632 return const_cast<self_type *
>(
this)->
end_ip4();
2635template <
typename PAYLOAD>
2641template <
typename PAYLOAD>
2644 return const_cast<self_type *
>(
this)->
begin_ip6();
2647template <
typename PAYLOAD>
2653template <
typename PAYLOAD>
2659template <
typename PAYLOAD>
2662 if (addr.is_ip4()) {
2663 return this->
find(addr.ip4());
2664 }
else if (addr.is_ip6()) {
2665 return this->
find(addr.ip6());
2670template <
typename PAYLOAD>
2673 if (addr.is_ip4()) {
2674 return this->
find(addr.ip4());
2675 }
else if (addr.is_ip6()) {
2676 return this->
find(addr.ip6());
2681template <
typename PAYLOAD>
2684 if (
auto spot =
_ip4.find(addr); spot !=
_ip4.end()) {
2685 return {spot,
_ip6.begin()};
2690template <
typename PAYLOAD>
2693 if (
auto spot =
_ip4.find(addr); spot !=
_ip4.end()) {
2694 return {spot,
_ip6.begin()};
2699template <
typename PAYLOAD>
2702 return {
_ip4.end(),
_ip6.find(addr)};
2705template <
typename PAYLOAD>
2711template <
typename PAYLOAD>
2716 }
else if (AF_INET6 ==
family) {
2722template <
typename PAYLOAD>
2727 }
else if (AF_INET6 ==
family) {
2733template <
typename PAYLOAD>
2736 return _ip4.count();
2739template <
typename PAYLOAD>
2742 return _ip6.count();
2745template <
typename PAYLOAD>
2748 return _ip4.count() +
_ip6.count();
2751template <
typename PAYLOAD>
2757template <
typename PAYLOAD>
2760 return _ip4.empty() &&
_ip6.empty();
2777 self_type zret{*
this};
2784 self_type zret{*
this};
2796 return &(
_iter->_rv);
2815template <>
class tuple_size<
swoc::IP4Net> :
public std::integral_constant<size_t, 2> {};
2817template <
size_t IDX>
class tuple_element<IDX, swoc::IP4Net> {
2818 static_assert(
"swoc::IP4Net tuple index out of range");
2821template <>
class tuple_element<0, swoc::IP4Net> {
2823 using type = swoc::IP4Addr;
2826template <>
class tuple_element<1, swoc::IP4Net> {
2828 using type = swoc::IPMask;
2832template <>
class tuple_size<swoc::IP6Net> :
public std::integral_constant<size_t, 2> {};
2834template <
size_t IDX>
class tuple_element<IDX, swoc::IP6Net> {
2835 static_assert(
"swoc::IP6Net tuple index out of range");
2838template <>
class tuple_element<0, swoc::IP6Net> {
2840 using type = swoc::IP6Addr;
2843template <>
class tuple_element<1, swoc::IP6Net> {
2845 using type = swoc::IPMask;
2849template <>
class tuple_size<swoc::IPNet> :
public std::integral_constant<size_t, 2> {};
2851template <
size_t IDX>
class tuple_element<IDX, swoc::IPNet> {
2852 static_assert(
"swoc::IPNet tuple index out of range");
2855template <>
class tuple_element<0, swoc::IPNet> {
2857 using type = swoc::IPAddr;
2860template <>
class tuple_element<1, swoc::IPNet> {
2862 using type = swoc::IPMask;
2867namespace swoc {
inline namespace SWOC_VERSION_NS {
2869template <
size_t IDX>
2870typename std::tuple_element<IDX, IP4Net>::type
2871get(swoc::IP4Net
const &net) {
2872 if constexpr (IDX == 0) {
2874 }
else if constexpr (IDX == 1) {
2879template <
size_t IDX>
2880typename std::tuple_element<IDX, IP6Net>::type
2881get(swoc::IP6Net
const &net) {
2882 if constexpr (IDX == 0) {
2884 }
else if constexpr (IDX == 1) {
2889template <
size_t IDX>
2890typename std::tuple_element<IDX, IPNet>::type
2891get(swoc::IPNet
const &net) {
2892 if constexpr (IDX == 0) {
2894 }
else if constexpr (IDX == 1) {
2907template <
typename P>
class tuple_size<swoc::detail::ip_space_value_type<P>> :
public integral_constant<size_t, 2> {};
2908template <
typename P>
class tuple_size<swoc::detail::ip_space_const_value_type<P>> :
public integral_constant<size_t, 2> {};
2910template <
size_t IDX,
typename P>
class tuple_element<IDX, swoc::detail::ip_space_value_type<P>> {
2911 static_assert(
"swoc::IPSpace::value_type tuple index out of range");
2913template <
size_t IDX,
typename P>
class tuple_element<IDX, swoc::detail::ip_space_const_value_type<P>> {
2914 static_assert(
"swoc::IPSpace::value_type tuple index out of range");
2917template <
typename P>
class tuple_element<0, swoc::detail::ip_space_value_type<P>> {
2919 using type = swoc::IPRangeView
const &;
2922template <
typename P>
class tuple_element<1, swoc::detail::ip_space_value_type<P>> {
2927template <
typename P>
class tuple_element<0, swoc::detail::ip_space_const_value_type<P>> {
2929 using type = swoc::IPRangeView
const &;
2932template <
typename P>
class tuple_element<1, swoc::detail::ip_space_const_value_type<P>> {
2934 using type = P
const &;
2939namespace swoc {
inline namespace SWOC_VERSION_NS {
namespace detail {
2940template <
size_t IDX,
typename P>
2942get(ip_space_const_value_type<P>
const &p) ->
typename std::tuple_element<IDX, ip_space_const_value_type<P>>::type {
2943 if constexpr (IDX == 0) {
2945 }
else if constexpr (IDX == 1) {
2946 return *(p._payload);
2950template <
size_t IDX,
typename P>
2952get(ip_space_value_type<P>
const &p) ->
typename std::tuple_element<IDX, ip_space_value_type<P>>::type {
2953 if constexpr (IDX == 0) {
2955 }
else if constexpr (IDX == 1) {
2956 return *(p._payload);
2962using swoc::detail::get;
2965using swoc::detail::get;
bool operator==(RBNode *n, RBNode::Color c)
T _max
the maximum value in the interval
constexpr DiscreteRange()
T _min
The minimum value in the interval.
static constexpr size_t WIDTH
in_addr_t _addr
Address in host order.
static constexpr sa_family_t AF_value
Address family type.
self_type & clear()
Reset network to invalid state.
self_type & assign(IP4Addr const &addr, IPMask const &mask)
bool load(swoc::TextView text)
IPMask _mask
Network mask.
IP4Range as_range() const
IP4Net(self_type const &that)=default
Copy constructor.
IP4Net()=default
Construct invalid network.
IPMask const & mask() const
IP4Addr _addr
Network address (also lower_node).
bool operator==(self_type const &that) const
Equality.
bool operator!=(self_type const &that) const
Inequality.
IP4Addr _mask
Mask for current network.
NetSource(self_type const &that)=default
Copy constructor.
self_type iterator
This class acts as a container and an iterator.
IPMask::raw_type _cidr
Current CIDR value.
bool empty() const
Return true if there are valid networks, false if not.
self_type & operator++()
Move to next network.
IP4Range range_type
Import base range type.
IP4Addr const & addr() const
iterator const_iterator
All iteration is constant so no distinction between iterators.
bool operator!=(self_type const &that) const
Inequality.
NetSource(range_type const &range)
Construct from range.
static iterator end()
Past last network.
bool operator==(self_type const &that) const
Equality.
iterator begin() const
First network.
self_type * operator->()
Access this as if it were an IP4Net.
bool load(string_view text)
< Import assign methods.
NetSource networks() const
constexpr IP4Range()=default
Default constructor, invalid range.
IP4Range(super_type const &r)
sa_family_t family() const
static constexpr size_t WIDTH
Number of bits in the address.
static constexpr sa_family_t AF_value
Address family type.
IPMask _mask
Network mask.
self_type & assign(IP6Addr const &addr, IPMask const &mask)
IPMask const & mask() const
IP6Net()=default
Construct invalid network.
self_type & clear()
Reset network to invalid state.
bool operator==(self_type const &that) const
Equality.
IP6Range as_range() const
IP6Net(self_type const &that)=default
Copy constructor.
bool operator!=(self_type const &that) const
Inequality.
IP6Addr _addr
Network address (also lower_node).
bool load(swoc::TextView text)
IP6Addr const & addr() const
bool operator!=(self_type const &that) const
Inequality.
self_type operator++(int)
Move to next network.
iterator begin() const
First network.
IPMask _mask
Current CIDR value.
IP6Range _range
Remaining range.
self_type iterator
This class acts as a container and an iterator.
NetSource(range_type const &range)
Construct from range.
iterator const_iterator
All iteration is constant so no distinction between iterators.
NetSource(self_type const &that)=default
Copy constructor.
iterator end() const
Past last network.
self_type & operator++()
Move to next network.
bool operator==(self_type const &that) const
Equality.
self_type * operator->()
Access this as if it were an IP6Net.
IP6Range range_type
Import base range type.
Inclusive range of IPv6 addresses.
sa_family_t family() const
bool load(string_view text)
< Import assign methods.
IP6Range(super_type const &r)
NetSource networks() const
IP6Addr const & ip6() const
IP4Addr const & ip4() const
sa_family_t family() const
uint8_t raw_type
Storage for mask width.
IPNet(self_type const &that)=default
Copy constructor.
IPMask::raw_type width() const
bool operator==(self_type const &that) const
Equality.
self_type & assign(IPAddr const &addr, IPMask const &mask)
IPAddr _addr
Address and family.
IPNet()=default
Construct invalid network.
bool load(swoc::TextView text)
IPMask const & mask() const
self_type & clear()
Reset network to invalid state.
IPMask _mask
Network mask.
bool operator!=(self_type const &that) const
Inequality.
sa_family_t family() const
Address family of network.
Bidirectional constant iterator for iteration over ranges.
const_iterator()=default
Default constructor.
super_type _iter
Underlying iterator.
bool operator!=(self_type const &that) const
Inequality.
self_type & operator=(self_type const &that)=default
Assignment.
reference operator*() const
pointer operator->() const
const_iterator(self_type const &that)=default
Copy constructor.
IPRange _r
Some less temporary storage for dereferences.
bool operator==(self_type const &that) const
Equality.
IPRangeSet()=default
Default construct empty set.
self_type & fill(swoc::IPRange const &r)
void clear()
Remove all addresses in the set.
self_type & mark(swoc::IPRange const &r)
const_iterator begin() const
Space _addrs
The address set.
const_iterator end() const
bool contains(swoc::IPAddr const &addr) const
bool operator==(IPRange const &r) const
Compare to a range.
IPRange::NetSource networks() const
bool contains(IPAddr const &addr) const
IP6Range const & ip6() const
storage_type _raw
Storage for the view pointer.
bool is(sa_family_t family) const
IP4Range const & ip4() const
bool operator!=(self_type const &that) const
Inequality.
self_type & assign(IP4Range const &r)
Update the view.
sa_family_t _family
Range address family.
IPRangeView()=default
Default constructor - invalid view.
self_type & clear()
Reset to invalid view.
iterator end() const
Past last network.
self_type * operator->()
Access this as if it were an IP6Net.
bool operator==(self_type const &that) const
Equality.
std::monostate _nil
Default value, no addresses.
NetSource(self_type const &that)=default
Copy constructor.
self_type iterator
This class acts as a container and an iterator.
sa_family_t _family
Mark for union content.
iterator begin() const
First network.
bool operator!=(self_type const &that) const
Inequality.
IP4Range::NetSource _ip4
IPv4 addresses.
self_type & operator++()
Move to next network.
IPRange range_type
Import base range type.
iterator const_iterator
All iteration is constant so no distinction between iterators.
self_type operator++(int)
Move to next network.
IP6Range::NetSource _ip6
IPv6 addresses.
NetSource(range_type const &range)
Construct from range.
std::monostate _nil
Make constructor easier to implement.
IPRange(IP6Addr const &addr)
bool operator!=(self_type const &that) const
Inequality.
bool load(std::string_view const &text)
IP4Range const & ip4() const
sa_family_t family() const
NetSource networks() const
IPRange(IPAddr const &addr)
bool is(sa_family_t family) const
bool contains(IPAddr const &addr) const
self_type & operator=(IPRangeView const &rv)
Assign from view.
self_type & assign(IP4Addr const &min, IP4Addr const &max)
sa_family_t _family
Family of _range.
self_type & clear()
Make the range empty / invalid.
IP6Range const & ip6() const
IPRange()=default
Default constructor - construct invalid range.
std::bidirectional_iterator_tag iterator_category
Import for API compliance.
const_iterator(self_type const &that)=default
Copy constructor.
bool operator==(self_type const &that) const
IP6Space::iterator _iter_6
const_iterator()=default
Default constructor.
reference operator*() const
pointer operator->() const
self_type & operator=(self_type const &that)
bool operator!=(self_type const &that) const
IP4Space::iterator _iter_4
IPv4 sub-space iterator.
value_type _value
Current value.
iterator()=default
Default constructor.
detail::ip_space_value_type< PAYLOAD > value_type
Value type of iteration.
iterator(self_type const &that)=default
Copy constructor.
reference operator*() const
iterator(const_iterator const &that)
self_type & operator=(self_type const &that)
pointer operator->() const
iterator find(IP6Addr const &addr)
const_iterator end(sa_family_t family) const
const_iterator end_ip4() const
const_iterator begin_ip4() const
self_type & mark(IPRange const &range, PAYLOAD const &payload)
const_iterator begin_ip6() const
const_iterator find(IP6Addr const &addr) const
iterator find(IPAddr const &addr)
self_type & fill(IPRange const &range, PAYLOAD const &payload)
const_iterator find(IP4Addr const &addr) const
std::pair< iterator, iterator > intersection(IP6Range const &r)
self_type & mark_bulk(std::vector< std::pair< DiscreteRange< IP6Addr >, PAYLOAD > > &range_payloads, bool is_sorted=false)
vector-based interface for the previous function.
void clear()
Remove all ranges.
iterator find(IP4Addr const &addr)
const_iterator begin(sa_family_t family) const
detail::ip_space_value_type< PAYLOAD > value_type
Iterator value, a range and payload.
const_iterator begin() const
self_type & blend(IPRange const &range, U const &color, F &&blender)
std::pair< iterator, iterator > intersection(IPRange const &r)
const_iterator end() const
self_type & mark_bulk(std::pair< DiscreteRange< IP6Addr >, PAYLOAD > *range_payloads, size_t size, bool is_sorted=false)
std::pair< iterator, iterator > intersection(IP4Range const &r)
IPSpace()=default
Construct an empty space.
const_iterator end_ip6() const
size_t count(sa_family_t f) const
self_type & mark_bulk(std::vector< std::pair< DiscreteRange< IP4Addr >, PAYLOAD > > &range_payloads, bool is_sorted=false)
vector-based interface for the previous function.
const_iterator find(IPAddr const &addr) const
self_type & mark_bulk(std::pair< DiscreteRange< IP4Addr >, PAYLOAD > *range_payloads, size_t size, bool is_sorted=false)
self_type & erase(IPRange const &range)
For template deduction guides.
bool operator==(IPAddr const &lhs, sockaddr const *sa)
Equality.
bool operator!=(IP4Addr const &lhs, IP4Addr const &rhs)
std::tuple< IPRangeView, PAYLOAD & > tuple() const
Support assignemnt to std::tie.
bool operator==(std::tuple< swoc::IPRange, PAYLOAD > const &t) const
Equality against an equivalent tuple.
PAYLOAD const & payload() const
IPRangeView _rv
View to the current range.
self_type & clear()
Reset to default constructed state.
self_type & assign(IP4Range const &r, PAYLOAD &payload)
IPRangeView range_view() const
PAYLOAD * _payload
Payload for _range.