]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Add missing pieces for for default printing
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Tue, 28 Oct 2025 11:18:15 +0000 (12:18 +0100)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Tue, 4 Nov 2025 12:40:38 +0000 (13:40 +0100)
Signed-off-by: Otto Moerbeek <otto.moerbeek@open-xchange.com>
pdns/recursordist/rec-rust-lib/cxxsupport.cc
pdns/recursordist/rec-rust-lib/generate.py
pdns/recursordist/rec-rust-lib/rust-bridge-in.rs
pdns/recursordist/rec-rust-lib/rust/src/bridge.rs
pdns/recursordist/rec_channel_rec.cc

index cfe7a7dfafc1d1c95454f7bd201020cda2789efb..02117358587a84ab842781eb0e18558589d0816c 100644 (file)
@@ -546,7 +546,7 @@ static void processLine(const std::string& arg, FieldMap& map, bool mainFile)
   ::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}});
@@ -677,6 +677,8 @@ std::string pdns::settings::rec::defaultsToYaml()
   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.
index 902c344fd67e07e4d157f6aff221b0ef2226b1e3..e0afd990954ce3017371bdd3b17caa937f3387ec 100644 (file)
@@ -313,7 +313,7 @@ def gen_cxx_oldstylesettingstobridgestruct(file, entries):
         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')
 
@@ -367,7 +367,7 @@ def gen_cxx_oldkvtobridgestruct(file, entries):
             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')
 
index b1e8a2214b7767f5a0d170ea22ecbac96fa44001..abe35bdd8be4dd879cdd4f482c0a343490e43544 100644 (file)
@@ -371,6 +371,8 @@ struct Value {
     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 {
index 95b8b43a5604ed535ea51d62fbc210c02c84c0da..89dd401ee07627335c3dff737199724a593961d3 100644 (file)
@@ -767,6 +767,13 @@ impl ForwardingCatalogZone {
 }
 
 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(())
@@ -774,6 +781,13 @@ impl IncomingWSConfig {
 }
 
 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);
@@ -1021,6 +1035,20 @@ pub fn map_to_yaml_string(vec: &Vec<OldStyle>) -> Result<String, serde_yaml::Err
                         }
                         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,
                     ),
index 51782812cc217d06cbda735a3d1f049e707e7fbf..c235fd6535bab2d9a92ef8fd7e655b8c8f35f37f 100644 (file)
@@ -297,18 +297,23 @@ static Answer doGet(ArgIterator begin, ArgIterator end)
 
 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 */