Fixed: [Defaults in choice does not work properly](https://github.com/clicon/clixon/issues/390)
C: Added new file clixon_xml_default.[ch] and moved all default handling there
This commit is contained in:
parent
7e92f67f4f
commit
ffe918dd0e
16 changed files with 1015 additions and 667 deletions
|
|
@ -94,6 +94,7 @@ extern "C" {
|
|||
#include <clixon/clixon_data.h>
|
||||
#include <clixon/clixon_regex.h>
|
||||
#include <clixon/clixon_path.h>
|
||||
#include <clixon/clixon_xml_default.h>
|
||||
#include <clixon/clixon_xml_map.h>
|
||||
#include <clixon/clixon_xml_bind.h>
|
||||
#include <clixon/clixon_xml_io.h>
|
||||
|
|
|
|||
59
lib/clixon/clixon_xml_default.h
Normal file
59
lib/clixon/clixon_xml_default.h
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
*
|
||||
***** BEGIN LICENSE BLOCK *****
|
||||
|
||||
Copyright (C) 2009-2016 Olof Hagsand and Benny Holmgren
|
||||
Copyright (C) 2017-2019 Olof Hagsand
|
||||
Copyright (C) 2020-2022 Olof Hagsand and Rubicon Communications, LLC(Netgate)
|
||||
|
||||
This file is part of CLIXON.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Alternatively, the contents of this file may be used under the terms of
|
||||
the GNU General Public License Version 3 or later (the "GPL"),
|
||||
in which case the provisions of the GPL are applicable instead
|
||||
of those above. If you wish to allow use of your version of this file only
|
||||
under the terms of the GPL, and not to allow others to
|
||||
use your version of this file under the terms of Apache License version 2,
|
||||
indicate your decision by deleting the provisions above and replace them with
|
||||
the notice and other provisions required by the GPL. If you do not delete
|
||||
the provisions above, a recipient may use your version of this file under
|
||||
the terms of any one of the Apache License version 2 or the GPL.
|
||||
|
||||
***** END LICENSE BLOCK *****
|
||||
|
||||
*
|
||||
* XML default values
|
||||
*/
|
||||
|
||||
#ifndef _CLIXON_XML_DEFAULT_H_
|
||||
#define _CLIXON_XML_DEFAULT_H_
|
||||
|
||||
/*
|
||||
* Types
|
||||
*/
|
||||
/* Declared in clixon_yang_internal */
|
||||
typedef enum yang_class yang_class;
|
||||
|
||||
/*
|
||||
* Prototypes
|
||||
*/
|
||||
int xml_default_recurse(cxobj *xn, int state);
|
||||
int xml_global_defaults(clicon_handle h, cxobj *xn, cvec *nsc, const char *xpath, yang_stmt *yspec, int state);
|
||||
int xml_defaults_nopresence(cxobj *xn, int purge);
|
||||
int xml_add_default_tag(cxobj *x, uint16_t flags);
|
||||
int xml_flag_state_default_value(cxobj *x, uint16_t flag);
|
||||
int xml_flag_default_value(cxobj *x, uint16_t flag);
|
||||
|
||||
#endif /* _CLIXON_XML_DEFAULT_H_ */
|
||||
|
|
@ -61,9 +61,6 @@ int xml_tree_prune_flagged_sub(cxobj *xt, int flag, int test, int *upmark);
|
|||
int xml_tree_prune_flagged(cxobj *xt, int flag, int test);
|
||||
int xml_tree_prune_flags(cxobj *xt, int flags, int mask);
|
||||
int xml_namespace_change(cxobj *x, char *ns, char *prefix);
|
||||
int xml_default_recurse(cxobj *xn, int state);
|
||||
int xml_global_defaults(clicon_handle h, cxobj *xn, cvec *nsc, const char *xpath, yang_stmt *yspec, int state);
|
||||
int xml_defaults_nopresence(cxobj *xn, int purge);
|
||||
int xml_sanity(cxobj *x, void *arg);
|
||||
int xml_non_config_data(cxobj *xt, cxobj **xerr);
|
||||
int xml2xpath(cxobj *x, cvec *nsc, char **xpath);
|
||||
|
|
@ -79,8 +76,5 @@ int yang_xml_mandatory(cxobj *xt, yang_stmt *ys);
|
|||
int xml_rpc_isaction(cxobj *xn);
|
||||
int xml_find_action(cxobj *xn, int top, cxobj **xap);
|
||||
int purge_tagged_nodes(cxobj *xn, char *ns, char *name, char *value, int keepnode);
|
||||
int xml_add_default_tag(cxobj *x, uint16_t flags);
|
||||
int xml_flag_state_default_value(cxobj *x, uint16_t flag);
|
||||
int xml_flag_default_value(cxobj *x, uint16_t flag);
|
||||
|
||||
#endif /* _CLIXON_XML_MAP_H_ */
|
||||
|
|
|
|||
|
|
@ -66,5 +66,6 @@ int xml2ns_recurse(cxobj *x);
|
|||
int xmlns_set(cxobj *x, char *prefix, char *ns);
|
||||
int xmlns_set_all(cxobj *x, cvec *nsc);
|
||||
int xml2prefix(cxobj *xn, char *ns, char **prefixp);
|
||||
int xml_add_namespace(cxobj *x, cxobj *xp, char *prefix, char *ns);
|
||||
|
||||
#endif /* _CLIXON_XML_NSCTX_H */
|
||||
|
|
|
|||
|
|
@ -257,6 +257,7 @@ char *yang_find_mynamespace(yang_stmt *ys);
|
|||
int yang_find_prefix_by_namespace(yang_stmt *ys, char *ns, char **prefix);
|
||||
int yang_find_namespace_by_prefix(yang_stmt *ys, char *prefix, char **ns);
|
||||
yang_stmt *yang_myroot(yang_stmt *ys);
|
||||
int choice_case_get(yang_stmt *yc, yang_stmt **ycase, yang_stmt **ychoice);
|
||||
yang_stmt *yang_choice(yang_stmt *y);
|
||||
int yang_order(yang_stmt *y);
|
||||
int yang_print_cb(FILE *f, yang_stmt *yn, clicon_output_cb *fn);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue