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