2 * Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
24 #include <sys/socket.h>
35 #define AUL_SOCK_MAXBUFF 131071
36 #define ELOCALLAUNCH_ID 128
37 #define EILLEGALACCESS 127
38 #define ETERMINATING 126
39 #define ENOLAUNCHPAD 125
42 #define AUL_PKT_HEADER_SIZE (sizeof(int) + sizeof(int) + sizeof(int))
44 typedef struct _app_pkt_t {
48 unsigned char data[1];
52 AUL_SOCK_NONE = 0x0, /* default */
53 AUL_SOCK_NOREPLY = 0x1, /* return immediately after packet sent without reply */
54 AUL_SOCK_ASYNC = 0x2, /* leave fd in open and return fd of client socket */
55 AUL_SOCK_QUEUE = 0x4, /* add request to pending list in case of receiver is busy */
56 AUL_SOCK_BUNDLE = 0x8, /* has bundle */
60 * This API is only for Appfw internally.
62 int aul_sock_create_server(int pid, uid_t uid);
65 * This API is only for Appfw internally.
67 int aul_sock_send_raw(int pid, uid_t uid, int cmd, unsigned char *kb_data, int datalen, int opt);
70 * This API is only for Appfw internally.
72 int aul_sock_send_bundle(int pid, uid_t uid, int cmd, bundle *kb, int opt);
75 * This API is only for Appfw internally.
77 int aul_sock_send_raw_with_fd(int fd, int cmd, unsigned char *kb_data, int datalen, int opt);
80 * This API is only for Appfw internally.
82 int aul_sock_send_bundle_with_fd(int fd, int cmd, bundle *kb, int opt);
85 * This API is only for Appfw internally.
87 app_pkt_t *aul_sock_recv_pkt(int fd, int *clifd, struct ucred *cr);
90 * This API is only for Appfw internally.
92 int aul_sock_create_launchpad_client(const char *pad_type, uid_t uid);
95 * This API is only for Appfw internally.
97 int aul_sock_recv_reply_sock_fd(int fd, int (*ret_fd)[2], int num_of_ret_fd);
100 * This API is only for Appfw internally.
102 int aul_sock_recv_reply_pkt(int fd, app_pkt_t **pkt);
105 * This API is only for Appfw internally.
107 int aul_sock_set_sock_option(int fd, int cli);
110 * This API is only for Appfw internally.
112 struct timeval aul_sock_get_rcv_timeval(void);
115 * This API in only for Appfw internally.
117 int aul_sock_recv_pkt_with_cb(int fd,
118 void (*callback)(app_pkt_t *pkt, void *data),
122 * This API in only for Appfw internally.
124 int aul_sock_recv_result_with_fd(int fd);
127 * This API in only for Appfw internally.
129 int aul_sock_destroy_server(int fd);
132 * This API is only for Appfw internally.
134 int aul_sock_send_result(int fd, int res);
137 * This API is only for Appfw internally.
139 int aul_sock_send_result_v2(int fd, int res, bool do_close);
142 * This API is only for Appfw internally.
144 int aul_sock_recv_reply_pkt_v2(int fd, app_pkt_t **pkt, bool do_close);