yumapro  20.10-12
YumaPro SDK
ypgnmi.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 - 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  */
12 #if defined(WITH_GNMI) && defined(WITH_RESTCONF) && defined(WITH_YCONTROL)
13 
14 #ifndef _H_ypgnmi
15 #define _H_ypgnmi
16 
17 /* FILE: ypgnmi.h
18 *********************************************************************
19 * *
20 * P U R P O S E *
21 * *
22 *********************************************************************/
23 
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 26-JUNE-18 am Begun
38 */
39 
40 #include <xmlstring.h>
41 
42 #ifndef _H_status
43 #include "status.h"
44 #endif
45 
46 #ifndef _H_status_enum
47 #include "status_enum.h"
48 #endif
49 
50 #ifndef _H_ncxtypes
51 #include "ncxtypes.h"
52 #endif
53 
54 #ifndef _H_dlq
55 #include "dlq.h"
56 #endif
57 
58 #ifndef _H_val
59 #include "val.h"
60 #endif
61 
62 #ifndef _H_yangapi
63 #include "yangapi.h"
64 #endif
65 
66 #ifdef __cplusplus
67 extern "C" {
68 #endif
69 
70 
81 /********************************************************************
82 * *
83 * T Y P E S *
84 * *
85 *********************************************************************/
86 
88 typedef struct ypgnmi_get_cb_t_ {
89 
91  xmlChar *prefix_str;
92 
94  xmlChar *path_str;
95 
99  restconf_content_t content_enum;
100 
102  obj_template_t *target_obj;
103 
105  val_value_t *request_target;
106 
107 } ypgnmi_get_cb_t;
108 
109 
111 typedef struct ypgnmi_edit_t_ {
112 
113  /* queue header in case added to a queue */
114  dlq_hdr_t qhdr;
115 
117  xmlChar *path_str;
118 
122  xmlChar *input;
123 
125  op_editop_t editop;
126 
128  status_t res;
129 
131  const xmlChar *error_details;
132 
134  obj_template_t *target_obj;
135 
139  val_value_t *value;
140 } ypgnmi_edit_t;
141 
142 
144 typedef struct ypgnmi_edit_cb_t_ {
146  dlq_hdr_t editsQ;
147 
149  xmlChar *prefix_str;
150 
151 } ypgnmi_edit_cb_t;
152 
153 
154 /********************************************************************
155 * *
156 * F U N C T I O N S *
157 * *
158 *********************************************************************/
159 
160 
166 extern ypgnmi_get_cb_t *
167  ypgnmi_new_gcb (void);
168 
169 
175 extern void
176  ypgnmi_free_gcb (ypgnmi_get_cb_t *cb);
177 
178 
185 extern ypgnmi_edit_t *
186  get_first_edit_entry (ypgnmi_edit_cb_t *cb);
187 
188 
195 extern ypgnmi_edit_t *
196  get_next_edit_entry (ypgnmi_edit_t *entry);
197 
198 
207 extern ypgnmi_edit_t *
208  ypgnmi_new_edit (xmlChar *path_str,
209  xmlChar *input,
210  op_editop_t editop);
211 
212 
218 extern void
219  ypgnmi_free_edit (ypgnmi_edit_t *entry);
220 
221 
227 extern ypgnmi_edit_cb_t *
228  ypgnmi_new_ecb (void);
229 
230 
236 extern void
237  ypgnmi_free_ecb (ypgnmi_edit_cb_t *cb);
238 
239 
260 extern void
261  ypgnmi_set_edit_status (rpc_msg_t *msg,
262  const xmlChar *edit_id,
263  status_t res);
264 
265 
275 extern boolean
276  ypgnmi_check_edits_status (ypgnmi_edit_cb_t *ecb);
277 
278 
282 #ifdef __cplusplus
283 } /* end extern 'C' */
284 #endif
285 
286 #endif /* _H_ypgnmi */
287 #endif // WITH_GNMI && WITH_RESTCONF && WITH_YCONTROL
ypgnmi_check_edits_status
boolean ypgnmi_check_edits_status(ypgnmi_edit_cb_t *ecb)
Check if any of the requested edits failed.
Definition: ypgnmi.c:381
ypgnmi_get_cb_t_::path_str
xmlChar * path_str
malloced! back-ptr Specified Path for the get request
Definition: ypgnmi.h:98
ypgnmi_get_cb_t_::target_obj
obj_template_t * target_obj
backptr inside schema_tree to the target object
Definition: ypgnmi.h:106
ypgnmi_edit_t_::error_details
const xmlChar * error_details
some specific error details of the edit
Definition: ypgnmi.h:131
run_subsystem
int run_subsystem(proto_id_t protocol_id, int trace_level, int argc, char **argv)
Run the subsystem : entry point.
Definition: subsystem.c:1035
ypgnmi_new_ecb
ypgnmi_edit_cb_t * ypgnmi_new_ecb(void)
Create a new ypgnmi_edit_cb_t control block.
Definition: ypgnmi.c:271
ypgnmi_edit_t_
Delete/Replace/Update edit requests Q.
Definition: ypgnmi.h:111
xml_strdup
xmlChar * xml_strdup(const xmlChar *copyFrom)
String duplicate for xmlChar.
Definition: xml_util.c:1553
ypgnmi_edit_cb_t_::editsQ
dlq_hdr_t editsQ
edits: Q of ypgnmi_edit_t
Definition: ypgnmi.h:146
ypgnmi_edit_t_::value
val_value_t * value
malloced! Specified Value for the Replace/Upodate requests NULL if the op is DELETE
Definition: ypgnmi.h:139
val.h
Value Node Basic Support.
status_enum.h
global error status code enumerations
ypgnmi_edit_cb_t_::prefix_str
xmlChar * prefix_str
malloced! Specified Path for the get request
Definition: ypgnmi.h:149
ypgnmi_free_ecb
void ypgnmi_free_ecb(ypgnmi_edit_cb_t *cb)
Clean and free a ypgnmi_edit_cb_t control block.
Definition: ypgnmi.c:295
ncxconst.h
Contains NCX constants.
ypgnmi_edit_cb_t_
gNMI Edit Control Block
Definition: ypgnmi.h:144
NO_ERR
@ NO_ERR
000
Definition: status_enum.h:188
xpath.h
Schema and data model Xpath search support.
ypgnmi_edit_t_::res
status_t res
status of the edit
Definition: ypgnmi.h:128
dlq_createSQue
void dlq_createSQue(dlq_hdrT *queAddr)
create a static queue header
Definition: dlq.c:177
ERR_INTERNAL_VAL
@ ERR_INTERNAL_VAL
004
Definition: status_enum.h:194
ypgnmi_free_gcb
void ypgnmi_free_gcb(ypgnmi_get_cb_t *cb)
Clean and free a ypgnmi_get_cb_t control block.
Definition: ypgnmi.c:113
rpc.h
NETCONF protocol remote procedure call common definitions.
ypgnmi_new_gcb
ypgnmi_get_cb_t * ypgnmi_new_gcb(void)
Create a new ypgnmi_get_cb_t control block.
Definition: ypgnmi.c:90
ypgnmi_free_edit
void ypgnmi_free_edit(ypgnmi_edit_t *entry)
Free a yp-gnmi Edit entries.
Definition: ypgnmi.c:242
ypgnmi_edit_t_::path_str
xmlChar * path_str
malloced! back-ptr Specified Path for the delete request
Definition: ypgnmi.h:117
ypgnmi_edit_t_::editop
op_editop_t editop
edit request operation
Definition: ypgnmi.h:125
dlq_nextEntry
#define dlq_nextEntry(nodeP)
get the next queue entry after the current entry
Definition: dlq.h:265
subsystem.h
Thin client IO handler for YumaPro server.
ypgnmi_get_cb_t_::prefix_str
xmlChar * prefix_str
malloced! Specified Path for the get request
Definition: ypgnmi.h:95
xml_strcmp
int xml_strcmp(const xmlChar *s1, const xmlChar *s2)
String compare for xmlChar.
Definition: xml_util.c:1746
get_first_edit_entry
ypgnmi_edit_t * get_first_edit_entry(ypgnmi_edit_cb_t *cb)
Get the first edit entry in editsQ.
Definition: ypgnmi.c:142
ncxtypes.h
YANG module data structures Many internal representations of YANG module constructs.
ypgnmi.h
YP-GNMI requests support module.
ypgnmi_get_cb_t_::content_enum
restconf_content_t content_enum
content parameter from RESTCONF ALL by default
Definition: ypgnmi.h:103
get_next_edit_entry
ypgnmi_edit_t * get_next_edit_entry(ypgnmi_edit_t *entry)
Get the next edit entry in the editsQ.
Definition: ypgnmi.c:169
dlq_deque
void * dlq_deque(dlq_hdrT *listP)
remove the first queue node from the queue list
Definition: dlq.c:286
ypgnmi_new_edit
ypgnmi_edit_t * ypgnmi_new_edit(xmlChar *path_str, xmlChar *input, op_editop_t editop)
Create a new yp-gnmi Edit entriy.
Definition: ypgnmi.c:198
dlq_empty
#define dlq_empty(listP)
check if queue list is empty
Definition: dlq.h:367
dlq_firstEntry
#define dlq_firstEntry(listP)
get the first entry in the queue list
Definition: dlq.h:337
ncx.h
YANG module utility functions.
ypgnmi_set_edit_status
void ypgnmi_set_edit_status(rpc_msg_t *msg, const xmlChar *edit_id, status_t res)
Set the error status to the gNMI edit.
Definition: ypgnmi.c:342
ypgnmi_get_cb_t_::request_target
val_value_t * request_target
backptr inside root_tree to the target value
Definition: ypgnmi.h:109
ypgnmi_edit_t_::input
xmlChar * input
malloced! Specified Input for the Replace/Upodate requests NULL if the op is DELETE
Definition: ypgnmi.h:122
SET_ERROR
#define SET_ERROR(E)
macro SET_ERROR
Definition: status_enum.h:103
ypgnmi_get_cb_t_
gNMI GET control block
Definition: ypgnmi.h:88
status.h
Global error messages for status code enumerations.
yangapi.h
YANG-API definitions (pre-RESTCONF)
dlq.h
dlq provides general double-linked list and queue support:
ypgnmi_edit_t_::target_obj
obj_template_t * target_obj
backptr inside schema_tree to target object
Definition: ypgnmi.h:134