923be748340ed124e20c9630e9e0f0df8c0d8345
[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_INFO_H
18 #define __TIZEN_SECURITY_PRIVILEGE_INFO_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 2.3
34  */
35 typedef enum
36 {
37     PRVINFO_ERROR_NONE                         = TIZEN_ERROR_NONE, /**< Successful */
38     PRVINFO_ERROR_INVALID_PARAMETER            = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid function parameter */
39     PRVINFO_ERROR_OUT_OF_MEMORY                = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
40     PRVINFO_ERROR_INTERNAL_ERROR               = TIZEN_ERROR_UNKNOWN, /**< Unknown error */
41 } privilege_info_error_e;
42
43
44 /**
45  * @brief Gets the display name of the given privilege.
46  * @since_tizen 2.3
47  * @remarks @a display_name must be released with free() by you.
48  * @param [in] api_version The version of API
49  * @param [in] privilege The privilege
50  * @param [out] display_name The display name of the privilege
51  * @return 0 on success, otherwise a negative error value.
52  * @retval #PRVINFO_ERROR_NONE Successful
53  * @retval #PRVINFO_ERROR_OUT_OF_MEMORY Out of memory
54  * @retval #PRVINFO_ERROR_INVALID_PARAMETER Invalid function parameter
55  * @retval #PRVINFO_ERROR_INTERNAL_ERROR Unknown error
56  */
57 int privilege_info_get_display_name(const char* api_version, const char* privilege, char **display_name);
58
59 /**
60  * @brief Gets the display name of the given privilege.
61  * @since_tizen 2.3
62  * @remarks @a display_name must be released with free() by you.
63  * @remarks package_type must be one of followings: PRVINFO_PACKAGE_TYPE_NATIVE, PRVINFO_PACKAGE_TYPE_WEB
64  * @param [in] package_type The type of application package
65  * @param [in] api_version The version of API
66  * @param [in] privilege The privilege
67  * @param [out] display_name The display name of the privilege
68  * @return 0 on success, otherwise a negative error value.
69  * @retval #PRVINFO_ERROR_NONE Successful
70  * @retval #PRVINFO_ERROR_OUT_OF_MEMORY Out of memory
71  * @retval #PRVINFO_ERROR_INVALID_PARAMETER Invalid function parameter
72  * @retval #PRVINFO_ERROR_INTERNAL_ERROR Unknown error
73  */
74 int privilege_info_get_display_name_by_pkgtype(const char* package_type, const char* api_version, const char* privilege, char **display_name);
75
76 /**
77  * @brief Gets the description of the given privilege.
78  * @since_tizen 2.3
79  * @remarks @a description must be released with free() by you.
80  * @param [in] api_version The version of API
81  * @param [in]  privilege The privilege
82  * @param [out] description The description of the privilege
83  * @return 0 on success, otherwise a negative error value.
84  * @retval #PRVINFO_ERROR_NONE Successful
85  * @retval #PRVINFO_ERROR_OUT_OF_MEMORY Out of memory
86  * @retval #PRVINFO_ERROR_INVALID_PARAMETER Invalid function parameter
87  * @retval #PRVINFO_ERROR_INTERNAL_ERROR Unknown error
88  */
89 int privilege_info_get_description(const char* api_version, const char *privilege, char **description);
90
91 /**
92  * @brief Gets the description of the given privilege.
93  * @since_tizen 2.3
94  * @remarks @a description must be released with free() by you.
95  * @remarks package_type must be one of followings: PRVINFO_PACKAGE_TYPE_NATIVE, PRVINFO_PACKAGE_TYPE_WEB 
96  * @param [in] package_type The type of application package
97  * @param [in] api_version The version of API
98  * @param [in]  privilege The privilege
99  * @param [out] description The description of the privilege
100  * @return 0 on success, otherwise a negative error value.
101  * @retval #PRVINFO_ERROR_NONE Successful                                                                                                                                            
102  * @retval #PRVINFO_ERROR_OUT_OF_MEMORY Out of memory
103  * @retval #PRVINFO_ERROR_INVALID_PARAMETER Invalid function parameter
104  * @retval #PRVINFO_ERROR_INTERNAL_ERROR Unknown error
105  */
106 int privilege_info_get_description_by_pkgtype(const char* package_type, const char* api_version, const char *privilege, char **description);
107 /**
108  * @}
109  */
110
111 #ifdef __cplusplus
112 }
113 #endif
114
115 #endif // __TIZEN_SECURITY_PRIVILEGE_INFO_H