30 #ifndef TINS_ADDRESS_HELPERS_H 31 #define TINS_ADDRESS_HELPERS_H 33 #include <tins/hw_address.h> 46 bool increment_buffer(T& addr) {
47 typename T::iterator it = addr.end() - 1;
48 while (it >= addr.begin() && *it == 0xff) {
53 if (it < addr.begin()) {
61 bool decrement_buffer(T& addr) {
62 typename T::iterator it = addr.end() - 1;
63 while (it >= addr.begin() && *it == 0) {
68 if (it < addr.begin()) {
75 bool increment(IPv4Address& addr);
76 bool increment(IPv6Address& addr);
77 bool decrement(IPv4Address& addr);
78 bool decrement(IPv6Address& addr);
80 bool increment(HWAddress<n>& addr) {
81 return increment_buffer(addr);
84 bool decrement(HWAddress<n>& addr) {
85 return decrement_buffer(addr);
88 IPv4Address last_address_from_mask(IPv4Address addr, IPv4Address mask);
89 IPv6Address last_address_from_mask(IPv6Address addr,
const IPv6Address& mask);
91 HWAddress<n> last_address_from_mask(HWAddress<n> addr,
const HWAddress<n>& mask) {
94 *addr_iter = *addr_iter | ~*it;
106 #endif // TINS_ADDRESS_HELPERS_H The Tins namespace.
Definition: address_range.h:38
storage_type * iterator
The random access iterator type.
Definition: hw_address.h:101
const storage_type * const_iterator
Const iterator type.
Definition: hw_address.h:106