]>
Commit | Line | Data |
---|---|---|
53e1b683 | 1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
4ba93280 LP |
2 | #pragma once |
3 | ||
4 | /*** | |
5 | This file is part of systemd. | |
6 | ||
7 | Copyright 2010-2013 Lennart Poettering | |
4ba93280 LP |
8 | ***/ |
9 | ||
c1ff5570 | 10 | #include <stdbool.h> |
4ba93280 | 11 | |
023fb90b LP |
12 | #include "sd-event.h" |
13 | ||
a8fbdf54 TA |
14 | #include "macro.h" |
15 | ||
023fb90b LP |
16 | typedef struct PTYForward PTYForward; |
17 | ||
ae3dde80 LP |
18 | typedef enum PTYForwardFlags { |
19 | PTY_FORWARD_READ_ONLY = 1, | |
20 | ||
21 | /* Continue reading after hangup? */ | |
22 | PTY_FORWARD_IGNORE_VHANGUP = 2, | |
23 | ||
24 | /* Continue reading after hangup but only if we never read anything else? */ | |
25 | PTY_FORWARD_IGNORE_INITIAL_VHANGUP = 4, | |
26 | } PTYForwardFlags; | |
27 | ||
2a453c2e LP |
28 | typedef int (*PTYForwardHandler)(PTYForward *f, int rcode, void*userdata); |
29 | ||
ae3dde80 | 30 | int pty_forward_new(sd_event *event, int master, PTYForwardFlags flags, PTYForward **f); |
023fb90b LP |
31 | PTYForward *pty_forward_free(PTYForward *f); |
32 | ||
0ec5543c LP |
33 | int pty_forward_get_last_char(PTYForward *f, char *ch); |
34 | ||
da054c37 | 35 | int pty_forward_set_ignore_vhangup(PTYForward *f, bool ignore_vhangup); |
2a453c2e LP |
36 | bool pty_forward_get_ignore_vhangup(PTYForward *f); |
37 | ||
38 | bool pty_forward_is_done(PTYForward *f); | |
39 | ||
40 | void pty_forward_set_handler(PTYForward *f, PTYForwardHandler handler, void *userdata); | |
9b15b784 | 41 | |
95f1d6bf LP |
42 | bool pty_forward_drain(PTYForward *f); |
43 | ||
d147457c LP |
44 | int pty_forward_set_priority(PTYForward *f, int64_t priority); |
45 | ||
023fb90b | 46 | DEFINE_TRIVIAL_CLEANUP_FUNC(PTYForward*, pty_forward_free); |