yumapro  20.10-14
YumaPro SDK
NETCONF Capabilities

The capabilities module constructs two versions. More...

Collaboration diagram for NETCONF Capabilities:

Data Structures

struct  cap_list_t
 one capabilities list More...
 
struct  cap_rec_t
 queue of this structure for list of enterprise capabilities More...
 

Macros

#define CAP_BASE_URN
 NETCONF Base Protocol Capability String (base:1.0)
 
#define CAP_BASE_URN11
 NETCONF Base Protocol Capability String (base:1.1)
 
#define CAP_URN   ((const xmlChar *)"urn:ietf:params:netconf:capability:")
 NETCONF Capability Identifier Base String.
 
#define CAP_REST_URN   ((const xmlChar *)"urn:ietf:params:restconf:capability:")
 RESTCONF Capability Identifier Base String.
 
#define CAP_J_URN   (const xmlChar *)"urn:ietf:params:xml:ns:netconf:capability:"
 NETCONF Capability Identifier Base String Implemented by Juniper.
 

Enumerations

enum  cap_subjtyp_t { ,
  CAP_SUBJTYP_PROT,
  CAP_SUBJTYP_DM,
  CAP_SUBJTYP_OTHER,
  CAP_SUBJTYP_CONFID
}
 NETCONF capability subject types. More...
 
enum  cap_change_t
 Capability Change Type.
 
enum  cap_stdid_t {
  CAP_STDID_V1,
  CAP_STDID_WRITE_RUNNING,
  CAP_STDID_CANDIDATE,
  CAP_STDID_CONF_COMMIT,
  CAP_STDID_ROLLBACK_ERR,
  CAP_STDID_VALIDATE,
  CAP_STDID_STARTUP,
  CAP_STDID_URL,
  CAP_STDID_XPATH,
  CAP_STDID_NOTIFICATION,
  CAP_STDID_INTERLEAVE,
  CAP_STDID_PARTIAL_LOCK,
  CAP_STDID_WITH_DEFAULTS,
  CAP_STDID_V11,
  CAP_STDID_VALIDATE11,
  CAP_STDID_CONF_COMMIT11,
  CAP_STDID_DEPTH,
  CAP_STDID_FIELDS,
  CAP_STDID_FILTER,
  CAP_STDID_REPLAY,
  CAP_STDID_DEFAULTS,
  CAP_STDID_YANGPATCH,
  CAP_STDID_YANGLIB,
  CAP_STDID_YANGLIB11
}
 enumerated list of standard capability IDs More...
 
enum  cap_yanglib_ver_t {
  CAP_YANGLIB_VER_NONE,
  CAP_YANGLIB_VER_10,
  CAP_YANGLIB_VER_11
}
 YANG library URI to use. More...
 

Functions

cap_list_tcap_new_caplist (void)
 Malloc and initialize the fields in a cap_list_t struct. More...
 
void cap_init_caplist (cap_list_t *caplist)
 Initialize the fields in a pre-allocated cap_list_t struct memory for caplist already allocated – this just inits fields. More...
 
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 cleans fields. More...
 
void cap_free_caplist (cap_list_t *caplist)
 Clean the fields in a pre-allocated cap_list_t struct Then free the caplist memory. More...
 
status_t cap_add_std (cap_list_t *caplist, cap_stdid_t capstd)
 Add a standard protocol capability to the list. More...
 
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) More...
 
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. More...
 
boolean cap_is_module_string (const xmlChar *uri)
 Check if the capability URI is a YANG module identifier. More...
 
status_t cap_add_module_string (cap_list_t *caplist, const xmlChar *uri)
 Add a standard protocol capability to the list by URI string. More...
 
status_t cap_add_url (cap_list_t *caplist, const xmlChar *scheme_list)
 Add the #url capability to the list. More...
 
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. More...
 
status_t cap_add_withdef (cap_list_t *caplist, const xmlChar *defstyle)
 Add the :with-defaults capability to the list. More...
 
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. More...
 
status_t cap_add_restdefval (val_value_t *caplist, const xmlChar *defstyle)
 Add the :defaults capability to the RESTCONF caplist value struct version. More...
 
status_t cap_add_ent (cap_list_t *caplist, const xmlChar *uristr)
 Add an enterprise capability to the list. More...
 
status_t cap_add_entval (val_value_t *caplist, const xmlChar *urival)
 Add an enterprise capability to the list (val_value_t version) More...
 
