| 780 | |
| 781 | |
| 782 | NetworkInterface NetworkInterface::forAddress(const IPAddress& addr) |
| 783 | { |
| 784 | Map map = NetworkInterface::map(true, false); |
| 785 | Map::const_iterator it = map.begin(); |
| 786 | Map::const_iterator end = map.end(); |
| 787 | |
| 788 | for (; it != end; ++it) |
| 789 | { |
| 790 | const std::size_t count = it->second.addressList().size(); |
| 791 | for (int i = 0; i < count; ++i) |
| 792 | { |
| 793 | if (it->second.address(i) == addr) |
| 794 | return it->second; |
| 795 | } |
| 796 | } |
| 797 | throw InterfaceNotFoundException(addr.toString()); |
| 798 | } |
| 799 | |
| 800 | |
| 801 | NetworkInterface NetworkInterface::forIndex(unsigned i) |