d708c7042d07b0bc5cc275c9f9ae6f1ef9756d08
[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 with free() by you.
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 with free() by you.
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 with free() by you.
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 with free() by you.
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  */
109
110 #ifdef __cplusplus
111 }
112 #endif
113
114 #endif /* __TIZEN_SECURITY_PRIVILEGE_INFORMAION_H */