status_t cap_add_modval (val_value_t *caplist, ncx_module_t *mod)
 Add a module capability to the list (val_value_t version) More...
 
status_t cap_add_mod (cap_list_t *caplist, ncx_module_t *mod)
 Add a module capability to the list. More...
 
void cap_remove_mod (cap_list_t *caplist, ncx_module_t *mod)
 Remove a module capability from the list. More...
 
status_t cap_remove_modval (val_value_t *caplist, ncx_module_t *mod)
 Remove a module capability from the list (val_value_t version) More...
 
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) More...
 
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) More...
 
boolean cap_std_set (const cap_list_t *caplist, cap_stdid_t capstd)
 fast search of standard protocol capability set More...
 
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, will check for std uris as well. More...
 
cap_rec_tcap_match (const cap_list_t *caplist, const xmlChar *capuri)
 Check if the capability URI is set in the capslist. More...
 
val_value_tcap_match_val (val_value_t *caplist, const xmlChar *capuri)
 Check if the capability URI is set in the capslist value_t tree. More...
 
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 More...
 
void cap_dump_stdcaps (const cap_list_t *caplist, log_debug_t lvl, FILE *outfile)
 debug function Printf the standard protocol capabilities list More...
 
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. More...
 
const cap_rec_tcap_find_modcap (const cap_list_t *caplist, const xmlChar *modname)
 Find a specified module in the caplist. More...
 
void cap_dump_entcaps (const cap_list_t *caplist, log_debug_t lvl, FILE *outfile)
 Printf the enterprise capabilities list debug function. More...
 
cap_rec_tcap_first_modcap (cap_list_t *caplist)
 Get the first module capability in the list. More...
 
cap_rec_tcap_next_modcap (cap_rec_t *curcap)
 Get the next module capability in the list. More...
 
void cap_split_modcap (cap_rec_t *cap, const xmlChar **module, const xmlChar **revision, const xmlChar **namespacestr)
 Split the modcap string into 3 parts. More...
 
xmlChar * cap_make_moduri (ncx_module_t *mod)
 Malloc and construct a module URI for the specified module make the module URI string (for sysCapabilityChange event) More...
 
status_t cap_add_config_id (cap_list_t *caplist)
 Add the :config-id capability to the list. More...
 
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. More...
 
status_t cap_add_yanglib (cap_list_t *caplist, cap_yanglib_ver_t yanglib_ver)
 Add the :yang-library capability to the list. More...
 

Detailed Description

The capabilities module constructs two versions.

The cap_list_t version is the internal struct used by the agent or manager.

The val_value_t version is used to cache the capabilities that will actually be used within an rpc_msg_t when the manager or agent actually sends a hello message.

Debugging and schema-discovery module support is also provided.

Enumeration Type Documentation

◆ cap_stdid_t

enumerated list of standard capability IDs

Enumerator
CAP_STDID_V1 

NETCONF 1.0 (RFC 4741)

CAP_STDID_WRITE_RUNNING 

:writable-running:1.0

CAP_STDID_CANDIDATE 

:candidate:1.0

CAP_STDID_CONF_COMMIT 

:confirmed-commit:1.0

CAP_STDID_ROLLBACK_ERR 

:rollback-on-error:1.0

CAP_STDID_VALIDATE 

:validate:1.0

CAP_STDID_STARTUP 

:startup:v1.0

CAP_STDID_URL 

:url:1.0

CAP_STDID_XPATH 

:xpath:1.0

CAP_STDID_NOTIFICATION 

:notification:1.0 *(RFC 5277 )

CAP_STDID_INTERLEAVE 

:interleave:1.0 *(RFC 5277 )

CAP_STDID_PARTIAL_LOCK 

:partial-lock:1.0 (RFC 5717)

CAP_STDID_WITH_DEFAULTS 

:with-defaults:1.0 (RFC 6243)

CAP_STDID_V11 

NETCONF v1.1 (RFC 6241)

CAP_STDID_VALIDATE11 

:validate:v1.1 (RFC 6241)

CAP_STDID_CONF_COMMIT11 

:confirmed-commit:v1.1 (RFC 6241)

CAP_STDID_DEPTH 

RESTCONF depth parameter.

CAP_STDID_FIELDS 

RESTCONF fields parameter.

CAP_STDID_FILTER 

RESTCONF filter parameter.

CAP_STDID_REPLAY 

RESTCONF replay parameter.

CAP_STDID_DEFAULTS 

