* Added clicon_handle as parameter to all validate functions
* Added libxml2 XSD regexp mode as alternative to posix translation * Added `CLICON_YANG_REGEXP` option with possible values libxml2 and posix
This commit is contained in:
parent
69f2eb30f1
commit
a804e05375
27 changed files with 501 additions and 289 deletions
|
|
@ -84,6 +84,7 @@
|
|||
#include <clixon/clixon_plugin.h>
|
||||
#include <clixon/clixon_options.h>
|
||||
#include <clixon/clixon_data.h>
|
||||
#include <clixon/clixon_regex.h>
|
||||
#include <clixon/clixon_xml_map.h>
|
||||
#include <clixon/clixon_datastore.h>
|
||||
#include <clixon/clixon_xpath_ctx.h>
|
||||
|
|
|
|||
|
|
@ -129,6 +129,9 @@ static inline char *clicon_yang_module_main(clicon_handle h){
|
|||
static inline char *clicon_yang_module_revision(clicon_handle h){
|
||||
return clicon_option_str(h, "CLICON_YANG_MODULE_REVISION");
|
||||
}
|
||||
static inline char *clicon_yang_regexp(clicon_handle h){
|
||||
return clicon_option_str(h, "CLICON_YANG_REGEXP");
|
||||
}
|
||||
static inline char *clicon_backend_dir(clicon_handle h){
|
||||
return clicon_option_str(h, "CLICON_BACKEND_DIR");
|
||||
}
|
||||
|
|
|
|||
46
lib/clixon/clixon_regex.h
Normal file
46
lib/clixon/clixon_regex.h
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
*
|
||||
***** BEGIN LICENSE BLOCK *****
|
||||
|
||||
Copyright (C) 2009-2019 Olof Hagsand and Benny Holmgren
|
||||
|
||||
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 *****
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _CLIXON_REGEX_H_
|
||||
#define _CLIXON_REGEX_H_
|
||||
|
||||
/*
|
||||
* Prototypes
|
||||
*/
|
||||
int regexp_xsd2posix(char *xsd, char **posix);
|
||||
int regex_compile(clicon_handle h, char *regexp, void **recomp);
|
||||
int regex_exec(clicon_handle h, void *recomp, char *string);
|
||||
|
||||
#endif /* _CLIXON_REGEX_H_ */
|
||||
|
|
@ -89,7 +89,6 @@ int clicon_str2int(const map_str2int *mstab, char *str);
|
|||
int clicon_str2int_search(const map_str2int *mstab, char *str, int upper);
|
||||
int nodeid_split(char *nodeid, char **prefix, char **id);
|
||||
char *clixon_trim(char *str);
|
||||
int regexp_xsd2posix(char *xsd, char **posix);
|
||||
#ifndef HAVE_STRNDUP
|
||||
char *clicon_strndup (const char *, size_t);
|
||||
#endif /* ! HAVE_STRNDUP */
|
||||
|
|
|
|||
|
|
@ -48,11 +48,11 @@ int xml2txt(FILE *f, cxobj *x, int level);
|
|||
int xml2cli(FILE *f, cxobj *x, char *prepend, enum genmodel_type gt);
|
||||
int xml_yang_root(cxobj *x, cxobj **xr);
|
||||
int xmlns_assign(cxobj *x);
|
||||
int xml_yang_validate_rpc(cxobj *xrpc, cbuf *cbret);
|
||||
int xml_yang_validate_list_key_only(cxobj *xt, cbuf *cbret);
|
||||
int xml_yang_validate_add(cxobj *xt, cbuf *cbret);
|
||||
int xml_yang_validate_all(cxobj *xt, cbuf *cbret);
|
||||
int xml_yang_validate_all_top(cxobj *xt, cbuf *cbret);
|
||||
int xml_yang_validate_rpc(clicon_handle h, cxobj *xrpc, cbuf *cbret);
|
||||
int xml_yang_validate_list_key_only(clicon_handle h, cxobj *xt, cbuf *cbret);
|
||||
int xml_yang_validate_add(clicon_handle h, cxobj *xt, cbuf *cbret);
|
||||
int xml_yang_validate_all(clicon_handle h, cxobj *xt, cbuf *cbret);
|
||||
int xml_yang_validate_all_top(clicon_handle h, cxobj *xt, cbuf *cbret);
|
||||
int xml2cvec(cxobj *xt, yang_stmt *ys, cvec **cvv0);
|
||||
int cvec2xml_1(cvec *cvv, char *toptag, cxobj *xp, cxobj **xt0);
|
||||
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ int ys_resolve_type(yang_stmt *ys, void *arg);
|
|||
int yang2cv_type(char *ytype, enum cv_type *cv_type);
|
||||
char *cv2yang_type(enum cv_type cv_type);
|
||||
yang_stmt *yang_find_identity(yang_stmt *ys, char *identity);
|
||||
int ys_cv_validate(cg_var *cv, yang_stmt *ys, char **reason);
|
||||
int ys_cv_validate(clicon_handle h, cg_var *cv, yang_stmt *ys, char **reason);
|
||||
int clicon_type2cv(char *type, char *rtype, yang_stmt *ys, enum cv_type *cvtype);
|
||||
int yang_type_get(yang_stmt *ys, char **otype, yang_stmt **restype,
|
||||
int *options, cvec **cvv, char **pattern,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue