tizen 2.4 release
[framework/appfw/aul-1.git] / include / app_sock.h
1 /*
2  *  aul
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>, Jaeho Lee <jaeho81.lee@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21
22
23 #ifndef __APP_PKT_H_
24 #define __APP_PKT_H_
25
26 #ifndef _GNU_SOURCE
27 #define _GNU_SOURCE
28 #endif
29 #include <unistd.h>
30 #include <sys/socket.h>
31 #include <linux/un.h>
32 #include "aul_zone.h"
33
34 #include "app_launchpad_types.h"
35
36 enum app_cmd {
37         APP_START,
38         APP_OPEN,
39         APP_RESUME,
40         APP_RESUME_BY_PID,
41         APP_TERM_BY_PID,
42         APP_TERM_BY_PID_WITHOUT_RESTART,
43         APP_RESULT,
44         APP_START_RES,
45         APP_CANCEL,
46         APP_KILL_BY_PID,
47         APP_ADD_HISTORY,
48         APP_RUNNING_INFO,
49         APP_RUNNING_INFO_MEMORY,
50         APP_RUNNING_INFO_RESULT,
51         APP_IS_RUNNING,
52         APP_GET_APPID_BYPID,
53         APP_GET_PKGID_BYPID,
54         APP_GET_INFO_OK,
55         APP_GET_INFO_ERROR,
56         APP_KEY_EVENT,
57         APP_KEY_RESERVE,
58         APP_KEY_RELEASE,
59         APP_STATUS_UPDATE,
60         APP_RUNNING_LIST_UPDATE,
61         APP_TERM_REQ_BY_PID,
62         APP_START_ASYNC,
63         APP_TERM_BY_PID_ASYNC,
64 #ifdef _APPFW_FEATURE_MULTI_INSTANCE
65         APP_START_MULTI_INSTANCE,
66 #endif
67         APP_GROUP_GET_WINDOW,
68         APP_GROUP_GET_LEADER_PIDS,
69         APP_GROUP_GET_GROUP_PIDS,
70         APP_GROUP_CLEAR_TOP,
71         APP_GROUP_GET_LEADER_PID,
72         APP_GROUP_GET_FG,
73         APP_GROUP_SET_WINDOW,
74         APP_GROUP_LOWER,
75         APP_GROUP_GET_IDLE_PIDS,
76         APP_GET_CMDLINE,
77         APP_TERM_BGAPP_BY_PID,
78         APP_PAUSE,
79         APP_PAUSE_BY_PID,
80         APP_GET_PID,
81         APP_GET_PID_CACHE,
82         APP_GET_STATUS,
83         APP_SET_PROCESS_GROUP,
84         APP_GET_GROUP_INFO,
85         APP_SUSPEND,
86         APP_WAKE,
87         APP_GET_LAST_CALLER_PID,
88 };
89
90 #define AUL_SOCK_PREFIX _get_sock_prefix()
91 #define AUL_SOCK_MAXBUFF 131071
92 #define ELOCALLAUNCH_ID 128
93 #define EILLEGALACCESS 127
94 #define ETERMINATING 126
95 #define ENOLAUNCHPAD 125
96 #ifdef _APPFW_FEATURE_APP_CONTROL_LITE
97 #define EUGLOCAL_LAUNCH 124
98 #endif
99 #define EREJECTED 123
100 #define ENOAPP 122
101
102
103
104 typedef struct _app_pkt_t {
105         int cmd;
106         int len;
107         unsigned char data[1];
108 } app_pkt_t;
109
110 int __create_server_sock(int pid);
111 int __create_client_sock(int pid);
112 int __app_send_raw(int pid, int cmd, unsigned char *kb_data, int datalen);
113 int __app_send_raw_with_noreply(int pid, int cmd, unsigned char *kb_data, int datalen);
114 int __app_send_raw_with_delay_reply(int pid, int cmd, unsigned char *kb_data, int datalen);
115 app_pkt_t *__app_recv_raw(int fd, int *clifd, struct ucred *cr);
116 app_pkt_t *__app_send_cmd_with_result(int pid, int cmd, unsigned char *kb_data, int datalen);
117
118 #endif
119