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