yumapro  20.10-14
YumaPro SDK
agt_sil.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 #ifdef WITH_YCONTROL
13 #ifndef _H_agt_sil
14 #define _H_agt_sil
15 
16 /* FILE: agt_sil.h
17 *********************************************************************
18 * *
19 * P U R P O S E *
20 * *
21 *********************************************************************/
22 
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 18-feb-14 abb Begun
38 */
39 
40 #ifndef _H_agt
41 #include "agt.h"
42 #endif
43 
44 #ifndef _H_agt_cfg
45 #include "agt_cfg.h"
46 #endif
47 
48 #ifndef _H_ncxtypes
49 #include "ncxtypes.h"
50 #endif
51 
52 #ifndef _H_dlq
53 #include "dlq.h"
54 #endif
55 
56 #ifndef _H_getcb
57 #include "getcb.h"
58 #endif
59 
60 #ifndef _H_status
61 #include "status.h"
62 #endif
63 
64 #ifdef __cplusplus
65 extern "C" {
66 #endif
67 
80 /********************************************************************
81 * *
82 * C O N S T A N T S *
83 * *
84 *********************************************************************/
85 
86 /********************************************************************
87 * *
88 * T Y P E S *
89 * *
90 *********************************************************************/
91 
93 typedef struct agt_sil_added_edit_t_ {
95  dlq_hdr_t qhdr;
96 
98  xmlChar *path;
99 
102 
104  xmlChar *editop;
105 
107  xmlChar *where;
108 
110  xmlChar *point;
111 
113  boolean skipcb;
114 } YPACK agt_sil_added_edit_t;
115 
116 
126 typedef void
128  const xmlChar *subsys_id,
129  status_t get_status,
130  val_value_t *return_val);
131 
132 
143 typedef status_t
144  (*agt_sil_rpc_walker_fn_t) (const xmlChar *subsys_id,
145  status_t rpc_status,
146  val_value_t *return_val,
147  dlq_hdr_t *saveQ);
148 
149 
165 typedef status_t
167  rpc_msg_t *msg,
168  agt_cfg_transaction_t *txcb,
169  const xmlChar *subsys_id,
170  status_t tx_status,
171  dlq_hdr_t *edded_editQ);
172 
173 
174 
175 /********************************************************************
176 * *
177 * F U N C T I O N S *
178 * *
179 *********************************************************************/
180 
181 
187 extern status_t
188  agt_sil_init (void);
189 
190 
196 extern void
197  agt_sil_cleanup (void);
198 
199 
221 extern status_t
222  agt_sil_start_transaction (const xmlChar *txid_str,
223  const xmlChar *user_id,
224  const xmlChar *client_addr,
225  const xmlChar *target,
226  boolean is_validate,
227  boolean is_replay,
228  boolean is_reverse_edit,
229  boolean is_load_config,
230  boolean is_hook_load,
231  boolean is_hook_validate,
232  dlq_hdr_t *editQ);
233 
234 
249 extern status_t
250  agt_sil_continue_start_transaction (const xmlChar *txid_str,
251  const xmlChar *user_id,
252  const xmlChar *client_addr,
253  const xmlChar *target,
254  boolean is_replay,
255  dlq_hdr_t *editQ);
256 
257 
265 extern status_t
266  agt_sil_continue_transaction (const xmlChar *txid_str,
267  agt_cbtyp_t cur_phase);
268 
269 
275 extern void
276  agt_sil_end_transaction (const xmlChar *txid_str);
277 
278 
286 extern void
287  agt_sil_cancel_transaction (const xmlChar *txid_str);
288 
289 
304 extern status_t
305  agt_sil_phase_status (const xmlChar *txid_str,
306  val_value_t **error_val,
307  xmlChar **error_path);
308 
309 
320 extern status_t
321  agt_sil_send_load_event (const xmlChar *name,
322  boolean is_bundle,
323  boolean is_load);
324 
325 
336 extern status_t
337  agt_sil_send_stream_callback_event (const xmlChar *subsys_id,
338  const xmlChar *modname,
339  const xmlChar *stream_name,
340  boolean all_streams,
341  agt_not_subevent_t subevent);
342 
343 
349 extern boolean
351 
352 
358 extern void
360 
361 
362 
373 extern status_t
375  getcb_get2_t *get2cb,
376  xml_msg_hdr_t *msg,
377  const xmlChar **txid_str);
378 
379 
388 extern status_t
389  agt_sil_get_transaction_status (const xmlChar *txid_str);
390 
391 
401 extern void
402  agt_sil_walk_get_results (const xmlChar *txid_str,
403  agt_sil_get_walker_fn_t get_walker_fn);
404 
405 
417 extern status_t
418  agt_sil_walk_rpc_results (const xmlChar *txid_str,
419  agt_sil_rpc_walker_fn_t rpc_walker_fn,
420  dlq_hdr_t *saveQ);
421 
422 
436 extern status_t
438  rpc_msg_t *msg,
439  agt_cfg_transaction_t *txcb,
440  const xmlChar *txid_str,
441  agt_sil_shook_walker_fn_t shook_walker_fn);
442 
443 
449 extern void
450  agt_sil_end_get_transaction (const xmlChar *txid_str);
451 
452 
458 extern void
459  agt_sil_set_subsys_timeout (uint32 val);
460 
461 
473 extern status_t
475  rpc_msg_t *msg,
476  obj_template_t *obj,
477  val_value_t *actionval,
478  const xmlChar **txid_str);
479 
480 
489 extern status_t
490  agt_sil_rpc_transaction_status (const xmlChar *txid_str);
491 
492 
498 extern void
499  agt_sil_end_rpc_transaction (const xmlChar *txid_str);
500 
501 
512 extern status_t
514  const xmlChar *client_txid,
515  boolean isvalidate,
516  boolean isrollback,
517  boolean isrunning);
518 
519 
525 extern status_t
526  agt_sil_transaction_complete_cb (const xmlChar *txid_str);
527 
528 
552 extern status_t
553  agt_sil_get_exit_mode (const xmlChar *txid_str,
554  agt_tx_type_t tx_type,
555  val_value_t **error_val,
556  xmlChar **error_path);
557 
558 
574 extern boolean
575  agt_sil_last_in_transaction (const xmlChar *txid_str,
576  ses_id_t sid);
577 
578 
585 extern void
586  agt_sil_unload_module (const xmlChar *modname);
587 
588 
596 extern status_t
597  agt_sil_bundle_walker (const xmlChar *name,
598  void *cookie);
599 
600 
608 extern status_t
609  agt_sil_module_walker (const xmlChar *name,
610  void *cookie);
611 
615 #ifdef __cplusplus
616 } /* end extern 'C' */
617 #endif
618 
619 #endif /* _H_agt_sil */
620 #endif // WITH_YCONTROL
status_t agt_sil_get_transaction_status(const xmlChar *txid_str)
Get the GET2 transaction status.
Definition: agt_sil.c:9002
status_t agt_sil_continue_transaction(const xmlChar *txid_str, agt_cbtyp_t cur_phase)
Continue a transaction to apply or commit phase.
Definition: agt_sil.c:8217
dlq provides general double-linked list and queue support:
Common Encoding Message Header No longer XML specific!! Used by JSON parsing as well!! Allows common ...
Definition: xml_msg.h:351
void(* agt_sil_get_walker_fn_t)(getcb_get2_t *get2cb, const xmlChar *subsys_id, status_t get_status, val_value_t *return_val)
get walker function for processing results from remote GET transaction from 1 or more subsystems ...
Definition: agt_sil.h:127
status_t agt_sil_walk_shook_results(ses_cb_t *scb, rpc_msg_t *msg, agt_cfg_transaction_t *txcb, const xmlChar *txid_str, agt_sil_shook_walker_fn_t shook_walker_fn)
Walk the Set Hook results.
Definition: agt_sil.c:9142
NETCONF Server and Client RPC Request/Reply Message Header.
Definition: rpc.h:181
void agt_sil_cleanup(void)
Cleanup the SIL Features Module.
Definition: agt_sil.c:7727
void agt_sil_check_deleted_edits(agt_cfg_transaction_t *txcb)
Check for deleted edits.
Definition: agt_sil.c:8723
status_t agt_sil_walk_rpc_results(const xmlChar *txid_str, agt_sil_rpc_walker_fn_t rpc_walker_fn, dlq_hdr_t *saveQ)
Walk the RPC transaction results.
Definition: agt_sil.c:9081
agt_tx_type_t
YControl transaction type.
Definition: agt.h:663
One YANG data-def-stmt.
Definition: obj.h:1057
boolean skipcb
skip callback flag
Definition: agt_sil.h:113
status_t(* agt_sil_rpc_walker_fn_t)(const xmlChar *subsys_id, status_t rpc_status, val_value_t *return_val, dlq_hdr_t *saveQ)
RPC walker function for processing results from remote GET transaction from 1 or more subsystems...
Definition: agt_sil.h:144
void agt_sil_walk_get_results(const xmlChar *txid_str, agt_sil_get_walker_fn_t get_walker_fn)
Walk the GET2 results.
Definition: agt_sil.c:9033
agt_not_subevent_t
event-stream sub-event types
Definition: agt_not.h:127
void agt_sil_end_rpc_transaction(const xmlChar *txid_str)
End an RPC transaction.
Definition: agt_sil.c:9499
status_t agt_sil_phase_status(const xmlChar *txid_str, val_value_t **error_val, xmlChar **error_path)
Get SIL Phase status.
Definition: agt_sil.c:8385
uint32 ses_id_t
Session ID.
Definition: ses.h:306
Transaction Control Block.
Definition: agt_cfg.h:224
boolean agt_sil_edit_transaction_in_progress(void)
Check if a SIL-SA transaction is in progress.
Definition: agt_sil.c:8707
void agt_sil_end_transaction(const xmlChar *txid_str)
End a transaction.
Definition: agt_sil.c:8340
status_t agt_sil_bundle_walker(const xmlChar *name, void *cookie)
Callback for bundles.
Definition: agt_sil.c:9870
status_t agt_sil_start_rpc_transaction(ses_cb_t *client_scb, rpc_msg_t *msg, obj_template_t *obj, val_value_t *actionval, const xmlChar **txid_str)
Start an RPC transaction.
Definition: agt_sil.c:9251
YANG module data structures Many internal representations of YANG module constructs.
xmlChar * editop
edit operation string
Definition: agt_sil.h:104
xmlChar * point
point parameter string
Definition: agt_sil.h:110
Manage Server configuration edit transactions.
void agt_sil_set_subsys_timeout(uint32 val)
Set the subsys-timeout parameter.
Definition: agt_sil.c:9224
status_t agt_sil_continue_start_transaction(const xmlChar *txid_str, const xmlChar *user_id, const xmlChar *client_addr, const xmlChar *target, boolean is_replay, dlq_hdr_t *editQ)
Continue already existed Start Transaction.
Definition: agt_sil.c:8002
status_t agt_sil_module_walker(const xmlChar *name, void *cookie)
Callback for dynamically loaded modules.
Definition: agt_sil.c:9910
status_t(* agt_sil_shook_walker_fn_t)(ses_cb_t *scb, rpc_msg_t *msg, agt_cfg_transaction_t *txcb, const xmlChar *subsys_id, status_t tx_status, dlq_hdr_t *edded_editQ)
Set Hook walker function.
Definition: agt_sil.h:166
one value to match one type
Definition: val.h:860
status_t agt_sil_init(void)
Initialize the SIL features module (phase 2)
Definition: agt_sil.c:7673
boolean agt_sil_last_in_transaction(const xmlChar *txid_str, ses_id_t sid)
Check if the session is the last in the current transaction.
Definition: agt_sil.c:9749
Session Control Block.
Definition: ses.h:542
xmlChar * path
absolute path for the editval
Definition: agt_sil.h:98
status_t
global error return code
Definition: status_enum.h:186
val_value_t * editval
edit value being added
Definition: agt_sil.h:101
Multi-Protocol Network Management Server.
xmlChar * where
where parameter string
Definition: agt_sil.h:107
void agt_sil_cancel_transaction(const xmlChar *txid_str)
Cancel and delete the transaction.
Definition: agt_sil.c:8359
status_t agt_sil_transaction_complete_cb(const xmlChar *txid_str)
SIL transaction complete callback.
Definition: agt_sil.c:9516
status_t agt_sil_start_get_transaction(ses_cb_t *client_scb, getcb_get2_t *get2cb, xml_msg_hdr_t *msg, const xmlChar **txid_str)
Start a GET2 transaction.
Definition: agt_sil.c:8771
Global error messages for status code enumerations.
void agt_sil_end_get_transaction(const xmlChar *txid_str)
End a GET2 transaction.
Definition: agt_sil.c:9206
status_t agt_sil_get_exit_mode(const xmlChar *txid_str, agt_tx_type_t tx_type, val_value_t **error_val, xmlChar **error_path)
Get the transaction exit code.
Definition: agt_sil.c:9593
status_t agt_sil_send_load_event(const xmlChar *name, boolean is_bundle, boolean is_load)
Send a <load-event> to all subsystems.
Definition: agt_sil.c:8447
status_t agt_sil_rpc_transaction_status(const xmlChar *txid_str)
Get RPC transaction status.
Definition: agt_sil.c:9470
status_t agt_sil_start_transaction(const xmlChar *txid_str, const xmlChar *user_id, const xmlChar *client_addr, const xmlChar *target, boolean is_validate, boolean is_replay, boolean is_reverse_edit, boolean is_load_config, boolean is_hook_load, boolean is_hook_validate, dlq_hdr_t *editQ)
Start Transaction Handler.
Definition: agt_sil.c:7800
void agt_sil_unload_module(const xmlChar *modname)
Unload a module from the subsystem register messages so the cleanup is not attempted again during sys...
Definition: agt_sil.c:9845
status_t agt_sil_handle_remote_trans_start(ses_cb_t *client_scb, const xmlChar *client_txid, boolean isvalidate, boolean isrollback, boolean isrunning)
Handle a remote transaction.
Definition: agt_sil.c:9658
agt_cbtyp_t
enumeration of the different server EDIT callback types These are used as array indices so there is n...
Definition: agt.h:619
Set Hook added edits from subsystem(s)
Definition: agt_sil.h:93
GET2 control block.
Definition: getcb.h:339
status_t agt_sil_send_stream_callback_event(const xmlChar *subsys_id, const xmlChar *modname, const xmlChar *stream_name, boolean all_streams, agt_not_subevent_t subevent)
Send a "<stream-callback-event>" message to one subsystem.
Definition: agt_sil.c:8551
GET1 and GET2 Callback Support.