diff options
author | Marc-André Lureau <marcandre.lureau@gmail.com> | 2014-10-24 16:59:30 +0200 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@gmail.com> | 2014-11-27 14:27:18 +0100 |
commit | 6f798ba1f75360e6c66260b0ac2de76efa0a7d1d (patch) | |
tree | 7cea10af758345cf11475b018b0b36d5488f36b3 /server/spice-char.h | |
parent | d26604ce65ff51e2820a27e16b62a2eb17ab994d (diff) | |
download | spice-6f798ba1f75360e6c66260b0ac2de76efa0a7d1d.tar.gz spice-6f798ba1f75360e6c66260b0ac2de76efa0a7d1d.tar.xz spice-6f798ba1f75360e6c66260b0ac2de76efa0a7d1d.zip |
Split spice.h
Make it easier to read the Spice server API.
Diffstat (limited to 'server/spice-char.h')
-rw-r--r-- | server/spice-char.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/server/spice-char.h b/server/spice-char.h new file mode 100644 index 00000000..efd685de --- /dev/null +++ b/server/spice-char.h @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2009-2014 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef SPICE_CHAR_H_ +#define SPICE_CHAR_H_ + +#if !defined(SPICE_H_INSIDE) && !defined(SPICE_SERVER_INTERNAL) +#error "Only spice.h can be included directly." +#endif + +#include "spice-core.h" + +/* char device interfaces */ + +#define SPICE_INTERFACE_CHAR_DEVICE "char_device" +#define SPICE_INTERFACE_CHAR_DEVICE_MAJOR 1 +#define SPICE_INTERFACE_CHAR_DEVICE_MINOR 3 +typedef struct SpiceCharDeviceInterface SpiceCharDeviceInterface; +typedef struct SpiceCharDeviceInstance SpiceCharDeviceInstance; +typedef struct SpiceCharDeviceState SpiceCharDeviceState; + +typedef enum { + SPICE_CHAR_DEVICE_NOTIFY_WRITABLE = 1 << 0, +} spice_char_device_flags; + +struct SpiceCharDeviceInterface { + SpiceBaseInterface base; + + void (*state)(SpiceCharDeviceInstance *sin, int connected); + int (*write)(SpiceCharDeviceInstance *sin, const uint8_t *buf, int len); + int (*read)(SpiceCharDeviceInstance *sin, uint8_t *buf, int len); + void (*event)(SpiceCharDeviceInstance *sin, uint8_t event); + spice_char_device_flags flags; +}; + +struct SpiceCharDeviceInstance { + SpiceBaseInstance base; + const char* subtype; + SpiceCharDeviceState *st; + const char* portname; +}; + +void spice_server_char_device_wakeup(SpiceCharDeviceInstance *sin); +void spice_server_port_event(SpiceCharDeviceInstance *char_device, uint8_t event); +const char** spice_server_char_device_recognized_subtypes(void); + +#endif /* SPICE_CHAR_H_ */ |