xref: /openbmc/qemu/qga/channel.h (revision 586ef5de)
1125b310eSMichael Roth /*
2125b310eSMichael Roth  * QEMU Guest Agent channel declarations
3125b310eSMichael Roth  *
4125b310eSMichael Roth  * Copyright IBM Corp. 2012
5125b310eSMichael Roth  *
6125b310eSMichael Roth  * Authors:
7125b310eSMichael Roth  *  Michael Roth      <mdroth@linux.vnet.ibm.com>
8125b310eSMichael Roth  *
9125b310eSMichael Roth  * This work is licensed under the terms of the GNU GPL, version 2 or later.
10125b310eSMichael Roth  * See the COPYING file in the top-level directory.
11125b310eSMichael Roth  */
12125b310eSMichael Roth #ifndef QGA_CHANNEL_H
13125b310eSMichael Roth #define QGA_CHANNEL_H
14125b310eSMichael Roth 
15125b310eSMichael Roth 
16125b310eSMichael Roth typedef struct GAChannel GAChannel;
17125b310eSMichael Roth 
18125b310eSMichael Roth typedef enum {
19125b310eSMichael Roth     GA_CHANNEL_VIRTIO_SERIAL,
20125b310eSMichael Roth     GA_CHANNEL_ISA_SERIAL,
21125b310eSMichael Roth     GA_CHANNEL_UNIX_LISTEN,
22*586ef5deSStefan Hajnoczi     GA_CHANNEL_VSOCK_LISTEN,
23125b310eSMichael Roth } GAChannelMethod;
24125b310eSMichael Roth 
25125b310eSMichael Roth typedef gboolean (*GAChannelCallback)(GIOCondition condition, gpointer opaque);
26125b310eSMichael Roth 
27125b310eSMichael Roth GAChannel *ga_channel_new(GAChannelMethod method, const gchar *path,
28125b310eSMichael Roth                           GAChannelCallback cb, gpointer opaque);
29125b310eSMichael Roth void ga_channel_free(GAChannel *c);
30125b310eSMichael Roth GIOStatus ga_channel_read(GAChannel *c, gchar *buf, gsize size, gsize *count);
31125b310eSMichael Roth GIOStatus ga_channel_write_all(GAChannel *c, const gchar *buf, gsize size);
32125b310eSMichael Roth 
33125b310eSMichael Roth #endif
34