| 1 | /*
|
|---|
| 2 | * SPDX-FileCopyrightText: 2021 Jiri Svoboda
|
|---|
| 3 | *
|
|---|
| 4 | * SPDX-License-Identifier: BSD-3-Clause
|
|---|
| 5 | */
|
|---|
| 6 |
|
|---|
| 7 | /** @addtogroup libc
|
|---|
| 8 | * @{
|
|---|
| 9 | */
|
|---|
| 10 | /** @file
|
|---|
| 11 | */
|
|---|
| 12 |
|
|---|
| 13 | #ifndef _LIBC_CON_SRV_H_
|
|---|
| 14 | #define _LIBC_CON_SRV_H_
|
|---|
| 15 |
|
|---|
| 16 | #include <adt/list.h>
|
|---|
| 17 | #include <async.h>
|
|---|
| 18 | #include <fibril_synch.h>
|
|---|
| 19 | #include <io/charfield.h>
|
|---|
| 20 | #include <io/color.h>
|
|---|
| 21 | #include <io/concaps.h>
|
|---|
| 22 | #include <io/cons_event.h>
|
|---|
| 23 | #include <io/pixel.h>
|
|---|
| 24 | #include <io/style.h>
|
|---|
| 25 | #include <stdbool.h>
|
|---|
| 26 | #include <time.h>
|
|---|
| 27 | #include <stddef.h>
|
|---|
| 28 |
|
|---|
| 29 | typedef struct con_ops con_ops_t;
|
|---|
| 30 |
|
|---|
| 31 | #define CON_CAPTION_MAXLEN 255
|
|---|
| 32 |
|
|---|
| 33 | /** Service setup (per sevice) */
|
|---|
| 34 | typedef struct {
|
|---|
| 35 | con_ops_t *ops;
|
|---|
| 36 | void *sarg;
|
|---|
| 37 | /** Period to check for abort */
|
|---|
| 38 | usec_t abort_timeout;
|
|---|
| 39 | bool aborted;
|
|---|
| 40 | } con_srvs_t;
|
|---|
| 41 |
|
|---|
| 42 | /** Server structure (per client session) */
|
|---|
| 43 | typedef struct {
|
|---|
| 44 | con_srvs_t *srvs;
|
|---|
| 45 | async_sess_t *client_sess;
|
|---|
| 46 | void *carg;
|
|---|
| 47 | } con_srv_t;
|
|---|
| 48 |
|
|---|
| 49 | struct con_ops {
|
|---|
| 50 | errno_t (*open)(con_srvs_t *, con_srv_t *);
|
|---|
| 51 | errno_t (*close)(con_srv_t *);
|
|---|
| 52 | errno_t (*read)(con_srv_t *, void *, size_t, size_t *);
|
|---|
| 53 | errno_t (*write)(con_srv_t *, void *, size_t, size_t *);
|
|---|
| 54 | void (*sync)(con_srv_t *);
|
|---|
| 55 | void (*clear)(con_srv_t *);
|
|---|
| 56 | void (*set_pos)(con_srv_t *, sysarg_t col, sysarg_t row);
|
|---|
| 57 | errno_t (*get_pos)(con_srv_t *, sysarg_t *, sysarg_t *);
|
|---|
| 58 | errno_t (*get_size)(con_srv_t *, sysarg_t *, sysarg_t *);
|
|---|
| 59 | errno_t (*get_color_cap)(con_srv_t *, console_caps_t *);
|
|---|
| 60 | void (*set_style)(con_srv_t *, console_style_t);
|
|---|
| 61 | void (*set_color)(con_srv_t *, console_color_t, console_color_t,
|
|---|
| 62 | console_color_attr_t);
|
|---|
| 63 | void (*set_rgb_color)(con_srv_t *, pixel_t, pixel_t);
|
|---|
| 64 | void (*set_cursor_visibility)(con_srv_t *, bool);
|
|---|
| 65 | errno_t (*set_caption)(con_srv_t *, const char *);
|
|---|
| 66 | errno_t (*get_event)(con_srv_t *, cons_event_t *);
|
|---|
| 67 | errno_t (*map)(con_srv_t *, sysarg_t, sysarg_t, charfield_t **);
|
|---|
| 68 | void (*unmap)(con_srv_t *);
|
|---|
| 69 | void (*update)(con_srv_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t);
|
|---|
| 70 | };
|
|---|
| 71 |
|
|---|
| 72 | extern void con_srvs_init(con_srvs_t *);
|
|---|
| 73 |
|
|---|
| 74 | extern errno_t con_conn(ipc_call_t *, con_srvs_t *);
|
|---|
| 75 |
|
|---|
| 76 | #endif
|
|---|
| 77 |
|
|---|
| 78 | /** @}
|
|---|
| 79 | */
|
|---|