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

File Contents

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