::rust::String section;
::rust::String fieldname;
::rust::String type_name;
- pdns::rust::settings::rec::Value rustvalue = {false, 0, 0.0, "", {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}};
+ pdns::rust::settings::rec::Value rustvalue = {false, 0, 0.0, "", {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}};
if (pdns::settings::rec::oldKVToBridgeStruct(var, val, section, fieldname, type_name, rustvalue)) {
auto overriding = !mainFile && !incremental && !simpleRustType(type_name);
auto [existing, inserted] = map.emplace(std::pair{std::pair{section, fieldname}, pdns::rust::settings::rec::OldStyle{section, fieldname, var, std::move(type_name), rustvalue, overriding}});
def("recursor", "allowed_additional_qtypes", "Vec<AllowedAdditionalQType>");
def("incoming", "proxymappings", "Vec<ProxyMapping>");
def("recursor", "forwarding_catalog_zones", "Vec<ForwardingCatalogZone>");
+ def("webservice", "listen", "Vec<IncomingWSConfig>");
+ def("recursor", "tls_configurations", "Vec<OutgoingTLSConfiguration>");
// End of should be generated XXX
// Convert the map to a vector, as CXX does not have any dictionary like support.
elif rust_type == 'Vec<AuthZone>':
file.write(f'getAuthZones("{oldname}")')
else:
- file.write(f'Unknown type {rust_type}\n')
+ file.write(f'Unknown3 type {rust_type}\n')
file.write(';\n')
file.write('}\n\n')
file.write(f' to_yaml(rustvalue.vec_authzone_val, value{extra});\n')
file.write(' return true;\n }\n')
else:
- file.write(f'Unknown type {rust_type}\n')
+ file.write(f'Unknown4 type {rust_type}\n')
file.write(' return false;\n')
file.write('}\n\n')
vec_allowedadditionalqtype_val: Vec<AllowedAdditionalQType>,
vec_proxymapping_val: Vec<ProxyMapping>,
vec_forwardingcatalogzone_val: Vec<ForwardingCatalogZone>,
+ vec_incomingwsconfig_val: Vec<IncomingWSConfig>,
+ vec_outgoingtlsconfiguration_val: Vec<OutgoingTLSConfiguration>,
}
struct OldStyle {
}
impl IncomingWSConfig {
+
+ fn to_yaml_map(&self) -> serde_yaml::Value {
+ // XXX
+ let map = serde_yaml::Mapping::new();
+ serde_yaml::Value::Mapping(map)
+ }
+
pub fn validate(&self, _field: &str) -> Result<(), ValidationError> {
// XXX
Ok(())
}
impl OutgoingTLSConfiguration {
+
+ fn to_yaml_map(&self) -> serde_yaml::Value {
+ // XXX
+ let map = serde_yaml::Mapping::new();
+ serde_yaml::Value::Mapping(map)
+ }
+
pub fn validate(&self, field: &str) -> Result<(), ValidationError> {
if self.name.is_empty() {
let msg = format!("{}: value may not be empty", field);
}
serde_yaml::Value::Sequence(seq)
}
+ "Vec<OutgoingTLSConfiguration>" => {
+ let mut seq = serde_yaml::Sequence::new();
+ for element in &entry.value.vec_outgoingtlsconfiguration_val {
+ seq.push(element.to_yaml_map());
+ }
+ serde_yaml::Value::Sequence(seq)
+ }
+ "Vec<IncomingWSConfig>" => {
+ let mut seq = serde_yaml::Sequence::new();
+ for element in &entry.value.vec_incomingwsconfig_val {
+ seq.push(element.to_yaml_map());
+ }
+ serde_yaml::Value::Sequence(seq)
+ }
other => serde_yaml::Value::String(
"map_to_yaml_string: Unknown type: ".to_owned() + other,
),
static Answer doGetParameter(ArgIterator begin, ArgIterator end)
{
- std::stringstream ret;
+ if (!g_yamlSettings) {
+ std::stringstream ret;
- for (auto i = begin; i != end; ++i) {
- if (::arg().parmIsset(*i)) {
- const auto& parm = arg()[*i];
- ret << *i << '=' << parm << endl;
- }
- else {
- ret << *i << " not known" << endl;
+ for (auto i = begin; i != end; ++i) {
+ if (::arg().parmIsset(*i)) {
+ const auto& parm = arg()[*i];
+ ret << *i << '=' << parm << endl;
+ }
+ else {
+ ret << *i << " not known" << endl;
+ }
}
+ return {0, ret.str()};
}
- return {0, ret.str()};
+ auto settings = g_yamlStruct.lock();
+ auto yaml = settings->to_yaml_string();
+ return {0, std::string(yaml)};
}
/* Read an (open) fd from the control channel */