RESTCONF defaults parameter.

CAP_STDID_YANGPATCH 

RESTCONF yangpatch parameter.

CAP_STDID_YANGLIB 

YANG-LIBRARY 1.0 capability.

CAP_STDID_YANGLIB11 

YANG-LIBRARY 1.1 capability.

◆ cap_subjtyp_t

NETCONF capability subject types.

Enumerator
CAP_SUBJTYP_PROT 

capability is a protocol extension

CAP_SUBJTYP_DM 

capability is a data model

CAP_SUBJTYP_OTHER 

capability is other than prot or DM (ENT)

CAP_SUBJTYP_CONFID 

config-id capability

◆ cap_yanglib_ver_t

YANG library URI to use.

Enumerator
CAP_YANGLIB_VER_NONE 

not set

CAP_YANGLIB_VER_10 

Version 1.0 non-NMDA.

CAP_YANGLIB_VER_11 

Version 1.1 NMDA.

Function Documentation

◆ cap_add_config_id()

status_t cap_add_config_id ( cap_list_t caplist)

Add the :config-id capability to the list.

Identifies the current etag for the running datastore resource

Add the :yang-library?module-set-id capability to the list. Identifies the current module ID

Parameters
caplistcapability list that will contain the cap
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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)

Parameters
caplistcapability list that will contain the deviation cap
savedevsave_deviations struct to use
Returns
status
Here is the call graph for this function:

◆ cap_add_ent()

status_t cap_add_ent ( cap_list_t caplist,
const xmlChar *  uristr 
)

Add an enterprise capability to the list.

Parameters
caplistcapability list that will contain the module caps
uristrURI string to add
Returns
status
Here is the call graph for this function:

◆ 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)

Parameters
caplistcapability list that will contain the enterprise cap
urivalcapability URI value to add
Returns
status
Here is the call graph for this function:

◆ 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.

Identifies the current etag for the running datastore resource value struct version

Add the :yang-library?module-set-id capability to the list. Identifies the current module ID

Parameters
caplistcapability list that will contain the cap
is_module_idTRUE if this is add for module-set-id
yanglib_verYANG library version enum (ignored if is_module_id == FALSE)
Returns
status
Here is the caller graph for this function:

◆ cap_add_mod()

status_t cap_add_mod ( cap_list_t caplist,
ncx_module_t mod 
)

Add a module capability to the list.

Parameters
caplistcapability list that will contain the module cap
modmodule to add
Returns
status
See also
cap_remove_mod
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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.

Parameters
caplistcapability list that will contain the standard cap
urithe URI string holding the capability identifier
Returns
status, NO_ERR if valid STD capability ERR_NCX_SKIPPED if this is not a module capability any other result is a non-recoverable error
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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)

Parameters
caplistcapability list that will contain the module cap
modmodule to add
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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)

Parameters
caplistcapability list that will contain the module cap
modNETCONF module to use
Returns
status
Here is the call graph for this function:

◆ 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.

Parameters
caplistcapability list that will contain the standard cap
defstylethe basic-mode with-default style
Returns
status

◆ cap_add_std()

status_t cap_add_std ( cap_list_t caplist,
cap_stdid_t  capstd 
)

Add a standard protocol capability to the list.

Parameters
caplistcapability list that will contain the standard cap
capstdthe standard capability ID
Returns
status, should always be NO_ERR
Here is the caller graph for this function:

◆ 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.

Parameters
caplistcapability list that will contain the standard cap
urithe string holding the capability URI
is_restconfTrue is this is restconf capability set up
Returns
status, NO_ERR if valid STD capability ERR_NCX_SKIPPED if this is not a standard capability any other result is a non-recoverable error
Here is the call graph for this function:

◆ 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)

Parameters
caplistcapability list that will contain the standard cap
capstdthe standard capability ID
is_restconf== TRUE if add RESTCONF capability; FALSE if NETCONF
Returns
status

◆ cap_add_url()

status_t cap_add_url ( cap_list_t caplist,
const xmlChar *  scheme_list 
)

Add the #url capability to the list.

Parameters
caplistcapability list that will contain the standard cap
scheme_listthe scheme list for the :url capability
Returns
status, should always be NO_ERR
Here is the call graph for this function:

◆ 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.

Parameters
caplistcapability list that will contain the standard cap
scheme_listthe list of schemes supported
is_restconf== TRUE if add RESTCONF capability; FALSE if NETCONF
Returns
status

◆ cap_add_withdef()

