]>
Commit | Line | Data |
---|---|---|
87ecb68b PB |
1 | #ifndef QEMU_CHAR_H |
2 | #define QEMU_CHAR_H | |
3 | ||
376253ec | 4 | #include "qemu-common.h" |
1de7afc9 | 5 | #include "qemu/option.h" |
1de7afc9 | 6 | #include "qemu/main-loop.h" |
0a73336d | 7 | #include "qemu/bitmap.h" |
777357d7 | 8 | #include "qom/object.h" |
376253ec | 9 | |
87ecb68b PB |
10 | /* character device */ |
11 | ||
8c260cb1 MAL |
12 | typedef enum { |
13 | CHR_EVENT_BREAK, /* serial break char */ | |
14 | CHR_EVENT_OPENED, /* new connection established */ | |
15 | CHR_EVENT_MUX_IN, /* mux-focus was set to this terminal */ | |
16 | CHR_EVENT_MUX_OUT, /* mux-focus will move on */ | |
17 | CHR_EVENT_CLOSED /* connection closed */ | |
18 | } QEMUChrEvent; | |
87ecb68b | 19 | |
f612143a | 20 | #define CHR_READ_BUF_LEN 4096 |
87ecb68b PB |
21 | |
22 | #define CHR_IOCTL_SERIAL_SET_PARAMS 1 | |
23 | typedef struct { | |
24 | int speed; | |
25 | int parity; | |
26 | int data_bits; | |
27 | int stop_bits; | |
28 | } QEMUSerialSetParams; | |
29 | ||
30 | #define CHR_IOCTL_SERIAL_SET_BREAK 2 | |
31 | ||
32 | #define CHR_IOCTL_PP_READ_DATA 3 | |
33 | #define CHR_IOCTL_PP_WRITE_DATA 4 | |
34 | #define CHR_IOCTL_PP_READ_CONTROL 5 | |
35 | #define CHR_IOCTL_PP_WRITE_CONTROL 6 | |
36 | #define CHR_IOCTL_PP_READ_STATUS 7 | |
37 | #define CHR_IOCTL_PP_EPP_READ_ADDR 8 | |
38 | #define CHR_IOCTL_PP_EPP_READ 9 | |
39 | #define CHR_IOCTL_PP_EPP_WRITE_ADDR 10 | |
40 | #define CHR_IOCTL_PP_EPP_WRITE 11 | |
563e3c6e | 41 | #define CHR_IOCTL_PP_DATA_DIR 12 |
87ecb68b | 42 | |
8a98ecad MA |
43 | struct ParallelIOArg { |
44 | void *buffer; | |
45 | int count; | |
46 | }; | |
47 | ||
f0664048 AJ |
48 | #define CHR_IOCTL_SERIAL_SET_TIOCM 13 |
49 | #define CHR_IOCTL_SERIAL_GET_TIOCM 14 | |
81174dae AL |
50 | |
51 | #define CHR_TIOCM_CTS 0x020 | |
52 | #define CHR_TIOCM_CAR 0x040 | |
53 | #define CHR_TIOCM_DSR 0x100 | |
54 | #define CHR_TIOCM_RI 0x080 | |
55 | #define CHR_TIOCM_DTR 0x002 | |
56 | #define CHR_TIOCM_RTS 0x004 | |
57 | ||
87ecb68b PB |
58 | typedef void IOEventHandler(void *opaque, int event); |
59 | ||
0a73336d DB |
60 | typedef enum { |
61 | /* Whether the chardev peer is able to close and | |
62 | * reopen the data channel, thus requiring support | |
63 | * for qemu_chr_wait_connected() to wait for a | |
64 | * valid connection */ | |
65 | QEMU_CHAR_FEATURE_RECONNECTABLE, | |
66 | /* Whether it is possible to send/recv file descriptors | |
67 | * over the data channel */ | |
68 | QEMU_CHAR_FEATURE_FD_PASS, | |
5ebd6703 MAL |
69 | /* Whether replay or record mode is enabled */ |
70 | QEMU_CHAR_FEATURE_REPLAY, | |
0a73336d DB |
71 | |
72 | QEMU_CHAR_FEATURE_LAST, | |
279b066e | 73 | } ChardevFeature; |
0a73336d | 74 | |
94a40fc5 | 75 | /* This is the backend as seen by frontend, the actual backend is |
0ec7b3e7 | 76 | * Chardev */ |
94a40fc5 | 77 | typedef struct CharBackend { |
0ec7b3e7 | 78 | Chardev *chr; |
a4afa548 MAL |
79 | IOEventHandler *chr_event; |
80 | IOCanReadHandler *chr_can_read; | |
81 | IOReadHandler *chr_read; | |
82 | void *opaque; | |
94a40fc5 | 83 | int tag; |
830896af | 84 | int fe_open; |
94a40fc5 | 85 | } CharBackend; |
0a73336d | 86 | |
0ec7b3e7 | 87 | struct Chardev { |
777357d7 MAL |
88 | Object parent_obj; |
89 | ||
9005b2a7 | 90 | QemuMutex chr_write_lock; |
a4afa548 | 91 | CharBackend *be; |
5ccfae10 AL |
92 | char *label; |
93 | char *filename; | |
d0d7708b | 94 | int logfd; |
16665b94 | 95 | int be_open; |
7ba9addc | 96 | guint fd_in_tag; |
0a73336d | 97 | DECLARE_BITMAP(features, QEMU_CHAR_FEATURE_LAST); |
0ec7b3e7 | 98 | QTAILQ_ENTRY(Chardev) next; |
87ecb68b PB |
99 | }; |
100 | ||
2011fe56 AL |
101 | /** |
102 | * @qemu_chr_new_from_opts: | |
103 | * | |
104 | * Create a new character backend from a QemuOpts list. | |
105 | * | |
106 | * @opts see qemu-config.c for a list of valid options | |
2011fe56 AL |
107 | * |
108 | * Returns: a new character backend | |
109 | */ | |
0ec7b3e7 MAL |
110 | Chardev *qemu_chr_new_from_opts(QemuOpts *opts, |
111 | Error **errp); | |
2011fe56 | 112 | |
21a933ea EB |
113 | /** |
114 | * @qemu_chr_parse_common: | |
115 | * | |
116 | * Parse the common options available to all character backends. | |
117 | * | |
118 | * @opts the options that still need parsing | |
119 | * @backend a new backend | |
120 | */ | |
121 | void qemu_chr_parse_common(QemuOpts *opts, ChardevCommon *backend); | |
122 | ||
2011fe56 AL |
123 | /** |
124 | * @qemu_chr_new: | |
125 | * | |
126 | * Create a new character backend from a URI. | |
127 | * | |
128 | * @label the name of the backend | |
129 | * @filename the URI | |
2011fe56 AL |
130 | * |
131 | * Returns: a new character backend | |
132 | */ | |
0ec7b3e7 | 133 | Chardev *qemu_chr_new(const char *label, const char *filename); |
94a40fc5 MAL |
134 | |
135 | ||
7d9d17f7 | 136 | /** |
7fa47e2a | 137 | * @qemu_chr_fe_disconnect: |
7d9d17f7 TM |
138 | * |
139 | * Close a fd accpeted by character backend. | |
279b066e | 140 | * Without associated Chardev, do nothing. |
7d9d17f7 | 141 | */ |
5345fdb4 | 142 | void qemu_chr_fe_disconnect(CharBackend *be); |
2011fe56 | 143 | |
aa5cb7f5 MAL |
144 | /** |
145 | * @qemu_chr_cleanup: | |
146 | * | |
147 | * Delete all chardevs (when leaving qemu) | |
148 | */ | |
149 | void qemu_chr_cleanup(void); | |
150 | ||
6b6723c3 | 151 | /** |
5345fdb4 | 152 | * @qemu_chr_fe_wait_connected: |
6b6723c3 | 153 | * |
fa394ed6 | 154 | * Wait for characted backend to be connected, return < 0 on error or |
279b066e | 155 | * if no assicated Chardev. |
6b6723c3 | 156 | */ |
5345fdb4 | 157 | int qemu_chr_fe_wait_connected(CharBackend *be, Error **errp); |
6b6723c3 | 158 | |
33577b47 PD |
159 | /** |
160 | * @qemu_chr_new_noreplay: | |
161 | * | |
162 | * Create a new character backend from a URI. | |
163 | * Character device communications are not written | |
164 | * into the replay log. | |
165 | * | |
166 | * @label the name of the backend | |
167 | * @filename the URI | |
33577b47 PD |
168 | * |
169 | * Returns: a new character backend | |
170 | */ | |
0ec7b3e7 | 171 | Chardev *qemu_chr_new_noreplay(const char *label, const char *filename); |
33577b47 | 172 | |
2011fe56 AL |
173 | /** |
174 | * @qemu_chr_delete: | |
175 | * | |
1ad78ea5 MAL |
176 | * Destroy a character backend and remove it from the list of |
177 | * identified character backends. | |
2011fe56 | 178 | */ |
0ec7b3e7 | 179 | void qemu_chr_delete(Chardev *chr); |
2011fe56 AL |
180 | |
181 | /** | |
182 | * @qemu_chr_fe_set_echo: | |
183 | * | |
184 | * Ask the backend to override its normal echo setting. This only really | |
185 | * applies to the stdio backend and is used by the QMP server such that you | |
186 | * can see what you type if you try to type QMP commands. | |
279b066e | 187 | * Without associated Chardev, do nothing. |
2011fe56 AL |
188 | * |
189 | * @echo true to enable echo, false to disable echo | |
190 | */ | |
5345fdb4 | 191 | void qemu_chr_fe_set_echo(CharBackend *be, bool echo); |
2011fe56 AL |
192 | |
193 | /** | |
8e25daa8 | 194 | * @qemu_chr_fe_set_open: |
2011fe56 | 195 | * |
8e25daa8 HG |
196 | * Set character frontend open status. This is an indication that the |
197 | * front end is ready (or not) to begin doing I/O. | |
279b066e | 198 | * Without associated Chardev, do nothing. |
2011fe56 | 199 | */ |
5345fdb4 | 200 | void qemu_chr_fe_set_open(CharBackend *be, int fe_open); |
2011fe56 AL |
201 | |
202 | /** | |
203 | * @qemu_chr_fe_printf: | |
204 | * | |
fa394ed6 MAL |
205 | * Write to a character backend using a printf style interface. This |
206 | * function is thread-safe. It does nothing without associated | |
279b066e | 207 | * Chardev. |
2011fe56 AL |
208 | * |
209 | * @fmt see #printf | |
210 | */ | |
5345fdb4 | 211 | void qemu_chr_fe_printf(CharBackend *be, const char *fmt, ...) |
8b7968f7 | 212 | GCC_FMT_ATTR(2, 3); |
2011fe56 | 213 | |
6f1de6b7 PB |
214 | /** |
215 | * @qemu_chr_fe_add_watch: | |
216 | * | |
217 | * If the backend is connected, create and add a #GSource that fires | |
218 | * when the given condition (typically G_IO_OUT|G_IO_HUP or G_IO_HUP) | |
219 | * is active; return the #GSource's tag. If it is disconnected, | |
279b066e | 220 | * or without associated Chardev, return 0. |
6f1de6b7 PB |
221 | * |
222 | * @cond the condition to poll for | |
223 | * @func the function to call when the condition happens | |
224 | * @user_data the opaque pointer to pass to @func | |
943b4684 MAL |
225 | * |
226 | * Returns: the source tag | |
6f1de6b7 | 227 | */ |
5345fdb4 | 228 | guint qemu_chr_fe_add_watch(CharBackend *be, GIOCondition cond, |
6f1de6b7 | 229 | GIOFunc func, void *user_data); |
23673ca7 | 230 | |
2011fe56 AL |
231 | /** |
232 | * @qemu_chr_fe_write: | |
233 | * | |
9005b2a7 PB |
234 | * Write data to a character backend from the front end. This function |
235 | * will send data from the front end to the back end. This function | |
236 | * is thread-safe. | |
2011fe56 AL |
237 | * |
238 | * @buf the data | |
239 | * @len the number of bytes to send | |
240 | * | |
279b066e | 241 | * Returns: the number of bytes consumed (0 if no assicated Chardev) |
2011fe56 | 242 | */ |
5345fdb4 | 243 | int qemu_chr_fe_write(CharBackend *be, const uint8_t *buf, int len); |
2011fe56 | 244 | |
cd18720a AL |
245 | /** |
246 | * @qemu_chr_fe_write_all: | |
247 | * | |
248 | * Write data to a character backend from the front end. This function will | |
249 | * send data from the front end to the back end. Unlike @qemu_chr_fe_write, | |
250 | * this function will block if the back end cannot consume all of the data | |
9005b2a7 | 251 | * attempted to be written. This function is thread-safe. |
cd18720a AL |
252 | * |
253 | * @buf the data | |
254 | * @len the number of bytes to send | |
255 | * | |
279b066e | 256 | * Returns: the number of bytes consumed (0 if no assicated Chardev) |
cd18720a | 257 | */ |
5345fdb4 | 258 | int qemu_chr_fe_write_all(CharBackend *be, const uint8_t *buf, int len); |
cd18720a | 259 | |
7b0bfdf5 NN |
260 | /** |
261 | * @qemu_chr_fe_read_all: | |
262 | * | |
263 | * Read data to a buffer from the back end. | |
264 | * | |
265 | * @buf the data buffer | |
266 | * @len the number of bytes to read | |
267 | * | |
279b066e | 268 | * Returns: the number of bytes read (0 if no assicated Chardev) |
7b0bfdf5 | 269 | */ |
5345fdb4 | 270 | int qemu_chr_fe_read_all(CharBackend *be, uint8_t *buf, int len); |
7b0bfdf5 | 271 | |
2011fe56 AL |
272 | /** |
273 | * @qemu_chr_fe_ioctl: | |
274 | * | |
9005b2a7 | 275 | * Issue a device specific ioctl to a backend. This function is thread-safe. |
2011fe56 AL |
276 | * |
277 | * @cmd see CHR_IOCTL_* | |
278 | * @arg the data associated with @cmd | |
279 | * | |
fa394ed6 | 280 | * Returns: if @cmd is not supported by the backend or there is no |
279b066e | 281 | * associated Chardev, -ENOTSUP, otherwise the return |
fa394ed6 | 282 | * value depends on the semantics of @cmd |
2011fe56 | 283 | */ |
5345fdb4 | 284 | int qemu_chr_fe_ioctl(CharBackend *be, int cmd, void *arg); |
2011fe56 AL |
285 | |
286 | /** | |
287 | * @qemu_chr_fe_get_msgfd: | |
288 | * | |
289 | * For backends capable of fd passing, return the latest file descriptor passed | |
290 | * by a client. | |
291 | * | |
292 | * Returns: -1 if fd passing isn't supported or there is no pending file | |
293 | * descriptor. If a file descriptor is returned, subsequent calls to | |
294 | * this function will return -1 until a client sends a new file | |
295 | * descriptor. | |
296 | */ | |
5345fdb4 | 297 | int qemu_chr_fe_get_msgfd(CharBackend *be); |
2011fe56 | 298 | |
c76bf6bb NN |
299 | /** |
300 | * @qemu_chr_fe_get_msgfds: | |
301 | * | |
302 | * For backends capable of fd passing, return the number of file received | |
303 | * descriptors and fills the fds array up to num elements | |
304 | * | |
305 | * Returns: -1 if fd passing isn't supported or there are no pending file | |
306 | * descriptors. If file descriptors are returned, subsequent calls to | |
307 | * this function will return -1 until a client sends a new set of file | |
308 | * descriptors. | |
309 | */ | |
5345fdb4 | 310 | int qemu_chr_fe_get_msgfds(CharBackend *be, int *fds, int num); |
c76bf6bb | 311 | |
d39aac7a NN |
312 | /** |
313 | * @qemu_chr_fe_set_msgfds: | |
314 | * | |
315 | * For backends capable of fd passing, set an array of fds to be passed with | |
316 | * the next send operation. | |
317 | * A subsequent call to this function before calling a write function will | |
318 | * result in overwriting the fd array with the new value without being send. | |
319 | * Upon writing the message the fd array is freed. | |
320 | * | |
279b066e | 321 | * Returns: -1 if fd passing isn't supported or no associated Chardev. |
d39aac7a | 322 | */ |
5345fdb4 | 323 | int qemu_chr_fe_set_msgfds(CharBackend *be, int *fds, int num); |
d39aac7a | 324 | |
2011fe56 AL |
325 | /** |
326 | * @qemu_chr_be_can_write: | |
327 | * | |
328 | * Determine how much data the front end can currently accept. This function | |
329 | * returns the number of bytes the front end can accept. If it returns 0, the | |
330 | * front end cannot receive data at the moment. The function must be polled | |
331 | * to determine when data can be received. | |
332 | * | |
333 | * Returns: the number of bytes the front end can receive via @qemu_chr_be_write | |
334 | */ | |
0ec7b3e7 | 335 | int qemu_chr_be_can_write(Chardev *s); |
2011fe56 AL |
336 | |
337 | /** | |
338 | * @qemu_chr_be_write: | |
339 | * | |
340 | * Write data from the back end to the front end. Before issuing this call, | |
341 | * the caller should call @qemu_chr_be_can_write to determine how much data | |
342 | * the front end can currently accept. | |
343 | * | |
344 | * @buf a buffer to receive data from the front end | |
345 | * @len the number of bytes to receive from the front end | |
346 | */ | |
0ec7b3e7 | 347 | void qemu_chr_be_write(Chardev *s, uint8_t *buf, int len); |
2011fe56 | 348 | |
33577b47 PD |
349 | /** |
350 | * @qemu_chr_be_write_impl: | |
351 | * | |
352 | * Implementation of back end writing. Used by replay module. | |
353 | * | |
354 | * @buf a buffer to receive data from the front end | |
355 | * @len the number of bytes to receive from the front end | |
356 | */ | |
0ec7b3e7 | 357 | void qemu_chr_be_write_impl(Chardev *s, uint8_t *buf, int len); |
a425d23f HG |
358 | |
359 | /** | |
360 | * @qemu_chr_be_event: | |
361 | * | |
362 | * Send an event from the back end to the front end. | |
363 | * | |
364 | * @event the event to send | |
365 | */ | |
0ec7b3e7 | 366 | void qemu_chr_be_event(Chardev *s, int event); |
a425d23f | 367 | |
94a40fc5 MAL |
368 | /** |
369 | * @qemu_chr_fe_init: | |
370 | * | |
5345fdb4 | 371 | * Initializes a front end for the given CharBackend and |
279b066e | 372 | * Chardev. Call qemu_chr_fe_deinit() to remove the association and |
c39860e6 | 373 | * release the driver. |
94a40fc5 MAL |
374 | * |
375 | * Returns: false on error. | |
376 | */ | |
0ec7b3e7 | 377 | bool qemu_chr_fe_init(CharBackend *b, Chardev *s, Error **errp); |
94a40fc5 MAL |
378 | |
379 | /** | |
380 | * @qemu_chr_fe_get_driver: | |
381 | * | |
fa394ed6 | 382 | * Returns the driver associated with a CharBackend or NULL if no |
279b066e | 383 | * associated Chardev. |
94a40fc5 | 384 | */ |
0ec7b3e7 | 385 | Chardev *qemu_chr_fe_get_driver(CharBackend *be); |
94a40fc5 | 386 | |
c39860e6 MAL |
387 | /** |
388 | * @qemu_chr_fe_deinit: | |
389 | * | |
279b066e | 390 | * Dissociate the CharBackend from the Chardev. |
fa394ed6 | 391 | * |
279b066e | 392 | * Safe to call without associated Chardev. |
c39860e6 MAL |
393 | */ |
394 | void qemu_chr_fe_deinit(CharBackend *b); | |
395 | ||
94a40fc5 MAL |
396 | /** |
397 | * @qemu_chr_fe_set_handlers: | |
398 | * @b: a CharBackend | |
399 | * @fd_can_read: callback to get the amount of data the frontend may | |
400 | * receive | |
401 | * @fd_read: callback to receive data from char | |
402 | * @fd_event: event callback | |
403 | * @opaque: an opaque pointer for the callbacks | |
404 | * @context: a main loop context or NULL for the default | |
39ab61c6 MAL |
405 | * @set_open: whether to call qemu_chr_fe_set_open() implicitely when |
406 | * any of the handler is non-NULL | |
94a40fc5 | 407 | * |
386f07d1 MAL |
408 | * Set the front end char handlers. The front end takes the focus if |
409 | * any of the handler is non-NULL. | |
fa394ed6 | 410 | * |
279b066e | 411 | * Without associated Chardev, nothing is changed. |
94a40fc5 MAL |
412 | */ |
413 | void qemu_chr_fe_set_handlers(CharBackend *b, | |
414 | IOCanReadHandler *fd_can_read, | |
415 | IOReadHandler *fd_read, | |
416 | IOEventHandler *fd_event, | |
417 | void *opaque, | |
39ab61c6 MAL |
418 | GMainContext *context, |
419 | bool set_open); | |
94a40fc5 MAL |
420 | |
421 | /** | |
422 | * @qemu_chr_fe_take_focus: | |
423 | * | |
fa394ed6 MAL |
424 | * Take the focus (if the front end is muxed). |
425 | * | |
279b066e | 426 | * Without associated Chardev, nothing is changed. |
94a40fc5 MAL |
427 | */ |
428 | void qemu_chr_fe_take_focus(CharBackend *b); | |
429 | ||
0ec7b3e7 | 430 | void qemu_chr_be_generic_open(Chardev *s); |
5345fdb4 | 431 | void qemu_chr_fe_accept_input(CharBackend *be); |
0ec7b3e7 MAL |
432 | int qemu_chr_add_client(Chardev *s, int fd); |
433 | Chardev *qemu_chr_find(const char *name); | |
ad5c679c | 434 | |
0ec7b3e7 | 435 | bool qemu_chr_has_feature(Chardev *chr, |
279b066e | 436 | ChardevFeature feature); |
0ec7b3e7 | 437 | void qemu_chr_set_feature(Chardev *chr, |
279b066e | 438 | ChardevFeature feature); |
2011fe56 | 439 | QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename); |
df85a78b | 440 | int qemu_chr_write_all(Chardev *s, const uint8_t *buf, int len); |
d24ca4b8 | 441 | int qemu_chr_wait_connected(Chardev *chr, Error **errp); |
2011fe56 | 442 | |
777357d7 MAL |
443 | #define TYPE_CHARDEV "chardev" |
444 | #define CHARDEV(obj) OBJECT_CHECK(Chardev, (obj), TYPE_CHARDEV) | |
445 | #define CHARDEV_CLASS(klass) \ | |
446 | OBJECT_CLASS_CHECK(ChardevClass, (klass), TYPE_CHARDEV) | |
447 | #define CHARDEV_GET_CLASS(obj) \ | |
448 | OBJECT_GET_CLASS(ChardevClass, (obj), TYPE_CHARDEV) | |
449 | ||
450 | #define TYPE_CHARDEV_NULL "chardev-null" | |
451 | #define TYPE_CHARDEV_MUX "chardev-mux" | |
452 | #define TYPE_CHARDEV_RINGBUF "chardev-ringbuf" | |
453 | #define TYPE_CHARDEV_PTY "chardev-pty" | |
454 | #define TYPE_CHARDEV_CONSOLE "chardev-console" | |
455 | #define TYPE_CHARDEV_STDIO "chardev-stdio" | |
456 | #define TYPE_CHARDEV_PIPE "chardev-pipe" | |
457 | #define TYPE_CHARDEV_MEMORY "chardev-memory" | |
458 | #define TYPE_CHARDEV_PARALLEL "chardev-parallel" | |
459 | #define TYPE_CHARDEV_FILE "chardev-file" | |
460 | #define TYPE_CHARDEV_SERIAL "chardev-serial" | |
461 | #define TYPE_CHARDEV_SOCKET "chardev-socket" | |
462 | #define TYPE_CHARDEV_UDP "chardev-udp" | |
463 | ||
777357d7 MAL |
464 | #define CHARDEV_IS_RINGBUF(chr) \ |
465 | object_dynamic_cast(OBJECT(chr), TYPE_CHARDEV_RINGBUF) | |
466 | #define CHARDEV_IS_PTY(chr) \ | |
467 | object_dynamic_cast(OBJECT(chr), TYPE_CHARDEV_PTY) | |
468 | ||
469 | typedef struct ChardevClass { | |
470 | ObjectClass parent_class; | |
471 | ||
472 | bool internal; /* TODO: eventually use TYPE_USER_CREATABLE */ | |
88cace9f | 473 | void (*parse)(QemuOpts *opts, ChardevBackend *backend, Error **errp); |
777357d7 MAL |
474 | |
475 | void (*open)(Chardev *chr, ChardevBackend *backend, | |
476 | bool *be_opened, Error **errp); | |
477 | ||
478 | int (*chr_write)(Chardev *s, const uint8_t *buf, int len); | |
479 | int (*chr_sync_read)(Chardev *s, const uint8_t *buf, int len); | |
480 | GSource *(*chr_add_watch)(Chardev *s, GIOCondition cond); | |
481 | void (*chr_update_read_handler)(Chardev *s, GMainContext *context); | |
482 | int (*chr_ioctl)(Chardev *s, int cmd, void *arg); | |
483 | int (*get_msgfds)(Chardev *s, int* fds, int num); | |
484 | int (*set_msgfds)(Chardev *s, int *fds, int num); | |
485 | int (*chr_add_client)(Chardev *chr, int fd); | |
486 | int (*chr_wait_connected)(Chardev *chr, Error **errp); | |
777357d7 MAL |
487 | void (*chr_disconnect)(Chardev *chr); |
488 | void (*chr_accept_input)(Chardev *chr); | |
489 | void (*chr_set_echo)(Chardev *chr, bool echo); | |
490 | void (*chr_set_fe_open)(Chardev *chr, int fe_open); | |
491 | } ChardevClass; | |
492 | ||
777357d7 MAL |
493 | Chardev *qemu_chardev_new(const char *id, const char *typename, |
494 | ChardevBackend *backend, Error **errp); | |
495 | ||
0e82f34d AL |
496 | extern int term_escape_char; |
497 | ||
3840f842 | 498 | /* console.c */ |
6f974c84 | 499 | void qemu_chr_parse_vc(QemuOpts *opts, ChardevBackend *backend, Error **errp); |
fa19d025 | 500 | |
87ecb68b | 501 | #endif |