Public Types |
typedef LinkedObject | policy |
| A convenience type for using a pointer to a linked list as a policy chain.
|
Public Member Functions |
| cidr () |
| Create an uninitialized cidr.
|
| cidr (const char *string) |
| Create an unlinked cidr from a string.
|
| cidr (policy **policy, const char *string, const char *name) |
| Create a named cidr entry on a specified policy chain.
|
| cidr (const cidr &existing) |
| Construct a copy of an existing cidr.
|
| cidr (policy **policy, const char *string) |
| Create an unnamed cidr entry on a specified policy chain.
|
inethostaddr_t | getBroadcast (void) const |
| Get the broadcast host address represented by our cidr.
|
int | getFamily (void) const |
| Get the address family of our cidr block object.
|
unsigned | getMask (void) const |
| Get the number of bits in the cidr bitmask.
|
const char * | getName (void) const |
| Get the saved name of our cidr.
|
inethostaddr_t | getNetmask (void) const |
| Get the effective network mask for our cidr block.
|
inethostaddr_t | getNetwork (void) const |
| Get the network host base address of our cidr block.
|
bool | isMember (const struct sockaddr *address) const |
| Test if a given socket address falls within this cidr.
|
bool | operator!= (const struct sockaddr *address) const |
| Test if a given socket address falls outside this cidr.
|
bool | operator== (const struct sockaddr *address) const |
| Test if a given socket address falls within this cidr.
|
void | set (const char *string) |
| Set our cidr to a string address.
|
Static Public Member Functions |
static cidr * | container (policy *policy, const struct sockaddr *address) |
| Get the largest container cidr entry in a list that matches the socket address.
|
static cidr * | find (policy *policy, const struct sockaddr *address) |
| Find the smallest cidr entry in a list that matches the socket address.
|
Protected Member Functions |
unsigned | getMask (const char *cp) const |
Protected Attributes |
int | family |
char | name [16] |
inethostaddr_t | netmask |
inethostaddr_t | network |
A class to hold internet segment routing rules.
This class can be used to provide a stand-alone representation of a cidr block of internet addresses or chained together into some form of access control list. The cidr class can hold segments for both IPV4 and IPV6 addresses. The class accepts cidr's defined as C strings, typically in the form of address/bits or address/submask. These routines auto-detect ipv4 and ipv6 addresses.
- Author:
- David Sugar <dyfet@gnutelephony.org>
Definition at line 156 of file socket.h.