yumapro  20.10-12
YumaPro SDK
agt_restcmn.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 #if defined (WITH_YANGAPI) || defined(WITH_RESTCONF) || defined(WITH_YCONTROL)
13 #ifndef _H_agt_restcmn
14 #define _H_agt_restcmn
15 
16 
17 /* FILE: agt_restcmn.h
18 *********************************************************************
19 * *
20 * P U R P O S E *
21 * *
22 *********************************************************************/
23 
30 /*********************************************************************
31 * *
32 * C H A N G E H I S T O R Y *
33 * *
34 *********************************************************************
35 
36 date init comment
37 ----------------------------------------------------------------------
38 30-jul-15 abb Begun.
39 
40 
41 *********************************************************************
42 * *
43 * I N C L U D E F I L E S *
44 * *
45 *********************************************************************/
46 
47 #ifndef _H_ses
48 #include "ses.h"
49 #endif
50 
51 #ifndef _H_status
52 #include "status.h"
53 #endif
54 
55 #ifndef _H_yangapi
56 #include "yangapi.h"
57 #endif
58 
59 #ifndef _H_yang_patch
60 #include "yang_patch.h"
61 #endif
62 
63 #ifndef _H_getcb
64 #include "getcb.h"
65 #endif
66 
67 #ifdef __cplusplus
68 extern "C" {
69 #endif
70 
71 
72 /********************************************************************
73 * *
74 * C O N S T A N T S *
75 * *
76 *********************************************************************/
77 /* YANG-API specific consts */
78 #define YANG_API_MODULE NCXMOD_YANG_API
79 #define YANGAPI_WRAPPER_NODE NCX_EL_DATA
80 #define YANGPATCH_WRAPPER_NODE (const xmlChar *)"yang-patch-status"
81 #define YANG_API_REVISION NULL
82 
83 #define YANG_API_ROOT (const xmlChar *)"yang-api"
84 #define YANG_API_VERSION (const xmlChar *)"1.0"
85 #define YANG_YANG \
86  (const xmlChar *)"Please specify module name and revision"
87 
88 /* RESTCONF specific const */
89 #define RESTCONF_REVISION (const xmlChar *)"2017-01-26"
90 #define RESTCONF_YUMA_REVISION (const xmlChar *)"2015-12-03"
91 
92 #define RESTCONF_ROOT (const xmlChar *)"restconf"
93 #define RESTCONF_QMAX (const xmlChar *)"1.0"
94 
95 #define RESTCONF_CONTENT_JSON (const xmlChar *)"application/json"
96 #define RESTCONF_CONTENT_XML (const xmlChar *)"application/xml"
97 #define RESTCONF_CONTENT_TEXT_XML (const xmlChar *)"text/xml"
98 #define RESTCONF_DEF_ACCEPT_TYPE (const xmlChar *)"application/yang-data"
99 #define RESTCONF_HEADER_WILDCARD (const xmlChar *)"*/*"
100 
101 /* YANG-PATCH const */
102 #define RESTCONF_CONTENT_PATCH_XML \
103  (const xmlChar *)"application/yang-patch+xml"
104 #define RESTCONF_CONTENT_PATCH_JSON \
105  (const xmlChar *)"application/yang-patch+json"
106 
107 /* common consts */
108 
109 /* used by parse_path to URL decode a key value inline
110  * instead of mallocing the buffer
111  */
112 #define TEMP_BUFF_SIZE 1024
113 
114 #define YL_FS_SEP (const xmlChar *)"/"
115 
116 #define YANG_XRD_MEDIA (const xmlChar *)"application/xrd"
117 #define YANG_YANG_MEDIA (const xmlChar *)"application/yang"
118 #define YANG_EVENT_MEDIA (const xmlChar *)"text/event"
119 #define YANG_STREAM_SUBMEDIA (const xmlChar *)"stream"
120 #define YANG_PATCH_SUBMEDIA (const xmlChar *)"patch"
121 #define YANG_DATA_SUBMEDIA (const xmlChar *)"data"
122 #define YANG_XRD_SUBMEDIA (const xmlChar *)"xrd"
123 
124 
125 #define RESTCONF_YANG_SCHEMA (const xmlChar *)"schema"
126 /*
127 Depricated
128 #define YANG_API_SUBMEDIA (const xmlChar *)"api"
129 #define YANG_DATASTORE_SUBMEDIA (const xmlChar *)"datastore"
130 #define YANG_OPERATION_SUBMEDIA (const xmlChar *)"operation"
131 #define YANG_ERRORS_SUBMEDIA (const xmlChar *)"errors"
132 #define YANG_PATCHSTAT_SUBMEDIA (const xmlChar *)"patch-status"
133 #define YANG_PATCHSTAT_MEDIA (const xmlChar *)"application/yang.patch-status"
134 */
135 
136 
137 /* heading only */
138 
139 
140 
162 /********************************************************************
163 * *
164 * T Y P E S *
165 * *
166 *********************************************************************/
167 
171 typedef struct agt_yangapi_context_t_ {
172  ncx_module_t *mod;
173  obj_template_t *obj;
174  val_value_t *root;
175  uint32 cap_changes;
176  uint32 requests;
177  boolean yangapi_enabled;
179 } agt_yangapi_context_t;
180 
181 
184 typedef struct agt_restconf_data_t_ {
185  ncx_module_t *mod;
186  ncx_module_t *yuma_mod;
187  obj_template_t *obj;
188  val_value_t *root;
189  uint32 cap_changes;
190  uint32 requests;
193 } agt_restconf_data_t;
194 
195 
196 
197 /********************************************************************
198 * *
199 * F U N C T I O N S *
200 * *
201 *********************************************************************/
202 
203 
210 extern const xmlChar *
211  get_launchpoint_name (yangapi_launchpt_t launchpt);
212 
213 
223 extern status_t
224  agt_restcmn_parse_fragment (yangapi_cb_t *rcb,
225  xmlChar *uri,
226  uint32 *retlen);
227 
228 
240 extern status_t
241  agt_restcmn_parse_query_string (ses_cb_t *scb,
242  rpc_msg_t *msg,
243  yangapi_cb_t *rcb,
244  xmlChar *uri,
245  uint32 *retlen);
246 
247 
259 extern xmlChar *
260  agt_restcmn_get_param (yangapi_cb_t *rcb,
261  const xmlChar *name,
262  boolean *found);
263 
264 
275 extern status_t
276  agt_restcmn_validate_query_string (ses_cb_t *scb,
277  rpc_msg_t *msg,
278  yangapi_cb_t *rcb);
279 
280 
302 extern status_t
303  agt_restcmn_parse_path (ses_cb_t *scb,
304  rpc_msg_t *msg,
305  yangapi_cb_t *rcb,
306  val_value_t *root,
307  const xmlChar *path);
308 
309 
323 extern status_t
324  agt_restcmn_get_http_input (ses_cb_t *scb,
325  yangapi_cb_t *rcb,
326  rpc_msg_t *msg,
327  int content_len);
328 
329 
346 extern status_t
347  agt_restcmn_set_content_encoding (ses_cb_t *scb,
348  yangapi_cb_t *rcb,
349  rpc_msg_t *msg);
350 
351 
359 extern boolean
360  agt_restcmn_check_unmodified_return (yangapi_cb_t *rcb);
361 
362 
373 extern status_t
374  agt_restcmn_setup_notifications (ses_cb_t *scb,
375  yangapi_cb_t *rcb,
376  rpc_msg_t *msg);
377 
378 
391 extern status_t
392  agt_restcmn_setup_read_params (ses_cb_t *scb,
393  yangapi_cb_t *rcb,
394  rpc_msg_t *msg);
395 
396 
406 extern boolean
407  agt_restcmn_operation_supports_json (obj_template_t *rpcobj);
408 
409 
422 extern status_t
423  agt_restcmn_get_operations (ses_cb_t *scb,
424  getcb_mode_t cbmode,
425  const val_value_t *virval,
426  val_value_t *dstval);
427 
428 
435 extern int
436  agt_restcmn_get_content_len (yangapi_cb_t *rcb);
437 
438 
453 extern status_t
454  agt_restcmn_validate_method (ses_cb_t *scb,
455  yangapi_cb_t *rcb,
456  rpc_msg_t *msg);
457 
458 
472 extern status_t
473  agt_restcmn_check_metpar_error (ses_cb_t *scb,
474  yangapi_cb_t *rcb,
475  rpc_msg_t *msg,
476  const xmlChar *parmname);
477 
478 
485 extern yangapi_method_t
486  agt_restcmn_get_method (const xmlChar *method);
487 
488 
495 extern boolean
496  agt_restcmn_method_is_read (yangapi_method_t method);
497 
498 
499 
534 extern boolean
535  agt_restcmn_validate_accept_header (ses_cb_t *scb,
536  yangapi_cb_t *rcb,
537  rpc_msg_t *msg,
538  boolean error_recorded,
539  status_t *res);
540 
541 
548 extern xmlns_id_t
549  agt_restcmn_get_nsid (ncx_protocol_t proto);
550 
551 
557 extern void
558  agt_restcmn_free_msg (rpc_msg_t *msg);
559 
560 
567 extern void
568  agt_restcmn_print_debug_line (ses_cb_t *scb,
569  yangapi_cb_t *rcb);
570 
571 
581 extern boolean
582  agt_restcmn_get_config_parm (yangapi_cb_t *rcb,
583  val_value_t *context_node);
584 
585 
592 extern val_value_t *
594 
595 
607 extern xmlChar *
608  agt_restcmn_make_uri (ses_cb_t *scb,
609  const xmlChar *target,
610  const xmlChar *edit_target);
611 
612 
621 extern xmlChar *
622  agt_restcmn_decode_url (const xmlChar *url,
623  status_t *res);
624 
625 
637 extern void
638  agt_restcmn_record_obj_error (ses_cb_t *scb,
639  rpc_msg_t *msg,
640  status_t res,
641  obj_template_t *errobj,
642  const xmlChar *badval);
643 
644 
654 extern void
655  agt_restcmn_record_error (ses_cb_t *scb,
656  xml_msg_hdr_t *mhdr,
657  status_t res,
658  val_value_t *errnode,
659  const xmlChar *badval);
660 
661 
673 extern void
674  agt_restcmn_record_error_errinfo (ses_cb_t *scb,
675  xml_msg_hdr_t *mhdr,
676  status_t res,
677  val_value_t *errnode,
678  const xmlChar *badval,
679  const ncx_errinfo_t *errinfo);
680 
681 
692 extern void
693  agt_restcmn_obj_error (ses_cb_t *scb,
694  xml_msg_hdr_t *mhdr,
695  status_t res,
696  obj_template_t *errobj,
697  const xmlChar *badval);
698 
699 
710 extern void
711  agt_restcmn_val_error (ses_cb_t *scb,
712  xml_msg_hdr_t *mhdr,
713  status_t res,
714  val_value_t *errval,
715  const xmlChar *badval);
716 
717 
723 extern const xmlChar *
725 
726 
735 extern void
736  agt_restcmn_setup_launch_point (yangapi_cb_t *rcb);
737 
738 
743 #ifdef __cplusplus
744 } /* end extern 'C' */
745 #endif
746 
747 #endif /* _H_agt_restcmn */
748 
749 #endif // (WITH_YANGAPI) || defined(WITH_RESTCONF) || defined(WITH_YCONTROL)
ses.h
NETCONF Session Common definitions module.
xpath_get_resnode_obj
obj_template_t * xpath_get_resnode_obj(xpath_resnode_t *resnode)
Get the resnode object pointer from a value resnode.
Definition: xpath.c:4050
ERR_NCX_SKIPPED
@ ERR_NCX_SKIPPED
2001
Definition: status_enum.h:551
xml_strlen
uint32 xml_strlen(const xmlChar *str)
Get the String len for xmlChar.
Definition: xml_util.c:1406
ERR_NCX_QPARAM_NOT_ALLOWED
@ ERR_NCX_QPARAM_NOT_ALLOWED
391
Definition: status_enum.h:434
NCX_NT_STRING
@ NCX_NT_STRING
xmlChar *, error only
Definition: ncxtypes.h:279
ERR_NCX_EXTRA_NODE
@ ERR_NCX_EXTRA_NODE
281
Definition: status_enum.h:324
cfg.h
agt_restcmn_get_http_input
status_t agt_restcmn_get_http_input(ses_cb_t *scb, yangapi_cb_t *rcb, rpc_msg_t *msg, int content_len)
Get the input from the session input buffers and parse it as the specified target object type.
Definition: agt_restcmn.c:5380
xpath_free_pcb
void xpath_free_pcb(xpath_pcb_t *pcb)
Free a malloced XPath parser control block.
Definition: xpath.c:2963
agt_restcmn_free_msg
void agt_restcmn_free_msg(rpc_msg_t *msg)
Free an rpc_msg_t.
Definition: agt_restcmn.c:6899
agt_restcmn_setup_read_params
status_t agt_restcmn_setup_read_params(ses_cb_t *scb, yangapi_cb_t *rcb, rpc_msg_t *msg)
Setup the message parameters from the yangapi_cb values.
Definition: agt_restcmn.c:5681
ncx_decode_url_string
status_t ncx_decode_url_string(const xmlChar *urlstr, uint32 urlstrlen, xmlChar *buffer, uint32 *cnt)
Fill buffer with a plain string from a URL string.
Definition: ncx.c:10822
ncx_next_submodule
ncx_module_t * ncx_next_submodule(ncx_module_t *mod, ncx_module_t *submod)
Get the next submodule in the specified main module.
Definition: ncx.c:12220
agt_restconf.h
IETF RESTCONF Protocol Message Handler.
YANGAPI_LAUNCHPT_YANG_PLAIN
@ YANGAPI_LAUNCHPT_YANG_PLAIN
RESTCONF 'schema' resource class.
Definition: yangapi.h:158
ncx_convert_dec64
status_t ncx_convert_dec64(const xmlChar *numstr, ncx_numfmt_t numfmt, uint8 digits, ncx_num_t *val)
Convert a number string to a decimal64 number.
Definition: ncx_num.c:1039
agt_ses.h
Server Session Management.
agt_util.h
Utility Functions for NCX Server method routines.
xpath_first_resnode_valptr
val_value_t * xpath_first_resnode_valptr(xpath_resnode_t *resnode)
Get the first result in the renodeQ from a result struct.
Definition: xpath.c:3982
agt_restconf_data_t_::requests
uint32 requests
limit in the EVAL_VERSION
Definition: agt_restcmn.h:190
agt_restcmn_get_method
yangapi_method_t agt_restcmn_get_method(const xmlChar *method)
Get the HTTP method enum from the string.
Definition: agt_restcmn.c:6297
tk_new_chain
tk_chain_t * tk_new_chain(void)
Allocatate a new token parse chain.
Definition: tk.c:2919
xml_strdup
xmlChar * xml_strdup(const xmlChar *copyFrom)
String duplicate for xmlChar.
Definition: xml_util.c:1553
ncx_decode_num
status_t ncx_decode_num(const xmlChar *numstr, ncx_btype_t btyp, ncx_num_t *retnum)
Handle some sort of number string.
Definition: ncx_num.c:1288
YANGAPI_LAUNCHPT_MODULE
@ YANGAPI_LAUNCHPT_MODULE
modules/module launch point
Definition: yangapi.h:146
ERR_NCX_RESOURCE_UNKNOWN
@ ERR_NCX_RESOURCE_UNKNOWN
385
Definition: status_enum.h:428
val_find_meta
val_value_t * val_find_meta(val_value_t *val, xmlns_id_t nsid, const xmlChar *name)
Get the corresponding meta data node.
Definition: val.c:5532
xpath_next_resnode_valptr
val_value_t * xpath_next_resnode_valptr(xpath_resnode_t *resnode, val_value_t *valptr)
Get the next node val pointer from a result node struct.
Definition: xpath.c:4017
xml_clean_node
void xml_clean_node(xml_node_t *node)
Clean an xml_node_t struct.
Definition: xml_util.c:266
xml_msg_set_tstamp
void xml_msg_set_tstamp(xml_msg_hdr_t *msg, time_t tstamp, boolean test_sense)
Set the timestamp match parameters.
Definition: xml_msg.c:1581
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
YANGAPI_LAUNCHPT_DATA
@ YANGAPI_LAUNCHPT_DATA
/restconf/data/foo launch point
Definition: yangapi.h:137
tstamp_convert_to_utctime
xmlChar * tstamp_convert_to_utctime(const xmlChar *timestr, boolean *isNegative, status_t *res)
Check if the specified string is a valid dateTime or date-and-time string is valid and if so,...
Definition: tstamp.c:298
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
OP_INSOP_AFTER
@ OP_INSOP_AFTER
insert after foo
Definition: op.h:142
agt_yangapi_edit.h
Yuma REST API Edit Handler.
agt_restcmn_setup_notifications
status_t agt_restcmn_setup_notifications(ses_cb_t *scb, yangapi_cb_t *rcb, rpc_msg_t *msg)
setup the notification delivery on this GET request
Definition: agt_restcmn.c:5576
ERR_NCX_DEF_NOT_FOUND
@ ERR_NCX_DEF_NOT_FOUND
250
Definition: status_enum.h:289
xpath_need_get2_processing
boolean xpath_need_get2_processing(xpath_result_t *result)
Check if the result nodeset contains any XP_RNT_GET2 nodes.
Definition: xpath.c:4783
agt_output_schema
status_t agt_output_schema(ses_cb_t *scb, rpc_msg_t *msg, int32 indent)
generate the YANG file contents for the get-schema operation
Definition: agt_util.c:3001
OP_INSOP_BEFORE
@ OP_INSOP_BEFORE
insert before foo
Definition: op.h:141
log_error
void log_error(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_ERROR log entry.
obj_is_rpc
boolean obj_is_rpc(const obj_template_t *obj)
Check if the object is an RPC method.
Definition: obj.c:13983
NCX_MSG_ENCODING_XML
@ NCX_MSG_ENCODING_XML
XML message encoding.
Definition: ncxtypes.h:477
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
tk_setup_chain_json_buffs
void tk_setup_chain_json_buffs(tk_chain_t *tkc, tk_getline_fn_t getline_fn, void *cookie)
Setup a previously allocated chain for a JSON buffer chain.
Definition: tk.c:3139
agt_yangapi_context_t_::root
val_value_t * root
template for retrieval
Definition: agt_restcmn.h:178
val.h
Value Node Basic Support.
NCX_WITHDEF_NONE
@ NCX_WITHDEF_NONE
not set
Definition: ncxtypes.h:1011
xml_util.h
XML Utilities.
ncx_get_first_module
ncx_module_t * ncx_get_first_module(void)
Get the first module in the ncx_modQ.
Definition: ncx.c:4729
NCX_DEF_ENCODING
#define NCX_DEF_ENCODING
default encoding
Definition: ncxconst.h:319
getcb.h
GET1 and GET2 Callback Support.
obj_next_key
obj_key_t * obj_next_key(obj_key_t *objkey)
Get the next key record.
Definition: obj.c:9559
ERR_NCX_EXTRA_VAL_INST
@ ERR_NCX_EXTRA_VAL_INST
311
Definition: status_enum.h:354
xpath_new_pcb
xpath_pcb_t * xpath_new_pcb(const xmlChar *xpathstr, xpath_getvar_fn_t getvar_fn)
malloc a new XPath parser control block
Definition: xpath.c:2739
AGT_RPC_PH_PARSE
@ AGT_RPC_PH_PARSE
(1) NO CB FOR THIS STATE
Definition: agt_rpc.h:124
ERR_NCX_DATA_EXISTS
@ ERR_NCX_DATA_EXISTS
271
Definition: status_enum.h:312
agt_rpc.h
NETCONF protocol remote procedure call server-side definitions.
op_insertop_id
op_insertop_t op_insertop_id(const xmlChar *opstr)
Get the ID for the insert operation from its keyword.
Definition: op.c:234
xpath_cvt_boolean
boolean xpath_cvt_boolean(const xpath_result_t *result)
Convert an XPath result to a boolean answer.
Definition: xpath.c:3630
NCX_LAYER_OPERATION
@ NCX_LAYER_OPERATION
protocol operation layer
Definition: ncxtypes.h:346
obj_first_key
obj_key_t * obj_first_key(obj_template_t *obj)
Get the first key record.
Definition: obj.c:9472
RESTCONF_CONTENT_ALL
@ RESTCONF_CONTENT_ALL
all descendant data nodes
Definition: yangapi.h:217
YANGAPI_LAUNCHPT_OPERATION
@ YANGAPI_LAUNCHPT_OPERATION
/restconf/operations/some-operation launch point
Definition: yangapi.h:152
ERR_NCX_MULTIPLE_MATCHES
@ ERR_NCX_MULTIPLE_MATCHES
381
Definition: status_enum.h:424
obj_is_rpc_root
boolean obj_is_rpc_root(const obj_template_t *obj)
Check if object is marked as an RPC root object.
Definition: obj.c:14182
NCX_PROTO_NETCONF11
@ NCX_PROTO_NETCONF11
RFC 6241 base:1.1.
Definition: ncxtypes.h:784
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_restcmn_validate_method
status_t agt_restcmn_validate_method(ses_cb_t *scb, yangapi_cb_t *rcb, rpc_msg_t *msg)
validate that the method is supported for the URI given.
Definition: agt_restcmn.c:5946
tk_dump_chain
void tk_dump_chain(const tk_chain_t *tkc)
Debug printf the token chain !!! Very verbose !!!
Definition: tk.c:3532
xml_wr.h
XML Write functions.
ncx_num.h
NCX Module Library Number Utility Functions.
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
NCX_MATCH_FIRST
@ NCX_MATCH_FIRST
match all chars case-insensitive, return first match
Definition: ncxtypes.h:531
YANGAPI_LAUNCHPT_YANGLIB_VERSION
@ YANGAPI_LAUNCHPT_YANGLIB_VERSION
/restconf/yang-library-version launch point
Definition: yangapi.h:173
agt_restconf_data_t_::obj
obj_template_t * obj
/restconf container
Definition: agt_restcmn.h:187
agt_restcmn_record_error
void agt_restcmn_record_error(ses_cb_t *scb, xml_msg_hdr_t *mhdr, status_t res, val_value_t *errnode, const xmlChar *badval)
Record an rpc-error for YANG-API/RESTCONF response translation.
Definition: agt_restcmn.c:7326
agt_yangapi_context_t_::mod_nsid
xmlns_id_t mod_nsid
module namespace ID
Definition: agt_restcmn.h:182
ERR_NCX_HEADER_NOT_ALLOWED
@ ERR_NCX_HEADER_NOT_ALLOWED
393
Definition: status_enum.h:436
agt_restcmn_get_content_len
int agt_restcmn_get_content_len(yangapi_cb_t *rcb)
Get the content length for the input request message body.
Definition: agt_restcmn.c:5913
ERR_NCX_UNEXPECTED_INSERT_ATTRS
@ ERR_NCX_UNEXPECTED_INSERT_ATTRS
351
Definition: status_enum.h:394
val_add_defaults
status_t val_add_defaults(val_value_t *val, boolean scriptmode)
Add defaults to an initialized complex value.
Definition: val_util.c:2692
agt_restcmn_record_obj_error
void agt_restcmn_record_obj_error(ses_cb_t *scb, rpc_msg_t *msg, status_t res, obj_template_t *errobj, const xmlChar *badval)
Record an rpc-error for YANG-API/RESTCONF response translation the error node is an object,...
Definition: agt_restcmn.c:7282
agt_xml.h
NETCONF Server XML Reader interface.
ncx_init_num
void ncx_init_num(ncx_num_t *num)
Init a ncx_num_t struct.
Definition: ncx_num.c:162
agt_match_etag_binary
boolean agt_match_etag_binary(val_value_t *val, ncx_etag_t etag)
Check if the etag matches the specified value string.
Definition: agt_util.c:5478
NCN_MODULE
#define NCN_MODULE
Internal notifications module.
Definition: ncxconst.h:74
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.
agt_not.h
NETCONF Notifications DM module support.
xpath_yang_make_instanceid_val
val_value_t * xpath_yang_make_instanceid_val(xpath_pcb_t *pcb, status_t *retres, val_value_t **deepest)
Make a value subtree out of an instance-identifier Used by yangcli to send PDUs from CLI target param...
Definition: xpath_yang.c:2838
agt_yangapi_context_t_::yangapi_enabled
boolean yangapi_enabled
YANG-API protocol OK.
Definition: agt_restcmn.h:181
NCX_PROTO_YUMA_YANGAPI
@ NCX_PROTO_YUMA_YANGAPI
YumaPro YANG-API 1.0.
Definition: ncxtypes.h:785
NCX_PROTO_YUMA_CLI
@ NCX_PROTO_YUMA_CLI
YumaPro Internal CLI 1.0.
Definition: ncxtypes.h:786
agt_yangapi.h
Yuma REST API Message Handler.
agt_restconf_validate_method_params
status_t agt_restconf_validate_method_params(ses_cb_t *scb, yangapi_cb_t *rcb, rpc_msg_t *msg)
validate that the operation is supported for the URI parameters given.
Definition: agt_restconf.c:1618
xml_stricmp
int xml_stricmp(const xmlChar *s1, const xmlChar *s2)
Case insensitive string compare for xmlChar.
Definition: xml_util.c:1785
NCX_DC_CONFIG
@ NCX_DC_CONFIG
persistent config
Definition: ncxtypes.h:192
agt_library_find_module
ncxmod_search_result_t * agt_library_find_module(const xmlChar *modname, const xmlChar *version)
Find the first instance of (modname, version)
Definition: agt_library.c:292
agt_restcmn_check_unmodified_return
boolean agt_restcmn_check_unmodified_return(yangapi_cb_t *rcb)
Check if the context node(s) will match the filters (if any)
Definition: agt_restcmn.c:5511
YANGAPI_LAUNCHPT_NONE
@ YANGAPI_LAUNCHPT_NONE
not set
Definition: yangapi.h:128
cfg_get_root
val_value_t * cfg_get_root(ncx_cfg_t cfgid)
Get the config root for the specified config.
Definition: cfg.c:3240
agt_restcmn_get_config_parm
boolean agt_restcmn_get_config_parm(yangapi_cb_t *rcb, val_value_t *context_node)
Get the value of the config parm to use.
Definition: agt_restcmn.c:7100
NCX_NF_DEC
@ NCX_NF_DEC
YANG deciaml format.
Definition: ncxtypes.h:335
xml_copy_clean_string
xmlChar * xml_copy_clean_string(const xmlChar *str)
Get a malloced string contained the converted string from the input.
Definition: xml_util.c:2119
agt_yangapi_context_t_::requests
uint32 requests
limit in the EVAL_VERSION
Definition: agt_restcmn.h:180
SES_TRANSPORT_COAP
@ SES_TRANSPORT_COAP
CoAP UDP socket.
Definition: ses.h:343
val_set_xpathpcb
status_t val_set_xpathpcb(val_value_t *val, xpath_pcb_t *xpathpcb)
Set the xpathpcb field with passed field;.
Definition: val_util.c:4324
obj_is_list
boolean obj_is_list(const obj_template_t *obj)
Check if object is a YANG list.
Definition: obj.c:13349
obj_is_action
boolean obj_is_action(const obj_template_t *obj)
Check if the object is a YANG 1.1 action.
Definition: obj.c:14028
agt_restcmn_parse_fragment
status_t agt_restcmn_parse_fragment(yangapi_cb_t *rcb, xmlChar *uri, uint32 *retlen)
parse the request URI fragment
Definition: agt_restcmn.c:3898
xmlns_id_t
uint16 xmlns_id_t
integer handle for registered namespaces
Definition: xmlns.h:89
log_info
void void void void void log_info(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_INFO log entry.
OP_FILTER_XPATH
@ OP_FILTER_XPATH
XPath filter.
Definition: op.h:117
agt_record_error
void agt_record_error(ses_cb_t *scb, xml_msg_hdr_t *msghdr, ncx_layer_t layer, status_t res, const xml_node_t *xmlnode, ncx_node_t parmtyp, const void *error_info, ncx_node_t nodetyp, void *error_path)
Generate an rpc_err_rec_t and save it in the msg.
Definition: agt_util.c:1942
ses_free_xml_reader
void ses_free_xml_reader(ses_cb_t *scb)
Free the xmlTextReader for the session The encoding is switching from XML to something else.
Definition: ses.c:4180
NCX_LAYER_RPC
@ NCX_LAYER_RPC
RPC operation layer.
Definition: ncxtypes.h:345
ERR_NCX_MISSING_PARM
@ ERR_NCX_MISSING_PARM
233
Definition: status_enum.h:272
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.
agt_json_parse.h
JSON input stream parser module.
xpath1.h
XPath 1.0 expression support.
agt_yangapi_context_t_::mod
ncx_module_t * mod
yang-api module
Definition: agt_restcmn.h:176
obj_find_child_ex
obj_template_t * obj_find_child_ex(obj_template_t *obj, const xmlChar *modname, const xmlChar *objname, ncx_name_match_t match_names, boolean alt_names, boolean dataonly, status_t *retres)
Find a child object with the specified Qname extended match modes.
Definition: obj.c:6296
NCX_DISPLAY_MODE_NONE
@ NCX_DISPLAY_MODE_NONE
not set
Definition: ncxtypes.h:448
ERR_NCX_UNKNOWN_QUERY_PARM
@ ERR_NCX_UNKNOWN_QUERY_PARM
404
Definition: status_enum.h:447
yangapi_clean_keyvalQ
void yangapi_clean_keyvalQ(yangapi_cb_t *rcb)
Clean the key value Q in a request control block.
Definition: yangapi.c:244
NO_ERR
@ NO_ERR
000
Definition: status_enum.h:188
xpath.h
Schema and data model Xpath search support.
obj_get_real_level
uint32 obj_get_real_level(const obj_template_t *obj)
Get the nest level for the specified object Top-level is '1' Does not count groupings as a level Does...
Definition: obj.c:11871
NCX_PROTO_RESTCONF
@ NCX_PROTO_RESTCONF
IETF RESTCONF.
Definition: ncxtypes.h:788
xml_val.h
Utility functions for creating value structs.
NCX_BT_UINT64
@ NCX_BT_UINT64
uint64
Definition: ncxtypes.h:214
xpath_discard_resnode
void xpath_discard_resnode(xpath_resnode_t *resnode)
Discard a result node.
Definition: xpath.c:4616
obj_force_root
void obj_force_root(obj_template_t *obj)
Set the object as an anydata type of root.
Definition: obj.c:14168
agt_json_parse_text
status_t agt_json_parse_text(ses_cb_t *scb, xml_msg_hdr_t *msg, obj_template_t *obj, dlq_hdr_t *returnQ)
Parse token chain representing JSON Text.
Definition: agt_json_parse.c:175
YANGAPI_LAUNCHPT_OPERATIONS
@ YANGAPI_LAUNCHPT_OPERATIONS
/restconf/operations launch point
Definition: yangapi.h:149
getcb_new_get2_lookup
getcb_get2_lookup_t * getcb_new_get2_lookup(obj_template_t *obj, dlq_hdr_t *keyvalQ)
Create a new getcb_get2_lookup struct.
Definition: getcb.c:7865
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_strndup
xmlChar * xml_strndup(const xmlChar *copyFrom, uint32 maxlen)
String duplicate for max N xmlChars.
Definition: xml_util.c:1663
val_dump_value
void val_dump_value(val_value_t *val, int32 startindent, log_debug_t lvl)
Printf the specified val_value_t struct to the logfile, or stdout if none set Uses conf file format (...
Definition: val.c:5688
ERR_NCX_INVALID_CONT_TYPE
@ ERR_NCX_INVALID_CONT_TYPE
403
Definition: status_enum.h:446
agt_restcmn_entry_point
const xmlChar * agt_restcmn_entry_point(void)
Get the RESTCONF entry point name.
Definition: agt_restcmn.c:7482
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
agt_ncx.h
NETCONF Server standard method routines.
ses_get_protocol
ncx_protocol_t ses_get_protocol(const ses_cb_t *scb)
Get the NETCONF protocol set (or unset) for this session.
Definition: ses.c:3854
ERR_NCX_OPERATION_FAILED
@ ERR_NCX_OPERATION_FAILED
274
Definition: status_enum.h:315
LOGDEBUG2
#define LOGDEBUG2
Check if at least log-level=debug2.
Definition: log.h:292
xpath_free_result
void xpath_free_result(xpath_result_t *result)
Free a malloced XPath result struct.
Definition: xpath.c:3107
dlq_createSQue
void dlq_createSQue(dlq_hdrT *queAddr)
create a static queue header
Definition: dlq.c:177
val_is_config_data
boolean val_is_config_data(const val_value_t *val)
Check if the specified value is a config DB object instance.
Definition: val.c:11157
ERR_INTERNAL_VAL
@ ERR_INTERNAL_VAL
004
Definition: status_enum.h:194
agt_rpc_parse_rpc_input
status_t agt_rpc_parse_rpc_input(ses_cb_t *scb, rpc_msg_t *msg, obj_template_t *rpcobj, xml_node_t *method)
RPC received, parse parameters against rpcio for 'input'.
Definition: agt_rpc.c:3877
obj_has_children
boolean obj_has_children(obj_template_t *obj)
Check if there are any accessible nodes within the object.
Definition: obj.c:14831
xmlns_find_ns_by_module
xmlns_id_t xmlns_find_ns_by_module(const xmlChar *modname)
Find the NS ID from its module name that registered it.
Definition: xmlns.c:712
ncx_match_any_object_ex
obj_template_t * ncx_match_any_object_ex(const xmlChar *modname, const xmlChar *objname, boolean dataonly, ncx_name_match_t name_match, boolean alt_names, status_t *retres)
Match any object in any YANG module with double extra search options.
Definition: ncx.c:4171
agt_restcmn_get_param
xmlChar * agt_restcmn_get_param(yangapi_cb_t *rcb, const xmlChar *name, boolean *found)
Find a query parameter and return its value.
Definition: agt_restcmn.c:4049
val_child_add
status_t val_child_add(val_value_t *child, val_value_t *parent)
Add a child value node to a parent value node.
Definition: val_child.c:1542
val_util.h
Value Node Utilities.
agt_restcmn_parse_path
status_t agt_restcmn_parse_path(ses_cb_t *scb, rpc_msg_t *msg, yangapi_cb_t *rcb, val_value_t *root, const xmlChar *path)
parse the request URI path
Definition: agt_restcmn.c:4593
json_wr.h
JSON Write functions.
xpath1_eval_expr
xpath_result_t * xpath1_eval_expr(xpath_pcb_t *pcb, val_value_t *val, val_value_t *docroot, boolean logerrors, boolean configonly, status_t *res)
Evaluate an XPath expression use if the prefixes are YANG: must/when.
Definition: xpath1.c:5293
agt_val_instance_check
status_t agt_val_instance_check(ses_cb_t *scb, xml_msg_hdr_t *msg, val_value_t *valset, val_value_t *valroot, ncx_layer_t layer)
Check for the proper number of object instances for the specified value struct.
Definition: agt_val.c:12799
YANGAPI_LAUNCHPT_NEW_DATA
@ YANGAPI_LAUNCHPT_NEW_DATA
/restconf/data/foo/new-bar launch point
Definition: yangapi.h:140
NCX_MSG_ENCODING_JSON
@ NCX_MSG_ENCODING_JSON
JSON message encoding.
Definition: ncxtypes.h:480
ERR_NCX_INVALID_VALUE
@ ERR_NCX_INVALID_VALUE
258
Definition: status_enum.h:299
ncx_is_true
boolean ncx_is_true(const xmlChar *str)
Check if an xmlChar string is a string OK for XSD boolean.
Definition: ncx.c:7691
agt_restcmn_decode_url
xmlChar * agt_restcmn_decode_url(const xmlChar *url, status_t *res)
Decode URL encoded string value into string.
Definition: agt_restcmn.c:7225
agt_sil_lib.h
Server Instrumentation Library Support.
agt_restcmn_record_error_errinfo
void agt_restcmn_record_error_errinfo(ses_cb_t *scb, xml_msg_hdr_t *mhdr, status_t res, val_value_t *errnode, const xmlChar *badval, const ncx_errinfo_t *errinfo)
Record an rpc-error for YANG-API/RESTCONF response translation.
Definition: agt_restcmn.c:7357
YANGAPI_LAUNCHPT_EVENTS
@ YANGAPI_LAUNCHPT_EVENTS
events launch point
Definition: yangapi.h:170
YANGAPI_LAUNCHPT_TOP
@ YANGAPI_LAUNCHPT_TOP
/restconf launch point
Definition: yangapi.h:131
agt_yangapi_context_t_::cap_changes
uint32 cap_changes
not used yet
Definition: agt_restcmn.h:179
rpc.h
NETCONF protocol remote procedure call common definitions.
ncx_get_next_module_all
ncx_module_t * ncx_get_next_module_all(const ncx_module_t *mod)
Get the first module entry in the ncx_modQ.
Definition: ncx.c:4779
agt_restconf_data_t_
RESTCONF structure for data.
Definition: agt_restcmn.h:184
ERR_INTERNAL_MEM
@ ERR_INTERNAL_MEM
003
Definition: status_enum.h:193
agt_restconf_data_t_::mod
ncx_module_t * mod
ietf-restconf module
Definition: agt_restcmn.h:185
agt_restconf_data_t_::restconf_enabled
boolean restconf_enabled
RESTCONF protocol OK.
Definition: agt_restcmn.h:191
val_child.h
Value Node Child Access Support.
ncx_get_modversion
const xmlChar * ncx_get_modversion(const ncx_module_t *mod)
Get the [sub]module version.
Definition: ncx.c:4871
OP_INSOP_NONE
@ OP_INSOP_NONE
not set
Definition: op.h:138
get_error_string
const char * get_error_string(status_t res)
Get the error message for a specific internal error.
Definition: status.c:239
yangapi_get_content_enum
restconf_content_t yangapi_get_content_enum(const xmlChar *content)
Get the enum for the content query parameter from the query URI part.
Definition: yangapi.c:611
agt_modified_since
boolean agt_modified_since(val_value_t *val, time_t *timerec)
Check if the timestamp for the object is later then the specified timestamp.
Definition: agt_util.c:5501
agt_restcmn_operation_supports_json
boolean agt_restcmn_operation_supports_json(obj_template_t *rpcobj)
Check if the NETCONF operation supports JSON output.
Definition: agt_restcmn.c:5827
ERR_NCX_MISSING_ATTRIBUTE
@ ERR_NCX_MISSING_ATTRIBUTE
260
Definition: status_enum.h:301
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.
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.
xml_msg_set_encoding
void xml_msg_set_encoding(xml_msg_hdr_t *msg, boolean is_output, ncx_display_mode_t encoding)
Set the message encoding value.
Definition: xml_msg.c:1481
yang_patch.h
YANG Patch Media Type.
YANG_K_ACTION
#define YANG_K_ACTION
YANG keyword/YIN element names.
Definition: yangconst.h:108
dlq_nextEntry
#define dlq_nextEntry(nodeP)
get the next queue entry after the current entry
Definition: dlq.h:265
agt_restconf_data_t_::cap_changes
uint32 cap_changes
capability set
Definition: agt_restcmn.h:189
agt_yangapi_validate_method_params
status_t agt_yangapi_validate_method_params(ses_cb_t *scb, yangapi_cb_t *rcb, rpc_msg_t *msg)
validate that the operation is supported for the URI parameters given.
Definition: agt_yangapi.c:1630
SES_IN_ENCODING
#define SES_IN_ENCODING(S)
get the inbound message encoding
Definition: ses.h:129
NCX_PROTO_YCONTROL
@ NCX_PROTO_YCONTROL
YumaPro Internal Control 1.0.
Definition: ncxtypes.h:787
agt_restcmn_method_is_read
boolean agt_restcmn_method_is_read(yangapi_method_t method)
Check if this is a read method.
Definition: agt_restcmn.c:6332
agt_new_xpath_pcb
xpath_pcb_t * agt_new_xpath_pcb(ses_cb_t *scb, const xmlChar *expr, status_t *res)
Get a new XPath parser control block and set up the server variable bindings.
Definition: agt_util.c:4172
YANGAPI_LAUNCHPT_YANG
@ YANGAPI_LAUNCHPT_YANG
YANG launch point.
Definition: yangapi.h:155
xpath_add_to_result
status_t xpath_add_to_result(xpath_result_t *source, xpath_result_t *target)
Move the resnodes from 1 XPath result to another.
Definition: xpath.c:4565
GETCB_GET_VALUE
@ GETCB_GET_VALUE
GET request.
Definition: getcb.h:247
agt_yangapi_reply.h
RESTCONF Reply Handler.
ncx_first_submodule
ncx_module_t * ncx_first_submodule(ncx_module_t *mod)
Get the first submodule in the specified main module.
Definition: ncx.c:12188
agt_restcmn.h
Common function for RESTCONF and YANG-API protocols.
val_find_list_from_keyvalQ
val_value_t * val_find_list_from_keyvalQ(val_value_t *parentval, val_value_t *firstmatch, dlq_hdr_t *keyvalQ, status_t *res)
Find the list entry identified by the Q of yangapi_keyval_t strings.
Definition: val_util.c:6508
agt_val_parse_nc
status_t agt_val_parse_nc(ses_cb_t *scb, xml_msg_hdr_t *msg, obj_template_t *obj, const xml_node_t *startnode, ncx_data_class_t parentdc, val_value_t *retval)
Parse NETCONF PDU sub-contents into value fields.
Definition: agt_val_parse.c:118
get_launchpoint_name
const xmlChar * get_launchpoint_name(yangapi_launchpt_t launchpt)
Get the keyword for the specified launchpt.
Definition: agt_restcmn.c:3842
YANGAPI_METHOD_NONE
@ YANGAPI_METHOD_NONE
not set
Definition: yangapi.h:116
xpath_yang.h
YANG-specific Xpath support.
ncx_get_withdefaults_enum
ncx_withdefaults_t ncx_get_withdefaults_enum(const xmlChar *withdefstr)
Get the enum for the specified string value.
Definition: ncx.c:8844
obj_rpc_has_output
boolean obj_rpc_has_output(obj_template_t *obj)
Check if the RPC object has any real output children.
Definition: obj.c:14967
ERR_NCX_OPERATION_NOT_SUPPORTED
@ ERR_NCX_OPERATION_NOT_SUPPORTED
273
Definition: status_enum.h:314
xml_msg.h
XML and JSON Message send and receive support.
agt_rpc_get_first_backptr
ncx_backptr_t * agt_rpc_get_first_backptr(void)
Get the first backptr to the registered and supported RPC methods on the server.
Definition: agt_rpc.c:3787
YANGAPI_LAUNCHPT_STREAMS
@ YANGAPI_LAUNCHPT_STREAMS
streams launch point
Definition: yangapi.h:164
agt_yangapi_get_context
agt_yangapi_context_t * agt_yangapi_get_context(void)
Get the YANG-API Context structure.
Definition: agt_yangapi.c:1768
xpath_get_next_resnode
xpath_resnode_t * xpath_get_next_resnode(xpath_resnode_t *resnode)
Get the next result in the renodeQ from a result struct.
Definition: xpath.c:3959
xml_val_new_struct
val_value_t * xml_val_new_struct(const xmlChar *name, xmlns_id_t nsid)
Set up a new generic struct.
Definition: xml_val.c:323
log_debug4_append
void void void void void void void void void void void void void void log_debug4_append(const char *fstr,...) __attribute__((format(printf
Append to a LOG_DEBUG_DEBUG4 log entry.
agt_val_parse.h
XML Parameter Value Parser Module.
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
agt_not_start_subscription
status_t agt_not_start_subscription(ses_cb_t *scb, const xmlChar *stream, xmlChar *startTime, xmlChar *stopTime, boolean futurestop, op_filtertyp_t filtertype, val_value_t *filterval, val_value_t *selectval)
Malloc and fill in a new subscription control block.
Definition: agt_not.c:6477
agt_restcmn_obj_error
void agt_restcmn_obj_error(ses_cb_t *scb, xml_msg_hdr_t *mhdr, status_t res, obj_template_t *errobj, const xmlChar *badval)
Record an rpc-error for YANG-API/RESTCONF response translation.
Definition: agt_restcmn.c:7389
ncx_clean_num
void ncx_clean_num(ncx_btype_t btyp, ncx_num_t *num)
Scrub the memory in a ncx_num_t by freeing all the sub-fields.
Definition: ncx_num.c:189
agt_restcmn_val_error
void agt_restcmn_val_error(ses_cb_t *scb, xml_msg_hdr_t *mhdr, status_t res, val_value_t *errval, const xmlChar *badval)
Record an rpc-error for YANG-API/RESTCONF response translation.
Definition: agt_restcmn.c:7438
EMPTY_STRING
#define EMPTY_STRING
empty string used to get const xmlChar * cast
Definition: ncxconst.h:289
obj_find_child
obj_template_t * obj_find_child(obj_template_t *obj, const xmlChar *modname, const xmlChar *objname)
Find a child object with the specified Qname.
Definition: obj.c:6116
NCX_NT_OBJ
@ NCX_NT_OBJ
obj_template_t
Definition: ncxtypes.h:277
tstamp_datetime
void tstamp_datetime(xmlChar *buff)
Set the current date and time in an XML dateTime string format.
Definition: tstamp.c:160
xpath_get_first_resnode
xpath_resnode_t * xpath_get_first_resnode(xpath_result_t *result)
Get the first result in the renodeQ from a result struct.
Definition: xpath.c:3931
agt_xml_consume_node
status_t agt_xml_consume_node(ses_cb_t *scb, xml_node_t *node, ncx_layer_t layer, xml_msg_hdr_t *msghdr)
Consume an XML node from libxml2.
Definition: agt_xml.c:141
ERR_NCX_MISSING_ACCEPT_HEADER
@ ERR_NCX_MISSING_ACCEPT_HEADER
405
Definition: status_enum.h:448
agt_cfg_free_transaction
void agt_cfg_free_transaction(agt_cfg_transaction_t *txcb)
Clean and free a agt_cfg_transaction_t struct.
Definition: agt_cfg.c:1278
ERR_NCX_INVALID_MEDIA
@ ERR_NCX_INVALID_MEDIA
401
Definition: status_enum.h:444
xpath1_res_flatten_result
status_t xpath1_res_flatten_result(xpath_pcb_t *pcb, xpath_result_t *result)
Convert any vahdr resnodes to valptr resnodes for simplified processing.
Definition: xpath1_res.c:928
xpath1_res_get_count
int64 xpath1_res_get_count(xpath_result_t *result)
Get the number of entries in the node-set result to support the count() function.
Definition: xpath1_res.c:814
NCX_DISPLAY_MODE_PLAIN
@ NCX_DISPLAY_MODE_PLAIN
plain CLI display mode
Definition: ncxtypes.h:451
agt_restcmn_check_metpar_error
status_t agt_restcmn_check_metpar_error(ses_cb_t *scb, yangapi_cb_t *rcb, rpc_msg_t *msg, const xmlChar *parmname)
validate that the URI parameters given are supported for the method
Definition: agt_restcmn.c:6272
getcb_new_keyval3
getcb_keyval_t * getcb_new_keyval3(const xmlChar *keyval, obj_template_t *keyobj, boolean fixed_value)
Create a new Get2 keyval holder using value string.
Definition: getcb.c:7786
agt_restcmn_make_uri
xmlChar * agt_restcmn_make_uri(ses_cb_t *scb, const xmlChar *target, const xmlChar *edit_target)
Make a URI string.
Definition: agt_restcmn.c:7167
xml_strcmp
int xml_strcmp(const xmlChar *s1, const xmlChar *s2)
String compare for xmlChar.
Definition: xml_util.c:1746
xml_val_add_cattr
status_t xml_val_add_cattr(const xmlChar *name, xmlns_id_t nsid, const xmlChar *cattrval, val_value_t *val)
Set up a new attr val and add it to the specified val const version copies string.
Definition: xml_val.c:292
agt_restconf_data_t_::yuma_mod
ncx_module_t * yuma_mod
yumaworks-restconf module
Definition: agt_restcmn.h:186
xml_val_new_flag
val_value_t * xml_val_new_flag(const xmlChar *name, xmlns_id_t nsid)
Set up a new flag (NCX_NT_EMPTY)
Definition: xml_val.c:553
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
yangapi_free_param
void yangapi_free_param(yangapi_param_t *param)
Free a YANG-API parameter.
Definition: yangapi.c:128
RESTCONF_CONTENT_CONFIG
@ RESTCONF_CONTENT_CONFIG
return only configuration data nodes
Definition: yangapi.h:215
xml_msg_set_start_depth
void xml_msg_set_start_depth(xml_msg_hdr_t *msg, uint32 start_depth)
Set the message start_depth value.
Definition: xml_msg.c:1393
LOGDEBUG4
#define LOGDEBUG4
Check if at least log-level=debug4.
Definition: log.h:302
log.h
NCX System Logging Manager.
YANGAPI_METHOD_POST
@ YANGAPI_METHOD_POST
POST method.
Definition: yangapi.h:120
agt_sys.h
NETCONF system.yang DM module support.
ERR_NCX_UNKNOWN_MODULE
@ ERR_NCX_UNKNOWN_MODULE
356
Definition: status_enum.h:399
xmlns_nc_id
xmlns_id_t xmlns_nc_id(void)
Get the ID for the NETCONF namespace or 0 if it doesn't exist.
Definition: xmlns.c:880
LOGDEBUG
#define LOGDEBUG
Check if at least log-level=debug.
Definition: log.h:287
agt_restcmn_get_nsid
xmlns_id_t agt_restcmn_get_nsid(ncx_protocol_t proto)
Get the XML namespace ID for specific proto.
Definition: agt_restcmn.c:6853
agt_restconf_setup_fields_nodes
status_t agt_restconf_setup_fields_nodes(ses_cb_t *scb, yangapi_cb_t *rcb, rpc_msg_t *msg, boolean *errdone)
Setup fields nodes if parameter is used.
Definition: agt_restconf.c:1426
yangapi_new_param
yangapi_param_t * yangapi_new_param(const xmlChar *parmname, uint32 parmnamelen, const xmlChar *parmval, uint32 parmvallen)
Create a new YANGAPI paramater.
Definition: yangapi.c:89
YANGAPI_METHOD_GET
@ YANGAPI_METHOD_GET
GET method.
Definition: yangapi.h:119
xpath_get_resnodeQ
dlq_hdr_t * xpath_get_resnodeQ(xpath_result_t *result)
Get the renodeQ from a result struct.
Definition: xpath.c:3905
ERR_NCX_INVALID_FORMAT
@ ERR_NCX_INVALID_FORMAT
402
Definition: status_enum.h:445
XML_MSG_SET_DELTA
#define XML_MSG_SET_DELTA(M)
Set Delta: Not currently used - enables sub-tree time-filtering.
Definition: xml_msg.h:204
rpc_err.h
NETCONF protocol standard error definitions.
agt_val_rpc_xpath_check
status_t agt_val_rpc_xpath_check(ses_cb_t *scb, rpc_msg_t *rpcmsg, xml_msg_hdr_t *msg, val_value_t *rpcinput, obj_template_t *rpcroot)
Check for any nodes which are present but have false when-stmts associated with the node.
Definition: agt_val.c:12678
OP_FILTER_NONE
@ OP_FILTER_NONE
not set
Definition: op.h:115
OP_EDITOP_REMOVE
@ OP_EDITOP_REMOVE
remove, base:1.1 only
Definition: op.h:130
xml_strcmp_nosp2
int xml_strcmp_nosp2(const xmlChar *s1, const xmlChar *s2)
String compare for xmlChar for 2 strings, but completely ignoring whitespace differences.
Definition: xml_util.c:2043
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
NCX_NT_VAL
@ NCX_NT_VAL
val_value_t
Definition: ncxtypes.h:276
agt_cfg.h
Manage Server configuration edit transactions.
NCX_BT_UINT32
@ NCX_BT_UINT32
uint32
Definition: ncxtypes.h:213
NCX_NT_NONE
@ NCX_NT_NONE
not set
Definition: ncxtypes.h:273
tk_tokenize_input
status_t tk_tokenize_input(tk_chain_t *tkc, ncx_module_t *mod)
Parse the input (FILE or buffer) into tk_token_t structs.
Definition: tk.c:3641
dlq_empty
#define dlq_empty(listP)
check if queue list is empty
Definition: dlq.h:367
xml_val_add_attr
status_t xml_val_add_attr(const xmlChar *name, xmlns_id_t nsid, xmlChar *attrval, val_value_t *val)
Set up a new attr val and add it to the specified val hand off a malloced attribute string.
Definition: xml_val.c:252
xml_strcpy
uint32 xml_strcpy(xmlChar *copyTo, const xmlChar *copyFrom)
String copy for xmlChar.
Definition: xml_util.c:1486
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
ERR_NCX_MISSING_ELEMENT
@ ERR_NCX_MISSING_ELEMENT
263
Definition: status_enum.h:304
agt_yangapi_context_t_
module context node with cached schema tree and API template for retrieval (root)
Definition: agt_restcmn.h:171
RESTCONF_CONTENT_NONCONFIG
@ RESTCONF_CONTENT_NONCONFIG
only non-configuration data nodes
Definition: yangapi.h:216
YANGAPI_LAUNCHPT_DATASTORE
@ YANGAPI_LAUNCHPT_DATASTORE
/restconf/data launch point
Definition: yangapi.h:134
log_debug2_append
void void void void void void void void void void log_debug2_append(const char *fstr,...) __attribute__((format(printf
Append to a LOG_DEBUG_DEBUG2 log entry.
xpath_resnode_count
uint32 xpath_resnode_count(xpath_result_t *result)
Get the number of resnodes in the node-set.
Definition: xpath.c:4594
YANGAPI_LAUNCHPT_ACTION
@ YANGAPI_LAUNCHPT_ACTION
action launch point
Definition: yangapi.h:176
agt_get_profile
agt_profile_t * agt_get_profile(void)
Get the server profile struct.
Definition: agt.c:4118
YANGAPI_METHOD_HEAD
@ YANGAPI_METHOD_HEAD
HEAD method.
Definition: yangapi.h:118
RPC_DATA_STD
@ RPC_DATA_STD
STD is used by <get> and <get-config> to force a <data> container in the NETCONF namespace.
Definition: rpc.h:162
agt_rpc_post_psd_state
status_t agt_rpc_post_psd_state(ses_cb_t *scb, rpc_msg_t *msg, status_t psdres)
Fixup parmset after parse phase.
Definition: agt_rpc.c:3955
NCX_LAYER_CONTENT
@ NCX_LAYER_CONTENT
application layer
Definition: ncxtypes.h:347
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_new_value
val_value_t * val_new_value(void)
Malloc and initialize the fields in a val_value_t.
Definition: val.c:2697
VAL_OBJ
#define VAL_OBJ(V)
Access the object template.
Definition: val.h:381
agt_json_parse_top_identifier
status_t agt_json_parse_top_identifier(ses_cb_t *scb, xml_msg_hdr_t *msg, obj_template_t *obj, const xmlChar **modname, const xmlChar **name, xmlChar **tempbuff)
Parse a top-level JSON object;.
Definition: agt_json_parse.c:119
agt_rpc_get_next_backptr
ncx_backptr_t * agt_rpc_get_next_backptr(ncx_backptr_t *curptr)
Get the next backptr to the registered and supported RPC methods on the server.
Definition: agt_rpc.c:3804
ncx.h
YANG module utility functions.
YANGAPI_METHOD_PATCH
@ YANGAPI_METHOD_PATCH
PATCH method.
Definition: yangapi.h:122
agt_restcmn_set_content_encoding
status_t agt_restcmn_set_content_encoding(ses_cb_t *scb, yangapi_cb_t *rcb, rpc_msg_t *msg)
Get the content encoding used.
Definition: agt_restcmn.c:5465
agt_rpcerr.h
NETCONF protocol <rpc-error> server-side handler.
obj_get_level
uint32 obj_get_level(const obj_template_t *obj)
Get the nest level for the specified object Top-level is '1' Does not count groupings as a level.
Definition: obj.c:11833
agt_restcmn_validate_query_string
status_t agt_restcmn_validate_query_string(ses_cb_t *scb, rpc_msg_t *msg, yangapi_cb_t *rcb)
Validate the parameters in the request URI query string.
Definition: agt_restcmn.c:4083
obj.h
Data Object Support.
ncx_is_false
boolean ncx_is_false(const xmlChar *str)
Check if an xmlChar string is a string OK for XSD boolean.
Definition: ncx.c:7714
agt_restcmn_print_debug_line
void agt_restcmn_print_debug_line(ses_cb_t *scb, yangapi_cb_t *rcb)
Print the message received debug line.
Definition: agt_restcmn.c:6917
ses_getline_cb
status_t ses_getline_cb(xmlChar *fillbuff, uint32 fillbuffsize, void *cookie)
The IO input front-end for the tk_parse_json_buffs function.
Definition: ses.c:4215
TSTAMP_MIN_SIZE
#define TSTAMP_MIN_SIZE
normal minimum buffer size for a tstamp buffer
Definition: tstamp.h:67
xpath1_eval_xmlexpr
xpath_result_t * xpath1_eval_xmlexpr(xmlTextReaderPtr reader, xpath_pcb_t *pcb, val_value_t *val, val_value_t *docroot, boolean logerrors, boolean configonly, status_t *res)
Evaluate an XML document expression.
Definition: xpath1.c:5643
ses_set_out_encoding
void ses_set_out_encoding(ses_cb_t *scb, ncx_display_mode_t encoding)
Set the output encoding.
Definition: ses.c:4084
xpath1_res.h
XPath 1.0 expression support; result support.
tstamp_htmltime2time
status_t tstamp_htmltime2time(const xmlChar *timestr, time_t *timerec)
Convert the specified HTML timestamp string to time_t format.
Definition: tstamp.c:524
val_init_from_template
void val_init_from_template(val_value_t *val, struct obj_template_t_ *obj)
Initialize a value node from its object template.
xml_msg_set_withdef
void xml_msg_set_withdef(xml_msg_hdr_t *msg, ncx_withdefaults_t withdef)
Set the message withdef enum.
Definition: xml_msg.c:1325
dlq_enque
void dlq_enque(REG void *newP, REG dlq_hdrT *listP)
add a queue node to the end of a queue list Add newP to listP
Definition: dlq.c:246
ncx_convert_num
status_t ncx_convert_num(const xmlChar *numstr, ncx_numfmt_t numfmt, ncx_btype_t btyp, ncx_num_t *val)
Convert a number string to a numeric type.
Definition: ncx_num.c:717
agt_library.h
Setup the server in library mode.
yangapi_new_accept
yangapi_accept_t * yangapi_new_accept(const xmlChar *mediatype, uint32 media_type_len, const xmlChar *submediatype, uint32 submediatype_len, const xmlChar *acc_format, uint32 acc_format_len, const xmlChar *qvalue, uint32 qvalue_len)
Create a new YANGAPI paramater.
Definition: yangapi.c:154
XML_MSG_GET2_TARGET
#define XML_MSG_GET2_TARGET(M)
GET2 request target terminal node.
Definition: xml_msg.h:270
agt_restconf_get_context
agt_restconf_data_t * agt_restconf_get_context(void)
Get the RESTCONF Context structure.
Definition: agt_restconf.c:2671
xml_msg_set_etag
void xml_msg_set_etag(xml_msg_hdr_t *msg, ncx_etag_t etag, boolean test_sense)
Set the etag match parameters.
Definition: xml_msg.c:1529
ERR_NCX_METHOD_NOT_ALLOWED
@ ERR_NCX_METHOD_NOT_ALLOWED
390
Definition: status_enum.h:433
NCX_DEF_CONFIRM_TIMEOUT
#define NCX_DEF_CONFIRM_TIMEOUT
default conrm-tmieout value in seconds
Definition: ncxconst.h:484
VAL_STR
#define VAL_STR(V)
Access the value as a string ONLY if typ_is_string() is true.
Definition: val.h:464
agt_restconf_data_t_::mod_nsid
xmlns_id_t mod_nsid
module namespace iD
Definition: agt_restcmn.h:192
YANGAPI_LAUNCHPT_VERSION
@ YANGAPI_LAUNCHPT_VERSION
version launch point
Definition: yangapi.h:161
SET_ERROR
#define SET_ERROR(E)
macro SET_ERROR
Definition: status_enum.h:103
ERR_NCX_DATA_MISSING
@ ERR_NCX_DATA_MISSING
272
Definition: status_enum.h:313
xml_init_node
void xml_init_node(xml_node_t *node)
Init an xml_node_t struct.
Definition: xml_util.c:229
ERR_NCX_RESOURCE_INSTANCE_UNKNOWN
@ ERR_NCX_RESOURCE_INSTANCE_UNKNOWN
388
Definition: status_enum.h:431
agt_restconf_data_t_::root
val_value_t * root
template for retrieval
Definition: agt_restcmn.h:188
xmlns_ncx_id
xmlns_id_t xmlns_ncx_id(void)
Get the ID for the NETCONF Extensions namespace or 0 if it doesn't exist.
Definition: xmlns.c:897
YANGAPI_METHOD_OPTIONS
@ YANGAPI_METHOD_OPTIONS
OPTIONS method.
Definition: yangapi.h:117
agt_restcmn_validate_accept_header
boolean agt_restcmn_validate_accept_header(ses_cb_t *scb, yangapi_cb_t *rcb, rpc_msg_t *msg, boolean error_recorded, status_t *res)
Validate the client Accept header.
Definition: agt_restcmn.c:6396
agt_record_error_errinfo
void agt_record_error_errinfo(ses_cb_t *scb, xml_msg_hdr_t *msghdr, ncx_layer_t layer, status_t res, const xml_node_t *xmlnode, ncx_node_t parmtyp, const void *error_info, ncx_node_t nodetyp, void *error_path, const ncx_errinfo_t *errinfo)
Generate an rpc_err_rec_t and save it in the msg Use provided error fields.
Definition: agt_util.c:2051
agt_restcmn_new_config_wrapper
val_value_t * agt_restcmn_new_config_wrapper(void)
Create a <config> wrapper val and return it.
Definition: agt_restcmn.c:7131
RESTCONF_CONTENT_NONE
@ RESTCONF_CONTENT_NONE
not set
Definition: yangapi.h:214
YANGAPI_LAUNCHPT_STREAM
@ YANGAPI_LAUNCHPT_STREAM
streams/stream launch point
Definition: yangapi.h:167
agt_restcmn_parse_query_string
status_t agt_restcmn_parse_query_string(ses_cb_t *scb, rpc_msg_t *msg, yangapi_cb_t *rcb, xmlChar *uri, uint32 *retlen)
parse the request URI query string
Definition: agt_restcmn.c:3935
ERR_NCX_MISSING_INPUT
@ ERR_NCX_MISSING_INPUT
407
Definition: status_enum.h:450
NCX_DISPLAY_MODE_JSON
@ NCX_DISPLAY_MODE_JSON
JSON (RFC 7951 format)
Definition: ncxtypes.h:466
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
NCX_PROTO_NETCONF10
@ NCX_PROTO_NETCONF10
RFC 4741 base:1.0
Definition: ncxtypes.h:783
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)
YANGAPI_METHOD_PUT
@ YANGAPI_METHOD_PUT
PUT method.
Definition: yangapi.h:121
NCX_DISPLAY_MODE_XML
@ NCX_DISPLAY_MODE_XML
XML display mode.
Definition: ncxtypes.h:460
agt_yangapi_context_t_::obj
obj_template_t * obj
/yang-api container
Definition: agt_restcmn.h:177
xpath_convert_url_to_path
xmlChar * xpath_convert_url_to_path(const xmlChar *urlpath, ncx_name_match_t match_names, boolean alt_naming, boolean wildcards, boolean withkeys, boolean fullkeys, boolean withmod, ncx_protocol_t proto, status_t *res)
Convert a URL format path to XPath format path.
Definition: xpath.c:4374
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:
agt_restcmn_get_operations
status_t agt_restcmn_get_operations(ses_cb_t *scb, getcb_mode_t cbmode, const val_value_t *virval, val_value_t *dstval)
GET1 operation handler for the /operations container.
Definition: agt_restcmn.c:5858
LOGDEBUG3
#define LOGDEBUG3
Check if at least log-level=debug3.
Definition: log.h:297
getbulk.h
yumaworks-getbulk.yang data structure support
YANGAPI_METHOD_DELETE
@ YANGAPI_METHOD_DELETE
DELETE method.
Definition: yangapi.h:123
xml_msg_set_max_depth
void xml_msg_set_max_depth(xml_msg_hdr_t *msg, uint32 max_depth)
Set the message max_depth value.
Definition: xml_msg.c:1359
agt_restcmn_setup_launch_point
void agt_restcmn_setup_launch_point(yangapi_cb_t *rcb)
check the parseed request URI path set the API launch point data
Definition: agt_restcmn.c:7503
YANGAPI_LAUNCHPT_MODULES
@ YANGAPI_LAUNCHPT_MODULES
modules launch point
Definition: yangapi.h:143