MCPcopy Create free account
hub / github.com/apache/trafficserver / BuildTable

Method BuildTable

src/proxy/IPAllow.cc:299–330  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

297}
298
299swoc::Errata
300IpAllow::BuildTable()
301{
302 // Table should be empty
303 ink_assert(_src_map.count() == 0 && _dst_map.count() == 0);
304
305 std::error_code ec;
306 std::string content{swoc::file::load(ip_allow_config_file, ec)};
307 swoc::Errata errata;
308 if (ec.value() == 0) {
309 try {
310 errata = this->YAMLBuildTable(content);
311 } catch (std::exception &ex) {
312 return swoc::Errata(ec, ERRATA_ERROR, "{} - Invalid config: {}", this, ex.what());
313 }
314 if (!errata.is_ok()) {
315 errata.note("While parsing config file");
316 return errata;
317 }
318
319 if (_src_map.count() == 0 && _dst_map.count() == 0) {
320 return swoc::Errata(ERRATA_ERROR, "{} - No entries found. All IP Addresses will be blocked", this);
321 }
322
323 if (dbg_ctl_ip_allow.on()) {
324 Print();
325 }
326 } else {
327 return swoc::Errata(ERRATA_ERROR, "{} Failed to load {}. All IP Addresses will be blocked", this, ec);
328 }
329 return {};
330}
331
332swoc::Errata
333IpAllow::YAMLLoadMethod(const YAML::Node &node, Record &rec)

Callers 1

reconfigureMethod · 0.45

Calls 9

YAMLBuildTableMethod · 0.95
ErrataClass · 0.85
loadFunction · 0.50
countMethod · 0.45
valueMethod · 0.45
whatMethod · 0.45
is_okMethod · 0.45
noteMethod · 0.45
onMethod · 0.45

Tested by

no test coverage detected