UCommon
ost::IPV4Cidr Class Reference

The CIDR class is used to support routing tables and validate address policies. More...

#include <address.h>

Public Member Functions

struct in_addr getBroadcast (void) const
 Compute the broadcast address associated with this cidr.
 
struct in_addr getNetmask (void) const
 Get network mask associated with this cidr.
 
struct in_addr getNetwork (void) const
 Get network address associated with this cidr.
 
 IPV4Cidr ()
 Construct an empty cidr.
 
 IPV4Cidr (const char *cidr)
 Construct a new cidr from a string.
 
 IPV4Cidr (IPV4Cidr &)
 Construct a copy of a cidr.
 
bool isMember (const struct in_addr &inaddr) const
 See if a low level address object is a member of this cidr's net.
 
bool isMember (const struct sockaddr *saddr) const
 See if a socket address is a member of this cidr's network.
 
bool operator!= (const struct in_addr &a) const
 
bool operator!= (const struct sockaddr *a) const
 
bool operator== (const struct in_addr &a) const
 
bool operator== (const struct sockaddr *a) const
 
void set (const char *cidr)
 Set the cidr from a full or partial hostname, or from an address/mask, or a host/bits specification.
 

Protected Member Functions

unsigned getMask (const char *cp) const
 

Protected Attributes

struct in_addr netmask network
 

Detailed Description

The CIDR class is used to support routing tables and validate address policies.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

Classless Internet Domain Routing

Definition at line 154 of file address.h.

Constructor & Destructor Documentation

◆ IPV4Cidr() [1/2]

ost::IPV4Cidr::IPV4Cidr ( const char * cidr)

Construct a new cidr from a string.

Parameters
cidrstring to use.

◆ IPV4Cidr() [2/2]

ost::IPV4Cidr::IPV4Cidr ( IPV4Cidr & )

Construct a copy of a cidr.

Parameters
cidrto copy from.

Member Function Documentation

◆ getBroadcast()

struct in_addr ost::IPV4Cidr::getBroadcast ( void ) const

Compute the broadcast address associated with this cidr.

Returns
system binary coded network address.

◆ getNetmask()

struct in_addr ost::IPV4Cidr::getNetmask ( void ) const
inline

Get network mask associated with this cidr.

Returns
system binary coded network mask.

Definition at line 175 of file address.h.

◆ getNetwork()

struct in_addr ost::IPV4Cidr::getNetwork ( void ) const
inline

Get network address associated with this cidr.

Returns
system binary coded address.

Definition at line 166 of file address.h.

◆ isMember() [1/2]

bool ost::IPV4Cidr::isMember ( const struct in_addr & inaddr) const

See if a low level address object is a member of this cidr's net.

Parameters
inaddrobject to test.
Returns
true if member of cidr.

◆ isMember() [2/2]

bool ost::IPV4Cidr::isMember ( const struct sockaddr * saddr) const

See if a socket address is a member of this cidr's network.

Parameters
saddrpointer to test.
Returns
true if member of cidr.

◆ operator!=() [1/2]

bool ost::IPV4Cidr::operator!= ( const struct in_addr & a) const
inline

Definition at line 241 of file address.h.

◆ operator!=() [2/2]

bool ost::IPV4Cidr::operator!= ( const struct sockaddr * a) const
inline

Definition at line 237 of file address.h.

◆ operator==() [1/2]

bool ost::IPV4Cidr::operator== ( const struct in_addr & a) const
inline

Definition at line 233 of file address.h.

◆ operator==() [2/2]

bool ost::IPV4Cidr::operator== ( const struct sockaddr * a) const
inline

Definition at line 229 of file address.h.

◆ set()

void ost::IPV4Cidr::set ( const char * cidr)

Set the cidr from a full or partial hostname, or from an address/mask, or a host/bits specification.

Parameters
cidrstring to use.

Field Documentation

◆ network

struct in_addr netmask ost::IPV4Cidr::network
protected

Definition at line 157 of file address.h.


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