43 #ifndef CCXX_ADDRESS_H_
44 #define CCXX_ADDRESS_H_
46 #ifndef CCXX_CONFIG_H_
50 #ifndef CCXX_MISSING_H_
54 #ifndef CCXX_THREAD_H_
58 #ifndef CCXX_EXCEPTION_H_
62 #ifdef CCXX_NAMESPACES
68 #define INET_IPV4_ADDRESS_SIZE 16
69 #define CIDR_IPV4_ADDRESS_SIZE 32
70 #define INET_IPV6_ADDRESS_SIZE 40
71 #define CIDR_IPV6_ADDRESS_SIZE 45
74 #define InetAddress IPV4Address
75 #define InetHostAddress IPV4Host
76 #define InetMaskAddress IPV4Mask
77 #define InetMcastAddress IPV4Multicast
78 #define InetMcastAddressValidator IPV4MulticastValidator
79 #define InetAddrValidator IPV4Validator
80 #define BroadcastAddress IPV4Broadcast
115 operator()(
const in_addr address)
const = 0;
143 void operator()(
const in_addr address)
const;
145 #if __BYTE_ORDER == __BIG_ENDIAN
147 MCAST_VALID_MASK = 0xF0000000,
148 MCAST_VALID_VALUE = 0xE0000000
152 MCAST_VALID_MASK = 0x000000F0,
153 MCAST_VALID_VALUE = 0x000000E0
168 struct in_addr netmask, network;
170 unsigned getMask(
const char *cp)
const;
177 inline struct in_addr getNetwork(void) const
185 inline struct in_addr getNetmask(void) const
193 struct in_addr getBroadcast(void) const;
201 void set(
const char *cidr);
228 bool isMember(
const struct sockaddr *saddr)
const;
236 bool isMember(
const struct in_addr &inaddr)
const;
238 inline bool operator==(
const struct sockaddr *a)
const
239 {
return isMember(a);};
241 inline bool operator==(
const struct in_addr &a)
const
242 {
return isMember(a);};
256 struct in6_addr netmask, network;
258 unsigned getMask(
const char *cp)
const;
265 inline struct in6_addr getNetwork(void) const
273 inline struct in6_addr getNetmask(void) const
281 struct in6_addr getBroadcast(void) const;
289 void set(
const char *cidr);
316 bool isMember(
const struct sockaddr *saddr)
const;
324 bool isMember(
const struct in6_addr &inaddr)
const;
326 inline bool operator==(
const struct sockaddr *sa)
const
327 {
return isMember(sa);};
329 inline bool operator==(
const struct in6_addr &a)
const
330 {
return isMember(a);};
375 bool setIPAddress(
const char *host);
383 void setAddress(
const char *host);
433 const char *getHostname(
void)
const;
442 bool isInetAddress(
void)
const;
451 struct in_addr getAddress(void) const;
464 struct in_addr getAddress(size_t i) const;
484 {
return *
this = (
unsigned long) addr; }
486 inline bool operator!()
const
487 {
return !isInetAddress();};
675 {
return ia.getAddress();}
708 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;
881 inline bool operator!()
const
882 {
return !isInetAddress();};
1052 {
return ia.getAddress();}
1057 #ifdef CCXX_NAMESPACES