yumapro  25.10-1
YumaPro SDK
Loading...
Searching...
No Matches
db_api.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2008 - 2012, Andy Bierman, All Rights Reserved.
3 * Copyright (c) 2012 - 2025, 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_db_api
13#define _H_db_api
14
15/* FILE: db_api.h
16*********************************************************************
17* *
18* P U R P O S E *
19* *
20*********************************************************************/
21
28/*********************************************************************
29* *
30* C H A N G E H I S T O R Y *
31* *
32*********************************************************************
33
34date init comment
35----------------------------------------------------------------------
3618-nov-14 abb Begun
37*/
38
39#include <xmlstring.h>
40
41#ifndef _H_db_api_types
42#include "db_api_types.h"
43#endif
44
45#ifndef _H_rpc
46#include "rpc.h"
47#endif
48
49#ifndef _H_val
50#include "val.h"
51#endif
52
53#ifndef _H_yang_patch
54#include "yang_patch.h"
55#endif
56
57
58#ifdef __cplusplus
59extern "C" {
60#endif
61
62
83/********************************************************************
84* *
85* C O N S T A N T S *
86* *
87*********************************************************************/
88
90#define DB_API (const xmlChar *)"db-api"
91
93#define DB_API_MOD (const xmlChar *)"yumaworks-db-api"
94
96#define DB_API_OBJ (const xmlChar *)"db-api"
97
99#define DB_API_REQ_OK(ST) (ST >= DB_API_ST_READY)
100
101
102/********************************************************************
103* *
104* T Y P E S *
105* *
106*********************************************************************/
107
108
109/********************************************************************
110* *
111* F U N C T I O N S *
112* *
113*********************************************************************/
114
115
126extern status_t
127 db_api_register_service (void);
128
129
187extern status_t
188 db_api_send_edit_oper (const xmlChar *edit_target,
189 const xmlChar *edit_operation,
190 const xmlChar *edit_value,
191 const xmlChar *patch_id_str,
192 const xmlChar *comment_str,
193 const xmlChar *insert_point,
194 const xmlChar *insert_where,
195 ncx_msg_encoding_t edit_encoding,
196 ncx_instfmt_t edit_id_format);
197
198
208extern status_t
209 db_api_register_service_ex (boolean with_db_lock);
210
211
221extern boolean
222 db_api_service_ready (void);
223
224
269extern status_t
270 db_api_send_edit (const xmlChar *edit_target,
271 const xmlChar *edit_operation,
272 const xmlChar *edit_xml_value);
273
274
305extern status_t
306 db_api_send_edit_ex (const xmlChar *edit_target,
307 const xmlChar *edit_operation,
308 const xmlChar *edit_xml_value,
309 const xmlChar *patch_id_str,
310 boolean system_edit);
311
312
379extern status_t
380 db_api_send_edit_full (const xmlChar *edit_target,
381 const xmlChar *edit_operation,
382 const xmlChar *edit_xml_value,
383 const xmlChar *patch_id_str,
384 boolean system_edit,
385 const xmlChar *insert_point,
386 const xmlChar *insert_where);
387
388
459extern status_t
460 db_api_send_edit_full2 (const xmlChar *edit_target,
461 const xmlChar *edit_operation,
462 const xmlChar *edit_xml_value,
463 const xmlChar *patch_id_str,
464 boolean system_edit,
465 const xmlChar *insert_point,
466 const xmlChar *insert_where,
467 boolean skip_sil);
468
469
482extern status_t
483 db_api_check_edit (void);
484
485
506extern status_t
507 db_api_check_edit_ex (const xmlChar **errstr);
508
509
510
520extern status_t
521 db_api_send_getconfig (const xmlChar *filespec,
522 boolean withdef);
523
524
541extern status_t
542 db_api_send_getfilter (const xmlChar *filespec,
543 boolean withdef,
544 boolean get_config,
545 const xmlChar *xpath_filter);
546
547
566extern status_t
568 void *cookie,
569 boolean withdef,
570 boolean get_config,
571 const xmlChar *xpath_filter);
572
573
596extern status_t
597 db_api_start_patch (const xmlChar *patch_id_str,
598 boolean system_edit,
599 yang_patch_cb_t **retcb);
600
601
602
633extern status_t
634 db_api_start_patch2 (const xmlChar *patch_id_str,
635 boolean system_edit,
636 boolean skip_sil,
637 const xmlChar *comment,
638 yang_patch_cb_t **retcb);
639
640
664extern status_t
665 db_api_add_edit (yang_patch_cb_t *pcb,
666 const xmlChar *edit_id_str,
667 const xmlChar *edit_target,
668 const xmlChar *edit_operation,
669 const xmlChar *edit_xml_value,
670 const xmlChar *insert_point,
671 const xmlChar *insert_where);
672
673
685extern status_t
686 db_api_send_patch (yang_patch_cb_t *pcb);
687
688
697extern void
698 db_api_free_patch (yang_patch_cb_t *pcb);
699
700
708extern status_t
710
711
720extern status_t
721 db_api_send_enter_maintmode_ex (boolean read_ok,
722 boolean operation_ok);
723
724
730extern status_t
732
733
740extern status_t
741 db_api_send_set_loglevel (const char *dlevel);
742
743
749extern status_t
751
752
758extern status_t
760
761
776extern status_t
777 db_api_send_subrpc_request (const xmlChar *user_id,
778 const xmlChar *rpc_modname,
779 const xmlChar *rpc_name,
780 const xmlChar *in_filespec,
781 const xmlChar *out_filespec);
782
783
784
785
786
797extern status_t
798 db_api_send_ypha_request(val_value_t *msgval);
799
800
801
811extern status_t
812 db_api_send_protocol_control (const xmlChar *action,
813 const xmlChar *protocol);
814
815
816
822extern uint32
824
825
826
830#ifdef __cplusplus
831} /* end extern 'C' */
832#endif
833
834#endif /* _H_db_api */
Data structures for DB-API service layer.
status_t db_api_send_edit(const xmlChar *edit_target, const xmlChar *edit_operation, const xmlChar *edit_xml_value)
Create a YANG Patch edit request and send it to the DB-API service on the main server.
Definition: db_api.c:3012
status_t db_api_send_edit_ex(const xmlChar *edit_target, const xmlChar *edit_operation, const xmlChar *edit_xml_value, const xmlChar *patch_id_str, boolean system_edit)
Create a YANG Patch edit request and send it to the DB-API service on the main server.
Definition: db_api.c:3094
uint32 db_api_get_last_msg_id(void)
API to get the last message ID sent by the db-api system.
Definition: db_api.c:4374
status_t db_api_send_exit_maintmode(void)
Create a <exit-maintmode> request and send it to the main server.
Definition: db_api.c:4076
status_t db_api_send_set_loglevel(const char *dlevel)
Create a <set-log-level> request and send it to the main server.
Definition: db_api.c:4095
status_t db_api_start_patch(const xmlChar *patch_id_str, boolean system_edit, yang_patch_cb_t **retcb)
Start a YANG Patch request that can have multiple edits.
Definition: db_api.c:3364
status_t db_api_send_edit_oper(const xmlChar *edit_target, const xmlChar *edit_operation, const xmlChar *edit_value, const xmlChar *patch_id_str, const xmlChar *comment_str, const xmlChar *insert_point, const xmlChar *insert_where, ncx_msg_encoding_t edit_encoding, ncx_instfmt_t edit_id_format)
Create a YANG Patch edit request and send it to the DB-API service on the main server.
Definition: db_api.c:2910
status_t db_api_send_protocol_control(const xmlChar *action, const xmlChar *protocol)
Create a <protocol-control> request and send it to the main server.
Definition: db_api.c:4331
status_t db_api_send_subrpc_request(const xmlChar *user_id, const xmlChar *rpc_modname, const xmlChar *rpc_name, const xmlChar *in_filespec, const xmlChar *out_filespec)
Create a <subrpc-request> request and send it to the main server.
Definition: db_api.c:4231
status_t db_api_send_enter_maintmode(void)
Create a <enter-maintmode> request and send it to the main server.
Definition: db_api.c:4034
status_t db_api_request_local_db_lock(void)
API to request that the local system has the Db-Edit-Lock.
Definition: db_api.c:4115
status_t db_api_release_local_db_lock(void)
API to release the local system Db-Edit-Lock.
Definition: db_api.c:4168
status_t db_api_send_getconfig(const xmlChar *filespec, boolean withdef)
Create a <getconfig> request and send it to the main server.
Definition: db_api.c:3624
status_t db_api_send_getfilter_cb(db_api_dataresp_cbfn_t cbfn, void *cookie, boolean withdef, boolean get_config, const xmlChar *xpath_filter)
Retrieve data from the server with user callback.
Definition: db_api.c:3711
status_t db_api_send_enter_maintmode_ex(boolean read_ok, boolean operation_ok)
Create a <enter-maintmode> request and send it to the main server.
Definition: db_api.c:4056
status_t db_api_send_edit_full(const xmlChar *edit_target, const xmlChar *edit_operation, const xmlChar *edit_xml_value, const xmlChar *patch_id_str, boolean system_edit, const xmlChar *insert_point, const xmlChar *insert_where)
Create a YANG Patch edit request and send it to the DB-API service on the main server.
Definition: db_api.c:3193
status_t db_api_check_edit(void)
Check on the status of an edit in progress.
Definition: db_api.c:3542
status_t db_api_register_service_ex(boolean with_db_lock)
Register the DB-API service with the YControl layer.
Definition: db_api.c:2795
void(* db_api_dataresp_cbfn_t)(status_t res, val_value_t *val, void *cookie)
user function callback template for processing the val_value_t tree for the server data response.
Definition: db_api_types.h:174
status_t
global error return code
Definition: status_enum.h:219
ncx_msg_encoding_t
enumeration for message encoding formats
Definition: ncxtypes.h:648
ncx_instfmt_t
instance identifier string format types
Definition: ncxtypes.h:562
NETCONF protocol remote procedure call common definitions.
one value to match one type
Definition: val.h:939
One YANG Patch Request.
Definition: yang_patch.h:155
Value Node Basic Support.
YANG Patch Media Type.