yumapro  20.10-12
YumaPro SDK
agt_val_rollback.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008 - 2012, Andy Bierman, All Rights Reserved.
3  * Copyright (c) 2012 - 2021 YumaWorks, Inc., All Rights Reserved.
4  *
5  * Unless required by applicable law or agreed to in writing,
6  * software distributed under the License is distributed on an
7  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8  * KIND, either express or implied. See the License for the
9  * specific language governing permissions and limitations
10  * under the License.
11  */
12 #ifndef _H_agt_val_rollback
13 #define _H_agt_val_rollback
14 
15 /* FILE: agt_val_rollback.h
16 *********************************************************************
17 * *
18 * P U R P O S E *
19 * *
20 *********************************************************************/
21 
29 /*********************************************************************
30 * *
31 * C H A N G E H I S T O R Y *
32 * *
33 *********************************************************************
34 
35 date init comment
36 ----------------------------------------------------------------------
37 19-dec-15 abb Begun; split from agt_val.c
38 */
39 
40 #ifndef _H_cfg
41 #include "cfg.h"
42 #endif
43 
44 #ifndef _H_rpc
45 #include "rpc.h"
46 #endif
47 
48 #ifndef _H_ses
49 #include "ses.h"
50 #endif
51 
52 #ifndef _H_status_enum
53 #include "status_enum.h"
54 #endif
55 
56 #ifdef __cplusplus
57 extern "C" {
58 #endif
59 
60 /********************************************************************
61 * *
62 * C O N S T A N T S *
63 * *
64 *********************************************************************/
65 
66 /********************************************************************
67 * *
68 * T Y P E S *
69 * *
70 *********************************************************************/
71 
72 /********************************************************************
73 * *
74 * F U N C T I O N S *
75 * *
76 *********************************************************************/
77 
78 /* Group defined in agt_val.h */
79 
101 extern status_t
102  agt_val_rollback_attempt_rollback (ses_cb_t *scb,
103  rpc_msg_t *msg,
104  cfg_template_t *target);
105 
109 #ifdef __cplusplus
110 } /* end extern 'C' */
111 #endif
112 
113 #endif /* _H_agt_val_rollback */
ses.h
NETCONF Session Common definitions module.
ERR_NCX_SKIPPED
@ ERR_NCX_SKIPPED
2001
Definition: status_enum.h:551
ncx_get_empty_npcon_presence
boolean ncx_get_empty_npcon_presence(void)
Get the empty_npcon_presence value.
Definition: ncx.c:13615
cfg.h
OP_EDITOP_CREATE
@ OP_EDITOP_CREATE
edit op is create
Definition: op.h:126
AGT_CFG_EDIT_ACTION_DELETE_DEFAULT
@ AGT_CFG_EDIT_ACTION_DELETE_DEFAULT
delete default edit action
Definition: agt_cfg.h:188
agt_util.h
Utility Functions for NCX Server method routines.
OP_EDITOP_REPLACE
@ OP_EDITOP_REPLACE
edit op is replace
Definition: op.h:125
tstamp.h
Timestamp utilities.
val_child_mark_default_undeleted
void val_child_mark_default_undeleted(val_value_t *val)
Mark all the leaf-list nodes that are defaults as deleted.
Definition: val_child.c:3570
OP_EDITOP_NONE
@ OP_EDITOP_NONE
not set
Definition: op.h:123
AGT_CFG_EDIT_ACTION_SET
@ AGT_CFG_EDIT_ACTION_SET
set edit action
Definition: agt_cfg.h:176
obj_is_terminal
boolean obj_is_terminal(const obj_template_t *obj)
Check if object is a proper leaf or leaflist or anyxml.
Definition: obj.c:13493
log_error
void log_error(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_ERROR log entry.
obj_is_leaf_list
boolean obj_is_leaf_list(const obj_template_t *obj)
Check if object is a proper leaf-list.
Definition: obj.c:13336
val.h
Value Node Basic Support.
agt_cfg_restore_newnode
void agt_cfg_restore_newnode(agt_cfg_undo_rec_t *undo)
Swap the newnode and newnode_pointers.
Definition: agt_cfg.c:2782
status_enum.h
global error status code enumerations
ncx_use_xpath_backptrs
boolean ncx_use_xpath_backptrs(void)
Check if it is OK to use XPath back pointers or not.
Definition: ncx.c:11335
val_swap_child
void val_swap_child(val_value_t *newchild, val_value_t *curchild)
Swap a child value node with a current value node.
Definition: val.c:8334
obj_in_edit2_mode
boolean obj_in_edit2_mode(obj_template_t *obj)
Check if the object is an edit2 container or list or terminal node child in an edit2 container or lis...
Definition: obj.c:17260
log_debug3
void void void void void void void void void void void log_debug3(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_DEBUG3 log entry.
AGT_CFG_EDIT_ACTION_NONE
@ AGT_CFG_EDIT_ACTION_NONE
not set
Definition: agt_cfg.h:170
val_get_mod_name
const xmlChar * val_get_mod_name(const val_value_t *val)
Get the module name associated with this value node.
Definition: val.c:12223
AGT_CFG_EDIT_ACTION_REPLACE
@ AGT_CFG_EDIT_ACTION_REPLACE
replace edit action
Definition: agt_cfg.h:182
AGT_CFG_EDIT_ACTION_ADD
@ AGT_CFG_EDIT_ACTION_ADD
add edit action
Definition: agt_cfg.h:173
obj_npcon_has_defaults_slow
boolean obj_npcon_has_defaults_slow(obj_template_t *obj)
Check if the specified NP container has defaults within it Must be a config object!...
Definition: obj.c:11776
AGT_CFG_EDIT_ACTION_MOVE
@ AGT_CFG_EDIT_ACTION_MOVE
move edit action
Definition: agt_cfg.h:179
ncx_next_backptr
ncx_backptr_t * ncx_next_backptr(ncx_backptr_t *curptr)
Get next back pointer struct.
Definition: ncx.c:11545
dlq_lastEntry
#define dlq_lastEntry(listP)
get the last entry in the queue list
Definition: dlq.h:352
op.h
NETCONF protocol operations.
VAL_NAME
#define VAL_NAME(V)
Access the value name.
Definition: val.h:399
ncxconst.h
Contains NCX constants.
agt_val_silcall_handle_remote_transaction
status_t agt_val_silcall_handle_remote_transaction(agt_cfg_transaction_t *txcb, ses_cb_t *scb, rpc_msg_t *msg, agt_cbtyp_t cbtyp, boolean is_reverse_edit)
Start a distributed transaction with the agt_sil module This function will not return until the entir...
Definition: agt_val_silcall.c:3299
agt_cb.h
NETCONF Server Data Model callback handler.
OP_EDITOP_MERGE
@ OP_EDITOP_MERGE
edit op is merge
Definition: op.h:124
log_info
void void void void void log_info(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_INFO log entry.
val_remove_child
void val_remove_child(val_value_t *child)
Remove a child value node from its parent value node.
Definition: val.c:8316
log_debug2
void void void void void void void void void log_debug2(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_DEBUG2 log entry.
agt_val.h
NETCONF Server database callback handler.
NO_ERR
@ NO_ERR
000
Definition: status_enum.h:188
xpath.h
Schema and data model Xpath search support.
xml_val.h
Utility functions for creating value structs.
agt_val_rollback.h
NETCONF Server database callback handler. Transaction Rollback Code.
log_debug4
void void void void void void void void void void void void void log_debug4(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_DEBUG4 log entry.
obj_get_name
const xmlChar * obj_get_name(const obj_template_t *obj)
Get the name field for this obj.
Definition: obj.c:10511
ERR_NCX_OPERATION_FAILED
@ ERR_NCX_OPERATION_FAILED
274
Definition: status_enum.h:315
agt_sil.h
SIL Transaction APIs.
LOGDEBUG2
#define LOGDEBUG2
Check if at least log-level=debug2.
Definition: log.h:292
OP_EDITOP_DELETE
@ OP_EDITOP_DELETE
edit op is delete
Definition: op.h:127
log_warn
void void void log_warn(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_WARN log entry.
ERR_INTERNAL_VAL
@ ERR_INTERNAL_VAL
004
Definition: status_enum.h:194
agt_cfg_use_child_undo
boolean agt_cfg_use_child_undo(agt_cfg_undo_rec_t *undo, agt_cfg_undo_rec_t *child_undo)
Check if the child edit node should be invoked.
Definition: agt_cfg.c:2811
val_util.h
Value Node Utilities.
agt_cfg_prev_active_undo
agt_cfg_undo_rec_t * agt_cfg_prev_active_undo(agt_cfg_transaction_t *txcb, agt_cfg_undo_rec_t *cur_undo)
Get the prev active undo record.
Definition: agt_cfg.c:3690
agt_cfg_last_active_child_undo
agt_cfg_undo_rec_t * agt_cfg_last_active_child_undo(agt_cfg_transaction_t *txcb, agt_cfg_undo_rec_t *parent_undo)
Get the last active child undo record.
Definition: agt_cfg.c:3783
VAL_UNMARK_DELETED
#define VAL_UNMARK_DELETED(V)
Unmark the value node as deleted.
Definition: val.h:539
AGT_CB_VALIDATE
@ AGT_CB_VALIDATE
P1: write operation validate.
Definition: agt.h:620
agt_val_silcall_invoke_raw
status_t agt_val_silcall_invoke_raw(ses_cb_t *scb, rpc_msg_t *msg, agt_cbtyp_t cbtyp, op_editop_t editop, val_value_t *newval, val_value_t *curval)
Call a SIL callback directly; used in rollback.
Definition: agt_val_silcall.c:3238
rpc.h
NETCONF protocol remote procedure call common definitions.
ERR_INTERNAL_MEM
@ ERR_INTERNAL_MEM
003
Definition: status_enum.h:193
agt_sil_end_transaction
void agt_sil_end_transaction(const xmlChar *txid_str)
End a transaction.
Definition: agt_sil.c:8322
val_clone
val_value_t * val_clone(const val_value_t *val)
Clone a specified val_value_t struct and sub-trees.
Definition: val.c:7836
val_child.h
Value Node Child Access Support.
get_error_string
const char * get_error_string(status_t res)
Get the error message for a specific internal error.
Definition: status.c:239
agt_cfg_last_active_undo
agt_cfg_undo_rec_t * agt_cfg_last_active_undo(agt_cfg_transaction_t *txcb)
Get the last active undo record.
Definition: agt_cfg.c:3656
log_debug
void void void void void void void log_debug(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_DEBUG log entry.
typ.h
Parameter Type Handler.
dlq_count
unsigned int dlq_count(const dlq_hdrT *listP)
get the number of queue entries in the listP queue list
Definition: dlq.c:994
NCX_CFGID_RUNNING
@ NCX_CFGID_RUNNING
running datastore (no value for not set!)
Definition: ncxtypes.h:384
yangconst.h
Contains YANG constants separated to prevent H file include loops.
dlq_prevEntry
#define dlq_prevEntry(nodeP)
get the previous queue entry before the current entry
Definition: dlq.h:280
agt.h
Multi-Protocol Network Management Server.
obj_is_np_container
boolean obj_is_np_container(const obj_template_t *obj)
Check if the object is an Non-Presence-container.
Definition: obj.c:14487
op_editop_name
const xmlChar * op_editop_name(op_editop_t ed_id)
Get the keyword for the specified op_editop_t enumeration.
Definition: op.c:106
ncx_first_backptr
ncx_backptr_t * ncx_first_backptr(dlq_hdr_t *que)
Get first back pointer struct.
Definition: ncx.c:11513
agt_val_silcall.h
NETCONF Server database callback handler. SIL callback code.
obj_get_mod_name
const xmlChar * obj_get_mod_name(const obj_template_t *obj)
Get the module name for this object.
Definition: obj.c:12176
typ_is_simple
boolean typ_is_simple(ncx_btype_t btyp)
Check if this is a simple data type.
Definition: typ.c:3107
OP_EDITOP_LOAD
@ OP_EDITOP_LOAD
load, internal enum
Definition: op.h:128
val_set_by_default
boolean val_set_by_default(const val_value_t *val)
Check if the value was set by val_add_defaults.
Definition: val.c:12571
LOGDEBUG4
#define LOGDEBUG4
Check if at least log-level=debug4.
Definition: log.h:302
log.h
NCX System Logging Manager.
ncx_remove_backptr
void ncx_remove_backptr(ncx_backptr_t *ptr)
Remove the specified backptr for deletion.
Definition: ncx.c:11592
LOGDEBUG
#define LOGDEBUG
Check if at least log-level=debug.
Definition: log.h:287
rpc_err.h
NETCONF protocol standard error definitions.
OP_EDITOP_REMOVE
@ OP_EDITOP_REMOVE
remove, base:1.1 only
Definition: op.h:130
agt_cfg.h
Manage Server configuration edit transactions.
dlq_empty
#define dlq_empty(listP)
check if queue list is empty
Definition: dlq.h:367
agt_cfg_prev_active_child_undo
agt_cfg_undo_rec_t * agt_cfg_prev_active_child_undo(agt_cfg_transaction_t *txcb, agt_cfg_undo_rec_t *cur_undo)
Get the prev active child undo record.
Definition: agt_cfg.c:3819
AGT_CB_ROLLBACK
@ AGT_CB_ROLLBACK
P3-neg: write operation rollback.
Definition: agt.h:623
agt_get_profile
agt_profile_t * agt_get_profile(void)
Get the server profile struct.
Definition: agt.c:4118
obj_npcon_has_defaults
boolean obj_npcon_has_defaults(obj_template_t *obj)
Check if the specified NP container has defaults within it Must be a config object!...
Definition: obj.c:11752
VAL_BTYPE
#define VAL_BTYPE(V)
Access the base type : same as VAL_TYPE.
Definition: val.h:548
ncx_get_backptr_node
void * ncx_get_backptr_node(ncx_backptr_t *backptr)
Get the back pointer node pointer.
Definition: ncx.c:11577
dlq_firstEntry
#define dlq_firstEntry(listP)
get the first entry in the queue list
Definition: dlq.h:337
VAL_OBJ
#define VAL_OBJ(V)
Access the object template.
Definition: val.h:381
obj_flag_xpath_backptrs_dirty
void obj_flag_xpath_backptrs_dirty(obj_template_t *obj, ncx_cfg_t cfg_id, boolean flag)
Check all the xpath backptr records for this object and set them to dirty or clean,...
Definition: obj.c:16539
ncx.h
YANG module utility functions.
obj.h
Data Object Support.
val_check_swap_resnode
void val_check_swap_resnode(val_value_t *curval, val_value_t *newval)
Maintain partial locks; Used by server only.
Definition: val_util.c:5894
AGT_CFG_EDIT_ACTION_DELETE
@ AGT_CFG_EDIT_ACTION_DELETE
delete edit action
Definition: agt_cfg.h:185
agt_val_rollback_attempt_rollback
status_t agt_val_rollback_attempt_rollback(ses_cb_t *scb, rpc_msg_t *msg, cfg_template_t *target)
Attempt to rollback a transaction attempt.
Definition: agt_val_rollback.c:913
CHK_EXIT
#define CHK_EXIT(res, retres)
used in parser routines to decide if processing can continue will exit the function if critical error...
Definition: yangconst.h:221
agt_val_silcall_has_subsys_callbacks
boolean agt_val_silcall_has_subsys_callbacks(agt_cfg_transaction_t *txcb)
Check if the transaction needs subsystem callbacks.
Definition: agt_val_silcall.c:2530
SET_ERROR
#define SET_ERROR(E)
macro SET_ERROR
Definition: status_enum.h:103
agt_val_silcall_reverse_edit
status_t agt_val_silcall_reverse_edit(agt_cfg_undo_rec_t *undo, ses_cb_t *scb, rpc_msg_t *msg, op_editop_t editop, val_value_t *newval, val_value_t *curval, boolean lookparent, boolean indelete, agt_cfg_edit_action_t edit_action)
Attempt SIL callbacks for a reverse edit.
Definition: agt_val_silcall.c:3080
ncx_free_backptr
void ncx_free_backptr(ncx_backptr_t *ptr)
Free an ncx_backptr_t struct.
Definition: ncx.c:11433
xmlns.h
XML namespace support.
val_free_value
void val_free_value(val_value_t *val)
Scrub the memory in a val_value_t by freeing all the sub-fields and then freeing the entire struct it...
Definition: val.c:2842
status.h
Global error messages for status code enumerations.
VAL_IS_DELETED
#define VAL_IS_DELETED(V)
Access the deleted flag.
Definition: val.h:533
dlq.h
dlq provides general double-linked list and queue support:
LOGDEBUG3
#define LOGDEBUG3
Check if at least log-level=debug3.
Definition: log.h:297