uvtd: add VT subsystem
[platform/upstream/kmscon.git] / src / uvtd_vt.h
1 /*
2  * uvtd - User-space VT daemon
3  *
4  * Copyright (c) 2013 David Herrmann <dh.herrmann@gmail.com>
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining
7  * a copy of this software and associated documentation files
8  * (the "Software"), to deal in the Software without restriction, including
9  * without limitation the rights to use, copy, modify, merge, publish,
10  * distribute, sublicense, and/or sell copies of the Software, and to
11  * permit persons to whom the Software is furnished to do so, subject to
12  * the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be included
15  * in all copies or substantial portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24  */
25
26 /*
27  * Virtual Terminals
28  * Every virtual terminal forms a session inside of uvtd. Sessions are scheduled
29  * by the seat/session-scheduler and notified whenever they get active/inactive.
30  */
31
32 #ifndef UVTD_VT_H
33 #define UVTD_VT_H
34
35 #include <inttypes.h>
36 #include <stdlib.h>
37 #include "uvt.h"
38
39 struct uvtd_vt;
40 extern struct uvt_vt_ops uvtd_vt_ops;
41
42 int uvtd_vt_new(struct uvtd_vt **out, struct uvt_ctx *uctx, unsigned int id,
43                 struct uvtd_seat *seat, bool is_legacy);
44 void uvtd_vt_ref(struct uvtd_vt *vt);
45 void uvtd_vt_unref(struct uvtd_vt *vt);
46
47 int uvtd_vt_register_cb(struct uvtd_vt *vt, uvt_vt_cb cb, void *data);
48 void uvtd_vt_unregister_cb(struct uvtd_vt *vt, uvt_vt_cb cb, void *data);
49
50 int uvtd_vt_read(struct uvtd_vt *vt, uint8_t *mem, size_t len);
51 int uvtd_vt_write(struct uvtd_vt *vt, const uint8_t *mem, size_t len);
52 unsigned int uvtd_vt_poll(struct uvtd_vt *vt);
53
54 #endif /* UVTD_VT_H */