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 * "api-path" is "URI-encoded path expression" definition in RFC8040 3.5.3 36 */ 37 #ifndef _CLIXON_API_PATH_PARSE_H_ 38 #define _CLIXON_API_PATH_PARSE_H_ 39 40 /* 41 * Types 42 */ 43 struct clixon_api_path_yacc { 44 const char *ay_name; /* Name of syntax (for error string) */ 45 int ay_linenum; /* Number of \n in parsed buffer */ 46 char *ay_parse_string; /* original (copy of) parse string */ 47 void *ay_lexbuf; /* internal parse buffer from lex */ 48 clixon_path *ay_top; 49 }; 50 typedef struct clixon_api_path_yacc clixon_api_path_yacc; 51 52 /* 53 * Variables 54 */ 55 extern char *clixon_api_path_parsetext; 56 57 /* 58 * Prototypes 59 */ 60 int api_path_scan_init(clixon_api_path_yacc *); 61 int api_path_scan_exit(clixon_api_path_yacc *); 62 63 int api_path_parse_init(clixon_api_path_yacc *); 64 int api_path_parse_exit(clixon_api_path_yacc *); 65 66 int clixon_api_path_parselex(void *); 67 int clixon_api_path_parseparse(void *); 68 void clixon_api_path_parseerror(void *, char*); 69 70 #endif /* _CLIXON_API_PATH_PARSE_H_ */ 71