]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/shared/ptyfwd.h
Merge pull request #11827 from keszybz/pkgconfig-variables
[thirdparty/systemd.git] / src / shared / ptyfwd.h
CommitLineData
53e1b683 1/* SPDX-License-Identifier: LGPL-2.1+ */
4ba93280
LP
2#pragma once
3
c1ff5570 4#include <stdbool.h>
4ba93280 5
023fb90b
LP
6#include "sd-event.h"
7
a8fbdf54
TA
8#include "macro.h"
9
023fb90b
LP
10typedef struct PTYForward PTYForward;
11
ae3dde80
LP
12typedef enum PTYForwardFlags {
13 PTY_FORWARD_READ_ONLY = 1,
14
15 /* Continue reading after hangup? */
16 PTY_FORWARD_IGNORE_VHANGUP = 2,
17
18 /* Continue reading after hangup but only if we never read anything else? */
19 PTY_FORWARD_IGNORE_INITIAL_VHANGUP = 4,
20} PTYForwardFlags;
21
f2a3de01 22typedef int (*PTYForwardHandler)(PTYForward *f, int rcode, void *userdata);
2a453c2e 23
ae3dde80 24int pty_forward_new(sd_event *event, int master, PTYForwardFlags flags, PTYForward **f);
023fb90b
LP
25PTYForward *pty_forward_free(PTYForward *f);
26
0ec5543c
LP
27int pty_forward_get_last_char(PTYForward *f, char *ch);
28
da054c37 29int pty_forward_set_ignore_vhangup(PTYForward *f, bool ignore_vhangup);
2a453c2e
LP
30bool pty_forward_get_ignore_vhangup(PTYForward *f);
31
32bool pty_forward_is_done(PTYForward *f);
33
34void pty_forward_set_handler(PTYForward *f, PTYForwardHandler handler, void *userdata);
9b15b784 35
95f1d6bf
LP
36bool pty_forward_drain(PTYForward *f);
37
d147457c
LP
38int pty_forward_set_priority(PTYForward *f, int64_t priority);
39
d435a182
LP
40int pty_forward_set_width_height(PTYForward *f, unsigned width, unsigned height);
41
023fb90b 42DEFINE_TRIVIAL_CLEANUP_FUNC(PTYForward*, pty_forward_free);