xref: /openbmc/qemu/qga/channel.h (revision 98c710f2d5cdf37f29a267352eb1f3c28cbf369d)
1*125b310eSMichael Roth /*
2*125b310eSMichael Roth  * QEMU Guest Agent channel declarations
3*125b310eSMichael Roth  *
4*125b310eSMichael Roth  * Copyright IBM Corp. 2012
5*125b310eSMichael Roth  *
6*125b310eSMichael Roth  * Authors:
7*125b310eSMichael Roth  *  Michael Roth      <mdroth@linux.vnet.ibm.com>
8*125b310eSMichael Roth  *
9*125b310eSMichael Roth  * This work is licensed under the terms of the GNU GPL, version 2 or later.
10*125b310eSMichael Roth  * See the COPYING file in the top-level directory.
11*125b310eSMichael Roth  */
12*125b310eSMichael Roth #ifndef QGA_CHANNEL_H
13*125b310eSMichael Roth #define QGA_CHANNEL_H
14*125b310eSMichael Roth 
15*125b310eSMichael Roth 
16*125b310eSMichael Roth typedef struct GAChannel GAChannel;
17*125b310eSMichael Roth 
18*125b310eSMichael Roth typedef enum {
19*125b310eSMichael Roth     GA_CHANNEL_VIRTIO_SERIAL,
20*125b310eSMichael Roth     GA_CHANNEL_ISA_SERIAL,
21*125b310eSMichael Roth     GA_CHANNEL_UNIX_LISTEN,
22*125b310eSMichael Roth     GA_CHANNEL_VSOCK_LISTEN,
23*125b310eSMichael Roth } GAChannelMethod;
24*125b310eSMichael Roth 
25*125b310eSMichael Roth typedef gboolean (*GAChannelCallback)(GIOCondition condition, gpointer opaque);
26*125b310eSMichael Roth 
27*125b310eSMichael Roth GAChannel *ga_channel_new(GAChannelMethod method, const gchar *path,
28*125b310eSMichael Roth                           int listen_fd, GAChannelCallback cb,
29*125b310eSMichael Roth                           gpointer opaque);
30*125b310eSMichael Roth void ga_channel_free(GAChannel *c);
31*125b310eSMichael Roth GIOStatus ga_channel_read(GAChannel *c, gchar *buf, gsize size, gsize *count);
32*125b310eSMichael Roth GIOStatus ga_channel_write_all(GAChannel *c, const gchar *buf, gsize size);
33 
34 #endif
35