source: mainline/uspace/lib/c/generic/private/async.h@ ca48672

Last change on this file since ca48672 was 3951046, checked in by Jiri Svoboda <jiri@…>, 12 days ago

Async ports and interfaces do the castling.

Now interfaces hang under ports.
Minimum change, missing port ID to select port if iface type is the
same.

  • Property mode set to 100644
File size: 3.1 KB
Line 
1/*
2 * Copyright (c) 2025 Jiri Svoboda
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
36#ifndef _LIBC_PRIVATE_ASYNC_H_
37#define _LIBC_PRIVATE_ASYNC_H_
38
39#include <async.h>
40#include <adt/list.h>
41#include <fibril.h>
42#include <fibril_synch.h>
43#include <time.h>
44#include <stdbool.h>
45
46/** Session data */
47struct 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 */
61 iface_t arg1;
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 */
73 int exchanges;
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 */
83struct 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
97extern void __async_server_init(void);
98extern void __async_server_fini(void);
99extern void __async_client_init(void);
100extern void __async_client_fini(void);
101extern void __async_ports_init(void);
102extern void __async_ports_fini(void);
103
104extern errno_t async_create_port_internal(iface_t, async_port_handler_t,
105 void *, port_id_t *);
106extern async_port_handler_t async_get_interface_handler(iface_t, port_id_t,
107 void **);
108
109extern void async_reply_received(ipc_call_t *);
110
111#endif
112
113/** @}
114 */
Note: See TracBrowser for help on using the repository browser.