Debian Codegraph @

lib/kpty.h

raw symbols SCIP
1 /* This file is part of the KDE libraries
2
3 Copyright (C) 2003,2007 Oswald Buddenhagen <[email protected]>
4
5 Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
16
17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA.
21 */
22
23 #ifndef kpty_h
24 #define kpty_hcxx . . $ `lib/kpty.h:24:9`!
25
26 #include <QObject>
27
28 class KPtyPrivatecxx . . $ KPtyPrivate#;
29 struct termioscxx . . $ termios#;
30
31 /**
32 * Provides primitives for opening & closing a pseudo TTY pair, assigning the
33 * controlling TTY, utmp registration and setting various terminal attributes.
34 */
35 class KPtycxx . . $ KPty# {
36 Q_DECLARE_PRIVATEcxx . . $ `<external>/15045578679651060896/qglobal.h:1158:9`!(KPty)
37
38 public:
39
40 /**
41 * Constructor
42 */
43 KPtycxx . . $ KPty#KPty(49f6e7a06ebc5aa8).();
44
45 /**
46 * Destructor:
47 *
48 * If the pty is still open, it will be closed. Note, however, that
49 * an utmp registration is @em not undone.
50 */
51 ~cxx . . $ KPty#`~KPty`(ced63f7c635d850d).KPtycxx . . $ KPty#();
52
53 KPtycxx . . $ KPty#KPty(433e734e5ce01c0f).(const KPtycxx . . $ KPty# &) = delete;
54 KPtycxx . . $ KPty# &operatorcxx . . $ KPty#`operator=`(51057a26a916b5b).=(const KPtycxx . . $ KPty# &) = delete;
55
56 /**
57 * Create a pty master/slave pair.
58 *
59 * @return true if a pty pair was successfully opened
60 */
61 bool opencxx . . $ KPty#open(c9857a73d68e59ba).();
62
63 bool opencxx . . $ KPty#open(83c267b20bac841a).(int fd);
64
65 /**
66 * Close the pty master/slave pair.
67 */
68 void closecxx . . $ KPty#close(49f6e7a06ebc5aa8).();
69
70 /**
71 * Close the pty slave descriptor.
72 *
73 * When creating the pty, KPty also opens the slave and keeps it open.
74 * Consequently the master will never receive an EOF notification.
75 * Usually this is the desired behavior, as a closed pty slave can be
76 * reopened any time - unlike a pipe or socket. However, in some cases
77 * pipe-alike behavior might be desired.
78 *
79 * After this function was called, slaveFd() and setCTty() cannot be
80 * used.
81 */
82 void closeSlavecxx . . $ KPty#closeSlave(49f6e7a06ebc5aa8).();
83 bool openSlavecxx . . $ KPty#openSlave(c9857a73d68e59ba).();
84
85 /**
86 * Creates a new session and process group and makes this pty the
87 * controlling tty.
88 */
89 void setCTtycxx . . $ KPty#setCTty(49f6e7a06ebc5aa8).();
90
91 /**
92 * Creates an utmp entry for the tty.
93 * This function must be called after calling setCTty and
94 * making this pty the stdin.
95 * @param user the user to be logged on
96 * @param remotehost the host from which the login is coming. This is
97 * @em not the local host. For remote logins it should be the hostname
98 * of the client. For local logins from inside an X session it should
99 * be the name of the X display. Otherwise it should be empty.
100 */
101 void logincxx . . $ KPty#login(2fa786934fe80e24).(const char * user = nullptr, const char * remotehost = nullptr);
102
103 /**
104 * Removes the utmp entry for this tty.
105 */
106 void logoutcxx . . $ KPty#logout(49f6e7a06ebc5aa8).();
107
108 /**
109 * Wrapper around tcgetattr(3).
110 *
111 * This function can be used only while the PTY is open.
112 * You will need an #include &lt;termios.h&gt; to do anything useful
113 * with it.
114 *
115 * @param ttmode a pointer to a termios structure.
116 * Note: when declaring ttmode, @c struct @c ::termios must be used -
117 * without the '::' some version of HP-UX thinks, this declares
118 * the struct in your class, in your method.
119 * @return @c true on success, false otherwise
120 */
121 bool tcGetAttrcxx . . $ KPty#tcGetAttr(5fad475f32619bec).(struct ::termioscxx . . $ termios# * ttmode) const;
122
123 /**
124 * Wrapper around tcsetattr(3) with mode TCSANOW.
125 *
126 * This function can be used only while the PTY is open.
127 *
128 * @param ttmode a pointer to a termios structure.
129 * @return @c true on success, false otherwise. Note that success means
130 * that @em at @em least @em one attribute could be set.
131 */
132 bool tcSetAttrcxx . . $ KPty#tcSetAttr(98b4f1f88d9dab40).(struct ::termioscxx . . $ termios# * ttmode);
133
134 /**
135 * Change the logical (screen) size of the pty.
136 * The default is 24 lines by 80 columns.
137 *
138 * This function can be used only while the PTY is open.
139 *
140 * @param lines the number of rows
141 * @param columns the number of columns
142 * @return @c true on success, false otherwise
143 */
144 bool setWinSizecxx . . $ KPty#setWinSize(cf9ef193275fa6d8).(int lines, int columns);
145
146 /**
147 * Set whether the pty should echo input.
148 *
149 * Echo is on by default.
150 * If the output of automatically fed (non-interactive) PTY clients
151 * needs to be parsed, disabling echo often makes it much simpler.
152 *
153 * This function can be used only while the PTY is open.
154 *
155 * @param echo true if input should be echoed.
156 * @return @c true on success, false otherwise
157 */
158 bool setEchocxx . . $ KPty#setEcho(efaadfb7dc14930a).(bool echo);
159
160 /**
161 * @return the name of the slave pty device.
162 *
163 * This function should be called only while the pty is open.
164 */
165 const char * ttyNamecxx . . $ KPty#ttyName(a9f41ea0e82d88cf).() const;
166
167 /**
168 * @return the file descriptor of the master pty
169 *
170 * This function should be called only while the pty is open.
171 */
172 int masterFdcxx . . $ KPty#masterFd(455f465bc33b4cdf).() const;
173
174 /**
175 * @return the file descriptor of the slave pty
176 *
177 * This function should be called only while the pty slave is open.
178 */
179 int slaveFdcxx . . $ KPty#slaveFd(455f465bc33b4cdf).() const;
180
181 protected:
182 /**
183 * @internal
184 */
185 KPtycxx . . $ KPty#KPty(a32c7870752f5a60).(KPtyPrivatecxx . . $ KPtyPrivate# * d);
186
187 /**
188 * @internal
189 */
190 KPtyPrivatecxx . . $ KPtyPrivate# * const d_ptrcxx . . $ KPty#d_ptr.;
191 };
192
193 #endif
194