Commit Graph

23 Commits

Author SHA1 Message Date
Frediano Ziglio
587c04f79e Improve big endian support for agent messages
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>
2020-10-25 20:01:54 +00:00
Frediano Ziglio
ed68d491fd Do not check for HAVE_CONFIG_H
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>
2019-04-30 09:26:55 +01:00
Frediano Ziglio
ca7fe46a73 agent-msg-filter: Simplify code
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>
2019-02-12 21:02:44 +00:00
Christophe Fergeau
ed44faef04 Replace remaining spice_printerr() with g_warning()
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>
2018-06-28 13:21:48 +01:00
Frediano Ziglio
73e6d88b20 Fix minor inconsistencies with declaration and definition
Declaration used gboolean while definition used int.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2017-02-16 10:28:52 +00:00
Pavel Grunt
dfccfa7083 agent-msg-filter: Remove extra headers
Signed-off-by: Pavel Grunt <pgrunt@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-10-11 13:41:37 +01:00
Pavel Grunt
cd80b9fc78 agent-filter: Use enum as return value
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>
2016-09-16 11:54:56 +01:00
Pavel Grunt
5d6e3ff1e9 agent-filter: Constantify parameter
Filter should not modify data

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-09-12 13:22:11 +01:00
Jonathon Jongsma
5c64e01111 AgentMsgFilter: use typedef
Instead of using the full 'struct AgentMsgFilter', use the typedef name

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-05-24 17:46:05 +01:00
Pavel Grunt
9d777e427a agent-msg-filter: Move include from header
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-05-04 14:40:51 +01:00
Christophe Fergeau
0df59fcfc9 agent: Sync AgentMsgFilter state upon agent connection
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>
2016-03-21 10:34:29 +00:00
Christophe Fergeau
79e02e98ab Revert "fix regression due to callback called earlier"
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>
2016-03-21 10:34:22 +00:00
Frediano Ziglio
5916dd8fa6 rename red-dispatcher.* files to red-qxl.*
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-04 15:27:41 +00:00
Frediano Ziglio
a1e62fa5ae fix regression due to callback called earlier
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>
2016-02-19 09:51:25 +00:00
Jonathon Jongsma
1f21008060 Remove use of global 'reds' from AgentMsgFilter
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-02-16 10:54:30 +00:00
Frediano Ziglio
aadb945570 Remove global 'dispatchers', 'num_active_workers' variables
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>
2016-02-16 10:10:58 +00:00
Frediano Ziglio
525cd67be7 server: rename files
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2015-12-03 23:54:32 +00:00
Hans de Goede
db278430f8 server: Add support for filtering out agent file-xfer msgs (rhbz#961848)
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2013-06-06 16:07:30 +02:00
Alon Levy
d694739b21 server: Filter VD_AGENT_MONITORS_CONFIG
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.
2012-09-13 14:47:32 +03:00
Marc-André Lureau
b34fd7432d Use the spice-common logging functions
It will abort by default for critical level messages. That behaviour
can be tuned at runtime.
2012-03-25 19:00:00 +02:00
Christophe Fergeau
78c1465ed3 add #include <config.h> to all source files
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
2011-05-03 14:44:10 +02:00
Hans de Goede
3accb60240 server: add discard all option to agent message filter 2011-04-04 11:30:30 +02:00
Hans de Goede
c2db6d1066 spice-server: Add the ability to filter agent messages 2011-03-24 17:28:21 +01:00