Structural C-code change: Merged yang_spec and yang_node types into yang_stmt
This commit is contained in:
parent
4f9e942103
commit
b5f1f7346e
52 changed files with 492 additions and 496 deletions
|
|
@ -58,14 +58,14 @@ typedef struct {
|
|||
/*
|
||||
* Prototypes
|
||||
*/
|
||||
yang_spec * clicon_dbspec_yang(clicon_handle h);
|
||||
int clicon_dbspec_yang_set(clicon_handle h, struct yang_spec *ys);
|
||||
yang_stmt * clicon_dbspec_yang(clicon_handle h);
|
||||
int clicon_dbspec_yang_set(clicon_handle h, yang_stmt *ys);
|
||||
|
||||
cxobj * clicon_nacm_ext(clicon_handle h);
|
||||
int clicon_nacm_ext_set(clicon_handle h, cxobj *xn);
|
||||
|
||||
yang_spec * clicon_config_yang(clicon_handle h);
|
||||
int clicon_config_yang_set(clicon_handle h, struct yang_spec *ys);
|
||||
yang_stmt * clicon_config_yang(clicon_handle h);
|
||||
int clicon_config_yang_set(clicon_handle h, yang_stmt *ys);
|
||||
|
||||
cxobj *clicon_conf_xml(clicon_handle h);
|
||||
int clicon_conf_xml_set(clicon_handle h, cxobj *x);
|
||||
|
|
|
|||
|
|
@ -43,8 +43,8 @@ int xml2json_cbuf(cbuf *cb, cxobj *x, int pretty);
|
|||
int xml2json_cbuf_vec(cbuf *cb, cxobj **vec, size_t veclen, int pretty);
|
||||
int xml2json(FILE *f, cxobj *x, int pretty);
|
||||
int xml2json_vec(FILE *f, cxobj **vec, size_t veclen, int pretty);
|
||||
int json2xml_ns(yang_spec *yspec, cxobj *x, cxobj **xerr);
|
||||
int json2xml_ns(yang_stmt *yspec, cxobj *x, cxobj **xerr);
|
||||
int json_parse_str(char *str, cxobj **xt);
|
||||
int json_parse_file(int fd, yang_spec *yspec, cxobj **xt);
|
||||
int json_parse_file(int fd, yang_stmt *yspec, cxobj **xt);
|
||||
|
||||
#endif /* _CLIXON_JSON_H */
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ int netconf_operation_failed(cbuf *cb, char *type, char *message);
|
|||
int netconf_operation_failed_xml(cxobj **xret, char *type, char *message);
|
||||
int netconf_malformed_message(cbuf *cb, char *message);
|
||||
int netconf_malformed_message_xml(cxobj **xret, char *message);
|
||||
int netconf_trymerge(cxobj *x, yang_spec *yspec, cxobj **xret);
|
||||
int netconf_trymerge(cxobj *x, yang_stmt *yspec, cxobj **xret);
|
||||
int netconf_module_load(clicon_handle h);
|
||||
char *netconf_db_find(cxobj *xn, char *name);
|
||||
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ int clicon_option_dump(clicon_handle h, int dblevel);
|
|||
int clicon_option_add(clicon_handle h, char *name, char *value);
|
||||
|
||||
/* Initialize options: set defaults, read config-file, etc */
|
||||
int clicon_options_main(clicon_handle h, yang_spec *yspec);
|
||||
int clicon_options_main(clicon_handle h, yang_stmt *yspec);
|
||||
|
||||
/*! Check if a clicon option has a value */
|
||||
int clicon_option_exists(clicon_handle h, const char *name);
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ struct clicon_msg *clicon_msg_encode(char *format, ...) __attribute__ ((format (
|
|||
#else
|
||||
struct clicon_msg *clicon_msg_encode(char *format, ...);
|
||||
#endif
|
||||
int clicon_msg_decode(struct clicon_msg *msg, yang_spec *yspec, cxobj **xml);
|
||||
int clicon_msg_decode(struct clicon_msg *msg, yang_stmt *yspec, cxobj **xml);
|
||||
|
||||
int clicon_connect_unix(char *sockpath);
|
||||
|
||||
|
|
|
|||
|
|
@ -153,12 +153,12 @@ int xml_free(cxobj *xn);
|
|||
int xml_print(FILE *f, cxobj *xn);
|
||||
int clicon_xml2file(FILE *f, cxobj *xn, int level, int prettyprint);
|
||||
int clicon_xml2cbuf(cbuf *xf, cxobj *xn, int level, int prettyprint);
|
||||
int xml_parse_file(int fd, char *endtag, yang_spec *yspec, cxobj **xt);
|
||||
int xml_parse_string(const char *str, yang_spec *yspec, cxobj **xml_top);
|
||||
int xml_parse_file(int fd, char *endtag, yang_stmt *yspec, cxobj **xt);
|
||||
int xml_parse_string(const char *str, yang_stmt *yspec, cxobj **xml_top);
|
||||
#if defined(__GNUC__) && __GNUC__ >= 3
|
||||
int xml_parse_va(cxobj **xt, yang_spec *yspec, const char *format, ...) __attribute__ ((format (printf, 3, 4)));
|
||||
int xml_parse_va(cxobj **xt, yang_stmt *yspec, const char *format, ...) __attribute__ ((format (printf, 3, 4)));
|
||||
#else
|
||||
int xml_parse_va(cxobj **xt, yang_spec *yspec, const char *format, ...);
|
||||
int xml_parse_va(cxobj **xt, yang_stmt *yspec, const char *format, ...);
|
||||
#endif
|
||||
int xmltree2cbuf(cbuf *cb, cxobj *x, int level);
|
||||
int xml_copy_one(cxobj *xn0, cxobj *xn1);
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ int xml_yang_validate_all(cxobj *xt, cbuf *cbret);
|
|||
int xml_yang_validate_all_top(cxobj *xt, cbuf *cbret);
|
||||
int xml2cvec(cxobj *xt, yang_stmt *ys, cvec **cvv0);
|
||||
int cvec2xml_1(cvec *cvv, char *toptag, cxobj *xp, cxobj **xt0);
|
||||
int xml_diff(yang_spec *yspec, cxobj *xt1, cxobj *xt2,
|
||||
int xml_diff(yang_stmt *yspec, cxobj *xt1, cxobj *xt2,
|
||||
cxobj ***first, size_t *firstlen,
|
||||
cxobj ***second, size_t *secondlen,
|
||||
cxobj ***changed1, cxobj ***changed2, size_t *changedlen);
|
||||
|
|
@ -63,12 +63,12 @@ int xml_tree_prune_flagged(cxobj *xt, int flag, int test);
|
|||
int xml_default(cxobj *x, void *arg);
|
||||
int xml_sanity(cxobj *x, void *arg);
|
||||
int xml_non_config_data(cxobj *xt, void *arg);
|
||||
int xml_spec_populate_rpc(clicon_handle h, cxobj *x, yang_spec *yspec);
|
||||
int xml_spec_populate_rpc(clicon_handle h, cxobj *x, yang_stmt *yspec);
|
||||
int xml_spec_populate(cxobj *x, void *arg);
|
||||
int api_path2xpath(yang_spec *yspec, cvec *cvv, int offset, cbuf *xpath);
|
||||
int api_path2xml(char *api_path, yang_spec *yspec, cxobj *xtop,
|
||||
yang_class nodeclass, cxobj **xpathp, yang_node **ypathp);
|
||||
int xml_merge(cxobj *x0, cxobj *x1, yang_spec *yspec, char **reason);
|
||||
int api_path2xpath(yang_stmt *yspec, cvec *cvv, int offset, cbuf *xpath);
|
||||
int api_path2xml(char *api_path, yang_stmt *yspec, cxobj *xtop,
|
||||
yang_class nodeclass, cxobj **xpathp, yang_stmt **ypathp);
|
||||
int xml_merge(cxobj *x0, cxobj *x1, yang_stmt *yspec, char **reason);
|
||||
int yang_enum_int_value(cxobj *node, int32_t *val);
|
||||
|
||||
#endif /* _CLIXON_XML_MAP_H_ */
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
/*
|
||||
* Prototypes
|
||||
*/
|
||||
int xml_child_spec(cxobj *x, cxobj *xp, yang_spec *yspec, yang_stmt **yp);
|
||||
int xml_child_spec(cxobj *x, cxobj *xp, yang_stmt *yspec, yang_stmt **yp);
|
||||
int xml_sort(cxobj *x0, void *arg);
|
||||
cxobj *xml_search(cxobj *x, char *name, int yangi, enum rfc_6020 keyword, int keynr, char **keyvec, char **keyval);
|
||||
int xml_insert_pos(cxobj *x0, char *name, int yangi, enum rfc_6020 keyword,
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ typedef struct yang_type_cache yang_type_cache;
|
|||
struct yang_stmt{
|
||||
int ys_len; /* Number of children */
|
||||
struct yang_stmt **ys_stmt; /* Vector of children statement pointers */
|
||||
struct yang_node *ys_parent; /* Backpointer to parent: yang-stmt or yang-spec */
|
||||
struct yang_stmt *ys_parent; /* Backpointer to parent: yang-stmt or yang-spec */
|
||||
enum rfc_6020 ys_keyword; /* See clicon_yang_parse.tab.h */
|
||||
|
||||
char *ys_argument; /* String / argument depending on keyword */
|
||||
|
|
@ -220,68 +220,64 @@ struct yang_stmt{
|
|||
yang_type_cache *ys_typecache; /* If ys_keyword==Y_TYPE, cache all typedef data except unions */
|
||||
};
|
||||
|
||||
/*! top-level yang parse-tree */
|
||||
struct yang_spec{
|
||||
int yp_len; /* Number of children */
|
||||
struct yang_stmt **yp_stmt; /* Vector of children statement pointers */
|
||||
struct yang_node *yp_parent; /* Backpointer to parent: always NULL. See yang_stmt */
|
||||
enum rfc_6020 yp_keyword; /* SHOULD BE Y_SPEC */
|
||||
char *yp_argument; /* XXX String / argument depending on keyword */
|
||||
int yp_flags; /* Flags according to YANG_FLAG_* above */
|
||||
};
|
||||
typedef struct yang_spec yang_spec;
|
||||
#if 0 /* Backward compatible */
|
||||
typedef struct yang_stmt yang_node;
|
||||
typedef struct yang_stmt yang_spec;
|
||||
|
||||
/*! super-class of yang_stmt and yang_spec: it must start exactly as those two classes */
|
||||
struct yang_node{
|
||||
int yn_len; /* Number of children */
|
||||
struct yang_stmt **yn_stmt; /* Vector of children statement pointers */
|
||||
struct yang_node *yn_parent; /* Backpointer to parent: yang-stmt or yang-spec */
|
||||
enum rfc_6020 yn_keyword; /* See clicon_yang_parse.tab.h */
|
||||
char *yn_argument; /* XXX String / argument depending on keyword */
|
||||
int yn_flags; /* Flags according to YANG_FLAG_* above */
|
||||
};
|
||||
typedef struct yang_node yang_node;
|
||||
#define yn_len ys_len
|
||||
#define yn_stmt ys_stmt
|
||||
#define yn_parent ys_parent
|
||||
#define yn_keyword ys_keyword
|
||||
#define yn_argument ys_argument
|
||||
#define yn_flags ys_flags
|
||||
#define yp_len ys_len
|
||||
#define yp_stmt ys_stmt
|
||||
#define yp_parent ys_parent
|
||||
#define yp_keyword ys_keyword
|
||||
#define yp_argument ys_argument
|
||||
#define yp_flags ys_flags
|
||||
#endif
|
||||
|
||||
typedef int (yang_applyfn_t)(yang_stmt *ys, void *arg);
|
||||
|
||||
/*
|
||||
* Prototypes
|
||||
*/
|
||||
yang_spec *yspec_new(void);
|
||||
yang_stmt *yspec_new(void);
|
||||
yang_stmt *ys_new(enum rfc_6020 keyw);
|
||||
int ys_free(yang_stmt *ys);
|
||||
int yspec_free(yang_spec *yspec);
|
||||
int yspec_free(yang_stmt *yspec);
|
||||
int ys_cp(yang_stmt *new, yang_stmt *old);
|
||||
yang_stmt *ys_dup(yang_stmt *old);
|
||||
int yn_insert(yang_node *yn_parent, yang_stmt *ys_child);
|
||||
yang_stmt *yn_each(yang_node *yn, yang_stmt *ys);
|
||||
int yn_insert(yang_stmt *ys_parent, yang_stmt *ys_child);
|
||||
yang_stmt *yn_each(yang_stmt *yn, yang_stmt *ys);
|
||||
char *yang_key2str(int keyword);
|
||||
char *yarg_prefix(yang_stmt *ys);
|
||||
char *yarg_id(yang_stmt *ys);
|
||||
int ys_module_by_xml(yang_spec *ysp, struct xml *xt, yang_stmt **ymodp);
|
||||
int ys_module_by_xml(yang_stmt *ysp, struct xml *xt, yang_stmt **ymodp);
|
||||
yang_stmt *ys_module(yang_stmt *ys);
|
||||
yang_spec *ys_spec(yang_stmt *ys);
|
||||
yang_stmt *ys_spec(yang_stmt *ys);
|
||||
yang_stmt *yang_find_module_by_prefix(yang_stmt *ys, char *prefix);
|
||||
yang_stmt *yang_find_module_by_namespace(yang_spec *yspec, char *namespace);
|
||||
yang_stmt *yang_find_module_by_name(yang_spec *yspec, char *name);
|
||||
yang_stmt *yang_find(yang_node *yn, int keyword, const char *argument);
|
||||
int yang_match(yang_node *yn, int keyword, char *argument);
|
||||
yang_stmt *yang_find_datanode(yang_node *yn, char *argument);
|
||||
yang_stmt *yang_find_schemanode(yang_node *yn, char *argument);
|
||||
yang_stmt *yang_find_module_by_namespace(yang_stmt *yspec, char *namespace);
|
||||
yang_stmt *yang_find_module_by_name(yang_stmt *yspec, char *name);
|
||||
yang_stmt *yang_find(yang_stmt *yn, int keyword, const char *argument);
|
||||
int yang_match(yang_stmt *yn, int keyword, char *argument);
|
||||
yang_stmt *yang_find_datanode(yang_stmt *yn, char *argument);
|
||||
yang_stmt *yang_find_schemanode(yang_stmt *yn, char *argument);
|
||||
char *yang_find_myprefix(yang_stmt *ys);
|
||||
char *yang_find_mynamespace(yang_stmt *ys);
|
||||
yang_node *yang_choice(yang_stmt *y);
|
||||
yang_stmt *yang_choice(yang_stmt *y);
|
||||
int yang_order(yang_stmt *y);
|
||||
int yang_print(FILE *f, yang_node *yn);
|
||||
int yang_print_cbuf(cbuf *cb, yang_node *yn, int marginal);
|
||||
int yang_print(FILE *f, yang_stmt *yn);
|
||||
int yang_print_cbuf(cbuf *cb, yang_stmt *yn, int marginal);
|
||||
int ys_populate(yang_stmt *ys, void *arg);
|
||||
yang_stmt *yang_parse_file(int fd, const char *name, yang_spec *ysp);
|
||||
int yang_apply(yang_node *yn, enum rfc_6020 key, yang_applyfn_t fn,
|
||||
yang_stmt *yang_parse_file(int fd, const char *name, yang_stmt *ysp);
|
||||
int yang_apply(yang_stmt *yn, enum rfc_6020 key, yang_applyfn_t fn,
|
||||
void *arg);
|
||||
int yang_abs_schema_nodeid(yang_spec *yspec, yang_stmt *ys,
|
||||
int yang_abs_schema_nodeid(yang_stmt *yspec, yang_stmt *ys,
|
||||
char *schema_nodeid,
|
||||
enum rfc_6020 keyword, yang_stmt **yres);
|
||||
int yang_desc_schema_nodeid(yang_node *yn, char *schema_nodeid,
|
||||
int yang_desc_schema_nodeid(yang_stmt *yn, char *schema_nodeid,
|
||||
enum rfc_6020 keyword, yang_stmt **yres);
|
||||
int ys_parse_date_arg(char *datearg, uint32_t *dateint);
|
||||
|
||||
|
|
@ -290,10 +286,10 @@ int ys_parse_sub(yang_stmt *ys, char *extra);
|
|||
int yang_mandatory(yang_stmt *ys);
|
||||
int yang_config(yang_stmt *ys);
|
||||
int yang_spec_parse_module(clicon_handle h, const char *module,
|
||||
const char *revision, yang_spec *yspec);
|
||||
int yang_spec_parse_file(clicon_handle h, char *filename, yang_spec *yspec);
|
||||
int yang_spec_load_dir(clicon_handle h, char *dir, yang_spec *yspec);
|
||||
const char *revision, yang_stmt *yspec);
|
||||
int yang_spec_parse_file(clicon_handle h, char *filename, yang_stmt *yspec);
|
||||
int yang_spec_load_dir(clicon_handle h, char *dir, yang_stmt *yspec);
|
||||
cvec *yang_arg2cvec(yang_stmt *ys, char *delimi);
|
||||
int yang_key_match(yang_node *yn, char *name);
|
||||
int yang_key_match(yang_stmt *yn, char *name);
|
||||
|
||||
#endif /* _CLIXON_YANG_H_ */
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ int modstate_diff_free(modstate_diff_t *);
|
|||
int yang_modules_init(clicon_handle h);
|
||||
char *yang_modules_revision(clicon_handle h);
|
||||
|
||||
int yang_modules_state_get(clicon_handle h, yang_spec *yspec, char *xpath,
|
||||
int yang_modules_state_get(clicon_handle h, yang_stmt *yspec, char *xpath,
|
||||
int brief, cxobj **xret);
|
||||
|
||||
int clixon_module_upgrade(clicon_handle h, cxobj *xt, modstate_diff_t *msd, cbuf *cb);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue