4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
7 * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
23 #ifndef __RPM_INSTALLER_H_
24 #define __RPM_INSTALLER_H_
28 #endif /* __cplusplus */
30 #include "rpm-installer-util.h"
34 #define PM_UNLIKELY(expr) __builtin_expect((expr), 0)
35 #define PM_LIKELY(expr) __builtin_expect((expr), 1)
39 GOT_PACKAGE_INFO_SUCCESSFULLY,
43 typedef enum backend_state backend_state;
45 enum rpm_request_type {
50 typedef enum rpm_request_type rpm_request_type;
52 #define MARGIN_FACTOR 12
53 #define RPM_SIZE_MARGIN(size) ( (int)(size/MARGIN_FACTOR) + 1)
57 * @in :pkgfilepath : Package file path
58 * @in :force_install: Whether we need to forceful overwrite.
59 * If package already installed then reinstall the application
60 * @in :install_options: install options
62 int _rpm_installer_package_install(char *pkgfilepath,
64 char *install_options,
69 * @in :pkgfilepath : Package file path
71 int _rpm_installer_package_install_with_dbpath(char *pkgfilepath, char *clientid);
74 * Install the package manifest
75 * @in :pkgfilepath : Package manifest file path
77 int _rpm_installer_corexml_install(char *pkgfilepath);
80 * get the package information from package name
81 * return the package information
82 * @in :pkgid : package id for which information is requested
84 pkginfo *_rpm_installer_get_pkgname_info(const char *pkgid);
87 * get the package information from package file
88 * return the package information
89 * @in :pkgfile : package file for which information is requested
91 pkginfo *_rpm_installer_get_pkgfile_info(char *pkgfile);
94 * Uninstall the Application
95 * @in :pkgid : package id to be uninstalled
97 int _rpm_installer_package_uninstall(char *pkgid);
100 * Uninstall the Application
101 * @in :pkgid : package id to be uninstalled
103 int _rpm_installer_package_uninstall_with_dbpath(const char *pkgid);
105 /* Dbus related prototype */
106 void _ri_broadcast_status_notification(const char *pkgid, char *pkg_type, char *key, char *val);
107 int _rpm_backend_interface(char *keyid, char *pkgid, char *reqcommand, char *clientid);
109 /* RPM operations prototype */
110 int _rpm_uninstall_pkg(char *pkgid);
112 int _rpm_install_pkg_with_dbpath(char *pkgfilepath, char *pkgid, char *clientid);
113 int _rpm_upgrade_pkg_with_dbpath(char *pkgfilepath, char *pkgid);
114 int _rpm_uninstall_pkg_with_dbpath(const char *pkgid, bool is_system);
116 int _rpm_install_corexml(char *pkgfilepath, char *pkgid);
117 int _rpm_process_cscxml(char *xml_path);
118 int _rpm_process_csc_coretpk(char *xml_path);
119 int _rpm_process_fota(char *fota_script);
120 int _rpm_process_fota_for_rw(char *fota_script);
122 int _rpm_process_enable(char *pkgid);
123 int _rpm_process_disable(char *pkgid);
125 int _ri_set_backend_state(int state);
126 int _ri_get_backend_state();
127 int _ri_get_backend_state_info();
128 int _ri_set_backend_state_info(int state);
129 int _ri_get_last_input_info(char **pkgid, int *preqcommand,
131 void _ri_save_last_input_info(char *pkgid, int reqcommand,
133 void _ri_package_downgrade_information(const char *message);
134 int _rpm_installer_clear_private_data(char *pkgid);
135 int _rpm_move_pkg(char *pkgid, int move_type);
137 /* libprivilege-control specific operations prototype*/
138 int _ri_privilege_register_package(const char *pkgid);
139 int _ri_privilege_unregister_package(const char *pkgid);
140 int _ri_privilege_revoke_permissions(const char *pkgid);
141 int _ri_privilege_enable_permissions(const char *pkgid, int apptype,
142 const char **perms, int persistent);
143 int _ri_privilege_setup_path(const char *pkgid, const char *dirpath,
144 int apppathtype, const char *groupid);
145 int _ri_privilege_add_friend(const char *pkgid1, const char *pkgid2);
146 int _ri_privilege_change_smack_label(const char *path, const char *label,
148 void _ri_unregister_cert(const char *pkgid);
149 void _ri_register_cert(const char *pkgid);
150 void _ri_apply_smack(char *pkgname, int flag);
151 int _ri_apply_privilege(char *pkgid, int visibility);
152 void _ri_soft_reset(char *pkgid);
154 int _rpm_process_enabled_list(const char *enabled_list);
155 int _rpm_process_disabled_list(const char *disabled_list);
157 int __is_dir(char *dirname);
158 int __ri_change_dir(char *dirname);
159 void __rpm_apply_smack(char *pkgname, int flag);
160 int _rpm_xsystem(const char *argv[]);
161 int _ri_smack_reload(const char *pkgid, rpm_request_type request_type);
162 int _ri_smack_reload_all(void);
163 int _ri_verify_signatures(const char *root_path, const char *pkgid);
164 int __ri_check_running_app(const pkgmgrinfo_appinfo_h handle, void *user_data);
165 void __ri_remove_updated_dir(const char *pkgid);
166 int __ri_copy_smack_rule_file(int op_type, const char *pkgname, int is_system);
167 void __rpm_clear_dir_list(GList* dir_list);
168 GList * __rpm_populate_dir_list();
169 void __ri_make_directory(const char *pkgid);
173 #endif /* __cplusplus */
174 #endif /* __RPM_INSTALLER_H_ */