status_t cap_add_withdef ( cap_list_t caplist,
const xmlChar *  defstyle 
)

Add the :with-defaults capability to the list.

Parameters
caplistcapability list that will contain the standard cap
defstylethe basic-mode with-default style
Returns
status, should always be NO_ERR
Here is the call graph for this function:

◆ 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.

Parameters
caplistcapability list that will contain the standard cap
defstylethe basic-mode with-default style
withdef_enabled== bitmask of enabled with-defaults modes
is_restconf== TRUE if add RESTCONF capability FALSE if NETCONF
Returns
status

◆ 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.

Parameters
caplistcapability list that will contain the standard cap
yanglib_verenum for the YANG library to use
Returns
status, should always be NO_ERR
Here is the caller graph for this function:

◆ 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 cleans fields.

Parameters
capliststruct to clean
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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.

Parameters
caplistcapability list to print
lvllog-level to dump capability list
outfilefile for output

◆ 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.

Parameters
caplistcapability list to print
lvldebug output level
outfilefile for output
Here is the call graph for this function:

◆ 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

Parameters
caplistcapability list to print
lvldebug output level
outfilefile for output
Here is the call graph for this function:

◆ 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.

Parameters
caplistcapability list to check
modnamemodule name to find
Returns
const pointer to found cap rec or NULL if not found
Here is the call graph for this function:

◆ cap_first_modcap()

cap_rec_t* cap_first_modcap ( cap_list_t caplist)

Get the first module capability in the list.

Parameters
caplistcapability list to check
Returns
pointer to first record, to use for next record; NULL if no first record
See also
cap_next_modcap

◆ 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.

Parameters
caplist== struct to free
Here is the call graph for this function:

◆ 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

Parameters
caplistcapability list to check
Returns
pointer to protocols string if any, or NULL if not

◆ 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 – this just inits fields.

Parameters
capliststruct to initialize
Returns
status, should always be NO_ERR
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cap_is_module_string()

boolean cap_is_module_string ( const xmlChar *  uri)

Check if the capability URI is a YANG module identifier.

Parameters
urithe URI string to check
Returns
TRUE if looks like a YANG module capability; FALSE if not
Here is the caller graph for this function:

◆ 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 sysCapabilityChange event)

Parameters
modmodule to use
Returns
malloced string containing the URI !!! must be freed later !!!
Here is the caller graph for this function:

◆ 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.

Return the entry if found;

!!! NOT FOR NETCONF STANDARD CAPS SET WITH BITS!!!

Parameters
caplistcapability list to check
capurithe capability URI to find
Returns
pointer to cap entry if found
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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.

Return the entry if found;

!!! NOT FOR NETCONF STANDARD CAPS SET WITH BITS!!!

Parameters
caplistcapability YANG list to check
capurithe capability URI to find
Returns
pointer to cap entry if found
Here is the call graph for this function:

◆ cap_new_caplist()

cap_list_t* cap_new_caplist ( void  )

Malloc and initialize the fields in a cap_list_t struct.

Returns
malloced cap_list or NULL if memory error
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cap_next_modcap()

cap_rec_t* cap_next_modcap ( cap_rec_t curcap)

Get the next module capability in the list.

Parameters
curcapcurrent mod_cap entry
Returns
pointer to next record; NULL if no next record
See also
cap_first_modcap

◆ cap_remove_mod()

void cap_remove_mod ( cap_list_t caplist,
ncx_module_t mod 
)

Remove a module capability from the list.

Parameters
caplistcapability list that will contain the module cap
mod== module to remove
See also
cap_add_mod
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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)

Parameters
caplistcapability list that will contain the module cap
modmodule to remove
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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, will check for std uris as well.

Parameters
caplistcapability list to check
capurithe capability URI to set
Returns
TRUE if indicated capability is set, FALSE if not
Here is the call graph for this function:

◆ 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.

Parameters
capcapability rec to parse
moduleaddress of return module name
revisionaddress of return module revision date string
namespacestraddress of return module namespace
Return values
*modulereturn module name
*revisionreturn module revision date string
*namespacestrreturn module namepsace
Returns
status

◆ cap_std_set()

boolean cap_std_set ( const cap_list_t caplist,
cap_stdid_t  capstd 
)

fast search of standard protocol capability set

Parameters
caplistcapability list to check
capstdthe standard capability ID
Returns
TRUE if indicated std capability is set, FALSE if not
Here is the caller graph for this function: