mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-08 09:30:30 +00:00
lib: yang wrapper for getting empty type
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
This commit is contained in:
parent
c64e4ca2a7
commit
47cd223441
@ -792,6 +792,29 @@ struct yang_data *yang_data_new_empty(const char *xpath)
|
|||||||
return yang_data_new(xpath, NULL);
|
return yang_data_new(xpath, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool yang_dnode_get_empty(const struct lyd_node *dnode, const char *xpath_fmt,
|
||||||
|
...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
char xpath[XPATH_MAXLEN];
|
||||||
|
const struct lyd_node_leaf_list *dleaf;
|
||||||
|
|
||||||
|
assert(dnode);
|
||||||
|
|
||||||
|
va_start(ap, xpath_fmt);
|
||||||
|
vsnprintf(xpath, sizeof(xpath), xpath_fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
|
dnode = yang_dnode_get(dnode, xpath);
|
||||||
|
if (dnode) {
|
||||||
|
dleaf = (const struct lyd_node_leaf_list *)dnode;
|
||||||
|
if (dleaf->value_type == LY_TYPE_EMPTY)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Derived type: IP prefix.
|
* Derived type: IP prefix.
|
||||||
*/
|
*/
|
||||||
|
@ -120,6 +120,8 @@ extern void yang_get_default_string_buf(char *buf, size_t size,
|
|||||||
|
|
||||||
/* empty */
|
/* empty */
|
||||||
extern struct yang_data *yang_data_new_empty(const char *xpath);
|
extern struct yang_data *yang_data_new_empty(const char *xpath);
|
||||||
|
extern bool yang_dnode_get_empty(const struct lyd_node *dnode,
|
||||||
|
const char *xpath_fmt, ...);
|
||||||
|
|
||||||
/* ip prefix */
|
/* ip prefix */
|
||||||
extern void yang_str2prefix(const char *value, union prefixptr prefix);
|
extern void yang_str2prefix(const char *value, union prefixptr prefix);
|
||||||
|
Loading…
Reference in New Issue
Block a user