yumapro  24.10-1
YumaPro SDK
Loading...
Searching...
No Matches
yang_patch.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2012 - 2021, YumaWorks, Inc., All Rights Reserved.
3 *
4 * Unless required by applicable law or agreed to in writing,
5 * software distributed under the License is distributed on an
6 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
7 * KIND, either express or implied. See the License for the
8 * specific language governing permissions and limitations
9 * under the License.
10 */
11#ifndef _H_yang_patch
12#define _H_yang_patch
13
14/* FILE: yang_patch.h
15*********************************************************************
16* *
17* P U R P O S E *
18* *
19*********************************************************************/
20
29/*********************************************************************
30* *
31* C H A N G E H I S T O R Y *
32* *
33*********************************************************************
34
35date init comment
36----------------------------------------------------------------------
3716-nov-14 abb Begun
38
39*/
40
41#include <xmlstring.h>
42
43#ifndef _H_dlq
44#include "dlq.h"
45#endif
46
47#ifndef _H_obj
48#include "obj.h"
49#endif
50
51#ifndef _H_op
52#include "op.h"
53#endif
54
55#ifndef _H_status
56#include "status.h"
57#endif
58
59#ifndef _H_val
60#include "val.h"
61#endif
62
63#ifdef __cplusplus
64extern "C" {
65#endif
66
67
68#define YANG_PATCH_DEF_SKIP_SIL TRUE
69
70
71/********************************************************************
72* *
73* T Y P E S *
74* *
75*********************************************************************/
76
87typedef enum yang_patch_op_t_ {
97
98
100typedef enum yang_patch_edit_type_t_ {
105
106
108typedef enum yang_patch_where_t_ {
115
116
118typedef struct yang_patch_edit_t_ {
120 dlq_hdr_t qhdr;
121
123 xmlChar *edit_id;
124
127
129 xmlChar *target;
130
132 xmlChar *point;
133
136
139
144
147
149 boolean lastedit;
150
152
153
155typedef struct yang_patch_cb_t_ {
157 dlq_hdr_t qhdr;
158
160 xmlChar *patch_id;
161
164
166 boolean skip_sil;
167
169 xmlChar *comment;
170
178 xmlChar *target;
179
181 dlq_hdr_t editQ;
183
184
185
186/********************************************************************
187* *
188* F U N C T I O N S *
189* *
190*********************************************************************/
191
192
198extern status_t
199 yang_patch_init (void);
200
201
206extern void
207 yang_patch_cleanup (void);
208
209
219extern yang_patch_cb_t *
220 yang_patch_new_cb (const xmlChar *patch_id,
221 const xmlChar *the_comment,
222 const xmlChar *target);
223
224
230extern void
232
233
239extern void
241
242
256extern yang_patch_edit_t *
257 yang_patch_new_edit (const xmlChar *edit_id,
258 yang_patch_op_t operation,
259 const xmlChar *target,
260 const xmlChar *point,
261 yang_patch_where_t insert_where,
262 val_value_t *value);
263
264
280extern yang_patch_edit_t *
281 yang_patch_new_edit2 (const xmlChar *edit_id,
282 yang_patch_op_t operation,
283 const xmlChar *target,
284 const xmlChar *point,
285 yang_patch_where_t insert_where,
286 val_value_t *value,
287 boolean plain_clone);
288
289
296extern void
298 yang_patch_edit_t *edit);
299
300
308extern yang_patch_edit_t *
310 const xmlChar *edit_id);
311
312
319extern uint32
321
322
330extern yang_patch_op_t
331 yang_patch_str_to_op (const xmlChar *opstr);
332
333
341extern const xmlChar *
343
344
353 yang_patch_str_to_edit_type (const xmlChar *str);
354
355
363extern const xmlChar *
365
366
375 yang_patch_str_to_where (const xmlChar *wherestr);
376
377
385extern const xmlChar *
387
388
399extern val_value_t *
401 yang_patch_edit_t *edit,
402 status_t *res);
403
404
415extern val_value_t *
417 yang_patch_cb_t *pcb,
418 status_t *res);
419
420
434extern yang_patch_edit_t *
436 boolean preserve_editval,
437 status_t *res);
438
439
454extern yang_patch_cb_t *
456 const xmlChar *target,
457 boolean preserve_patchval,
458 status_t *res);
459
460
471extern op_editop_t
473 boolean *is_insert);
474
475
485extern yang_patch_op_t
487
488
496extern void
498
499
503#ifdef __cplusplus
504} /* end extern 'C' */
505#endif
506
507#endif /* _H_yang_patch */
dlq provides general double-linked list and queue support:
op_editop_t
NETCONF edit-config operation types.
Definition: op.h:122
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.
Definition: yang_patch.c:254
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.
Definition: yang_patch.c:1219
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.
Definition: yang_patch.c:525
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.
Definition: yang_patch.c:695
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.
Definition: yang_patch.c:1074
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.
Definition: yang_patch.c:1170
void yang_patch_cleanup(void)
Cleanup the yang_patch module.
Definition: yang_patch.c:140
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.
Definition: yang_patch.c:161
void yang_patch_free_edit(yang_patch_edit_t *edit)
Free a YANG Patch edit control block.
Definition: yang_patch.c:366
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.
Definition: yang_patch.c:862
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.
Definition: yang_patch.c:951
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.
Definition: yang_patch.c:624
status_t yang_patch_init(void)
Load the ietf-yang-patch module.
Definition: yang_patch.c:119
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.
Definition: yang_patch.c:660
yang_patch_where_t
YANG Patch insert location.
Definition: yang_patch.h:108
void yang_patch_free_cb(yang_patch_cb_t *pcb)
Free a YANG Patch control block.
Definition: yang_patch.c:213
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.
Definition: yang_patch.c:596
void yang_patch_dump_pcb(yang_patch_cb_t *pcb)
Dump the current Patch Control block with all the edits.
Definition: yang_patch.c:1264
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.
Definition: yang_patch.c:472
yang_patch_edit_type_t
Internal edit type for access control and DB-API support.
Definition: yang_patch.h:100
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.
Definition: yang_patch.c:563
yang_patch_op_t
YANG Patch operation type.
Definition: yang_patch.h:87
uint32 yang_patch_edit_count(yang_patch_cb_t *pcb)
Get the number of edits in the PCB.
Definition: yang_patch.c:447
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.
Definition: yang_patch.c:416
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.
Definition: yang_patch.c:292
void yang_patch_add_edit(yang_patch_cb_t *pcb, yang_patch_edit_t *edit)
Malloc and add new YANG Patch edit control block.
Definition: yang_patch.c:392
@ YANG_PATCH_WHERE_FIRST
insert first
Definition: yang_patch.h:112
@ YANG_PATCH_WHERE_NONE
not set
Definition: yang_patch.h:109
@ YANG_PATCH_WHERE_AFTER
insert after foo
Definition: yang_patch.h:111
@ YANG_PATCH_WHERE_BEFORE
insert before foo
Definition: yang_patch.h:110
@ YANG_PATCH_WHERE_LAST
insert lsat (default)
Definition: yang_patch.h:113
@ YANG_PATCH_EDIT_TYPE_USER
edit by user
Definition: yang_patch.h:102
@ YANG_PATCH_EDIT_TYPE_SYSTEM
edit by system
Definition: yang_patch.h:103
@ YANG_PATCH_EDIT_TYPE_NONE
not set
Definition: yang_patch.h:101
@ YANG_PATCH_OP_REMOVE
remove
Definition: yang_patch.h:95
@ YANG_PATCH_OP_MERGE
merge
Definition: yang_patch.h:92
@ YANG_PATCH_OP_INSERT
insert
Definition: yang_patch.h:91
@ YANG_PATCH_OP_CREATE
create
Definition: yang_patch.h:89
@ YANG_PATCH_OP_DELETE
delete
Definition: yang_patch.h:90
@ YANG_PATCH_OP_REPLACE
replace
Definition: yang_patch.h:94
@ YANG_PATCH_OP_MOVE
move
Definition: yang_patch.h:93
@ YANG_PATCH_OP_NONE
not set
Definition: yang_patch.h:88
status_t
global error return code
Definition: status_enum.h:210
Data Object Support.
NETCONF protocol operations.
Global error messages for status code enumerations.
One YANG data-def-stmt.
Definition: obj.h:1229
one value to match one type
Definition: val.h:912
One YANG Patch Request.
Definition: yang_patch.h:155
yang_patch_edit_type_t edit_type
edit type (user or system)
Definition: yang_patch.h:163
boolean skip_sil
skip SIL callback; used by DB-API to control edit in main server
Definition: yang_patch.h:166
xmlChar * target
In case of HA and NETCONF this 'target' uses the datastore root '/' as the target resource and use th...
Definition: yang_patch.h:178
dlq_hdr_t editQ
Parsed edits: Q of yang_patch_edit_t.
Definition: yang_patch.h:181
dlq_hdr_t qhdr
in case used in Queue of patches
Definition: yang_patch.h:157
xmlChar * comment
comment provided for this patch
Definition: yang_patch.h:169
xmlChar * patch_id
patch ID is usually the transaction-id
Definition: yang_patch.h:160
Represents one YANG Patch edit entry.
Definition: yang_patch.h:118
xmlChar * edit_id
edit identifier string from request
Definition: yang_patch.h:123
xmlChar * point
point parameter for insert from request
Definition: yang_patch.h:132
xmlChar * target
data path target from request
Definition: yang_patch.h:129
yang_patch_op_t operation
edit operation from request
Definition: yang_patch.h:126
dlq_hdr_t qhdr
queue header
Definition: yang_patch.h:120
val_value_t * value
edit value from request (not provided for delete)
Definition: yang_patch.h:138
yang_patch_where_t insert_where
insert where parameter for insert from request
Definition: yang_patch.h:135
val_value_t * targval
REAL target value for the current EDIT.
Definition: yang_patch.h:146
boolean lastedit
flag for last edit
Definition: yang_patch.h:149
val_value_t * configval
the 'root' value struct that represents the tree of changes to apply to the target
Definition: yang_patch.h:143
Value Node Basic Support.