yumapro  24.10-1
YumaPro SDK
Loading...
Searching...
No Matches
YANG Patch Media Type

YANG Patch Support (RFC 8072) More...

Collaboration diagram for YANG Patch Media Type:

Data Structures

struct  yang_patch_edit_t
 Represents one YANG Patch edit entry. More...
 
struct  yang_patch_cb_t
 One YANG Patch Request. More...
 

Enumerations

enum  yang_patch_op_t {
  YANG_PATCH_OP_NONE ,
  YANG_PATCH_OP_CREATE ,
  YANG_PATCH_OP_DELETE ,
  YANG_PATCH_OP_INSERT ,
  YANG_PATCH_OP_MERGE ,
  YANG_PATCH_OP_MOVE ,
  YANG_PATCH_OP_REPLACE ,
  YANG_PATCH_OP_REMOVE
}
 YANG Patch operation type. More...
 
enum  yang_patch_edit_type_t {
  YANG_PATCH_EDIT_TYPE_NONE ,
  YANG_PATCH_EDIT_TYPE_USER ,
  YANG_PATCH_EDIT_TYPE_SYSTEM
}
 Internal edit type for access control and DB-API support. More...
 
enum  yang_patch_where_t {
  YANG_PATCH_WHERE_NONE ,
  YANG_PATCH_WHERE_BEFORE ,
  YANG_PATCH_WHERE_AFTER ,
  YANG_PATCH_WHERE_FIRST ,
  YANG_PATCH_WHERE_LAST
}
 YANG Patch insert location. More...
 

Functions

status_t yang_patch_init (void)
 Load the ietf-yang-patch module. More...
 
void yang_patch_cleanup (void)
 Cleanup the yang_patch module. More...
 
yang_patch_cb_tyang_patch_new_cb (const xmlChar *patch_id, const xmlChar *the_comment, const xmlChar *target)
 Malloc a new YANG Patch control block. More...
 
void yang_patch_free_cb (yang_patch_cb_t *pcb)
 Free a YANG Patch control block. More...
 
void yang_patch_free_edit (yang_patch_edit_t *edit)
 Free a YANG Patch edit control block. More...
 
yang_patch_edit_tyang_patch_new_edit (const xmlChar *edit_id, yang_patch_op_t operation, const xmlChar *target, const xmlChar *point, yang_patch_where_t insert_where, val_value_t *value)
 Malloc a new YANG Patch edit control block Any of the fields can be NULL to add later or not use. More...
 
yang_patch_edit_tyang_patch_new_edit2 (const xmlChar *edit_id, yang_patch_op_t operation, const xmlChar *target, const xmlChar *point, yang_patch_where_t insert_where, val_value_t *value, boolean plain_clone)
 Malloc a new YANG Patch edit control block Any of the fields can be NULL to add later or not use. More...
 
void yang_patch_add_edit (yang_patch_cb_t *pcb, yang_patch_edit_t *edit)
 Malloc and add new YANG Patch edit control block. More...
 
yang_patch_edit_tyang_patch_find_edit (yang_patch_cb_t *pcb, const xmlChar *edit_id)
 Find an edit by its edit_id in the YANG Patch. More...
 
uint32 yang_patch_edit_count (yang_patch_cb_t *pcb)
 Get the number of edits in the PCB. More...
 
yang_patch_op_t yang_patch_str_to_op (const xmlChar *opstr)
 Convert a YANG Patch operation string to the operation enumeration for the string. More...
 
const xmlChar * yang_patch_op_to_str (yang_patch_op_t op)
 Convert a YANG Patch operation enum to the operation string for the enumeration. More...
 
yang_patch_edit_type_t yang_patch_str_to_edit_type (const xmlChar *str)
 Convert a YANG Patch edit-type string to the edit_type enumeration for the string. More...
 
const xmlChar * yang_patch_edit_type_to_str (yang_patch_edit_type_t typ)
 Convert a YANG Patch edit type enum to the string for the enumeration. More...
 
yang_patch_where_t yang_patch_str_to_where (const xmlChar *wherestr)
 Convert a YANG Patch where string to the where enumeration for the string. More...
 
const xmlChar * yang_patch_where_to_str (yang_patch_where_t wh)
 Convert a YANG Patch where enum to the where string for the enumeration. More...
 
val_value_tyang_patch_edit_to_value (obj_template_t *edit_obj, yang_patch_edit_t *edit, status_t *res)
 Convert a YANG Patch edit to a val_value_t tree. More...
 
val_value_tyang_patch_to_value (obj_template_t *patch_obj, yang_patch_cb_t *pcb, status_t *res)
 Convert a YANG Patch control block to a val_value_t tree. More...
 
yang_patch_edit_tyang_patch_value_to_edit (val_value_t *edit_val, boolean preserve_editval, status_t *res)
 Convert a val_value_t tree to a YANG Patch edit. More...
 
yang_patch_cb_tyang_patch_value_to_patch (val_value_t *patch_val, const xmlChar *target, boolean preserve_patchval, status_t *res)
 Convert a val_value tree to a YANG Patch control block. More...
 
op_editop_t yang_patch_op_to_editop (yang_patch_op_t op, boolean *is_insert)
 Convert a YANG Patch operation enum to the corresponding edit operation. More...
 
yang_patch_op_t yang_patch_editop_to_op (op_editop_t edit_op)
 Convert an edit operation enum to a YANG Patch operation enum. More...
 
void yang_patch_dump_pcb (yang_patch_cb_t *pcb)
 Dump the current Patch Control block with all the edits. More...
 

Detailed Description

YANG Patch Support (RFC 8072)

Enumeration Type Documentation

◆ yang_patch_edit_type_t

Internal edit type for access control and DB-API support.

Enumerator
YANG_PATCH_EDIT_TYPE_NONE 

not set

YANG_PATCH_EDIT_TYPE_USER 

edit by user

YANG_PATCH_EDIT_TYPE_SYSTEM 

edit by system

◆ yang_patch_op_t

YANG Patch operation type.

Enumerator
YANG_PATCH_OP_NONE 

not set

YANG_PATCH_OP_CREATE 

create

YANG_PATCH_OP_DELETE 

delete

YANG_PATCH_OP_INSERT 

insert

YANG_PATCH_OP_MERGE 

merge

YANG_PATCH_OP_MOVE 

move

YANG_PATCH_OP_REPLACE 

replace

YANG_PATCH_OP_REMOVE 

remove

◆ yang_patch_where_t

YANG Patch insert location.

Enumerator
YANG_PATCH_WHERE_NONE 

not set

YANG_PATCH_WHERE_BEFORE 

insert before foo

YANG_PATCH_WHERE_AFTER 

insert after foo

YANG_PATCH_WHERE_FIRST 

insert first

YANG_PATCH_WHERE_LAST 

insert lsat (default)

Function Documentation

◆ yang_patch_add_edit()

void yang_patch_add_edit ( yang_patch_cb_t pcb,
yang_patch_edit_t edit 
)

Malloc and add new YANG Patch edit control block.

Parameters
pcbpatch control block to add edit into
editedit to add
Here is the call graph for this function:
Here is the caller graph for this function:

◆ yang_patch_cleanup()

void yang_patch_cleanup ( void  )

Cleanup the yang_patch module.

Here is the caller graph for this function:

◆ yang_patch_dump_pcb()

void yang_patch_dump_pcb ( yang_patch_cb_t pcb)

Dump the current Patch Control block with all the edits.

Debug function

Parameters
pcbPatch control block
Here is the call graph for this function:

◆ yang_patch_edit_count()

uint32 yang_patch_edit_count ( yang_patch_cb_t pcb)

Get the number of edits in the PCB.

Parameters
pcbpatch control block to check
Returns
edit count
Here is the call graph for this function:
Here is the caller graph for this function:

◆ yang_patch_edit_to_value()

val_value_t * yang_patch_edit_to_value ( obj_template_t edit_obj,
yang_patch_edit_t edit,
status_t res 
)

