This class encapsulates an IPv4 address. More...
#include <DwmIpv4Address.hh>
Public Member Functions | |
| Ipv4Address () | |
| Constructor. | |
| Ipv4Address (ipv4addr_t addr) | |
| Construct from an ipv4addr_t (32-bit value in network byte order). | |
| Ipv4Address (const std::string &dottedAddr) | |
| Construct from a dotted-decimal string. | |
| ipv4addr_t | Raw () const |
| Returns an ipv4addr_t representation (32-bit value in network byte order). | |
| operator std::string () const | |
| Returns a dotted-decimal string representation. | |
| bool | operator< (const Ipv4Address &addr) const |
| less-than operator. | |
| bool | operator> (const Ipv4Address &addr) const |
| Greater-than operator. | |
| bool | operator>= (const Ipv4Address &addr) const |
| Greater than or equal-to operator. | |
| bool | operator<= (const Ipv4Address &addr) const |
| Less-than or equal-to operator. | |
| bool | operator== (const Ipv4Address &addr) const |
| Equal-to operator. | |
| bool | operator!= (const Ipv4Address &addr) const |
| Not-equal-to operator. | |
| Ipv4Address & | operator&= (const Ipv4Address &mask) |
| Mask operator. | |
| Ipv4Address | operator++ (int) |
| Post-increment operator. | |
| Ipv4Address & | operator++ () |
| Pre-increment operator. | |
| Ipv4Address | operator-- (int) |
| Post-decrement operator. | |
| Ipv4Address & | operator-- () |
| Pre-decrement operator. | |
| Ipv4Address & | operator-= (uint32_t i) |
| -= operator. | |
| Ipv4Address & | operator+= (uint32_t i) |
| += operator. | |
| bool | BitIsSet (int8_t bit) const |
| int | GetBit (int bit) const |
| uint64_t | StreamedLength () const |
| Returns the number of bytes that would be written if we called one of the non-compressing Write() members. | |
| std::istream & | Read (std::istream &is) |
| Reads from an istream. Returns the istream. | |
| std::ostream & | Write (std::ostream &os) const |
| Writes to an ostream. Returns the ostream. | |
| ssize_t | Read (int fd) |
| Reads from a file descriptor. | |
| ssize_t | Write (int fd) const |
| Writes to a file descriptor. | |
| size_t | Read (FILE *f) |
| Reads from a FILE pointer. Returns 1 on success, 0 on failure. | |
| size_t | Write (FILE *f) const |
| Writes to a FILE pointer. Returns 1 on success, 0 on failure. | |
| int | Read (gzFile gzf) |
| Reads from a gzFile. | |
| int | Write (gzFile gzf) const |
| Writes to a gzFile. | |
| int | BZRead (BZFILE *bzf) |
| Reads from a BZFILE pointer. | |
| int | BZWrite (BZFILE *bzf) const |
| Writes to a BZFILE pointer. | |
| bool | Read (boost::asio::ip::tcp::socket &s, boost::system::error_code &ec) |
| Reads from a boost::asio::ip::tcp::socket. | |
| bool | Write (boost::asio::ip::tcp::socket &s, boost::system::error_code &ec) const |
| Writes to a boost::asio::ip::tcp::socket. | |
| bool | Read (boost::asio::local::stream_protocol::socket &s, boost::system::error_code &ec) |
| Reads from a boost::asio::local::stream_protocol::socket. | |
| bool | Write (boost::asio::local::stream_protocol::socket &s, boost::system::error_code &ec) const |
| Writes to a boost::asio::local::stream_protocol::socket. | |
| bool | Read (boost::asio::generic::stream_protocol::socket &s, boost::system::error_code &ec) |
| Reads from a boost::asio::generic::stream_protocol::socket. | |
| bool | Write (boost::asio::generic::stream_protocol::socket &s, boost::system::error_code &ec) const |
| Writes to a boost::asio::generic::stream_protocol::socket. | |
| uint32_t | IpSum () const |
| Returns the partial sum of the IP address, as would be used when calculating the IP header checksum or UDP checksum (as part of the 'pseudo-header' used for UDP checksums). | |
Static Public Member Functions | |
| static uint8_t | MaxKeyBits () |
Protected Member Functions | |
| template<typename Protocol , typename Executor > | |
| bool | ASIO_Read (boost::asio::basic_stream_socket< Protocol, Executor > &s, boost::system::error_code &ec) |
Protected Attributes | |
| uint32_t | _addr |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const Ipv4Address &addr) |
| Prints an Ipv4Address to an ostream in human-readable form. | |
| Ipv4Address | operator& (const Ipv4Address &addr, const Ipv4Address &mask) |
Apply a mask (bitwise AND) to the given addr and return the result. | |
This class encapsulates an IPv4 address.
| int Dwm::Ipv4Address::BZRead | ( | BZFILE * | bzf | ) |
Reads from a BZFILE pointer.
Returns the number of bytes read (4 on success).
| int Dwm::Ipv4Address::BZWrite | ( | BZFILE * | bzf | ) | const |
Writes to a BZFILE pointer.
Returns the number of bytes written (4 on success).
|
inline |
+= operator.
Protects against roll-over (will not increment past 255.255.255.255). Note that the right hand side must be in host byte order.
|
inline |
-= operator.
Protects against roll-under (will not decrement past 0.0.0.0). Note that the right hand side must be in host byte order.
|
inline |
Reads from a boost::asio::generic::stream_protocol::socket.
Returns true on success. Returns false and sets ec on failure.
|
inline |
Reads from a boost::asio::ip::tcp::socket.
Returns true on success. Returns false and sets ec on failure.
| bool Dwm::Ipv4Address::Read | ( | boost::asio::local::stream_protocol::socket & | s, |
| boost::system::error_code & | ec ) |
Reads from a boost::asio::local::stream_protocol::socket.
Returns true on success. Returns false and sets ec on failure.
| int Dwm::Ipv4Address::Read | ( | gzFile | gzf | ) |
Reads from a gzFile.
Returns the number of bytes read (4 on success).
| ssize_t Dwm::Ipv4Address::Read | ( | int | fd | ) |
Reads from a file descriptor.
Returns the number of bytes read (4 on success).
| bool Dwm::Ipv4Address::Write | ( | boost::asio::generic::stream_protocol::socket & | s, |
| boost::system::error_code & | ec ) const |
Writes to a boost::asio::generic::stream_protocol::socket.
Returns true on success. Returns false and sets ec on failure.
| bool Dwm::Ipv4Address::Write | ( | boost::asio::ip::tcp::socket & | s, |
| boost::system::error_code & | ec ) const |
Writes to a boost::asio::ip::tcp::socket.
Returns true on success. Returns false and sets ec on failure.
| bool Dwm::Ipv4Address::Write | ( | boost::asio::local::stream_protocol::socket & | s, |
| boost::system::error_code & | ec ) const |
Writes to a boost::asio::local::stream_protocol::socket.
Returns true on success. Returns false and sets ec on failure.
| int Dwm::Ipv4Address::Write | ( | gzFile | gzf | ) | const |
Writes to a gzFile.
Returns the number of bytes written (4 on success).
| ssize_t Dwm::Ipv4Address::Write | ( | int | fd | ) | const |
Writes to a file descriptor.
Returns the number of bytes written (4 on success).