Support SMACK permissive mode in Buxton
[platform/upstream/buxton.git] / src / shared / configurator.h
1 /*
2  * This file is part of buxton.
3  *
4  * Copyright (C) 2013 Intel Corporation
5  *
6  * buxton is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as
8  * published by the Free Software Foundation; either version 2.1
9  * of the License, or (at your option) any later version.
10  */
11
12 /**
13  * \file configurator.h Internal header
14  * This file is used internally by buxton to provide functionality
15  * used to handle the configuration
16  */
17 #pragma once
18
19 #ifdef HAVE_CONFIG_H
20         #include "config.h"
21 #endif
22
23 typedef enum ConfigKey {
24         CONFIG_MIN = 0,
25         CONFIG_CONF_FILE,
26         CONFIG_MODULE_DIR,
27         CONFIG_DB_PATH,
28         CONFIG_SMACK_LOAD_FILE,
29         CONFIG_BUXTON_SOCKET,
30         CONFIG_SMACK_PERMISSIVE,
31         CONFIG_MAX
32 } ConfigKey;
33
34 /**
35  * Slightly duplicative of BuxtonLayer, but defined here instead of
36  * there. This will probably be deprecated for BuxtonLayer once
37  * things are integrated.
38  */
39 typedef struct ConfigLayer {
40         char *name;
41         char *type;
42         char *backend;
43         char *description;
44         char *access;
45         int priority;
46 } ConfigLayer;
47
48 /**
49  * @internal
50  * @brief Add command line data
51  *
52  * @note This API is draft
53  */
54 void buxton_add_cmd_line(ConfigKey confkey, const char *data);
55
56 /**
57  * @internal
58  * @brief Get the directory of plugin modules
59  *
60  * @return the path to the plugin module. Do not free this pointer.
61  * It belongs to configurator.
62  */
63 const char *buxton_module_dir(void)
64         __attribute__((warn_unused_result));
65
66 /**
67  * @internal
68  * @brief Get the path of the config file
69  *
70  * @return the path of the config file. Do not free this pointer.
71  * It belongs to configurator.
72  */
73 const char *buxton_conf_file(void)
74         __attribute__((warn_unused_result));
75
76 /**
77  * @internal
78  * @brief Get the path of the buxton database
79  *
80  *
81  * @return the path of the database file. Do not free this pointer.
82  * It belongs to configurator.
83  */
84 const char *buxton_db_path(void)
85         __attribute__((warn_unused_result));
86
87 /**
88  * @internal
89  * @brief Get the path of the smack load file.
90  *
91  *
92  * @return the path of the smack load file. Do not free this pointer.
93  * It belongs to configurator.
94  */
95 const char *buxton_smack_load_file(void)
96         __attribute__((warn_unused_result));
97
98 /**
99  * @internal
100  * @brief Get the path of the smack permissive.
101  *
102  *
103  * @return the path of the smack permissive file. Do not free this pointer.
104  * It belongs to configurator.
105  */
106 const char *buxton_smack_permissive(void)
107         __attribute__((warn_unused_result));
108
109 /**
110  * @internal
111  * @brief Get the path of the buxton socket.
112  *
113  *
114  * @return the path of the buxton socket. Do not free this pointer.
115  * It belongs to configurator.
116  */
117 const char *buxton_socket(void)
118         __attribute__((warn_unused_result));
119
120 /**
121  * @internal
122  * @brief Get an array of ConfigLayers from the conf file
123  *
124  * @param layers pointer to a pointer where the array of ConfigLayers
125  * will be stored. Callers should free this pointer with free when
126  * they are done with it.
127  *
128  * @return an integer that indicates the number of layers.
129  */
130 int buxton_key_get_layers(ConfigLayer **layers)
131         __attribute__((warn_unused_result));
132
133 void include_configurator(void);
134
135 /*
136  * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
137  *
138  * Local variables:
139  * c-basic-offset: 8
140  * tab-width: 8
141  * indent-tabs-mode: t
142  * End:
143  *
144  * vi: set shiftwidth=8 tabstop=8 noexpandtab:
145  * :indentSize=8:tabSize=8:noTabs=false:
146  */