Add privacy related APIs
[platform/core/security/privilege-info.git] / src / include / privilege_information.h
1 /*
2  * Copyright (c) 2013 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 #ifndef __TIZEN_SECURITY_PRIVILEGE_INFORMAION_H
18 #define __TIZEN_SECURITY_PRIVILEGE_INFORMAION_H
19
20 #include <tizen.h>
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26 /**
27  * @addtogroup CAPI_SECURITY_FRAMEWORK_PRIVILEGE_INFO_MODULE
28  * @{
29  */
30
31 /**
32  * @brief Enumerations of error code for Privilege Information.
33  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
34  */
35 typedef enum {
36         PRVINFO_ERROR_NONE                                               = TIZEN_ERROR_NONE, /**< Successful */
37         PRVINFO_ERROR_INVALID_PARAMETER                 = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid function parameter */
38         PRVINFO_ERROR_OUT_OF_MEMORY                             = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
39         PRVINFO_ERROR_INTERNAL_ERROR                       = TIZEN_ERROR_UNKNOWN, /**< Unknown error */
40 } privilege_info_error_e;
41
42
43 /**
44  * @brief Gets the display name of the given privilege.
45  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
46  * @remarks @a display_name must be released using free().
47  * @param [in] api_version The version of API
48  * @param [in] privilege The privilege
49  * @param [out] display_name The display name of the privilege
50  * @return 0 on success, otherwise a negative error value.
51  * @retval #PRVINFO_ERROR_NONE Successful
52  * @retval #PRVINFO_ERROR_OUT_OF_MEMORY Out of memory
53  * @retval #PRVINFO_ERROR_INVALID_PARAMETER Invalid function parameter
54  * @retval #PRVINFO_ERROR_INTERNAL_ERROR Unknown error
55  */
56 int privilege_info_get_display_name(const char *api_version, const char *privilege, char **display_name);
57
58 /**
59  * @brief Gets the display name of the given privilege.
60  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
61  * @remarks @a display_name must be released using free().
62  * @remarks package_type must be one of followings: PRVINFO_PACKAGE_TYPE_NATIVE, PRVINFO_PACKAGE_TYPE_WEB
63  * @param [in] package_type The type of application package
64  * @param [in] api_version The version of API
65  * @param [in] privilege The privilege
66  * @param [out] display_name The display name of the privilege
67  * @return 0 on success, otherwise a negative error value.
68  * @retval #PRVINFO_ERROR_NONE Successful
69  * @retval #PRVINFO_ERROR_OUT_OF_MEMORY Out of memory
70  * @retval #PRVINFO_ERROR_INVALID_PARAMETER Invalid function parameter
71  * @retval #PRVINFO_ERROR_INTERNAL_ERROR Unknown error
72  */
73 int privilege_info_get_display_name_by_pkgtype(const char *package_type, const char *api_version, const char *privilege, char **display_name);
74
75 /**
76  * @brief Gets the description of the given privilege.
77  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
78  * @remarks @a description must be released using free().
79  * @param [in] api_version The version of API
80  * @param [in]  privilege The privilege
81  * @param [out] description The description of the privilege
82  * @return 0 on success, otherwise a negative error value.
83  * @retval #PRVINFO_ERROR_NONE Successful
84  * @retval #PRVINFO_ERROR_OUT_OF_MEMORY Out of memory
85  * @retval #PRVINFO_ERROR_INVALID_PARAMETER Invalid function parameter
86  * @retval #PRVINFO_ERROR_INTERNAL_ERROR Unknown error
87  */
88 int privilege_info_get_description(const char *api_version, const char *privilege, char **description);
89
90 /**
91  * @brief Gets the description of the given privilege.
92  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
93  * @remarks @a description must be released using free().
94  * @remarks package_type must be one of followings: PRVINFO_PACKAGE_TYPE_NATIVE, PRVINFO_PACKAGE_TYPE_WEB
95  * @param [in] package_type The type of application package
96  * @param [in] api_version The version of API
97  * @param [in]  privilege The privilege
98  * @param [out] description The description of the privilege
99  * @return 0 on success, otherwise a negative error value.
100  * @retval #PRVINFO_ERROR_NONE Successful
101  * @retval #PRVINFO_ERROR_OUT_OF_MEMORY Out of memory
102  * @retval #PRVINFO_ERROR_INVALID_PARAMETER Invalid function parameter
103  * @retval #PRVINFO_ERROR_INTERNAL_ERROR Unknown error
104  */
105 int privilege_info_get_description_by_pkgtype(const char *package_type, const char *api_version, const char *privilege, char **description);
106
107 /**
108  * @brief Gets the display name of the privacy group in which the given privilege is included.
109  * @since_tizen 3.0
110  * @remarks @a privacy_name must be released using free().
111  * @remarks @a privilege must be privacy related, otherwise #PRVINFO_ERROR_INVALID_PARAMETER is returned.
112  * @param [in] privilege The privilege
113  * @param [out] privacy_name The privacy group's display name that the given privilege is included in
114  * @return 0 on success, otherwise a negative error value.
115  * @retval #PRVINFO_ERROR_NONE Successful
116  * @retval #PRVINFO_ERROR_OUT_OF_MEMORY Out of memory
117  * @retval #PRVINFO_ERROR_INVALID_PARAMETER Invalid function parameter
118  * @retval #PRVINFO_ERROR_INTERNAL_ERROR Unknown error
119  */
120 int privilege_info_get_privacy_display_name(const char *privilege, char **privacy_name);
121
122 /**
123  * @brief Gets the status of the given privacy related privilege.
124  * @since_tizen 3.0
125  * @remarks @a privilege must be privacy related, otherwise #PRVINFO_ERROR_INVALID_PARAMETER is returned.
126  * @remarks In case of errors, @a status is set to true.
127  * @param [in] privilege The privilege
128  * @param [out] status true if the privilege is on and false if the privilege is off.
129  * @return 0 on success, otherwise a negative error value.
130  * @retval #PRVINFO_ERROR_NONE Successful
131  * @retval #PRVINFO_ERROR_INVALID_PARAMETER Invalid function parameter
132  * @retval #PRVINFO_ERROR_INTERNAL_ERROR Unknown error
133  */
134 int privilege_info_get_privacy_privilege_status(const char *privilege, bool *status);
135 /**
136  * @}
137  */
138
139 #ifdef __cplusplus
140 }
141 #endif
142
143 #endif /* __TIZEN_SECURITY_PRIVILEGE_INFORMAION_H */