blob: b4e7c52c611f74ee69a98ac82950812acf0ba477 [file] [log] [blame]
Michael Roth13a286d2011-07-19 15:41:53 -05001/*
2 * QEMU Guest Agent core declarations
3 *
4 * Copyright IBM Corp. 2011
5 *
6 * Authors:
7 * Adam Litke <aglitke@linux.vnet.ibm.com>
8 * Michael Roth <mdroth@linux.vnet.ibm.com>
9 *
10 * This work is licensed under the terms of the GNU GPL, version 2 or later.
11 * See the COPYING file in the top-level directory.
12 */
Peter Maydell61baac22018-11-08 12:52:23 +000013#ifndef GUEST_AGENT_CORE_H
14#define GUEST_AGENT_CORE_H
15
Paolo Bonzini7b1b5d12012-12-17 18:19:43 +010016#include "qapi/qmp/dispatch.h"
Markus Armbrusterabb297e2018-02-01 12:18:33 +010017#include "qga-qapi-types.h"
Michael Roth13a286d2011-07-19 15:41:53 -050018
Michael Roth125b3102012-01-19 00:18:20 -060019#define QGA_READ_COUNT_DEFAULT 4096
Michael Roth13a286d2011-07-19 15:41:53 -050020
Michael Roth48ff7a62011-07-20 15:19:37 -050021typedef struct GAState GAState;
Michael Roth13a286d2011-07-19 15:41:53 -050022typedef struct GACommandState GACommandState;
Markus Armbruster1527bad2017-03-03 13:32:25 +010023
Michael Roth3cf0bed2012-02-07 13:56:48 -060024extern GAState *ga_state;
Markus Armbruster1527bad2017-03-03 13:32:25 +010025extern QmpCommandList ga_commands;
Michael Roth13a286d2011-07-19 15:41:53 -050026
Thomas Huth0e4ef702022-07-27 11:21:34 +020027GList *ga_command_init_blockedrpcs(GList *blockedrpcs);
Michael Rothe3d4d252011-07-19 15:41:55 -050028void ga_command_state_init(GAState *s, GACommandState *cs);
Michael Roth13a286d2011-07-19 15:41:53 -050029void ga_command_state_add(GACommandState *cs,
30 void (*init)(void),
31 void (*cleanup)(void));
32void ga_command_state_init_all(GACommandState *cs);
33void ga_command_state_cleanup_all(GACommandState *cs);
34GACommandState *ga_command_state_new(void);
Marc-André Lureau3e3e3022016-07-15 17:52:52 +020035void ga_command_state_free(GACommandState *cs);
Michael Roth48ff7a62011-07-20 15:19:37 -050036bool ga_logging_enabled(GAState *s);
37void ga_disable_logging(GAState *s);
38void ga_enable_logging(GAState *s);
Marc-André Lureau9edc6312022-02-20 20:39:25 +040039void G_GNUC_PRINTF(1, 2) slog(const gchar *fmt, ...);
Michael Roth3cf0bed2012-02-07 13:56:48 -060040void ga_set_response_delimited(GAState *s);
Michael Rothf22d85e2012-04-17 19:01:45 -050041bool ga_is_frozen(GAState *s);
42void ga_set_frozen(GAState *s);
43void ga_unset_frozen(GAState *s);
Tomoki Sekiyamaec0f6942012-12-12 12:55:55 +090044const char *ga_fsfreeze_hook(GAState *s);
Michael Roth39097da2013-03-01 11:40:27 -060045int64_t ga_get_fd_handle(GAState *s, Error **errp);
Eric Blake0b4b4932016-02-09 14:27:16 -070046int ga_parse_whence(GuestFileWhence *whence, Error **errp);
Luiz Capitulino04b4e752012-05-10 16:50:41 -030047
48#ifndef _WIN32
49void reopen_fd_to_null(int fd);
50#endif
Peter Maydell61baac22018-11-08 12:52:23 +000051
52#endif /* GUEST_AGENT_CORE_H */