30 #ifndef TINS_IPADDRESS_H 31 #define TINS_IPADDRESS_H 37 #include <tins/cxxstd.h> 38 #include <tins/macros.h> 50 static const size_t address_size =
sizeof(uint32_t);
62 static IPv4Address from_prefix_length(uint32_t prefix_length);
98 operator uint32_t()
const;
105 std::string to_string()
const;
114 return ip_addr_ == rhs.ip_addr_;
125 return !(*
this == rhs);
135 return ip_addr_ < rhs.ip_addr_;
146 return !operator>(rhs);
156 return ip_addr_ > rhs.ip_addr_;
167 return !operator<(rhs);
202 bool is_private()
const;
210 bool is_loopback()
const;
218 bool is_multicast()
const;
223 bool is_unicast()
const;
228 bool is_broadcast()
const;
249 TINS_API
friend std::ostream& operator<<(std::ostream& output,
const IPv4Address& addr);
251 uint32_t ip_to_int(
const char* ip);
262 struct hash<
Tins::IPv4Address> {
265 return std::hash<std::uint32_t>()(addr);
271 #endif // TINS_IS_CXX11 273 #endif // TINS_IPADDRESS_H bool operator!=(const IPv4Address &rhs) const
Compare this IPv4Address for inequality.
Definition: ip_address.h:124
bool operator>(const IPv4Address &rhs) const
Compare this IPv4Address for greater-than inequality.
Definition: ip_address.h:155
static const IPv4Address broadcast
Definition: ip_address.h:55
Definition: hw_address.h:456
bool operator<=(const IPv4Address &rhs) const
Compares this address for less-than equality.
Definition: ip_address.h:145
The Tins namespace.
Definition: address_range.h:38
bool operator==(const IPv4Address &rhs) const
Compare this IPv4Address for equality.
Definition: ip_address.h:113
Abstraction of an IPv4 address.
Definition: ip_address.h:45
size_t size() const
Returns the size of an IPv4 Address.
Definition: ip_address.h:235
bool operator<(const IPv4Address &rhs) const
Compare this IPv4Address for less-than inequality.
Definition: ip_address.h:134
bool operator>=(const IPv4Address &rhs) const
Compares this address for greater-than equality.
Definition: ip_address.h:166