libyang  2.1.148
libyang is YANG data modelling language parser and toolkit written (and providing API) in C.
metadata.h
Go to the documentation of this file.
1 
16 #ifndef LY_PLUGINS_EXTS_METADATA_H_
17 #define LY_PLUGINS_EXTS_METADATA_H_
18 
19 #include "plugins_exts.h"
20 #include "tree_data.h"
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
36 struct lyd_meta {
37  struct lyd_node *parent;
38  struct lyd_meta *next;
40  const char *name;
41  struct lyd_value value;
42 };
43 
50 static inline const char *
51 lyd_get_meta_value(const struct lyd_meta *meta)
52 {
53  if (meta) {
54  const struct lyd_value *value = &meta->value;
55 
56  return value->_canonical ? value->_canonical : lyd_value_get_canonical(meta->annotation->module->ctx, value);
57  }
58 
59  return NULL;
60 }
61 
62 #ifdef __cplusplus
63 }
64 #endif
65 
66 #endif /* LY_PLUGINS_EXTS_METADATA_H_ */
libyang support for YANG extensions implementation.
struct ly_ctx * ctx
Definition: tree_schema.h:2107
Generic structure for a data node.
Definition: tree_data.h:781
YANG extension compiled instance.
Definition: plugins_exts.h:436
const char * name
Definition: metadata.h:40
struct lyd_node * parent
Definition: metadata.h:37
struct lyd_value value
Definition: metadata.h:41
libyang representation of YANG data trees.
struct lyd_meta * next
Definition: metadata.h:38
YANG data representation.
Definition: tree_data.h:560
const char * _canonical
Definition: tree_data.h:561
Metadata structure.
Definition: metadata.h:36
LIBYANG_API_DECL const char * lyd_value_get_canonical(const struct ly_ctx *ctx, const struct lyd_value *value)
Get the (canonical) value of a lyd_value.
struct lys_module * module
Definition: plugins_exts.h:439
struct lysc_ext_instance * annotation
Definition: metadata.h:39