Convert a YANG Patch edit to a val_value_t tree.

Parameters
edit_objobject template for the <edit> list
editYANG Patch edit to convert
[out]resaddress of return status
  • *res return status
Returns
converted edit to malloced val_value_t; must free with val_free_value
Here is the call graph for this function:
Here is the caller graph for this function:

◆ yang_patch_edit_type_to_str()

const xmlChar * yang_patch_edit_type_to_str ( yang_patch_edit_type_t  typ)

Convert a YANG Patch edit type enum to the string for the enumeration.

Parameters
typenum to convert
Returns
converted string or 'none' if none
Here is the caller graph for this function:

◆ yang_patch_editop_to_op()

yang_patch_op_t yang_patch_editop_to_op ( op_editop_t  edit_op)

Convert an edit operation enum to a YANG Patch operation enum.

This function does not handle insert and move since these are not NETCONF edit operations

Parameters
edit_openum to convert
Returns
converted enum 'none' if none

◆ yang_patch_find_edit()

yang_patch_edit_t * yang_patch_find_edit ( yang_patch_cb_t pcb,
const xmlChar *  edit_id 
)

Find an edit by its edit_id in the YANG Patch.

Parameters
pcbpatch control block to search
edit_idto find
Returns
found edit struct or NULL if not found
Here is the call graph for this function:
Here is the caller graph for this function:

◆ yang_patch_free_cb()

void yang_patch_free_cb ( yang_patch_cb_t pcb)

Free a YANG Patch control block.

Parameters
pcbYANG Patch control block to free
Here is the call graph for this function:
Here is the caller graph for this function:

◆ yang_patch_free_edit()

void yang_patch_free_edit ( yang_patch_edit_t edit)

Free a YANG Patch edit control block.

Parameters
editYANG Patch edit control block to free
Here is the call graph for this function:
Here is the caller graph for this function:

◆ yang_patch_init()

status_t yang_patch_init ( void  )

Load the ietf-yang-patch module.

Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ yang_patch_new_cb()

yang_patch_cb_t * yang_patch_new_cb ( const xmlChar *  patch_id,
const xmlChar *  the_comment,
const xmlChar *  target 
)

Malloc a new YANG Patch control block.

Parameters
patch_idpatch ID string (transaction-id)
the_commentuser comment for entire patch
targetunified datastore target resource for patch
Returns
malloced YANG Patch control block; must be freed later with yang_patch_free_cb
Here is the call graph for this function:
Here is the caller graph for this function:

◆ yang_patch_new_edit()

yang_patch_edit_t * yang_patch_new_edit ( const xmlChar *  edit_id,
yang_patch_op_t  operation,
const xmlChar *  target,
const xmlChar *  point,
yang_patch_where_t  insert_where,
val_value_t value 
)

Malloc a new YANG Patch edit control block Any of the fields can be NULL to add later or not use.

Parameters
edit_idedit ID string
operationYANG Patch operation
targetrelative offset to patch target
pointinsertion point if operation is insert of move
insert_whereinsertion type if operation is insert or move
valuethe value to use for the patch (if needed)
Returns
malloced YANG Patch control block; must be freed later with yang_patch_free_cb
Here is the call graph for this function:
Here is the caller graph for this function:

◆ yang_patch_new_edit2()

yang_patch_edit_t * yang_patch_new_edit2 ( const xmlChar *  edit_id,
yang_patch_op_t  operation,
const xmlChar *  target,
const xmlChar *  point,
yang_patch_where_t  insert_where,
val_value_t value,
boolean  plain_clone 
)

Malloc a new YANG Patch edit control block Any of the fields can be NULL to add later or not use.

Parameters
edit_idedit ID string
operationYANG Patch operation
targetrelative offset to patch target
pointinsertion point if operation is insert of move
insert_whereinsertion type if operation is insert or move
valuethe value to use for the patch (if needed)
plain_cloneTRUE to clone clompletely
FALSE to use clone_config_save
Returns
malloced YANG Patch control block; must be freed later with yang_patch_free_cb
Here is the call graph for this function:
Here is the caller graph for this function:

◆ yang_patch_op_to_editop()

op_editop_t yang_patch_op_to_editop ( yang_patch_op_t  op,
boolean *  is_insert 
)

Convert a YANG Patch operation enum to the corresponding edit operation.

Parameters
openum to convert
[out]is_insertaddress of return is_insert flag
  • *is_insert TRUE if some soft of insert operation; returned editio will be merge
Returns
converted enum 'none' if none
Here is the caller graph for this function:

◆ yang_patch_op_to_str()

const xmlChar * yang_patch_op_to_str ( yang_patch_op_t  op)

Convert a YANG Patch operation enum to the operation string for the enumeration.

Parameters
openum to convert
Returns
converted string or 'none' if none
Here is the caller graph for this function:

◆ yang_patch_str_to_edit_type()

yang_patch_edit_type_t yang_patch_str_to_edit_type ( const xmlChar *  str)

Convert a YANG Patch edit-type string to the edit_type enumeration for the string.

Parameters
strstring to convert
Returns
converted enum or 0 if none
Here is the call graph for this function:

◆ yang_patch_str_to_op()

yang_patch_op_t yang_patch_str_to_op ( const xmlChar *  opstr)

Convert a YANG Patch operation string to the operation enumeration for the string.

Parameters
opstrstring to convert
Returns
converted enum or 0 if none
Here is the call graph for this function:
Here is the caller graph for this function:

◆ yang_patch_str_to_where()

yang_patch_where_t yang_patch_str_to_where ( const xmlChar *  wherestr)

Convert a YANG Patch where string to the where enumeration for the string.

Parameters
wherestrstring to convert
Returns
converted enum or 0 if none
Here is the call graph for this function:
Here is the caller graph for this function:

◆ yang_patch_to_value()

val_value_t * yang_patch_to_value ( obj_template_t patch_obj,
yang_patch_cb_t pcb,
status_t res 
)

Convert a YANG Patch control block to a val_value_t tree.

Parameters
patch_objobject template for the <yang-patch> container
pcbYANG Patch control block to convert
[out]resaddress of return status
  • *res return status
Returns
converted patch to malloced val_value_t; must free with val_free_value
Here is the call graph for this function:
Here is the caller graph for this function:

◆ yang_patch_value_to_edit()

yang_patch_edit_t * yang_patch_value_to_edit ( val_value_t edit_val,
boolean  preserve_editval,
status_t res 
)

Convert a val_value_t tree to a YANG Patch edit.

Parameters
edit_valvalue node for the <edit> list
preserve_editvalTRUE to preserve the edit_val
FALSE to move memory from edit_val to value tree as needed You need to call val_free_value(edit_val) after this is done and not continue to use the edit_val value tree
[out]resaddress of return status
  • *res return status
Returns
converted edit to malloced yang_patch_edit_t must free with yang_patch_free_edit
Here is the call graph for this function:
Here is the caller graph for this function:

◆ yang_patch_value_to_patch()

yang_patch_cb_t * yang_patch_value_to_patch ( val_value_t patch_val,
const xmlChar *  target,
boolean  preserve_patchval,
status_t res 
)

Convert a val_value tree to a YANG Patch control block.

Parameters
patch_valvalue node for the <yang-patch> container
targetthe target resource string from outside the YANG patch
preserve_patchvalTRUE to preserve the patch_val
FALSE to move memory from patch_val to value tree as needed You need to call val_free_value(patch_val) after this is done and not continue to use the patch_val value tree
[out]resaddress of return status
  • *res return status
Returns
converted val_value_t to malloced yang_patch_cb_t must free with yang_patch_free_cb
Here is the call graph for this function:

◆ yang_patch_where_to_str()

const xmlChar * yang_patch_where_to_str ( yang_patch_where_t  wh)

Convert a YANG Patch where enum to the where string for the enumeration.

Parameters
whenum to convert
Returns
converted string or 'none' if none
Here is the caller graph for this function: