| 1 | /*
|
|---|
| 2 | * Copyright (c) 2006 Ondrej Palkovsky
|
|---|
| 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 |
|
|---|
| 29 | /** @addtogroup libc
|
|---|
| 30 | * @{
|
|---|
| 31 | */
|
|---|
| 32 | /** @file
|
|---|
| 33 | */
|
|---|
| 34 |
|
|---|
| 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 |
|
|---|
| 39 | #ifndef LIBC_ASYNC_H_
|
|---|
| 40 | #define LIBC_ASYNC_H_
|
|---|
| 41 |
|
|---|
| 42 | #include <ipc/common.h>
|
|---|
| 43 | #include <fibril.h>
|
|---|
| 44 | #include <fibril_synch.h>
|
|---|
| 45 | #include <sys/time.h>
|
|---|
| 46 | #include <atomic.h>
|
|---|
| 47 | #include <bool.h>
|
|---|
| 48 | #include <task.h>
|
|---|
| 49 |
|
|---|
| 50 | typedef ipc_callid_t aid_t;
|
|---|
| 51 |
|
|---|
| 52 | typedef void *(*async_client_data_ctor_t)(void);
|
|---|
| 53 | typedef void (*async_client_data_dtor_t)(void *);
|
|---|
| 54 |
|
|---|
| 55 | /** Client connection handler
|
|---|
| 56 | *
|
|---|
| 57 | * @param callid ID of incoming call or 0 if connection initiated from
|
|---|
| 58 | * inside using async_connect_to_me()
|
|---|
| 59 | * @param call Incoming call or 0 if connection initiated from inside
|
|---|
| 60 | * @param arg Local argument passed from async_new_connection() or
|
|---|
| 61 | * async_connect_to_me()
|
|---|
| 62 | */
|
|---|
| 63 | typedef void (*async_client_conn_t)(ipc_callid_t, ipc_call_t *, void *);
|
|---|
| 64 |
|
|---|
| 65 | /** Interrupt handler */
|
|---|
| 66 | typedef void (*async_interrupt_handler_t)(ipc_callid_t, ipc_call_t *);
|
|---|
| 67 |
|
|---|
| 68 | /** Exchange management style
|
|---|
| 69 | *
|
|---|
| 70 | */
|
|---|
| 71 | typedef enum {
|
|---|
| 72 | /** No explicit exchange management
|
|---|
| 73 | *
|
|---|
| 74 | * Suitable for protocols which use a single
|
|---|
| 75 | * IPC message per exchange only.
|
|---|
| 76 | *
|
|---|
| 77 | */
|
|---|
| 78 | EXCHANGE_ATOMIC = 0,
|
|---|
| 79 |
|
|---|
| 80 | /** Exchange management via phone cloning
|
|---|
| 81 | *
|
|---|
| 82 | * Suitable for servers which support client
|
|---|
| 83 | * data tracking by task hashes and do not
|
|---|
| 84 | * mind cloned phones.
|
|---|
| 85 | *
|
|---|
| 86 | */
|
|---|
| 87 | EXCHANGE_PARALLEL,
|
|---|
| 88 |
|
|---|
| 89 | /** Exchange management via mutual exclusion
|
|---|
| 90 | *
|
|---|
| 91 | * Suitable for any kind of client/server communication,
|
|---|
| 92 | * but can limit parallelism.
|
|---|
| 93 | *
|
|---|
| 94 | */
|
|---|
| 95 | EXCHANGE_SERIALIZE
|
|---|
| 96 | } exch_mgmt_t;
|
|---|
| 97 |
|
|---|
| 98 | /** Session data */
|
|---|
| 99 | typedef struct {
|
|---|
| 100 | /** List of inactive exchanges */
|
|---|
| 101 | list_t exch_list;
|
|---|
| 102 |
|
|---|
| 103 | /** Exchange management style */
|
|---|
| 104 | exch_mgmt_t mgmt;
|
|---|
| 105 |
|
|---|
| 106 | /** Session identification */
|
|---|
| 107 | int phone;
|
|---|
| 108 |
|
|---|
| 109 | /** First clone connection argument */
|
|---|
| 110 | sysarg_t arg1;
|
|---|
| 111 |
|
|---|
| 112 | /** Second clone connection argument */
|
|---|
| 113 | sysarg_t arg2;
|
|---|
| 114 |
|
|---|
| 115 | /** Third clone connection argument */
|
|---|
| 116 | sysarg_t arg3;
|
|---|
| 117 |
|
|---|
| 118 | /** Exchange mutex */
|
|---|
| 119 | fibril_mutex_t mutex;
|
|---|
| 120 |
|
|---|
| 121 | /** Number of opened exchanges */
|
|---|
| 122 | atomic_t refcnt;
|
|---|
| 123 | } async_sess_t;
|
|---|
| 124 |
|
|---|
| 125 | /** Exchange data */
|
|---|
| 126 | typedef struct {
|
|---|
| 127 | /** Link into list of inactive exchanges */
|
|---|
| 128 | link_t sess_link;
|
|---|
| 129 |
|
|---|
| 130 | /** Link into global list of inactive exchanges */
|
|---|
| 131 | link_t global_link;
|
|---|
| 132 |
|
|---|
| 133 | /** Session pointer */
|
|---|
| 134 | async_sess_t *sess;
|
|---|
| 135 |
|
|---|
| 136 | /** Exchange identification */
|
|---|
| 137 | int phone;
|
|---|
| 138 | } async_exch_t;
|
|---|
| 139 |
|
|---|
| 140 | extern atomic_t threads_in_ipc_wait;
|
|---|
| 141 |
|
|---|
| 142 | #define async_manager() \
|
|---|
| 143 | fibril_switch(FIBRIL_TO_MANAGER)
|
|---|
| 144 |
|
|---|
| 145 | #define async_get_call(data) \
|
|---|
| 146 | async_get_call_timeout(data, 0)
|
|---|
| 147 |
|
|---|
| 148 | extern ipc_callid_t async_get_call_timeout(ipc_call_t *, suseconds_t);
|
|---|
| 149 |
|
|---|
| 150 | /*
|
|---|
| 151 | * User-friendly wrappers for async_send_fast() and async_send_slow(). The
|
|---|
| 152 | * macros are in the form async_send_m(), where m denotes the number of payload
|
|---|
| 153 | * arguments. Each macros chooses between the fast and the slow version based
|
|---|
| 154 | * on m.
|
|---|
| 155 | */
|
|---|
| 156 |
|
|---|
| 157 | #define async_send_0(exch, method, dataptr) \
|
|---|
| 158 | async_send_fast(exch, method, 0, 0, 0, 0, dataptr)
|
|---|
| 159 | #define async_send_1(exch, method, arg1, dataptr) \
|
|---|
| 160 | async_send_fast(exch, method, arg1, 0, 0, 0, dataptr)
|
|---|
| 161 | #define async_send_2(exch, method, arg1, arg2, dataptr) \
|
|---|
| 162 | async_send_fast(exch, method, arg1, arg2, 0, 0, dataptr)
|
|---|
| 163 | #define async_send_3(exch, method, arg1, arg2, arg3, dataptr) \
|
|---|
| 164 | async_send_fast(exch, method, arg1, arg2, arg3, 0, dataptr)
|
|---|
| 165 | #define async_send_4(exch, method, arg1, arg2, arg3, arg4, dataptr) \
|
|---|
| 166 | async_send_fast(exch, method, arg1, arg2, arg3, arg4, dataptr)
|
|---|
| 167 | #define async_send_5(exch, method, arg1, arg2, arg3, arg4, arg5, dataptr) \
|
|---|
| 168 | async_send_slow(exch, method, arg1, arg2, arg3, arg4, arg5, dataptr)
|
|---|
| 169 |
|
|---|
| 170 | extern aid_t async_send_fast(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
|
|---|
| 171 | sysarg_t, sysarg_t, ipc_call_t *);
|
|---|
| 172 | extern aid_t async_send_slow(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
|
|---|
| 173 | sysarg_t, sysarg_t, sysarg_t, ipc_call_t *);
|
|---|
| 174 |
|
|---|
| 175 | extern void async_wait_for(aid_t, sysarg_t *);
|
|---|
| 176 | extern int async_wait_timeout(aid_t, sysarg_t *, suseconds_t);
|
|---|
| 177 |
|
|---|
| 178 | extern fid_t async_new_connection(sysarg_t, sysarg_t, ipc_callid_t,
|
|---|
| 179 | ipc_call_t *, async_client_conn_t, void *);
|
|---|
| 180 |
|
|---|
| 181 | extern void async_usleep(suseconds_t);
|
|---|
| 182 | extern void async_create_manager(void);
|
|---|
| 183 | extern void async_destroy_manager(void);
|
|---|
| 184 |
|
|---|
| 185 | extern void async_set_client_data_constructor(async_client_data_ctor_t);
|
|---|
| 186 | extern void async_set_client_data_destructor(async_client_data_dtor_t);
|
|---|
| 187 | extern void *async_get_client_data(void);
|
|---|
| 188 | extern void *async_get_client_data_by_hash(sysarg_t);
|
|---|
| 189 | extern void async_put_client_data_by_hash(sysarg_t);
|
|---|
| 190 |
|
|---|
| 191 | extern void async_set_client_connection(async_client_conn_t);
|
|---|
| 192 | extern void async_set_interrupt_received(async_interrupt_handler_t);
|
|---|
| 193 |
|
|---|
| 194 | /*
|
|---|
| 195 | * Wrappers for simple communication.
|
|---|
| 196 | */
|
|---|
| 197 |
|
|---|
| 198 | extern void async_msg_0(async_exch_t *, sysarg_t);
|
|---|
| 199 | extern void async_msg_1(async_exch_t *, sysarg_t, sysarg_t);
|
|---|
| 200 | extern void async_msg_2(async_exch_t *, sysarg_t, sysarg_t, sysarg_t);
|
|---|
| 201 | extern void async_msg_3(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t);
|
|---|
| 202 | extern void async_msg_4(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
|
|---|
| 203 | sysarg_t);
|
|---|
| 204 | extern void async_msg_5(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
|
|---|
| 205 | sysarg_t, sysarg_t);
|
|---|
| 206 |
|
|---|
| 207 | /*
|
|---|
| 208 | * Wrappers for answer routines.
|
|---|
| 209 | */
|
|---|
| 210 |
|
|---|
| 211 | extern sysarg_t async_answer_0(ipc_callid_t, sysarg_t);
|
|---|
| 212 | extern sysarg_t async_answer_1(ipc_callid_t, sysarg_t, sysarg_t);
|
|---|
| 213 | extern sysarg_t async_answer_2(ipc_callid_t, sysarg_t, sysarg_t, sysarg_t);
|
|---|
| 214 | extern sysarg_t async_answer_3(ipc_callid_t, sysarg_t, sysarg_t, sysarg_t,
|
|---|
| 215 | sysarg_t);
|
|---|
| 216 | extern sysarg_t async_answer_4(ipc_callid_t, sysarg_t, sysarg_t, sysarg_t,
|
|---|
| 217 | sysarg_t, sysarg_t);
|
|---|
| 218 | extern sysarg_t async_answer_5(ipc_callid_t, sysarg_t, sysarg_t, sysarg_t,
|
|---|
| 219 | sysarg_t, sysarg_t, sysarg_t);
|
|---|
| 220 |
|
|---|
| 221 | /*
|
|---|
| 222 | * Wrappers for forwarding routines.
|
|---|
| 223 | */
|
|---|
| 224 |
|
|---|
| 225 | extern int async_forward_fast(ipc_callid_t, async_exch_t *, sysarg_t, sysarg_t,
|
|---|
| 226 | sysarg_t, unsigned int);
|
|---|
| 227 | extern int async_forward_slow(ipc_callid_t, async_exch_t *, sysarg_t, sysarg_t,
|
|---|
| 228 | sysarg_t, sysarg_t, sysarg_t, sysarg_t, unsigned int);
|
|---|
| 229 |
|
|---|
| 230 | /*
|
|---|
| 231 | * User-friendly wrappers for async_req_fast() and async_req_slow(). The macros
|
|---|
| 232 | * are in the form async_req_m_n(), where m is the number of payload arguments
|
|---|
| 233 | * and n is the number of return arguments. The macros decide between the fast
|
|---|
| 234 | * and slow verion based on m.
|
|---|
| 235 | */
|
|---|
| 236 |
|
|---|
| 237 | #define async_req_0_0(exch, method) \
|
|---|
| 238 | async_req_fast(exch, method, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL)
|
|---|
| 239 | #define async_req_0_1(exch, method, r1) \
|
|---|
| 240 | async_req_fast(exch, method, 0, 0, 0, 0, r1, NULL, NULL, NULL, NULL)
|
|---|
| 241 | #define async_req_0_2(exch, method, r1, r2) \
|
|---|
| 242 | async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, NULL, NULL, NULL)
|
|---|
| 243 | #define async_req_0_3(exch, method, r1, r2, r3) \
|
|---|
| 244 | async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, r3, NULL, NULL)
|
|---|
| 245 | #define async_req_0_4(exch, method, r1, r2, r3, r4) \
|
|---|
| 246 | async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, r3, r4, NULL)
|
|---|
| 247 | #define async_req_0_5(exch, method, r1, r2, r3, r4, r5) \
|
|---|
| 248 | async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, r3, r4, r5)
|
|---|
| 249 |
|
|---|
| 250 | #define async_req_1_0(exch, method, arg1) \
|
|---|
| 251 | async_req_fast(exch, method, arg1, 0, 0, 0, NULL, NULL, NULL, NULL, \
|
|---|
| 252 | NULL)
|
|---|
| 253 | #define async_req_1_1(exch, method, arg1, rc1) \
|
|---|
| 254 | async_req_fast(exch, method, arg1, 0, 0, 0, rc1, NULL, NULL, NULL, \
|
|---|
| 255 | NULL)
|
|---|
| 256 | #define async_req_1_2(exch, method, arg1, rc1, rc2) \
|
|---|
| 257 | async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, NULL, NULL, \
|
|---|
| 258 | NULL)
|
|---|
| 259 | #define async_req_1_3(exch, method, arg1, rc1, rc2, rc3) \
|
|---|
| 260 | async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, rc3, NULL, \
|
|---|
| 261 | NULL)
|
|---|
| 262 | #define async_req_1_4(exch, method, arg1, rc1, rc2, rc3, rc4) \
|
|---|
| 263 | async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, rc3, rc4, \
|
|---|
| 264 | NULL)
|
|---|
| 265 | #define async_req_1_5(exch, method, arg1, rc1, rc2, rc3, rc4, rc5) \
|
|---|
| 266 | async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, rc3, rc4, \
|
|---|
| 267 | rc5)
|
|---|
| 268 |
|
|---|
| 269 | #define async_req_2_0(exch, method, arg1, arg2) \
|
|---|
| 270 | async_req_fast(exch, method, arg1, arg2, 0, 0, NULL, NULL, NULL, \
|
|---|
| 271 | NULL, NULL)
|
|---|
| 272 | #define async_req_2_1(exch, method, arg1, arg2, rc1) \
|
|---|
| 273 | async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, NULL, NULL, \
|
|---|
| 274 | NULL, NULL)
|
|---|
| 275 | #define async_req_2_2(exch, method, arg1, arg2, rc1, rc2) \
|
|---|
| 276 | async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, NULL, NULL, \
|
|---|
| 277 | NULL)
|
|---|
| 278 | #define async_req_2_3(exch, method, arg1, arg2, rc1, rc2, rc3) \
|
|---|
| 279 | async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, rc3, NULL, \
|
|---|
| 280 | NULL)
|
|---|
| 281 | #define async_req_2_4(exch, method, arg1, arg2, rc1, rc2, rc3, rc4) \
|
|---|
| 282 | async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, rc3, rc4, \
|
|---|
| 283 | NULL)
|
|---|
| 284 | #define async_req_2_5(exch, method, arg1, arg2, rc1, rc2, rc3, rc4, rc5) \
|
|---|
| 285 | async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, rc3, rc4, \
|
|---|
| 286 | rc5)
|
|---|
| 287 |
|
|---|
| 288 | #define async_req_3_0(exch, method, arg1, arg2, arg3) \
|
|---|
| 289 | async_req_fast(exch, method, arg1, arg2, arg3, 0, NULL, NULL, NULL, \
|
|---|
| 290 | NULL, NULL)
|
|---|
| 291 | #define async_req_3_1(exch, method, arg1, arg2, arg3, rc1) \
|
|---|
| 292 | async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, NULL, NULL, \
|
|---|
| 293 | NULL, NULL)
|
|---|
| 294 | #define async_req_3_2(exch, method, arg1, arg2, arg3, rc1, rc2) \
|
|---|
| 295 | async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, NULL, \
|
|---|
| 296 | NULL, NULL)
|
|---|
| 297 | #define async_req_3_3(exch, method, arg1, arg2, arg3, rc1, rc2, rc3) \
|
|---|
| 298 | async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, rc3, \
|
|---|
| 299 | NULL, NULL)
|
|---|
| 300 | #define async_req_3_4(exch, method, arg1, arg2, arg3, rc1, rc2, rc3, rc4) \
|
|---|
| 301 | async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, rc3, \
|
|---|
| 302 | rc4, NULL)
|
|---|
| 303 | #define async_req_3_5(exch, method, arg1, arg2, arg3, rc1, rc2, rc3, rc4, \
|
|---|
| 304 | rc5) \
|
|---|
| 305 | async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, rc3, \
|
|---|
| 306 | rc4, rc5)
|
|---|
| 307 |
|
|---|
| 308 | #define async_req_4_0(exch, method, arg1, arg2, arg3, arg4) \
|
|---|
| 309 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, NULL, NULL, \
|
|---|
| 310 | NULL, NULL, NULL)
|
|---|
| 311 | #define async_req_4_1(exch, method, arg1, arg2, arg3, arg4, rc1) \
|
|---|
| 312 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, NULL, \
|
|---|
| 313 | NULL, NULL, NULL)
|
|---|
| 314 | #define async_req_4_2(exch, method, arg1, arg2, arg3, arg4, rc1, rc2) \
|
|---|
| 315 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, NULL, \
|
|---|
| 316 | NULL, NULL)
|
|---|
| 317 | #define async_req_4_3(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3) \
|
|---|
| 318 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
|---|
| 319 | NULL, NULL)
|
|---|
| 320 | #define async_req_4_4(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
|---|
| 321 | rc4) \
|
|---|
| 322 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
|---|
| 323 | rc4, NULL)
|
|---|
| 324 | #define async_req_4_5(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
|---|
| 325 | rc4, rc5) \
|
|---|
| 326 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
|---|
| 327 | rc4, rc5)
|
|---|
| 328 |
|
|---|
| 329 | #define async_req_5_0(exch, method, arg1, arg2, arg3, arg4, arg5) \
|
|---|
| 330 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, NULL, \
|
|---|
| 331 | NULL, NULL, NULL, NULL)
|
|---|
| 332 | #define async_req_5_1(exch, method, arg1, arg2, arg3, arg4, arg5, rc1) \
|
|---|
| 333 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, \
|
|---|
| 334 | NULL, NULL, NULL, NULL)
|
|---|
| 335 | #define async_req_5_2(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2) \
|
|---|
| 336 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
|---|
| 337 | NULL, NULL, NULL)
|
|---|
| 338 | #define async_req_5_3(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
|---|
| 339 | rc3) \
|
|---|
| 340 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
|---|
| 341 | rc3, NULL, NULL)
|
|---|
| 342 | #define async_req_5_4(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
|---|
| 343 | rc3, rc4) \
|
|---|
| 344 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
|---|
| 345 | rc3, rc4, NULL)
|
|---|
| 346 | #define async_req_5_5(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
|---|
| 347 | rc3, rc4, rc5) \
|
|---|
| 348 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
|---|
| 349 | rc3, rc4, rc5)
|
|---|
| 350 |
|
|---|
| 351 | extern sysarg_t async_req_fast(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
|
|---|
| 352 | sysarg_t, sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *,
|
|---|
| 353 | sysarg_t *);
|
|---|
| 354 | extern sysarg_t async_req_slow(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
|
|---|
| 355 | sysarg_t, sysarg_t, sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *,
|
|---|
| 356 | sysarg_t *, sysarg_t *);
|
|---|
| 357 |
|
|---|
| 358 | extern async_sess_t *async_connect_me(exch_mgmt_t, async_exch_t *);
|
|---|
| 359 | extern async_sess_t *async_connect_me_to(exch_mgmt_t, async_exch_t *, sysarg_t,
|
|---|
| 360 | sysarg_t, sysarg_t);
|
|---|
| 361 | extern async_sess_t *async_connect_me_to_blocking(exch_mgmt_t, async_exch_t *,
|
|---|
| 362 | sysarg_t, sysarg_t, sysarg_t);
|
|---|
| 363 | extern async_sess_t *async_connect_kbox(task_id_t);
|
|---|
| 364 |
|
|---|
| 365 | extern int async_connect_to_me(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
|
|---|
| 366 | async_client_conn_t, void *);
|
|---|
| 367 |
|
|---|
| 368 | extern int async_hangup(async_sess_t *);
|
|---|
| 369 | extern void async_poke(void);
|
|---|
| 370 |
|
|---|
| 371 | extern async_exch_t *async_exchange_begin(async_sess_t *);
|
|---|
| 372 | extern void async_exchange_end(async_exch_t *);
|
|---|
| 373 |
|
|---|
| 374 | /*
|
|---|
| 375 | * User-friendly wrappers for async_share_in_start().
|
|---|
| 376 | */
|
|---|
| 377 |
|
|---|
| 378 | #define async_share_in_start_0_0(exch, dst, size) \
|
|---|
| 379 | async_share_in_start(exch, dst, size, 0, NULL)
|
|---|
| 380 | #define async_share_in_start_0_1(exch, dst, size, flags) \
|
|---|
| 381 | async_share_in_start(exch, dst, size, 0, flags)
|
|---|
| 382 | #define async_share_in_start_1_0(exch, dst, size, arg) \
|
|---|
| 383 | async_share_in_start(exch, dst, size, arg, NULL)
|
|---|
| 384 | #define async_share_in_start_1_1(exch, dst, size, arg, flags) \
|
|---|
| 385 | async_share_in_start(exch, dst, size, arg, flags)
|
|---|
| 386 |
|
|---|
| 387 | extern int async_share_in_start(async_exch_t *, void *, size_t, sysarg_t,
|
|---|
| 388 | unsigned int *);
|
|---|
| 389 | extern bool async_share_in_receive(ipc_callid_t *, size_t *);
|
|---|
| 390 | extern int async_share_in_finalize(ipc_callid_t, void *, unsigned int);
|
|---|
| 391 |
|
|---|
| 392 | extern int async_share_out_start(async_exch_t *, void *, unsigned int);
|
|---|
| 393 | extern bool async_share_out_receive(ipc_callid_t *, size_t *, unsigned int *);
|
|---|
| 394 | extern int async_share_out_finalize(ipc_callid_t, void *);
|
|---|
| 395 |
|
|---|
| 396 | /*
|
|---|
| 397 | * User-friendly wrappers for async_data_read_forward_fast().
|
|---|
| 398 | */
|
|---|
| 399 |
|
|---|
| 400 | #define async_data_read_forward_0_0(exch, method, answer) \
|
|---|
| 401 | async_data_read_forward_fast(exch, method, 0, 0, 0, 0, NULL)
|
|---|
| 402 | #define async_data_read_forward_0_1(exch, method, answer) \
|
|---|
| 403 | async_data_read_forward_fast(exch, method, 0, 0, 0, 0, answer)
|
|---|
| 404 | #define async_data_read_forward_1_0(exch, method, arg1, answer) \
|
|---|
| 405 | async_data_read_forward_fast(exch, method, arg1, 0, 0, 0, NULL)
|
|---|
| 406 | #define async_data_read_forward_1_1(exch, method, arg1, answer) \
|
|---|
| 407 | async_data_read_forward_fast(exch, method, arg1, 0, 0, 0, answer)
|
|---|
| 408 | #define async_data_read_forward_2_0(exch, method, arg1, arg2, answer) \
|
|---|
| 409 | async_data_read_forward_fast(exch, method, arg1, arg2, 0, 0, NULL)
|
|---|
| 410 | #define async_data_read_forward_2_1(exch, method, arg1, arg2, answer) \
|
|---|
| 411 | async_data_read_forward_fast(exch, method, arg1, arg2, 0, 0, answer)
|
|---|
| 412 | #define async_data_read_forward_3_0(exch, method, arg1, arg2, arg3, answer) \
|
|---|
| 413 | async_data_read_forward_fast(exch, method, arg1, arg2, arg3, 0, NULL)
|
|---|
| 414 | #define async_data_read_forward_3_1(exch, method, arg1, arg2, arg3, answer) \
|
|---|
| 415 | async_data_read_forward_fast(exch, method, arg1, arg2, arg3, 0, \
|
|---|
| 416 | answer)
|
|---|
| 417 | #define async_data_read_forward_4_0(exch, method, arg1, arg2, arg3, arg4, \
|
|---|
| 418 | answer) \
|
|---|
| 419 | async_data_read_forward_fast(exch, method, arg1, arg2, arg3, arg4, \
|
|---|
| 420 | NULL)
|
|---|
| 421 | #define async_data_read_forward_4_1(exch, method, arg1, arg2, arg3, arg4, \
|
|---|
| 422 | answer) \
|
|---|
| 423 | async_data_read_forward_fast(exch, method, arg1, arg2, arg3, arg4, \
|
|---|
| 424 | answer)
|
|---|
| 425 |
|
|---|
| 426 | extern aid_t async_data_read(async_exch_t *, void *, size_t, ipc_call_t *);
|
|---|
| 427 | extern int async_data_read_start(async_exch_t *, void *, size_t);
|
|---|
| 428 | extern bool async_data_read_receive(ipc_callid_t *, size_t *);
|
|---|
| 429 | extern int async_data_read_finalize(ipc_callid_t, const void *, size_t);
|
|---|
| 430 |
|
|---|
| 431 | extern int async_data_read_forward_fast(async_exch_t *, sysarg_t, sysarg_t,
|
|---|
| 432 | sysarg_t, sysarg_t, sysarg_t, ipc_call_t *);
|
|---|
| 433 |
|
|---|
| 434 | /*
|
|---|
| 435 | * User-friendly wrappers for async_data_write_forward_fast().
|
|---|
| 436 | */
|
|---|
| 437 |
|
|---|
| 438 | #define async_data_write_forward_0_0(exch, method, answer) \
|
|---|
| 439 | async_data_write_forward_fast(exch, method, 0, 0, 0, 0, NULL)
|
|---|
| 440 | #define async_data_write_forward_0_1(exch, method, answer) \
|
|---|
| 441 | async_data_write_forward_fast(exch, method, 0, 0, 0, 0, answer)
|
|---|
| 442 | #define async_data_write_forward_1_0(exch, method, arg1, answer) \
|
|---|
| 443 | async_data_write_forward_fast(exch, method, arg1, 0, 0, 0, NULL)
|
|---|
| 444 | #define async_data_write_forward_1_1(exch, method, arg1, answer) \
|
|---|
| 445 | async_data_write_forward_fast(exch, method, arg1, 0, 0, 0, answer)
|
|---|
| 446 | #define async_data_write_forward_2_0(exch, method, arg1, arg2, answer) \
|
|---|
| 447 | async_data_write_forward_fast(exch, method, arg1, arg2, 0, 0, NULL)
|
|---|
| 448 | #define async_data_write_forward_2_1(exch, method, arg1, arg2, answer) \
|
|---|
| 449 | async_data_write_forward_fast(exch, method, arg1, arg2, 0, 0, answer)
|
|---|
| 450 | #define async_data_write_forward_3_0(exch, method, arg1, arg2, arg3, answer) \
|
|---|
| 451 | async_data_write_forward_fast(exch, method, arg1, arg2, arg3, 0, \
|
|---|
| 452 | NULL)
|
|---|
| 453 | #define async_data_write_forward_3_1(exch, method, arg1, arg2, arg3, answer) \
|
|---|
| 454 | async_data_write_forward_fast(exch, method, arg1, arg2, arg3, 0, \
|
|---|
| 455 | answer)
|
|---|
| 456 | #define async_data_write_forward_4_0(exch, method, arg1, arg2, arg3, arg4, \
|
|---|
| 457 | answer) \
|
|---|
| 458 | async_data_write_forward_fast(exch, method, arg1, arg2, arg3, arg4, \
|
|---|
| 459 | NULL)
|
|---|
| 460 | #define async_data_write_forward_4_1(exch, method, arg1, arg2, arg3, arg4, \
|
|---|
| 461 | answer) \
|
|---|
| 462 | async_data_write_forward_fast(exch, method, arg1, arg2, arg3, arg4, \
|
|---|
| 463 | answer)
|
|---|
| 464 |
|
|---|
| 465 | extern int async_data_write_start(async_exch_t *, const void *, size_t);
|
|---|
| 466 | extern bool async_data_write_receive(ipc_callid_t *, size_t *);
|
|---|
| 467 | extern int async_data_write_finalize(ipc_callid_t, void *, size_t);
|
|---|
| 468 |
|
|---|
| 469 | extern int async_data_write_accept(void **, const bool, const size_t,
|
|---|
| 470 | const size_t, const size_t, size_t *);
|
|---|
| 471 | extern void async_data_write_void(sysarg_t);
|
|---|
| 472 |
|
|---|
| 473 | extern int async_data_write_forward_fast(async_exch_t *, sysarg_t, sysarg_t,
|
|---|
| 474 | sysarg_t, sysarg_t, sysarg_t, ipc_call_t *);
|
|---|
| 475 |
|
|---|
| 476 | extern int async_exchange_clone(async_exch_t *, async_exch_t *);
|
|---|
| 477 | extern async_sess_t *async_clone_receive(exch_mgmt_t);
|
|---|
| 478 | extern async_sess_t *async_callback_receive(exch_mgmt_t);
|
|---|
| 479 | extern async_sess_t *async_callback_receive_start(exch_mgmt_t, ipc_call_t *);
|
|---|
| 480 |
|
|---|
| 481 | extern int async_state_change_start(async_exch_t *, sysarg_t, sysarg_t,
|
|---|
| 482 | sysarg_t, async_exch_t *);
|
|---|
| 483 | extern bool async_state_change_receive(ipc_callid_t *, sysarg_t *, sysarg_t *,
|
|---|
| 484 | sysarg_t *);
|
|---|
| 485 | extern int async_state_change_finalize(ipc_callid_t, async_exch_t *);
|
|---|
| 486 |
|
|---|
| 487 | #endif
|
|---|
| 488 |
|
|---|
| 489 | /** @}
|
|---|
| 490 | */
|
|---|