yumapro  20.10-12
YumaPro SDK
agt_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_agt_cap
13 #define _H_agt_cap
14 
15 /* FILE: agt_cap.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 03-feb-06 abb Begun; split out from base/cap.h
36 
37 */
38 
39 #ifndef _H_agt
40 #include "agt.h"
41 #endif
42 
43 #ifndef _H_cap
44 #include "cap.h"
45 #endif
46 
47 #ifndef _H_ncxconst
48 #include "ncxconst.h"
49 #endif
50 
51 #ifndef _H_status
52 #include "status.h"
53 #endif
54 
55 #ifndef _H_val
56 #include "val.h"
57 #endif
58 
59 #ifdef __cplusplus
60 extern "C" {
61 #endif
62 
63 /********************************************************************
64 * *
65 * F U N C T I O N S *
66 * *
67 *********************************************************************/
68 
69 
70 /* header only */
71 
95 extern void
96  agt_cap_cleanup (void);
97 
98 
106 extern status_t
107  agt_cap_set_restconf_caps (const xmlChar *defstyle,
108  uint8 withdef_enabled);
109 
110 
120 extern status_t
121  agt_cap_set_caps (ncx_agttarg_t agttarg,
122  ncx_agtstart_t agtstart,
123  const xmlChar *defstyle,
124  uint8 withdef_enabled);
125 
126 
134 extern status_t
135  agt_cap_set_modules (void);
136 
137 
145 extern status_t
146  agt_cap_add_module (ncx_module_t *mod);
147 
148 
155 extern status_t
156  agt_cap_remove_module (ncx_module_t *mod);
157 
158 
164 extern cap_list_t *
165  agt_cap_get_caps (void);
166 
172 extern cap_list_t *
174 
175 
181 extern val_value_t *
182  agt_cap_get_capsval (void);
183 
184 
190 extern val_value_t *
192 
193 
200 extern boolean
201  agt_cap_std_set (cap_stdid_t cap);
202 
203 
210 extern boolean
211  agt_restconf_cap_std_set (cap_stdid_t cap);
212 
213 
220 extern status_t
222 
223 
245 extern void
246  agt_cap_get_netconf_features (boolean *f_write_running,
247  boolean *f_candidate,
248  boolean *f_confirmed_commit,
249  boolean *f_rollback,
250  boolean *f_validate,
251  boolean *f_startup,
252  boolean *f_url,
253  boolean *f_xpath);
254 
255 
263 extern status_t
265 
266 
275 extern status_t
277 
278 
282 #ifdef __cplusplus
283 } /* end extern 'C' */
284 #endif
285 
286 #endif /* _H_agt_cap */
NCX_AGT_TARG_RUNNING
@ NCX_AGT_TARG_RUNNING
target=running
Definition: ncxtypes.h:355
ses.h
NETCONF Session Common definitions module.
agt_cap.h
NETCONF Server capabilities handler.
agt_cap_set_netconf_module
status_t agt_cap_set_netconf_module(void)
Initialize the NETCONF module capabilities.
Definition: agt_cap.c:1151
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.
ncx_set_features_for_mod
void ncx_set_features_for_mod(ncx_module_t *mod)
Check if any feature parameters were set for the specified feature struct for all features in a modul...
Definition: ncx_feature.c:1572
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_STDID_ROLLBACK_ERR
@ CAP_STDID_ROLLBACK_ERR
:rollback-on-error:1.0
Definition: cap.h:242
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
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
log_error
void log_error(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_ERROR log entry.
ncx_get_modname
const xmlChar * ncx_get_modname(const ncx_module_t *mod)
Get the main module name.
Definition: ncx.c:4834
val.h
Value Node Basic Support.
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
ncx_get_first_module
ncx_module_t * ncx_get_first_module(void)
Get the first module in the ncx_modQ.
Definition: ncx.c:4729
agt_cap_set_caps
status_t agt_cap_set_caps(ncx_agttarg_t agttarg, ncx_agtstart_t agtstart, const xmlChar *defstyle, uint8 withdef_enabled)
Initialize the NETCONF server capabilities.
Definition: agt_cap.c:482
NCX_PROTO_NETCONF11
@ NCX_PROTO_NETCONF11
RFC 6241 base:1.1.
Definition: ncxtypes.h:784
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
ncxconst.h
Contains NCX constants.
ncxmod.h
NCX Module Load Manager.
agt_cap_get_caps
cap_list_t * agt_cap_get_caps(void)
Get the NETCONF server capabilities.
Definition: agt_cap.c:931
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
agt_cap_remove_module
status_t agt_cap_remove_module(ncx_module_t *mod)
Remove a module at runtime, after the initial set has been set MUST call after agt_cap_set_caps.
Definition: agt_cap.c:895
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
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
val_find_next_child
val_value_t * val_find_next_child(const val_value_t *parent, const xmlChar *modname, const xmlChar *childname, const val_value_t *curchild)
Find the next instance of the specified child node.
Definition: val.c:8748
xmlns_id_t
uint16 xmlns_id_t
integer handle for registered namespaces
Definition: xmlns.h:89
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
CAP_STDID_XPATH
@ CAP_STDID_XPATH
:xpath:1.0
Definition: cap.h:254
CAP_STDID_STARTUP
@ CAP_STDID_STARTUP
:startup:v1.0
Definition: cap.h:248
NO_ERR
@ NO_ERR
000
Definition: status_enum.h:188
ncx_set_feature_enable_ex
status_t ncx_set_feature_enable_ex(const xmlChar *modname, const xmlChar *name, boolean flag, boolean force)
Create or set a feature_entry struct for the specified feature enabled parameter (extended)
Definition: ncx_feature.c:1466
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_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
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.
ERR_NCX_OPERATION_FAILED
@ ERR_NCX_OPERATION_FAILED
274
Definition: status_enum.h:315
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
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
NCX_AGT_TARG_CANDIDATE
@ NCX_AGT_TARG_CANDIDATE
target=candidate
Definition: ncxtypes.h:354
agt_get_savedevQ
dlq_hdr_t * agt_get_savedevQ(void)
Get the agt_savedevQ pointer.
Definition: agt.c:4747
CAP_STDID_CONF_COMMIT11
@ CAP_STDID_CONF_COMMIT11
:confirmed-commit:v1.1 (RFC 6241)
Definition: cap.h:275
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
agt_sil_lib.h
Server Instrumentation Library Support.
ERR_INTERNAL_MEM
@ ERR_INTERNAL_MEM
003
Definition: status_enum.h:193
ncx_mod_is_hidden
boolean ncx_mod_is_hidden(const ncx_module_t *mod)
Check if the module is forced no advertise (e.g.
Definition: ncx.c:13104
ERR_INTERNAL_INIT_SEQ
@ ERR_INTERNAL_INIT_SEQ
007
Definition: status_enum.h:197
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
agt_cap_add_module
status_t agt_cap_add_module(ncx_module_t *mod)
Add a module at runtime, after the initial set has been set.
Definition: agt_cap.c:858
agt_cap_set_modules
status_t agt_cap_set_modules(void)
Initialize the NETCONF server capabilities modules list.
Definition: agt_cap.c:791
typ.h
Parameter Type Handler.
ncx_protocol_enabled
boolean ncx_protocol_enabled(ncx_protocol_t proto)
Check if the specified protocol version is enabled.
Definition: ncx.c:10192
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
agt.h
Multi-Protocol Network Management Server.
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_YANGLIB_VER_11
@ CAP_YANGLIB_VER_11
Version 1.1 NMDA.
Definition: cap.h:340
agt_cap_get_restconf_caps
cap_list_t * agt_cap_get_restconf_caps(void)
Get the RESTCONF capabilities.
Definition: agt_cap.c:949
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
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
NCX_AGT_START_DISTINCT
@ NCX_AGT_START_DISTINCT
with-startup=true
Definition: ncxtypes.h:366
ncx_set_feature_enable
status_t ncx_set_feature_enable(const xmlChar *modname, const xmlChar *name, boolean flag)
Create or set a feature_entry struct for the specified feature enabled parameter.
Definition: ncx_feature.c:1437
agt_cap_std_set
boolean agt_cap_std_set(cap_stdid_t cap)
Check if the STD capability is set for the server.
Definition: agt_cap.c:1001
CAP_STDID_INTERLEAVE
@ CAP_STDID_INTERLEAVE
:interleave:1.0 *(RFC 5277 )
Definition: cap.h:260
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
LOGDEBUG4
#define LOGDEBUG4
Check if at least log-level=debug4.
Definition: log.h:302
agt_cap_get_netconf_features
void agt_cap_get_netconf_features(boolean *f_write_running, boolean *f_candidate, boolean *f_confirmed_commit, boolean *f_rollback, boolean *f_validate, boolean *f_startup, boolean *f_url, boolean *f_xpath)
Get the NETCONF 1.1 YANG features that should be enabled for the current server profile.
Definition: agt_cap.c:1071
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
agt_cli.h
NETCONF Server Command Line Interface handler.
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
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
xml_strcpy
uint32 xml_strcpy(xmlChar *copyTo, const xmlChar *copyFrom)
String copy for xmlChar.
Definition: xml_util.c:1486
agt_cap_get_restconf_capsval
val_value_t * agt_cap_get_restconf_capsval(void)
Get the RESTCONF capabilities in val_value_t format.
Definition: agt_cap.c:983
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
agt_get_profile
agt_profile_t * agt_get_profile(void)
Get the server profile struct.
Definition: agt.c:4118
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
agt_restconf_cap_std_set
boolean agt_restconf_cap_std_set(cap_stdid_t cap)
Check if the STD RESTCONF capability is set for the agent.
Definition: agt_cap.c:1020
agt_advertise_module_needed
boolean agt_advertise_module_needed(const xmlChar *modname)
Check if the module should be advertised or not.
Definition: agt.c:4277
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
CAP_STDID_YANGPATCH
@ CAP_STDID_YANGPATCH
RESTCONF yangpatch parameter.
Definition: cap.h:293
agt_cap_update_config_id
status_t agt_cap_update_config_id(void)
Update the config-id capability id' value to the new txid for the running config.
Definition: agt_cap.c:1040
agt_cap_cleanup
void agt_cap_cleanup(void)
Clean the NETCONF server capabilities.
Definition: agt_cap.c:276
agt_cap_get_capsval
val_value_t * agt_cap_get_capsval(void)
Get the NETCONF server capabilities in val_value_t format.
Definition: agt_cap.c:966
VAL_STR
#define VAL_STR(V)
Access the value as a string ONLY if typ_is_string() is true.
Definition: val.h:464
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
CAP_STDID_NOTIFICATION
@ CAP_STDID_NOTIFICATION
:notification:1.0 *(RFC 5277 )
Definition: cap.h:257
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
agt_advertise_yang11_module_needed
boolean agt_advertise_yang11_module_needed(ncx_module_t *mod)
Check whether the NETCONF hello message should conform to the standard and leave out YANG 1....
Definition: agt.c:5009
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
agt_cli_get_valset
val_value_t * agt_cli_get_valset(void)
Retrieve the command line parameter set from boot time.
Definition: agt_cli.c:3427
status.h
Global error messages for status code enumerations.
agt_cap_update_module_setid
status_t agt_cap_update_module_setid(void)
Update YANG-LIBRARY capability module setID.
Definition: agt_cap.c:1175
CAP_YANGLIB_VER_10
@ CAP_YANGLIB_VER_10
Version 1.0 non-NMDA.
Definition: cap.h:337
agt_cap_set_restconf_caps
status_t agt_cap_set_restconf_caps(const xmlChar *defstyle, uint8 withdef_enabled)
Initialize the RESTCONF capabilities.
Definition: agt_cap.c:315
CAP_STDID_VALIDATE
@ CAP_STDID_VALIDATE
:validate:1.0
Definition: cap.h:245