| 385 | |
| 386 | |
| 387 | IPAddress IPAddress::operator & (const IPAddress& other) const |
| 388 | { |
| 389 | if (family() == other.family()) |
| 390 | { |
| 391 | if (family() == IPv4) |
| 392 | { |
| 393 | IPv4AddressImpl t(pImpl()->addr()); |
| 394 | IPv4AddressImpl o(other.pImpl()->addr()); |
| 395 | return IPAddress((t & o).addr(), sizeof(struct in_addr)); |
| 396 | } |
| 397 | #if defined(POCO_HAVE_IPv6) |
| 398 | else if (family() == IPv6) |
| 399 | { |
| 400 | const IPv6AddressImpl t(pImpl()->addr(), pImpl()->scope()); |
| 401 | const IPv6AddressImpl o(other.pImpl()->addr(), other.pImpl()->scope()); |
| 402 | const IPv6AddressImpl r = t & o; |
| 403 | return IPAddress(r.addr(), sizeof(struct in6_addr), r.scope()); |
| 404 | } |
| 405 | #endif |
| 406 | else throw Poco::InvalidArgumentException("Invalid or unsupported address family passed to IPAddress()"); |
| 407 | } |
| 408 | else throw Poco::InvalidArgumentException("Invalid or unsupported address family passed to IPAddress()"); |
| 409 | } |
| 410 | |
| 411 | |
| 412 | IPAddress IPAddress::operator | (const IPAddress& other) const |