]> git.proxmox.com Git - qemu-server.git/blob - qmeventd.h
cfg2cmd tests: config with q35, pci passthrough, NUMA, EFI
[qemu-server.git] / qmeventd.h
1 /*
2
3 Copyright (C) 2018 Proxmox Server Solutions GmbH
4
5 Copyright: qemumonitor is under GNU GPL, the GNU General Public License.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; version 2 dated June, 1991.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19 02111-1307, USA.
20
21 Author: Dominik Csapak <d.csapak@proxmox.com>
22 */
23
24 #define VERBOSE_PRINT(...) do { if (verbose) { printf(__VA_ARGS__); } } while (0)
25
26 static inline void log_neg(int errval, const char *msg)
27 {
28 if (errval < 0) {
29 perror(msg);
30 }
31 }
32
33 static inline void bail_neg(int errval, const char *msg)
34 {
35 if (errval < 0) {
36 perror(msg);
37 exit(EXIT_FAILURE);
38 }
39 }
40
41 struct Client {
42 char buf[4096];
43 char vmid[16];
44 int fd;
45 pid_t pid;
46 unsigned int buflen;
47 unsigned short graceful;
48 unsigned short guest;
49 };
50
51 void handle_qmp_handshake(struct Client *client);
52 void handle_qmp_event(struct Client *client, struct json_object *obj);
53 void handle_client(struct Client *client);
54 void add_new_client(int client_fd);
55 void cleanup_client(struct Client *client);