]>
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 | |
8 | ||
9 | systemd is free software; you can redistribute it and/or modify it | |
10 | under the terms of the GNU Lesser General Public License as published by | |
11 | the Free Software Foundation; either version 2.1 of the License, or | |
12 | (at your option) any later version. | |
13 | ||
14 | systemd is distributed in the hope that it will be useful, but | |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 | Lesser General Public License for more details. | |
18 | ||
19 | You should have received a copy of the GNU Lesser General Public License | |
20 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
21 | ***/ | |
22 | ||
c1ff5570 | 23 | #include <stdbool.h> |
4ba93280 | 24 | |
023fb90b LP |
25 | #include "sd-event.h" |
26 | ||
a8fbdf54 TA |
27 | #include "macro.h" |
28 | ||
023fb90b LP |
29 | typedef struct PTYForward PTYForward; |
30 | ||
ae3dde80 LP |
31 | typedef enum PTYForwardFlags { |
32 | PTY_FORWARD_READ_ONLY = 1, | |
33 | ||
34 | /* Continue reading after hangup? */ | |
35 | PTY_FORWARD_IGNORE_VHANGUP = 2, | |
36 | ||
37 | /* Continue reading after hangup but only if we never read anything else? */ | |
38 | PTY_FORWARD_IGNORE_INITIAL_VHANGUP = 4, | |
39 | } PTYForwardFlags; | |
40 | ||
2a453c2e LP |
41 | typedef int (*PTYForwardHandler)(PTYForward *f, int rcode, void*userdata); |
42 | ||
ae3dde80 | 43 | int pty_forward_new(sd_event *event, int master, PTYForwardFlags flags, PTYForward **f); |
023fb90b LP |
44 | PTYForward *pty_forward_free(PTYForward *f); |
45 | ||
0ec5543c LP |
46 | int pty_forward_get_last_char(PTYForward *f, char *ch); |
47 | ||
da054c37 | 48 | int pty_forward_set_ignore_vhangup(PTYForward *f, bool ignore_vhangup); |
2a453c2e LP |
49 | bool pty_forward_get_ignore_vhangup(PTYForward *f); |
50 | ||
51 | bool pty_forward_is_done(PTYForward *f); | |
52 | ||
53 | void pty_forward_set_handler(PTYForward *f, PTYForwardHandler handler, void *userdata); | |
9b15b784 | 54 | |
95f1d6bf LP |
55 | bool pty_forward_drain(PTYForward *f); |
56 | ||
023fb90b | 57 | DEFINE_TRIVIAL_CLEANUP_FUNC(PTYForward*, pty_forward_free); |