Check privilege via dbus-daemon
[platform/core/appfw/slp-pkgmgr.git] / server / 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 <glib.h>
27
28 #ifdef LOG_TAG
29 #undef LOG_TAG
30 #endif /* LOG_TAG */
31 #define LOG_TAG "PKGMGR_SERVER"
32 #include "package-manager-debug.h"
33
34 #define CONF_FILE "/etc/package-manager/server/.config"
35 #define DESKTOP_FILE_DIRS "/usr/share/install-info/desktop.conf"
36
37 #define PKG_BACKEND "backend:"
38 #define PKG_CONF_PATH "/etc/package-manager/pkg_path.conf"
39
40 #define MAX_REQ_ID_LEN 256
41 #define MAX_PKG_TYPE_LEN 128
42 #define MAX_PKG_NAME_LEN 256
43 #define MAX_PKG_ARGS_LEN 4096
44 #define DESKTOP_FILE_DIRS_NUM 1024
45
46 typedef struct {
47         char req_id[MAX_REQ_ID_LEN];
48         int req_type;
49         uid_t uid;
50         char pkg_type[MAX_PKG_TYPE_LEN];
51         char pkgid[MAX_PKG_NAME_LEN];
52         char args[MAX_PKG_ARGS_LEN];
53 } pm_dbus_msg;
54
55 typedef struct backend_info_t {
56         int pid;
57         uid_t uid;
58         char pkgtype[MAX_PKG_TYPE_LEN];
59         char pkgid[MAX_PKG_NAME_LEN];
60         char args[MAX_PKG_ARGS_LEN];
61 } backend_info;
62
63 struct pm_inotify_paths_t {
64         int wd;
65         char *path;
66 };
67 typedef struct pm_inotify_paths_t pm_inotify_paths;
68
69 char *_get_backend_cmd(char *type);
70 void _pm_desktop_file_monitor_init();
71 void _pm_desktop_file_monitor_fini();
72 int _pm_desktop_file_dir_search(pm_inotify_paths *paths, int number);
73
74 gboolean queue_job(void *data);
75 int __init_request_handler(void);
76 void __fini_request_handler(void);
77
78 #endif/*  _PKGMGR_SERVER_H_ */