libDwm-0.6.0
Dwm::Ipv6Prefix Class Reference

This class encapsulates an IPv6 network prefix. More...

#include <DwmIpv6Prefix.hh>

Inheritance diagram for Dwm::Ipv6Prefix:
Collaboration diagram for Dwm::Ipv6Prefix:

Public Member Functions

 Ipv6Prefix ()
 Constructor.
 
 Ipv6Prefix (const std::string &prefix)
 Construct from a string.
 
 Ipv6Prefix (const Ipv6Address &network, uint8_t maskLength)
 Construct from an IPv6 network address and netmask length. More...
 
 Ipv6Prefix (const Ipv6Prefix &prefix)
 Copy constructor.
 
Ipv6Address Network () const
 Returns the network address.
 
Ipv6Address Netmask () const
 Returns the netmask.
 
uint8_t MaskLength () const
 Returns the netmask length.
 
bool Set (const Ipv6Address &network, uint8_t maskLength)
 Set the prefix using a network address and netmask length. More...
 
bool operator< (const Ipv6Prefix &prefix) const
 Less-than operator.
 
bool operator> (const Ipv6Prefix &prefix) const
 Greater-than operator.
 
bool operator== (const Ipv6Prefix &prefix) const
 Equal-to operator.
 
bool Contains (const Ipv6Address &addr) const
 Returns true if addr falls within the prefix.
 
ssize_t Read (int fd)
 Reads the prefix from a file descriptor.
 
ssize_t Write (int fd) const
 Writes the prefix to a file descriptor.
 
size_t Read (FILE *f)
 Reads the prefix from a FILE pointer. More...
 
size_t Write (FILE *f) const
 Writes the prefix to a FILE pointer. More...
 
std::istream & Read (std::istream &is)
 Reads the prefix from an istream. Returns the istream.
 
std::ostream & Write (std::ostream &os) const
 Writes the prefix to an ostream. Returns the ostream.
 
int Read (gzFile gzf)
 Reads the prefix from a gzFile.
 
int Write (gzFile gzf) const
 Writes the prefix to a gzFile.
 
int BZRead (BZFILE *bzf)
 Reads the prefix from a BZFILE pointer.
 
int BZWrite (BZFILE *bzf) const
 Writes the prefix to a BZFILE pointer.
 
std::string ToString () const
 Returns a string representation of the prefix in the usual form, for example "1234:5678::/32".
 
uint32_t StreamedLength () const
 Returns the number of bytes that would be written if the prefix was written to a file descriptor or ostream. More...
 
- Public Member Functions inherited from Dwm::Readable
virtual ~Readable ()
 destructor
 
- Public Member Functions inherited from Dwm::Writable
virtual ~Writable ()
 Destructor.
 
- Public Member Functions inherited from Dwm::GZReadable
virtual ~GZReadable ()
 destructor
 
- Public Member Functions inherited from Dwm::GZWritable
virtual ~GZWritable ()
 destructor
 

Friends

std::ostream & operator<< (std::ostream &os, const Ipv6Prefix &prefix)
 Prints a prefix to an ostream in the usual colon-delimited form.
 

Detailed Description

This class encapsulates an IPv6 network prefix.

Constructor & Destructor Documentation

◆ Ipv6Prefix()

Dwm::Ipv6Prefix::Ipv6Prefix ( const Ipv6Address network,
uint8_t  maskLength 
)

Construct from an IPv6 network address and netmask length.

The network address may be a host address; this constructor will apply the netmask.

Member Function Documentation

◆ Read()

size_t Dwm::Ipv6Prefix::Read ( FILE *  f)
virtual

Reads the prefix from a FILE pointer.

Returns 1 on success, 0 on failure.

Implements Dwm::Readable.

◆ Set()

bool Dwm::Ipv6Prefix::Set ( const Ipv6Address network,
uint8_t  maskLength 
)

Set the prefix using a network address and netmask length.

Returns true on success, false on failure.

◆ StreamedLength()

uint32_t Dwm::Ipv6Prefix::StreamedLength ( ) const
virtual

Returns the number of bytes that would be written if the prefix was written to a file descriptor or ostream.

Implements Dwm::Writable.

◆ Write()

size_t Dwm::Ipv6Prefix::Write ( FILE *  f) const
virtual

Writes the prefix to a FILE pointer.

Returns 1 on success, 0 on failure.

Implements Dwm::Writable.


The documentation for this class was generated from the following file: