30#ifndef TINS_IPADDRESS_H
31#define TINS_IPADDRESS_H
37#include <tins/cxxstd.h>
38#include <tins/macros.h>
98 operator uint32_t()
const;
114 return ip_addr_ == rhs.ip_addr_;
125 return !(*
this == rhs);
135 return ip_addr_ < rhs.ip_addr_;
156 return ip_addr_ > rhs.ip_addr_;
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;
251 uint32_t ip_to_int(
const char* ip);
265 return std::hash<std::uint32_t>()(addr);
Abstraction of an IPv4 address.
Definition ip_address.h:45
IPv4Address(const char *ip=0)
Constructor taking a const char*.
Definition ip_address.cpp:73
Abstraction of an IPv4 address.
Definition ip_address.h:45
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 less-than inequality.
Definition ip_address.h:134
bool operator<=(const IPv4Address &rhs) const
Compares this address for less-than equality.
Definition ip_address.h:145
std::string to_string() const
Retrieve the string representation of this address.
Definition ip_address.cpp:86
IPv4Address(const char *ip=0)
Constructor taking a const char*.
Definition ip_address.cpp:73
static const size_t address_size
Definition ip_address.h:50
TINS_API friend std::ostream & operator<<(std::ostream &output, const IPv4Address &addr)
Writes this address to a std::ostream.
static IPv4Address from_prefix_length(uint32_t prefix_length)
Constructs an IPv4 address from a prefix length.
Definition ip_address.cpp:64
bool operator>=(const IPv4Address &rhs) const
Compares this address for greater-than equality.
Definition ip_address.h:166
bool operator==(const IPv4Address &rhs) const
Compare this IPv4Address for equality.
Definition ip_address.h:113
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 greater-than inequality.
Definition ip_address.h:155
static const IPv4Address broadcast
Definition ip_address.h:55
The Tins namespace.
Definition address_range.h:38