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; }
212 return m_addr.s_addr == rhs.m_addr.s_addr;
223 return !(*
this == rhs);
234 return m_addr.s_addr < rhs.m_addr.s_addr;
A class for representing an IP address in an OS independent way.
Ip4Addr ip4Addr(void) const
Return the IP address in OS specific representation.
IpAddress(const IpAddress &addr)
Copy contructor.
struct in_addr Ip4Addr
The type for the OS specific representation of an IP address.
bool isWithinSubet(const std::string &subnet) const
Check if the IP address is within the given netmask.
std::string toString(void) const
Return the string representation of the IP address.
~IpAddress(void)
Destructor.
bool setIpFromString(const std::string &str)
Set the IP address from a string.
friend std::ostream & operator<<(std::ostream &os, const Async::IpAddress &ip)
Output stream operator.
void clear(void)
Invalidate the IP address value.
bool operator!=(const IpAddress &rhs) const
Unequality operator.
bool isUnicast(void) const
Check if this is a unicast IP address.
IpAddress(const Ip4Addr &addr)
Constructor for the IpAddress class.
friend std::istream & operator>>(std::istream &is, Async::IpAddress &ip)
Input stream operator.
IpAddress(void)
Default constructor for the IpAddress class.
IpAddress(const std::string &addr)
Constructor for the IpAddress class.
bool operator<(const IpAddress &rhs) const
Less than operator.
void setIp(const Ip4Addr &addr)
Set the IP address.
bool operator==(const IpAddress &rhs) const
Equality operator.
IpAddress & operator=(const IpAddress &rhs)
Assignment operator.
bool isEmpty(void) const
Check if an invalid IP address has been assigned.
Namespace for the asynchronous programming classes.
std::istream & operator>>(std::istream &is, IpAddress &ip)
std::ostream & operator<<(std::ostream &os, const IpAddress &ip)