xref: /openbmc/qemu/qga/guest-agent-core.h (revision 6016b7b4)
1 /*
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  */
13 #ifndef GUEST_AGENT_CORE_H
14 #define GUEST_AGENT_CORE_H
15 
16 #include "qapi/qmp/dispatch.h"
17 #include "qga-qapi-types.h"
18 
19 #define QGA_READ_COUNT_DEFAULT 4096
20 
21 typedef struct GAState GAState;
22 typedef struct GACommandState GACommandState;
23 
24 extern GAState *ga_state;
25 extern QmpCommandList ga_commands;
26 
27 GList *ga_command_blacklist_init(GList *blacklist);
28 void ga_command_state_init(GAState *s, GACommandState *cs);
29 void ga_command_state_add(GACommandState *cs,
30                           void (*init)(void),
31                           void (*cleanup)(void));
32 void ga_command_state_init_all(GACommandState *cs);
33 void ga_command_state_cleanup_all(GACommandState *cs);
34 GACommandState *ga_command_state_new(void);
35 void ga_command_state_free(GACommandState *cs);
36 bool ga_logging_enabled(GAState *s);
37 void ga_disable_logging(GAState *s);
38 void ga_enable_logging(GAState *s);
39 void GCC_FMT_ATTR(1, 2) slog(const gchar *fmt, ...);
40 void ga_set_response_delimited(GAState *s);
41 bool ga_is_frozen(GAState *s);
42 void ga_set_frozen(GAState *s);
43 void ga_unset_frozen(GAState *s);
44 const char *ga_fsfreeze_hook(GAState *s);
45 int64_t ga_get_fd_handle(GAState *s, Error **errp);
46 int ga_parse_whence(GuestFileWhence *whence, Error **errp);
47 
48 #ifndef _WIN32
49 void reopen_fd_to_null(int fd);
50 #endif
51 
52 #endif /* GUEST_AGENT_CORE_H */
53