Motr  M0
console_yaml.h
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2012-2020 Seagate Technology LLC and/or its Affiliates
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * For any questions about this software or licensing,
18  * please email opensource@seagate.com or cortx-questions@seagate.com.
19  *
20  */
21 
22 
23 #pragma once
24 
25 #ifndef __MOTR_CONSOLE_YAML_H__
26 #define __MOTR_CONSOLE_YAML_H__
27 
28 #ifdef HAVE_CONFIG_H
29 # include "config.h"
30 #endif
31 
32 #include <yaml.h>
33 
40 M0_EXTERN bool yaml_support;
41 
47  yaml_parser_t cyi_parser;
49  yaml_event_t cyi_event;
51  yaml_document_t cyi_document;
53  yaml_node_t *cyi_current;
55  FILE *cyi_file;
56 };
57 
66 M0_INTERNAL int m0_cons_yaml_init(const char *path);
67 
77 M0_INTERNAL int m0_cons_yaml_set_value(const char *value, void *data);
78 
87 M0_INTERNAL void *m0_cons_yaml_get_value(const char *value);
88 
92 M0_INTERNAL void m0_cons_yaml_fini(void);
93 
95 /* __MOTR_CONSOLE_YAML_H__ */
96 #endif
97 /*
98  * Local variables:
99  * c-indentation-style: "K&R"
100  * c-basic-offset: 8
101  * tab-width: 8
102  * fill-column: 80
103  * scroll-step: 1
104  * End:
105  */
yaml_document_t cyi_document
Definition: console_yaml.h:51
struct m0_bufvec data
Definition: di.c:40
int const char const void * value
Definition: dir.c:325
M0_INTERNAL int m0_cons_yaml_init(const char *file_path)
Inititalizes parser by opening given file. and also checks for error by getting root node...
Definition: console_yaml.c:94
M0_EXTERN bool yaml_support
Definition: console_yaml.h:40
yaml_parser_t cyi_parser
Definition: console_yaml.h:47
M0_INTERNAL void m0_cons_yaml_fini(void)
Deletes the parser and closes the YAML file.
Definition: console_yaml.c:147
yaml_node_t * cyi_current
Definition: console_yaml.h:53
M0_INTERNAL int m0_cons_yaml_set_value(const char *name, void *data)
Search for specified string and get the respctive value form YAML file. (like "name : console") ...
Definition: console_yaml.c:183
Keeps info for YAML parser.
Definition: console_yaml.h:45
yaml_event_t cyi_event
Definition: console_yaml.h:49
M0_INTERNAL void * m0_cons_yaml_get_value(const char *name)
Search for specified string and set the respctive value form YAML file. (like "name : console") ...
Definition: console_yaml.c:177