xref: /qemu/tests/qtest/libqtest.h (revision ca5d464151c72695a960d0f493f2fe7c083e468f)
149ee3590SAnthony Liguori /*
249ee3590SAnthony Liguori  * QTest
349ee3590SAnthony Liguori  *
449ee3590SAnthony Liguori  * Copyright IBM, Corp. 2012
549ee3590SAnthony Liguori  * Copyright Red Hat, Inc. 2012
6872536bfSAndreas Färber  * Copyright SUSE LINUX Products GmbH 2013
749ee3590SAnthony Liguori  *
849ee3590SAnthony Liguori  * Authors:
949ee3590SAnthony Liguori  *  Anthony Liguori   <aliguori@us.ibm.com>
1049ee3590SAnthony Liguori  *  Paolo Bonzini     <pbonzini@redhat.com>
11872536bfSAndreas Färber  *  Andreas Färber    <afaerber@suse.de>
1249ee3590SAnthony Liguori  *
1349ee3590SAnthony Liguori  * This work is licensed under the terms of the GNU GPL, version 2 or later.
1449ee3590SAnthony Liguori  * See the COPYING file in the top-level directory.
1549ee3590SAnthony Liguori  *
1649ee3590SAnthony Liguori  */
1749ee3590SAnthony Liguori #ifndef LIBQTEST_H
1849ee3590SAnthony Liguori #define LIBQTEST_H
1949ee3590SAnthony Liguori 
205cb8f0dbSPaolo Bonzini #include "qapi/qmp/qobject.h"
215cb8f0dbSPaolo Bonzini #include "qapi/qmp/qdict.h"
225cb8f0dbSPaolo Bonzini 
2349ee3590SAnthony Liguori typedef struct QTestState QTestState;
2449ee3590SAnthony Liguori 
2549ee3590SAnthony Liguori /**
2688b988c8SMarkus Armbruster  * qtest_initf:
2778b27badSEric Blake  * @fmt...: Format for creating other arguments to pass to QEMU, formatted
2878b27badSEric Blake  * like sprintf().
2978b27badSEric Blake  *
3000825d96SThomas Huth  * Convenience wrapper around qtest_init().
3178b27badSEric Blake  *
3278b27badSEric Blake  * Returns: #QTestState instance.
3378b27badSEric Blake  */
3488b988c8SMarkus Armbruster QTestState *qtest_initf(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
3578b27badSEric Blake 
3678b27badSEric Blake /**
3788b988c8SMarkus Armbruster  * qtest_vinitf:
3878b27badSEric Blake  * @fmt: Format for creating other arguments to pass to QEMU, formatted
3978b27badSEric Blake  * like vsprintf().
4078b27badSEric Blake  * @ap: Format arguments.
4178b27badSEric Blake  *
4200825d96SThomas Huth  * Convenience wrapper around qtest_init().
4378b27badSEric Blake  *
4478b27badSEric Blake  * Returns: #QTestState instance.
4578b27badSEric Blake  */
4688b988c8SMarkus Armbruster QTestState *qtest_vinitf(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0);
4778b27badSEric Blake 
4878b27badSEric Blake /**
4949ee3590SAnthony Liguori  * qtest_init:
5088b988c8SMarkus Armbruster  * @extra_args: other arguments to pass to QEMU.  CAUTION: these
5188b988c8SMarkus Armbruster  * arguments are subject to word splitting and shell evaluation.
526acf801dSAndreas Färber  *
536acf801dSAndreas Färber  * Returns: #QTestState instance.
5449ee3590SAnthony Liguori  */
5549ee3590SAnthony Liguori QTestState *qtest_init(const char *extra_args);
5649ee3590SAnthony Liguori 
5749ee3590SAnthony Liguori /**
58f66e7ac8SMarkus Armbruster  * qtest_init_without_qmp_handshake:
59ddee57e0SEric Blake  * @extra_args: other arguments to pass to QEMU.  CAUTION: these
60ddee57e0SEric Blake  * arguments are subject to word splitting and shell evaluation.
61f66e7ac8SMarkus Armbruster  *
62f66e7ac8SMarkus Armbruster  * Returns: #QTestState instance.
63f66e7ac8SMarkus Armbruster  */
64192f26a7SPeter Xu QTestState *qtest_init_without_qmp_handshake(const char *extra_args);
65f66e7ac8SMarkus Armbruster 
66f66e7ac8SMarkus Armbruster /**
676c90a82cSJulia Suvorova  * qtest_init_with_serial:
686c90a82cSJulia Suvorova  * @extra_args: other arguments to pass to QEMU.  CAUTION: these
696c90a82cSJulia Suvorova  * arguments are subject to word splitting and shell evaluation.
706c90a82cSJulia Suvorova  * @sock_fd: pointer to store the socket file descriptor for
716c90a82cSJulia Suvorova  * connection with serial.
726c90a82cSJulia Suvorova  *
736c90a82cSJulia Suvorova  * Returns: #QTestState instance.
746c90a82cSJulia Suvorova  */
756c90a82cSJulia Suvorova QTestState *qtest_init_with_serial(const char *extra_args, int *sock_fd);
766c90a82cSJulia Suvorova 
776c90a82cSJulia Suvorova /**
7849ee3590SAnthony Liguori  * qtest_quit:
796acf801dSAndreas Färber  * @s: #QTestState instance to operate on.
8049ee3590SAnthony Liguori  *
8149ee3590SAnthony Liguori  * Shut down the QEMU process associated to @s.
8249ee3590SAnthony Liguori  */
8349ee3590SAnthony Liguori void qtest_quit(QTestState *s);
8449ee3590SAnthony Liguori 
8549ee3590SAnthony Liguori /**
8624d5588cSYury Kotov  * qtest_qmp_fds:
8724d5588cSYury Kotov  * @s: #QTestState instance to operate on.
8824d5588cSYury Kotov  * @fds: array of file descriptors
8924d5588cSYury Kotov  * @fds_num: number of elements in @fds
9024d5588cSYury Kotov  * @fmt...: QMP message to send to qemu, formatted like
9124d5588cSYury Kotov  * qobject_from_jsonf_nofail().  See parse_escape() for what's
9224d5588cSYury Kotov  * supported after '%'.
9324d5588cSYury Kotov  *
9424d5588cSYury Kotov  * Sends a QMP message to QEMU with fds and returns the response.
9524d5588cSYury Kotov  */
9624d5588cSYury Kotov QDict *qtest_qmp_fds(QTestState *s, int *fds, size_t fds_num,
9724d5588cSYury Kotov                      const char *fmt, ...)
9824d5588cSYury Kotov     GCC_FMT_ATTR(4, 5);
9924d5588cSYury Kotov 
10024d5588cSYury Kotov /**
1010c460dacSStefan Hajnoczi  * qtest_qmp:
1020c460dacSStefan Hajnoczi  * @s: #QTestState instance to operate on.
103bb340eb2SEric Blake  * @fmt...: QMP message to send to qemu, formatted like
1046ce80fd8SMarkus Armbruster  * qobject_from_jsonf_nofail().  See parse_escape() for what's
1056ce80fd8SMarkus Armbruster  * supported after '%'.
1060c460dacSStefan Hajnoczi  *
1070c460dacSStefan Hajnoczi  * Sends a QMP message to QEMU and returns the response.
1080c460dacSStefan Hajnoczi  */
109e3dc93beSMarkus Armbruster QDict *qtest_qmp(QTestState *s, const char *fmt, ...)
110e3dc93beSMarkus Armbruster     GCC_FMT_ATTR(2, 3);
1110c460dacSStefan Hajnoczi 
1120c460dacSStefan Hajnoczi /**
1134277f1ebSMarkus Armbruster  * qtest_qmp_send:
114ba4ed393SJohn Snow  * @s: #QTestState instance to operate on.
115bb340eb2SEric Blake  * @fmt...: QMP message to send to qemu, formatted like
1166ce80fd8SMarkus Armbruster  * qobject_from_jsonf_nofail().  See parse_escape() for what's
1176ce80fd8SMarkus Armbruster  * supported after '%'.
118ba4ed393SJohn Snow  *
119ba4ed393SJohn Snow  * Sends a QMP message to QEMU and leaves the response in the stream.
120ba4ed393SJohn Snow  */
121e3dc93beSMarkus Armbruster void qtest_qmp_send(QTestState *s, const char *fmt, ...)
122e3dc93beSMarkus Armbruster     GCC_FMT_ATTR(2, 3);
123ba4ed393SJohn Snow 
124ba4ed393SJohn Snow /**
125aed877c5SMarkus Armbruster  * qtest_qmp_send_raw:
126aed877c5SMarkus Armbruster  * @s: #QTestState instance to operate on.
127aed877c5SMarkus Armbruster  * @fmt...: text to send, formatted like sprintf()
128aed877c5SMarkus Armbruster  *
129aed877c5SMarkus Armbruster  * Sends text to the QMP monitor verbatim.  Need not be valid JSON;
130aed877c5SMarkus Armbruster  * this is useful for negative tests.
131aed877c5SMarkus Armbruster  */
132aed877c5SMarkus Armbruster void qtest_qmp_send_raw(QTestState *s, const char *fmt, ...)
133aed877c5SMarkus Armbruster     GCC_FMT_ATTR(2, 3);
134aed877c5SMarkus Armbruster 
135aed877c5SMarkus Armbruster /**
13624d5588cSYury Kotov  * qtest_vqmp_fds:
13724d5588cSYury Kotov  * @s: #QTestState instance to operate on.
13824d5588cSYury Kotov  * @fds: array of file descriptors
13924d5588cSYury Kotov  * @fds_num: number of elements in @fds
14024d5588cSYury Kotov  * @fmt: QMP message to send to QEMU, formatted like
14124d5588cSYury Kotov  * qobject_from_jsonf_nofail().  See parse_escape() for what's
14224d5588cSYury Kotov  * supported after '%'.
14324d5588cSYury Kotov  * @ap: QMP message arguments
14424d5588cSYury Kotov  *
14524d5588cSYury Kotov  * Sends a QMP message to QEMU with fds and returns the response.
14624d5588cSYury Kotov  */
14724d5588cSYury Kotov QDict *qtest_vqmp_fds(QTestState *s, int *fds, size_t fds_num,
14824d5588cSYury Kotov                       const char *fmt, va_list ap)
14924d5588cSYury Kotov     GCC_FMT_ATTR(4, 0);
15024d5588cSYury Kotov 
15124d5588cSYury Kotov /**
15224d5588cSYury Kotov  * qtest_vqmp:
1530c460dacSStefan Hajnoczi  * @s: #QTestState instance to operate on.
154bb340eb2SEric Blake  * @fmt: QMP message to send to QEMU, formatted like
1556ce80fd8SMarkus Armbruster  * qobject_from_jsonf_nofail().  See parse_escape() for what's
1566ce80fd8SMarkus Armbruster  * supported after '%'.
1570c460dacSStefan Hajnoczi  * @ap: QMP message arguments
1580c460dacSStefan Hajnoczi  *
1590c460dacSStefan Hajnoczi  * Sends a QMP message to QEMU and returns the response.
1600c460dacSStefan Hajnoczi  */
161248eef02SMarkus Armbruster QDict *qtest_vqmp(QTestState *s, const char *fmt, va_list ap)
162e3dc93beSMarkus Armbruster     GCC_FMT_ATTR(2, 0);
1630c460dacSStefan Hajnoczi 
1640c460dacSStefan Hajnoczi /**
16524d5588cSYury Kotov  * qtest_qmp_vsend_fds:
16624d5588cSYury Kotov  * @s: #QTestState instance to operate on.
16724d5588cSYury Kotov  * @fds: array of file descriptors
16824d5588cSYury Kotov  * @fds_num: number of elements in @fds
16924d5588cSYury Kotov  * @fmt: QMP message to send to QEMU, formatted like
17024d5588cSYury Kotov  * qobject_from_jsonf_nofail().  See parse_escape() for what's
17124d5588cSYury Kotov  * supported after '%'.
17224d5588cSYury Kotov  * @ap: QMP message arguments
17324d5588cSYury Kotov  *
17424d5588cSYury Kotov  * Sends a QMP message to QEMU and leaves the response in the stream.
17524d5588cSYury Kotov  */
17624d5588cSYury Kotov void qtest_qmp_vsend_fds(QTestState *s, int *fds, size_t fds_num,
17724d5588cSYury Kotov                          const char *fmt, va_list ap)
17824d5588cSYury Kotov     GCC_FMT_ATTR(4, 0);
17924d5588cSYury Kotov 
18024d5588cSYury Kotov /**
1814277f1ebSMarkus Armbruster  * qtest_qmp_vsend:
182ba4ed393SJohn Snow  * @s: #QTestState instance to operate on.
183bb340eb2SEric Blake  * @fmt: QMP message to send to QEMU, formatted like
1846ce80fd8SMarkus Armbruster  * qobject_from_jsonf_nofail().  See parse_escape() for what's
1856ce80fd8SMarkus Armbruster  * supported after '%'.
186ba4ed393SJohn Snow  * @ap: QMP message arguments
187ba4ed393SJohn Snow  *
188ba4ed393SJohn Snow  * Sends a QMP message to QEMU and leaves the response in the stream.
189ba4ed393SJohn Snow  */
190e3dc93beSMarkus Armbruster void qtest_qmp_vsend(QTestState *s, const char *fmt, va_list ap)
191e3dc93beSMarkus Armbruster     GCC_FMT_ATTR(2, 0);
192ba4ed393SJohn Snow 
193ba4ed393SJohn Snow /**
19466e0c7b1SAndreas Färber  * qtest_receive:
19566e0c7b1SAndreas Färber  * @s: #QTestState instance to operate on.
19666e0c7b1SAndreas Färber  *
19766e0c7b1SAndreas Färber  * Reads a QMP message from QEMU and returns the response.
19866e0c7b1SAndreas Färber  */
19966e0c7b1SAndreas Färber QDict *qtest_qmp_receive(QTestState *s);
20066e0c7b1SAndreas Färber 
20166e0c7b1SAndreas Färber /**
2028fe941f7SJohn Snow  * qtest_qmp_eventwait:
2038fe941f7SJohn Snow  * @s: #QTestState instance to operate on.
2048fe941f7SJohn Snow  * @s: #event event to wait for.
2058fe941f7SJohn Snow  *
206e8ec0117SEric Blake  * Continuously polls for QMP responses until it receives the desired event.
2078fe941f7SJohn Snow  */
2088fe941f7SJohn Snow void qtest_qmp_eventwait(QTestState *s, const char *event);
2098fe941f7SJohn Snow 
2108fe941f7SJohn Snow /**
2117ffe3124SJohn Snow  * qtest_qmp_eventwait_ref:
2127ffe3124SJohn Snow  * @s: #QTestState instance to operate on.
2137ffe3124SJohn Snow  * @s: #event event to wait for.
2147ffe3124SJohn Snow  *
215e8ec0117SEric Blake  * Continuously polls for QMP responses until it receives the desired event.
2167ffe3124SJohn Snow  * Returns a copy of the event for further investigation.
2177ffe3124SJohn Snow  */
2187ffe3124SJohn Snow QDict *qtest_qmp_eventwait_ref(QTestState *s, const char *event);
2197ffe3124SJohn Snow 
2207ffe3124SJohn Snow /**
2213cd46d42SMarkus Armbruster  * qtest_qmp_receive_success:
2223cd46d42SMarkus Armbruster  * @s: #QTestState instance to operate on
2233cd46d42SMarkus Armbruster  * @event_cb: Event callback
2243cd46d42SMarkus Armbruster  * @opaque: Argument for @event_cb
2253cd46d42SMarkus Armbruster  *
2263cd46d42SMarkus Armbruster  * Poll QMP messages until a command success response is received.
2273cd46d42SMarkus Armbruster  * If @event_cb, call it for each event received, passing @opaque,
2283cd46d42SMarkus Armbruster  * the event's name and data.
2293cd46d42SMarkus Armbruster  * Return the success response's "return" member.
2303cd46d42SMarkus Armbruster  */
2313cd46d42SMarkus Armbruster QDict *qtest_qmp_receive_success(QTestState *s,
2323cd46d42SMarkus Armbruster                                  void (*event_cb)(void *opaque,
2333cd46d42SMarkus Armbruster                                                   const char *name,
2343cd46d42SMarkus Armbruster                                                   QDict *data),
2353cd46d42SMarkus Armbruster                                  void *opaque);
2363cd46d42SMarkus Armbruster 
2373cd46d42SMarkus Armbruster /**
2386bb87be8SThomas Huth  * qtest_hmp:
2395fb48d96SMarkus Armbruster  * @s: #QTestState instance to operate on.
2407b899f4dSEric Blake  * @fmt...: HMP command to send to QEMU, formats arguments like sprintf().
2415fb48d96SMarkus Armbruster  *
2425fb48d96SMarkus Armbruster  * Send HMP command to QEMU via QMP's human-monitor-command.
2436bb87be8SThomas Huth  * QMP events are discarded.
2445fb48d96SMarkus Armbruster  *
2455fb48d96SMarkus Armbruster  * Returns: the command's output.  The caller should g_free() it.
2465fb48d96SMarkus Armbruster  */
2477b899f4dSEric Blake char *qtest_hmp(QTestState *s, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
2485fb48d96SMarkus Armbruster 
2495fb48d96SMarkus Armbruster /**
2505fb48d96SMarkus Armbruster  * qtest_hmpv:
2515fb48d96SMarkus Armbruster  * @s: #QTestState instance to operate on.
252bb340eb2SEric Blake  * @fmt: HMP command to send to QEMU, formats arguments like vsprintf().
2535fb48d96SMarkus Armbruster  * @ap: HMP command arguments
2545fb48d96SMarkus Armbruster  *
2555fb48d96SMarkus Armbruster  * Send HMP command to QEMU via QMP's human-monitor-command.
2566bb87be8SThomas Huth  * QMP events are discarded.
2575fb48d96SMarkus Armbruster  *
2585fb48d96SMarkus Armbruster  * Returns: the command's output.  The caller should g_free() it.
2595fb48d96SMarkus Armbruster  */
260248eef02SMarkus Armbruster char *qtest_vhmp(QTestState *s, const char *fmt, va_list ap)
261bb340eb2SEric Blake     GCC_FMT_ATTR(2, 0);
2625fb48d96SMarkus Armbruster 
263eb062cfaSMarc-André Lureau void qtest_module_load(QTestState *s, const char *prefix, const char *libname);
264eb062cfaSMarc-André Lureau 
2655fb48d96SMarkus Armbruster /**
26649ee3590SAnthony Liguori  * qtest_get_irq:
2676acf801dSAndreas Färber  * @s: #QTestState instance to operate on.
26849ee3590SAnthony Liguori  * @num: Interrupt to observe.
26949ee3590SAnthony Liguori  *
2706acf801dSAndreas Färber  * Returns: The level of the @num interrupt.
27149ee3590SAnthony Liguori  */
27249ee3590SAnthony Liguori bool qtest_get_irq(QTestState *s, int num);
27349ee3590SAnthony Liguori 
27449ee3590SAnthony Liguori /**
27549ee3590SAnthony Liguori  * qtest_irq_intercept_in:
2766acf801dSAndreas Färber  * @s: #QTestState instance to operate on.
27749ee3590SAnthony Liguori  * @string: QOM path of a device.
27849ee3590SAnthony Liguori  *
27949ee3590SAnthony Liguori  * Associate qtest irqs with the GPIO-in pins of the device
28049ee3590SAnthony Liguori  * whose path is specified by @string.
28149ee3590SAnthony Liguori  */
28249ee3590SAnthony Liguori void qtest_irq_intercept_in(QTestState *s, const char *string);
28349ee3590SAnthony Liguori 
28449ee3590SAnthony Liguori /**
28549ee3590SAnthony Liguori  * qtest_irq_intercept_out:
2866acf801dSAndreas Färber  * @s: #QTestState instance to operate on.
28749ee3590SAnthony Liguori  * @string: QOM path of a device.
28849ee3590SAnthony Liguori  *
28949ee3590SAnthony Liguori  * Associate qtest irqs with the GPIO-out pins of the device
29049ee3590SAnthony Liguori  * whose path is specified by @string.
29149ee3590SAnthony Liguori  */
29249ee3590SAnthony Liguori void qtest_irq_intercept_out(QTestState *s, const char *string);
29349ee3590SAnthony Liguori 
29449ee3590SAnthony Liguori /**
2959813dc6aSSteffen Görtz  * qtest_set_irq_in:
2969813dc6aSSteffen Görtz  * @s: QTestState instance to operate on.
2979813dc6aSSteffen Görtz  * @string: QOM path of a device
2989813dc6aSSteffen Görtz  * @name: IRQ name
2999813dc6aSSteffen Görtz  * @irq: IRQ number
3009813dc6aSSteffen Görtz  * @level: IRQ level
3019813dc6aSSteffen Görtz  *
3029813dc6aSSteffen Görtz  * Force given device/irq GPIO-in pin to the given level.
3039813dc6aSSteffen Görtz  */
3049813dc6aSSteffen Görtz void qtest_set_irq_in(QTestState *s, const char *string, const char *name,
3059813dc6aSSteffen Görtz                       int irq, int level);
3069813dc6aSSteffen Görtz 
3079813dc6aSSteffen Görtz /**
30849ee3590SAnthony Liguori  * qtest_outb:
3096acf801dSAndreas Färber  * @s: #QTestState instance to operate on.
31049ee3590SAnthony Liguori  * @addr: I/O port to write to.
31149ee3590SAnthony Liguori  * @value: Value being written.
31249ee3590SAnthony Liguori  *
31349ee3590SAnthony Liguori  * Write an 8-bit value to an I/O port.
31449ee3590SAnthony Liguori  */
31549ee3590SAnthony Liguori void qtest_outb(QTestState *s, uint16_t addr, uint8_t value);
31649ee3590SAnthony Liguori 
31749ee3590SAnthony Liguori /**
31849ee3590SAnthony Liguori  * qtest_outw:
3196acf801dSAndreas Färber  * @s: #QTestState instance to operate on.
32049ee3590SAnthony Liguori  * @addr: I/O port to write to.
32149ee3590SAnthony Liguori  * @value: Value being written.
32249ee3590SAnthony Liguori  *
32349ee3590SAnthony Liguori  * Write a 16-bit value to an I/O port.
32449ee3590SAnthony Liguori  */
32549ee3590SAnthony Liguori void qtest_outw(QTestState *s, uint16_t addr, uint16_t value);
32649ee3590SAnthony Liguori 
32749ee3590SAnthony Liguori /**
32849ee3590SAnthony Liguori  * qtest_outl:
3296acf801dSAndreas Färber  * @s: #QTestState instance to operate on.
33049ee3590SAnthony Liguori  * @addr: I/O port to write to.
33149ee3590SAnthony Liguori  * @value: Value being written.
33249ee3590SAnthony Liguori  *
33349ee3590SAnthony Liguori  * Write a 32-bit value to an I/O port.
33449ee3590SAnthony Liguori  */
33549ee3590SAnthony Liguori void qtest_outl(QTestState *s, uint16_t addr, uint32_t value);
33649ee3590SAnthony Liguori 
33749ee3590SAnthony Liguori /**
33849ee3590SAnthony Liguori  * qtest_inb:
3396acf801dSAndreas Färber  * @s: #QTestState instance to operate on.
34049ee3590SAnthony Liguori  * @addr: I/O port to read from.
34149ee3590SAnthony Liguori  *
34249ee3590SAnthony Liguori  * Returns an 8-bit value from an I/O port.
34349ee3590SAnthony Liguori  */
34449ee3590SAnthony Liguori uint8_t qtest_inb(QTestState *s, uint16_t addr);
34549ee3590SAnthony Liguori 
34649ee3590SAnthony Liguori /**
34749ee3590SAnthony Liguori  * qtest_inw:
3486acf801dSAndreas Färber  * @s: #QTestState instance to operate on.
34949ee3590SAnthony Liguori  * @addr: I/O port to read from.
35049ee3590SAnthony Liguori  *
35149ee3590SAnthony Liguori  * Returns a 16-bit value from an I/O port.
35249ee3590SAnthony Liguori  */
35349ee3590SAnthony Liguori uint16_t qtest_inw(QTestState *s, uint16_t addr);
35449ee3590SAnthony Liguori 
35549ee3590SAnthony Liguori /**
35649ee3590SAnthony Liguori  * qtest_inl:
3576acf801dSAndreas Färber  * @s: #QTestState instance to operate on.
35849ee3590SAnthony Liguori  * @addr: I/O port to read from.
35949ee3590SAnthony Liguori  *
36049ee3590SAnthony Liguori  * Returns a 32-bit value from an I/O port.
36149ee3590SAnthony Liguori  */
36249ee3590SAnthony Liguori uint32_t qtest_inl(QTestState *s, uint16_t addr);
36349ee3590SAnthony Liguori 
36449ee3590SAnthony Liguori /**
365872536bfSAndreas Färber  * qtest_writeb:
366872536bfSAndreas Färber  * @s: #QTestState instance to operate on.
367872536bfSAndreas Färber  * @addr: Guest address to write to.
368872536bfSAndreas Färber  * @value: Value being written.
369872536bfSAndreas Färber  *
370872536bfSAndreas Färber  * Writes an 8-bit value to memory.
371872536bfSAndreas Färber  */
372872536bfSAndreas Färber void qtest_writeb(QTestState *s, uint64_t addr, uint8_t value);
373872536bfSAndreas Färber 
374872536bfSAndreas Färber /**
375872536bfSAndreas Färber  * qtest_writew:
376872536bfSAndreas Färber  * @s: #QTestState instance to operate on.
377872536bfSAndreas Färber  * @addr: Guest address to write to.
378872536bfSAndreas Färber  * @value: Value being written.
379872536bfSAndreas Färber  *
380872536bfSAndreas Färber  * Writes a 16-bit value to memory.
381872536bfSAndreas Färber  */
382872536bfSAndreas Färber void qtest_writew(QTestState *s, uint64_t addr, uint16_t value);
383872536bfSAndreas Färber 
384872536bfSAndreas Färber /**
385872536bfSAndreas Färber  * qtest_writel:
386872536bfSAndreas Färber  * @s: #QTestState instance to operate on.
387872536bfSAndreas Färber  * @addr: Guest address to write to.
388872536bfSAndreas Färber  * @value: Value being written.
389872536bfSAndreas Färber  *
390872536bfSAndreas Färber  * Writes a 32-bit value to memory.
391872536bfSAndreas Färber  */
392872536bfSAndreas Färber void qtest_writel(QTestState *s, uint64_t addr, uint32_t value);
393872536bfSAndreas Färber 
394872536bfSAndreas Färber /**
395872536bfSAndreas Färber  * qtest_writeq:
396872536bfSAndreas Färber  * @s: #QTestState instance to operate on.
397872536bfSAndreas Färber  * @addr: Guest address to write to.
398872536bfSAndreas Färber  * @value: Value being written.
399872536bfSAndreas Färber  *
400872536bfSAndreas Färber  * Writes a 64-bit value to memory.
401872536bfSAndreas Färber  */
402872536bfSAndreas Färber void qtest_writeq(QTestState *s, uint64_t addr, uint64_t value);
403872536bfSAndreas Färber 
404872536bfSAndreas Färber /**
405872536bfSAndreas Färber  * qtest_readb:
406872536bfSAndreas Färber  * @s: #QTestState instance to operate on.
407872536bfSAndreas Färber  * @addr: Guest address to read from.
408872536bfSAndreas Färber  *
409872536bfSAndreas Färber  * Reads an 8-bit value from memory.
410872536bfSAndreas Färber  *
411872536bfSAndreas Färber  * Returns: Value read.
412872536bfSAndreas Färber  */
413872536bfSAndreas Färber uint8_t qtest_readb(QTestState *s, uint64_t addr);
414872536bfSAndreas Färber 
415872536bfSAndreas Färber /**
416872536bfSAndreas Färber  * qtest_readw:
417872536bfSAndreas Färber  * @s: #QTestState instance to operate on.
418872536bfSAndreas Färber  * @addr: Guest address to read from.
419872536bfSAndreas Färber  *
420872536bfSAndreas Färber  * Reads a 16-bit value from memory.
421872536bfSAndreas Färber  *
422872536bfSAndreas Färber  * Returns: Value read.
423872536bfSAndreas Färber  */
424872536bfSAndreas Färber uint16_t qtest_readw(QTestState *s, uint64_t addr);
425872536bfSAndreas Färber 
426872536bfSAndreas Färber /**
427872536bfSAndreas Färber  * qtest_readl:
428872536bfSAndreas Färber  * @s: #QTestState instance to operate on.
429872536bfSAndreas Färber  * @addr: Guest address to read from.
430872536bfSAndreas Färber  *
431872536bfSAndreas Färber  * Reads a 32-bit value from memory.
432872536bfSAndreas Färber  *
433872536bfSAndreas Färber  * Returns: Value read.
434872536bfSAndreas Färber  */
435872536bfSAndreas Färber uint32_t qtest_readl(QTestState *s, uint64_t addr);
436872536bfSAndreas Färber 
437872536bfSAndreas Färber /**
438872536bfSAndreas Färber  * qtest_readq:
439872536bfSAndreas Färber  * @s: #QTestState instance to operate on.
440872536bfSAndreas Färber  * @addr: Guest address to read from.
441872536bfSAndreas Färber  *
442872536bfSAndreas Färber  * Reads a 64-bit value from memory.
443872536bfSAndreas Färber  *
444872536bfSAndreas Färber  * Returns: Value read.
445872536bfSAndreas Färber  */
446872536bfSAndreas Färber uint64_t qtest_readq(QTestState *s, uint64_t addr);
447872536bfSAndreas Färber 
448872536bfSAndreas Färber /**
44949ee3590SAnthony Liguori  * qtest_memread:
4506acf801dSAndreas Färber  * @s: #QTestState instance to operate on.
45149ee3590SAnthony Liguori  * @addr: Guest address to read from.
45249ee3590SAnthony Liguori  * @data: Pointer to where memory contents will be stored.
45349ee3590SAnthony Liguori  * @size: Number of bytes to read.
45449ee3590SAnthony Liguori  *
45549ee3590SAnthony Liguori  * Read guest memory into a buffer.
45649ee3590SAnthony Liguori  */
45749ee3590SAnthony Liguori void qtest_memread(QTestState *s, uint64_t addr, void *data, size_t size);
45849ee3590SAnthony Liguori 
45949ee3590SAnthony Liguori /**
460eeddd59fSLaurent Vivier  * qtest_rtas_call:
461eeddd59fSLaurent Vivier  * @s: #QTestState instance to operate on.
462eeddd59fSLaurent Vivier  * @name: name of the command to call.
463eeddd59fSLaurent Vivier  * @nargs: Number of args.
464eeddd59fSLaurent Vivier  * @args: Guest address to read args from.
465eeddd59fSLaurent Vivier  * @nret: Number of return value.
466eeddd59fSLaurent Vivier  * @ret: Guest address to write return values to.
467eeddd59fSLaurent Vivier  *
468eeddd59fSLaurent Vivier  * Call an RTAS function
469eeddd59fSLaurent Vivier  */
470eeddd59fSLaurent Vivier uint64_t qtest_rtas_call(QTestState *s, const char *name,
471eeddd59fSLaurent Vivier                          uint32_t nargs, uint64_t args,
472eeddd59fSLaurent Vivier                          uint32_t nret, uint64_t ret);
473eeddd59fSLaurent Vivier 
474eeddd59fSLaurent Vivier /**
4757a6a740dSJohn Snow  * qtest_bufread:
4767a6a740dSJohn Snow  * @s: #QTestState instance to operate on.
4777a6a740dSJohn Snow  * @addr: Guest address to read from.
4787a6a740dSJohn Snow  * @data: Pointer to where memory contents will be stored.
4797a6a740dSJohn Snow  * @size: Number of bytes to read.
4807a6a740dSJohn Snow  *
4817a6a740dSJohn Snow  * Read guest memory into a buffer and receive using a base64 encoding.
4827a6a740dSJohn Snow  */
4837a6a740dSJohn Snow void qtest_bufread(QTestState *s, uint64_t addr, void *data, size_t size);
4847a6a740dSJohn Snow 
4857a6a740dSJohn Snow /**
48649ee3590SAnthony Liguori  * qtest_memwrite:
4876acf801dSAndreas Färber  * @s: #QTestState instance to operate on.
48849ee3590SAnthony Liguori  * @addr: Guest address to write to.
48949ee3590SAnthony Liguori  * @data: Pointer to the bytes that will be written to guest memory.
49049ee3590SAnthony Liguori  * @size: Number of bytes to write.
49149ee3590SAnthony Liguori  *
49249ee3590SAnthony Liguori  * Write a buffer to guest memory.
49349ee3590SAnthony Liguori  */
49449ee3590SAnthony Liguori void qtest_memwrite(QTestState *s, uint64_t addr, const void *data, size_t size);
49549ee3590SAnthony Liguori 
49649ee3590SAnthony Liguori /**
4977a6a740dSJohn Snow  * qtest_bufwrite:
4987a6a740dSJohn Snow  * @s: #QTestState instance to operate on.
4997a6a740dSJohn Snow  * @addr: Guest address to write to.
5007a6a740dSJohn Snow  * @data: Pointer to the bytes that will be written to guest memory.
5017a6a740dSJohn Snow  * @size: Number of bytes to write.
5027a6a740dSJohn Snow  *
5037a6a740dSJohn Snow  * Write a buffer to guest memory and transmit using a base64 encoding.
5047a6a740dSJohn Snow  */
5057a6a740dSJohn Snow void qtest_bufwrite(QTestState *s, uint64_t addr,
5067a6a740dSJohn Snow                     const void *data, size_t size);
5077a6a740dSJohn Snow 
5087a6a740dSJohn Snow /**
50986298845SJohn Snow  * qtest_memset:
51086298845SJohn Snow  * @s: #QTestState instance to operate on.
51186298845SJohn Snow  * @addr: Guest address to write to.
51286298845SJohn Snow  * @patt: Byte pattern to fill the guest memory region with.
51386298845SJohn Snow  * @size: Number of bytes to write.
51486298845SJohn Snow  *
51586298845SJohn Snow  * Write a pattern to guest memory.
51686298845SJohn Snow  */
51786298845SJohn Snow void qtest_memset(QTestState *s, uint64_t addr, uint8_t patt, size_t size);
51886298845SJohn Snow 
51986298845SJohn Snow /**
52049ee3590SAnthony Liguori  * qtest_clock_step_next:
5216acf801dSAndreas Färber  * @s: #QTestState instance to operate on.
52249ee3590SAnthony Liguori  *
523bc72ad67SAlex Bligh  * Advance the QEMU_CLOCK_VIRTUAL to the next deadline.
5246acf801dSAndreas Färber  *
525bc72ad67SAlex Bligh  * Returns: The current value of the QEMU_CLOCK_VIRTUAL in nanoseconds.
52649ee3590SAnthony Liguori  */
52749ee3590SAnthony Liguori int64_t qtest_clock_step_next(QTestState *s);
52849ee3590SAnthony Liguori 
52949ee3590SAnthony Liguori /**
53049ee3590SAnthony Liguori  * qtest_clock_step:
53149ee3590SAnthony Liguori  * @s: QTestState instance to operate on.
53249ee3590SAnthony Liguori  * @step: Number of nanoseconds to advance the clock by.
53349ee3590SAnthony Liguori  *
534bc72ad67SAlex Bligh  * Advance the QEMU_CLOCK_VIRTUAL by @step nanoseconds.
5356acf801dSAndreas Färber  *
536bc72ad67SAlex Bligh  * Returns: The current value of the QEMU_CLOCK_VIRTUAL in nanoseconds.
53749ee3590SAnthony Liguori  */
53849ee3590SAnthony Liguori int64_t qtest_clock_step(QTestState *s, int64_t step);
53949ee3590SAnthony Liguori 
54049ee3590SAnthony Liguori /**
54149ee3590SAnthony Liguori  * qtest_clock_set:
54249ee3590SAnthony Liguori  * @s: QTestState instance to operate on.
54349ee3590SAnthony Liguori  * @val: Nanoseconds value to advance the clock to.
54449ee3590SAnthony Liguori  *
545bc72ad67SAlex Bligh  * Advance the QEMU_CLOCK_VIRTUAL to @val nanoseconds since the VM was launched.
5466acf801dSAndreas Färber  *
547bc72ad67SAlex Bligh  * Returns: The current value of the QEMU_CLOCK_VIRTUAL in nanoseconds.
54849ee3590SAnthony Liguori  */
54949ee3590SAnthony Liguori int64_t qtest_clock_set(QTestState *s, int64_t val);
55049ee3590SAnthony Liguori 
55149ee3590SAnthony Liguori /**
55254ce6f22SLaurent Vivier  * qtest_big_endian:
55354ce6f22SLaurent Vivier  * @s: QTestState instance to operate on.
55454ce6f22SLaurent Vivier  *
55554ce6f22SLaurent Vivier  * Returns: True if the architecture under test has a big endian configuration.
55654ce6f22SLaurent Vivier  */
55754ce6f22SLaurent Vivier bool qtest_big_endian(QTestState *s);
55854ce6f22SLaurent Vivier 
55954ce6f22SLaurent Vivier /**
56049ee3590SAnthony Liguori  * qtest_get_arch:
56149ee3590SAnthony Liguori  *
5626acf801dSAndreas Färber  * Returns: The architecture for the QEMU executable under test.
56349ee3590SAnthony Liguori  */
56449ee3590SAnthony Liguori const char *qtest_get_arch(void);
56549ee3590SAnthony Liguori 
56649ee3590SAnthony Liguori /**
56749ee3590SAnthony Liguori  * qtest_add_func:
56849ee3590SAnthony Liguori  * @str: Test case path.
56949ee3590SAnthony Liguori  * @fn: Test case function
57049ee3590SAnthony Liguori  *
57149ee3590SAnthony Liguori  * Add a GTester testcase with the given name and function.
57249ee3590SAnthony Liguori  * The path is prefixed with the architecture under test, as
5736acf801dSAndreas Färber  * returned by qtest_get_arch().
57449ee3590SAnthony Liguori  */
575041088c7SMarkus Armbruster void qtest_add_func(const char *str, void (*fn)(void));
57649ee3590SAnthony Liguori 
57749ee3590SAnthony Liguori /**
5787949c0e3SAndreas Färber  * qtest_add_data_func:
5797949c0e3SAndreas Färber  * @str: Test case path.
5807949c0e3SAndreas Färber  * @data: Test case data
5817949c0e3SAndreas Färber  * @fn: Test case function
5827949c0e3SAndreas Färber  *
5837949c0e3SAndreas Färber  * Add a GTester testcase with the given name, data and function.
5847949c0e3SAndreas Färber  * The path is prefixed with the architecture under test, as
5857949c0e3SAndreas Färber  * returned by qtest_get_arch().
5867949c0e3SAndreas Färber  */
587041088c7SMarkus Armbruster void qtest_add_data_func(const char *str, const void *data,
588041088c7SMarkus Armbruster                          void (*fn)(const void *));
5897949c0e3SAndreas Färber 
5907949c0e3SAndreas Färber /**
591822e36caSMarc-André Lureau  * qtest_add_data_func_full:
592822e36caSMarc-André Lureau  * @str: Test case path.
593822e36caSMarc-André Lureau  * @data: Test case data
594822e36caSMarc-André Lureau  * @fn: Test case function
595822e36caSMarc-André Lureau  * @data_free_func: GDestroyNotify for data
596822e36caSMarc-André Lureau  *
597822e36caSMarc-André Lureau  * Add a GTester testcase with the given name, data and function.
598822e36caSMarc-André Lureau  * The path is prefixed with the architecture under test, as
599822e36caSMarc-André Lureau  * returned by qtest_get_arch().
600822e36caSMarc-André Lureau  *
601822e36caSMarc-André Lureau  * @data is passed to @data_free_func() on test completion.
602822e36caSMarc-André Lureau  */
603822e36caSMarc-André Lureau void qtest_add_data_func_full(const char *str, void *data,
604822e36caSMarc-André Lureau                               void (*fn)(const void *),
605822e36caSMarc-André Lureau                               GDestroyNotify data_free_func);
606822e36caSMarc-André Lureau 
607822e36caSMarc-André Lureau /**
60845b0f830SAndreas Färber  * qtest_add:
60945b0f830SAndreas Färber  * @testpath: Test case path
61045b0f830SAndreas Färber  * @Fixture: Fixture type
61145b0f830SAndreas Färber  * @tdata: Test case data
61245b0f830SAndreas Färber  * @fsetup: Test case setup function
61345b0f830SAndreas Färber  * @ftest: Test case function
61445b0f830SAndreas Färber  * @fteardown: Test case teardown function
61545b0f830SAndreas Färber  *
61645b0f830SAndreas Färber  * Add a GTester testcase with the given name, data and functions.
61745b0f830SAndreas Färber  * The path is prefixed with the architecture under test, as
61845b0f830SAndreas Färber  * returned by qtest_get_arch().
61945b0f830SAndreas Färber  */
62045b0f830SAndreas Färber #define qtest_add(testpath, Fixture, tdata, fsetup, ftest, fteardown) \
62145b0f830SAndreas Färber     do { \
62245b0f830SAndreas Färber         char *path = g_strdup_printf("/%s/%s", qtest_get_arch(), testpath); \
62345b0f830SAndreas Färber         g_test_add(path, Fixture, tdata, fsetup, ftest, fteardown); \
62445b0f830SAndreas Färber         g_free(path); \
62545b0f830SAndreas Färber     } while (0)
62645b0f830SAndreas Färber 
627041088c7SMarkus Armbruster void qtest_add_abrt_handler(GHookFunc fn, const void *data);
628063c23d9SMarc-André Lureau 
62945b0f830SAndreas Färber /**
6306fc9f3d3SThomas Huth  * qtest_qmp_assert_success:
6316fc9f3d3SThomas Huth  * @qts: QTestState instance to operate on
632edbe36adSKevin Wolf  * @fmt...: QMP message to send to qemu, formatted like
633edbe36adSKevin Wolf  * qobject_from_jsonf_nofail().  See parse_escape() for what's
634edbe36adSKevin Wolf  * supported after '%'.
635edbe36adSKevin Wolf  *
636edbe36adSKevin Wolf  * Sends a QMP message to QEMU and asserts that a 'return' key is present in
637edbe36adSKevin Wolf  * the response.
638edbe36adSKevin Wolf  */
6396fc9f3d3SThomas Huth void qtest_qmp_assert_success(QTestState *qts, const char *fmt, ...)
6406fc9f3d3SThomas Huth     GCC_FMT_ATTR(2, 3);
641edbe36adSKevin Wolf 
642dc47995eSMarc-André Lureau QDict *qmp_fd_receive(int fd);
64324d5588cSYury Kotov void qmp_fd_vsend_fds(int fd, int *fds, size_t fds_num,
64424d5588cSYury Kotov                       const char *fmt, va_list ap) GCC_FMT_ATTR(4, 0);
645e3dc93beSMarkus Armbruster void qmp_fd_vsend(int fd, const char *fmt, va_list ap) GCC_FMT_ATTR(2, 0);
646e3dc93beSMarkus Armbruster void qmp_fd_send(int fd, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
647e2f64a68SMarkus Armbruster void qmp_fd_send_raw(int fd, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
648e2f64a68SMarkus Armbruster void qmp_fd_vsend_raw(int fd, const char *fmt, va_list ap) GCC_FMT_ATTR(2, 0);
649e3dc93beSMarkus Armbruster QDict *qmp_fdv(int fd, const char *fmt, va_list ap) GCC_FMT_ATTR(2, 0);
650e3dc93beSMarkus Armbruster QDict *qmp_fd(int fd, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
651dc47995eSMarc-André Lureau 
65202ef6e87SThomas Huth /**
65302ef6e87SThomas Huth  * qtest_cb_for_every_machine:
65402ef6e87SThomas Huth  * @cb: Pointer to the callback function
6551f4a0d81SThomas Huth  * @skip_old_versioned: true if versioned old machine types should be skipped
65602ef6e87SThomas Huth  *
65702ef6e87SThomas Huth  *  Call a callback function for every name of all available machines.
65802ef6e87SThomas Huth  */
6591f4a0d81SThomas Huth void qtest_cb_for_every_machine(void (*cb)(const char *machine),
6601f4a0d81SThomas Huth                                 bool skip_old_versioned);
66102ef6e87SThomas Huth 
662acd80015SThomas Huth /**
663b4510bb4SIgor Mammedov  * qtest_qmp_device_add_qdict:
664b4510bb4SIgor Mammedov  * @qts: QTestState instance to operate on
665b4510bb4SIgor Mammedov  * @drv: Name of the device that should be added
666b4510bb4SIgor Mammedov  * @arguments: QDict with properties for the device to intialize
667b4510bb4SIgor Mammedov  *
668b4510bb4SIgor Mammedov  * Generic hot-plugging test via the device_add QMP command with properties
669b4510bb4SIgor Mammedov  * supplied in form of QDict. Use NULL for empty properties list.
670b4510bb4SIgor Mammedov  */
671b4510bb4SIgor Mammedov void qtest_qmp_device_add_qdict(QTestState *qts, const char *drv,
672b4510bb4SIgor Mammedov                                 const QDict *arguments);
673b4510bb4SIgor Mammedov 
674b4510bb4SIgor Mammedov /**
675acd80015SThomas Huth  * qtest_qmp_device_add:
676e5758de4SThomas Huth  * @qts: QTestState instance to operate on
677acd80015SThomas Huth  * @driver: Name of the device that should be added
678acd80015SThomas Huth  * @id: Identification string
67982cab70bSMarkus Armbruster  * @fmt...: QMP message to send to qemu, formatted like
68082cab70bSMarkus Armbruster  * qobject_from_jsonf_nofail().  See parse_escape() for what's
68182cab70bSMarkus Armbruster  * supported after '%'.
682acd80015SThomas Huth  *
683acd80015SThomas Huth  * Generic hot-plugging test via the device_add QMP command.
684acd80015SThomas Huth  */
685e5758de4SThomas Huth void qtest_qmp_device_add(QTestState *qts, const char *driver, const char *id,
686e5758de4SThomas Huth                           const char *fmt, ...) GCC_FMT_ATTR(4, 5);
687acd80015SThomas Huth 
688acd80015SThomas Huth /**
689acd80015SThomas Huth  * qtest_qmp_device_del:
690e5758de4SThomas Huth  * @qts: QTestState instance to operate on
691acd80015SThomas Huth  * @id: Identification string
692acd80015SThomas Huth  *
693acd80015SThomas Huth  * Generic hot-unplugging test via the device_del QMP command.
694acd80015SThomas Huth  */
695e5758de4SThomas Huth void qtest_qmp_device_del(QTestState *qts, const char *id);
696acd80015SThomas Huth 
697c35665e1SIgor Mammedov /**
698c35665e1SIgor Mammedov  * qmp_rsp_is_err:
699c35665e1SIgor Mammedov  * @rsp: QMP response to check for error
700c35665e1SIgor Mammedov  *
701c35665e1SIgor Mammedov  * Test @rsp for error and discard @rsp.
702c35665e1SIgor Mammedov  * Returns 'true' if there is error in @rsp and 'false' otherwise.
703c35665e1SIgor Mammedov  */
704c35665e1SIgor Mammedov bool qmp_rsp_is_err(QDict *rsp);
705c35665e1SIgor Mammedov 
706ebb4d82dSMarc-André Lureau /**
707ebb4d82dSMarc-André Lureau  * qmp_assert_error_class:
708ebb4d82dSMarc-André Lureau  * @rsp: QMP response to check for error
709ebb4d82dSMarc-André Lureau  * @class: an error class
710ebb4d82dSMarc-André Lureau  *
711ebb4d82dSMarc-André Lureau  * Assert the response has the given error class and discard @rsp.
712ebb4d82dSMarc-André Lureau  */
713ebb4d82dSMarc-André Lureau void qmp_assert_error_class(QDict *rsp, const char *class);
714ebb4d82dSMarc-André Lureau 
71521f80286SRichard Henderson /**
71621f80286SRichard Henderson  * qtest_probe_child:
71721f80286SRichard Henderson  * @s: QTestState instance to operate on.
71821f80286SRichard Henderson  *
71921f80286SRichard Henderson  * Returns: true if the child is still alive.
72021f80286SRichard Henderson  */
72121f80286SRichard Henderson bool qtest_probe_child(QTestState *s);
72221f80286SRichard Henderson 
723d43e59e7SYury Kotov /**
724d43e59e7SYury Kotov  * qtest_set_expected_status:
725d43e59e7SYury Kotov  * @s: QTestState instance to operate on.
726d43e59e7SYury Kotov  * @status: an expected exit status.
727d43e59e7SYury Kotov  *
728d43e59e7SYury Kotov  * Set expected exit status of the child.
729d43e59e7SYury Kotov  */
730d43e59e7SYury Kotov void qtest_set_expected_status(QTestState *s, int status);
731d43e59e7SYury Kotov 
732ca5d4641SAlexander Bulekov QTestState *qtest_inproc_init(QTestState **s, bool log, const char* arch,
733ca5d4641SAlexander Bulekov                     void (*send)(void*, const char*));
734ca5d4641SAlexander Bulekov 
735ca5d4641SAlexander Bulekov void qtest_client_inproc_recv(void *opaque, const char *str);
73649ee3590SAnthony Liguori #endif
737