ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libptytty/src/libptytty.h
Revision: 1.16
Committed: Wed Jun 16 05:08:48 2021 UTC (2 years, 11 months ago) by sf-exg
Content type: text/plain
Branch: MAIN
Changes since 1.15: +2 -1 lines
Log Message:
Fix style

File Contents

# Content
1 #ifndef LIBPTYTTY_H_ /* public libptytty header file */
2 #define LIBPTYTTY_H_
3
4 #ifdef __cplusplus
5
6 // C++ API
7
8 struct ptytty
9 {
10 int pty; // pty file descriptor; connected to terminal emulator
11 int tty; // tty file descriptor; connected to child
12
13 virtual ~ptytty ()
14 {
15 }
16
17 virtual bool get () = 0;
18 virtual void login (int cmd_pid, bool login_shell, const char *hostname) = 0;
19
20 void close_tty ();
21 bool make_controlling_tty ();
22 void set_utf8_mode (bool on);
23
24 static void sanitise_stdfd ();
25 static void init ();
26 static ptytty *create (); // create a new pty object
27
28 static void drop_privileges ();
29 static void use_helper ();
30
31 static bool send_fd (int socket, int fd);
32 static int recv_fd (int socket);
33
34 protected:
35
36 ptytty ()
37 : pty(-1), tty(-1)
38 {
39 }
40 };
41
42 #else
43
44 // C API
45
46 typedef void *PTYTTY;
47
48 int ptytty_pty (PTYTTY ptytty);
49 int ptytty_tty (PTYTTY ptytty);
50 void ptytty_delete (PTYTTY ptytty);
51 int ptytty_get (PTYTTY ptytty);
52 void ptytty_login (PTYTTY ptytty, int cmd_pid, int login_shell, const char *hostname);
53
54 void ptytty_close_tty (PTYTTY ptytty);
55 int ptytty_make_controlling_tty (PTYTTY ptytty);
56 void ptytty_set_utf8_mode (PTYTTY ptytty, int on);
57
58 void ptytty_sanitise_stdfd ();
59 void ptytty_init ();
60 PTYTTY ptytty_create ();
61
62 void ptytty_drop_privileges ();
63 void ptytty_use_helper ();
64
65 #endif
66
67 #endif
68