44 #ifndef CCXX_ADDRESS_H_
45 #define CCXX_ADDRESS_H_
47 #ifndef CCXX_CONFIG_H_
51 #ifndef CCXX_MISSING_H_
55 #ifndef CCXX_THREAD_H_
59 #ifndef CCXX_EXCEPTION_H_
63 #ifdef CCXX_NAMESPACES
69 #define INET_IPV4_ADDRESS_SIZE 16
70 #define CIDR_IPV4_ADDRESS_SIZE 32
71 #define INET_IPV6_ADDRESS_SIZE 40
72 #define CIDR_IPV6_ADDRESS_SIZE 45
75 #define InetAddress IPV4Address
76 #define InetHostAddress IPV4Host
77 #define InetMaskAddress IPV4Mask
78 #define InetMcastAddress IPV4Multicast
79 #define InetMcastAddressValidator IPV4MulticastValidator
80 #define InetAddrValidator IPV4Validator
81 #define BroadcastAddress IPV4Broadcast
116 operator()(
const in_addr address)
const = 0;
144 void operator()(
const in_addr address)
const;
146 #if __BYTE_ORDER == __BIG_ENDIAN
148 MCAST_VALID_MASK = 0xF0000000,
149 MCAST_VALID_VALUE = 0xE0000000
153 MCAST_VALID_MASK = 0x000000F0,
154 MCAST_VALID_VALUE = 0x000000E0
169 struct in_addr netmask, network;
171 unsigned getMask(
const char *cp)
const;
178 inline struct in_addr getNetwork(void) const
186 inline struct in_addr getNetmask(void) const
194 struct in_addr getBroadcast(void) const;
202 void set(
const char *cidr);
229 bool isMember(
const struct sockaddr *saddr)
const;
237 bool isMember(
const struct in_addr &inaddr)
const;
240 {
return isMember(a);};
243 {
return isMember(a);};
257 struct in6_addr netmask, network;
259 unsigned getMask(
const char *cp)
const;
266 inline struct in6_addr getNetwork(void) const
274 inline struct in6_addr getNetmask(void) const
282 struct in6_addr getBroadcast(void) const;
290 void set(
const char *cidr);
317 bool isMember(
const struct sockaddr *saddr)
const;
325 bool isMember(
const struct in6_addr &inaddr)
const;
328 {
return isMember(sa);};
331 {
return isMember(a);};
376 bool setIPAddress(
const char *host);
384 void setAddress(
const char *host);
434 const char *getHostname(
void)
const;
443 bool isInetAddress(
void)
const;
452 struct in_addr getAddress(void) const;
465 struct in_addr getAddress(size_t i) const;
485 {
return *
this = (
unsigned long) addr; }
488 {
return !isInetAddress();};
676 {
return ia.getAddress();}
708 virtual void operator()(
const in6_addr address)
const = 0;
736 void operator()(
const in6_addr address)
const;
779 bool setIPAddress(
const char *host);
787 void setAddress(
const char *host);
837 const char *getHostname(
void)
const;
846 bool isInetAddress(
void)
const;
855 struct in6_addr getAddress(void) const;
868 struct in6_addr getAddress(size_t i) const;
882 {
return !isInetAddress();};
1052 {
return ia.getAddress();}
1057 #ifdef CCXX_NAMESPACES
size_t getAddressCount() const
Returns the number of internet addresses that an IPV4Address object contains.
Definition: address.h:472
bool operator==(const struct sockaddr *sa) const
Definition: address.h:327
Classes derived from IPV4Address would require an specific validator to pass to the IPV4Address const...
Definition: address.h:98
Internet addresses used specifically as masking addresses (such as " 255.255.255.0") are held in the ...
Definition: address.h:916
struct in6_addr * ipaddr
Definition: address.h:764
The CIDR class is used to support routing tables and validate address policies.
Definition: address.h:166
IPV4MulticastValidator()
Constructor.
Definition: address.h:133
bool operator==(const struct in_addr &a) const
Definition: address.h:242
struct in_addr getaddress(const IPV4Address &ia)
Definition: address.h:675
static Mutex mutex
Definition: address.h:367
The CIDR class is used to support routing tables and validate address policies.
Definition: address.h:254
#define __EXPORT
Definition: config.h:980
IPV4Address & operator=(const char *str)
substitute functions which may be missing in target platform libc.
static Mutex mutex
Definition: address.h:770
IPV4Validator()
Constructor.
Definition: address.h:104
char * hostname
Definition: address.h:363
IPV4Address & operator=(unsigned long addr)
Allows assignment from the return of functions like inet_addr() or htonl()
Definition: address.h:594
virtual ~IPV6Validator()
Keeps compilers happy.
Definition: address.h:702
virtual ~IPV6MulticastValidator()
Keeps compilers happy...
Definition: address.h:730
bool operator==(const struct in6_addr &a) const
Definition: address.h:330
class __EXPORT IPV6Host
Definition: address.h:681
GNU Common C++ exception model base classes.
Synchronization and threading services.
bool operator!() const
Definition: address.h:881
IPV6MulticastValidator()
Constructor.
Definition: address.h:725
The network name and address objects are all derived from a common IPV6Address base class...
Definition: address.h:753
The network name and address objects are all derived from a common IPV4Address base class...
Definition: address.h:350
size_t addr_count
Definition: address.h:765
class __EXPORT IPV4Host
Definition: address.h:88
IPV4Address & operator=(unsigned long addr)
Allows assignment from the return of functions like inet_addr() or htonl()
Definition: address.h:550
char * hostname
Definition: address.h:766
The broadcast address object is used to store the broadcast address for a specific subnet...
Definition: address.h:988
bool operator!() const
Definition: address.h:487
IPV6Validator()
Constructor.
Definition: address.h:697
The Mutex class is used to protect a section of code so that at any given time only a single thread c...
Definition: thread.h:186
A specialization of IPV6Address that provides address validation for multicast addresses.
Definition: address.h:1010
IPV4Address & operator=(unsigned int addr)
Definition: address.h:484
size_t addr_count
Definition: address.h:362
size_t getAddressCount() const
Returns the number of internet addresses that an IPV6Address object contains.
Definition: address.h:875
The broadcast address object is used to store the broadcast address for a specific subnet...
Definition: address.h:612
bool operator==(const struct sockaddr *a) const
Definition: address.h:239
__EXPORT std::ostream & operator<<(std::ostream &os, const IPV4Address &ia)
The Mutex Counter is a counter variable which can safely be incremented or decremented by multiple th...
Definition: thread.h:499
struct in_addr * ipaddr
Definition: address.h:361
This object is used to hold the actual and valid internet address of a specific host machine that wil...
Definition: address.h:561
Classes derived from IPV6Address would require an specific validator to pass to the IPV6Address const...
Definition: address.h:691
A specialization of IPV4Address that provides address validation for multicast addresses.
Definition: address.h:634
#define InetAddrValidator
Definition: address.h:80
virtual ~IPV4Validator()
keeps compilers happy.
Definition: address.h:109
unsigned short tpport_t
Transport Protocol Ports.
Definition: address.h:86
This object is used to hold the actual and valid internet address of a specific host machine that wil...
Definition: address.h:948
virtual ~IPV4MulticastValidator()
Keeps compilers happy.
Definition: address.h:138
Class for the function object that validates multicast addresses.
Definition: address.h:719
Class for the function object that validates multicast addresses.
Definition: address.h:127
Internet addresses used specifically as masking addresses (such as " 255.255.255.0") are held in the ...
Definition: address.h:522