Source code formating unification
[platform/framework/web/wrt.git] / src / wrt-launchpad-daemon / include / app_sock.h
1 /*
2  * Copyright (c) 2011 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 #ifndef __APP_PKT_H_
18 #define __APP_PKT_H_
19
20 #include <unistd.h>
21 #define __USE_GNU
22 #include <sys/socket.h>
23 #include <linux/un.h>
24
25 enum app_cmd {
26     APP_START,
27     APP_OPEN,
28     APP_RESUME,
29     APP_RESUME_BY_PID,
30     APP_TERM_BY_PID,
31     APP_RESULT,
32     APP_START_RES,
33     APP_CANCEL,
34     APP_KILL_BY_PID,
35     APP_ADD_HISTORY,
36     APP_RUNNING_INFO,
37     APP_RUNNING_INFO_RESULT,
38     APP_IS_RUNNING,
39     APP_KEY_EVENT,
40     APP_KEY_RESERVE,
41     APP_KEY_RELEASE,
42     APP_STATUS_UPDATE,
43     APP_RELEASED,
44     APP_RUNNING_LIST_UPDATE
45 };
46
47 #define AUL_SOCK_PREFIX "/tmp/alaunch"
48 #define AUL_SOCK_MAXBUFF 65535
49 #define LAUNCHPAD_PID -1
50 #define WRT_LAUNCHPAD_PID -3
51 #define ELOCALLAUNCH_ID 128
52
53 typedef struct _app_pkt_t {
54     int cmd;
55     int len;
56     unsigned char data[1];
57 } app_pkt_t;
58
59 int __create_server_sock(int pid);
60 int __create_client_sock(int pid);
61 int __app_send_raw(int pid, int cmd, unsigned char *kb_data, int datalen);
62 app_pkt_t *__app_recv_raw(int fd, int *clifd, struct ucred *cr);
63 app_pkt_t *__app_send_cmd_with_result(int pid, int cmd);
64
65 #endif
66