Big endian machines on server are not officially supported but won't
hurt.
Messages from client are always encoded as little endian (as all
SPICE protocol).
Convert fields from little endian to host endian on some places
where numbers are used and not just binary copied.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Uri Lublin <ulublin@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>
Most of the time result is set to AGENT_MSG_FILTER_OK, set at
the beginning and change if necessary.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
The remaining occurrences of spice_printerr() are warnings when
something unexpected happens, they can be replaced with g_warning() so
that users of spice-server can redirect them with
g_log_set_default_handler().
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
Explicitely discard AGENT_MSG_FILTER_MONITORS_CONFIG messages
from the agent.
Also remove unused AGENT_MSG_FILTER_END
Acked-by: Frediano Ziglio <fziglio@redhat.com>
AgentMsgFilter needs to know whether monitors config messages need to be
filtered or not. This used to be done from within
agent_msg_filter_config() using the global RedsState, but this got more
tricky as it was removed.
A first attempt a1e62fa5ae caused crashes on qemu startup with
"qemu-system-x86_64 -spice port=5900" (without -vga qxl). A second
attempt added a RedsState* argument to agent_msg_filter_config() which
in my opinion is not really nice from a layering point of view.
This new attempt makes sure AgentMsgFilter state is correct when the
filter is set to stop discarding all data, which allows to remove direct
use of RedsState from within AgentMsgFilter.
Acked-by: Frediano Ziglio <fziglio@redhat.com>
Passing Reds into agent-msg-filter.[ch] isn't the right thing to do from
a layering point of view.
This reverts commit a1e62fa5ae.
Acked-by: Frediano Ziglio <fziglio@redhat.com>
Patch 1f21008060 ("Remove use of global
'reds' from AgentMsgFilter") introduced a regression. This because
QXLInterface->client_monitors_config was called before returning
from spice_add_interface. Some client of spice-server expect the
spice_add_interface already returned and some state change was done
before client_monitors_config was called.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
Since these are server-level variables, move them into RedsState.
However, num_active_workers was removed because:
- each dispatcher always has 1 active worker, so we can determine the
number of active workers by counting the dispatchers
- it was never actually set correctly. Even if there was more than one
worker, this variable was always only set to either 0 or 1.
This change required moving a bunch of helper code into RedsState as
well, an providing some RedDispatcher interfaces to access dispatcher
information from RedsState.
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
If the guest supports client monitors config we pass it the
VDAgentMonitorsConfig message via the
QXLInterface::client_monitors_config api instead of via the vdagent.
When using config.h, it must be the very first include in all source
files since it contains #define that may change the compilation process
(eg libc structure layout changes when it's used to enable large file
support on 32 bit x86 archs). This commit adds it at the beginning
of all .c and .cpp files