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