2d3244636e44c5008cc1dbeb32a64f85407d7537
[platform/core/appfw/slp-pkgmgr.git] / installer / pkgmgr_installer_info.h
1 /*
2  * slp-pkgmgr
3  *
4  * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20
21 #ifndef __PKGMGR_INSTALLER_INFO_H__
22 #define __PKGMGR_INSTALLER_INFO_H__
23
24 #include <sys/types.h>
25
26 #include "pkgmgr_installer_type.h"
27
28 /**
29  * @file        pkgmgr_installer_info.h
30  * @brief       This file declares API for getting information of pkgmgr_installer
31  */
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36
37 /**
38  * @brief       Get target_uid of package which is being processed by installer
39  * @pre         None
40  * @post        None
41  * @param[out]  uid     user id
42  * @return      0 if success, else retrun < 0
43  * @code
44         #include <pkgmgr_installer_info.h>
45         int main()
46         {
47                 uid_t uid;
48                 if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
49                         printf("failed to get target uid\n");
50                 }
51                 printf("uid = %d\n", uid);
52         }
53  * @endcode
54  */
55 int pkgmgr_installer_info_get_target_uid(uid_t *uid);
56
57 /**
58  * @brief       Get privilege_level of package which is being processed by installer
59  * @pre         None
60  * @post        None
61  * @param[out]  pkgmgr_privilege_level  level
62  * @return      0 if success, else retrun < 0
63  * @remark      In case of uninstallation, the level can be PM_PRIVILEGE_UNKNOWN.
64  *              Because, the installer don't have the privilege level in that case.
65  * @code
66         #include <pkgmgr_installer_info.h>
67         int main()
68         {
69                 pkgmgr_privilege_level level;
70                 if (pkgmgr_installer_info_get_privilege_level(&level) < 0) {
71                         printf("failed to get privilege level\n");
72                 }
73                 if (level == PM_PRIVILEGE_PLATFORM)) {
74                         printf("platform level privilege");
75                 }
76         }
77  * @endcode
78  */
79 int pkgmgr_installer_info_get_privilege_level(pkgmgr_privilege_level *level);
80
81 /**
82  * @brief       Get debug mode flag
83  * @pre         None
84  * @post        None
85  * @param[out]  int     debug_mode
86  * @return      0 if success, else retrun < 0
87  * @code
88         #include <pkgmgr_installer_info.h>
89         int main()
90         {
91                 int debug_mode;
92                 if (pkgmgr_installer_info_get_debug_mode(&debug_mode) < 0) {
93                         printf("failed to get debug mode\n");
94                 }
95                 if (debug_mode)) {
96                         printf("debug mode is enabled");
97                 }
98         }
99  * @endcode
100  */
101 int pkgmgr_installer_info_get_debug_mode(int *debug_mode);
102
103 /**
104  * @brief       Get skip optimization flag
105  * @pre         None
106  * @post        None
107  * @param[out]  int     skip_optimization
108  * @return      0 if success, else retrun < 0
109  * @code
110         #include <pkgmgr_installer_info.h>
111         int main()
112         {
113                 int skip_optimization;
114                 if (pkgmgr_installer_info_get_skip_optimization(&skip_optimization) < 0) {
115                         printf("failed to get skip optimization\n");
116                 }
117                 if (skip_optimization)) {
118                         printf("skip optimization is enabled");
119                 }
120         }
121  * @endcode
122  */
123 int pkgmgr_installer_info_get_skip_optimization(int *skip_optimization);
124
125 #ifdef __cplusplus
126 }
127 #endif
128
129 #endif  /* __PKGMGR_INSTALLER_INFO_H__ */
130