Add new functions to handling running components
[platform/core/appfw/aul-1.git] / include / aul_svc_db.h
1 /*
2  * Copyright (c) 2015 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 #pragma once
18
19 #include <sqlite3.h>
20 #include <stdbool.h>
21 #include <time.h>
22 #include <sys/types.h>
23 #include <glib.h>
24
25 #define MAX_FILTER_STR_SIZE 1024
26 #define MAX_PACKAGE_STR_SIZE 512
27 #define MAX_URI_STR_SIZE 256
28 #define MAX_MIME_STR_SIZE 256
29 #define MAX_SCHEME_STR_SIZE 256
30 #define MAX_HOST_STR_SIZE 256
31 #define MAX_OP_STR_SIZE 128
32
33 #ifdef __cplusplus
34 extern "C"
35 {
36 #endif
37
38 int _svc_db_check_perm(uid_t uid, bool readonly);
39 int _svc_db_add_app(const char *op, const char *mime_type, const char *uri, const char *pkg_name, uid_t uid);
40 int _svc_db_delete_with_pkgname(const char *pkg_name, uid_t uid);
41 char* _svc_db_get_app(const char *op, const char *mime_type, const char *uri, uid_t uid);
42 int _svc_db_is_defapp(const char *pkg_name, uid_t uid);
43 int _svc_db_adjust_list_with_submode(int mainapp_mode, char *win_id, GSList **pkg_list, uid_t uid);
44 int _svc_db_get_list_with_all_defapps(GSList **pkg_list, uid_t uid);
45 int _svc_db_delete_all(uid_t uid);
46
47 char *_svc_db_query_builder_in(const char *field, char *args);
48 char *_svc_db_query_builder_or(char *q1, char *q2);
49 char *_svc_db_query_builder_add(char *old_query, char *op, char *uri, char *mime, bool collate);
50 char *_svc_db_query_builder_build(char *old_query);
51 int _svc_db_exec_query(const char *query, GSList **pkg_list, uid_t uid);
52
53 int _svc_db_add_alias_appid(const char *alias_appid, const char *appid,
54                 uid_t uid);
55 int _svc_db_delete_alias_appid(const char *alias_appid, uid_t uid);
56 int _svc_db_get_appid_from_alias_info(const char *alias_appid,
57                 char **appid, uid_t uid);
58 int _svc_db_foreach_alias_info(void (*callback)(const char *alias_appid, const
59                         char *appid, void *data),
60                 uid_t uid, void *user_data);
61 int _svc_db_enable_alias_info(const char *appid, uid_t uid);
62 int _svc_db_disable_alias_info(const char *appid, uid_t uid);
63 int _svc_db_foreach_alias_info_by_appid(int (*callback)(
64                         const char *alias_appid, const char *appid, void *data),
65                 const char *appid, uid_t uid, void *user_data);
66 int _svc_db_foreach_allowed_info(int (*callback)(const char *appid,
67                         const char *allowed_appid, void *data),
68                 uid_t uid, void *user_data);
69 int _svc_db_foreach_allowed_info_by_appid(int (*callback)(const char *appid,
70                         const char *allowed_appid, void *data),
71                 const char *appid, uid_t uid, void *user_data);
72
73 #ifdef __cplusplus
74 }
75 #endif
76
77