yumapro  20.10-12
YumaPro SDK
json_wr.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_json_wr
13 #define _H_json_wr
14 
15 /* FILE: json_wr.h
16 *********************************************************************
17 * *
18 * P U R P O S E *
19 * *
20 *********************************************************************/
21 
27 /*********************************************************************
28 * *
29 * C H A N G E H I S T O R Y *
30 * *
31 *********************************************************************
32 
33 date init comment
34 ----------------------------------------------------------------------
35 01-sep-11 abb Begun;
36 
37 */
38 
39 #include <stdio.h>
40 #include <xmlstring.h>
41 
42 #ifndef _H_ses
43 #include "ses.h"
44 #endif
45 
46 #ifndef _H_status
47 #include "status.h"
48 #endif
49 
50 #ifndef _H_val
51 #include "val.h"
52 #endif
53 
54 #ifndef _H_val_util
55 #include "val_util.h"
56 #endif
57 
58 #ifndef _H_getcb
59 #include "getcb.h"
60 #endif
61 
62 #ifdef __cplusplus
63 extern "C" {
64 #endif
65 
66 /********************************************************************
67 * *
68 * C O N S T A N T S *
69 * *
70 *********************************************************************/
71 #define JSON_WR_YANG_NULL (const xmlChar *)"[null]"
72 
73 /********************************************************************
74 * *
75 * T Y P E S *
76 * *
77 *********************************************************************/
78 
79 
88 typedef enum json_wr_tag_t_ {
89  JSON_WR_TAG_NONE,
90  JSON_WR_TAG_FIRST,
91  JSON_WR_TAG_MIDDLE,
92  JSON_WR_TAG_LAST
93 } json_wr_tag_t;
94 
96 typedef struct json_walker_cookie_t_ {
98  ses_cb_t *scb;
99 
101  xml_msg_hdr_t *msg;
102 
104  int32 indent;
105 
108 
110  boolean expand_varexpr;
111 
113  boolean maxmode;
114 
116  boolean isfirst;
117 
119  boolean isfirstchild;
120 
121  /* YPW-1199: malformed JSON output for leaf-lists and list */
127  boolean list_failed;
128 
129 } json_walker_cookie_t;
130 
131 
132 /********************************************************************
133 * *
134 * F U N C T I O N S *
135 * *
136 *********************************************************************/
137 
138 
148 extern void
149  json_wr_start_object (ses_cb_t *scb,
150  xml_msg_hdr_t *msg,
151  const xmlChar *modname,
152  const xmlChar *name,
153  int32 startindent);
154 
155 
167 extern void
168  json_wr_start_object_ex (ses_cb_t *scb,
169  xml_msg_hdr_t *msg,
170  const xmlChar *modname,
171  const xmlChar *name,
172  int32 startindent,
173  boolean startbrace,
174  boolean endbrace);
175 
176 
187 extern void
188  json_wr_start_object_val (ses_cb_t *scb,
189  xml_msg_hdr_t *msg,
190  val_value_t *val,
191  int32 startindent);
192 
193 
205 extern void
206  json_wr_start_object_obj (ses_cb_t *scb,
207  xml_msg_hdr_t *msg,
208  const xmlChar *modname,
209  const xmlChar *name,
210  obj_template_t *obj,
211  int32 startindent);
212 
213 
221 extern void
222  json_wr_end_object (ses_cb_t *scb,
223  xml_msg_hdr_t *msg,
224  int32 startindent);
225 
226 
234 extern void
235  json_wr_start_array (ses_cb_t *scb,
236  xml_msg_hdr_t *msg,
237  int32 startindent);
238 
239 
252 extern void
253  json_wr_start_array_obj (ses_cb_t *scb,
254  xml_msg_hdr_t *msg,
255  const xmlChar *modname,
256  const xmlChar *name,
257  obj_template_t *obj,
258  int32 startindent,
259  boolean startbrace,
260  boolean startbracket);
261 
262 
273 extern void
274  json_wr_start_array_val (ses_cb_t *scb,
275  xml_msg_hdr_t *msg,
276  val_value_t *val,
277  int32 startindent,
278  boolean startbrace,
279  boolean startbracket);
280 
281 
289 extern void
290  json_wr_end_array (ses_cb_t *scb,
291  xml_msg_hdr_t *msg,
292  int32 startindent);
293 
294 
309 extern void
310  json_wr_simval_line (ses_cb_t *scb,
311  xml_msg_hdr_t *msg,
312  xmlns_id_t nsid,
313  const xmlChar *namestr,
314  const xmlChar *valstr,
315  ncx_btype_t btyp,
316  int32 startindent,
317  boolean isfirst);
318 
319 
349 extern status_t
350  json_wr_max_check_val (ses_cb_t *scb,
351  xml_msg_hdr_t *msg,
352  xmlns_id_t parent_nsid,
353  val_value_t *val,
354  int32 startindent,
355  val_nodetest_fn_t testfn,
356  boolean isfirst,
357  boolean islast,
358  boolean isfirstchild,
359  boolean isfirstsibling,
360  boolean force_lastsibling,
361  boolean force_lastsib_value,
362  boolean force_array_obj);
363 
364 
397 extern status_t
398  json_wr_max_check_val_force (ses_cb_t *scb,
399  xml_msg_hdr_t *msg,
400  xmlns_id_t parent_nsid,
401  val_value_t *val,
402  int32 startindent,
403  val_nodetest_fn_t testfn,
404  boolean isfirst,
405  boolean islast,
406  boolean isfirstchild,
407  boolean isfirstsibling,
408  boolean force_lastsibling,
409  boolean force_lastsib_value,
410  boolean force_array_obj,
411  xmlns_id_t force_nsid,
412  const xmlChar *force_name);
413 
414 
430 extern status_t
431  json_wr_full_check_val (ses_cb_t *scb,
432  xml_msg_hdr_t *msg,
433  xmlns_id_t parent_nsid,
434  val_value_t *val,
435  int32 startindent,
436  val_nodetest_fn_t testfn);
437 
438 
456 extern status_t
457  json_wr_full_check_val_force (ses_cb_t *scb,
458  xml_msg_hdr_t *msg,
459  xmlns_id_t parent_nsid,
460  val_value_t *val,
461  int32 startindent,
462  val_nodetest_fn_t testfn,
463  xmlns_id_t force_nsid,
464  const xmlChar *force_name);
465 
466 
477 extern status_t
478  json_wr_check_open_file (FILE *fp,
479  val_value_t *val,
480  int32 startindent,
481  int32 indent,
482  val_nodetest_fn_t testfn);
483 
484 
485 
486 
497 extern status_t
498  json_wr_check_file (const xmlChar *filespec,
499  val_value_t *val,
500  int32 startindent,
501  int32 indent,
502  val_nodetest_fn_t testfn);
503 
504 
514 extern status_t
515  json_wr_file (const xmlChar *filespec,
516  val_value_t *val,
517  int32 startindent,
518  int32 indent);
519 
520 
528 extern void
529  json_wr_output_null (ses_cb_t *scb,
530  int32 startindent);
531 
532 
548 extern void
549  json_wr_check_child_obj (ses_cb_t *scb,
550  xml_msg_hdr_t *msg,
551  val_value_t *val,
552  obj_template_t *objnode,
553  int32 indent,
554  val_nodetest_fn_t testfn,
555  boolean isfirst,
556  boolean isfirstchild);
557 
558 
574 extern void
575  json_wr_check_child_obj_ex (ses_cb_t *scb,
576  xml_msg_hdr_t *msg,
577  getcb_get2_t *parent_get2cb,
578  obj_template_t *objnode,
579  int32 indent,
580  val_nodetest_fn_t testfn,
581  boolean isfirst,
582  boolean isfirstchild);
583 
584 
588 #ifdef __cplusplus
589 } /* end extern 'C' */
590 #endif
591 
592 #endif /* _H_json_wr */
ses.h
NETCONF Session Common definitions module.
ERR_NCX_SKIPPED
@ ERR_NCX_SKIPPED
2001
Definition: status_enum.h:551
val_get_first_meta_val
val_value_t * val_get_first_meta_val(val_value_t *val)
Get the first metaQ entry from the specified Queue.
Definition: val.c:5447
ses_finish_msg
void ses_finish_msg(ses_cb_t *scb)
Finish an outbound message on the specified session.
Definition: ses.c:3013
json_wr_check_child_obj
void json_wr_check_child_obj(ses_cb_t *scb, xml_msg_hdr_t *msg, val_value_t *val, obj_template_t *objnode, int32 indent, val_nodetest_fn_t testfn, boolean isfirst, boolean isfirstchild)
generate entire val_value_t *w/filter)
Definition: json_wr.c:2886
NCX_BT_BINARY
@ NCX_BT_BINARY
binary (base64)
Definition: ncxtypes.h:218
ses_new_indent_count
int32 ses_new_indent_count(boolean indent_in, int32 indent, int32 indent_amount)
Get the new indent count from the current and indent_amount.
Definition: ses.c:4148
val_type_is_any
boolean val_type_is_any(const val_value_t *val)
Check if val_value node is a proper simple type ANYXML.
Definition: val_util.c:7918
val_get_owner
const xmlChar * val_get_owner(val_value_t *val)
Get the owner string for the specified value node.
Definition: val.c:13572
val_find_child
val_value_t * val_find_child(const val_value_t *parent, const xmlChar *modname, const xmlChar *childname)
Find the first instance of the specified child node.
Definition: val.c:8560
ses_new_dummy_scb
ses_cb_t * ses_new_dummy_scb(void)
Create a new dummy session control block.
Definition: ses.c:2100
getcb_need_get2
boolean getcb_need_get2(obj_template_t *curobj, obj_template_t *reqobj)
check if the node has a get2 callback or in a choice/case subtree that has get2 callback
Definition: getcb.c:8233
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
obj_is_in_aio_get2
boolean obj_is_in_aio_get2(obj_template_t *obj)
Check if this object is a child of a node with sil-aio-get2 extension setup or if this object itself ...
Definition: obj.c:18305
VAL_NSID
#define VAL_NSID(V)
Access the namespace ID.
Definition: val.h:396
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
NCX_BT_BOOLEAN
@ NCX_BT_BOOLEAN
boolean
Definition: ncxtypes.h:206
val.h
Value Node Basic Support.
val_is_default
boolean val_is_default(val_value_t *val)
Check if the specified value is set to the YANG default value.
Definition: val.c:11347
json_wr_simval_line
void json_wr_simval_line(ses_cb_t *scb, xml_msg_hdr_t *msg, xmlns_id_t nsid, const xmlChar *namestr, const xmlChar *valstr, ncx_btype_t btyp, int32 startindent, boolean isfirst)
generate 1 line for a simple value within a container or array
Definition: json_wr.c:1861
NCX_BT_IDREF
@ NCX_BT_IDREF
identityref
Definition: ncxtypes.h:222
getcb.h
GET1 and GET2 Callback Support.
val_next_child_same
val_value_t * val_next_child_same(val_value_t *curchild)
Get the next instance of the corresponding child node.
Definition: val.c:8456
obj_next_key
obj_key_t * obj_next_key(obj_key_t *objkey)
Get the next key record.
Definition: obj.c:9559
NCX_BT_INTERN
@ NCX_BT_INTERN
not a real type, string buffer for contents
Definition: ncxtypes.h:231
obj_first_key
obj_key_t * obj_first_key(obj_template_t *obj)
Get the first key record.
Definition: obj.c:9472
typ_is_number
boolean typ_is_number(ncx_btype_t btyp)
Check if the base type is numeric.
Definition: typ.c:4063
obj_next_child_deep
obj_template_t * obj_next_child_deep(obj_template_t *obj)
Get the next child object if the specified object has any children.
Definition: obj.c:7138
ncx_num.h
NCX Module Library Number Utility Functions.
val_is_wildcard_string
#define val_is_wildcard_string(V)
Check if the value is a wildcard string.
Definition: val.h:4983
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
json_wr_check_file
status_t json_wr_check_file(const xmlChar *filespec, val_value_t *val, int32 startindent, int32 indent, val_nodetest_fn_t testfn)
Write the specified value to a FILE in JSON format.
Definition: json_wr.c:2795
xml_msg_inc_cur_depth
void xml_msg_inc_cur_depth(xml_msg_hdr_t *mhdr)
Increment the cur_depth parameter if needed.
Definition: xml_msg.c:1652
json_wr_max_check_val_force
status_t json_wr_max_check_val_force(ses_cb_t *scb, xml_msg_hdr_t *msg, xmlns_id_t parent_nsid, val_value_t *val, int32 startindent, val_nodetest_fn_t testfn, boolean isfirst, boolean islast, boolean isfirstchild, boolean isfirstsibling, boolean force_lastsibling, boolean force_lastsib_value, boolean force_array_obj, xmlns_id_t force_nsid, const xmlChar *force_name)
generate entire val_value_t *w/filter)
Definition: json_wr.c:2026
VAL_IDREF_NAME
#define VAL_IDREF_NAME(V)
Access the name string value as an identityref ONLY if NCX_BT_IDREF.
Definition: val.h:476
json_wr_start_object_val
void json_wr_start_object_val(ses_cb_t *scb, xml_msg_hdr_t *msg, val_value_t *val, int32 startindent)
generate start of a JSON object based on val value tree
Definition: json_wr.c:1540
XML_MSG_WITH_GET2
#define XML_MSG_WITH_GET2(M)
Check if GET2 mode requested.
Definition: xml_msg.h:228
ncx_next_backptr
ncx_backptr_t * ncx_next_backptr(ncx_backptr_t *curptr)
Get next back pointer struct.
Definition: ncx.c:11545
ses_add_indent
int32 ses_add_indent(ses_cb_t *scb, int32 indent)
Add in the new indent amount.
Definition: ses.c:4515
XML_MSG_WITH_OWNERS
#define XML_MSG_WITH_OWNERS(M)
Check if NDMA owner attributes requested.
Definition: xml_msg.h:216
val_get_value_ex
val_value_t * val_get_value_ex(ses_cb_t *scb, xml_msg_hdr_t *msg, val_value_t *val, val_nodetest_fn_t testfn, boolean acmcheck, boolean *malloced, status_t *res, void *get2cb)
Get the value for a node after lots of internal processing (extended)
Definition: val_util.c:6161
obj_is_key
boolean obj_is_key(const obj_template_t *obj)
Check if object is being used as a key leaf within a list.
Definition: obj.c:14278
ERR_NCX_NO_INSTANCE
@ ERR_NCX_NO_INSTANCE
1009
Definition: status_enum.h:498
obj_is_any
boolean obj_is_any(const obj_template_t *obj)
Get the config flag for the top-level object Check the specified object all the way to root.
Definition: obj.c:13304
xml_msg_dec_cur_depth
void xml_msg_dec_cur_depth(xml_msg_hdr_t *mhdr)
Decrement the cur_depth parameter if needed.
Definition: xml_msg.c:1674
VAL_NAME
#define VAL_NAME(V)
Access the value name.
Definition: val.h:399
ncxconst.h
Contains NCX constants.
ncxmod.h
NCX Module Load Manager.
xml_msg_get_withdef
ncx_withdefaults_t xml_msg_get_withdef(xml_msg_hdr_t *msg)
Get the message withdef enum.
Definition: xml_msg.c:1309
ncx_use_objptrs
boolean ncx_use_objptrs(void)
Get the use_objptrs flag.
Definition: ncx.c:12647
xml_clean_attrs
void xml_clean_attrs(xml_attrs_t *attrs)
clean an xml_attrs_t variable
Definition: xml_util.c:1243
SES_SET_LEAFLIST_ATTRS
#define SES_SET_LEAFLIST_ATTRS(S, A)
set the leaf-list attributes
Definition: ses.h:165
ncx_first_objptr
ncx_backptr_t * ncx_first_objptr(void)
Get the first object pointer.
Definition: ncx.c:12662
obj_is_list
boolean obj_is_list(const obj_template_t *obj)
Check if object is a YANG list.
Definition: obj.c:13349
ses_putchar
void ses_putchar(ses_cb_t *scb, uint32 ch)
Write one char to the session, without any translation.
Definition: ses.c:2353
NCX_WITHDEF_REPORT_ALL
@ NCX_WITHDEF_REPORT_ALL
report-all
Definition: ncxtypes.h:1012
VAL_ENUM_NAME
#define VAL_ENUM_NAME(V)
Access the enum name in the value ONLY if BCX_NT_ENUM This is the macro used to check values in SIL c...
Definition: val.h:434
xmlns_get_module
const xmlChar * xmlns_get_module(xmlns_id_t nsid)
get the module name of the namespace ID
Definition: xmlns.c:1126
xmlns_id_t
uint16 xmlns_id_t
integer handle for registered namespaces
Definition: xmlns.h:89
ses_putjstr
void ses_putjstr(ses_cb_t *scb, const xmlChar *str, int32 indent)
write JSON safe content string Write a zero-terminated element content string to the session
Definition: ses.c:2700
SES_SET_LEAFLIST_PTR
#define SES_SET_LEAFLIST_PTR(S, V)
set the session leaf-list pointer
Definition: ses.h:159
json_wr_file
status_t json_wr_file(const xmlChar *filespec, val_value_t *val, int32 startindent, int32 indent)
Write the specified value to a FILE in JSON format.
Definition: json_wr.c:2835
json_wr_output_null
void json_wr_output_null(ses_cb_t *scb, int32 startindent)
generate a null value; needed for printing empty <data> element which is done as a wrapper,...
Definition: json_wr.c:2856
val_nodetest_fn_t
boolean(* val_nodetest_fn_t)(xml_msg_hdr_t *mhdr, ncx_withdefaults_t withdef, boolean realtest, val_value_t *node)
user function callback template to test output of a specified node.
Definition: val_util.h:132
NCX_BT_ENUM
@ NCX_BT_ENUM
enumeration
Definition: ncxtypes.h:204
NO_ERR
@ NO_ERR
000
Definition: status_enum.h:188
ses_clean_breadcrumbQ
void ses_clean_breadcrumbQ(ses_cb_t *scb)
Clean the breadcrumbQ.
Definition: ses.c:4841
NCX_BT_UINT64
@ NCX_BT_UINT64
uint64
Definition: ncxtypes.h:214
getcb_get2_allowed
boolean getcb_get2_allowed(xml_msg_hdr_t *msg, obj_template_t *chobj)
Check if the current node and operation are allowed to use the GET2 callback if there is one; Used to...
Definition: getcb.c:8931
xml_init_attrs
void xml_init_attrs(xml_attrs_t *attrs)
initialize an xml_attrs_t variable
Definition: xml_util.c:745
val_get_nsid
xmlns_id_t val_get_nsid(const val_value_t *val)
Get the namespace ID for the specified value node.
Definition: val.c:12277
obj_get_name
const xmlChar * obj_get_name(const obj_template_t *obj)
Get the name field for this obj.
Definition: obj.c:10511
getcb_get2_child_obj
status_t getcb_get2_child_obj(ses_cb_t *scb, xml_msg_hdr_t *msg, val_value_t *parentval, getcb_get2_t *parent_get2cb, obj_template_t *obj, boolean with_defaults, getcb_get2_walker_fn_t walkerfn, void *cookie)
Process the instances of an object for the object itself and 0 or more nest levels of descendant node...
Definition: getcb.c:7541
ses_message_indent_count
int32 ses_message_indent_count(const ses_cb_t *scb)
Get the message indent count for this session.
Definition: ses.c:2822
NCX_WITHDEF_REPORT_ALL_TAGGED
@ NCX_WITHDEF_REPORT_ALL_TAGGED
report-all-tagged
Definition: ncxtypes.h:1013
SES_USE_JSON_ATTRS
#define SES_USE_JSON_ATTRS(S)
get the JSON use attributes flag
Definition: ses.h:153
ERR_INTERNAL_VAL
@ ERR_INTERNAL_VAL
004
Definition: status_enum.h:194
val_util.h
Value Node Utilities.
xml_msg_test_max_depth
boolean xml_msg_test_max_depth(xml_msg_hdr_t *mhdr, const struct obj_template_t_ *obj)
Test the max_depth parameter if needed.
Definition: xml_msg.c:1711
json_wr.h
JSON Write functions.
NCX_BT_INT64
@ NCX_BT_INT64
int64
Definition: ncxtypes.h:210
XML_MSG_GET2CB
#define XML_MSG_GET2CB(M)
GET2 control block backptr.
Definition: xml_msg.h:273
val_get_varexpr
const xmlChar * val_get_varexpr(const val_value_t *val)
Get the varexpr field if set; NULL if not set.
Definition: val.c:15486
NCX_BT_EMPTY
@ NCX_BT_EMPTY
empty
Definition: ncxtypes.h:205
SES_OUT_BYTES
#define SES_OUT_BYTES(S)
get session out bytes
Definition: ses.h:120
rpc_new_out_msg
rpc_msg_t * rpc_new_out_msg(void)
Malloc and initialize a new rpc_msg_t struct for output or for dummy use.
Definition: rpc.c:126
json_wr_full_check_val
status_t json_wr_full_check_val(ses_cb_t *scb, xml_msg_hdr_t *msg, xmlns_id_t parent_nsid, val_value_t *val, int32 startindent, val_nodetest_fn_t testfn)
generate entire val_value_t *w/filter)
Definition: json_wr.c:2622
ERR_INTERNAL_MEM
@ ERR_INTERNAL_MEM
003
Definition: status_enum.h:193
obj_is_dup_local
boolean obj_is_dup_local(obj_template_t *obj)
Check if this object is one that has a duplicate sibling with the same local-name and different modul...
Definition: obj.c:16854
ncx_obj_is_generic
boolean ncx_obj_is_generic(const obj_template_t *obj)
Check if the object is 1 of the gen_foo object templates.
Definition: ncx.c:13013
val_need_owner_string
boolean val_need_owner_string(val_value_t *val)
Check if the owner string is needed when generating ywx:owner attrs.
Definition: val.c:13622
obj_get_real_parent
obj_template_t * obj_get_real_parent(obj_template_t *obj)
Get the parent of the current object; skip OBJ_TYP_CHOICE and OBJ_TYP_CASE.
Definition: obj.c:12733
xml_msg_get_cur_depth
uint32 xml_msg_get_cur_depth(xml_msg_hdr_t *msg)
Get the message cur_depth value.
Definition: xml_msg.c:1411
obj_is_anydata
boolean obj_is_anydata(const obj_template_t *obj)
Check if object is an anydata.
Definition: obj.c:13284
json_wr_end_array
void json_wr_end_array(ses_cb_t *scb, xml_msg_hdr_t *msg, int32 startindent)
generate end of a JSON array
Definition: json_wr.c:1829
val_write_intern
void val_write_intern(ses_cb_t *scb, const val_value_t *val)
Write an internal buffer to the session.
Definition: val_util.c:6078
XML_MSG_GET2CB_ALLINONE
#define XML_MSG_GET2CB_ALLINONE(M)
GET2 control block backptr to be used in AIO mode.
Definition: xml_msg.h:312
val_make_sprintf_string
xmlChar * val_make_sprintf_string(const val_value_t *val)
Malloc a buffer and then sprintf the xmlChar string NETCONF representation of a simple value.
Definition: val.c:10323
xml_msg_get_max_depth
uint32 xml_msg_get_max_depth(xml_msg_hdr_t *msg)
Get the message max_depth value.
Definition: xml_msg.c:1343
json_wr_start_array
void json_wr_start_array(ses_cb_t *scb, xml_msg_hdr_t *msg, int32 startindent)
generate start of a JSON array
Definition: json_wr.c:1668
obj_is_anyxml
boolean obj_is_anyxml(const obj_template_t *obj)
Check if object is an anyxml.
Definition: obj.c:13271
xml_msg.h
XML and JSON Message send and receive support.
obj_is_container
boolean obj_is_container(const obj_template_t *obj)
Check if object is a YANG container.
Definition: obj.c:13405
SES_GET_LEAFLIST_ATTRS
#define SES_GET_LEAFLIST_ATTRS(S)
get the leaf-list attributes
Definition: ses.h:168
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
ses_indent
void ses_indent(ses_cb_t *scb, int32 indent)
Write the proper newline + indentation to the specified session.
Definition: ses.c:2768
SES_GET_JSON_1LINE
#define SES_GET_JSON_1LINE(S)
get the JSON 1 line state
Definition: ses.h:150
json_wr_check_child_obj_ex
void json_wr_check_child_obj_ex(ses_cb_t *scb, xml_msg_hdr_t *msg, getcb_get2_t *parent_get2cb, obj_template_t *objnode, int32 indent, val_nodetest_fn_t testfn, boolean isfirst, boolean isfirstchild)
generate entire val_value_t *w/filter) (extended version)
Definition: json_wr.c:2971
xml_strcmp
int xml_strcmp(const xmlChar *s1, const xmlChar *s2)
String compare for xmlChar.
Definition: xml_util.c:1746
getcb_find_next_return_val
val_value_t * getcb_find_next_return_val(getcb_get2_t *get2cb, val_value_t *curval)
Find the next matching return val in the get2cb return_valQ.
Definition: getcb.c:5932
val_get_next_child
val_value_t * val_get_next_child(const val_value_t *curchild)
Get the next child node.
Definition: val.c:8496
getcb_handle_acmtest
status_t getcb_handle_acmtest(ses_cb_t *scb, xml_msg_hdr_t *msg, val_nodetest_fn_t testfn, getcb_get2_t *get2cb)
check the access control and testfn callback for a node that would have it skipped because the write_...
Definition: getcb.c:7661
obj_is_leaf
boolean obj_is_leaf(const obj_template_t *obj)
Check if object is a proper leaf.
Definition: obj.c:13323
SES_GET_LEAFLIST_PTR
#define SES_GET_LEAFLIST_PTR(S)
get the session leaf-list pointer
Definition: ses.h:162
json_wr_tag_t_
json_wr_tag_t_
type parser used in 3 separate modes
Definition: json_wr.h:88
val_get_next_meta
val_value_t * val_get_next_meta(val_value_t *curnode)
Get the next metaQ entry from the specified entry.
Definition: val.c:5475
ses_dec_indent
int32 ses_dec_indent(ses_cb_t *scb, int32 indent)
Remove the specified indent amount.
Definition: ses.c:4549
json_wr_start_array_val
void json_wr_start_array_val(ses_cb_t *scb, xml_msg_hdr_t *msg, val_value_t *val, int32 startindent, boolean startbrace, boolean startbracket)
generate start of a JSON array; use value node
Definition: json_wr.c:1767
obj_is_top_aio_get2
boolean obj_is_top_aio_get2(obj_template_t *obj)
Check if this object is a really top level holder of extension sil-aio-get2.
Definition: obj.c:18349
val_get_first_child
val_value_t * val_get_first_child(const val_value_t *parent)
Get the first child node.
Definition: val.c:8477
json_wr_start_object_obj
void json_wr_start_object_obj(ses_cb_t *scb, xml_msg_hdr_t *msg, const xmlChar *modname, const xmlChar *name, obj_template_t *obj, int32 startindent)
generate start of a JSON object based on val value tree; use OBJ to check the modname
Definition: json_wr.c:1597
rpc_free_msg
void rpc_free_msg(rpc_msg_t *msg)
Free all the memory used by the specified rpc_msg_t.
Definition: rpc.c:152
json_wr_start_object
void json_wr_start_object(ses_cb_t *scb, xml_msg_hdr_t *msg, const xmlChar *modname, const xmlChar *name, int32 startindent)
generate start of a JSON object
Definition: json_wr.c:1427
json_wr_start_array_obj
void json_wr_start_array_obj(ses_cb_t *scb, xml_msg_hdr_t *msg, const xmlChar *modname, const xmlChar *name, obj_template_t *obj, int32 startindent, boolean startbrace, boolean startbracket)
generate start of a JSON array; use OBJ to check the modname
Definition: json_wr.c:1702
VAL_TYPE
#define VAL_TYPE(V)
Access the base type : same as VAL_BTYPE.
Definition: val.h:387
obj_first_child_deep
obj_template_t * obj_first_child_deep(obj_template_t *obj)
Get the first child object if the specified object has any children.
Definition: obj.c:7084
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
VAL_OBJ
#define VAL_OBJ(V)
Access the object template.
Definition: val.h:381
ncx.h
YANG module utility functions.
VAL_IDREF_NSID
#define VAL_IDREF_NSID(V)
Access the namespace ID value as an identityref ONLY if NCX_BT_IDREF.
Definition: val.h:473
xml_attrs_t
dlq_hdr_t xml_attrs_t
queue of xml_attr_t
Definition: xml_util.h:151
obj.h
Data Object Support.
getcb_find_return_key
val_value_t * getcb_find_return_key(getcb_get2_t *get2cb, obj_template_t *obj)
Find a return keyval in the get2cb return_keyQ.
Definition: getcb.c:6253
json_wr_end_object
void json_wr_end_object(ses_cb_t *scb, xml_msg_hdr_t *msg, int32 startindent)
generate end of a JSON object
Definition: json_wr.c:1642
NCX_BT_EXTERN
@ NCX_BT_EXTERN
not a real type, points fo file for contents
Definition: ncxtypes.h:230
ncx_file_close
void ncx_file_close(FILE *fp)
Close a file; check result.
Definition: ncx.c:13235
XML_MSG_GET2_TARGET
#define XML_MSG_GET2_TARGET(M)
GET2 request target terminal node.
Definition: xml_msg.h:270
json_wr_max_check_val
status_t json_wr_max_check_val(ses_cb_t *scb, xml_msg_hdr_t *msg, xmlns_id_t parent_nsid, val_value_t *val, int32 startindent, val_nodetest_fn_t testfn, boolean isfirst, boolean islast, boolean isfirstchild, boolean isfirstsibling, boolean force_lastsibling, boolean force_lastsib_value, boolean force_array_obj)
generate entire val_value_t *w/filter)
Definition: json_wr.c:1955
ses_free_scb
void ses_free_scb(ses_cb_t *scb)
Free a session control block.
Definition: ses.c:2221
SET_ERROR
#define SET_ERROR(E)
macro SET_ERROR
Definition: status_enum.h:103
ses_putstr
void ses_putstr(ses_cb_t *scb, const xmlChar *str)
Write a zero-terminated string to the session.
Definition: ses.c:2460
json_wr_full_check_val_force
status_t json_wr_full_check_val_force(ses_cb_t *scb, xml_msg_hdr_t *msg, xmlns_id_t parent_nsid, val_value_t *val, int32 startindent, val_nodetest_fn_t testfn, xmlns_id_t force_nsid, const xmlChar *force_name)
generate entire val_value_t *w/filter)
Definition: json_wr.c:2667
NCX_BT_DECIMAL64
@ NCX_BT_DECIMAL64
decimal64
Definition: ncxtypes.h:215
ERR_FIL_OPEN
@ ERR_FIL_OPEN
system errors start at 100
Definition: status_enum.h:212
WILDCARD_STRING
#define WILDCARD_STRING
yangcli test-suite allows wildcards in leafy nodes using the wildcar string
Definition: ncxconst.h:1678
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
json_wr_check_open_file
status_t json_wr_check_open_file(FILE *fp, val_value_t *val, int32 startindent, int32 indent, val_nodetest_fn_t testfn)
Write the specified value to an open FILE in JSON format.
Definition: json_wr.c:2711
obj_is_root
boolean obj_is_root(const obj_template_t *obj)
Check if object is marked as a root object.
Definition: obj.c:14152
status.h
Global error messages for status code enumerations.
yangapi.h
YANG-API definitions (pre-RESTCONF)
obj_get_nsid
xmlns_id_t obj_get_nsid(const obj_template_t *obj)
Get the namespace ID for this object.
Definition: obj.c:12395
dlq.h
dlq provides general double-linked list and queue support:
val_write_extern
void val_write_extern(ses_cb_t *scb, const val_value_t *val)
Write an external file to the session.
Definition: val_util.c:5982
json_wr_start_object_ex
void json_wr_start_object_ex(ses_cb_t *scb, xml_msg_hdr_t *msg, const xmlChar *modname, const xmlChar *name, int32 startindent, boolean startbrace, boolean endbrace)
generate start of a JSON object (extended version)
Definition: json_wr.c:1478