Skip to main content

lyd_new_path2

Function lyd_new_path2 

Source
pub unsafe extern "C" fn lyd_new_path2(
    parent: *mut lyd_node,
    ctx: *const ly_ctx,
    path: *const c_char,
    value: *const c_void,
    value_size_bits: u64,
    any_hints: u32,
    options: u32,
    new_parent: *mut *mut lyd_node,
    new_node: *mut *mut lyd_node,
) -> Type
Expand description

@brief Create a new node in the data tree based on a path. All node types can be created.

Details are mentioned in ::lyd_new_path().

@param[in] parent Data parent to add to/modify, can be NULL. Note that in case a first top-level sibling is used, it may no longer be first if @p path is absolute and starts with a non-existing top-level node inserted before @p parent. Use ::lyd_first_sibling() to adjust @p parent in these cases. @param[in] ctx libyang context, must be set if @p parent is NULL. @param[in] path [Path](@ref howtoXPath) to create. @param[in] value Value of the new leaf/leaf-list. If creating an anyxml/anydata node, a string value is expected but can be a data tree based on @p options. For other node types, it should be NULL. @param[in] value_size_bits Size of @p value in bits. Does not have to be set if a 0-terminated string and XML or JSON value format. Ignored when creating anyxml/anydata nodes. @param[in] any_hints Hints for @p value when creating an anyxml/anydata node. Bitmap of [val hints](@ref lydvalhints) and [node hints](@ref lydnodehints). @param[in] options Bitmask of options, see @ref newvaloptions. @param[out] new_parent Optional first parent node created. If only one node was created, equals to @p new_node. @param[out] new_node Optional target node of @p path (the last created node, the list instance in case of a list). @return LY_SUCCESS on success. @return LY_EEXIST if the final node to create exists (unless ::LYD_NEW_PATH_UPDATE is used). @return LY_EINVAL on invalid arguments including invalid @p path. @return LY_EVALID on invalid @p value. @return LY_ERR on other errors.