| 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 | #ifdef _WIN32 |
| 17 | #include <pdh.h> |
| 18 | #endif |
| 19 | |
| 20 | #include "qapi/qmp-registry.h" |
| 21 | #include "qga-qapi-types.h" |
| 22 | |
| 23 | #define QGA_READ_COUNT_DEFAULT 4096 |
| 24 | |
| 25 | typedef struct GAState GAState; |
| 26 | typedef struct GACommandState GACommandState; |
| 27 | |
| 28 | extern GAState *ga_state; |
| 29 | extern QmpCommandList ga_commands; |
| 30 | |
| 31 | GList *ga_command_init_blockedrpcs(GList *blockedrpcs); |
| 32 | void ga_command_state_init(GAState *s, GACommandState *cs); |
| 33 | void ga_command_state_add(GACommandState *cs, |
| 34 | void (*init)(void), |
| 35 | void (*cleanup)(void)); |
| 36 | void ga_command_state_init_all(GACommandState *cs); |
| 37 | void ga_command_state_cleanup_all(GACommandState *cs); |
| 38 | GACommandState *ga_command_state_new(void); |
| 39 | void ga_command_state_free(GACommandState *cs); |
| 40 | bool ga_logging_enabled(GAState *s); |
| 41 | void ga_disable_logging(GAState *s); |
| 42 | void ga_enable_logging(GAState *s); |
| 43 | void G_GNUC_PRINTF(1, 2) slog(const gchar *fmt, ...); |
| 44 | void ga_set_response_delimited(GAState *s); |
| 45 | bool ga_is_frozen(GAState *s); |
| 46 | void ga_set_frozen(GAState *s); |
| 47 | void ga_unset_frozen(GAState *s); |
| 48 | #ifdef _WIN32 |
| 49 | void ga_set_load_avg_event(GAState *s, HANDLE event); |
| 50 | void ga_set_load_avg_wait_handle(GAState *s, HANDLE wait_handle); |
| 51 | void ga_set_load_avg_pdh_query(GAState *s, HQUERY query); |
| 52 | HQUERY ga_get_load_avg_pdh_query(GAState *s); |
| 53 | #endif |
| 54 | const char *ga_fsfreeze_hook(GAState *s); |
| 55 | int64_t ga_get_fd_handle(GAState *s, Error **errp); |
| 56 | int ga_parse_whence(GuestFileWhence *whence, Error **errp); |
| 57 | |
| 58 | #ifndef _WIN32 |
| 59 | void reopen_fd_to_null(int fd); |
| 60 | #endif |
| 61 | |
| 62 | #endif /* GUEST_AGENT_CORE_H */ |