[4f5edcf6] | 1 | /*
|
---|
[3951046] | 2 | * Copyright (c) 2025 Jiri Svoboda
|
---|
[4f5edcf6] | 3 | * Copyright (c) 2006 Ondrej Palkovsky
|
---|
| 4 | * All rights reserved.
|
---|
| 5 | *
|
---|
| 6 | * Redistribution and use in source and binary forms, with or without
|
---|
| 7 | * modification, are permitted provided that the following conditions
|
---|
| 8 | * are met:
|
---|
| 9 | *
|
---|
| 10 | * - Redistributions of source code must retain the above copyright
|
---|
| 11 | * notice, this list of conditions and the following disclaimer.
|
---|
| 12 | * - Redistributions in binary form must reproduce the above copyright
|
---|
| 13 | * notice, this list of conditions and the following disclaimer in the
|
---|
| 14 | * documentation and/or other materials provided with the distribution.
|
---|
| 15 | * - The name of the author may not be used to endorse or promote products
|
---|
| 16 | * derived from this software without specific prior written permission.
|
---|
| 17 | *
|
---|
| 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
| 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
| 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
| 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
| 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
| 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
| 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
| 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
| 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
| 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
| 28 | */
|
---|
| 29 |
|
---|
| 30 | /** @addtogroup libc
|
---|
| 31 | * @{
|
---|
| 32 | */
|
---|
| 33 | /** @file
|
---|
| 34 | */
|
---|
| 35 |
|
---|
[4805495] | 36 | #ifndef _LIBC_PRIVATE_ASYNC_H_
|
---|
| 37 | #define _LIBC_PRIVATE_ASYNC_H_
|
---|
[4f5edcf6] | 38 |
|
---|
[b76a7329] | 39 | #include <async.h>
|
---|
[4f5edcf6] | 40 | #include <adt/list.h>
|
---|
| 41 | #include <fibril.h>
|
---|
[b76a7329] | 42 | #include <fibril_synch.h>
|
---|
[bd41ac52] | 43 | #include <time.h>
|
---|
[3e6a98c5] | 44 | #include <stdbool.h>
|
---|
[4f5edcf6] | 45 |
|
---|
[49a796f1] | 46 | /** Session data */
|
---|
| 47 | struct async_sess {
|
---|
| 48 | /** List of inactive exchanges */
|
---|
| 49 | list_t exch_list;
|
---|
| 50 |
|
---|
| 51 | /** Session interface */
|
---|
| 52 | iface_t iface;
|
---|
| 53 |
|
---|
| 54 | /** Exchange management style */
|
---|
| 55 | exch_mgmt_t mgmt;
|
---|
| 56 |
|
---|
| 57 | /** Session identification */
|
---|
| 58 | cap_phone_handle_t phone;
|
---|
| 59 |
|
---|
| 60 | /** First clone connection argument */
|
---|
[914c693] | 61 | iface_t arg1;
|
---|
[49a796f1] | 62 |
|
---|
| 63 | /** Second clone connection argument */
|
---|
| 64 | sysarg_t arg2;
|
---|
| 65 |
|
---|
| 66 | /** Third clone connection argument */
|
---|
| 67 | sysarg_t arg3;
|
---|
| 68 |
|
---|
| 69 | /** Exchange mutex */
|
---|
| 70 | fibril_mutex_t mutex;
|
---|
| 71 |
|
---|
| 72 | /** Number of opened exchanges */
|
---|
[498ced1] | 73 | int exchanges;
|
---|
[49a796f1] | 74 |
|
---|
| 75 | /** Mutex for stateful connections */
|
---|
| 76 | fibril_mutex_t remote_state_mtx;
|
---|
| 77 |
|
---|
| 78 | /** Data for stateful connections */
|
---|
| 79 | void *remote_state_data;
|
---|
| 80 | };
|
---|
| 81 |
|
---|
| 82 | /** Exchange data */
|
---|
| 83 | struct async_exch {
|
---|
| 84 | /** Link into list of inactive exchanges */
|
---|
| 85 | link_t sess_link;
|
---|
| 86 |
|
---|
| 87 | /** Link into global list of inactive exchanges */
|
---|
| 88 | link_t global_link;
|
---|
| 89 |
|
---|
| 90 | /** Session pointer */
|
---|
| 91 | async_sess_t *sess;
|
---|
| 92 |
|
---|
| 93 | /** Exchange identification */
|
---|
| 94 | cap_phone_handle_t phone;
|
---|
| 95 | };
|
---|
| 96 |
|
---|
| 97 | extern void __async_server_init(void);
|
---|
[25f6bddb] | 98 | extern void __async_server_fini(void);
|
---|
[49a796f1] | 99 | extern void __async_client_init(void);
|
---|
[25f6bddb] | 100 | extern void __async_client_fini(void);
|
---|
[49a796f1] | 101 | extern void __async_ports_init(void);
|
---|
[25f6bddb] | 102 | extern void __async_ports_fini(void);
|
---|
[49a796f1] | 103 |
|
---|
| 104 | extern errno_t async_create_port_internal(iface_t, async_port_handler_t,
|
---|
| 105 | void *, port_id_t *);
|
---|
[3951046] | 106 | extern async_port_handler_t async_get_interface_handler(iface_t, port_id_t,
|
---|
| 107 | void **);
|
---|
[b6ee5b1] | 108 |
|
---|
[d054ad3] | 109 | extern void async_reply_received(ipc_call_t *);
|
---|
| 110 |
|
---|
[4f5edcf6] | 111 | #endif
|
---|
| 112 |
|
---|
| 113 | /** @}
|
---|
| 114 | */
|
---|