diff options
-rw-r--r-- | AUTHORS | 0 | ||||
-rw-r--r-- | COPYING | 25 | ||||
-rw-r--r-- | ChangeLog | 0 | ||||
-rw-r--r-- | Makefile.am | 24 | ||||
-rw-r--r-- | NEWS | 150 | ||||
-rw-r--r-- | README | 0 | ||||
-rwxr-xr-x | autogen.sh | 19 | ||||
-rw-r--r-- | configure.ac | 21 | ||||
-rw-r--r-- | git.mk | 227 | ||||
-rw-r--r-- | includes.sed | 8 | ||||
-rwxr-xr-x | rename-identifiers.sh | 9 | ||||
-rw-r--r-- | renames | 522 | ||||
-rw-r--r-- | spice-protocol.pc.in | 9 | ||||
-rw-r--r-- | spice/Makefile.am | 24 | ||||
-rw-r--r-- | spice/barrier.h | 55 | ||||
-rw-r--r-- | spice/controller_prot.h | 124 | ||||
-rw-r--r-- | spice/end-packed.h | 38 | ||||
-rw-r--r-- | spice/enums.h | 649 | ||||
-rw-r--r-- | spice/error_codes.h | 51 | ||||
-rw-r--r-- | spice/foreign_menu_prot.h | 104 | ||||
-rw-r--r-- | spice/ipc_ring.h | 136 | ||||
-rw-r--r-- | spice/macros.h | 362 | ||||
-rw-r--r-- | spice/protocol.h | 152 | ||||
-rw-r--r-- | spice/qxl_dev.h | 781 | ||||
-rw-r--r-- | spice/qxl_windows.h | 21 | ||||
-rw-r--r-- | spice/start-packed.h | 64 | ||||
-rw-r--r-- | spice/stats.h | 67 | ||||
-rw-r--r-- | spice/types.h | 41 | ||||
-rw-r--r-- | spice/vd_agent.h | 260 | ||||
-rw-r--r-- | spice/vdi_dev.h | 86 |
30 files changed, 4029 insertions, 0 deletions
@@ -0,0 +1,25 @@ +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS +IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/ChangeLog diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..d2e49a4 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,24 @@ +NULL = +SUBDIRS = spice + +pkgconfigdir = $(datadir)/pkgconfig +pkgconfig_DATA = spice-protocol.pc + +MAINTAINERCLEANFILES = \ + $(srcdir)/INSTALL \ + $(srcdir)/aclocal.m4 \ + $(srcdir)/autoscan.log \ + $(srcdir)/compile \ + $(srcdir)/config.guess \ + $(srcdir)/config.h.in \ + $(srcdir)/config.sub \ + $(srcdir)/configure.scan \ + $(srcdir)/depcomp \ + $(srcdir)/install-sh \ + $(srcdir)/ltmain.sh \ + $(srcdir)/missing \ + $(srcdir)/mkinstalldirs \ + `find "$(srcdir)" -type f -name Makefile.in -print` \ + $(NULL) + +-include $(top_srcdir)/git.mk @@ -0,0 +1,150 @@ +Major changes in 0.12.9 +======================= +* rename newly introduced SpiceImageCompress enum to SpiceImageCompression + as otherwise it was clashing with the definition used by older spice-server + releases, breaking QEMU build + +Major changes in 0.12.8 +======================= +* add LZ4 support +* add audio volume synchronization +* deprecate unused vdi-dev +* add 'preferred-compression' message/capability +* add a new Windows driver escape code to send + monitors capability from guest to client + +Major changes in 0.12.7 +======================= +* add support for Webdav channel +* add support for the Opus codec + +Major changes in 0.12.6 +======================= +* add adaptive video streaming support: + control playback latency and receive playback + reports from the client. +* add agent capabilities for signaling guest line ending. + +Major changes in 0.12.5 +======================= +* Add agent file xfer success status +* Add a client-disconnected agent message + +Major changes in 0.12.4 +======================= +* Add agent file copy support. +* Add agent sparse monitors capability. +* Add controller proxy message. + +Major changes in 0.12.3 +======================= +* Add a generic "port" channel + +Major changes in 0.12.2 +======================= +* Add A8 surface capability in display channel. +* Add to qxl device support for: + * client present + * client capabilities + * client monitors configuration + +Major changes in 0.12.1 +======================= +* Support seamless migration. +* New QXLComposite message for better X support. +* Support arbitrary scancode message INPUTS_KEY_SCANCODE. + +Major changes in 0.12.0 +======================= +* Add support for arbitrary resolution on Windows QXL with + QXL_ESCAPE_SET_CUSTOM_DISPLAY +* Add support for arbitrary resolution and multiple monitor per + display channel with QXLMonitorsConfig and co +* build cleanup + +Major changes in 0.10.3 (0.10.2 was never released) +=================================================== +* Add support for video streams with differently sized (wxh) data +* Add controller messages for USB redirection, COLOR_DEPTH, DISABLE_EFFECTS, + and ENABLE_SMARTCARD +* Add name & uuid messages on main channel +* some cleanups +* Fixes RHBZ#815422, RHBZ#807295, RHBZ#787447 + +Major changes in 0.10.1 +======================= +* Add support for a header without sublist and serial (mini header) + +Major changes in 0.10.0 +======================= +* no changes, released to match version with spice + +Major changes in 0.9.1 (same as 0.8.2 in 0.8 branch) +====================== +* Add support for semi-seamless migration + +Major changes in 0.9.0 +====================== +* Add support for generic spicevmc chardev passthrough messages +* Add USB redirection channel + +Major changes in 0.8.1 +====================== +* Add support for volume change +* Add support for async guest io writes and interrupt +* Add support for suspend related guest io writes +* Add support for interrupt indicating guest bug + +Major changes in 0.8.0 +====================== +* Add support for different clipboards (selections) to vd_agent copy paste +* Add support for using different authentication mechanisms (just SASL for now) + +Major changes in 0.7.1 +====================== +* Add some enums for the xorg qxl driver +* Some other small fixes + +Major changes in 0.7.0 +====================== +* Add smartcard channel + +Major changes in 0.6.4 +====================== +* Make controller client protocol menu text UTF8 rather then 16 bit unicode + +Major changes in 0.6.3: +======================= +* Add support for copy and paste to the agent protocol +* Add foreign-menu and external controller client protocol headers + +Major changes in 0.6.2: +======================= +* Skipped to stay in sync with spice + +Major changes in 0.6.1: +======================= +* Added compat flag for 16bpp commands + +Major changes in 0.6.0: +======================= +* Initial messages for clipboard sharing +* Move agent protocol structs from spice to spice-protocol +* Add capabilities to agent protocol + +Major changes in 0.5.3: +======================= + +Network major number changed to 2 to reflect that the network +protocol is now stable and backwards compatible from this point. + +Some vdagent messages for display settings and clipboard sharing +were added. + +Major changes in 0.5.2: +======================= + +This is the first release of the unstable 0.5.x series leading up to 0.6. +This module was split out of spice so that e.g. drivers and qemu can +get the types and constants they need without using the full spice +codebase. diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..de6881d --- /dev/null +++ b/autogen.sh @@ -0,0 +1,19 @@ +#! /bin/sh + +set -e # exit on errors + +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. + + +( + cd "$srcdir" + autoreconf --verbose --force --install +) + +CONFIGURE_ARGS="--enable-maintainer-mode" + +if [ -z "$NOCONFIGURE" ]; then + echo "Running configure with $CONFIGURE_ARGS $@" + "$srcdir/configure" $CONFIGURE_ARGS "$@" +fi diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..ece6672 --- /dev/null +++ b/configure.ac @@ -0,0 +1,21 @@ +AC_PREREQ([2.57]) + +m4_define([SPICE_MAJOR], 0) +m4_define([SPICE_MINOR], 12) +m4_define([SPICE_MICRO], 10) + +AC_INIT(spice-protocol, [SPICE_MAJOR.SPICE_MINOR.SPICE_MICRO], [], spice-protocol) + +AC_CONFIG_MACRO_DIR([m4]) +AM_CONFIG_HEADER([config.h]) + +AM_INIT_AUTOMAKE([dist-bzip2]) +AM_MAINTAINER_MODE + +m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) + +AC_OUTPUT([ +Makefile +spice-protocol.pc +spice/Makefile +]) @@ -0,0 +1,227 @@ +# git.mk +# +# Copyright 2009, Red Hat, Inc. +# Copyright 2010,2011 Behdad Esfahbod +# Written by Behdad Esfahbod +# +# Copying and distribution of this file, with or without modification, +# is permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. +# +# The latest version of this file can be downloaded from: +# https://raw.github.com/behdad/git.mk/master/git.mk +# Bugs, etc, should be reported upstream at: +# https://github.com/behdad/git.mk +# +# To use in your project, import this file in your git repo's toplevel, +# then do "make -f git.mk". This modifies all Makefile.am files in +# your project to -include git.mk. Remember to add that line to new +# Makefile.am files you create in your project, or just rerun the +# "make -f git.mk". +# +# This enables automatic .gitignore generation. If you need to ignore +# more files, add them to the GITIGNOREFILES variable in your Makefile.am. +# But think twice before doing that. If a file has to be in .gitignore, +# chances are very high that it's a generated file and should be in one +# of MOSTLYCLEANFILES, CLEANFILES, DISTCLEANFILES, or MAINTAINERCLEANFILES. +# +# The only case that you need to manually add a file to GITIGNOREFILES is +# when remove files in one of mostlyclean-local, clean-local, distclean-local, +# or maintainer-clean-local make targets. +# +# Note that for files like editor backup, etc, there are better places to +# ignore them. See "man gitignore". +# +# If "make maintainer-clean" removes the files but they are not recognized +# by this script (that is, if "git status" shows untracked files still), send +# me the output of "git status" as well as your Makefile.am and Makefile for +# the directories involved and I'll diagnose. +# +# For a list of toplevel files that should be in MAINTAINERCLEANFILES, see +# Makefile.am.sample in the git.mk git repo. +# +# Don't EXTRA_DIST this file. It is supposed to only live in git clones, +# not tarballs. It serves no useful purpose in tarballs and clutters the +# build dir. +# +# This file knows how to handle autoconf, automake, libtool, gtk-doc, +# gnome-doc-utils, yelp.m4, mallard, intltool, gsettings, dejagnu. +# +# This makefile provides the following targets: +# +# - all: "make all" will build all gitignore files. +# - gitignore: makes all gitignore files in the current dir and subdirs. +# - .gitignore: make gitignore file for the current dir. +# - gitignore-recurse: makes all gitignore files in the subdirs. +# +# KNOWN ISSUES: +# +# - Recursive configure doesn't work as $(top_srcdir)/git.mk inside the +# submodule doesn't find us. If you have configure.{in,ac} files in +# subdirs, add a proxy git.mk file in those dirs that simply does: +# "include $(top_srcdir)/../git.mk". Add more ..'s to your taste. +# And add those files to git. See vte/gnome-pty-helper/git.mk for +# example. +# + +git-all: git-mk-install + +git-mk-install: + @echo Installing git makefile + @any_failed=; \ + find "`test -z "$(top_srcdir)" && echo . || echo "$(top_srcdir)"`" -name Makefile.am | while read x; do \ + if grep 'include .*/git.mk' $$x >/dev/null; then \ + echo $$x already includes git.mk; \ + else \ + failed=; \ + echo "Updating $$x"; \ + { cat $$x; \ + echo ''; \ + echo '-include $$(top_srcdir)/git.mk'; \ + } > $$x.tmp || failed=1; \ + if test x$$failed = x; then \ + mv $$x.tmp $$x || failed=1; \ + fi; \ + if test x$$failed = x; then : else \ + echo Failed updating $$x; >&2 \ + any_failed=1; \ + fi; \ + fi; done; test -z "$$any_failed" + +.PHONY: git-all git-mk-install + + +### .gitignore generation + +$(srcdir)/.gitignore: Makefile.am $(top_srcdir)/git.mk + $(AM_V_GEN) \ + { \ + if test "x$(DOC_MODULE)" = x -o "x$(DOC_MAIN_SGML_FILE)" = x; then :; else \ + for x in \ + $(DOC_MODULE)-decl-list.txt \ + $(DOC_MODULE)-decl.txt \ + tmpl/$(DOC_MODULE)-unused.sgml \ + "tmpl/*.bak" \ + xml html \ + ; do echo /$$x; done; \ + fi; \ + if test "x$(DOC_MODULE)$(DOC_ID)" = x -o "x$(DOC_LINGUAS)" = x; then :; else \ + for lc in $(DOC_LINGUAS); do \ + for x in \ + $(if $(DOC_MODULE),$(DOC_MODULE).xml) \ + $(DOC_PAGES) \ + $(DOC_INCLUDES) \ + ; do echo /$$lc/$$x; done; \ + done; \ + for x in \ + $(_DOC_OMF_ALL) \ + $(_DOC_DSK_ALL) \ + $(_DOC_HTML_ALL) \ + $(_DOC_MOFILES) \ + $(DOC_H_FILE) \ + "*/.xml2po.mo" \ + "*/*.omf.out" \ + ; do echo /$$x; done; \ + fi; \ + if test "x$(HELP_ID)" = x -o "x$(HELP_LINGUAS)" = x; then :; else \ + for lc in $(HELP_LINGUAS); do \ + for x in \ + $(HELP_FILES) \ + "$$lc.stamp" \ + "$$lc.mo" \ + ; do echo /$$lc/$$x; done; \ + done; \ + fi; \ + if test "x$(gsettings_SCHEMAS)" = x; then :; else \ + for x in \ + $(gsettings_SCHEMAS:.xml=.valid) \ + $(gsettings__enum_file) \ + ; do echo /$$x; done; \ + fi; \ + if test -f $(srcdir)/po/Makefile.in.in; then \ + for x in \ + po/Makefile.in.in \ + po/Makefile.in \ + po/Makefile \ + po/POTFILES \ + po/stamp-it \ + po/.intltool-merge-cache \ + "po/*.gmo" \ + "po/*.mo" \ + po/$(GETTEXT_PACKAGE).pot \ + intltool-extract.in \ + intltool-merge.in \ + intltool-update.in \ + ; do echo /$$x; done; \ + fi; \ + if test -f $(srcdir)/configure; then \ + for x in \ + autom4te.cache \ + configure \ + config.h \ + stamp-h1 \ + libtool \ + config.lt \ + ; do echo /$$x; done; \ + fi; \ + if test "x$(DEJATOOL)" = x; then :; else \ + for x in \ + $(DEJATOOL) \ + ; do echo /$$x.sum; echo /$$x.log; done; \ + echo /site.exp; \ + fi; \ + for x in \ + .gitignore \ + $(GITIGNOREFILES) \ + $(CLEANFILES) \ + $(PROGRAMS) $(check_PROGRAMS) $(EXTRA_PROGRAMS) \ + $(LIBRARIES) $(check_LIBRARIES) $(EXTRA_LIBRARIES) \ + $(LTLIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LTLIBRARIES) \ + so_locations \ + .libs _libs \ + $(MOSTLYCLEANFILES) \ + "*.$(OBJEXT)" \ + "*.lo" \ + $(DISTCLEANFILES) \ + $(am__CONFIG_DISTCLEAN_FILES) \ + $(CONFIG_CLEAN_FILES) \ + TAGS ID GTAGS GRTAGS GSYMS GPATH tags \ + "*.tab.c" \ + $(MAINTAINERCLEANFILES) \ + $(BUILT_SOURCES) \ + $(DEPDIR) \ + Makefile \ + Makefile.in \ + "*.orig" \ + "*.rej" \ + "*.bak" \ + "*~" \ + ".*.sw[nop]" \ + ".dirstamp" \ + ; do echo /$$x; done; \ + } | \ + sed "s@^/`echo "$(srcdir)" | sed 's/\(.\)/[\1]/g'`/@/@" | \ + sed 's@/[.]/@/@g' | \ + LC_ALL=C sort | uniq > $@.tmp && \ + mv $@.tmp $@; + +all: $(srcdir)/.gitignore gitignore-recurse-maybe +gitignore: $(srcdir)/.gitignore gitignore-recurse + +gitignore-recurse-maybe: + @for subdir in $(DIST_SUBDIRS); do \ + case " $(SUBDIRS) " in \ + *" $$subdir "*) :;; \ + *) test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) .gitignore gitignore-recurse-maybe || echo "Skipping $$subdir");; \ + esac; \ + done +gitignore-recurse: + @for subdir in $(DIST_SUBDIRS); do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) .gitignore gitignore-recurse || echo "Skipping $$subdir"); \ + done + +maintainer-clean: gitignore-clean +gitignore-clean: + -rm -f $(srcdir)/.gitignore + +.PHONY: gitignore-clean gitignore gitignore-recurse gitignore-recurse-maybe diff --git a/includes.sed b/includes.sed new file mode 100644 index 0000000..f357b7a --- /dev/null +++ b/includes.sed @@ -0,0 +1,8 @@ +s#\"qxl_dev\.h\"#<spice/qxl_dev\.h># +s#\"draw\.h\"#<spice/draw\.h># +s#\"ipc_ring\.h\"#<spice/ipc_ring\.h># +s#\"red\.h\"#<spice/protocol\.h># +s#\"red_error_codes\.h\"#<spice/error_codes\.h># +s#\"reds_stat\.h\"#<spice/stats\.h># +s#\"vd_agent\.h\"#<spice/vd_agent\.h># +s#\"vdi_dev\.h\"#<spice/vdi_dev\.h># diff --git a/rename-identifiers.sh b/rename-identifiers.sh new file mode 100755 index 0000000..7c1a2ef --- /dev/null +++ b/rename-identifiers.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +SEDFILE=`mktemp` + +awk '$0 !~ /^#.*/ && (NF == 2) { print "s/\\(^\\|[^A-Za-z_]\\)\\(" $1 "\\)\\($\\|[^A-Za-z0-9_]\\)/\\1" $2 "\\3/g" }' $1 > $SEDFILE + +shift +sed -f $SEDFILE -i $* +rm $SEDFILE @@ -0,0 +1,522 @@ +RED_MAGIC SPICE_MAGIC +RED_VERSION_MAJOR SPICE_VERSION_MAJOR +RED_VERSION_MINOR SPICE_VERSION_MINOR + +RED_MAX_PASSWORD_LENGTH SPICE_MAX_PASSWORD_LENGTH +RED_TICKET_KEY_PAIR_LENGTH SPICE_TICKET_KEY_PAIR_LENGTH +RED_TICKET_PUBKEY_BYTES SPICE_TICKET_PUBKEY_BYTES + +# Channel types +RED_CHANNEL_MAIN SPICE_CHANNEL_MAIN +RED_CHANNEL_DISPLAY SPICE_CHANNEL_DISPLAY +RED_CHANNEL_INPUTS SPICE_CHANNEL_INPUTS +RED_CHANNEL_CURSOR SPICE_CHANNEL_CURSOR +RED_CHANNEL_PLAYBACK SPICE_CHANNEL_PLAYBACK +RED_CHANNEL_RECORD SPICE_CHANNEL_RECORD +RED_CHANNEL_TUNNEL SPICE_CHANNEL_TUNNEL +RED_CHANNEL_END SPICE_END_CHANNEL + + +RED_ERR_OK SPICE_LINK_ERR_OK +RED_ERR_ERROR SPICE_LINK_ERR_ERROR +RED_ERR_INVALID_MAGIC SPICE_LINK_ERR_INVALID_MAGIC +RED_ERR_INVALID_DATA SPICE_LINK_ERR_INVALID_DATA +RED_ERR_VERSION_MISMATCH SPICE_LINK_ERR_VERSION_MISMATCH +RED_ERR_NEED_SECURED SPICE_LINK_ERR_NEED_SECURED +RED_ERR_NEED_UNSECURED SPICE_LINK_ERR_NEED_UNSECURED +RED_ERR_PERMISSION_DENIED SPICE_LINK_ERR_PERMISSION_DENIED +RED_ERR_BAD_CONNECTION_ID SPICE_LINK_ERR_BAD_CONNECTION_ID +RED_ERR_CHANNEL_NOT_AVAILABLE SPICE_LINK_ERR_CHANNEL_NOT_AVAILABLE +RED_ERR_ SPICE_ERR_ + +RED_WARN_GENERAL SPICE_WARN_GENERAL +RED_INFO_GENERAL SPICE_INFO_GENERAL +RedLinkHeader SpiceLinkHeader +RedLinkMess SpiceLinkMess +RedLinkReply SpiceLinkReply +RedLinkEncryptedTicket SpiceLinkEncryptedTicket +RedDataHeader SpiceDataHeader +RedSubMessage SpicedSubMessage +RedSubMessageList SpiceSubMessageList + +RED_MIGRATE SPICE_MSG_MIGRATE +RED_MIGRATE_DATA SPICE_MSG_MIGRATE_DATA +RED_SET_ACK SPICE_MSG_SET_ACK +RED_PING SPICE_MSG_PING +RED_WAIT_FOR_CHANNELS SPICE_MSG_WAIT_FOR_CHANNELS +RED_DISCONNECTING SPICE_MSG_DISCONNECTING +RED_NOTIFY SPICE_MSG_NOTIFY +RED_FIRST_AVAIL_MESSAGE SPICE_MSG_FIRST_AVAIL + +REDC_ACK_SYNC SPICE_MSGC_ACK_SYNC +REDC_ACK SPICE_MSGC_ACK +REDC_PONG SPICE_MSGC_PONG +REDC_MIGRATE_FLUSH_MARK SPICE_MSGC_MIGRATE_FLUSH_MARK +REDC_MIGRATE_DATA SPICE_MSGC_MIGRATE_DATA +REDC_DISCONNECTING SPICE_MSGC_DISCONNECTING +REDC_FIRST_AVAIL_MESSAGE SPICE_MSGC_FIRST_AVAIL + +RED_MIGRATE_BEGIN SPICE_MSG_MAIN_MIGRATE_BEGIN +RED_MIGRATE_CANCEL SPICE_MSG_MAIN_MIGRATE_CANCEL +RED_INIT SPICE_MSG_MAIN_INIT +RED_CHANNELS_LIST SPICE_MSG_MAIN_CHANNELS_LIST +RED_MOUSE_MODE SPICE_MSG_MAIN_MOUSE_MODE +RED_MULTI_MEDIA_TIME SPICE_MSG_MAIN_MULTI_MEDIA_TIME +RED_AGENT_CONNECTED SPICE_MSG_MAIN_AGENT_CONNECTED +RED_AGENT_DISCONNECTED SPICE_MSG_MAIN_AGENT_DISCONNECTED +RED_AGENT_DATA SPICE_MSG_MAIN_AGENT_DATA +RED_AGENT_TOKEN SPICE_MSG_MAIN_AGENT_TOKEN +RED_MESSAGES_END SPICE_MSG_END_MAIN + +REDC_CLIENT_INFO SPICE_MSGC_MAIN_CLIENT_INFO +REDC_MIGRATE_CONNECTED SPICE_MSGC_MAIN_MIGRATE_CONNECTED +REDC_MIGRATE_CONNECT_ERROR SPICE_MSGC_MAIN_MIGRATE_CONNECT_ERROR +REDC_ATTACH_CHANNELS SPICE_MSGC_MAIN_ATTACH_CHANNELS +REDC_MOUSE_MODE_REQUEST SPICE_MSGC_MAIN_MOUSE_MODE_REQUEST +REDC_AGENT_START SPICE_MSGC_MAIN_AGENT_START +REDC_AGENT_DATA SPICE_MSGC_MAIN_AGENT_DATA +REDC_AGENT_TOKEN SPICE_MSGC_MAIN_AGENT_TOKEN + +RED_INPUTS_INIT SPICE_MSG_INPUTS_INIT +RED_INPUTS_KEY_MODIFAIERS SPICE_MSG_INPUTS_KEY_MODIFIERS +RED_INPUTS_MOUSE_MOTION_ACK SPICE_MSG_INPUTS_MOUSE_MOTION_ACK +RED_INPUTS_MESSAGES_END SPICE_MSG_END_INPUTS + +RED_MOTION_ACK_BUNCH SPICE_INPUT_MOTION_ACK_BUNCH + +RED_SCROLL_LOCK_MODIFIER SPICE_SCROLL_LOCK_MODIFIER +RED_NUM_LOCK_MODIFIER SPICE_NUM_LOCK_MODIFIER +RED_CAPS_LOCK_MODIFIER SPICE_CAPS_LOCK_MODIFIER + +RedInputsInit SpiceMsgInputsInit +RedKeyModifiers SpiceMsgInputsKeyModifiers +RedMultiMediaTime SpiceMsgMainMultiMediaTime + +RED_PUBKEY_TYPE_INVALID SPICE_PUBKEY_TYPE_INVALID +RED_PUBKEY_TYPE_RSA SPICE_PUBKEY_TYPE_RSA +RED_PUBKEY_TYPE_RSA2 SPICE_PUBKEY_TYPE_RSA2 +RED_PUBKEY_TYPE_DSA SPICE_PUBKEY_TYPE_DSA +RED_PUBKEY_TYPE_DSA1 SPICE_PUBKEY_TYPE_DSA1 +RED_PUBKEY_TYPE_DSA2 SPICE_PUBKEY_TYPE_DSA2 +RED_PUBKEY_TYPE_DSA3 SPICE_PUBKEY_TYPE_DSA3 +RED_PUBKEY_TYPE_DSA4 SPICE_PUBKEY_TYPE_DSA4 +RED_PUBKEY_TYPE_DH SPICE_PUBKEY_TYPE_DH +RED_PUBKEY_TYPE_EC SPICE_PUBKEY_TYPE_EC + +RedMigrationBegin SpiceMsgMainMigrationBegin + +RED_MIGRATE_NEED_FLUSH SPICE_MIGRATE_NEED_FLUSH +RED_MIGRATE_NEED_DATA_TRANSFER SPICE_MIGRATE_NEED_DATA_TRANSFER + +RED_RES_TYPE_INVALID SPICE_RES_TYPE_INVALID +RED_RES_TYPE_PIXMAP SPICE_RES_TYPE_PIXMAP + +RedResorceID SpiceResorceID +RedResorceList SpiceResorceList +RedSetAck SpiceMsgSetAck +RedWaitForChannel SpiceWaitForChannel +RedWaitForChannels SpiceMsgWaitForChannels + +# This seems to have the wrong name compared to the protocol docs, fix +RedChannelInit SpiceChannelId + +RedMigrate SpiceMsgMigrate +RedInit SpiceMsgMainInit +RedDisconnect SpiceMsgDisconnect + +RED_NOTIFY_SEVERITY_INFO SPICE_NOTIFY_SEVERITY_INFO +RED_NOTIFY_SEVERITY_WARN SPICE_NOTIFY_SEVERITY_WARN +RED_NOTIFY_SEVERITY_ERROR SPICE_NOTIFY_SEVERITY_ERROR + +RED_NOTIFY_VISIBILITY_LOW SPICE_NOTIFY_VISIBILITY_LOW +RED_NOTIFY_VISIBILITY_MEDIUM SPICE_NOTIFY_VISIBILITY_MEDIUM +RED_NOTIFY_VISIBILITY_HIGH SPICE_NOTIFY_VISIBILITY_HIGH + +RedNotify SpiceMsgNotify +RedChannels SpiceMsgChannels +RedMouseMode SpiceMsgMainMouseMode +RedPing SpiceMsgPing + +RedAgentDisconnect SpiceMsgMainAgentDisconnect +RedAgentTokens SpiceMsgMainAgentTokens +RedcAgentTokens SpiceMsgcMainAgentTokens +RedcAgentStart SpiceMsgcMainAgentStart + +# This seem unused in the codebase??? +RedcClientInfo SpiceMsgcClientInfo + +RedcMouseModeRequest SpiceMsgcMainMouseModeRequest + +RED_AGENT_MAX_DATA_SIZE SPICE_AGENT_MAX_DATA_SIZE + +RED_DISPLAY_MODE SPICE_MSG_DISPLAY_MODE +RED_DISPLAY_MARK SPICE_MSG_DISPLAY_MARK +RED_DISPLAY_RESET SPICE_MSG_DISPLAY_RESET +RED_DISPLAY_COPY_BITS SPICE_MSG_DISPLAY_COPY_BITS +RED_DISPLAY_INVAL_LIST SPICE_MSG_DISPLAY_INVAL_LIST +RED_DISPLAY_INVAL_ALL_PIXMAPS SPICE_MSG_DISPLAY_INVAL_ALL_PIXMAPS +RED_DISPLAY_INVAL_PALETTE SPICE_MSG_DISPLAY_INVAL_PALETTE +RED_DISPLAY_INVAL_ALL_PALETTES SPICE_MSG_DISPLAY_INVAL_ALL_PALETTES +RED_DISPLAY_STREAM_CREATE SPICE_MSG_DISPLAY_STREAM_CREATE +RED_DISPLAY_STREAM_DATA SPICE_MSG_DISPLAY_STREAM_DATA +RED_DISPLAY_STREAM_CLIP SPICE_MSG_DISPLAY_STREAM_CLIP +RED_DISPLAY_STREAM_DESTROY SPICE_MSG_DISPLAY_STREAM_DESTROY +RED_DISPLAY_STREAM_DESTROY_ALL SPICE_MSG_DISPLAY_STREAM_DESTROY_ALL +RED_DISPLAY_DRAW_FILL SPICE_MSG_DISPLAY_DRAW_FILL +RED_DISPLAY_DRAW_OPAQUE SPICE_MSG_DISPLAY_DRAW_OPAQUE +RED_DISPLAY_DRAW_COPY SPICE_MSG_DISPLAY_DRAW_COPY +RED_DISPLAY_DRAW_BLEND SPICE_MSG_DISPLAY_DRAW_BLEND +RED_DISPLAY_DRAW_BLACKNESS SPICE_MSG_DISPLAY_DRAW_BLACKNESS +RED_DISPLAY_DRAW_WHITENESS SPICE_MSG_DISPLAY_DRAW_WHITENESS +RED_DISPLAY_DRAW_INVERS SPICE_MSG_DISPLAY_DRAW_INVERS +RED_DISPLAY_DRAW_ROP3 SPICE_MSG_DISPLAY_DRAW_ROP3 +RED_DISPLAY_DRAW_STROKE SPICE_MSG_DISPLAY_DRAW_STROKE +RED_DISPLAY_DRAW_TEXT SPICE_MSG_DISPLAY_DRAW_TEXT +RED_DISPLAY_DRAW_TRANSPARENT SPICE_MSG_DISPLAY_DRAW_TRANSPARENT +RED_DISPLAY_DRAW_ALPHA_BLEND SPICE_MSG_DISPLAY_DRAW_ALPHA_BLEND +RED_DISPLAY_MESSAGES_END SPICE_MSG_END_DISPLAY + + +RED_CURSOR_NONE SPICE_CURSOR_FLAGS_NONE +RED_CURSOR_CACHE_ME SPICE_CURSOR_FLAGS_CACHE_ME +RED_CURSOR_FROM_CACHE SPICE_CURSOR_FLAGS_FROM_CACHE + +RedCursor SpiceCursor +RedMode SpiceMsgDisplayMode + +RedDrawBase SpiceMsgDisplayBase +RedCopyBits SpiceMsgDisplayCopyBits +RedFill SpiceMsgDisplayDrawFill +RedOpaque SpiceMsgDisplayDrawOpaque +RedCopy SpiceMsgDisplayDrawCopy +RedTransparent SpiceMsgDisplayDrawTransparent +RedAlphaBlend SpiceMsgDisplayDrawAlphaBlend +RedBlend SpiceMsgDisplayDrawBlend +RedRop3 SpiceMsgDisplayDrawRop3 +RedBlackness SpiceMsgDisplayDrawBlackness +RedWhiteness SpiceMsgDisplayDrawWhiteness +RedInvers SpiceMsgDisplayDrawInvers +RedStroke SpiceMsgDisplayDrawStroke +RedText SpiceMsgDisplayDrawText +RedInvalOne SpiceMsgDisplayInvalOne + +RED_VIDEO_CODEC_TYPE_MJPEG SPICE_VIDEO_CODEC_TYPE_MJPEG +STREAM_TOP_DOWN SPICE_STREAM_FLAGS_TOP_DOWN + +RedStreamCreate SpiceMsgDisplayStreamCreate +RedStreamData SpiceMsgDisplayStreamData +RedStreamClip SpiceMsgDisplayStreamClip +RedStreamDestroy SpiceMsgDisplayStreamDestroy + + +RED_CURSOR_INIT SPICE_MSG_CURSOR_INIT +RED_CURSOR_RESET SPICE_MSG_CURSOR_RESET +RED_CURSOR_SET SPICE_MSG_CURSOR_SET +RED_CURSOR_MOVE SPICE_MSG_CURSOR_MOVE +RED_CURSOR_HIDE SPICE_MSG_CURSOR_HIDE +RED_CURSOR_TRAIL SPICE_MSG_CURSOR_TRAIL +RED_CURSOR_INVAL_ONE SPICE_MSG_CURSOR_INVAL_ONE +RED_CURSOR_INVAL_ALL SPICE_MSG_CURSOR_INVAL_ALL +RED_CURSOR_MESSAGES_END SPICE_MSG_END_CURSOR + +RedCursorInit SpiceMsgCursorInit +RedCursorSet SpiceMsgCursorSet +RedCursorMove SpiceMsgCursorMove +RedCursorTrail SpiceMsgCursorTrail + +REDC_DISPLAY_INIT SPICE_MSGC_DISPLAY_INIT +REDC_DISPLAY_MESSGES_END SPICE_MSGC_END_DISPLAY + +RedcDisplayInit SpiceMsgcDisplayInit + +REDC_INPUTS_KEY_DOWN SPICE_MSGC_INPUTS_KEY_DOWN +REDC_INPUTS_KEY_UP SPICE_MSGC_INPUTS_KEY_UP +REDC_INPUTS_KEY_MODIFAIERS SPICE_MSGC_INPUTS_KEY_MODIFIERS +REDC_INPUTS_MOUSE_MOTION SPICE_MSGC_INPUTS_MOUSE_MOTION +REDC_INPUTS_MOUSE_POSITION SPICE_MSGC_INPUTS_MOUSE_POSITION +REDC_INPUTS_MOUSE_PRESS SPICE_MSGC_INPUTS_MOUSE_PRESS +REDC_INPUTS_MOUSE_RELEASE SPICE_MSGC_INPUTS_MOUSE_RELEASE +REDC_INPUTS_MESSGES_END SPICE_MSGC_END_INPUTS_MESSGES + +RedcKeyDown SpiceMsgcKeyDown +RedcKeyUp SpiceMsgcKeyUp + +RED_MOUSE_MODE_SERVER SPICE_MOUSE_MODE_SERVER +RED_MOUSE_MODE_CLIENT SPICE_MOUSE_MODE_CLIENT + +RedcKeyModifiers SpiceMsgcKeyModifiers +RedButton SpiceMouseButton + +REDC_MOUSE_INVALID_BUTTON SPICE_MOUSE_BUTTON_INVALID +REDC_MOUSE_LBUTTON SPICE_MOUSE_BUTTON_LEFT +REDC_MOUSE_MBUTTON SPICE_MOUSE_BUTTON_MIDDLE +REDC_MOUSE_RBUTTON SPICE_MOUSE_BUTTON_RIGHT +REDC_MOUSE_UBUTTON SPICE_MOUSE_BUTTON_UP +REDC_MOUSE_DBUTTON SPICE_MOUSE_BUTTON_DOWN + +REDC_LBUTTON_MASK SPICE_MOUSE_BUTTON_MASK_LEFT +REDC_MBUTTON_MASK SPICE_MOUSE_BUTTON_MASK_MIDDLE +REDC_RBUTTON_MASK SPICE_MOUSE_BUTTON_MASK_RIGHT + +RedcMouseMotion SpiceMsgcMouseMotion +RedcMousePosition SpiceMsgcMousePosition +RedcMousePress SpiceMsgcMousePress +RedcMouseRelease SpiceMsgcMouseRelease + +RED_AUDIO_FMT_INVALD SPICE_AUDIO_FMT_INVALD +RED_AUDIO_FMT_S16 SPICE_AUDIO_FMT_S16 +RED_AUDIO_FMT_ SPICE_AUDIO_FMT_ + +RED_AUDIO_DATA_MODE_INVALD SPICE_AUDIO_DATA_MODE_INVALD +RED_AUDIO_DATA_MODE_RAW SPICE_AUDIO_DATA_MODE_RAW +RED_AUDIO_DATA_MODE_CELT_0_5_1 SPICE_AUDIO_DATA_MODE_CELT_0_5_1 +RED_AUDIO_DATA_MODE_ SPICE_AUDIO_DATA_MODE_ + +RED_PLAYBACK_DATA SPICE_MSG_PLAYBACK_DATA +RED_PLAYBACK_MODE SPICE_MSG_PLAYBACK_MODE +RED_PLAYBACK_START SPICE_MSG_PLAYBACK_START +RED_PLAYBACK_STOP SPICE_MSG_PLAYBACK_STOP +RED_PLAYBACK_MESSAGES_END SPICE_MSG_END_PLAYBACK + + +RED_PLAYBACK_CAP_CELT_0_5_1 SPICE_PLAYBACK_CAP_CELT_0_5_1 + +RED_RECORD_START SPICE_MSG_RECORD_START +RED_RECORD_STOP SPICE_MSG_RECORD_STOP +RED_RECORD_MESSAGES_END SPICE_MSG_END_RECORD + +RED_RECORD_CAP_CELT_0_5_1 SPICE_RECORD_CAP_CELT_0_5_1 + +RedPlaybackMode SpiceMsgPlaybackMode +RedPlaybackStart SpiceMsgPlaybackStart +RedPlaybackPacket SpiceMsgPlaybackPacket +RedRecordStart SpiceMsgRecordStart +RedcRecordMode SpiceMsgcRecordMode +RedcRecordPacket SpiceMsgcRecordPacket +RedcRecordStartMark SpiceMsgcRecordStartMark + +REDC_RECORD_DATA SPICE_MSGC_RECORD_DATA +REDC_RECORD_MODE SPICE_MSGC_RECORD_MODE +REDC_RECORD_START_MARK SPICE_MSGC_RECORD_START_MARK +REDC_RECORD_MESSAGES_END SPICE_MSGC_END_RECORD + +RED_TUNNEL_SERVICE_TYPE_INVALID SPICE_TUNNEL_SERVICE_TYPE_INVALID +RED_TUNNEL_SERVICE_TYPE_GENERIC SPICE_TUNNEL_SERVICE_TYPE_GENERIC +RED_TUNNEL_SERVICE_TYPE_IPP SPICE_TUNNEL_SERVICE_TYPE_IPP + +RED_TUNNEL_INIT SPICE_MSG_TUNNEL_INIT +RED_TUNNEL_SERVICE_IP_MAP SPICE_MSG_TUNNEL_SERVICE_IP_MAP +RED_TUNNEL_SOCKET_OPEN SPICE_MSG_TUNNEL_SOCKET_OPEN +RED_TUNNEL_SOCKET_FIN SPICE_MSG_TUNNEL_SOCKET_FIN +RED_TUNNEL_SOCKET_CLOSE SPICE_MSG_TUNNEL_SOCKET_CLOSE +RED_TUNNEL_SOCKET_DATA SPICE_MSG_TUNNEL_SOCKET_DATA +RED_TUNNEL_SOCKET_CLOSED_ACK SPICE_MSG_TUNNEL_SOCKET_CLOSED_ACK +RED_TUNNEL_SOCKET_TOKEN SPICE_MSG_TUNNEL_SOCKET_TOKEN +RED_TUNNEL_MESSAGES_END SPICE_MSG_END_TUNNEL + +RedTunnelIPv4 SpiceTunnelIPv4 + +RED_TUNNEL_IP_TYPE_INVALID SPICE_TUNNEL_IP_TYPE_INVALID +RED_TUNNEL_IP_TYPE_IPv4 SPICE_TUNNEL_IP_TYPE_IPv4 + +RedTunnelInit SpiceMsgTunnelInit +RedTunnelIpInfo SpiceMsgTunnelIpInfo +RedTunnelServiceIpMap SpiceMsgTunnelServiceIpMap +RedTunnelSocketOpen SpiceMsgTunnelSocketOpen +RedTunnelSocketFin SpiceMsgTunnelSocketFin +RedTunnelSocketClose SpiceMsgTunnelSocketClose +RedTunnelSocketData SpiceMsgTunnelSocketData +RedTunnelSocketTokens SpiceMsgTunnelSocketTokens +RedTunnelSocketClosedAck SpiceMsgTunnelSocketClosedAck + +REDC_TUNNEL_SERVICE_ADD SPICE_MSGC_TUNNEL_SERVICE_ADD +REDC_TUNNEL_SERVICE_REMOVE SPICE_MSGC_TUNNEL_SERVICE_REMOVE +REDC_TUNNEL_SOCKET_OPEN_ACK SPICE_MSGC_TUNNEL_SOCKET_OPEN_ACK +REDC_TUNNEL_SOCKET_OPEN_NACK SPICE_MSGC_TUNNEL_SOCKET_OPEN_NACK +REDC_TUNNEL_SOCKET_FIN SPICE_MSGC_TUNNEL_SOCKET_FIN +REDC_TUNNEL_SOCKET_CLOSED SPICE_MSGC_TUNNEL_SOCKET_CLOSED +REDC_TUNNEL_SOCKET_CLOSED_ACK SPICE_MSGC_TUNNEL_SOCKET_CLOSED_ACK +REDC_TUNNEL_SOCKET_DATA SPICE_MSGC_TUNNEL_SOCKET_DATA +REDC_TUNNEL_SOCKET_TOKEN SPICE_MSGC_TUNNEL_SOCKET_TOKEN +REDC_TUNNEL_MESSGES_END SPICE_MSGC_END_TUNNEL + +RedcTunnelAddGenericService SpiceMsgcTunnelAddGenericService +RedcTunnelAddPrintService SpiceMsgcTunnelAddPrintService +RedcTunnelRemoveService SpiceMsgcTunnelRemoveService +RedcTunnelSocketOpenAck SpiceMsgcTunnelSocketOpenAck +RedcTunnelSocketOpenNack SpiceMsgcTunnelSocketOpenNack +RedcTunnelSocketData SpiceMsgcTunnelSocketData +RedcTunnelSocketFin SpiceMsgcTunnelSocketFin +RedcTunnelSocketClosed SpiceMsgcTunnelSocketClosed +RedcTunnelSocketClosedAck SpiceMsgcTunnelSocketClosedAck +RedcTunnelSocketTokens SpiceMsgcTunnelSocketTokens + + +FIXED28_4 SPICE_FIXED28_4 +ADDRESS SPICE_ADDRESS + +GET_ADDRESS SPICE_GET_ADDRESS +SET_ADDRESS SPICE_SET_ADDRESS + +PATH_BEGIN SPICE_PATH_BEGIN +PATH_END SPICE_PATH_END +PATH_CLOSE SPICE_PATH_CLOSE +PATH_BEZIER SPICE_PATH_BEZIER + +LINE_ATTR_STARTGAP SPICE_LINE_ATTR_STARTGAP +LINE_ATTR_STYLED SPICE_LINE_ATTR_STYLED + +PointFix SpicePointFix +Point SpicePoint +Point16 SpicePoint16 +Rect SpiceRect +PathSeg SpicePathSeg +ClipType SpiceClipType + +CLIP_TYPE_NONE SPICE_CLIP_TYPE_NONE +CLIP_TYPE_RECTS SPICE_CLIP_TYPE_RECTS +CLIP_TYPE_PATH SPICE_CLIP_TYPE_PATH + +Clip SpiceClip + +ROPDescriptor SpiceROPDescriptor +Pattern SpicePattern + +BRUSH_TYPE_NONE SPICE_BRUSH_TYPE_NONE +BRUSH_TYPE_SOLID SPICE_BRUSH_TYPE_SOLID +BRUSH_TYPE_PATTERN SPICE_BRUSH_TYPE_PATTERN + +Brush SpiceBrush + +MASK_INVERS SPICE_MASK_FLAGS_INVERS + +QMask SpiceQMask +Fill SpiceFill +Palette SpicePalette + +IMAGE_TYPE_BITMAP SPICE_IMAGE_TYPE_BITMAP +IMAGE_TYPE_QUIC SPICE_IMAGE_TYPE_QUIC +IMAGE_TYPE_RESERVED SPICE_IMAGE_TYPE_RESERVED +IMAGE_TYPE_LZ_PLT SPICE_IMAGE_TYPE_LZ_PLT +IMAGE_TYPE_LZ_RGB SPICE_IMAGE_TYPE_LZ_RGB +IMAGE_TYPE_GLZ_RGB SPICE_IMAGE_TYPE_GLZ_RGB +IMAGE_TYPE_FROM_CACHE SPICE_IMAGE_TYPE_FROM_CACHE + +IMAGE_CACHE_ME SPICE_IMAGE_FLAGS_CACHE_ME + +ImageDescriptor SpiceImageDescriptor + +BITMAP_FMT_INVALID SPICE_BITMAP_FMT_INVALID +BITMAP_FMT_1BIT_LE SPICE_BITMAP_FMT_1BIT_LE +BITMAP_FMT_1BIT_BE SPICE_BITMAP_FMT_1BIT_BE +BITMAP_FMT_4BIT_LE SPICE_BITMAP_FMT_4BIT_LE +BITMAP_FMT_4BIT_BE SPICE_BITMAP_FMT_4BIT_BE +BITMAP_FMT_8BIT SPICE_BITMAP_FMT_8BIT +BITMAP_FMT_16BIT SPICE_BITMAP_FMT_16BIT +BITMAP_FMT_24BIT SPICE_BITMAP_FMT_24BIT +BITMAP_FMT_32BIT SPICE_BITMAP_FMT_32BIT +BITMAP_FMT_RGBA SPICE_BITMAP_FMT_RGBA + + +BITMAP_PAL_CACHE_ME SPICE_BITMAP_FLAGS_PAL_CACHE_ME +BITMAP_PAL_FROM_CACHE SPICE_BITMAP_FLAGS_PAL_FROM_CACHE +BITMAP_TOP_DOWN SPICE_BITMAP_FLAGS_TOP_DOWN + +Bitmap SpiceBitmap +BitmapImage SpiceBitmapImage +QUICData SpiceQUICData +QUICImage SpiceQUICImage +LZ_RGBImage SpiceLZRGBImage +LZ_RGBData SpiceLZRGBData +LZ_PLTData SpiceLZPLTData +LZ_PLTImage SpiceLZPLTImage + +IMAGE_SCALE_INTERPOLATE SPICE_IMAGE_SCALE_MODE_INTERPOLATE +IMAGE_SCALE_NEAREST SPICE_IMAGE_SCALE_MODE_NEAREST + +Opaque SpiceOpaque +Copy SpiceCopy +Blend SpiceBlend +Transparent SpiceTransparent +AlphaBlnd SpiceAlphaBlnd +Rop3 SpiceRop3 +Blackness SpiceBlackness +Invers SpiceInvers +Whiteness SpiceWhiteness + +LINE_STYLED SPICE_LINE_FLAGS_STYLED +LINE_START_WITH_GAP SPICE_LINE_FLAGS_START_WITH_GAP + +LINE_CAP_ROUND SPICE_LINE_CAP_ROUND +LINE_CAP_SQUARE SPICE_LINE_CAP_SQUARE +LINE_CAP_BUTT SPICE_LINE_CAP_BUTT + +LINE_JOIN_ROUND SPICE_LINE_JOIN_ROUND +LINE_JOIN_BEVEL SPICE_LINE_JOIN_BEVEL +LINE_JOIN_MITER SPICE_LINE_JOIN_MITER + +LineAttr SpiceLineAttr +Stroke SpiceStroke +RasterGlyph SpiceRasterGlyph +VectotGlyph SpiceVectorGlyph + +STRING_RASTER_A1 SPICE_STRING_FLAGS_RASTER_A1 +STRING_RASTER_A4 SPICE_STRING_FLAGS_RASTER_A4 +STRING_RASTER_A8 SPICE_STRING_FLAGS_RASTER_A8 +STRING_RASTER_TOP_DOWN SPICE_STRING_FLAGS_RASTER_TOP_DOWN + +String SpiceString +Text SpiceText + +CURSOR_TYPE_ALPHA SPICE_CURSOR_TYPE_ALPHA +CURSOR_TYPE_MONO SPICE_CURSOR_TYPE_MONO +CURSOR_TYPE_COLOR4 SPICE_CURSOR_TYPE_COLOR4 +CURSOR_TYPE_COLOR8 SPICE_CURSOR_TYPE_COLOR8 +CURSOR_TYPE_COLOR16 SPICE_CURSOR_TYPE_COLOR16 +CURSOR_TYPE_COLOR24 SPICE_CURSOR_TYPE_COLOR24 +CURSOR_TYPE_COLOR32 SPICE_CURSOR_TYPE_COLOR32 + +CursorHeader SpiceCursorHeader + +ROPD_INVERS_SRC SPICE_ROPD_INVERS_SRC +ROPD_INVERS_BRUSH SPICE_ROPD_INVERS_BRUSH +ROPD_INVERS_DEST SPICE_ROPD_INVERS_DEST +ROPD_OP_PUT SPICE_ROPD_OP_PUT +ROPD_OP_OR SPICE_ROPD_OP_OR +ROPD_OP_AND SPICE_ROPD_OP_AND +ROPD_OP_XOR SPICE_ROPD_OP_XOR +ROPD_OP_BLACKNESS SPICE_ROPD_OP_BLACKNESS +ROPD_OP_WHITENESS SPICE_ROPD_OP_WHITENESS +ROPD_OP_INVERS SPICE_ROPD_OP_INVERS +ROPD_INVERS_RES SPICE_ROPD_INVERS_RES + +RING_DECLARE SPICE_RING_DECLARE +RING_INIT SPICE_RING_INIT +RING_INDEX_MASK SPICE_RING_INDEX_MASK +RING_IS_PACKED SPICE_RING_IS_PACKED +RING_IS_EMPTY SPICE_RING_IS_EMPTY +RING_IS_FULL SPICE_RING_IS_FULL +RING_PROD_ITEM SPICE_RING_PROD_ITEM +RING_PROD_WAIT SPICE_RING_PROD_WAIT +RING_PUSH SPICE_RING_PUSH +RING_CONS_ITEM SPICE_RING_CONS_ITEM +RING_CONS_WAIT SPICE_RING_CONS_WAIT +RING_POP SPICE_RING_POP + +PHYSICAL QXLPHYSICAL + +REDS_STAT_SHM_NAME SPICE_STAT_SHM_NAME +REDS_STAT_NODE_NAME_MAX_LENGTH SPICE_STAT_NODE_NAME_MAX +REDS_STAT_MAGIC SPICE_STAT_MAGIC +REDS_STAT_VERSION SPICE_STAT_VERSION + +STAT_NODE_FLAG_ENABLED SPICE_STAT_NODE_FLAG_ENABLED +STAT_NODE_FLAG_VISIBLE SPICE_STAT_NODE_FLAG_VISIBLE +STAT_NODE_FLAG_VALUE SPICE_STAT_NODE_FLAG_VALUE + +STAT_NODE_MASK_SHOW SPICE_STAT_NODE_MASK_SHOW +STAT_NODE_MASK_SHOW_VALUE SPICE_STAT_NODE_MASK_SHOW_VALUE + +StatNode SpiceStatNode +RedsStat SpiceStat + diff --git a/spice-protocol.pc.in b/spice-protocol.pc.in new file mode 100644 index 0000000..c7e76cd --- /dev/null +++ b/spice-protocol.pc.in @@ -0,0 +1,9 @@ +prefix=@prefix@ +includedir=@includedir@ + +Name: spice-protocol +Description: SPICE protocol headers +Version: @VERSION@ + +Libs: +Cflags: -I${includedir}/spice-1 diff --git a/spice/Makefile.am b/spice/Makefile.am new file mode 100644 index 0000000..a54ae89 --- /dev/null +++ b/spice/Makefile.am @@ -0,0 +1,24 @@ +NULL = + +spice_protocol_includedir = $(includedir)/spice-1/spice + +spice_protocol_include_HEADERS = \ + barrier.h \ + controller_prot.h \ + end-packed.h \ + enums.h \ + error_codes.h \ + foreign_menu_prot.h \ + ipc_ring.h \ + macros.h \ + protocol.h \ + qxl_dev.h \ + qxl_windows.h \ + start-packed.h \ + stats.h \ + types.h \ + vd_agent.h \ + vdi_dev.h \ + $(NULL) + +-include $(top_srcdir)/git.mk diff --git a/spice/barrier.h b/spice/barrier.h new file mode 100644 index 0000000..710da09 --- /dev/null +++ b/spice/barrier.h @@ -0,0 +1,55 @@ +/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef _H_SPICE_BARRIER +#define _H_SPICE_BARRIER + +#ifdef __GNUC__ + +#ifdef __i386__ +#define spice_mb() __asm__ __volatile__ ("lock; addl $0,0(%%esp)": : :"memory") +#else +//mfence +#define spice_mb() __asm__ __volatile__ ("lock; addl $0,0(%%rsp)": : :"memory") +#endif + +#else + +#ifdef _WIN64 +//__asm not supported on _WIN64, so use macro instead. +#define spice_mb MemoryBarrier +#else +#define spice_mb() __asm {lock add [esp], 0} +#endif + +#endif + +#endif /* _H_SPICE_BARRIER */ diff --git a/spice/controller_prot.h b/spice/controller_prot.h new file mode 100644 index 0000000..bca7804 --- /dev/null +++ b/spice/controller_prot.h @@ -0,0 +1,124 @@ +/* + Copyright (C) 2009 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 _H_CONTROLLER_PROT +#define _H_CONTROLLER_PROT + +#include <spice/types.h> +#include <spice/start-packed.h> + +#define CONTROLLER_MAGIC (*(uint32_t*)"CTRL") +#define CONTROLLER_VERSION 1 + + +typedef struct SPICE_ATTR_PACKED ControllerInitHeader { + uint32_t magic; + uint32_t version; + uint32_t size; +} ControllerInitHeader; + +typedef struct SPICE_ATTR_PACKED ControllerInit { + ControllerInitHeader base; + uint64_t credentials; + uint32_t flags; +} ControllerInit; + +enum { + CONTROLLER_FLAG_EXCLUSIVE = 1 << 0, +}; + +typedef struct SPICE_ATTR_PACKED ControllerMsg { + uint32_t id; + uint32_t size; +} ControllerMsg; + +enum { + //extrenal app -> spice client + CONTROLLER_HOST = 1, + CONTROLLER_PORT, + CONTROLLER_SPORT, + CONTROLLER_PASSWORD, + + CONTROLLER_SECURE_CHANNELS, + CONTROLLER_DISABLE_CHANNELS, + + CONTROLLER_TLS_CIPHERS, + CONTROLLER_CA_FILE, + CONTROLLER_HOST_SUBJECT, + + CONTROLLER_FULL_SCREEN, + CONTROLLER_SET_TITLE, + + CONTROLLER_CREATE_MENU, + CONTROLLER_DELETE_MENU, + + CONTROLLER_HOTKEYS, + CONTROLLER_SEND_CAD, + + CONTROLLER_CONNECT, + CONTROLLER_SHOW, + CONTROLLER_HIDE, + + CONTROLLER_ENABLE_SMARTCARD, + + CONTROLLER_COLOR_DEPTH, + CONTROLLER_DISABLE_EFFECTS, + + CONTROLLER_ENABLE_USB, + CONTROLLER_ENABLE_USB_AUTOSHARE, + CONTROLLER_USB_FILTER, + + CONTROLLER_PROXY, + + //spice client -> external app + CONTROLLER_MENU_ITEM_CLICK = 1001, +}; + +#define CONTROLLER_TRUE (1 << 0) + +enum { + CONTROLLER_SET_FULL_SCREEN = CONTROLLER_TRUE, + CONTROLLER_AUTO_DISPLAY_RES = 1 << 1, +}; + +typedef struct SPICE_ATTR_PACKED ControllerValue { + ControllerMsg base; + uint32_t value; +} ControllerValue; + +typedef struct SPICE_ATTR_PACKED ControllerData { + ControllerMsg base; + uint8_t data[0]; +} ControllerData; + +#define CONTROLLER_MENU_ITEM_DELIMITER "\n" +#define CONTROLLER_MENU_PARAM_DELIMITER "\r" + +enum { + CONTROLLER_MENU_FLAGS_SEPARATOR = 1 << 0, + CONTROLLER_MENU_FLAGS_DISABLED = 1 << 1, + CONTROLLER_MENU_FLAGS_POPUP = 1 << 2, + CONTROLLER_MENU_FLAGS_CHECKED = 1 << 3, + CONTROLLER_MENU_FLAGS_GRAYED = 1 << 4, +}; + +#define SPICE_MENU_INTERNAL_ID_BASE 0x1300 +#define SPICE_MENU_INTERNAL_ID_SHIFT 8 + +#include <spice/end-packed.h> + +#endif diff --git a/spice/end-packed.h b/spice/end-packed.h new file mode 100644 index 0000000..1acea18 --- /dev/null +++ b/spice/end-packed.h @@ -0,0 +1,38 @@ +/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* See start-packed.h for details */ + +#undef SPICE_ATTR_PACKED + +#if defined(__MINGW32__) || !defined(__GNUC__) +#pragma pack(pop) +#endif diff --git a/spice/enums.h b/spice/enums.h new file mode 100644 index 0000000..16885ac --- /dev/null +++ b/spice/enums.h @@ -0,0 +1,649 @@ +/* this is a file autogenerated by spice_codegen.py */ +/* + Copyright (C) 2013 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 _H_SPICE_ENUMS +#define _H_SPICE_ENUMS + +typedef enum SpiceLinkErr { + SPICE_LINK_ERR_OK, + SPICE_LINK_ERR_ERROR, + SPICE_LINK_ERR_INVALID_MAGIC, + SPICE_LINK_ERR_INVALID_DATA, + SPICE_LINK_ERR_VERSION_MISMATCH, + SPICE_LINK_ERR_NEED_SECURED, + SPICE_LINK_ERR_NEED_UNSECURED, + SPICE_LINK_ERR_PERMISSION_DENIED, + SPICE_LINK_ERR_BAD_CONNECTION_ID, + SPICE_LINK_ERR_CHANNEL_NOT_AVAILABLE, + + SPICE_LINK_ERR_ENUM_END +} SpiceLinkErr; + +typedef enum SpiceWarnCode { + SPICE_WARN_GENERAL, + + SPICE_WARN_CODE_ENUM_END +} SpiceWarnCode; + +typedef enum SpiceInfoCode { + SPICE_INFO_GENERAL, + + SPICE_INFO_CODE_ENUM_END +} SpiceInfoCode; + +typedef enum SpiceMigrateFlags { + SPICE_MIGRATE_NEED_FLUSH = (1 << 0), + SPICE_MIGRATE_NEED_DATA_TRANSFER = (1 << 1), + + SPICE_MIGRATE_FLAGS_MASK = 0x3 +} SpiceMigrateFlags; + +typedef enum SpiceCompositeFlags { + SPICE_COMPOSITE_OP0 = (1 << 0), + SPICE_COMPOSITE_OP1 = (1 << 1), + SPICE_COMPOSITE_OP2 = (1 << 2), + SPICE_COMPOSITE_OP3 = (1 << 3), + SPICE_COMPOSITE_OP4 = (1 << 4), + SPICE_COMPOSITE_OP5 = (1 << 5), + SPICE_COMPOSITE_OP6 = (1 << 6), + SPICE_COMPOSITE_OP7 = (1 << 7), + SPICE_COMPOSITE_SRC_FILTER0 = (1 << 8), + SPICE_COMPOSITE_SRC_FILTER1 = (1 << 9), + SPICE_COMPOSITE_SRC_FILTER2 = (1 << 10), + SPICE_COMPOSITE_MASK_FILTER0 = (1 << 11), + SPICE_COMPOSITE_MASK_FITLER1 = (1 << 12), + SPICE_COMPOSITE_MASK_FILTER2 = (1 << 13), + SPICE_COMPOSITE_SRC_REPEAT0 = (1 << 14), + SPICE_COMPOSITE_SRC_REPEAT1 = (1 << 15), + SPICE_COMPOSITE_MASK_REPEAT0 = (1 << 16), + SPICE_COMPOSITE_MASK_REPEAT1 = (1 << 17), + SPICE_COMPOSITE_COMPONENT_ALPHA = (1 << 18), + SPICE_COMPOSITE_HAS_MASK = (1 << 19), + SPICE_COMPOSITE_HAS_SRC_TRANSFORM = (1 << 20), + SPICE_COMPOSITE_HAS_MASK_TRANSFORM = (1 << 21), + SPICE_COMPOSITE_SOURCE_OPAQUE = (1 << 22), + SPICE_COMPOSITE_MASK_OPAQUE = (1 << 23), + SPICE_COMPOSITE_DEST_OPAQUE = (1 << 24), + + SPICE_COMPOSITE_FLAGS_MASK = 0x1ffffff +} SpiceCompositeFlags; + +typedef enum SpiceNotifySeverity { + SPICE_NOTIFY_SEVERITY_INFO, + SPICE_NOTIFY_SEVERITY_WARN, + SPICE_NOTIFY_SEVERITY_ERROR, + + SPICE_NOTIFY_SEVERITY_ENUM_END +} SpiceNotifySeverity; + +typedef enum SpiceNotifyVisibility { + SPICE_NOTIFY_VISIBILITY_LOW, + SPICE_NOTIFY_VISIBILITY_MEDIUM, + SPICE_NOTIFY_VISIBILITY_HIGH, + + SPICE_NOTIFY_VISIBILITY_ENUM_END +} SpiceNotifyVisibility; + +typedef enum SpiceMouseMode { + SPICE_MOUSE_MODE_SERVER = (1 << 0), + SPICE_MOUSE_MODE_CLIENT = (1 << 1), + + SPICE_MOUSE_MODE_MASK = 0x3 +} SpiceMouseMode; + +typedef enum SpicePubkeyType { + SPICE_PUBKEY_TYPE_INVALID, + SPICE_PUBKEY_TYPE_RSA, + SPICE_PUBKEY_TYPE_RSA2, + SPICE_PUBKEY_TYPE_DSA, + SPICE_PUBKEY_TYPE_DSA1, + SPICE_PUBKEY_TYPE_DSA2, + SPICE_PUBKEY_TYPE_DSA3, + SPICE_PUBKEY_TYPE_DSA4, + SPICE_PUBKEY_TYPE_DH, + SPICE_PUBKEY_TYPE_EC, + + SPICE_PUBKEY_TYPE_ENUM_END +} SpicePubkeyType; + +typedef enum SpiceClipType { + SPICE_CLIP_TYPE_NONE, + SPICE_CLIP_TYPE_RECTS, + + SPICE_CLIP_TYPE_ENUM_END +} SpiceClipType; + +typedef enum SpicePathFlags { + SPICE_PATH_BEGIN = (1 << 0), + SPICE_PATH_END = (1 << 1), + SPICE_PATH_CLOSE = (1 << 3), + SPICE_PATH_BEZIER = (1 << 4), + + SPICE_PATH_FLAGS_MASK = 0x1b +} SpicePathFlags; + +typedef enum SpiceVideoCodecType { + SPICE_VIDEO_CODEC_TYPE_MJPEG = 1, + + SPICE_VIDEO_CODEC_TYPE_ENUM_END +} SpiceVideoCodecType; + +typedef enum SpiceStreamFlags { + SPICE_STREAM_FLAGS_TOP_DOWN = (1 << 0), + + SPICE_STREAM_FLAGS_MASK = 0x1 +} SpiceStreamFlags; + +typedef enum SpiceBrushType { + SPICE_BRUSH_TYPE_NONE, + SPICE_BRUSH_TYPE_SOLID, + SPICE_BRUSH_TYPE_PATTERN, + + SPICE_BRUSH_TYPE_ENUM_END +} SpiceBrushType; + +typedef enum SpiceMaskFlags { + SPICE_MASK_FLAGS_INVERS = (1 << 0), + + SPICE_MASK_FLAGS_MASK = 0x1 +} SpiceMaskFlags; + +typedef enum SpiceImageType { + SPICE_IMAGE_TYPE_BITMAP, + SPICE_IMAGE_TYPE_QUIC, + SPICE_IMAGE_TYPE_RESERVED, + SPICE_IMAGE_TYPE_LZ_PLT = 100, + SPICE_IMAGE_TYPE_LZ_RGB, + SPICE_IMAGE_TYPE_GLZ_RGB, + SPICE_IMAGE_TYPE_FROM_CACHE, + SPICE_IMAGE_TYPE_SURFACE, + SPICE_IMAGE_TYPE_JPEG, + SPICE_IMAGE_TYPE_FROM_CACHE_LOSSLESS, + SPICE_IMAGE_TYPE_ZLIB_GLZ_RGB, + SPICE_IMAGE_TYPE_JPEG_ALPHA, + SPICE_IMAGE_TYPE_LZ4, + + SPICE_IMAGE_TYPE_ENUM_END +} SpiceImageType; + +typedef enum SpiceImageCompression { + SPICE_IMAGE_COMPRESSION_INVALID, + SPICE_IMAGE_COMPRESSION_OFF, + SPICE_IMAGE_COMPRESSION_AUTO_GLZ, + SPICE_IMAGE_COMPRESSION_AUTO_LZ, + SPICE_IMAGE_COMPRESSION_QUIC, + SPICE_IMAGE_COMPRESSION_GLZ, + SPICE_IMAGE_COMPRESSION_LZ, + SPICE_IMAGE_COMPRESSION_LZ4, + + SPICE_IMAGE_COMPRESSION_ENUM_END +} SpiceImageCompression; + +typedef enum SpiceImageFlags { + SPICE_IMAGE_FLAGS_CACHE_ME = (1 << 0), + SPICE_IMAGE_FLAGS_HIGH_BITS_SET = (1 << 1), + SPICE_IMAGE_FLAGS_CACHE_REPLACE_ME = (1 << 2), + + SPICE_IMAGE_FLAGS_MASK = 0x7 +} SpiceImageFlags; + +typedef enum SpiceBitmapFmt { + SPICE_BITMAP_FMT_INVALID, + SPICE_BITMAP_FMT_1BIT_LE, + SPICE_BITMAP_FMT_1BIT_BE, + SPICE_BITMAP_FMT_4BIT_LE, + SPICE_BITMAP_FMT_4BIT_BE, + SPICE_BITMAP_FMT_8BIT, + SPICE_BITMAP_FMT_16BIT, + SPICE_BITMAP_FMT_24BIT, + SPICE_BITMAP_FMT_32BIT, + SPICE_BITMAP_FMT_RGBA, + SPICE_BITMAP_FMT_8BIT_A, + + SPICE_BITMAP_FMT_ENUM_END +} SpiceBitmapFmt; + +typedef enum SpiceBitmapFlags { + SPICE_BITMAP_FLAGS_PAL_CACHE_ME = (1 << 0), + SPICE_BITMAP_FLAGS_PAL_FROM_CACHE = (1 << 1), + SPICE_BITMAP_FLAGS_TOP_DOWN = (1 << 2), + + SPICE_BITMAP_FLAGS_MASK = 0x7 +} SpiceBitmapFlags; + +typedef enum SpiceJpegAlphaFlags { + SPICE_JPEG_ALPHA_FLAGS_TOP_DOWN = (1 << 0), + + SPICE_JPEG_ALPHA_FLAGS_MASK = 0x1 +} SpiceJpegAlphaFlags; + +typedef enum SpiceImageScaleMode { + SPICE_IMAGE_SCALE_MODE_INTERPOLATE, + SPICE_IMAGE_SCALE_MODE_NEAREST, + + SPICE_IMAGE_SCALE_MODE_ENUM_END +} SpiceImageScaleMode; + +typedef enum SpiceRopd { + SPICE_ROPD_INVERS_SRC = (1 << 0), + SPICE_ROPD_INVERS_BRUSH = (1 << 1), + SPICE_ROPD_INVERS_DEST = (1 << 2), + SPICE_ROPD_OP_PUT = (1 << 3), + SPICE_ROPD_OP_OR = (1 << 4), + SPICE_ROPD_OP_AND = (1 << 5), + SPICE_ROPD_OP_XOR = (1 << 6), + SPICE_ROPD_OP_BLACKNESS = (1 << 7), + SPICE_ROPD_OP_WHITENESS = (1 << 8), + SPICE_ROPD_OP_INVERS = (1 << 9), + SPICE_ROPD_INVERS_RES = (1 << 10), + + SPICE_ROPD_MASK = 0x7ff +} SpiceRopd; + +typedef enum SpiceLineFlags { + SPICE_LINE_FLAGS_START_WITH_GAP = (1 << 2), + SPICE_LINE_FLAGS_STYLED = (1 << 3), + + SPICE_LINE_FLAGS_MASK = 0xc +} SpiceLineFlags; + +typedef enum SpiceStringFlags { + SPICE_STRING_FLAGS_RASTER_A1 = (1 << 0), + SPICE_STRING_FLAGS_RASTER_A4 = (1 << 1), + SPICE_STRING_FLAGS_RASTER_A8 = (1 << 2), + SPICE_STRING_FLAGS_RASTER_TOP_DOWN = (1 << 3), + + SPICE_STRING_FLAGS_MASK = 0xf +} SpiceStringFlags; + +typedef enum SpiceSurfaceFlags { + SPICE_SURFACE_FLAGS_PRIMARY = (1 << 0), + + SPICE_SURFACE_FLAGS_MASK = 0x1 +} SpiceSurfaceFlags; + +typedef enum SpiceSurfaceFmt { + SPICE_SURFACE_FMT_INVALID, + SPICE_SURFACE_FMT_1_A, + SPICE_SURFACE_FMT_8_A = 8, + SPICE_SURFACE_FMT_16_555 = 16, + SPICE_SURFACE_FMT_32_xRGB = 32, + SPICE_SURFACE_FMT_16_565 = 80, + SPICE_SURFACE_FMT_32_ARGB = 96, + + SPICE_SURFACE_FMT_ENUM_END +} SpiceSurfaceFmt; + +typedef enum SpiceAlphaFlags { + SPICE_ALPHA_FLAGS_DEST_HAS_ALPHA = (1 << 0), + SPICE_ALPHA_FLAGS_SRC_SURFACE_HAS_ALPHA = (1 << 1), + + SPICE_ALPHA_FLAGS_MASK = 0x3 +} SpiceAlphaFlags; + +typedef enum SpiceResourceType { + SPICE_RES_TYPE_INVALID, + SPICE_RES_TYPE_PIXMAP, + + SPICE_RESOURCE_TYPE_ENUM_END +} SpiceResourceType; + +typedef enum SpiceKeyboardModifierFlags { + SPICE_KEYBOARD_MODIFIER_FLAGS_SCROLL_LOCK = (1 << 0), + SPICE_KEYBOARD_MODIFIER_FLAGS_NUM_LOCK = (1 << 1), + SPICE_KEYBOARD_MODIFIER_FLAGS_CAPS_LOCK = (1 << 2), + + SPICE_KEYBOARD_MODIFIER_FLAGS_MASK = 0x7 +} SpiceKeyboardModifierFlags; + +typedef enum SpiceMouseButton { + SPICE_MOUSE_BUTTON_INVALID, + SPICE_MOUSE_BUTTON_LEFT, + SPICE_MOUSE_BUTTON_MIDDLE, + SPICE_MOUSE_BUTTON_RIGHT, + SPICE_MOUSE_BUTTON_UP, + SPICE_MOUSE_BUTTON_DOWN, + + SPICE_MOUSE_BUTTON_ENUM_END +} SpiceMouseButton; + +typedef enum SpiceMouseButtonMask { + SPICE_MOUSE_BUTTON_MASK_LEFT = (1 << 0), + SPICE_MOUSE_BUTTON_MASK_MIDDLE = (1 << 1), + SPICE_MOUSE_BUTTON_MASK_RIGHT = (1 << 2), + + SPICE_MOUSE_BUTTON_MASK_MASK = 0x7 +} SpiceMouseButtonMask; + +typedef enum SpiceCursorType { + SPICE_CURSOR_TYPE_ALPHA, + SPICE_CURSOR_TYPE_MONO, + SPICE_CURSOR_TYPE_COLOR4, + SPICE_CURSOR_TYPE_COLOR8, + SPICE_CURSOR_TYPE_COLOR16, + SPICE_CURSOR_TYPE_COLOR24, + SPICE_CURSOR_TYPE_COLOR32, + + SPICE_CURSOR_TYPE_ENUM_END +} SpiceCursorType; + +typedef enum SpiceCursorFlags { + SPICE_CURSOR_FLAGS_NONE = (1 << 0), + SPICE_CURSOR_FLAGS_CACHE_ME = (1 << 1), + SPICE_CURSOR_FLAGS_FROM_CACHE = (1 << 2), + + SPICE_CURSOR_FLAGS_MASK = 0x7 +} SpiceCursorFlags; + +typedef enum SpiceAudioDataMode { + SPICE_AUDIO_DATA_MODE_INVALID, + SPICE_AUDIO_DATA_MODE_RAW, + SPICE_AUDIO_DATA_MODE_CELT_0_5_1, + SPICE_AUDIO_DATA_MODE_OPUS, + + SPICE_AUDIO_DATA_MODE_ENUM_END +} SpiceAudioDataMode; + +typedef enum SpiceAudioFmt { + SPICE_AUDIO_FMT_INVALID, + SPICE_AUDIO_FMT_S16, + + SPICE_AUDIO_FMT_ENUM_END +} SpiceAudioFmt; + +typedef enum SpiceTunnelServiceType { + SPICE_TUNNEL_SERVICE_TYPE_INVALID, + SPICE_TUNNEL_SERVICE_TYPE_GENERIC, + SPICE_TUNNEL_SERVICE_TYPE_IPP, + + SPICE_TUNNEL_SERVICE_TYPE_ENUM_END +} SpiceTunnelServiceType; + +typedef enum SpiceTunnelIpType { + SPICE_TUNNEL_IP_TYPE_INVALID, + SPICE_TUNNEL_IP_TYPE_IPv4, + + SPICE_TUNNEL_IP_TYPE_ENUM_END +} SpiceTunnelIpType; + +typedef enum SpiceVscMessageType { + SPICE_VSC_MESSAGE_TYPE_Init = 1, + SPICE_VSC_MESSAGE_TYPE_Error, + SPICE_VSC_MESSAGE_TYPE_ReaderAdd, + SPICE_VSC_MESSAGE_TYPE_ReaderRemove, + SPICE_VSC_MESSAGE_TYPE_ATR, + SPICE_VSC_MESSAGE_TYPE_CardRemove, + SPICE_VSC_MESSAGE_TYPE_APDU, + SPICE_VSC_MESSAGE_TYPE_Flush, + SPICE_VSC_MESSAGE_TYPE_FlushComplete, + + SPICE_VSC_MESSAGE_TYPE_ENUM_END +} SpiceVscMessageType; + +enum { + SPICE_CHANNEL_MAIN = 1, + SPICE_CHANNEL_DISPLAY, + SPICE_CHANNEL_INPUTS, + SPICE_CHANNEL_CURSOR, + SPICE_CHANNEL_PLAYBACK, + SPICE_CHANNEL_RECORD, + SPICE_CHANNEL_TUNNEL, + SPICE_CHANNEL_SMARTCARD, + SPICE_CHANNEL_USBREDIR, + SPICE_CHANNEL_PORT, + SPICE_CHANNEL_WEBDAV, + + SPICE_END_CHANNEL +}; + +enum { + SPICE_MSG_MIGRATE = 1, + SPICE_MSG_MIGRATE_DATA, + SPICE_MSG_SET_ACK, + SPICE_MSG_PING, + SPICE_MSG_WAIT_FOR_CHANNELS, + SPICE_MSG_DISCONNECTING, + SPICE_MSG_NOTIFY, + SPICE_MSG_LIST, + SPICE_MSG_BASE_LAST = 100, +}; + +enum { + SPICE_MSGC_ACK_SYNC = 1, + SPICE_MSGC_ACK, + SPICE_MSGC_PONG, + SPICE_MSGC_MIGRATE_FLUSH_MARK, + SPICE_MSGC_MIGRATE_DATA, + SPICE_MSGC_DISCONNECTING, +}; + +enum { + SPICE_MSG_MAIN_MIGRATE_BEGIN = 101, + SPICE_MSG_MAIN_MIGRATE_CANCEL, + SPICE_MSG_MAIN_INIT, + SPICE_MSG_MAIN_CHANNELS_LIST, + SPICE_MSG_MAIN_MOUSE_MODE, + SPICE_MSG_MAIN_MULTI_MEDIA_TIME, + SPICE_MSG_MAIN_AGENT_CONNECTED, + SPICE_MSG_MAIN_AGENT_DISCONNECTED, + SPICE_MSG_MAIN_AGENT_DATA, + SPICE_MSG_MAIN_AGENT_TOKEN, + SPICE_MSG_MAIN_MIGRATE_SWITCH_HOST, + SPICE_MSG_MAIN_MIGRATE_END, + SPICE_MSG_MAIN_NAME, + SPICE_MSG_MAIN_UUID, + SPICE_MSG_MAIN_AGENT_CONNECTED_TOKENS, + SPICE_MSG_MAIN_MIGRATE_BEGIN_SEAMLESS, + SPICE_MSG_MAIN_MIGRATE_DST_SEAMLESS_ACK, + SPICE_MSG_MAIN_MIGRATE_DST_SEAMLESS_NACK, + + SPICE_MSG_END_MAIN +}; + +enum { + SPICE_MSGC_MAIN_CLIENT_INFO = 101, + SPICE_MSGC_MAIN_MIGRATE_CONNECTED, + SPICE_MSGC_MAIN_MIGRATE_CONNECT_ERROR, + SPICE_MSGC_MAIN_ATTACH_CHANNELS, + SPICE_MSGC_MAIN_MOUSE_MODE_REQUEST, + SPICE_MSGC_MAIN_AGENT_START, + SPICE_MSGC_MAIN_AGENT_DATA, + SPICE_MSGC_MAIN_AGENT_TOKEN, + SPICE_MSGC_MAIN_MIGRATE_END, + SPICE_MSGC_MAIN_MIGRATE_DST_DO_SEAMLESS, + SPICE_MSGC_MAIN_MIGRATE_CONNECTED_SEAMLESS, + + SPICE_MSGC_END_MAIN +}; + +enum { + SPICE_MSG_DISPLAY_MODE = 101, + SPICE_MSG_DISPLAY_MARK, + SPICE_MSG_DISPLAY_RESET, + SPICE_MSG_DISPLAY_COPY_BITS, + SPICE_MSG_DISPLAY_INVAL_LIST, + SPICE_MSG_DISPLAY_INVAL_ALL_PIXMAPS, + SPICE_MSG_DISPLAY_INVAL_PALETTE, + SPICE_MSG_DISPLAY_INVAL_ALL_PALETTES, + SPICE_MSG_DISPLAY_STREAM_CREATE = 122, + SPICE_MSG_DISPLAY_STREAM_DATA, + SPICE_MSG_DISPLAY_STREAM_CLIP, + SPICE_MSG_DISPLAY_STREAM_DESTROY, + SPICE_MSG_DISPLAY_STREAM_DESTROY_ALL, + SPICE_MSG_DISPLAY_DRAW_FILL = 302, + SPICE_MSG_DISPLAY_DRAW_OPAQUE, + SPICE_MSG_DISPLAY_DRAW_COPY, + SPICE_MSG_DISPLAY_DRAW_BLEND, + SPICE_MSG_DISPLAY_DRAW_BLACKNESS, + SPICE_MSG_DISPLAY_DRAW_WHITENESS, + SPICE_MSG_DISPLAY_DRAW_INVERS, + SPICE_MSG_DISPLAY_DRAW_ROP3, + SPICE_MSG_DISPLAY_DRAW_STROKE, + SPICE_MSG_DISPLAY_DRAW_TEXT, + SPICE_MSG_DISPLAY_DRAW_TRANSPARENT, + SPICE_MSG_DISPLAY_DRAW_ALPHA_BLEND, + SPICE_MSG_DISPLAY_SURFACE_CREATE, + SPICE_MSG_DISPLAY_SURFACE_DESTROY, + SPICE_MSG_DISPLAY_STREAM_DATA_SIZED, + SPICE_MSG_DISPLAY_MONITORS_CONFIG, + SPICE_MSG_DISPLAY_DRAW_COMPOSITE, + SPICE_MSG_DISPLAY_STREAM_ACTIVATE_REPORT, + + SPICE_MSG_END_DISPLAY +}; + +enum { + SPICE_MSGC_DISPLAY_INIT = 101, + SPICE_MSGC_DISPLAY_STREAM_REPORT, + SPICE_MSGC_DISPLAY_PREFERRED_COMPRESSION, + + SPICE_MSGC_END_DISPLAY +}; + +enum { + SPICE_MSG_INPUTS_INIT = 101, + SPICE_MSG_INPUTS_KEY_MODIFIERS, + SPICE_MSG_INPUTS_MOUSE_MOTION_ACK = 111, + + SPICE_MSG_END_INPUTS +}; + +enum { + SPICE_MSGC_INPUTS_KEY_DOWN = 101, + SPICE_MSGC_INPUTS_KEY_UP, + SPICE_MSGC_INPUTS_KEY_MODIFIERS, + SPICE_MSGC_INPUTS_KEY_SCANCODE, + SPICE_MSGC_INPUTS_MOUSE_MOTION = 111, + SPICE_MSGC_INPUTS_MOUSE_POSITION, + SPICE_MSGC_INPUTS_MOUSE_PRESS, + SPICE_MSGC_INPUTS_MOUSE_RELEASE, + + SPICE_MSGC_END_INPUTS +}; + +enum { + SPICE_MSG_CURSOR_INIT = 101, + SPICE_MSG_CURSOR_RESET, + SPICE_MSG_CURSOR_SET, + SPICE_MSG_CURSOR_MOVE, + SPICE_MSG_CURSOR_HIDE, + SPICE_MSG_CURSOR_TRAIL, + SPICE_MSG_CURSOR_INVAL_ONE, + SPICE_MSG_CURSOR_INVAL_ALL, + + SPICE_MSG_END_CURSOR +}; + +enum { + SPICE_MSG_PLAYBACK_DATA = 101, + SPICE_MSG_PLAYBACK_MODE, + SPICE_MSG_PLAYBACK_START, + SPICE_MSG_PLAYBACK_STOP, + SPICE_MSG_PLAYBACK_VOLUME, + SPICE_MSG_PLAYBACK_MUTE, + SPICE_MSG_PLAYBACK_LATENCY, + + SPICE_MSG_END_PLAYBACK +}; + +enum { + SPICE_MSG_RECORD_START = 101, + SPICE_MSG_RECORD_STOP, + SPICE_MSG_RECORD_VOLUME, + SPICE_MSG_RECORD_MUTE, + + SPICE_MSG_END_RECORD +}; + +enum { + SPICE_MSGC_RECORD_DATA = 101, + SPICE_MSGC_RECORD_MODE, + SPICE_MSGC_RECORD_START_MARK, + + SPICE_MSGC_END_RECORD +}; + +enum { + SPICE_MSG_TUNNEL_INIT = 101, + SPICE_MSG_TUNNEL_SERVICE_IP_MAP, + SPICE_MSG_TUNNEL_SOCKET_OPEN, + SPICE_MSG_TUNNEL_SOCKET_FIN, + SPICE_MSG_TUNNEL_SOCKET_CLOSE, + SPICE_MSG_TUNNEL_SOCKET_DATA, + SPICE_MSG_TUNNEL_SOCKET_CLOSED_ACK, + SPICE_MSG_TUNNEL_SOCKET_TOKEN, + + SPICE_MSG_END_TUNNEL +}; + +enum { + SPICE_MSGC_TUNNEL_SERVICE_ADD = 101, + SPICE_MSGC_TUNNEL_SERVICE_REMOVE, + SPICE_MSGC_TUNNEL_SOCKET_OPEN_ACK, + SPICE_MSGC_TUNNEL_SOCKET_OPEN_NACK, + SPICE_MSGC_TUNNEL_SOCKET_FIN, + SPICE_MSGC_TUNNEL_SOCKET_CLOSED, + SPICE_MSGC_TUNNEL_SOCKET_CLOSED_ACK, + SPICE_MSGC_TUNNEL_SOCKET_DATA, + SPICE_MSGC_TUNNEL_SOCKET_TOKEN, + + SPICE_MSGC_END_TUNNEL +}; + +enum { + SPICE_MSG_SMARTCARD_DATA = 101, + + SPICE_MSG_END_SMARTCARD +}; + +enum { + SPICE_MSGC_SMARTCARD_DATA = 101, + SPICE_MSGC_SMARTCARD_HEADER = 101, + SPICE_MSGC_SMARTCARD_ERROR = 101, + SPICE_MSGC_SMARTCARD_ATR = 101, + SPICE_MSGC_SMARTCARD_READER_ADD = 101, + + SPICE_MSGC_END_SMARTCARD +}; + +enum { + SPICE_MSG_SPICEVMC_DATA = 101, + + SPICE_MSG_END_SPICEVMC +}; + +enum { + SPICE_MSGC_SPICEVMC_DATA = 101, + + SPICE_MSGC_END_SPICEVMC +}; + +enum { + SPICE_MSG_PORT_INIT = 201, + SPICE_MSG_PORT_EVENT, + + SPICE_MSG_END_PORT +}; + +enum { + SPICE_MSGC_PORT_EVENT = 201, + + SPICE_MSGC_END_PORT +}; + +#endif /* _H_SPICE_ENUMS */ diff --git a/spice/error_codes.h b/spice/error_codes.h new file mode 100644 index 0000000..9fcfe3f --- /dev/null +++ b/spice/error_codes.h @@ -0,0 +1,51 @@ +/* + Copyright (C) 2009 Red Hat, Inc. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef _H_SPICE_ERROR_CODES +#define _H_SPICE_ERROR_CODES + +#define SPICEC_ERROR_CODE_SUCCESS 0 +#define SPICEC_ERROR_CODE_ERROR 1 +#define SPICEC_ERROR_CODE_GETHOSTBYNAME_FAILED 2 +#define SPICEC_ERROR_CODE_CONNECT_FAILED 3 +#define SPICEC_ERROR_CODE_SOCKET_FAILED 4 +#define SPICEC_ERROR_CODE_SEND_FAILED 5 +#define SPICEC_ERROR_CODE_RECV_FAILED 6 +#define SPICEC_ERROR_CODE_SSL_ERROR 7 +#define SPICEC_ERROR_CODE_NOT_ENOUGH_MEMORY 8 +#define SPICEC_ERROR_CODE_AGENT_TIMEOUT 9 +#define SPICEC_ERROR_CODE_AGENT_ERROR 10 +#define SPICEC_ERROR_CODE_VERSION_MISMATCH 11 +#define SPICEC_ERROR_CODE_PERMISSION_DENIED 12 +#define SPICEC_ERROR_CODE_INVALID_ARG 13 +#define SPICEC_ERROR_CODE_CMD_LINE_ERROR 14 + +#endif /* _H_SPICE_ERROR_CODES */ + diff --git a/spice/foreign_menu_prot.h b/spice/foreign_menu_prot.h new file mode 100644 index 0000000..f478e2a --- /dev/null +++ b/spice/foreign_menu_prot.h @@ -0,0 +1,104 @@ +/* + Copyright (C) 2009 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 _H_FOREIGN_MENU_PROT +#define _H_FOREIGN_MENU_PROT + +#include <spice/types.h> +#include <spice/start-packed.h> + +#define FOREIGN_MENU_MAGIC (*(uint32_t*)"FRGM") +#define FOREIGN_MENU_VERSION 1 + +typedef struct SPICE_ATTR_PACKED FrgMenuInitHeader { + uint32_t magic; + uint32_t version; + uint32_t size; +} FrgMenuInitHeader; + +typedef struct SPICE_ATTR_PACKED FrgMenuInit { + FrgMenuInitHeader base; + uint64_t credentials; + uint8_t title[0]; //UTF8 +} FrgMenuInit; + +typedef struct SPICE_ATTR_PACKED FrgMenuMsg { + uint32_t id; + uint32_t size; +} FrgMenuMsg; + +enum { + //extrenal app -> spice client + FOREIGN_MENU_SET_TITLE = 1, + FOREIGN_MENU_ADD_ITEM, + FOREIGN_MENU_MODIFY_ITEM, + FOREIGN_MENU_REMOVE_ITEM, + FOREIGN_MENU_CLEAR, + + //spice client -> external app + FOREIGN_MENU_ITEM_EVENT = 1001, + FOREIGN_MENU_APP_ACTIVATED, + FOREIGN_MENU_APP_DEACTIVATED, +}; + +typedef struct SPICE_ATTR_PACKED FrgMenuSetTitle { + FrgMenuMsg base; + uint8_t string[0]; //UTF8 +} FrgMenuSetTitle; + +enum { + FOREIGN_MENU_ITEM_TYPE_CHECKED = 1 << 0, + FOREIGN_MENU_ITEM_TYPE_DIM = 1 << 1, + FOREIGN_MENU_ITEM_TYPE_SEPARATOR = 1 << 2 +}; + +#define FOREIGN_MENU_INVALID_ID 0 + +typedef struct SPICE_ATTR_PACKED FrgMenuAddItem { + FrgMenuMsg base; + uint32_t id; + uint32_t type; + uint32_t position; + uint8_t string[0]; //UTF8 +} FrgMenuAddItem, FrgMenuModItem; + +typedef struct SPICE_ATTR_PACKED FrgMenuRmItem { + FrgMenuMsg base; + uint32_t id; +} FrgMenuRmItem; + +typedef struct FrgMenuMsg FrgMenuRmItems; +typedef struct FrgMenuMsg FrgMenuDelete; + +enum { + FOREIGN_MENU_EVENT_CLICK, + FOREIGN_MENU_EVENT_CHECKED, + FOREIGN_MENU_EVENT_UNCHECKED +}; + +typedef struct SPICE_ATTR_PACKED FrgMenuEvent { + FrgMenuMsg base; + uint32_t id; + uint32_t action; //FOREIGN_MENU_EVENT_? +} FrgMenuEvent; + +typedef struct FrgMenuMsg FrgMenuActivate; +typedef struct FrgMenuMsg FrgMenuDeactivate; + +#include <spice/end-packed.h> + +#endif diff --git a/spice/ipc_ring.h b/spice/ipc_ring.h new file mode 100644 index 0000000..d8d854f --- /dev/null +++ b/spice/ipc_ring.h @@ -0,0 +1,136 @@ +/* + Copyright (C) 2009 Red Hat, Inc. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#ifndef _H_SPICE_RING +#define _H_SPICE_RING + +#include <spice/types.h> + +#define _SPICE_MSB_MASK4(x) \ + (((x) & 0x8) ? 0x8 : \ + ((x) & 0x4) ? 0x4 : \ + ((x) & 0x2) ? 0x2 : \ + ((x) & 0x1) ? 0x1 : 0) + +#define _SPICE_MSB_MASK8(x) \ + (((x) & 0xf0) ? _SPICE_MSB_MASK4((x) >> 4) << 4 : _SPICE_MSB_MASK4(x)) + +#define _SPICE_MSB_MASK16(x) \ + (((x) & 0xff00) ? _SPICE_MSB_MASK8((x) >> 8) << 8 : _SPICE_MSB_MASK8(x)) + +#define _SPICE_MSB_MASK(x) \ + (((x) & 0xffff0000) ? _SPICE_MSB_MASK16((x) >> 16) << 16 : _SPICE_MSB_MASK16(x)) + +#define _SPICE_POWER2_ALIGN(x) _SPICE_MSB_MASK((x) * 2 - 1) + + +#define _SPICE_TOSHIFT_4(x) \ + (((x) & 0x8) ? 3 : \ + ((x) & 0x4) ? 2 : \ + ((x) & 0x2) ? 1 : 0) + +#define _SPICE_TOSHIFT_8(x) \ + (((x) & 0xf0) ? _SPICE_TOSHIFT_4((x) >> 4) + 4 : _SPICE_TOSHIFT_4(x)) + +#define _SPICE_TOSHIFT_16(x) \ + (((x) & 0xff00) ? _SPICE_TOSHIFT_8((x) >> 8) + 8 : _SPICE_TOSHIFT_8(x)) + +#define _SPICE_POWER2_TO_SHIFT(x) \ + (((x) & 0xffff0000) ? _SPICE_TOSHIFT_16((x) >> 16) + 16 : _SPICE_TOSHIFT_16(x)) + + + +#define SPICE_RING_DECLARE(name, el_type, size) \ +typedef struct SPICE_ATTR_PACKED name##_ring_el { \ + union { \ + el_type el; \ + uint8_t data[_SPICE_POWER2_ALIGN(sizeof(el_type))]; \ + } ; \ +} name##_ring_el; \ + \ +typedef struct SPICE_ATTR_PACKED name { \ + uint32_t num_items; \ + uint32_t prod; \ + uint32_t notify_on_prod; \ + uint32_t cons; \ + uint32_t notify_on_cons; \ + name##_ring_el items[_SPICE_POWER2_ALIGN(size)]; \ +} name; + + +#define SPICE_RING_INIT(r) \ + (r)->num_items = sizeof((r)->items) >> \ + _SPICE_POWER2_TO_SHIFT(sizeof((r)->items[0])); \ + (r)->prod = (r)->cons = 0; \ + (r)->notify_on_prod = 1; \ + (r)->notify_on_cons = 0; + + +#define SPICE_RING_INDEX_MASK(r) ((r)->num_items - 1) + +#define SPICE_RING_IS_PACKED(r) (sizeof((r)->items[0]) == sizeof((r)->items[0]).el) + +#define SPICE_RING_IS_EMPTY(r) ((r)->cons == (r)->prod) + +#define SPICE_RING_IS_FULL(r) (((r)->prod - (r)->cons) == (r)->num_items) + +#define SPICE_RING_PROD_ITEM(r) (&(r)->items[(r)->prod & SPICE_RING_INDEX_MASK(r)].el) + +#define SPICE_RING_PROD_WAIT(r, wait) \ + if (((wait) = SPICE_RING_IS_FULL(r))) { \ + (r)->notify_on_cons = (r)->cons + 1; \ + spice_mb(); \ + (wait) = SPICE_RING_IS_FULL(r); \ + } + +#define SPICE_RING_PUSH(r, notify) \ + (r)->prod++; \ + spice_mb(); \ + (notify) = (r)->prod == (r)->notify_on_prod; + + +#define SPICE_RING_CONS_ITEM(r) (&(r)->items[(r)->cons & SPICE_RING_INDEX_MASK(r)].el) + +#define SPICE_RING_CONS_WAIT(r, wait) \ + if (((wait) = SPICE_RING_IS_EMPTY(r))) { \ + (r)->notify_on_prod = (r)->prod + 1; \ + spice_mb(); \ + (wait) = SPICE_RING_IS_EMPTY(r); \ + } + +#define SPICE_RING_POP(r, notify) \ + (r)->cons++; \ + spice_mb(); \ + (notify) = (r)->cons == (r)->notify_on_cons; + + + +#endif /* _H_SPICE_RING */ diff --git a/spice/macros.h b/spice/macros.h new file mode 100644 index 0000000..62157b4 --- /dev/null +++ b/spice/macros.h @@ -0,0 +1,362 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2010 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 program 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 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/>. +*/ + +/* This file is to a large extent based on gmacros.h from glib + * Which is LGPL and copyright: + * + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef _H_SPICE_MACROS +#define _H_SPICE_MACROS + +/* We include stddef.h to get the system's definition of NULL */ +#include <stddef.h> + +#include <spice/types.h> + +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +#define SPICE_GNUC_PURE __attribute__((__pure__)) +#define SPICE_GNUC_MALLOC __attribute__((__malloc__)) +#else +#define SPICE_GNUC_PURE +#define SPICE_GNUC_MALLOC +#endif + +#if __GNUC__ >= 4 +#define SPICE_GNUC_NULL_TERMINATED __attribute__((__sentinel__)) +#else +#define SPICE_GNUC_NULL_TERMINATED +#endif + +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#define SPICE_GNUC_ALLOC_SIZE(x) __attribute__((__alloc_size__(x))) +#define SPICE_GNUC_ALLOC_SIZE2(x,y) __attribute__((__alloc_size__(x,y))) +#else +#define SPICE_GNUC_ALLOC_SIZE(x) +#define SPICE_GNUC_ALLOC_SIZE2(x,y) +#endif + +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4) +#define SPICE_GNUC_PRINTF( format_idx, arg_idx ) __attribute__((__format__ (__printf__, format_idx, arg_idx))) +#define SPICE_GNUC_SCANF( format_idx, arg_idx ) __attribute__((__format__ (__scanf__, format_idx, arg_idx))) +#define SPICE_GNUC_FORMAT( arg_idx ) __attribute__((__format_arg__ (arg_idx))) +#define SPICE_GNUC_NORETURN __attribute__((__noreturn__)) +#define SPICE_GNUC_CONST __attribute__((__const__)) +#define SPICE_GNUC_UNUSED __attribute__((__unused__)) +#define SPICE_GNUC_NO_INSTRUMENT __attribute__((__no_instrument_function__)) +#else /* !__GNUC__ */ +#define SPICE_GNUC_PRINTF( format_idx, arg_idx ) +#define SPICE_GNUC_SCANF( format_idx, arg_idx ) +#define SPICE_GNUC_FORMAT( arg_idx ) +#define SPICE_GNUC_NORETURN +#define SPICE_GNUC_CONST +#define SPICE_GNUC_UNUSED +#define SPICE_GNUC_NO_INSTRUMENT +#endif /* !__GNUC__ */ + +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) +#define SPICE_GNUC_DEPRECATED __attribute__((__deprecated__)) +#else +#define SPICE_GNUC_DEPRECATED +#endif /* __GNUC__ */ + +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) +# define SPICE_GNUC_MAY_ALIAS __attribute__((may_alias)) +#else +# define SPICE_GNUC_MAY_ALIAS +#endif + +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +#define SPICE_GNUC_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) +#else +#define SPICE_GNUC_WARN_UNUSED_RESULT +#endif /* __GNUC__ */ + + +/* Guard C code in headers, while including them from C++ */ +#ifdef __cplusplus +# define SPICE_BEGIN_DECLS extern "C" { +# define SPICE_END_DECLS } +#else +# define SPICE_BEGIN_DECLS +# define SPICE_END_DECLS +#endif + +#ifndef FALSE +#define FALSE (0) +#endif + +#ifndef TRUE +#define TRUE (!FALSE) +#endif + +#undef MAX +#define MAX(a, b) (((a) > (b)) ? (a) : (b)) + +#undef MIN +#define MIN(a, b) (((a) < (b)) ? (a) : (b)) + +#undef ABS +#define ABS(a) (((a) < 0) ? -(a) : (a)) + +/* Count the number of elements in an array. The array must be defined + * as such; using this with a dynamically allocated array will give + * incorrect results. + */ +#define SPICE_N_ELEMENTS(arr) (sizeof (arr) / sizeof ((arr)[0])) + +#define SPICE_ALIGN(a, size) (((a) + ((size) - 1)) & ~((size) - 1)) + +/* Provide convenience macros for handling structure + * fields through their offsets. + */ + +#if defined(__GNUC__) && __GNUC__ >= 4 +# define SPICE_OFFSETOF(struct_type, member) \ + ((long) offsetof (struct_type, member)) +#else +# define SPICE_OFFSETOF(struct_type, member) \ + ((long) ((uint8_t*) &((struct_type*) 0)->member)) +#endif + +#define SPICE_CONTAINEROF(ptr, struct_type, member) \ + ((struct_type *)((uint8_t *)(ptr) - SPICE_OFFSETOF(struct_type, member))) + +#define SPICE_MEMBER_P(struct_p, struct_offset) \ + ((gpointer) ((guint8*) (struct_p) + (glong) (struct_offset))) +#define SPICE_MEMBER(member_type, struct_p, struct_offset) \ + (*(member_type*) SPICE_STRUCT_MEMBER_P ((struct_p), (struct_offset))) + +/* Provide simple macro statement wrappers: + * SPICE_STMT_START { statements; } SPICE_STMT_END; + * This can be used as a single statement, like: + * if (x) SPICE_STMT_START { ... } SPICE_STMT_END; else ... + * This intentionally does not use compiler extensions like GCC's '({...})' to + * avoid portability issue or side effects when compiled with different compilers. + */ +#if !(defined (SPICE_STMT_START) && defined (SPICE_STMT_END)) +# define SPICE_STMT_START do +# define SPICE_STMT_END while (0) +#endif + +/* + * The SPICE_LIKELY and SPICE_UNLIKELY macros let the programmer give hints to + * the compiler about the expected result of an expression. Some compilers + * can use this information for optimizations. + * + * The _SPICE_BOOLEAN_EXPR macro is intended to trigger a gcc warning when + * putting assignments in g_return_if_fail (). + */ +#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__) +#define _SPICE_BOOLEAN_EXPR(expr) \ + __extension__ ({ \ + int _g_boolean_var_; \ + if (expr) \ + _g_boolean_var_ = 1; \ + else \ + _g_boolean_var_ = 0; \ + _g_boolean_var_; \ +}) +#define SPICE_LIKELY(expr) (__builtin_expect (_SPICE_BOOLEAN_EXPR(expr), 1)) +#define SPICE_UNLIKELY(expr) (__builtin_expect (_SPICE_BOOLEAN_EXPR(expr), 0)) +#else +#define SPICE_LIKELY(expr) (expr) +#define SPICE_UNLIKELY(expr) (expr) +#endif + +#ifdef _MSC_VER +#define SPICE_UINT64_CONSTANT(x) (x ## UI64) +#define SPICE_INT64_CONSTANT(x) (x ## I64) +#else +#if LONG_MAX == 2147483647L +#define SPICE_UINT64_CONSTANT(x) (x ## ULL) +#define SPICE_INT64_CONSTANT(x) (x ## LL) +#else +#define SPICE_UINT64_CONSTANT(x) (x ## UL) +#define SPICE_INT64_CONSTANT(x) (x ## L) +#endif +#endif + +/* Little/Bit endian byte swapping */ + +#define SPICE_BYTESWAP16_CONSTANT(val) ((uint16_t) ( \ + (uint16_t) ((uint16_t) (val) >> 8) | \ + (uint16_t) ((uint16_t) (val) << 8))) + +#define SPICE_BYTESWAP32_CONSTANT(val) ((uint32_t) ( \ + (((uint32_t) (val) & (uint32_t) 0x000000ffU) << 24) | \ + (((uint32_t) (val) & (uint32_t) 0x0000ff00U) << 8) | \ + (((uint32_t) (val) & (uint32_t) 0x00ff0000U) >> 8) | \ + (((uint32_t) (val) & (uint32_t) 0xff000000U) >> 24))) + +#define SPICE_BYTESWAP64_CONSTANT(val) ((uint64_t) ( \ + (((uint64_t) (val) & \ + (uint64_t) SPICE_UINT64_CONSTANT(0x00000000000000ff)) << 56) | \ + (((uint64_t) (val) & \ + (uint64_t) SPICE_UINT64_CONSTANT(0x000000000000ff00)) << 40) | \ + (((uint64_t) (val) & \ + (uint64_t) SPICE_UINT64_CONSTANT(0x0000000000ff0000)) << 24) | \ + (((uint64_t) (val) & \ + (uint64_t) SPICE_UINT64_CONSTANT(0x00000000ff000000)) << 8) | \ + (((uint64_t) (val) & \ + (uint64_t) SPICE_UINT64_CONSTANT(0x000000ff00000000)) >> 8) | \ + (((uint64_t) (val) & \ + (uint64_t) SPICE_UINT64_CONSTANT(0x0000ff0000000000)) >> 24) | \ + (((uint64_t) (val) & \ + (uint64_t) SPICE_UINT64_CONSTANT(0x00ff000000000000)) >> 40) | \ + (((uint64_t) (val) & \ + (uint64_t) SPICE_UINT64_CONSTANT(0xff00000000000000)) >> 56))) + +/* Arch specific stuff for speed + */ +#if defined (__GNUC__) && (__GNUC__ >= 2) && defined (__OPTIMIZE__) +# if defined (__i386__) +# define SPICE_BYTESWAP16_IA32(val) \ + (__extension__ \ + ({ register uint16_t __v, __x = ((uint16_t) (val)); \ + if (__builtin_constant_p (__x)) \ + __v = SPICE_BYTESWAP16_CONSTANT (__x); \ + else \ + __asm__ ("rorw $8, %w0" \ + : "=r" (__v) \ + : "0" (__x) \ + : "cc"); \ + __v; })) +# if !defined (__i486__) && !defined (__i586__) \ + && !defined (__pentium__) && !defined (__i686__) \ + && !defined (__pentiumpro__) && !defined (__pentium4__) +# define SPICE_BYTESWAP32_IA32(val) \ + (__extension__ \ + ({ register uint32_t __v, __x = ((uint32_t) (val)); \ + if (__builtin_constant_p (__x)) \ + __v = SPICE_BYTESWAP32_CONSTANT (__x); \ + else \ + __asm__ ("rorw $8, %w0\n\t" \ + "rorl $16, %0\n\t" \ + "rorw $8, %w0" \ + : "=r" (__v) \ + : "0" (__x) \ + : "cc"); \ + __v; })) +# else /* 486 and higher has bswap */ +# define SPICE_BYTESWAP32_IA32(val) \ + (__extension__ \ + ({ register uint32_t __v, __x = ((uint32_t) (val)); \ + if (__builtin_constant_p (__x)) \ + __v = SPICE_BYTESWAP32_CONSTANT (__x); \ + else \ + __asm__ ("bswap %0" \ + : "=r" (__v) \ + : "0" (__x)); \ + __v; })) +# endif /* processor specific 32-bit stuff */ +# define SPICE_BYTESWAP64_IA32(val) \ + (__extension__ \ + ({ union { uint64_t __ll; \ + uint32_t __l[2]; } __w, __r; \ + __w.__ll = ((uint64_t) (val)); \ + if (__builtin_constant_p (__w.__ll)) \ + __r.__ll = SPICE_BYTESWAP64_CONSTANT (__w.__ll); \ + else \ + { \ + __r.__l[0] = SPICE_BYTESWAP32 (__w.__l[1]); \ + __r.__l[1] = SPICE_BYTESWAP32 (__w.__l[0]); \ + } \ + __r.__ll; })) + /* Possibly just use the constant version and let gcc figure it out? */ +# define SPICE_BYTESWAP16(val) (SPICE_BYTESWAP16_IA32 (val)) +# define SPICE_BYTESWAP32(val) (SPICE_BYTESWAP32_IA32 (val)) +# define SPICE_BYTESWAP64(val) (SPICE_BYTESWAP64_IA32 (val)) +# elif defined (__ia64__) +# define SPICE_BYTESWAP16_IA64(val) \ + (__extension__ \ + ({ register uint16_t __v, __x = ((uint16_t) (val)); \ + if (__builtin_constant_p (__x)) \ + __v = SPICE_BYTESWAP16_CONSTANT (__x); \ + else \ + __asm__ __volatile__ ("shl %0 = %1, 48 ;;" \ + "mux1 %0 = %0, @rev ;;" \ + : "=r" (__v) \ + : "r" (__x)); \ + __v; })) +# define SPICE_BYTESWAP32_IA64(val) \ + (__extension__ \ + ({ register uint32_t __v, __x = ((uint32_t) (val)); \ + if (__builtin_constant_p (__x)) \ + __v = SPICE_BYTESWAP32_CONSTANT (__x); \ + else \ + __asm__ __volatile__ ("shl %0 = %1, 32 ;;" \ + "mux1 %0 = %0, @rev ;;" \ + : "=r" (__v) \ + : "r" (__x)); \ + __v; })) +# define SPICE_BYTESWAP64_IA64(val) \ + (__extension__ \ + ({ register uint64_t __v, __x = ((uint64_t) (val)); \ + if (__builtin_constant_p (__x)) \ + __v = SPICE_BYTESWAP64_CONSTANT (__x); \ + else \ + __asm__ __volatile__ ("mux1 %0 = %1, @rev ;;" \ + : "=r" (__v) \ + : "r" (__x)); \ + __v; })) +# define SPICE_BYTESWAP16(val) (SPICE_BYTESWAP16_IA64 (val)) +# define SPICE_BYTESWAP32(val) (SPICE_BYTESWAP32_IA64 (val)) +# define SPICE_BYTESWAP64(val) (SPICE_BYTESWAP64_IA64 (val)) +# elif defined (__x86_64__) +# define SPICE_BYTESWAP32_X86_64(val) \ + (__extension__ \ + ({ register uint32_t __v, __x = ((uint32_t) (val)); \ + if (__builtin_constant_p (__x)) \ + __v = SPICE_BYTESWAP32_CONSTANT (__x); \ + else \ + __asm__ ("bswapl %0" \ + : "=r" (__v) \ + : "0" (__x)); \ + __v; })) +# define SPICE_BYTESWAP64_X86_64(val) \ + (__extension__ \ + ({ register uint64_t __v, __x = ((uint64_t) (val)); \ + if (__builtin_constant_p (__x)) \ + __v = SPICE_BYTESWAP64_CONSTANT (__x); \ + else \ + __asm__ ("bswapq %0" \ + : "=r" (__v) \ + : "0" (__x)); \ + __v; })) + /* gcc seems to figure out optimal code for this on its own */ +# define SPICE_BYTESWAP16(val) (SPICE_BYTESWAP16_CONSTANT (val)) +# define SPICE_BYTESWAP32(val) (SPICE_BYTESWAP32_X86_64 (val)) +# define SPICE_BYTESWAP64(val) (SPICE_BYTESWAP64_X86_64 (val)) +# else /* generic gcc */ +# define SPICE_BYTESWAP16(val) (SPICE_BYTESWAP16_CONSTANT (val)) +# define SPICE_BYTESWAP32(val) (SPICE_BYTESWAP32_CONSTANT (val)) +# define SPICE_BYTESWAP64(val) (SPICE_BYTESWAP64_CONSTANT (val)) +# endif +#else /* generic */ +# define SPICE_BYTESWAP16(val) (SPICE_BYTESWAP16_CONSTANT (val)) +# define SPICE_BYTESWAP32(val) (SPICE_BYTESWAP32_CONSTANT (val)) +# define SPICE_BYTESWAP64(val) (SPICE_BYTESWAP64_CONSTANT (val)) +#endif /* generic */ + + +#endif /* _H_SPICE_MACROS */ diff --git a/spice/protocol.h b/spice/protocol.h new file mode 100644 index 0000000..d3c5962 --- /dev/null +++ b/spice/protocol.h @@ -0,0 +1,152 @@ +/* + Copyright (C) 2009 Red Hat, Inc. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef _H_SPICE_PROTOCOL +#define _H_SPICE_PROTOCOL + +#include <spice/types.h> +#include <spice/enums.h> +#include <spice/start-packed.h> + +#define SPICE_MAGIC (*(uint32_t*)"REDQ") +#define SPICE_VERSION_MAJOR 2 +#define SPICE_VERSION_MINOR 2 + +// Encryption & Ticketing Parameters +#define SPICE_MAX_PASSWORD_LENGTH 60 +#define SPICE_TICKET_KEY_PAIR_LENGTH 1024 +#define SPICE_TICKET_PUBKEY_BYTES (SPICE_TICKET_KEY_PAIR_LENGTH / 8 + 34) + +typedef struct SPICE_ATTR_PACKED SpiceLinkHeader { + uint32_t magic; + uint32_t major_version; + uint32_t minor_version; + uint32_t size; +} SpiceLinkHeader; + +enum { + SPICE_COMMON_CAP_PROTOCOL_AUTH_SELECTION, + SPICE_COMMON_CAP_AUTH_SPICE, + SPICE_COMMON_CAP_AUTH_SASL, + SPICE_COMMON_CAP_MINI_HEADER, +}; + +typedef struct SPICE_ATTR_PACKED SpiceLinkMess { + uint32_t connection_id; + uint8_t channel_type; + uint8_t channel_id; + uint32_t num_common_caps; + uint32_t num_channel_caps; + uint32_t caps_offset; +} SpiceLinkMess; + +typedef struct SPICE_ATTR_PACKED SpiceLinkReply { + uint32_t error; + uint8_t pub_key[SPICE_TICKET_PUBKEY_BYTES]; + uint32_t num_common_caps; + uint32_t num_channel_caps; + uint32_t caps_offset; +} SpiceLinkReply; + +typedef struct SPICE_ATTR_PACKED SpiceLinkEncryptedTicket { + uint8_t encrypted_data[SPICE_TICKET_KEY_PAIR_LENGTH / 8]; +} SpiceLinkEncryptedTicket; + +typedef struct SPICE_ATTR_PACKED SpiceLinkAuthMechanism { + uint32_t auth_mechanism; +} SpiceLinkAuthMechanism; + +typedef struct SPICE_ATTR_PACKED SpiceDataHeader { + uint64_t serial; + uint16_t type; + uint32_t size; + uint32_t sub_list; //offset to SpiceSubMessageList[] +} SpiceDataHeader; + +typedef struct SPICE_ATTR_PACKED SpiceMiniDataHeader { + uint16_t type; + uint32_t size; +} SpiceMiniDataHeader; + +typedef struct SPICE_ATTR_PACKED SpiceSubMessage { + uint16_t type; + uint32_t size; +} SpiceSubMessage; + +typedef struct SPICE_ATTR_PACKED SpiceSubMessageList { + uint16_t size; + uint32_t sub_messages[0]; //offsets to SpicedSubMessage +} SpiceSubMessageList; + +#define SPICE_INPUT_MOTION_ACK_BUNCH 4 + +enum { + SPICE_PLAYBACK_CAP_CELT_0_5_1, + SPICE_PLAYBACK_CAP_VOLUME, + SPICE_PLAYBACK_CAP_LATENCY, + SPICE_PLAYBACK_CAP_OPUS, +}; + +enum { + SPICE_RECORD_CAP_CELT_0_5_1, + SPICE_RECORD_CAP_VOLUME, + SPICE_RECORD_CAP_OPUS, +}; + +enum { + SPICE_MAIN_CAP_SEMI_SEAMLESS_MIGRATE, + SPICE_MAIN_CAP_NAME_AND_UUID, + SPICE_MAIN_CAP_AGENT_CONNECTED_TOKENS, + SPICE_MAIN_CAP_SEAMLESS_MIGRATE, +}; + +enum { + SPICE_DISPLAY_CAP_SIZED_STREAM, + SPICE_DISPLAY_CAP_MONITORS_CONFIG, + SPICE_DISPLAY_CAP_COMPOSITE, + SPICE_DISPLAY_CAP_A8_SURFACE, + SPICE_DISPLAY_CAP_STREAM_REPORT, + SPICE_DISPLAY_CAP_LZ4_COMPRESSION, + SPICE_DISPLAY_CAP_PREF_COMPRESSION, +}; + +enum { + SPICE_INPUTS_CAP_KEY_SCANCODE, +}; + +enum { + SPICE_PORT_EVENT_OPENED, + SPICE_PORT_EVENT_CLOSED, + SPICE_PORT_EVENT_BREAK, +}; + +#include <spice/end-packed.h> + +#endif /* _H_SPICE_PROTOCOL */ diff --git a/spice/qxl_dev.h b/spice/qxl_dev.h new file mode 100644 index 0000000..a3e91a5 --- /dev/null +++ b/spice/qxl_dev.h @@ -0,0 +1,781 @@ +/* + Copyright (C) 2009 Red Hat, Inc. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#ifndef _H_QXL_DEV +#define _H_QXL_DEV + +#include <spice/types.h> +#include <spice/barrier.h> +#include <spice/ipc_ring.h> +#include <spice/enums.h> + +#include <spice/start-packed.h> + +#define REDHAT_PCI_VENDOR_ID 0x1b36 + +/* 0x100-0x11f reserved for spice, 0x1ff used for unstable work */ +#define QXL_DEVICE_ID_STABLE 0x0100 + +enum { + QXL_REVISION_STABLE_V04=0x01, + QXL_REVISION_STABLE_V06=0x02, + QXL_REVISION_STABLE_V10=0x03, + QXL_REVISION_STABLE_V12=0x04, +}; + +#define QXL_DEVICE_ID_DEVEL 0x01ff +#define QXL_REVISION_DEVEL 0x01 + +#define QXL_ROM_MAGIC (*(const uint32_t*)"QXRO") +#define QXL_RAM_MAGIC (*(const uint32_t*)"QXRA") + +enum { + QXL_RAM_RANGE_INDEX, + QXL_VRAM_RANGE_INDEX, + QXL_ROM_RANGE_INDEX, + QXL_IO_RANGE_INDEX, + + QXL_PCI_RANGES +}; + +/* qxl-1 compat: append only */ +enum { + QXL_IO_NOTIFY_CMD, + QXL_IO_NOTIFY_CURSOR, + QXL_IO_UPDATE_AREA, + QXL_IO_UPDATE_IRQ, + QXL_IO_NOTIFY_OOM, + QXL_IO_RESET, + QXL_IO_SET_MODE, /* qxl-1 */ + QXL_IO_LOG, + /* appended for qxl-2 */ + QXL_IO_MEMSLOT_ADD, + QXL_IO_MEMSLOT_DEL, + QXL_IO_DETACH_PRIMARY, + QXL_IO_ATTACH_PRIMARY, + QXL_IO_CREATE_PRIMARY, + QXL_IO_DESTROY_PRIMARY, + QXL_IO_DESTROY_SURFACE_WAIT, + QXL_IO_DESTROY_ALL_SURFACES, + /* appended for qxl-3 */ + QXL_IO_UPDATE_AREA_ASYNC, + QXL_IO_MEMSLOT_ADD_ASYNC, + QXL_IO_CREATE_PRIMARY_ASYNC, + QXL_IO_DESTROY_PRIMARY_ASYNC, + QXL_IO_DESTROY_SURFACE_ASYNC, + QXL_IO_DESTROY_ALL_SURFACES_ASYNC, + QXL_IO_FLUSH_SURFACES_ASYNC, + QXL_IO_FLUSH_RELEASE, + /* appended for qxl-4 */ + QXL_IO_MONITORS_CONFIG_ASYNC, + + QXL_IO_RANGE_SIZE +}; + +typedef uint64_t QXLPHYSICAL; +typedef int32_t QXLFIXED; //fixed 28.4 + +typedef struct SPICE_ATTR_PACKED QXLPointFix { + QXLFIXED x; + QXLFIXED y; +} QXLPointFix; + +typedef struct SPICE_ATTR_PACKED QXLPoint { + int32_t x; + int32_t y; +} QXLPoint; + +typedef struct SPICE_ATTR_PACKED QXLPoint16 { + int16_t x; + int16_t y; +} QXLPoint16; + +typedef struct SPICE_ATTR_PACKED QXLRect { + int32_t top; + int32_t left; + int32_t bottom; + int32_t right; +} QXLRect; + +typedef struct SPICE_ATTR_PACKED QXLURect { + uint32_t top; + uint32_t left; + uint32_t bottom; + uint32_t right; +} QXLURect; + +/* qxl-1 compat: append only */ +typedef struct SPICE_ATTR_PACKED QXLRom { + uint32_t magic; + uint32_t id; + uint32_t update_id; + uint32_t compression_level; + uint32_t log_level; + uint32_t mode; /* qxl-1 */ + uint32_t modes_offset; + uint32_t num_pages; + uint32_t pages_offset; /* qxl-1 */ + uint32_t draw_area_offset; /* qxl-1 */ + uint32_t surface0_area_size; /* qxl-1 name: draw_area_size */ + uint32_t ram_header_offset; + uint32_t mm_clock; + /* appended for qxl-2 */ + uint32_t n_surfaces; + uint64_t flags; + uint8_t slots_start; + uint8_t slots_end; + uint8_t slot_gen_bits; + uint8_t slot_id_bits; + uint8_t slot_generation; + /* appended for qxl-4 */ + uint8_t client_present; + uint8_t client_capabilities[58]; + uint32_t client_monitors_config_crc; + struct { + uint16_t count; + uint16_t padding; + QXLURect heads[64]; + } client_monitors_config; +} QXLRom; + +#define CLIENT_MONITORS_CONFIG_CRC32_POLY 0xedb88320 + +/* qxl-1 compat: fixed */ +typedef struct SPICE_ATTR_PACKED QXLMode { + uint32_t id; + uint32_t x_res; + uint32_t y_res; + uint32_t bits; + uint32_t stride; + uint32_t x_mili; + uint32_t y_mili; + uint32_t orientation; +} QXLMode; + +/* qxl-1 compat: fixed */ +typedef struct SPICE_ATTR_PACKED QXLModes { + uint32_t n_modes; + QXLMode modes[0]; +} QXLModes; + +/* qxl-1 compat: append only */ +typedef enum QXLCmdType { + QXL_CMD_NOP, + QXL_CMD_DRAW, + QXL_CMD_UPDATE, + QXL_CMD_CURSOR, + QXL_CMD_MESSAGE, + QXL_CMD_SURFACE, +} QXLCmdType; + +/* qxl-1 compat: fixed */ +typedef struct SPICE_ATTR_PACKED QXLCommand { + QXLPHYSICAL data; + uint32_t type; + uint32_t padding; +} QXLCommand; + +#define QXL_COMMAND_FLAG_COMPAT (1<<0) +#define QXL_COMMAND_FLAG_COMPAT_16BPP (2<<0) + +typedef struct SPICE_ATTR_PACKED QXLCommandExt { + QXLCommand cmd; + uint32_t group_id; + uint32_t flags; +} QXLCommandExt; + +typedef struct SPICE_ATTR_PACKED QXLMemSlot { + uint64_t mem_start; + uint64_t mem_end; +} QXLMemSlot; + +#define QXL_SURF_TYPE_PRIMARY 0 + +#define QXL_SURF_FLAG_KEEP_DATA (1 << 0) + +typedef struct SPICE_ATTR_PACKED QXLSurfaceCreate { + uint32_t width; + uint32_t height; + int32_t stride; + uint32_t format; + uint32_t position; + uint32_t mouse_mode; + uint32_t flags; + uint32_t type; + QXLPHYSICAL mem; +} QXLSurfaceCreate; + +#define QXL_COMMAND_RING_SIZE 32 +#define QXL_CURSOR_RING_SIZE 32 +#define QXL_RELEASE_RING_SIZE 8 + +SPICE_RING_DECLARE(QXLCommandRing, QXLCommand, QXL_COMMAND_RING_SIZE); +SPICE_RING_DECLARE(QXLCursorRing, QXLCommand, QXL_CURSOR_RING_SIZE); + +SPICE_RING_DECLARE(QXLReleaseRing, uint64_t, QXL_RELEASE_RING_SIZE); + +#define QXL_LOG_BUF_SIZE 4096 + +#define QXL_INTERRUPT_DISPLAY (1 << 0) +#define QXL_INTERRUPT_CURSOR (1 << 1) +#define QXL_INTERRUPT_IO_CMD (1 << 2) +#define QXL_INTERRUPT_ERROR (1 << 3) +#define QXL_INTERRUPT_CLIENT (1 << 4) +#define QXL_INTERRUPT_CLIENT_MONITORS_CONFIG (1 << 5) + +/* qxl-1 compat: append only */ +typedef struct SPICE_ATTR_PACKED QXLRam { + uint32_t magic; + uint32_t int_pending; + uint32_t int_mask; + uint8_t log_buf[QXL_LOG_BUF_SIZE]; + QXLCommandRing cmd_ring; + QXLCursorRing cursor_ring; + QXLReleaseRing release_ring; + QXLRect update_area; + /* appended for qxl-2 */ + uint32_t update_surface; + QXLMemSlot mem_slot; + QXLSurfaceCreate create_surface; + uint64_t flags; + + /* appended for qxl-4 */ + + /* used by QXL_IO_MONITORS_CONFIG_ASYNC */ + QXLPHYSICAL monitors_config; + +} QXLRam; + +typedef union QXLReleaseInfo { + uint64_t id; // in + uint64_t next; // out +} QXLReleaseInfo; + +typedef struct QXLReleaseInfoExt { + QXLReleaseInfo *info; + uint32_t group_id; +} QXLReleaseInfoExt; + +typedef struct SPICE_ATTR_PACKED QXLDataChunk { + uint32_t data_size; + QXLPHYSICAL prev_chunk; + QXLPHYSICAL next_chunk; + uint8_t data[0]; +} QXLDataChunk; + +typedef struct SPICE_ATTR_PACKED QXLMessage { + QXLReleaseInfo release_info; + uint8_t data[0]; +} QXLMessage; + +typedef struct SPICE_ATTR_PACKED QXLCompatUpdateCmd { + QXLReleaseInfo release_info; + QXLRect area; + uint32_t update_id; +} QXLCompatUpdateCmd; + +typedef struct SPICE_ATTR_PACKED QXLUpdateCmd { + QXLReleaseInfo release_info; + QXLRect area; + uint32_t update_id; + uint32_t surface_id; +} QXLUpdateCmd; + +typedef struct SPICE_ATTR_PACKED QXLCursorHeader { + uint64_t unique; + uint16_t type; + uint16_t width; + uint16_t height; + uint16_t hot_spot_x; + uint16_t hot_spot_y; +} QXLCursorHeader; + +typedef struct SPICE_ATTR_PACKED QXLCursor { + QXLCursorHeader header; + uint32_t data_size; + QXLDataChunk chunk; +} QXLCursor; + +enum { + QXL_CURSOR_SET, + QXL_CURSOR_MOVE, + QXL_CURSOR_HIDE, + QXL_CURSOR_TRAIL, +}; + +#define QXL_CURSUR_DEVICE_DATA_SIZE 128 + +typedef struct SPICE_ATTR_PACKED QXLCursorCmd { + QXLReleaseInfo release_info; + uint8_t type; + union { + struct SPICE_ATTR_PACKED { + QXLPoint16 position; + uint8_t visible; + QXLPHYSICAL shape; + } set; + struct SPICE_ATTR_PACKED { + uint16_t length; + uint16_t frequency; + } trail; + QXLPoint16 position; + } u; + uint8_t device_data[QXL_CURSUR_DEVICE_DATA_SIZE]; //todo: dynamic size from rom +} QXLCursorCmd; + +enum { + QXL_DRAW_NOP, + QXL_DRAW_FILL, + QXL_DRAW_OPAQUE, + QXL_DRAW_COPY, + QXL_COPY_BITS, + QXL_DRAW_BLEND, + QXL_DRAW_BLACKNESS, + QXL_DRAW_WHITENESS, + QXL_DRAW_INVERS, + QXL_DRAW_ROP3, + QXL_DRAW_STROKE, + QXL_DRAW_TEXT, + QXL_DRAW_TRANSPARENT, + QXL_DRAW_ALPHA_BLEND, + QXL_DRAW_COMPOSITE +}; + +typedef struct SPICE_ATTR_PACKED QXLRasterGlyph { + QXLPoint render_pos; + QXLPoint glyph_origin; + uint16_t width; + uint16_t height; + uint8_t data[0]; +} QXLRasterGlyph; + +typedef struct SPICE_ATTR_PACKED QXLString { + uint32_t data_size; + uint16_t length; + uint16_t flags; + QXLDataChunk chunk; +} QXLString; + +typedef struct SPICE_ATTR_PACKED QXLCopyBits { + QXLPoint src_pos; +} QXLCopyBits; + +typedef enum QXLEffectType +{ + QXL_EFFECT_BLEND = 0, + QXL_EFFECT_OPAQUE = 1, + QXL_EFFECT_REVERT_ON_DUP = 2, + QXL_EFFECT_BLACKNESS_ON_DUP = 3, + QXL_EFFECT_WHITENESS_ON_DUP = 4, + QXL_EFFECT_NOP_ON_DUP = 5, + QXL_EFFECT_NOP = 6, + QXL_EFFECT_OPAQUE_BRUSH = 7 +} QXLEffectType; + +typedef struct SPICE_ATTR_PACKED QXLPattern { + QXLPHYSICAL pat; + QXLPoint pos; +} QXLPattern; + +typedef struct SPICE_ATTR_PACKED QXLBrush { + uint32_t type; + union { + uint32_t color; + QXLPattern pattern; + } u; +} QXLBrush; + +typedef struct SPICE_ATTR_PACKED QXLQMask { + uint8_t flags; + QXLPoint pos; + QXLPHYSICAL bitmap; +} QXLQMask; + +typedef struct SPICE_ATTR_PACKED QXLFill { + QXLBrush brush; + uint16_t rop_descriptor; + QXLQMask mask; +} QXLFill; + +typedef struct SPICE_ATTR_PACKED QXLOpaque { + QXLPHYSICAL src_bitmap; + QXLRect src_area; + QXLBrush brush; + uint16_t rop_descriptor; + uint8_t scale_mode; + QXLQMask mask; +} QXLOpaque; + +typedef struct SPICE_ATTR_PACKED QXLCopy { + QXLPHYSICAL src_bitmap; + QXLRect src_area; + uint16_t rop_descriptor; + uint8_t scale_mode; + QXLQMask mask; +} QXLCopy, QXLBlend; + +typedef struct SPICE_ATTR_PACKED QXLTransparent { + QXLPHYSICAL src_bitmap; + QXLRect src_area; + uint32_t src_color; + uint32_t true_color; +} QXLTransparent; + +typedef struct SPICE_ATTR_PACKED QXLAlphaBlend { + uint16_t alpha_flags; + uint8_t alpha; + QXLPHYSICAL src_bitmap; + QXLRect src_area; +} QXLAlphaBlend; + +typedef struct SPICE_ATTR_PACKED QXLCompatAlphaBlend { + uint8_t alpha; + QXLPHYSICAL src_bitmap; + QXLRect src_area; +} QXLCompatAlphaBlend; + +typedef struct SPICE_ATTR_PACKED QXLRop3 { + QXLPHYSICAL src_bitmap; + QXLRect src_area; + QXLBrush brush; + uint8_t rop3; + uint8_t scale_mode; + QXLQMask mask; +} QXLRop3; + +typedef struct SPICE_ATTR_PACKED QXLLineAttr { + uint8_t flags; + uint8_t join_style; + uint8_t end_style; + uint8_t style_nseg; + QXLFIXED width; + QXLFIXED miter_limit; + QXLPHYSICAL style; +} QXLLineAttr; + +typedef struct SPICE_ATTR_PACKED QXLStroke { + QXLPHYSICAL path; + QXLLineAttr attr; + QXLBrush brush; + uint16_t fore_mode; + uint16_t back_mode; +} QXLStroke; + +typedef struct SPICE_ATTR_PACKED QXLText { + QXLPHYSICAL str; + QXLRect back_area; + QXLBrush fore_brush; + QXLBrush back_brush; + uint16_t fore_mode; + uint16_t back_mode; +} QXLText; + +typedef struct SPICE_ATTR_PACKED QXLBlackness { + QXLQMask mask; +} QXLBlackness, QXLInvers, QXLWhiteness; + +typedef struct SPICE_ATTR_PACKED QXLClip { + uint32_t type; + QXLPHYSICAL data; +} QXLClip; + +typedef enum { + QXL_OP_CLEAR = 0x00, + QXL_OP_SOURCE = 0x01, + QXL_OP_DST = 0x02, + QXL_OP_OVER = 0x03, + QXL_OP_OVER_REVERSE = 0x04, + QXL_OP_IN = 0x05, + QXL_OP_IN_REVERSE = 0x06, + QXL_OP_OUT = 0x07, + QXL_OP_OUT_REVERSE = 0x08, + QXL_OP_ATOP = 0x09, + QXL_OP_ATOP_REVERSE = 0x0a, + QXL_OP_XOR = 0x0b, + QXL_OP_ADD = 0x0c, + QXL_OP_SATURATE = 0x0d, + /* Note the jump here from 0x0d to 0x30 */ + QXL_OP_MULTIPLY = 0x30, + QXL_OP_SCREEN = 0x31, + QXL_OP_OVERLAY = 0x32, + QXL_OP_DARKEN = 0x33, + QXL_OP_LIGHTEN = 0x34, + QXL_OP_COLOR_DODGE = 0x35, + QXL_OP_COLOR_BURN = 0x36, + QXL_OP_HARD_LIGHT = 0x37, + QXL_OP_SOFT_LIGHT = 0x38, + QXL_OP_DIFFERENCE = 0x39, + QXL_OP_EXCLUSION = 0x3a, + QXL_OP_HSL_HUE = 0x3b, + QXL_OP_HSL_SATURATION = 0x3c, + QXL_OP_HSL_COLOR = 0x3d, + QXL_OP_HSL_LUMINOSITY = 0x3e +} QXLOperator; + +typedef struct { + uint32_t t00; + uint32_t t01; + uint32_t t02; + uint32_t t10; + uint32_t t11; + uint32_t t12; +} QXLTransform; + +/* The flags field has the following bit fields: + * + * operator: [ 0 - 7 ] + * src_filter: [ 8 - 10 ] + * mask_filter: [ 11 - 13 ] + * src_repeat: [ 14 - 15 ] + * mask_repeat: [ 16 - 17 ] + * component_alpha: [ 18 - 18 ] + * reserved: [ 19 - 31 ] + * + * The repeat and filter values are those of pixman: + * REPEAT_NONE = 0 + * REPEAT_NORMAL = 1 + * REPEAT_PAD = 2 + * REPEAT_REFLECT = 3 + * + * The filter values are: + * FILTER_NEAREST = 0 + * FILTER_BILINEAR = 1 + */ +typedef struct SPICE_ATTR_PACKED QXLComposite { + uint32_t flags; + + QXLPHYSICAL src; + QXLPHYSICAL src_transform; /* May be NULL */ + QXLPHYSICAL mask; /* May be NULL */ + QXLPHYSICAL mask_transform; /* May be NULL */ + QXLPoint16 src_origin; + QXLPoint16 mask_origin; +} QXLComposite; + +typedef struct SPICE_ATTR_PACKED QXLCompatDrawable { + QXLReleaseInfo release_info; + uint8_t effect; + uint8_t type; + uint16_t bitmap_offset; + QXLRect bitmap_area; + QXLRect bbox; + QXLClip clip; + uint32_t mm_time; + union { + QXLFill fill; + QXLOpaque opaque; + QXLCopy copy; + QXLTransparent transparent; + QXLCompatAlphaBlend alpha_blend; + QXLCopyBits copy_bits; + QXLBlend blend; + QXLRop3 rop3; + QXLStroke stroke; + QXLText text; + QXLBlackness blackness; + QXLInvers invers; + QXLWhiteness whiteness; + } u; +} QXLCompatDrawable; + +typedef struct SPICE_ATTR_PACKED QXLDrawable { + QXLReleaseInfo release_info; + uint32_t surface_id; + uint8_t effect; + uint8_t type; + uint8_t self_bitmap; + QXLRect self_bitmap_area; + QXLRect bbox; + QXLClip clip; + uint32_t mm_time; + int32_t surfaces_dest[3]; + QXLRect surfaces_rects[3]; + union { + QXLFill fill; + QXLOpaque opaque; + QXLCopy copy; + QXLTransparent transparent; + QXLAlphaBlend alpha_blend; + QXLCopyBits copy_bits; + QXLBlend blend; + QXLRop3 rop3; + QXLStroke stroke; + QXLText text; + QXLBlackness blackness; + QXLInvers invers; + QXLWhiteness whiteness; + QXLComposite composite; + } u; +} QXLDrawable; + +typedef enum QXLSurfaceCmdType { + QXL_SURFACE_CMD_CREATE, + QXL_SURFACE_CMD_DESTROY, +} QXLSurfaceCmdType; + +typedef struct SPICE_ATTR_PACKED QXLSurface { + uint32_t format; + uint32_t width; + uint32_t height; + int32_t stride; + QXLPHYSICAL data; +} QXLSurface; + +typedef struct SPICE_ATTR_PACKED QXLSurfaceCmd { + QXLReleaseInfo release_info; + uint32_t surface_id; + uint8_t type; + uint32_t flags; + union { + QXLSurface surface_create; + } u; +} QXLSurfaceCmd; + +typedef struct SPICE_ATTR_PACKED QXLClipRects { + uint32_t num_rects; + QXLDataChunk chunk; +} QXLClipRects; + +enum { + QXL_PATH_BEGIN = (1 << 0), + QXL_PATH_END = (1 << 1), + QXL_PATH_CLOSE = (1 << 3), + QXL_PATH_BEZIER = (1 << 4), +}; + +typedef struct SPICE_ATTR_PACKED QXLPathSeg { + uint32_t flags; + uint32_t count; + QXLPointFix points[0]; +} QXLPathSeg; + +typedef struct SPICE_ATTR_PACKED QXLPath { + uint32_t data_size; + QXLDataChunk chunk; +} QXLPath; + +enum { + QXL_IMAGE_GROUP_DRIVER, + QXL_IMAGE_GROUP_DEVICE, + QXL_IMAGE_GROUP_RED, + QXL_IMAGE_GROUP_DRIVER_DONT_CACHE, +}; + +typedef struct SPICE_ATTR_PACKED QXLImageID { + uint32_t group; + uint32_t unique; +} QXLImageID; + +typedef union { + QXLImageID id; + uint64_t value; +} QXLImageIDUnion; + +typedef enum QXLImageFlags { + QXL_IMAGE_CACHE = (1 << 0), + QXL_IMAGE_HIGH_BITS_SET = (1 << 1), +} QXLImageFlags; + +typedef enum QXLBitmapFlags { + QXL_BITMAP_DIRECT = (1 << 0), + QXL_BITMAP_UNSTABLE = (1 << 1), + QXL_BITMAP_TOP_DOWN = (1 << 2), // == SPICE_BITMAP_FLAGS_TOP_DOWN +} QXLBitmapFlags; + +#define QXL_SET_IMAGE_ID(image, _group, _unique) { \ + (image)->descriptor.id = (((uint64_t)_unique) << 32) | _group; \ +} + +typedef struct SPICE_ATTR_PACKED QXLImageDescriptor { + uint64_t id; + uint8_t type; + uint8_t flags; + uint32_t width; + uint32_t height; +} QXLImageDescriptor; + +typedef struct SPICE_ATTR_PACKED QXLPalette { + uint64_t unique; + uint16_t num_ents; + uint32_t ents[0]; +} QXLPalette; + +typedef struct SPICE_ATTR_PACKED QXLBitmap { + uint8_t format; + uint8_t flags; + uint32_t x; + uint32_t y; + uint32_t stride; + QXLPHYSICAL palette; + QXLPHYSICAL data; //data[0] ? +} QXLBitmap; + +typedef struct SPICE_ATTR_PACKED QXLSurfaceId { + uint32_t surface_id; +} QXLSurfaceId; + +typedef struct SPICE_ATTR_PACKED QXLQUICData { + uint32_t data_size; + uint8_t data[0]; +} QXLQUICData, QXLLZRGBData, QXLJPEGData; + +typedef struct SPICE_ATTR_PACKED QXLImage { + QXLImageDescriptor descriptor; + union { // variable length + QXLBitmap bitmap; + QXLQUICData quic; + QXLSurfaceId surface_image; + }; +} QXLImage; + +/* A QXLHead is a single monitor output backed by a QXLSurface. + * x and y offsets are unsigned since they are used in relation to + * the given surface, not the same as the x, y coordinates in the guest + * screen reference frame. */ +typedef struct SPICE_ATTR_PACKED QXLHead { + uint32_t id; + uint32_t surface_id; + uint32_t width; + uint32_t height; + uint32_t x; + uint32_t y; + uint32_t flags; +} QXLHead; + +typedef struct SPICE_ATTR_PACKED QXLMonitorsConfig { + uint16_t count; + uint16_t max_allowed; /* If it is 0 no fixed limit is given by the driver */ + QXLHead heads[0]; +} QXLMonitorsConfig; + +#include <spice/end-packed.h> + +#endif /* _H_QXL_DEV */ diff --git a/spice/qxl_windows.h b/spice/qxl_windows.h new file mode 100644 index 0000000..bc2ceff --- /dev/null +++ b/spice/qxl_windows.h @@ -0,0 +1,21 @@ +#ifndef _H_QXL_WINDOWS +#define _H_QXL_WINDOWS + +#include <spice/types.h> + +#include <spice/start-packed.h> + +enum { + QXL_ESCAPE_SET_CUSTOM_DISPLAY = 0x10001, + QXL_ESCAPE_MONITOR_CONFIG +}; + +typedef struct SPICE_ATTR_PACKED QXLEscapeSetCustomDisplay { + uint32_t xres; + uint32_t yres; + uint32_t bpp; +} QXLEscapeSetCustomDisplay; + +#include <spice/end-packed.h> + +#endif /* _H_QXL_WINDOWS */ diff --git a/spice/start-packed.h b/spice/start-packed.h new file mode 100644 index 0000000..ab3fa98 --- /dev/null +++ b/spice/start-packed.h @@ -0,0 +1,64 @@ +/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* Ideally this should all have been macros in a common headers, but + * its not possible to put pragmas into header files, so we have + * to use include magic. + * + * Use it like this: + * + * #include <spice/start-packed.h> + * + * typedef struct SPICE_ATTR_PACKED { + * ... + * } Type; + * + * #include <spice/end-packed.h> + * + */ + +#ifdef __GNUC__ + +#define SPICE_ATTR_PACKED __attribute__ ((__packed__)) + +#ifdef __MINGW32__ +#pragma pack(push,1) +#endif + +#else + +#pragma pack(push) +#pragma pack(1) +#define SPICE_ATTR_PACKED +#pragma warning(disable:4200) +#pragma warning(disable:4103) + +#endif diff --git a/spice/stats.h b/spice/stats.h new file mode 100644 index 0000000..452d89e --- /dev/null +++ b/spice/stats.h @@ -0,0 +1,67 @@ +/* + Copyright (C) 2009 Red Hat, Inc. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef _H_SPICE_STATS +#define _H_SPICE_STATS + +#include <spice/types.h> + +#define SPICE_STAT_SHM_NAME "/spice.%u" +#define SPICE_STAT_NODE_NAME_MAX 20 +#define SPICE_STAT_MAGIC (*(uint32_t*)"STAT") +#define SPICE_STAT_VERSION 1 + +enum { + SPICE_STAT_NODE_FLAG_ENABLED = (1 << 0), + SPICE_STAT_NODE_FLAG_VISIBLE = (1 << 1), + SPICE_STAT_NODE_FLAG_VALUE = (1 << 2), +}; + +#define SPICE_STAT_NODE_MASK_SHOW (SPICE_STAT_NODE_FLAG_ENABLED | SPICE_STAT_NODE_FLAG_VISIBLE) +#define SPICE_STAT_NODE_MASK_SHOW_VALUE (SPICE_STAT_NODE_MASK_SHOW | SPICE_STAT_NODE_FLAG_VALUE) + +typedef struct SpiceStatNode { + uint64_t value; + uint32_t flags; + uint32_t next_sibling_index; + uint32_t first_child_index; + char name[SPICE_STAT_NODE_NAME_MAX]; +} SpiceStatNode; + +typedef struct SpiceStat { + uint32_t magic; + uint32_t version; + uint32_t generation; + uint32_t num_of_nodes; + uint32_t root_index; + SpiceStatNode nodes[]; +} SpiceStat; + +#endif /* _H_SPICE_STATS */ diff --git a/spice/types.h b/spice/types.h new file mode 100644 index 0000000..c8c5333 --- /dev/null +++ b/spice/types.h @@ -0,0 +1,41 @@ +/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef _H_SPICE_TYPES +#define _H_SPICE_TYPES + +/* We always want the standard int types + * If they are not in stdint.h on your system, + * include the right one here. */ +#include <stdint.h> +#include <limits.h> + +#endif /* _H_SPICE_TYPES */ diff --git a/spice/vd_agent.h b/spice/vd_agent.h new file mode 100644 index 0000000..445b458 --- /dev/null +++ b/spice/vd_agent.h @@ -0,0 +1,260 @@ +/* + Copyright (C) 2009 Red Hat, Inc. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef _H_VD_AGENT +#define _H_VD_AGENT + +#include <spice/types.h> + +#include <spice/start-packed.h> + +enum { + VDP_CLIENT_PORT = 1, + VDP_SERVER_PORT, + VDP_END_PORT +}; + +typedef struct SPICE_ATTR_PACKED VDIChunkHeader { + uint32_t port; + uint32_t size; +} VDIChunkHeader; + +typedef struct SPICE_ATTR_PACKED VDAgentMessage { + uint32_t protocol; + uint32_t type; + uint64_t opaque; + uint32_t size; + uint8_t data[0]; +} VDAgentMessage; + +#define VD_AGENT_PROTOCOL 1 +#define VD_AGENT_MAX_DATA_SIZE 2048 + +#ifdef SPICE_DEPRECATED +#define VD_AGENT_CLIPBOARD_MAX_SIZE_DEFAULT 1024 +#define VD_AGENT_CLIPBOARD_MAX_SIZE_ENV "SPICE_CLIPBOARD_MAX_SIZE" +#endif + +enum { + VD_AGENT_MOUSE_STATE = 1, + VD_AGENT_MONITORS_CONFIG, + VD_AGENT_REPLY, + VD_AGENT_CLIPBOARD, + VD_AGENT_DISPLAY_CONFIG, + VD_AGENT_ANNOUNCE_CAPABILITIES, + VD_AGENT_CLIPBOARD_GRAB, + VD_AGENT_CLIPBOARD_REQUEST, + VD_AGENT_CLIPBOARD_RELEASE, + VD_AGENT_FILE_XFER_START, + VD_AGENT_FILE_XFER_STATUS, + VD_AGENT_FILE_XFER_DATA, + VD_AGENT_CLIENT_DISCONNECTED, + VD_AGENT_MAX_CLIPBOARD, + VD_AGENT_AUDIO_VOLUME_SYNC, + VD_AGENT_END_MESSAGE, +}; + +enum { + VD_AGENT_FILE_XFER_STATUS_CAN_SEND_DATA, + VD_AGENT_FILE_XFER_STATUS_CANCELLED, + VD_AGENT_FILE_XFER_STATUS_ERROR, + VD_AGENT_FILE_XFER_STATUS_SUCCESS, +}; + +typedef struct SPICE_ATTR_PACKED VDAgentFileXferStatusMessage { + uint32_t id; + uint32_t result; +} VDAgentFileXferStatusMessage; + +typedef struct SPICE_ATTR_PACKED VDAgentFileXferStartMessage { + uint32_t id; + uint8_t data[0]; +} VDAgentFileXferStartMessage; + +typedef struct SPICE_ATTR_PACKED VDAgentFileXferDataMessage { + uint32_t id; + uint64_t size; + uint8_t data[0]; +} VDAgentFileXferDataMessage; + +typedef struct SPICE_ATTR_PACKED VDAgentMonConfig { + /* + * Note a width and height of 0 can be used to indicate a disabled + * monitor, this may only be used with agents with the + * VD_AGENT_CAP_SPARSE_MONITORS_CONFIG capability. + */ + uint32_t height; + uint32_t width; + uint32_t depth; + int32_t x; + int32_t y; +} VDAgentMonConfig; + +enum { + VD_AGENT_CONFIG_MONITORS_FLAG_USE_POS = (1 << 0), +}; + +typedef struct SPICE_ATTR_PACKED VDAgentMonitorsConfig { + uint32_t num_of_monitors; + uint32_t flags; + VDAgentMonConfig monitors[0]; +} VDAgentMonitorsConfig; + +enum { + VD_AGENT_DISPLAY_CONFIG_FLAG_DISABLE_WALLPAPER = (1 << 0), + VD_AGENT_DISPLAY_CONFIG_FLAG_DISABLE_FONT_SMOOTH = (1 << 1), + VD_AGENT_DISPLAY_CONFIG_FLAG_DISABLE_ANIMATION = (1 << 2), + VD_AGENT_DISPLAY_CONFIG_FLAG_SET_COLOR_DEPTH = (1 << 3), +}; + +typedef struct SPICE_ATTR_PACKED VDAgentDisplayConfig { + uint32_t flags; + uint32_t depth; +} VDAgentDisplayConfig; + +#define VD_AGENT_LBUTTON_MASK (1 << 1) +#define VD_AGENT_MBUTTON_MASK (1 << 2) +#define VD_AGENT_RBUTTON_MASK (1 << 3) +#define VD_AGENT_UBUTTON_MASK (1 << 4) +#define VD_AGENT_DBUTTON_MASK (1 << 5) + +typedef struct SPICE_ATTR_PACKED VDAgentMouseState { + uint32_t x; + uint32_t y; + uint32_t buttons; + uint8_t display_id; +} VDAgentMouseState; + +typedef struct SPICE_ATTR_PACKED VDAgentReply { + uint32_t type; + uint32_t error; +} VDAgentReply; + +enum { + VD_AGENT_SUCCESS = 1, + VD_AGENT_ERROR, +}; + +typedef struct SPICE_ATTR_PACKED VDAgentClipboard { +#if 0 /* VD_AGENT_CAP_CLIPBOARD_SELECTION */ + uint8_t selection; + uint8_t __reserved[sizeof(uint32_t) - 1 * sizeof(uint8_t)]; +#endif + uint32_t type; + uint8_t data[0]; +} VDAgentClipboard; + +enum { + VD_AGENT_CLIPBOARD_NONE = 0, + VD_AGENT_CLIPBOARD_UTF8_TEXT, + VD_AGENT_CLIPBOARD_IMAGE_PNG, /* All clients with image support should support this one */ + VD_AGENT_CLIPBOARD_IMAGE_BMP, /* optional */ + VD_AGENT_CLIPBOARD_IMAGE_TIFF, /* optional */ + VD_AGENT_CLIPBOARD_IMAGE_JPG, /* optional */ +}; + +typedef struct SPICE_ATTR_PACKED VDAgentClipboardGrab { +#if 0 /* VD_AGENT_CAP_CLIPBOARD_SELECTION */ + uint8_t selection; + uint8_t __reserved[sizeof(uint32_t) - 1 * sizeof(uint8_t)]; +#endif + uint32_t types[0]; +} VDAgentClipboardGrab; + +typedef struct SPICE_ATTR_PACKED VDAgentClipboardRequest { +#if 0 /* VD_AGENT_CAP_CLIPBOARD_SELECTION */ + uint8_t selection; + uint8_t __reserved[sizeof(uint32_t) - 1 * sizeof(uint8_t)]; +#endif + uint32_t type; +} VDAgentClipboardRequest; + +typedef struct SPICE_ATTR_PACKED VDAgentClipboardRelease { +#if 0 /* VD_AGENT_CAP_CLIPBOARD_SELECTION */ + uint8_t selection; + uint8_t __reserved[sizeof(uint32_t) - 1 * sizeof(uint8_t)]; +#endif +} VDAgentClipboardRelease; + +typedef struct SPICE_ATTR_PACKED VDAgentMaxClipboard { + int32_t max; +} VDAgentMaxClipboard; + +typedef struct SPICE_ATTR_PACKED VDAgentAudioVolumeSync { + uint8_t is_playback; + uint8_t mute; + uint8_t nchannels; + uint16_t volume[0]; +} VDAgentAudioVolumeSync; + +enum { + VD_AGENT_CAP_MOUSE_STATE = 0, + VD_AGENT_CAP_MONITORS_CONFIG, + VD_AGENT_CAP_REPLY, + VD_AGENT_CAP_CLIPBOARD, + VD_AGENT_CAP_DISPLAY_CONFIG, + VD_AGENT_CAP_CLIPBOARD_BY_DEMAND, + VD_AGENT_CAP_CLIPBOARD_SELECTION, + VD_AGENT_CAP_SPARSE_MONITORS_CONFIG, + VD_AGENT_CAP_GUEST_LINEEND_LF, + VD_AGENT_CAP_GUEST_LINEEND_CRLF, + VD_AGENT_CAP_MAX_CLIPBOARD, + VD_AGENT_CAP_AUDIO_VOLUME_SYNC, + VD_AGENT_CAP_MONITORS_CONFIG_POSITION, + VD_AGENT_END_CAP, +}; + +enum { + VD_AGENT_CLIPBOARD_SELECTION_CLIPBOARD = 0, + VD_AGENT_CLIPBOARD_SELECTION_PRIMARY, + VD_AGENT_CLIPBOARD_SELECTION_SECONDARY, +}; + +typedef struct SPICE_ATTR_PACKED VDAgentAnnounceCapabilities { + uint32_t request; + uint32_t caps[0]; +} VDAgentAnnounceCapabilities; + +#define VD_AGENT_CAPS_SIZE_FROM_MSG_SIZE(msg_size) \ + (((msg_size) - sizeof(VDAgentAnnounceCapabilities)) / sizeof(uint32_t)) + +#define VD_AGENT_CAPS_SIZE ((VD_AGENT_END_CAP + 31) / 32) + +#define VD_AGENT_CAPS_BYTES (((VD_AGENT_END_CAP + 31) / 8) & ~3) + +#define VD_AGENT_HAS_CAPABILITY(caps, caps_size, index) \ + ((index) < (caps_size * 32) && ((caps)[(index) / 32] & (1 << ((index) % 32)))) + +#define VD_AGENT_SET_CAPABILITY(caps, index) \ + { (caps)[(index) / 32] |= (1 << ((index) % 32)); } + +#include <spice/end-packed.h> + +#endif /* _H_VD_AGENT */ diff --git a/spice/vdi_dev.h b/spice/vdi_dev.h new file mode 100644 index 0000000..def88fc --- /dev/null +++ b/spice/vdi_dev.h @@ -0,0 +1,86 @@ +/* + Copyright (C) 2009 Red Hat, Inc. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef _H_VDI_DEV +#define _H_VDI_DEV + +#include <spice/types.h> +#include <spice/barrier.h> +#include <spice/ipc_ring.h> + +#include <spice/start-packed.h> + +#ifndef SPICE_DISABLE_DEPRECATED +#error "This SPICE interface is deprecated" +#endif + +#define REDHAT_PCI_VENDOR_ID 0x1b36 + +#define VDI_PORT_DEVICE_ID 0x0105 +#define VDI_PORT_REVISION 0x01 + +#define VDI_PORT_INTERRUPT (1 << 0) + +#define VDI_PORT_MAGIC (*(uint32_t*)"VDIP") + +typedef struct SPICE_ATTR_PACKED VDIPortPacket { + uint32_t gen; + uint32_t size; + uint8_t data[512 - 2 * sizeof(uint32_t)]; +} VDIPortPacket; + +SPICE_RING_DECLARE(VDIPortRing, VDIPortPacket, 32); + +enum { + VDI_PORT_IO_RANGE_INDEX, + VDI_PORT_RAM_RANGE_INDEX, +}; + +enum { + VDI_PORT_IO_CONNECTION, + VDI_PORT_IO_NOTIFY = 4, + VDI_PORT_IO_UPDATE_IRQ = 8, + + VDI_PORT_IO_RANGE_SIZE = 12 +}; + +typedef struct SPICE_ATTR_PACKED VDIPortRam { + uint32_t magic; + uint32_t generation; + uint32_t int_pending; + uint32_t int_mask; + VDIPortRing input; + VDIPortRing output; + uint32_t reserv[32]; +} VDIPortRam; + +#include <spice/end-packed.h> + +#endif /* _H_VDI_DEV */ |