1 /**
2  * @file context.h
3  * @author Radek Krejci <rkrejci@cesnet.cz>
4  * @brief internal context structures and functions
5  *
6  * Copyright (c) 2015 - 2017 CESNET, z.s.p.o.
7  *
8  * This source code is licensed under BSD 3-Clause License (the "License").
9  * You may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *     https://opensource.org/licenses/BSD-3-Clause
13  */
14 
15 #ifndef LY_CONTEXT_H_
16 #define LY_CONTEXT_H_
17 
18 #include <pthread.h>
19 
20 #include "libyang.h"
21 #include "common.h"
22 #include "hash_table.h"
23 #include "tree_schema.h"
24 
25 struct ly_modules_list {
26     char **search_paths;
27     int size;
28     int used;
29     struct lys_module **list;
30     /* all (sub)modules that are currently being parsed */
31     struct lys_module **parsing_sub_modules;
32     /* all already parsed submodules of a module, which is before all its submodules (to mark submodule imports) */
33     struct lys_module **parsed_submodules;
34     uint8_t parsing_sub_modules_count;
35     uint8_t parsed_submodules_count;
36     uint16_t module_set_id;
37     int flags; /* see @ref contextoptions. */
38 };
39 
40 struct ly_ctx {
41     struct dict_table dict;
42     struct ly_modules_list models;
43     ly_module_imp_clb imp_clb;
44     void *imp_clb_data;
45     ly_module_data_clb data_clb;
46     void *data_clb_data;
47 #ifdef LY_ENABLED_LYD_PRIV
48     void *(*priv_dup_clb)(const void *priv);
49 #endif
50     pthread_key_t errlist_key;
51     uint8_t internal_module_count;
52 };
53 
54 #endif /* LY_CONTEXT_H_ */
55