diff --git a/rust/src/conf.rs b/rust/src/conf.rs index 0dae7a013a..6980cd0f29 100644 --- a/rust/src/conf.rs +++ b/rust/src/conf.rs @@ -35,6 +35,22 @@ extern { vptr: *mut *const c_char) -> i8; fn ConfGetChildValueBool(conf: *const c_void, key: *const c_char, vptr: *mut c_int) -> i8; + fn ConfGetNode(key: *const c_char) -> *const c_void; +} + +pub fn conf_get_node(key: &str) -> Option { + let key = if let Ok(key) = CString::new(key) { + key + } else { + return None; + }; + + let node = unsafe { ConfGetNode(key.as_ptr()) }; + if node.is_null() { + None + } else { + Some(ConfNode::wrap(node)) + } } // Return the string value of a configuration value.