shibboleth-3.4.1
shibsp::IPRange Class Reference

Represents a range of IP addresses. More...

#include <shibsp/util/IPRange.h>

Public Member Functions

 IPRange (const std::bitset< 32 > &address, int maskSize)
 Constructor.
 
 IPRange (const std::bitset< 128 > &address, int maskSize)
 Constructor.
 
bool contains (const char *address) const
 Determines whether the given address is contained in the IP range.
 
bool contains (const struct sockaddr *address) const
 Determines whether the given address is contained in the IP range.
 

Static Public Member Functions

static IPRange parseCIDRBlock (const char *cidrBlock)
 Parses a CIDR block definition in to an IP range.
 

Detailed Description

Represents a range of IP addresses.

Constructor & Destructor Documentation

◆ IPRange() [1/2]

shibsp::IPRange::IPRange ( const std::bitset< 32 > &  address,
int  maskSize 
)

Constructor.

Parameters
addressaddress to base the range on; may be the network address or the address of a host within the network
maskSizethe number of bits in the netmask

◆ IPRange() [2/2]

shibsp::IPRange::IPRange ( const std::bitset< 128 > &  address,
int  maskSize 
)

Constructor.

Parameters
addressaddress to base the range on; may be the network address or the address of a host within the network
maskSizethe number of bits in the netmask

Member Function Documentation

◆ contains() [1/2]

bool shibsp::IPRange::contains ( const char *  address) const

Determines whether the given address is contained in the IP range.

Parameters
addressthe address to check
Returns
true iff the address is in the range

◆ contains() [2/2]

bool shibsp::IPRange::contains ( const struct sockaddr *  address) const

Determines whether the given address is contained in the IP range.

Parameters
addressthe address to check
Returns
true iff the address is in the range

◆ parseCIDRBlock()

static IPRange shibsp::IPRange::parseCIDRBlock ( const char *  cidrBlock)
static

Parses a CIDR block definition in to an IP range.

Parameters
cidrBlockthe CIDR block definition
Returns
the resultant IP range

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