895c9bde86e1b79afe24a5b4eb1dd6b1f9f1b51b
[platform/core/appfw/pkgmgr-server.git] / include / pkgmgr-server.h
1 /*
2  * slp-pkgmgr
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
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>
8  *
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
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
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.
20  *
21  */
22
23 #ifndef _PKGMGR_SERVER_H_
24 #define _PKGMGR_SERVER_H_
25
26 #include <sys/types.h>
27 #include <glib.h>
28 #include <dlog.h>
29
30 #include "queue.h"
31
32 #ifdef LOG_TAG
33 #undef LOG_TAG
34 #endif /* LOG_TAG */
35 #define LOG_TAG "PKGMGR_SERVER"
36
37 #ifndef ERR
38 #define ERR(fmt, args...) LOGE("[%s:%d] "fmt"\n", __func__, __LINE__, ##args)
39 #endif
40
41 #ifndef DBG
42 #define DBG(fmt, args...) LOGD("[%s:%d] "fmt"\n", __func__, __LINE__, ##args)
43 #endif
44
45 #ifndef INFO
46 #define INFO(fmt, args...) LOGI("[%s:%d] "fmt"\n", __func__, __LINE__, ##args)
47 #endif
48
49 #define MAX_REQ_ID_LEN 256
50 #define MAX_PKG_TYPE_LEN 128
51 #define MAX_PKG_NAME_LEN 256
52 #define MAX_PKG_ARGS_LEN 4096
53 #define DESKTOP_FILE_DIRS_NUM 1024
54
55 enum request_type {
56         REQUEST_TYPE_INSTALL,
57         REQUEST_TYPE_MOUNT_INSTALL,
58         REQUEST_TYPE_REINSTALL,
59         REQUEST_TYPE_UNINSTALL,
60         REQUEST_TYPE_MOVE,
61         REQUEST_TYPE_ENABLE_PKG,
62         REQUEST_TYPE_DISABLE_PKG,
63         REQUEST_TYPE_ENABLE_APP,
64         REQUEST_TYPE_DISABLE_APP,
65         REQUEST_TYPE_GETSIZE,
66         REQUEST_TYPE_CLEARDATA,
67         REQUEST_TYPE_CLEARCACHE,
68         REQUEST_TYPE_ENABLE_GLOBAL_APP_FOR_UID,
69         REQUEST_TYPE_DISABLE_GLOBAL_APP_FOR_UID,
70         REQUEST_TYPE_KILL,
71         REQUEST_TYPE_CHECK,
72         REQUEST_TYPE_GENERATE_LICENSE_REQUEST,
73         REQUEST_TYPE_REGISTER_LICENSE,
74         REQUEST_TYPE_DECRYPT_PACKAGE,
75         REQUEST_TYPE_ENABLE_APP_SPLASH_SCREEN,
76         REQUEST_TYPE_DISABLE_APP_SPLASH_SCREEN,
77         REQUEST_TYPE_SET_RESTRICTION_MODE,
78         REQUEST_TYPE_UNSET_RESTRICTION_MODE,
79         REQUEST_TYPE_GET_RESTRICTION_MODE,
80 };
81
82 gboolean queue_job(void *data);
83 int _return_value_to_caller(const char *req_key, GVariant *result);
84 int _init_request_handler(void);
85 void _fini_request_handler(void);
86 void _send_app_signal(uid_t uid, const char *req_id,
87                 const char *pkgid, const char *appid,
88                 const char *key, const char *val, int req_type);
89 void _send_fail_signal(struct backend_job *job);
90 int _set_restriction_mode(uid_t uid, const char *pkgid, int mode);
91 int _unset_restriction_mode(uid_t uid, const char *pkgid, int mode);
92 int _get_restriction_mode(uid_t uid, const char *pkgid, int *mode);
93 const char *_get_pkgtype_from_file(const char *file_path);
94 char *_get_pkgtype_from_pkgid(const char *pkgid, uid_t uid);
95
96 #endif/*  _PKGMGR_SERVER_H_ */