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

Method BuildCategories

src/proxy/IPAllow.cc:575–602  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

573}
574
575swoc::Errata
576IpAllow::BuildCategories()
577{
578 std::error_code ec;
579 if (ip_categories_config_file.empty()) {
580 return {};
581 }
582
583 Note("%s loading categores file %s ...", ts::filename::IP_ALLOW, ip_categories_config_file.c_str());
584 std::string content{swoc::file::load(ip_categories_config_file, ec)};
585 swoc::Errata errata;
586 if (ec.value() == 0) {
587 try {
588 errata = this->YAMLBuildCategories(content);
589 } catch (std::exception &ex) {
590 return swoc::Errata(ec, ERRATA_ERROR, "{} - Invalid IP Categories {} content: {}", this, ip_categories_config_file,
591 ex.what());
592 }
593 if (!errata.is_ok()) {
594 errata.note("While parsing ip categories file: {}", ip_categories_config_file);
595 return errata;
596 }
597 } else {
598 return swoc::Errata(ERRATA_ERROR, "{} Failed to load {}", this, ec);
599 }
600 Note("%s done loading categores file %s ...", ts::filename::IP_ALLOW, ip_categories_config_file.c_str());
601 return {};
602}
603
604swoc::Errata
605IpAllow::YAMLBuildCategories(std::string const &content)

Callers 1

reconfigureMethod · 0.80

Calls 9

YAMLBuildCategoriesMethod · 0.95
ErrataClass · 0.85
loadFunction · 0.50
emptyMethod · 0.45
c_strMethod · 0.45
valueMethod · 0.45
whatMethod · 0.45
is_okMethod · 0.45
noteMethod · 0.45

Tested by

no test coverage detected