| 8988 | } |
| 8989 | |
| 8990 | TSReturnCode |
| 8991 | TSRecYAMLConfigParse(TSYaml node, TSYAMLRecNodeHandler handler, void *data) |
| 8992 | { |
| 8993 | swoc::Errata err; |
| 8994 | try { |
| 8995 | err = ParseRecordsFromYAML( |
| 8996 | *reinterpret_cast<YAML::Node *>(node), |
| 8997 | [handler, data](const CfgNode &field, swoc::Errata &) -> void { |
| 8998 | // Errors from the handler should be reported and handled by the handler. |
| 8999 | // RecYAMLConfigFileParse will report any YAML parsing error. |
| 9000 | TSYAMLRecCfgFieldData cfg; |
| 9001 | auto const &field_str = field.node.as<std::string>(); |
| 9002 | cfg.field_name = field_str.c_str(); |
| 9003 | cfg.record_name = field.get_record_name().data(); |
| 9004 | cfg.value_node = reinterpret_cast<TSYaml>(const_cast<YAML::Node *>(&field.value_node)); |
| 9005 | handler(&cfg, data); |
| 9006 | }, |
| 9007 | true /* lock */); |
| 9008 | } catch (std::exception const &ex) { |
| 9009 | err.note(ERRATA_ERROR, "RecYAMLConfigParse error cought: {}", ex.what()); |
| 9010 | } |
| 9011 | // Drop API logs in case of an error. |
| 9012 | if (!err.empty()) { |
| 9013 | std::string buf; |
| 9014 | Dbg(dbg_ctl_plugin, "%s", swoc::bwprint(buf, "{}", err).c_str()); |
| 9015 | } |
| 9016 | |
| 9017 | return err.empty() ? TS_SUCCESS : TS_ERROR; |
| 9018 | } |
| 9019 | |
| 9020 | TSTxnType |
| 9021 | TSHttpTxnTypeGet(TSHttpTxn txnp) |
no test coverage detected