1 /* 2 * 3 ***** BEGIN LICENSE BLOCK ***** 4 5 Copyright (C) 2009-2019 Olof Hagsand 6 Copyright (C) 2020 Olof Hagsand and Rubicon Communications, LLC(Netgate) 7 8 This file is part of CLIXON. 9 10 Licensed under the Apache License, Version 2.0 (the "License"); 11 you may not use this file except in compliance with the License. 12 You may obtain a copy of the License at 13 14 http://www.apache.org/licenses/LICENSE-2.0 15 16 Unless required by applicable law or agreed to in writing, software 17 distributed under the License is distributed on an "AS IS" BASIS, 18 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 See the License for the specific language governing permissions and 20 limitations under the License. 21 22 Alternatively, the contents of this file may be used under the terms of 23 the GNU General Public License Version 3 or later (the "GPL"), 24 in which case the provisions of the GPL are applicable instead 25 of those above. If you wish to allow use of your version of this file only 26 under the terms of the GPL, and not to allow others to 27 use your version of this file under the terms of Apache License version 2, 28 indicate your decision by deleting the provisions above and replace them with 29 the notice and other provisions required by the GPL. If you do not delete 30 the provisions above, a recipient may use your version of this file under 31 the terms of any one of the Apache License version 2 or the GPL. 32 33 ***** END LICENSE BLOCK ***** 34 35 * Clixon XML XPATH 1.0 according to https://www.w3.org/TR/xpath-10 (Base XML) 36 * and rfc 7950 (YANG-specific) 37 */ 38 #ifndef _CLIXON_XPATH_FUNCTION_H 39 #define _CLIXON_XPATH_FUNCTION_H 40 41 /* 42 * Types 43 */ 44 /* 45 * XPath functions from Xpath 1.0 spec or YANG 46 * @see xp_checkfn where they are parsed and checked 47 * @see clixon_xpath_function.c for implementations 48 */ 49 enum clixon_xpath_function{ 50 XPATHFN_CURRENT, /* RFC 7950 10.1.1 */ 51 XPATHFN_RE_MATCH, /* RFC 7950 10.2.1 NYI */ 52 XPATHFN_DEREF, /* RFC 7950 10.3.1 */ 53 XPATHFN_DERIVED_FROM, /* RFC 7950 10.4.1 */ 54 XPATHFN_DERIVED_FROM_OR_SELF, /* RFC 7950 10.4.2 */ 55 XPATHFN_ENUM_VALUE, /* RFC 7950 10.5.1 NYI */ 56 XPATHFN_BIT_IS_SET, /* RFC 7950 10.6.1 NYI */ 57 XPATHFN_LAST, /* XPATH 1.0 4.1 NYI */ 58 XPATHFN_POSITION, /* XPATH 1.0 4.1 NYI */ 59 XPATHFN_COUNT, /* XPATH 1.0 4.1 */ 60 XPATHFN_ID, /* XPATH 1.0 4.1 NYI */ 61 XPATHFN_LOCAL_NAME, /* XPATH 1.0 4.1 NYI */ 62 XPATHFN_NAMESPACE_URI, /* XPATH 1.0 4.1 NYI */ 63 XPATHFN_NAME, /* XPATH 1.0 4.1 */ 64 XPATHFN_STRING, /* XPATH 1.0 4.2 NYI */ 65 XPATHFN_CONCAT, /* XPATH 1.0 4.2 NYI */ 66 XPATHFN_STARTS_WITH, /* XPATH 1.0 4.2 NYI */ 67 XPATHFN_CONTAINS, /* XPATH 1.0 4.2 */ 68 XPATHFN_SUBSTRING_BEFORE, /* XPATH 1.0 4.2 NYI */ 69 XPATHFN_SUBSTRING_AFTER, /* XPATH 1.0 4.2 NYI */ 70 XPATHFN_SUBSTRING, /* XPATH 1.0 4.2 NYI */ 71 XPATHFN_STRING_LENGTH, /* XPATH 1.0 4.2 NYI */ 72 XPATHFN_NORMALIZE_SPACE, /* XPATH 1.0 4.2 NYI */ 73 XPATHFN_TRANSLATE, /* XPATH 1.0 4.2 NYI */ 74 XPATHFN_BOOLEAN, /* XPATH 1.0 4.3 NYI */ 75 XPATHFN_NOT, /* XPATH 1.0 4.3 */ 76 XPATHFN_TRUE, /* XPATH 1.0 4.3 NYI */ 77 XPATHFN_FALSE, /* XPATH 1.0 4.3 NYI */ 78 XPATHFN_LANG, /* XPATH 1.0 4.3 NYI */ 79 XPATHFN_NUMBER, /* XPATH 1.0 4.4 NYI */ 80 XPATHFN_SUM, /* XPATH 1.0 4.4 NYI */ 81 XPATHFN_FLOOR, /* XPATH 1.0 4.4 NYI */ 82 XPATHFN_CEILING, /* XPATH 1.0 4.4 NYI */ 83 XPATHFN_ROUND, /* XPATH 1.0 4.4 NYI */ 84 XPATHFN_COMMENT, /* XPATH 1.0 nodetype NYI */ 85 XPATHFN_TEXT, /* XPATH 1.0 nodetype */ 86 XPATHFN_PROCESSING_INSTRUCTIONS,/* XPATH 1.0 nodetype NYI */ 87 XPATHFN_NODE, /* XPATH 1.0 nodetype */ 88 }; 89 90 /* 91 * Prototypes 92 */ 93 int xp_fnname_str2int(char *fnname); 94 const char *xp_fnname_int2str(enum clixon_xpath_function code); 95 96 int xp_function_current(xp_ctx *xc, struct xpath_tree *xs, cvec *nsc, int localonly, xp_ctx **xrp); 97 int xp_function_deref(xp_ctx *xc, struct xpath_tree *xs, cvec *nsc, int localonly, xp_ctx **xrp); 98 int xp_function_derived_from(xp_ctx *xc, struct xpath_tree *xs, cvec *nsc, int localonly, int self, xp_ctx **xrp); 99 int xp_function_count(xp_ctx *xc, struct xpath_tree *xs, cvec *nsc, int localonly, xp_ctx **xrp); 100 int xp_function_name(xp_ctx *xc, struct xpath_tree *xs, cvec *nsc, int localonly, xp_ctx **xrp); 101 int xp_function_contains(xp_ctx *xc, struct xpath_tree *xs, cvec *nsc, int localonly, xp_ctx **xrp); 102 int xp_function_not(xp_ctx *xc, struct xpath_tree *xs, cvec *nsc, int localonly, xp_ctx **xrp); 103 104 #endif /* _CLIXON_XPATH_FUNCTION_H */ 105