Skip to main content

lyd_parse_data

Function lyd_parse_data 

Source
pub unsafe extern "C" fn lyd_parse_data(
    ctx: *const ly_ctx,
    parent: *mut lyd_node,
    in_: *mut ly_in,
    format: Type,
    parse_options: u32,
    validate_options: u32,
    tree: *mut *mut lyd_node,
) -> Type
Expand description

@brief Parse (and validate) data from the input handler as a YANG data tree.

@param[in] ctx Context to connect with the tree being built here. @param[in] parent Optional parent to connect the parsed nodes to. If provided, the data are expected to describe a subtree of the YANG module instead of starting at the schema root. @param[in] in The input handle to provide the dumped data in the specified @p format to parse (and validate). @param[in] format Format of the input data to be parsed. Can be 0 to try to detect format from the input handler. @param[in] parse_options Options for parser, see @ref dataparseroptions. @param[in] validate_options Options for the validation phase, see @ref datavalidationoptions. @param[out] tree Full parsed data tree, note that NULL can be a valid tree. If @p parent is set, the first parsed child. @return LY_SUCCESS in case of successful parsing (and validation). @return LY_ERR value in case of error. Additional error information can be obtained from the context using ly_err* functions.

When parsing subtrees (i.e., when @p parent is non-NULL), validation is only performed on the newly parsed data. This might result in allowing invalid datastore content when the schema contains cross-branch constraints, complicated must statements, etc. When a full-datastore validation is desirable, parse all subtrees first, and then request validation of the complete datastore content.