yumapro  20.10-12
YumaPro SDK
cap.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_cap
13 #define _H_cap
14 /* FILE: cap.h
15 *********************************************************************
16 * *
17 * P U R P O S E *
18 * *
19 *********************************************************************/
20 
26 /*********************************************************************
27 * *
28 * C H A N G E H I S T O R Y *
29 * *
30 *********************************************************************
31 
32 date init comment
33 ----------------------------------------------------------------------
34 28-apr-05 abb Begun.
35 */
36 #include <xmlstring.h>
37 
38 #ifndef _H_ncxtypes
39 #include "ncxtypes.h"
40 #endif
41 
42 #ifndef _H_status
43 #include "status.h"
44 #endif
45 
46 #ifndef _H_val
47 #include "val.h"
48 #endif
49 
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53 
54 
76 /********************************************************************
77 * *
78 * C O N S T A N T S *
79 * *
80 *********************************************************************/
81 
82 
83 #define MAX_STD_CAP_NAME_LEN 31
84 
85 #define CAP_VERSION_LEN 15
86 
88 #define CAP_BASE_URN ((const xmlChar *) \
89  "urn:ietf:params:netconf:base:1.0")
90 
92 #define CAP_BASE_URN11 ((const xmlChar *) \
93  "urn:ietf:params:netconf:base:1.1")
94 
96 #define CAP_URN ((const xmlChar *)"urn:ietf:params:netconf:capability:")
97 
99 #define CAP_REST_URN ((const xmlChar *)"urn:ietf:params:restconf:capability:")
100 
102 #define CAP_J_URN \
103  (const xmlChar *)"urn:ietf:params:xml:ns:netconf:capability:"
104 
105 #define CAP_JUNOS \
106  (const xmlChar *)"http://xml.juniper.net/netconf/junos/1.0"
107 
108 #define CAP_SEP_CH '/'
109 
110 
111 /************************************************************
112  * *
113  * The following 2 sets of definitions must be kept aligned *
114  * *
115  ************************************************************/
116 
117 /* fast lookup -- standard capability bit ID */
118 #define CAP_BIT_V1 bit0
119 #define CAP_BIT_WR_RUN bit1
120 #define CAP_BIT_CANDIDATE bit2
121 #define CAP_BIT_CONF_COMMIT bit3
122 #define CAP_BIT_ROLLBACK_ERR bit4
123 #define CAP_BIT_VALIDATE bit5
124 #define CAP_BIT_STARTUP bit6
125 #define CAP_BIT_URL bit7
126 #define CAP_BIT_XPATH bit8
127 #define CAP_BIT_NOTIFICATION bit9
128 #define CAP_BIT_INTERLEAVE bit10
129 #define CAP_BIT_PARTIAL_LOCK bit11
130 #define CAP_BIT_WITH_DEFAULTS bit12
131 #define CAP_BIT_V11 bit13
132 #define CAP_BIT_CONF_COMMIT11 bit14
133 #define CAP_BIT_VALIDATE11 bit15
134 #define CAP_BIT_DEPTH bit16
135 #define CAP_BIT_FIELDS bit17
136 #define CAP_BIT_FILTER bit18
137 #define CAP_BIT_REPLAY bit19
138 #define CAP_BIT_DEFAULTS bit20
139 #define CAP_BIT_YANGPATCH bit21
140 #define CAP_BIT_YANGLIB bit22
141 #define CAP_BIT_YANGLIB11 bit23
142 
143 
144 /* put the version numbers in the capability names for now */
145 #define CAP_NAME_V1 ((const xmlChar *)"base:1.0")
146 #define CAP_NAME_V11 ((const xmlChar *)"base:1.1")
147 #define CAP_NAME_CANDIDATE ((const xmlChar *)"candidate:1.0")
148 #define CAP_NAME_CONF_COMMIT ((const xmlChar *)"confirmed-commit:1.0")
149 #define CAP_NAME_CONF_COMMIT11 ((const xmlChar *)"confirmed-commit:1.1")
150 #define CAP_NAME_DEFAULTS ((const xmlChar *)"defaults:1.0")
151 #define CAP_NAME_DEPTH ((const xmlChar *)"depth:1.0")
152 #define CAP_NAME_FIELDS ((const xmlChar *)"fields:1.0")
153 #define CAP_NAME_FILTER ((const xmlChar *)"filter:1.0")
154 #define CAP_NAME_INTERLEAVE ((const xmlChar *)"interleave:1.0")
155 #define CAP_NAME_NOTIFICATION ((const xmlChar *)"notification:1.0")
156 #define CAP_NAME_PARTIAL_LOCK ((const xmlChar *)"partial-lock:1.0")
157 #define CAP_NAME_REPLAY ((const xmlChar *)"replay:1.0")
158 #define CAP_NAME_ROLLBACK_ERR ((const xmlChar *)"rollback-on-error:1.0")
159 #define CAP_NAME_STARTUP ((const xmlChar *)"startup:1.0")
160 #define CAP_NAME_URL ((const xmlChar *)"url:1.0")
161 #define CAP_NAME_VALIDATE ((const xmlChar *)"validate:1.0")
162 #define CAP_NAME_VALIDATE11 ((const xmlChar *)"validate:1.1")
163 #define CAP_NAME_WITH_DEFAULTS ((const xmlChar *)"with-defaults:1.0")
164 #define CAP_NAME_WR_RUN ((const xmlChar *)"writable-running:1.0")
165 #define CAP_NAME_XPATH ((const xmlChar *)"xpath:1.0")
166 #define CAP_NAME_YANGLIB ((const xmlChar *)"yang-library:1.0")
167 #define CAP_NAME_YANGLIB11 ((const xmlChar *)"yang-library:1.1")
168 #define CAP_NAME_YANGPATCH ((const xmlChar *)"yang-patch:1.0")
169 
170 
171 
172 /* some YANG capability details */
173 #define CAP_REVISION_EQ (const xmlChar *)"revision="
174 #define CAP_MODULE_EQ (const xmlChar *)"module="
175 #define CAP_FEATURES_EQ (const xmlChar *)"features="
176 #define CAP_DEVIATIONS_EQ (const xmlChar *)"deviations="
177 #define CAP_SCHEME_EQ (const xmlChar *)"scheme="
178 #define CAP_PROTOCOL_EQ (const xmlChar *)"protocol="
179 #define CAP_BASIC_EQ (const xmlChar *)"basic-mode="
180 #define CAP_SUPPORTED_EQ (const xmlChar *)"also-supported="
181 #define CAP_MODULESETID_EQ (const xmlChar *)"module-set-id="
182 #define CAP_CONTENTID_EQ (const xmlChar *)"content-id="
183 
184 #define CAP_YANGLIB_REVISION_PARAM (const xmlChar *)"revision=2016-06-21"
185 #define CAP_YANGLIB_REVISION (const xmlChar *)"2016-06-21"
186 
187 #define CAP_YANGLIB_NMDA_REVISION_PARAM (const xmlChar *)"revision=2019-01-04"
188 #define CAP_YANGLIB_NMDA_REVISION (const xmlChar *)"2019-01-04"
189 
190 /* yang-library module-set-id capability base string */
191 #define CAP_YANGLIB_BASE_URN \
192  (const xmlChar *)"urn:ietf:params:netconf:capability:yang-library:1.0"
193 
194 /* NMDA yang-library content-id capability base string */
195 #define CAP_YANGLIB_NMDA_BASE_URN \
196  (const xmlChar *)"urn:ietf:params:netconf:capability:yang-library:1.1"
197 
198 #define CAP_SCHEMA_RETRIEVAL \
199  (const xmlChar *)"urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring"
200 
201 
202 /********************************************************************
203 * *
204 * T Y P E S *
205 * *
206 *********************************************************************/
207 
209 typedef enum cap_subjtyp_t_ {
210  CAP_SUBJTYP_NONE,
215 } cap_subjtyp_t;
216 
217 
219 typedef enum cap_change_t_ {
220  CAP_CHANGE_NONE,
221  CAP_CHANGE_ADD,
222  CAP_CHANGE_DELETE,
223  CAP_CHANGE_MODIFY
224 } cap_change_t;
225 
226 
228 typedef enum cap_stdid_t_ {
231 
234 
237 
240 
243 
246 
249 
252 
255 
258 
261 
264 
267 
270 
273 
276 
279 
282 
285 
288 
291 
294 
296 
298 
299  CAP_STDID_LAST_MARKER
300 } cap_stdid_t;
301 
302 
304 typedef struct cap_list_t_ {
305  uint32 cap_std;
306  xmlChar *cap_schemes;
307  xmlChar *cap_defstyle;
308  xmlChar *cap_supported;
311  xmlChar *cap_yanglib_rev;
312  xmlChar *cap_yanglib_setid;
314  dlq_hdr_t capQ;
315 } cap_list_t;
316 
317 
319 typedef struct cap_rec_t_ {
320  dlq_hdr_t cap_qhdr;
321  cap_subjtyp_t cap_subject;
322  xmlChar *cap_uri;
323  xmlChar *cap_namespace;
324  xmlChar *cap_module;
325  xmlChar *cap_revision;
326  ncx_list_t cap_feature_list;
327  ncx_list_t cap_deviation_list;
328 } cap_rec_t;
329 
330 
332 typedef enum cap_yanglib_ver_t_ {
335 
338 
341 } cap_yanglib_ver_t;
342 
343 
344 /********************************************************************
345 * *
346 * F U N C T I O N S *
347 * *
348 *********************************************************************/
349 
350 
356 extern cap_list_t *
357  cap_new_caplist (void);
358 
359 
367 extern void
368  cap_init_caplist (cap_list_t *caplist);
369 
370 
377 extern void
378  cap_clean_caplist (cap_list_t *caplist);
379 
380 
387 extern void
388  cap_free_caplist (cap_list_t *caplist);
389 
390 
398 extern status_t
399  cap_add_std (cap_list_t *caplist,
400  cap_stdid_t capstd);
401 
402 
412 extern status_t
413  cap_add_stdval (val_value_t *caplist,
414  cap_stdid_t capstd,
415  boolean is_restconf);
416 
417 
429 extern status_t
430  cap_add_std_string (cap_list_t *caplist,
431  const xmlChar *uri,
432  boolean is_restconf);
433 
434 
442 extern boolean
443  cap_is_module_string (const xmlChar *uri);
444 
445 
455 extern status_t
456  cap_add_module_string (cap_list_t *caplist,
457  const xmlChar *uri);
458 
459 
467 extern status_t
468  cap_add_url (cap_list_t *caplist,
469  const xmlChar *scheme_list);
470 
471 
482 extern status_t
483  cap_add_urlval (val_value_t *caplist,
484  const xmlChar *scheme_list,
485  boolean is_restconf);
486 
487 
495 extern status_t
496  cap_add_withdef (cap_list_t *caplist,
497  const xmlChar *defstyle);
498 
499 
511 extern status_t
512  cap_add_withdefval (val_value_t *caplist,
513  const xmlChar *defstyle,
514  uint8 withdef_enabled,
515  boolean is_restconf);
516 
517 
526 extern status_t
527  cap_add_restdefval (val_value_t *caplist,
528  const xmlChar *defstyle);
529 
530 
538 extern status_t
539  cap_add_ent (cap_list_t *caplist,
540  const xmlChar *uristr);
541 
542 
550 extern status_t
551  cap_add_entval (val_value_t *caplist,
552  const xmlChar *urival);
553 
554 
562 extern status_t
563  cap_add_modval (val_value_t *caplist,
564  ncx_module_t *mod);
565 
566 
575 extern status_t
576  cap_add_mod (cap_list_t *caplist,
577  ncx_module_t *mod);
578 
579 
587 extern void
588  cap_remove_mod (cap_list_t *caplist,
589  ncx_module_t *mod);
590 
591 
599 extern status_t
600  cap_remove_modval (val_value_t *caplist,
601  ncx_module_t *mod);
602 
603 
604 
612 extern status_t
613  cap_add_netconf_modval (val_value_t *caplist,
614  ncx_module_t *mod);
615 
616 
624 extern status_t
625  cap_add_devmodval (val_value_t *caplist,
626  ncx_save_deviations_t *savedev);
627 
628 
636 extern boolean
637  cap_std_set (const cap_list_t *caplist,
638  cap_stdid_t capstd);
639 
640 
649 extern boolean
650  cap_set (const cap_list_t *caplist,
651  const xmlChar *capuri);
652 
653 
665 extern cap_rec_t *
666  cap_match (const cap_list_t *caplist,
667  const xmlChar *capuri);
668 
669 
681 extern val_value_t *
682  cap_match_val (val_value_t *caplist,
683  const xmlChar *capuri);
684 
685 
693 extern const xmlChar *
694  cap_get_protos (cap_list_t *caplist);
695 
696 
705 extern void
706  cap_dump_stdcaps (const cap_list_t *caplist,
707  log_debug_t lvl,
708  FILE *outfile);
709 
710 
719 extern void
720  cap_dump_modcaps (const cap_list_t *caplist,
721  log_debug_t lvl,
722  FILE *outfile);
723 
724 
732 extern const cap_rec_t *
733  cap_find_modcap (const cap_list_t *caplist,
734  const xmlChar *modname);
735 
736 
745 extern void
746  cap_dump_entcaps (const cap_list_t *caplist,
747  log_debug_t lvl,
748  FILE *outfile);
749 
750 
759 extern cap_rec_t *
760  cap_first_modcap (cap_list_t *caplist);
761 
762 
771 extern cap_rec_t *
772  cap_next_modcap (cap_rec_t *curcap);
773 
774 
787 extern void
788  cap_split_modcap (cap_rec_t *cap,
789  const xmlChar **module,
790  const xmlChar **revision,
791  const xmlChar **namespacestr);
792 
793 
801 extern xmlChar *
802  cap_make_moduri (ncx_module_t *mod);
803 
804 
816 extern status_t
817  cap_add_config_id (cap_list_t *caplist);
818 
819 
834 extern status_t
835  cap_add_ids_val (val_value_t *caplist,
836  boolean is_module_id,
837  cap_yanglib_ver_t yanglib_ver);
838 
839 
847 extern status_t
848  cap_add_yanglib (cap_list_t *caplist,
849  cap_yanglib_ver_t yanglib_ver);
850 
851 
855 #ifdef __cplusplus
856 } /* end extern 'C' */
857 #endif
858 
859 #endif /* _H_cap */
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
cfg.h
CAP_STDID_V1
@ CAP_STDID_V1
NETCONF 1.0 (RFC 4741)
Definition: cap.h:230
ncx_feature.h
NCX Module Library YANG Feature Utility Functions.
cap_match
cap_rec_t * cap_match(const cap_list_t *caplist, const xmlChar *capuri)
Check if the capability URI is set in the capslist.
Definition: cap.c:2273
xmlns_find_ns_by_name_str
xmlns_id_t xmlns_find_ns_by_name_str(const xmlChar *name, uint32 namelen)
Find the NS ID from its name (counted string version)
Definition: xmlns.c:831
cap_clean_caplist
void cap_clean_caplist(cap_list_t *caplist)
Clean the fields in a pre-allocated cap_list_t struct Memory for caplist not deallocated – this just ...
Definition: cap.c:596
cap_match_val
val_value_t * cap_match_val(val_value_t *caplist, const xmlChar *capuri)
Check if the capability URI is set in the capslist value_t tree.
Definition: cap.c:2313
xml_strdup
xmlChar * xml_strdup(const xmlChar *copyFrom)
String duplicate for xmlChar.
Definition: xml_util.c:1553
ncx_warning_enabled
boolean ncx_warning_enabled(status_t res)
Check if a specific status_t code is enabled.
Definition: ncx.c:9394
CAP_URN
#define CAP_URN
NETCONF Capability Identifier Base String.
Definition: cap.h:96
cap_dump_modcaps
void cap_dump_modcaps(const cap_list_t *caplist, log_debug_t lvl, FILE *outfile)
Printf the standard data model module capabilities list debug function.
Definition: cap.c:2489
CAP_STDID_ROLLBACK_ERR
@ CAP_STDID_ROLLBACK_ERR
:rollback-on-error:1.0
Definition: cap.h:242
cap_list_t_::cap_yanglib_rev
xmlChar * cap_yanglib_rev
YANG-LIBRARY pointers, stored in the cap list.
Definition: cap.h:311
cap_add_devmodval
status_t cap_add_devmodval(val_value_t *caplist, ncx_save_deviations_t *savedev)
Add a deviation module capability to the list (val_value_t version)
Definition: cap.c:2121
cap_find_modcap
const cap_rec_t * cap_find_modcap(const cap_list_t *caplist, const xmlChar *modname)
Find a specified module in the caplist.
Definition: cap.c:2596
cap_dump_entcaps
void cap_dump_entcaps(const cap_list_t *caplist, log_debug_t lvl, FILE *outfile)
Printf the enterprise capabilities list debug function.
Definition: cap.c:2631
CAP_SUBJTYP_DM
@ CAP_SUBJTYP_DM
capability is a data model
Definition: cap.h:216
log_error
void log_error(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_ERROR log entry.
NCX_WITHDEF_TRIM
@ NCX_WITHDEF_TRIM
trim
Definition: ncxtypes.h:1014
ncx_get_modname
const xmlChar * ncx_get_modname(const ncx_module_t *mod)
Get the main module name.
Definition: ncx.c:4834
CAP_J_URN
#define CAP_J_URN
NETCONF Capability Identifier Base String Implemented by Juniper.
Definition: cap.h:102
val.h
Value Node Basic Support.
NCX_WITHDEF_NONE
@ NCX_WITHDEF_NONE
not set
Definition: ncxtypes.h:1011
cap_free_caplist
void cap_free_caplist(cap_list_t *caplist)
Clean the fields in a pre-allocated cap_list_t struct Then free the caplist memory.
Definition: cap.c:652
xml_util.h
XML Utilities.
CAP_STDID_YANGLIB
@ CAP_STDID_YANGLIB
YANG-LIBRARY 1.0 capability.
Definition: cap.h:295
CAP_STDID_V11
@ CAP_STDID_V11
NETCONF v1.1 (RFC 6241)
Definition: cap.h:269
CAP_STDID_REPLAY
@ CAP_STDID_REPLAY
RESTCONF replay parameter.
Definition: cap.h:287
cap_add_entval
status_t cap_add_entval(val_value_t *caplist, const xmlChar *urival)
Add an enterprise capability to the list (val_value_t version)
Definition: cap.c:1816
CAP_STDID_FILTER
@ CAP_STDID_FILTER
RESTCONF filter parameter.
Definition: cap.h:284
ncx_get_mod_ocversion
const xmlChar * ncx_get_mod_ocversion(const ncx_module_t *mod)
Get the module openconfig-version string for the specified module.
Definition: ncx.c:8994
ncxconst.h
Contains NCX constants.
ncxmod.h
NCX Module Load Manager.
cap_add_urlval
status_t cap_add_urlval(val_value_t *caplist, const xmlChar *scheme_list, boolean is_restconf)
Add the :url capability to the list; value struct version.
Definition: cap.c:1415
cap_std_set
boolean cap_std_set(const cap_list_t *caplist, cap_stdid_t capstd)
fast search of standard protocol capability set
Definition: cap.c:2168
ERR_NCX_WRONG_VAL
@ ERR_NCX_WRONG_VAL
232
Definition: status_enum.h:271
cap_list_t_::cap_std
uint32 cap_std
bitset of std caps
Definition: cap.h:305
ncx_first_lmem
ncx_lmem_t * ncx_first_lmem(ncx_list_t *list)
Return the first list member.
Definition: ncx_list.c:1249
CAP_STDID_YANGLIB11
@ CAP_STDID_YANGLIB11
YANG-LIBRARY 1.1 capability.
Definition: cap.h:297
CAP_STDID_VALIDATE11
@ CAP_STDID_VALIDATE11
:validate:v1.1 (RFC 6241)
Definition: cap.h:272
CAP_YANGLIB_VER_NONE
@ CAP_YANGLIB_VER_NONE
not set
Definition: cap.h:334
cap_add_withdef
status_t cap_add_withdef(cap_list_t *caplist, const xmlChar *defstyle)
Add the :with-defaults capability to the list.
Definition: cap.c:1485
NCX_WITHDEF_REPORT_ALL
@ NCX_WITHDEF_REPORT_ALL
report-all
Definition: ncxtypes.h:1012
xmlns_get_module
const xmlChar * xmlns_get_module(xmlns_id_t nsid)
get the module name of the namespace ID
Definition: xmlns.c:1126
log_info
void void void void void log_info(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_INFO log entry.
xmlns_id_t
uint16 xmlns_id_t
integer handle for registered namespaces
Definition: xmlns.h:89
val_remove_child
void val_remove_child(val_value_t *child)
Remove a child value node from its parent value node.
Definition: val.c:8316
ncx_warning_elevated
boolean ncx_warning_elevated(status_t res)
Check if a specific status_t code is elevated.
Definition: ncx.c:9439
cap_remove_mod
void cap_remove_mod(cap_list_t *caplist, ncx_module_t *mod)
Remove a module capability from the list.
Definition: cap.c:2009
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.
CAP_STDID_XPATH
@ CAP_STDID_XPATH
:xpath:1.0
Definition: cap.h:254
cap_list_t_::cap_defstyle
xmlChar * cap_defstyle
with-defaults 'basic' parm
Definition: cap.h:307
CAP_STDID_STARTUP
@ CAP_STDID_STARTUP
:startup:v1.0
Definition: cap.h:248
ncx_get_module_setid
uint32 ncx_get_module_setid(void)
GET YANG-LIBRARY module set ID.
Definition: ncx.c:13528
NO_ERR
@ NO_ERR
000
Definition: status_enum.h:188
cap_rec_t_
queue of this structure for list of enterprise capabilities
Definition: cap.h:319
cap_first_modcap
cap_rec_t * cap_first_modcap(cap_list_t *caplist)
Get the first module capability in the list.
Definition: cap.c:2674
ncx_clean_list
void ncx_clean_list(ncx_list_t *list)
Scrub the memory of a ncx_list_t but do not delete it.
Definition: ncx_list.c:139
CAP_STDID_PARTIAL_LOCK
@ CAP_STDID_PARTIAL_LOCK
:partial-lock:1.0 (RFC 5717)
Definition: cap.h:263
xml_val.h
Utility functions for creating value structs.
cap_is_module_string
boolean cap_is_module_string(const xmlChar *uri)
Check if the capability URI is a YANG module identifier.
Definition: cap.c:1048
cap_add_modval
status_t cap_add_modval(val_value_t *caplist, ncx_module_t *mod)
Add a module capability to the list (val_value_t version)
Definition: cap.c:1860
xml_strndup
xmlChar * xml_strndup(const xmlChar *copyFrom, uint32 maxlen)
String duplicate for max N xmlChars.
Definition: xml_util.c:1663
CAP_STDID_DEFAULTS
@ CAP_STDID_DEFAULTS
RESTCONF defaults parameter.
Definition: cap.h:290
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
YW_CONFIG_ID_URN
#define YW_CONFIG_ID_URN
yumaworks config-id capability base string
Definition: ncxconst.h:285
cfg_sprintf_etag
status_t cfg_sprintf_etag(cfg_template_t *cfg, xmlChar *buff, int32 buffsize)
Write the Entity Tag for the datastore to the specified buffer.
Definition: cfg.c:2936
dlq_createSQue
void dlq_createSQue(dlq_hdrT *queAddr)
create a static queue header
Definition: dlq.c:177
cap_new_caplist
cap_list_t * cap_new_caplist(void)
Malloc and initialize the fields in a cap_list_t struct.
Definition: cap.c:544
log_warn
void void void log_warn(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_WARN log entry.
ERR_INTERNAL_VAL
@ ERR_INTERNAL_VAL
004
Definition: status_enum.h:194
cap_remove_modval
status_t cap_remove_modval(val_value_t *caplist, ncx_module_t *mod)
Remove a module capability from the list (val_value_t version)
Definition: cap.c:1908
xml_val_new_leaflist_string
val_value_t * xml_val_new_leaflist_string(const xmlChar *name, xmlns_id_t nsid, xmlChar *strval)
Set up a new string element; reuse the value instead of copying it hand off a malloced string.
Definition: xml_val.c:527
cap_add_module_string
status_t cap_add_module_string(cap_list_t *caplist, const xmlChar *uri)
Add a standard protocol capability to the list by URI string.
Definition: cap.c:1084
dlq_remove
void dlq_remove(void *nodeP)
remove the queue entry from its queue list entry MUST have been enqueued somehow before this function...
Definition: dlq.c:519
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
CAP_STDID_CONF_COMMIT11
@ CAP_STDID_CONF_COMMIT11
:confirmed-commit:v1.1 (RFC 6241)
Definition: cap.h:275
cap_list_t_::cap_supported
xmlChar * cap_supported
with-defaults 'also-supported' parm
Definition: cap.h:308
cap_add_ent
status_t cap_add_ent(cap_list_t *caplist, const xmlChar *uristr)
Add an enterprise capability to the list.
Definition: cap.c:1773
ERR_NCX_INVALID_VALUE
@ ERR_NCX_INVALID_VALUE
258
Definition: status_enum.h:299
cap_list_t_::cap_yanglib_setid
xmlChar * cap_yanglib_setid
yang-library module-set-id param
Definition: cap.h:312
cap_add_std_string
status_t cap_add_std_string(cap_list_t *caplist, const xmlChar *uri, boolean is_restconf)
Add a standard protocol capability to the list by URI string.
Definition: cap.c:872
cap_stdid_t_
cap_stdid_t_
enumerated list of standard capability IDs
Definition: cap.h:228
ERR_INTERNAL_MEM
@ ERR_INTERNAL_MEM
003
Definition: status_enum.h:193
xml_strncmp
int xml_strncmp(const xmlChar *s1, const xmlChar *s2, uint32 maxlen)
String compare for xmlChar for at most 'maxlen' xmlChars.
Definition: xml_util.c:1824
ncx_feature_count
uint32 ncx_feature_count(const ncx_module_t *mod, boolean enabledonly)
Get the total feature count for this module and any submodules.
Definition: ncx_feature.c:1107
val_child.h
Value Node Child Access Support.
get_error_string
const char * get_error_string(status_t res)
Get the error message for a specific internal error.
Definition: status.c:239
ERR_INTERNAL_PTR
@ ERR_INTERNAL_PTR
002
Definition: status_enum.h:192
cap_change_t_
cap_change_t_
Capability Change Type.
Definition: cap.h:219
ncx_sprintf_module_setid
status_t ncx_sprintf_module_setid(uint32 id, xmlChar *buff, int32 buffsize)
Write the module set ID for the yang-library to the specified buffer.
Definition: ncx.c:13551
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.
ncx_set_list
status_t ncx_set_list(ncx_btype_t btyp, const xmlChar *strval, ncx_list_t *list)
consume a generic string list with base type checking Parse the XML input as an NCX_BT_SLIST
Definition: ncx_list.c:751
cap_next_modcap
cap_rec_t * cap_next_modcap(cap_rec_t *curcap)
Get the next module capability in the list.
Definition: cap.c:2707
dlq_nextEntry
#define dlq_nextEntry(nodeP)
get the next queue entry after the current entry
Definition: dlq.h:265
CAP_STDID_WITH_DEFAULTS
@ CAP_STDID_WITH_DEFAULTS
:with-defaults:1.0 (RFC 6243)
Definition: cap.h:266
CAP_STDID_CANDIDATE
@ CAP_STDID_CANDIDATE
:candidate:1.0
Definition: cap.h:236
cap_add_mod
status_t cap_add_mod(cap_list_t *caplist, ncx_module_t *mod)
Add a module capability to the list.
Definition: cap.c:1971
CAP_STDID_WRITE_RUNNING
@ CAP_STDID_WRITE_RUNNING
:writable-running:1.0
Definition: cap.h:233
cap_split_modcap
void cap_split_modcap(cap_rec_t *cap, const xmlChar **module, const xmlChar **revision, const xmlChar **namespacestr)
Split the modcap string into 3 parts.
Definition: cap.c:2746
CAP_YANGLIB_VER_11
@ CAP_YANGLIB_VER_11
Version 1.1 NMDA.
Definition: cap.h:340
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
cap_add_url
status_t cap_add_url(cap_list_t *caplist, const xmlChar *scheme_list)
Add the #url capability to the list.
Definition: cap.c:1373
NCX_MAX_NUMLEN
#define NCX_MAX_NUMLEN
max number len to use for static buffer allocation only
Definition: ncxconst.h:136
CAP_REST_URN
#define CAP_REST_URN
RESTCONF Capability Identifier Base String.
Definition: cap.h:99
ncx_for_all_features
void ncx_for_all_features(const ncx_module_t *mod, ncx_feature_cbfn_t cbfn, void *cookie, boolean enabledonly)
Execute a callback function for all features in this module and any submodules.
Definition: ncx_feature.c:1030
ncx_list_cnt
uint32 ncx_list_cnt(const ncx_list_t *list)
Get the number of entries in the list.
Definition: ncx_list.c:196
cap_set
boolean cap_set(const cap_list_t *caplist, const xmlChar *capuri)
Check if the capability URI is set in the capslist linear search of capability list,...
Definition: cap.c:2197
xml_strcmp
int xml_strcmp(const xmlChar *s1, const xmlChar *s2)
String compare for xmlChar.
Definition: xml_util.c:1746
CAP_STDID_INTERLEAVE
@ CAP_STDID_INTERLEAVE
:interleave:1.0 *(RFC 5277 )
Definition: cap.h:260
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
cap_add_restdefval
status_t cap_add_restdefval(val_value_t *caplist, const xmlChar *defstyle)
Add the :defaults capability to the RESTCONF caplist value struct version.
Definition: cap.c:1704
log.h
NCX System Logging Manager.
ncxtypes.h
YANG module data structures Many internal representations of YANG module constructs.
cap_add_netconf_modval
status_t cap_add_netconf_modval(val_value_t *caplist, ncx_module_t *mod)
Add a module capability to the list (val_value_t version)
Definition: cap.c:2078
cap_add_ids_val
status_t cap_add_ids_val(val_value_t *caplist, boolean is_module_id, cap_yanglib_ver_t yanglib_ver)
Add the :config-id capability to the list.
Definition: cap.c:2891
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
cap_get_protos
const xmlChar * cap_get_protos(cap_list_t *caplist)
get the #url capability protocols list if it exists get the protocols field for the :url capability
Definition: cap.c:2351
cap_add_config_id
status_t cap_add_config_id(cap_list_t *caplist)
Add the :config-id capability to the list.
Definition: cap.c:2810
ncx_list.h
NCX Module Library List Utility Functions.
dlq_deque
void * dlq_deque(dlq_hdrT *listP)
remove the first queue node from the queue list
Definition: dlq.c:286
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
CAP_STDID_CONF_COMMIT
@ CAP_STDID_CONF_COMMIT
:confirmed-commit:1.0
Definition: cap.h:239
CAP_STDID_FIELDS
@ CAP_STDID_FIELDS
RESTCONF fields parameter.
Definition: cap.h:281
NC_URN
#define NC_URN
NETCONF namespace used for base:10 and base:1.1.
Definition: ncxconst.h:100
dlq_empty
#define dlq_empty(listP)
check if queue list is empty
Definition: dlq.h:367
xml_strcpy
uint32 xml_strcpy(xmlChar *copyTo, const xmlChar *copyFrom)
String copy for xmlChar.
Definition: xml_util.c:1486
cap_list_t_::cap_schemes
xmlChar * cap_schemes
URL capability protocol list.
Definition: cap.h:306
CAP_SUBJTYP_OTHER
@ CAP_SUBJTYP_OTHER
capability is other than prot or DM (ENT)
Definition: cap.h:217
CAP_STDID_URL
@ CAP_STDID_URL
:url:1.0
Definition: cap.h:251
cap_list_t_
one capabilities list
Definition: cap.h:304
cap_add_stdval
status_t cap_add_stdval(val_value_t *caplist, cap_stdid_t capstd, boolean is_restconf)
Add a standard protocol capability to the list (val_value_t version)
Definition: cap.c:708
cap.h
NETCONF protocol capabilities.
dlq_firstEntry
#define dlq_firstEntry(listP)
get the first entry in the queue list
Definition: dlq.h:337
cap_add_withdefval
status_t cap_add_withdefval(val_value_t *caplist, const xmlChar *defstyle, uint8 withdef_enabled, boolean is_restconf)
Add the :with-defaults capability to the list; value struct version.
Definition: cap.c:1544
CAP_STDID_DEPTH
@ CAP_STDID_DEPTH
RESTCONF depth parameter.
Definition: cap.h:278
ncx.h
YANG module utility functions.
ncx_get_mod_revision
const xmlChar * ncx_get_mod_revision(const ncx_module_t *mod)
Get the module revision string for the specified module.
Definition: ncx.c:8975
cap_yanglib_ver_t_
cap_yanglib_ver_t_
YANG library URI to use.
Definition: cap.h:332
cap_add_yanglib
status_t cap_add_yanglib(cap_list_t *caplist, cap_yanglib_ver_t yanglib_ver)
Add the :yang-library capability to the list.
Definition: cap.c:3025
cfg_get_config_id
cfg_template_t * cfg_get_config_id(ncx_cfg_t cfgid)
Get the config struct from its ID.
Definition: cfg.c:1530
CAP_STDID_YANGPATCH
@ CAP_STDID_YANGPATCH
RESTCONF yangpatch parameter.
Definition: cap.h:293
ncx_init_list
void ncx_init_list(ncx_list_t *list, ncx_btype_t btyp)
Initialize an allocated ncx_list_t.
Definition: ncx_list.c:113
CAP_SUBJTYP_CONFID
@ CAP_SUBJTYP_CONFID
config-id capability
Definition: cap.h:218
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
cap_init_caplist
void cap_init_caplist(cap_list_t *caplist)
Initialize the fields in a pre-allocated cap_list_t struct memory for caplist already allocated – thi...
Definition: cap.c:569
log_warn_append
void void void void log_warn_append(const char *fstr,...) __attribute__((format(printf
Append to a LOG_DEBUG_WARN log entry.
VAL_STR
#define VAL_STR(V)
Access the value as a string ONLY if typ_is_string() is true.
Definition: val.h:464
CAP_BASE_URN
#define CAP_BASE_URN
NETCONF Base Protocol Capability String (base:1.0)
Definition: cap.h:88
ncx_find_module
ncx_module_t * ncx_find_module(const xmlChar *modname, const xmlChar *revision)
Find a ncx_module_t in the ncx_sesmodQ.
Definition: ncx.c:3227
SET_ERROR
#define SET_ERROR(E)
macro SET_ERROR
Definition: status_enum.h:103
ERR_NCX_RCV_INVALID_MODCAP
@ ERR_NCX_RCV_INVALID_MODCAP
1040
Definition: status_enum.h:529
CAP_STDID_NOTIFICATION
@ CAP_STDID_NOTIFICATION
:notification:1.0 *(RFC 5277 )
Definition: cap.h:257
NEED_EXIT
#define NEED_EXIT(res)
used in parser routines to decide if processing can continue does not return, just evaluates to TRUE ...
Definition: yangconst.h:234
cap_add_std
status_t cap_add_std(cap_list_t *caplist, cap_stdid_t capstd)
Add a standard protocol capability to the list.
Definition: cap.c:676
NCX_BT_STRING
@ NCX_BT_STRING
string
Definition: ncxtypes.h:217
cap_dump_stdcaps
void cap_dump_stdcaps(const cap_list_t *caplist, log_debug_t lvl, FILE *outfile)
debug function Printf the standard protocol capabilities list
Definition: cap.c:2397
ncx_get_modnamespace
const xmlChar * ncx_get_modnamespace(const ncx_module_t *mod)
Get the module namespace URI.
Definition: ncx.c:4887
cap_make_moduri
xmlChar * cap_make_moduri(ncx_module_t *mod)
Malloc and construct a module URI for the specified module make the module URI string (for sysCapabil...
Definition: cap.c:2779
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
status.h
Global error messages for status code enumerations.
NCX_WITHDEF_EXPLICIT
@ NCX_WITHDEF_EXPLICIT
explicit
Definition: ncxtypes.h:1015
CAP_SUBJTYP_PROT
@ CAP_SUBJTYP_PROT
capability is a protocol extension
Definition: cap.h:215
cap_list_t_::capQ
dlq_hdr_t capQ
queue of cap_rec_t structs
Definition: cap.h:314
dlq.h
dlq provides general double-linked list and queue support:
CAP_YANGLIB_VER_10
@ CAP_YANGLIB_VER_10
Version 1.0 non-NMDA.
Definition: cap.h:337
CAP_BASE_URN11
#define CAP_BASE_URN11
NETCONF Base Protocol Capability String (base:1.1)
Definition: cap.h:92
CAP_STDID_VALIDATE
@ CAP_STDID_VALIDATE
:validate:1.0
Definition: cap.h:245
cap_subjtyp_t_
cap_subjtyp_t_
NETCONF capability subject types.
Definition: cap.h:209