30 #ifndef ASYNC_IP_ADDRESS_INCLUDED 31 #define ASYNC_IP_ADDRESS_INCLUDED 40 #include <netinet/in.h> 167 bool isEmpty(
void)
const {
return (m_addr.s_addr == INADDR_NONE); }
172 void clear(
void) { m_addr.s_addr = INADDR_NONE; }
206 return m_addr.s_addr == rhs.m_addr.s_addr;
217 return !(*
this == rhs);
228 return m_addr.s_addr < rhs.m_addr.s_addr;
236 friend std::ostream&
operator<<(std::ostream& os,
244 friend std::istream&
operator>>(std::istream& is,
255 std::ostream&
operator<<(std::ostream& os,
const IpAddress& ip);
256 std::istream&
operator>>(std::istream& is, IpAddress& ip);
bool operator<(const IpAddress &rhs) const
Less than operator.
IpAddress & operator=(const IpAddress &rhs)
Assignment operator.
friend std::istream & operator>>(std::istream &is, Async::IpAddress &ip)
Input stream operator.
std::ostream & operator<<(std::ostream &os, const IpAddress &ip)
bool isUnicast(void) const
Check if this is a unicast IP address.
bool isWithinSubet(const std::string &subnet) const
Check if the IP address is within the given netmask.
Ip4Addr ip4Addr(void) const
Return the IP address in OS specific representation.
bool operator==(const IpAddress &rhs) const
Equality operator.
void clear(void)
Invalidate the IP address value.
IpAddress(const IpAddress &addr)
Copy contructor.
friend std::ostream & operator<<(std::ostream &os, const Async::IpAddress &ip)
Output stream operator.
IpAddress(void)
Default constructor for the IpAddress class.
struct in_addr Ip4Addr
The type for the OS specific representation of an IP address.
~IpAddress(void)
Destructor.
bool isEmpty(void) const
Check if an invalid IP address has been assigned.
bool operator!=(const IpAddress &rhs) const
Unequality operator.
Namespace for the asynchronous programming classes.
std::string toString(void) const
Return the string representation of the IP address.
A class for representing an IP address in an OS independent way.
bool setIpFromString(const std::string &str)
Set the IP address from a string.
std::istream & operator>>(std::istream &is, IpAddress &ip)