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>
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>
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>
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>
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>
No need to compute these variable always, only if we have
a reference to a previous sequence.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Francesco Giudici <fgiudici@redhat.com>
The loop is always executed once so use a do {} while construct
to avoid the repetition.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Francesco Giudici <fgiudici@redhat.com>
Boundaries checks already done some lines above, no needs
to repeat for each pixel.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Francesco Giudici <fgiudici@redhat.com>
"buffers" and "marshallers" are always pointing to the static
buffers inside the same structure.
Use single array fields to avoid having initialize and have them.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Julien Rope <jrope@redhat.com>
This macro was suggested to simplify hot path expensive checks
which should be disable in production environments.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Francesco Giudici <fgiudici@redhat.com>
Include headers required for implementation only in the
implementation file.
This remove dependency and avoid the user component having to
check for header flags (in this case HAVE_CELT051 and HAVE_OPUS).
This make easier integration in other components.
This also make compilation faster.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
quic_config is used only by the implementation so include it
only from the implementation file.
This remove dependency.
This make easier integration in other components.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
The agent-interface is an experimental instrumentation library for
capturing and sharing Spice performance indicators with an external
agent.
--enable-instrumentation=[recorder/agent/no]
Enable instrumentation [default=no]
The former configuration option '--enable-recorder' is transformed
into '--enable-instrumentation=recorder'.
Signed-off-by: Kevin Pouget <kpouget@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
agent_interface_start: this function allows launching the agent
interface (ie, its listening socket) on a given port.
agent_interface_set_on_connect_cb: this function allows passing a
callback function that will be triggered when a client (a Local Agent)
connects to the Agent Interface socket.
agent_interface_set_forward_quality_cb: this function allows SPICE to
provide a function that will forward Quality messages received by the
Agent Interface towards SPICE server, for a centralized processing of
the messages.
Signed-off-by: Kevin Pouget <kpouget@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
When initialized (recorder_initialization), the Agent Interface launch
a GThread (handle_communications) that opens a TCP server socket and
waits for Smart Local Agent connections. When a Local Agent connects
to the sockets, the communication is initialized
(agent_initialize_communication), the communication socket is stored
and the list of Recorders is sent. In return, the local agent
indicates which recorders to enable.
On the SPICE side, the Agent Interface handles the record() calls
(recorder_append*). When a record is received from SPICE, and if the
recorder is enabled, the record entry is sent through the TCP
connection. Otherwise, the record is dropped.
Signed-off-by: Kevin Pouget <kpouget@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
Pull version update and some features.
Version update changed copyright in files to LGPLv2, more
compatible with SPICE.
One of the feature is the support for absolute time.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
This should always be defined and including config.h is a requirement.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
git.mk seems to have issues with Makefile rules generating multiple
files so add manually this file.
This avoid SPICE server to generate distribution files with
"-dirty" suffix.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
Fixes out-of-tree builds.
For example spice-gtk out-of-tree build fails with:
../subprojects/spice-common/common/generated_client_marshallers.h:19:10:
fatal error: client_marshallers.h: No such file or directory
#include "client_marshallers.h"
^~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Uri Lublin <uril@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
Access the items by names instead of indexes.
Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
spice-gtk and spice-server will use spice_common_client_dep
and spice_common_server_dep as dependencies.
However they will depend on both spice-common client/server
libraries and their sources causing the sources to be compiled
multiple times and causes linker errors on spice-gtk.
The issue can be observed doing a "find -name \*generated\*.o"
in Meson build directory.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
All generated file depends on generated_messages.h which is
generated too.
So add an explicit dependency from all generated file
(except generated_messages.h generator) to generated_messages.h
generator.
This fixes compiling SPICE server where generated_messages.h
was not generated at all.
Add dependency to the include header to make Meson generate the
proper include flag.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
This commit adds a SPICE_UNREACHABLE macro (courtesy of Frediano)
so that gcc does not think that code control can go past
spice_return_{val_,}if_fail(), spice_critical() and spice_error()
This avoids this kind of warnings:
fallthrough.c:
#include "log.h"
int main(int argc, char **argv)
{
switch(argc) {
case 1:
spice_critical("foo");
default:
return 0;
}
}
$ gcc -c $(pkg-config --cflags --libs glib-2.0 spice-protocol)
-I common -Wimplicit-fallthrough=5 ./fallthrough.c
In file included from ./fallthrough.c:1:
./fallthrough.c: In function 'main':
common/log.h:73:5: warning: this statement may fall through [-Wimplicit-fallthrough=]
73 | spice_log(G_LOG_LEVEL_CRITICAL, SPICE_STRLOC, __FUNCTION__, "" format, ## __VA_ARGS__); \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./fallthrough.c:8:25: note: in expansion of macro 'spice_critical'
8 | spice_critical("foo");
| ^~~~~~~~~~~~~~
./fallthrough.c:9:17: note: here
9 | default:
| ^~~~~~~
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
Pull some fixes and features.
One of the feature is the support for @output setting to redirect
log output.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
QUIC_VERSION_MINOR is never used.. Set QUIC_VERSION_MINOR to the same
version as QUIC_VERSION_MAJOR to avoid breaking backwards compatibility,
and fix the QUIC_VERSION macro.
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>