CliXoN
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
clixon_qdb.h
Go to the documentation of this file.
1 /*
2  *
3  ***** BEGIN LICENSE BLOCK *****
4 
5  Copyright (C) 2009-2017 Olof Hagsand and Benny Holmgren
6 
7  This file is part of CLIXON.
8 
9  Licensed under the Apache License, Version 2.0 (the "License");
10  you may not use this file except in compliance with the License.
11  You may obtain a copy of the License at
12 
13  http://www.apache.org/licenses/LICENSE-2.0
14 
15  Unless required by applicable law or agreed to in writing, software
16  distributed under the License is distributed on an "AS IS" BASIS,
17  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  See the License for the specific language governing permissions and
19  limitations under the License.
20 
21  Alternatively, the contents of this file may be used under the terms of
22  the GNU General Public License Version 3 or later (the "GPL"),
23  in which case the provisions of the GPL are applicable instead
24  of those above. If you wish to allow use of your version of this file only
25  under the terms of the GPL, and not to allow others to
26  use your version of this file under the terms of Apache License version 2,
27  indicate your decision by deleting the provisions above and replace them with
28  the notice and other provisions required by the GPL. If you do not delete
29  the provisions above, a recipient may use your version of this file under
30  the terms of any one of the Apache License version 2 or the GPL.
31 
32  ***** END LICENSE BLOCK *****
33 
34  */
35 
36 #ifndef _CLIXON_QDB_H_
37 #define _CLIXON_QDB_H_
38 
39 
40 /*
41  * Low level API
42  */
43 
44 struct db_pair {
45  char *dp_key; /* database key */
46  char *dp_matched; /* Matched component of key */
47  char *dp_val; /* pointer to vector of lvalues */
48  int dp_vlen; /* length of vector of lvalues */
49 };
50 
51 /*
52  * Prototypes
53  */
54 int db_init(char *file);
55 
56 int db_delete(char *file);
57 
58 int db_set(char *file, char *key, void *data, size_t datalen);
59 
60 int db_get(char *file, char *key, void *data, size_t *datalen);
61 
62 int db_get_alloc(char *file, char *key, void **data, size_t *datalen);
63 
64 int db_del(char *file, char *key);
65 
66 int db_exists(char *file, char *key);
67 
68 int db_regexp(char *file, char *regexp, const char *label,
69  struct db_pair **pairs, int noval);
70 
71 char *db_sanitize(char *rx, const char *label);
72 
73 #endif /* _CLIXON_QDB_H_ */
char * dp_matched
Definition: clixon_qdb.h:46
< KEYWORD > key
Definition: clixon_yang_parse.l:143
char * db_sanitize(char *rx, const char *label)
Definition: clixon_qdb.c:491
int db_set(char *file, char *key, void *data, size_t datalen)
Definition: clixon_qdb.c:149
int db_exists(char *file, char *key)
Definition: clixon_qdb.c:329
int db_get_alloc(char *file, char *key, void **data, size_t *datalen)
Definition: clixon_qdb.c:253
char * dp_key
Definition: clixon_qdb.h:45
int db_init(char *file)
Definition: clixon_qdb.c:117
int db_del(char *file, char *key)
Definition: clixon_qdb.c:299
int dp_vlen
Definition: clixon_qdb.h:48
int db_get(char *file, char *key, void *data, size_t *datalen)
Definition: clixon_qdb.c:191
Definition: clixon_qdb.h:44
char * dp_val
Definition: clixon_qdb.h:47
int db_regexp(char *file, char *regexp, const char *label, struct db_pair **pairs, int noval)
Definition: clixon_qdb.c:373
int db_delete(char *file)
Definition: clixon_qdb.c:126