2 * Copyright (c) 2000 - 2016 Samsung Electronics Co., Ltd. All rights reserved.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 * @brief RUA API declaration header file.
20 * @author Jinwoo Nam (jwoo.nam@samsung.com)
22 * @history 0.1: RUA API Declarations, structure declaration
32 #include <sys/types.h>
43 #define API __attribute__ ((visibility("default")))
66 * @brief RUA record info structure
69 int id; /**< primary key */
70 char *pkg_name; /**< package name */
71 char *app_path; /**< application path */
72 char *arg; /**< application launching argument */
73 time_t launch_time; /**< application launching time */
78 * @param[in] pkg_name package name to delete history
79 * @return 0 on success, otherwise a nagative error value
80 * @retval 0 on successful
81 * @retval -1 on failed
83 API int rua_add_history_for_uid(char *pkg_name, char *app_path, char *arg, uid_t uid);
86 * @brief Delete history with pkg_name
87 * @param[in] pkg_name package name to delete history
88 * @return 0 on success, otherwise a nagative error value
89 * @retval 0 on successful
90 * @retval -1 on failed
92 API int rua_delete_history_with_pkgname(char *pkg_name);
93 API int rua_delete_history_with_pkgname_for_uid(char *pkg_name, uid_t uid);
96 * @brief Delete history with app_path
97 * @param[in] app_path package name to delete history
98 * @return 0 on success, otherwise a nagative error value
99 * @retval 0 on successful
100 * @retval -1 on failed
102 API int rua_delete_history_with_apppath(char *app_path);
103 API int rua_delete_history_with_apppath_for_uid(char *app_path, uid_t uid);
106 * @brief Clear history
107 * @return 0 on success, otherwise a nagative error value
108 * @retval 0 on successful
109 * @retval -1 on failed
111 API int rua_clear_history(void);
112 API int rua_clear_history_for_uid(uid_t uid);
115 * @brief Load recently used application history db.
116 * @param[out] table db table pointer
117 * @param[out] nrows the number of record
118 * @param[out] ncols the number of field
119 * @return 0 on success, otherwise a nagative error value
120 * @retval 0 on successful
121 * @retval -1 on failed
123 API int rua_history_load_db(char ***table, int *nrows, int *ncols);
124 API int rua_history_load_db_for_uid(char ***table, int *nrows, int *ncols, uid_t uid);
127 * @brief Unload recently used application history db.
128 * @param[in] table db table pointer to unload
129 * @return 0 on success, otherwise a nagative error value
130 * @retval 0 on successful
131 * @retval -1 on failed
133 API int rua_history_unload_db(char ***table);
136 * @brief Load recently used application record.
137 * @param[out] rec record to load
138 * @param[in] table db table pointer
139 * @param[in] nrows the number of record
140 * @param[in] ncols the number of field
141 * @param[in] row record index to load
142 * @return 0 on success, otherwise a nagative error value
143 * @retval 0 on successful
144 * @retval -1 on failed
146 API int rua_history_get_rec(struct rua_rec *rec, char **table,
147 int nrows, int ncols, int row);
150 * @brief Check some package is latest or not with package name
151 * @param[in] pkg_name package name
152 * @return 0 on success, otherwise a nagative error value
153 * @retval 0 if given pkg_name is lastest application
154 * @retval -1 if not lastest applicaton or on failed
156 API int rua_is_latest_app(const char *pkg_name);
157 API int rua_is_latest_app_for_uid(const char *pkg_name, uid_t uid);
160 * @brief Initialize rua
161 * @return 0 on success, otherwise a nagative error value
162 * @retval 0 on successful
163 * @retval -1 on failed
165 API int rua_init(void);
168 * @brief Finalize rua
169 * @return 0 on success, otherwise a nagative error value
170 * @retval 0 on successful
171 * @retval -1 on failed
173 API int rua_fini(void);