This syntax was only used in protocol 1 which has been removed
time ago.
Beside not being used it's confusing and prone to errors,
array size is specified using 2 identifiers, one reporting
bytes and the other number of items, one used for marshalling,
the other for demarshalling.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Avoid buffer overflows decoding images. On compression we compute
lengths till end of line so it won't cause regressions.
Proved by fuzzing the code.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Uri Lublin <uril@redhat.com>
Avoid some overflow in code due to images too big or
negative numbers.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Uri Lublin <uril@redhat.com>
All paths already pass some data to quic_decode_begin but for the
test check it, it's not that expensive test.
Checking for not 0 is enough, all other words will potentially be
read calling more_io_words but we need one to avoid a potential
initial buffer overflow or deferencing an invalid pointer.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Uri Lublin <uril@redhat.com>
This is the couterpart of spice-protocol commit
commit cbe7b2c28543f4c5e57d1db1b753b73a64104162 (HEAD -> master, origin/master, origin/HEAD)
Author: SimonP <simonp.git@gmail.com>
protocol: Add support for side mouse buttons
Side mouse buttons currently do not exist in the protocol, causing them
to be inexplicably ignored by VMs in virt-manager and such. This lays
the groundwork for fixing that issue.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Kevin Pouget <kpouget@redhat.com>
There's no point on checking an empty IP address, an IP
address is never empty.
This also solve some compiler warnings trying to possibly
pass a NULL pointer to memcmp or setting a variable without
reading it.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Uri Lublin <uril@redhat.com>
The "##" before __VA_ARGS__ is a GCC extension.
Try to limit its usage where necessary.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Uri Lublin <uril@redhat.com>
In backtrace.h spice_backtrace is defined as:
#if defined(WIN32) && !defined(__MINGW32__)
#define spice_backtrace()
#else
..
so don't try to compile if an empty macro is used.
Currently not causing any issue as we use MingW on Windows but
does not hurt is code is more portable.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Uri Lublin <uril@redhat.com>
Instead of just plain preprocessor macros use an enum.
This is more type safe and could produce better debugging
type information.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Julien Ropé <jrope@gmail.com>
mode should be an enumeration value of SpiceAudioDataMode.
Return type is just a boolean.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Julien Ropé <jrope@gmail.com>
In Meson better to use --werror option instead to manually add to
options.
Also this prevents build if spice-protocol deprecate some stuff
or fails the build if any warning occur.
This fixes an issue for
https://gitlab.freedesktop.org/spice/spice/-/issues/44.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Ropé <jrope@gmail.com>
Some Windows headers define "small" causing issues.
Use "small_rect" instead. For coherence use "big_rect" instead of
"big".
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Francesco Giudici <fgiudici@redhat.com>
The "more_space" callback is used in both decode and encode path to provide
either more space to read or more space to write.
The current implementation was dealing only to provide more space to write
(that is encoding) crashing in case it was used for decoding.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Uri Lublin <uril@redhat.com>
QUIC uses different methods to reduce image size.
One uses RLE on pixels. Using fixed images allows to better
test these paths increase code coverage.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
libgthread was needed to call g_thread_init.
This was removed by this commit:
commit 3e116a6c71
Date: Wed Feb 6 13:32:09 2019 +0000
Obsolete Glib cleanup
We require at least GLib 2.38, remove code and check to
support earlier versions.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
SpiceCopy and SpiceBlend are typedefs of the same structure.
This to prove that canvas_draw_blend and canvas_draw_copy do
exactly the same thing.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
Flexible arrays cannot have other fields following, even
if the fields are from a containing structure.
To fix this use an union and put the additional field inside
other structure in the union.
The final layout is the same but the compiler is not complaining.
This works on both GCC and Visual Studio.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Add agent.h and agent.c to deal with some common agent job:
- checking message from network and fixing network order.
- send back file transfer status.
Code based on Linux agent and Windows agent.
AgentXxxx and agent_xxx are used to avoid conflicts with protocol.
See agent.h for more detail on how to use these APIs.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Containing project can request a greater SPICE protocol version.
This will be taken into account while checking our requirements.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
Of all SPICE_MSGC_SMARTCARD_xxx constants only SPICE_MSGC_SMARTCARD_DATA
is used by both spice-gtk and spice-server.
Generate the right constant, all obsolete ones will not be generated.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
This structure is not used by both spice-gtk and spice-server.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
We want to obsolete from enumeration values, currently CELT.
The removal of check in has_attr is not an issue, as the attributes
are already checked by fix_attributes calls.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
These messages are used to exchange Streaming Quality messages between
SPICE client and SPICE server:
- `SPICE_MSGC_MAIN_QUALITY_INDICATOR`: a client->server message on the
Main channel. This message is used by the client to share streaming
quality observation with the server and the adaptive streaming
control center. The format of the string message is not specified
yet, it will depend of the sender/receiver final implementation.
- `SPICE_MSG_DISPLAY_QUALITY_INDICATOR`: a server->client message on
the Display channel. This message is used to inform the client about
adaptive-streaming specific details. The client should use it to
configure its quality-message generation algorithms. The format of
the string message is not specified yet, it will depend of the
sender/receiver final implementation.
As an example, a `SPICE_MSG_DISPLAY_QUALITY_INDICATOR` message can
inform the client about the requested framerate (say, 60 FPS); and the
client will send a `SPICE_MSGC_MAIN_QUALITY_INDICATOR` warning message
when the measured framerate drops below 45 FPS.
Signed-off-by: Kevin Pouget <kpouget@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
All other projects just use master version of spice-protocol.
Do this also on Windows to use the last sources, it could happen
that we need them and not last packaged version.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
"level" can have value "DEBUG". In some environment "DEBUG" is
used as preprocessor name to enable some debugging code.
Using -DDEBUG option (or similar) cause "DEBUG" to be defined as "1"
so "G_PASTE(G_LOG_LEVEL_, level)" will be expanded to "G_LOG_LEVEL_1"
instead of "G_LOG_LEVEL_DEBUG".
Just concatenate the two literal to avoid "DEBUG" expansion.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
warning_level 2 setting for Meson add the same "-Wall -Wextra"
options to GCC compiler.
This removes a warning using Meson.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
This patch introduces `set_bitmap` and `test_bitmap` + relevant
macros, adapted from `<qemu>/include/qemu/bitops.h`.
These functions differ from `set_bit`/`test_bit` as they can set/test
bits in bit arrays longer than scalar data-types.
Signed-off-by: Kevin Pouget <kpouget@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>