tizen 2.3.1 release
[framework/web/wearable/wrt-security.git] / ace_settings / include / ace_api_settings.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Apache License, Version 2.0 (the "License");
5  *    you may not use this file except in compliance with the License.
6  *    You may obtain a copy of the License at
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *    Unless required by applicable law or agreed to in writing, software
11  *    distributed under the License is distributed on an "AS IS" BASIS,
12  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *    See the License for the specific language governing permissions and
14  *    limitations under the License.
15  */
16 /*
17  * @file        ace_api_settings.h
18  * @author      Tomasz Swierczek (t.swierczek@samsung.com)
19  * @version     1.0
20  * @brief       This is header for ACE settings API (RW part).
21  */
22
23 #ifndef ACE_API_SETTINGS_H
24 #define ACE_API_SETTINGS_H
25
26 #include <ace_api_common.h>
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 /*
33  * API defined in this header should be used only from one thread. If used
34  * otherwise, unexpected behaviour may occur, including segmentation faults and
35  * escalation of global warming. Be warned.
36  */
37
38 // --------------- Initialization ----------------------------------------------
39
40 /*
41  * Initializes ACE - connects (RW) to the database. Must be called only once.
42  * Returns ACE_OK or error
43  */
44 ace_return_t ace_settings_initialize(void);
45
46 /*
47  * Deinitializes ACE - deinitialize internal structures, detach DB, etc.
48  * Must be called only once.
49  * Returns ACE_OK or error
50  */
51 ace_return_t ace_settings_shutdown(void);
52
53 // --------------- Resource settings API ---------------------------------------
54
55 /*
56  * Order and values of enum constants are part of API
57  */
58 typedef enum
59 {
60     ACE_PREFERENCE_PERMIT,
61     ACE_PREFERENCE_DENY,
62     ACE_PREFERENCE_DEFAULT,         // means: not set
63     ACE_PREFERENCE_BLANKET_PROMPT,
64     ACE_PREFERENCE_SESSION_PROMPT,
65     ACE_PREFERENCE_ONE_SHOT_PROMPT
66 } ace_preference_t;
67
68 /*
69  * Returns error or ACE_OK
70  * If return value is ACE_OK, 'prerefence' value is the queried one, otherwise
71  * 'preference' value is undefined
72  */
73 ace_return_t ace_get_widget_resource_preference(ace_widget_handle_t handle,
74                                                 const ace_resource_t resource,
75                                                 ace_preference_t* preference);
76
77 /*
78  * Returns error or ACE_OK
79  * If return value is ACE_OK, 'prerefence' value is the queried one, otherwise
80  * 'preference' value is undefined
81  */
82 ace_return_t ace_get_global_resource_preference(const ace_resource_t resource,
83         ace_preference_t* preference);
84
85 /*
86  * To reset setting, pass ACE_PREFERENCE_DEFAULT
87  * Returns error or ACE_OK
88  */
89 ace_return_t ace_set_widget_resource_preference(ace_widget_handle_t handle,
90                                                 const ace_resource_t resource,
91                                                 ace_preference_t preference);
92
93 /*
94  * To reset setting, pass ACE_PREFERENCE_DEFAULT
95  * Returns error or ACE_OK
96  */
97 ace_return_t ace_set_global_resource_preference(const ace_resource_t resource,
98                                                 ace_preference_t preference);
99
100 /*
101  * Resets per widget resource settings to ACE_PREFERENCE_DEFAULT
102  */
103 ace_return_t ace_reset_widget_resource_settings(void);
104
105 /*
106  * Resets global resource settings to ACE_PREFERENCE_DEFAULT
107  */
108 ace_return_t ace_reset_global_resource_settings(void);
109
110 /*
111  * After execution, is_privacy_api is ACE_TRUE if resource_name is the name
112  * of Privacy API
113  */
114 ace_return_t ace_is_private_api(const ace_resource_t resource_name,
115                        ace_bool_t* is_private_api);
116
117 #ifdef __cplusplus
118 }
119 #endif
120
121 #endif // ACE_API_SETTINGS_H