| 39 | } // namespace |
| 40 | |
| 41 | static void |
| 42 | ParseHostLine(swoc::TextView line, HostAddrMap &map, AddrHostMap &rmap) |
| 43 | { |
| 44 | // Elements should be the address then a list of host names. |
| 45 | swoc::TextView addr_text = line.take_prefix_if(&isspace); |
| 46 | IpAddr addr; |
| 47 | |
| 48 | // Don't use RecHttpLoadIp because the address *must* be literal. |
| 49 | if (TS_SUCCESS != addr.load(addr_text)) { |
| 50 | return; |
| 51 | } |
| 52 | |
| 53 | while (!line.ltrim_if(&isspace).empty()) { |
| 54 | swoc::TextView name = line.take_prefix_if(&isspace); |
| 55 | if (addr.isIp6()) { |
| 56 | std::get<IPV6_IDX>(map[name]).push_back(addr); |
| 57 | } else if (addr.isIp4()) { |
| 58 | std::get<IPV4_IDX>(map[name]).push_back(addr); |
| 59 | } |
| 60 | // use insert here so only the first mapping in the file is used to provide a stable view between reloads |
| 61 | rmap.insert(std::pair(addr, name)); |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | HostDBRecord::Handle |
| 66 | HostFile::lookup(const HostDBHash &hash) |
no test coverage detected