[c594489] | 1 | /*
|
---|
[df4ed85] | 2 | * Copyright (c) 2006 Ondrej Palkovsky
|
---|
[c594489] | 3 | * All rights reserved.
|
---|
| 4 | *
|
---|
| 5 | * Redistribution and use in source and binary forms, with or without
|
---|
| 6 | * modification, are permitted provided that the following conditions
|
---|
| 7 | * are met:
|
---|
| 8 | *
|
---|
| 9 | * - Redistributions of source code must retain the above copyright
|
---|
| 10 | * notice, this list of conditions and the following disclaimer.
|
---|
| 11 | * - Redistributions in binary form must reproduce the above copyright
|
---|
| 12 | * notice, this list of conditions and the following disclaimer in the
|
---|
| 13 | * documentation and/or other materials provided with the distribution.
|
---|
| 14 | * - The name of the author may not be used to endorse or promote products
|
---|
| 15 | * derived from this software without specific prior written permission.
|
---|
| 16 | *
|
---|
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
| 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
| 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
| 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
| 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
| 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
| 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
| 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
| 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
| 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
| 27 | */
|
---|
| 28 |
|
---|
[fadd381] | 29 | /** @addtogroup libc
|
---|
[b2951e2] | 30 | * @{
|
---|
| 31 | */
|
---|
| 32 | /** @file
|
---|
| 33 | */
|
---|
| 34 |
|
---|
[64d2b10] | 35 | #if ((defined(LIBC_IPC_H_)) && (!defined(LIBC_ASYNC_C_)))
|
---|
| 36 | #error Do not intermix low-level IPC interface and async framework
|
---|
| 37 | #endif
|
---|
| 38 |
|
---|
[fadd381] | 39 | #ifndef LIBC_ASYNC_H_
|
---|
| 40 | #define LIBC_ASYNC_H_
|
---|
[630c3a9] | 41 |
|
---|
[64d2b10] | 42 | #include <ipc/common.h>
|
---|
[bc1f1c2] | 43 | #include <fibril.h>
|
---|
[f25b73d6] | 44 | #include <sys/time.h>
|
---|
[fc42b28] | 45 | #include <atomic.h>
|
---|
[3e6a98c5] | 46 | #include <stdbool.h>
|
---|
[64d2b10] | 47 | #include <task.h>
|
---|
[630c3a9] | 48 |
|
---|
[01ff41c] | 49 | typedef ipc_callid_t aid_t;
|
---|
[46eec3b] | 50 |
|
---|
| 51 | typedef void *(*async_client_data_ctor_t)(void);
|
---|
| 52 | typedef void (*async_client_data_dtor_t)(void *);
|
---|
| 53 |
|
---|
[9934f7d] | 54 | /** Client connection handler
|
---|
| 55 | *
|
---|
[3815efb] | 56 | * @param callid ID of incoming call or 0 if connection initiated from
|
---|
| 57 | * inside using async_connect_to_me()
|
---|
| 58 | * @param call Incoming call or 0 if connection initiated from inside
|
---|
| 59 | * @param arg Local argument passed from async_new_connection() or
|
---|
| 60 | * async_connect_to_me()
|
---|
[9934f7d] | 61 | */
|
---|
| 62 | typedef void (*async_client_conn_t)(ipc_callid_t, ipc_call_t *, void *);
|
---|
| 63 |
|
---|
| 64 | /** Interrupt handler */
|
---|
| 65 | typedef void (*async_interrupt_handler_t)(ipc_callid_t, ipc_call_t *);
|
---|
[9db9b10] | 66 |
|
---|
[79ae36dd] | 67 | /** Exchange management style
|
---|
| 68 | *
|
---|
| 69 | */
|
---|
| 70 | typedef enum {
|
---|
| 71 | /** No explicit exchange management
|
---|
| 72 | *
|
---|
| 73 | * Suitable for protocols which use a single
|
---|
| 74 | * IPC message per exchange only.
|
---|
| 75 | *
|
---|
| 76 | */
|
---|
| 77 | EXCHANGE_ATOMIC = 0,
|
---|
| 78 |
|
---|
| 79 | /** Exchange management via phone cloning
|
---|
| 80 | *
|
---|
| 81 | * Suitable for servers which support client
|
---|
| 82 | * data tracking by task hashes and do not
|
---|
| 83 | * mind cloned phones.
|
---|
| 84 | *
|
---|
| 85 | */
|
---|
| 86 | EXCHANGE_PARALLEL,
|
---|
| 87 |
|
---|
| 88 | /** Exchange management via mutual exclusion
|
---|
| 89 | *
|
---|
| 90 | * Suitable for any kind of client/server communication,
|
---|
| 91 | * but can limit parallelism.
|
---|
| 92 | *
|
---|
| 93 | */
|
---|
| 94 | EXCHANGE_SERIALIZE
|
---|
| 95 | } exch_mgmt_t;
|
---|
| 96 |
|
---|
[b76a7329] | 97 | /** Forward declarations */
|
---|
[5da7199] | 98 | struct async_exch;
|
---|
| 99 | struct async_sess;
|
---|
[b76a7329] | 100 |
|
---|
[5da7199] | 101 | typedef struct async_sess async_sess_t;
|
---|
| 102 | typedef struct async_exch async_exch_t;
|
---|
[79ae36dd] | 103 |
|
---|
[8619f25] | 104 | extern atomic_t threads_in_ipc_wait;
|
---|
| 105 |
|
---|
[47b7006] | 106 | #define async_manager() \
|
---|
| 107 | fibril_switch(FIBRIL_TO_MANAGER)
|
---|
[9db9b10] | 108 |
|
---|
[47b7006] | 109 | #define async_get_call(data) \
|
---|
| 110 | async_get_call_timeout(data, 0)
|
---|
[440cff5] | 111 |
|
---|
[47b7006] | 112 | extern ipc_callid_t async_get_call_timeout(ipc_call_t *, suseconds_t);
|
---|
[db24058] | 113 |
|
---|
[0cc4313] | 114 | /*
|
---|
| 115 | * User-friendly wrappers for async_send_fast() and async_send_slow(). The
|
---|
| 116 | * macros are in the form async_send_m(), where m denotes the number of payload
|
---|
[79ae36dd] | 117 | * arguments. Each macros chooses between the fast and the slow version based
|
---|
[0cc4313] | 118 | * on m.
|
---|
[440cff5] | 119 | */
|
---|
| 120 |
|
---|
[79ae36dd] | 121 | #define async_send_0(exch, method, dataptr) \
|
---|
| 122 | async_send_fast(exch, method, 0, 0, 0, 0, dataptr)
|
---|
| 123 | #define async_send_1(exch, method, arg1, dataptr) \
|
---|
| 124 | async_send_fast(exch, method, arg1, 0, 0, 0, dataptr)
|
---|
| 125 | #define async_send_2(exch, method, arg1, arg2, dataptr) \
|
---|
| 126 | async_send_fast(exch, method, arg1, arg2, 0, 0, dataptr)
|
---|
| 127 | #define async_send_3(exch, method, arg1, arg2, arg3, dataptr) \
|
---|
| 128 | async_send_fast(exch, method, arg1, arg2, arg3, 0, dataptr)
|
---|
| 129 | #define async_send_4(exch, method, arg1, arg2, arg3, arg4, dataptr) \
|
---|
| 130 | async_send_fast(exch, method, arg1, arg2, arg3, arg4, dataptr)
|
---|
| 131 | #define async_send_5(exch, method, arg1, arg2, arg3, arg4, arg5, dataptr) \
|
---|
| 132 | async_send_slow(exch, method, arg1, arg2, arg3, arg4, arg5, dataptr)
|
---|
| 133 |
|
---|
| 134 | extern aid_t async_send_fast(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
|
---|
[11bb813] | 135 | sysarg_t, sysarg_t, ipc_call_t *);
|
---|
[79ae36dd] | 136 | extern aid_t async_send_slow(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
|
---|
| 137 | sysarg_t, sysarg_t, sysarg_t, ipc_call_t *);
|
---|
| 138 |
|
---|
[11bb813] | 139 | extern void async_wait_for(aid_t, sysarg_t *);
|
---|
| 140 | extern int async_wait_timeout(aid_t, sysarg_t *, suseconds_t);
|
---|
[47c9a8c] | 141 | extern void async_forget(aid_t);
|
---|
[440cff5] | 142 |
|
---|
[e2ab36f1] | 143 | extern fid_t async_new_connection(task_id_t, sysarg_t, ipc_callid_t,
|
---|
[9934f7d] | 144 | ipc_call_t *, async_client_conn_t, void *);
|
---|
[79ae36dd] | 145 |
|
---|
[11bb813] | 146 | extern void async_usleep(suseconds_t);
|
---|
[9db9b10] | 147 | extern void async_create_manager(void);
|
---|
| 148 | extern void async_destroy_manager(void);
|
---|
[01ff41c] | 149 |
|
---|
[46eec3b] | 150 | extern void async_set_client_data_constructor(async_client_data_ctor_t);
|
---|
| 151 | extern void async_set_client_data_destructor(async_client_data_dtor_t);
|
---|
[79ae36dd] | 152 | extern void *async_get_client_data(void);
|
---|
[e2ab36f1] | 153 | extern void *async_get_client_data_by_id(task_id_t);
|
---|
| 154 | extern void async_put_client_data_by_id(task_id_t);
|
---|
[23882034] | 155 |
|
---|
[11bb813] | 156 | extern void async_set_client_connection(async_client_conn_t);
|
---|
[9934f7d] | 157 | extern void async_set_interrupt_received(async_interrupt_handler_t);
|
---|
[b4df8db] | 158 | extern void async_set_interrupt_handler_stack_size(size_t);
|
---|
[0cc4313] | 159 |
|
---|
[64d2b10] | 160 | /*
|
---|
| 161 | * Wrappers for simple communication.
|
---|
| 162 | */
|
---|
| 163 |
|
---|
[79ae36dd] | 164 | extern void async_msg_0(async_exch_t *, sysarg_t);
|
---|
| 165 | extern void async_msg_1(async_exch_t *, sysarg_t, sysarg_t);
|
---|
| 166 | extern void async_msg_2(async_exch_t *, sysarg_t, sysarg_t, sysarg_t);
|
---|
| 167 | extern void async_msg_3(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t);
|
---|
| 168 | extern void async_msg_4(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
|
---|
[64d2b10] | 169 | sysarg_t);
|
---|
[79ae36dd] | 170 | extern void async_msg_5(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
|
---|
| 171 | sysarg_t, sysarg_t);
|
---|
[64d2b10] | 172 |
|
---|
| 173 | /*
|
---|
| 174 | * Wrappers for answer routines.
|
---|
| 175 | */
|
---|
| 176 |
|
---|
| 177 | extern sysarg_t async_answer_0(ipc_callid_t, sysarg_t);
|
---|
| 178 | extern sysarg_t async_answer_1(ipc_callid_t, sysarg_t, sysarg_t);
|
---|
| 179 | extern sysarg_t async_answer_2(ipc_callid_t, sysarg_t, sysarg_t, sysarg_t);
|
---|
| 180 | extern sysarg_t async_answer_3(ipc_callid_t, sysarg_t, sysarg_t, sysarg_t,
|
---|
| 181 | sysarg_t);
|
---|
| 182 | extern sysarg_t async_answer_4(ipc_callid_t, sysarg_t, sysarg_t, sysarg_t,
|
---|
| 183 | sysarg_t, sysarg_t);
|
---|
| 184 | extern sysarg_t async_answer_5(ipc_callid_t, sysarg_t, sysarg_t, sysarg_t,
|
---|
| 185 | sysarg_t, sysarg_t, sysarg_t);
|
---|
| 186 |
|
---|
| 187 | /*
|
---|
| 188 | * Wrappers for forwarding routines.
|
---|
| 189 | */
|
---|
| 190 |
|
---|
[79ae36dd] | 191 | extern int async_forward_fast(ipc_callid_t, async_exch_t *, sysarg_t, sysarg_t,
|
---|
| 192 | sysarg_t, unsigned int);
|
---|
| 193 | extern int async_forward_slow(ipc_callid_t, async_exch_t *, sysarg_t, sysarg_t,
|
---|
| 194 | sysarg_t, sysarg_t, sysarg_t, sysarg_t, unsigned int);
|
---|
[0cc4313] | 195 |
|
---|
| 196 | /*
|
---|
| 197 | * User-friendly wrappers for async_req_fast() and async_req_slow(). The macros
|
---|
| 198 | * are in the form async_req_m_n(), where m is the number of payload arguments
|
---|
[6b21292] | 199 | * and n is the number of return arguments. The macros decide between the fast
|
---|
[0cc4313] | 200 | * and slow verion based on m.
|
---|
| 201 | */
|
---|
[64d2b10] | 202 |
|
---|
[79ae36dd] | 203 | #define async_req_0_0(exch, method) \
|
---|
| 204 | async_req_fast(exch, method, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL)
|
---|
| 205 | #define async_req_0_1(exch, method, r1) \
|
---|
| 206 | async_req_fast(exch, method, 0, 0, 0, 0, r1, NULL, NULL, NULL, NULL)
|
---|
| 207 | #define async_req_0_2(exch, method, r1, r2) \
|
---|
| 208 | async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, NULL, NULL, NULL)
|
---|
| 209 | #define async_req_0_3(exch, method, r1, r2, r3) \
|
---|
| 210 | async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, r3, NULL, NULL)
|
---|
| 211 | #define async_req_0_4(exch, method, r1, r2, r3, r4) \
|
---|
| 212 | async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, r3, r4, NULL)
|
---|
| 213 | #define async_req_0_5(exch, method, r1, r2, r3, r4, r5) \
|
---|
| 214 | async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, r3, r4, r5)
|
---|
| 215 |
|
---|
| 216 | #define async_req_1_0(exch, method, arg1) \
|
---|
| 217 | async_req_fast(exch, method, arg1, 0, 0, 0, NULL, NULL, NULL, NULL, \
|
---|
| 218 | NULL)
|
---|
| 219 | #define async_req_1_1(exch, method, arg1, rc1) \
|
---|
| 220 | async_req_fast(exch, method, arg1, 0, 0, 0, rc1, NULL, NULL, NULL, \
|
---|
| 221 | NULL)
|
---|
| 222 | #define async_req_1_2(exch, method, arg1, rc1, rc2) \
|
---|
| 223 | async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, NULL, NULL, \
|
---|
| 224 | NULL)
|
---|
| 225 | #define async_req_1_3(exch, method, arg1, rc1, rc2, rc3) \
|
---|
| 226 | async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, rc3, NULL, \
|
---|
[9db9b10] | 227 | NULL)
|
---|
[79ae36dd] | 228 | #define async_req_1_4(exch, method, arg1, rc1, rc2, rc3, rc4) \
|
---|
| 229 | async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, rc3, rc4, \
|
---|
[9db9b10] | 230 | NULL)
|
---|
[79ae36dd] | 231 | #define async_req_1_5(exch, method, arg1, rc1, rc2, rc3, rc4, rc5) \
|
---|
| 232 | async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, rc3, rc4, \
|
---|
| 233 | rc5)
|
---|
| 234 |
|
---|
| 235 | #define async_req_2_0(exch, method, arg1, arg2) \
|
---|
| 236 | async_req_fast(exch, method, arg1, arg2, 0, 0, NULL, NULL, NULL, \
|
---|
| 237 | NULL, NULL)
|
---|
| 238 | #define async_req_2_1(exch, method, arg1, arg2, rc1) \
|
---|
| 239 | async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, NULL, NULL, \
|
---|
| 240 | NULL, NULL)
|
---|
| 241 | #define async_req_2_2(exch, method, arg1, arg2, rc1, rc2) \
|
---|
| 242 | async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, NULL, NULL, \
|
---|
[9db9b10] | 243 | NULL)
|
---|
[79ae36dd] | 244 | #define async_req_2_3(exch, method, arg1, arg2, rc1, rc2, rc3) \
|
---|
| 245 | async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, rc3, NULL, \
|
---|
[9db9b10] | 246 | NULL)
|
---|
[79ae36dd] | 247 | #define async_req_2_4(exch, method, arg1, arg2, rc1, rc2, rc3, rc4) \
|
---|
| 248 | async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, rc3, rc4, \
|
---|
[9db9b10] | 249 | NULL)
|
---|
[79ae36dd] | 250 | #define async_req_2_5(exch, method, arg1, arg2, rc1, rc2, rc3, rc4, rc5) \
|
---|
| 251 | async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, rc3, rc4, \
|
---|
| 252 | rc5)
|
---|
| 253 |
|
---|
| 254 | #define async_req_3_0(exch, method, arg1, arg2, arg3) \
|
---|
| 255 | async_req_fast(exch, method, arg1, arg2, arg3, 0, NULL, NULL, NULL, \
|
---|
[9db9b10] | 256 | NULL, NULL)
|
---|
[79ae36dd] | 257 | #define async_req_3_1(exch, method, arg1, arg2, arg3, rc1) \
|
---|
| 258 | async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, NULL, NULL, \
|
---|
[9db9b10] | 259 | NULL, NULL)
|
---|
[79ae36dd] | 260 | #define async_req_3_2(exch, method, arg1, arg2, arg3, rc1, rc2) \
|
---|
| 261 | async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, NULL, \
|
---|
[9db9b10] | 262 | NULL, NULL)
|
---|
[79ae36dd] | 263 | #define async_req_3_3(exch, method, arg1, arg2, arg3, rc1, rc2, rc3) \
|
---|
| 264 | async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, rc3, \
|
---|
[9db9b10] | 265 | NULL, NULL)
|
---|
[79ae36dd] | 266 | #define async_req_3_4(exch, method, arg1, arg2, arg3, rc1, rc2, rc3, rc4) \
|
---|
| 267 | async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, rc3, \
|
---|
| 268 | rc4, NULL)
|
---|
| 269 | #define async_req_3_5(exch, method, arg1, arg2, arg3, rc1, rc2, rc3, rc4, \
|
---|
| 270 | rc5) \
|
---|
| 271 | async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, rc3, \
|
---|
| 272 | rc4, rc5)
|
---|
| 273 |
|
---|
| 274 | #define async_req_4_0(exch, method, arg1, arg2, arg3, arg4) \
|
---|
| 275 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, NULL, NULL, \
|
---|
[9db9b10] | 276 | NULL, NULL, NULL)
|
---|
[79ae36dd] | 277 | #define async_req_4_1(exch, method, arg1, arg2, arg3, arg4, rc1) \
|
---|
| 278 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, NULL, \
|
---|
[9db9b10] | 279 | NULL, NULL, NULL)
|
---|
[79ae36dd] | 280 | #define async_req_4_2(exch, method, arg1, arg2, arg3, arg4, rc1, rc2) \
|
---|
| 281 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, NULL, \
|
---|
| 282 | NULL, NULL)
|
---|
| 283 | #define async_req_4_3(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3) \
|
---|
| 284 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
---|
| 285 | NULL, NULL)
|
---|
| 286 | #define async_req_4_4(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
---|
[0cc4313] | 287 | rc4) \
|
---|
[79ae36dd] | 288 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
---|
| 289 | rc4, NULL)
|
---|
| 290 | #define async_req_4_5(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
---|
[0cc4313] | 291 | rc4, rc5) \
|
---|
[79ae36dd] | 292 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
---|
| 293 | rc4, rc5)
|
---|
| 294 |
|
---|
| 295 | #define async_req_5_0(exch, method, arg1, arg2, arg3, arg4, arg5) \
|
---|
| 296 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, NULL, \
|
---|
| 297 | NULL, NULL, NULL, NULL)
|
---|
| 298 | #define async_req_5_1(exch, method, arg1, arg2, arg3, arg4, arg5, rc1) \
|
---|
| 299 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, \
|
---|
| 300 | NULL, NULL, NULL, NULL)
|
---|
| 301 | #define async_req_5_2(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2) \
|
---|
| 302 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
| 303 | NULL, NULL, NULL)
|
---|
| 304 | #define async_req_5_3(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
[0cc4313] | 305 | rc3) \
|
---|
[79ae36dd] | 306 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
| 307 | rc3, NULL, NULL)
|
---|
| 308 | #define async_req_5_4(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
[0cc4313] | 309 | rc3, rc4) \
|
---|
[79ae36dd] | 310 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
| 311 | rc3, rc4, NULL)
|
---|
| 312 | #define async_req_5_5(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
[0cc4313] | 313 | rc3, rc4, rc5) \
|
---|
[79ae36dd] | 314 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
| 315 | rc3, rc4, rc5)
|
---|
[fc42b28] | 316 |
|
---|
[79ae36dd] | 317 | extern sysarg_t async_req_fast(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
|
---|
[11bb813] | 318 | sysarg_t, sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *,
|
---|
| 319 | sysarg_t *);
|
---|
[79ae36dd] | 320 | extern sysarg_t async_req_slow(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
|
---|
| 321 | sysarg_t, sysarg_t, sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *,
|
---|
| 322 | sysarg_t *, sysarg_t *);
|
---|
[085bd54] | 323 |
|
---|
[6aae539d] | 324 | extern async_sess_t *async_clone_establish(exch_mgmt_t, async_exch_t *);
|
---|
[79ae36dd] | 325 | extern async_sess_t *async_connect_me_to(exch_mgmt_t, async_exch_t *, sysarg_t,
|
---|
| 326 | sysarg_t, sysarg_t);
|
---|
| 327 | extern async_sess_t *async_connect_me_to_blocking(exch_mgmt_t, async_exch_t *,
|
---|
| 328 | sysarg_t, sysarg_t, sysarg_t);
|
---|
| 329 | extern async_sess_t *async_connect_kbox(task_id_t);
|
---|
[fc42b28] | 330 |
|
---|
[79ae36dd] | 331 | extern int async_connect_to_me(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
|
---|
[9934f7d] | 332 | async_client_conn_t, void *);
|
---|
[79ae36dd] | 333 |
|
---|
| 334 | extern int async_hangup(async_sess_t *);
|
---|
[64d2b10] | 335 | extern void async_poke(void);
|
---|
[f74392f] | 336 |
|
---|
[79ae36dd] | 337 | extern async_exch_t *async_exchange_begin(async_sess_t *);
|
---|
| 338 | extern void async_exchange_end(async_exch_t *);
|
---|
| 339 |
|
---|
[93ad49a8] | 340 | /*
|
---|
| 341 | * FIXME These functions just work around problems with parallel exchange
|
---|
| 342 | * management. Proper solution needs to be implemented.
|
---|
| 343 | */
|
---|
| 344 | void async_sess_args_set(async_sess_t *sess, sysarg_t, sysarg_t, sysarg_t);
|
---|
| 345 |
|
---|
[0da4e41] | 346 | /*
|
---|
| 347 | * User-friendly wrappers for async_share_in_start().
|
---|
| 348 | */
|
---|
[64d2b10] | 349 |
|
---|
[fbcdeb8] | 350 | #define async_share_in_start_0_0(exch, size, dst) \
|
---|
| 351 | async_share_in_start(exch, size, 0, NULL, dst)
|
---|
| 352 | #define async_share_in_start_0_1(exch, size, flags, dst) \
|
---|
| 353 | async_share_in_start(exch, size, 0, flags, dst)
|
---|
| 354 | #define async_share_in_start_1_0(exch, size, arg, dst) \
|
---|
| 355 | async_share_in_start(exch, size, arg, NULL, dst)
|
---|
| 356 | #define async_share_in_start_1_1(exch, size, arg, flags, dst) \
|
---|
| 357 | async_share_in_start(exch, size, arg, flags, dst)
|
---|
| 358 |
|
---|
| 359 | extern int async_share_in_start(async_exch_t *, size_t, sysarg_t,
|
---|
| 360 | unsigned int *, void **);
|
---|
[47b7006] | 361 | extern bool async_share_in_receive(ipc_callid_t *, size_t *);
|
---|
| 362 | extern int async_share_in_finalize(ipc_callid_t, void *, unsigned int);
|
---|
| 363 |
|
---|
[79ae36dd] | 364 | extern int async_share_out_start(async_exch_t *, void *, unsigned int);
|
---|
[47b7006] | 365 | extern bool async_share_out_receive(ipc_callid_t *, size_t *, unsigned int *);
|
---|
[fbcdeb8] | 366 | extern int async_share_out_finalize(ipc_callid_t, void **);
|
---|
[b4cbef1] | 367 |
|
---|
| 368 | /*
|
---|
| 369 | * User-friendly wrappers for async_data_read_forward_fast().
|
---|
| 370 | */
|
---|
[64d2b10] | 371 |
|
---|
[79ae36dd] | 372 | #define async_data_read_forward_0_0(exch, method, answer) \
|
---|
| 373 | async_data_read_forward_fast(exch, method, 0, 0, 0, 0, NULL)
|
---|
| 374 | #define async_data_read_forward_0_1(exch, method, answer) \
|
---|
| 375 | async_data_read_forward_fast(exch, method, 0, 0, 0, 0, answer)
|
---|
| 376 | #define async_data_read_forward_1_0(exch, method, arg1, answer) \
|
---|
| 377 | async_data_read_forward_fast(exch, method, arg1, 0, 0, 0, NULL)
|
---|
| 378 | #define async_data_read_forward_1_1(exch, method, arg1, answer) \
|
---|
| 379 | async_data_read_forward_fast(exch, method, arg1, 0, 0, 0, answer)
|
---|
| 380 | #define async_data_read_forward_2_0(exch, method, arg1, arg2, answer) \
|
---|
| 381 | async_data_read_forward_fast(exch, method, arg1, arg2, 0, 0, NULL)
|
---|
| 382 | #define async_data_read_forward_2_1(exch, method, arg1, arg2, answer) \
|
---|
| 383 | async_data_read_forward_fast(exch, method, arg1, arg2, 0, 0, answer)
|
---|
| 384 | #define async_data_read_forward_3_0(exch, method, arg1, arg2, arg3, answer) \
|
---|
| 385 | async_data_read_forward_fast(exch, method, arg1, arg2, arg3, 0, NULL)
|
---|
| 386 | #define async_data_read_forward_3_1(exch, method, arg1, arg2, arg3, answer) \
|
---|
| 387 | async_data_read_forward_fast(exch, method, arg1, arg2, arg3, 0, \
|
---|
| 388 | answer)
|
---|
| 389 | #define async_data_read_forward_4_0(exch, method, arg1, arg2, arg3, arg4, \
|
---|
| 390 | answer) \
|
---|
| 391 | async_data_read_forward_fast(exch, method, arg1, arg2, arg3, arg4, \
|
---|
[b4cbef1] | 392 | NULL)
|
---|
[79ae36dd] | 393 | #define async_data_read_forward_4_1(exch, method, arg1, arg2, arg3, arg4, \
|
---|
| 394 | answer) \
|
---|
| 395 | async_data_read_forward_fast(exch, method, arg1, arg2, arg3, arg4, \
|
---|
| 396 | answer)
|
---|
| 397 |
|
---|
| 398 | extern aid_t async_data_read(async_exch_t *, void *, size_t, ipc_call_t *);
|
---|
| 399 | extern int async_data_read_start(async_exch_t *, void *, size_t);
|
---|
[47b7006] | 400 | extern bool async_data_read_receive(ipc_callid_t *, size_t *);
|
---|
[0da4e41] | 401 | extern int async_data_read_finalize(ipc_callid_t, const void *, size_t);
|
---|
[eda925a] | 402 |
|
---|
[79ae36dd] | 403 | extern int async_data_read_forward_fast(async_exch_t *, sysarg_t, sysarg_t,
|
---|
| 404 | sysarg_t, sysarg_t, sysarg_t, ipc_call_t *);
|
---|
[b4cbef1] | 405 |
|
---|
| 406 | /*
|
---|
[eda925a] | 407 | * User-friendly wrappers for async_data_write_forward_fast().
|
---|
[b4cbef1] | 408 | */
|
---|
[64d2b10] | 409 |
|
---|
[79ae36dd] | 410 | #define async_data_write_forward_0_0(exch, method, answer) \
|
---|
| 411 | async_data_write_forward_fast(exch, method, 0, 0, 0, 0, NULL)
|
---|
| 412 | #define async_data_write_forward_0_1(exch, method, answer) \
|
---|
| 413 | async_data_write_forward_fast(exch, method, 0, 0, 0, 0, answer)
|
---|
| 414 | #define async_data_write_forward_1_0(exch, method, arg1, answer) \
|
---|
| 415 | async_data_write_forward_fast(exch, method, arg1, 0, 0, 0, NULL)
|
---|
| 416 | #define async_data_write_forward_1_1(exch, method, arg1, answer) \
|
---|
| 417 | async_data_write_forward_fast(exch, method, arg1, 0, 0, 0, answer)
|
---|
| 418 | #define async_data_write_forward_2_0(exch, method, arg1, arg2, answer) \
|
---|
| 419 | async_data_write_forward_fast(exch, method, arg1, arg2, 0, 0, NULL)
|
---|
| 420 | #define async_data_write_forward_2_1(exch, method, arg1, arg2, answer) \
|
---|
| 421 | async_data_write_forward_fast(exch, method, arg1, arg2, 0, 0, answer)
|
---|
| 422 | #define async_data_write_forward_3_0(exch, method, arg1, arg2, arg3, answer) \
|
---|
| 423 | async_data_write_forward_fast(exch, method, arg1, arg2, arg3, 0, \
|
---|
| 424 | NULL)
|
---|
| 425 | #define async_data_write_forward_3_1(exch, method, arg1, arg2, arg3, answer) \
|
---|
| 426 | async_data_write_forward_fast(exch, method, arg1, arg2, arg3, 0, \
|
---|
| 427 | answer)
|
---|
| 428 | #define async_data_write_forward_4_0(exch, method, arg1, arg2, arg3, arg4, \
|
---|
| 429 | answer) \
|
---|
| 430 | async_data_write_forward_fast(exch, method, arg1, arg2, arg3, arg4, \
|
---|
[b4cbef1] | 431 | NULL)
|
---|
[79ae36dd] | 432 | #define async_data_write_forward_4_1(exch, method, arg1, arg2, arg3, arg4, \
|
---|
| 433 | answer) \
|
---|
| 434 | async_data_write_forward_fast(exch, method, arg1, arg2, arg3, arg4, \
|
---|
| 435 | answer)
|
---|
| 436 |
|
---|
| 437 | extern int async_data_write_start(async_exch_t *, const void *, size_t);
|
---|
[47b7006] | 438 | extern bool async_data_write_receive(ipc_callid_t *, size_t *);
|
---|
[0da4e41] | 439 | extern int async_data_write_finalize(ipc_callid_t, void *, size_t);
|
---|
[eda925a] | 440 |
|
---|
| 441 | extern int async_data_write_accept(void **, const bool, const size_t,
|
---|
| 442 | const size_t, const size_t, size_t *);
|
---|
[47b7006] | 443 | extern void async_data_write_void(sysarg_t);
|
---|
[eda925a] | 444 |
|
---|
[79ae36dd] | 445 | extern int async_data_write_forward_fast(async_exch_t *, sysarg_t, sysarg_t,
|
---|
| 446 | sysarg_t, sysarg_t, sysarg_t, ipc_call_t *);
|
---|
| 447 |
|
---|
| 448 | extern int async_exchange_clone(async_exch_t *, async_exch_t *);
|
---|
| 449 | extern async_sess_t *async_clone_receive(exch_mgmt_t);
|
---|
| 450 | extern async_sess_t *async_callback_receive(exch_mgmt_t);
|
---|
[8869f7b] | 451 | extern async_sess_t *async_callback_receive_start(exch_mgmt_t, ipc_call_t *);
|
---|
[8aa42e3] | 452 |
|
---|
[2c4aa39] | 453 | extern int async_state_change_start(async_exch_t *, sysarg_t, sysarg_t,
|
---|
| 454 | sysarg_t, async_exch_t *);
|
---|
| 455 | extern bool async_state_change_receive(ipc_callid_t *, sysarg_t *, sysarg_t *,
|
---|
| 456 | sysarg_t *);
|
---|
| 457 | extern int async_state_change_finalize(ipc_callid_t, async_exch_t *);
|
---|
| 458 |
|
---|
[58cbf8d5] | 459 | extern void *async_remote_state_acquire(async_sess_t *);
|
---|
| 460 | extern void async_remote_state_update(async_sess_t *, void *);
|
---|
| 461 | extern void async_remote_state_release(async_sess_t *);
|
---|
| 462 | extern void async_remote_state_release_exchange(async_exch_t *);
|
---|
| 463 |
|
---|
[630c3a9] | 464 | #endif
|
---|
[b2951e2] | 465 |
|
---|
[fadd381] | 466 | /** @}
|
---|
[b2951e2] | 467 | */
|
---|