Async
1.4.0
|
A class for representing an IP address in an OS independent way. More...
#include <AsyncIpAddress.h>
Public Types | |
typedef struct in_addr | Ip4Addr |
The type for the OS specific representation of an IP address. More... | |
Public Member Functions | |
IpAddress (void) | |
Default constructor for the IpAddress class. More... | |
IpAddress (const std::string &addr) | |
Constructor for the IpAddress class. More... | |
IpAddress (const Ip4Addr &addr) | |
Constructor for the IpAddress class. More... | |
IpAddress (const IpAddress &addr) | |
Copy contructor. More... | |
~IpAddress (void) | |
Destructor. More... | |
Ip4Addr | ip4Addr (void) const |
Return the IP address in OS specific representation. More... | |
bool | isUnicast (void) const |
Check if this is a unicast IP address. More... | |
bool | isWithinSubet (const std::string &subnet) const |
Check if the IP address is within the given netmask. More... | |
bool | isEmpty (void) const |
Check if an invalid IP address has been assigned. More... | |
void | clear (void) |
Invalidate the IP address value. More... | |
std::string | toString (void) const |
Return the string representation of the IP address. More... | |
bool | setIpFromString (const std::string &str) |
Set the IP address from a string. More... | |
IpAddress & | operator= (const IpAddress &rhs) |
Assignment operator. More... | |
bool | operator== (const IpAddress &rhs) const |
Equality operator. More... | |
bool | operator!= (const IpAddress &rhs) const |
Unequality operator. More... | |
bool | operator< (const IpAddress &rhs) const |
Less than operator. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const Async::IpAddress &ip) |
Output stream operator. More... | |
std::istream & | operator>> (std::istream &is, Async::IpAddress &ip) |
Input stream operator. More... | |
A class for representing an IP address in an OS independent way.
Definition at line 104 of file AsyncIpAddress.h.
typedef struct in_addr Async::IpAddress::Ip4Addr |
The type for the OS specific representation of an IP address.
Definition at line 110 of file AsyncIpAddress.h.
Async::IpAddress::IpAddress | ( | void | ) |
Default constructor for the IpAddress class.
Async::IpAddress::IpAddress | ( | const std::string & | addr | ) |
Constructor for the IpAddress class.
addr | The string representation of an IP address |
Async::IpAddress::IpAddress | ( | const Ip4Addr & | addr | ) |
Constructor for the IpAddress class.
addr | The IP address in OS specific representation |
|
inline |
Copy contructor.
addr | An IpAddress object to construct the new object from |
Definition at line 133 of file AsyncIpAddress.h.
|
inline |
Destructor.
Definition at line 138 of file AsyncIpAddress.h.
|
inline |
Invalidate the IP address value.
Definition at line 172 of file AsyncIpAddress.h.
References setIpFromString(), and toString().
|
inline |
Return the IP address in OS specific representation.
Definition at line 144 of file AsyncIpAddress.h.
References isUnicast(), and isWithinSubet().
|
inline |
Check if an invalid IP address has been assigned.
Definition at line 167 of file AsyncIpAddress.h.
bool Async::IpAddress::isUnicast | ( | void | ) | const |
Check if this is a unicast IP address.
Referenced by ip4Addr().
bool Async::IpAddress::isWithinSubet | ( | const std::string & | subnet | ) | const |
Check if the IP address is within the given netmask.
subnet | The subnet to use in the check. The subnet should be given on the form a.b.c.d/m (e.g. 192.168.1.0/24). |
Referenced by ip4Addr().
|
inline |
Unequality operator.
rhs | Right hand side expression |
Definition at line 215 of file AsyncIpAddress.h.
|
inline |
Less than operator.
rhs | Right hand side expression |
Definition at line 226 of file AsyncIpAddress.h.
References operator<<, and operator>>.
Assignment operator.
rhs | The address object to assign to this object |
Definition at line 192 of file AsyncIpAddress.h.
|
inline |
Equality operator.
rhs | Right hand side expression |
Definition at line 204 of file AsyncIpAddress.h.
bool Async::IpAddress::setIpFromString | ( | const std::string & | str | ) |
Set the IP address from a string.
str | The string to parse (e.g. "192.168.0.1") |
Referenced by clear().
std::string Async::IpAddress::toString | ( | void | ) | const |
Return the string representation of the IP address.
Referenced by clear().
|
friend |
Output stream operator.
os | The stream to output data to |
ip | The IP address to output to the stream |
Referenced by operator<().
|
friend |
Input stream operator.
is | The stream to input data from |
ip | The IP address object to store information in |
Referenced by operator<().