Commit Graph

181 Commits

Author SHA1 Message Date
Frediano Ziglio
1d4fb2fee7 red-parse-qxl: Use a base reference class for RedCursorCmd
Don't code manually reference counting for this structure

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2021-08-04 13:01:05 +01:00
orbea
c5fe3df1ef build: Fix undefined pthread references
The build fails with slibtool while GNU libtool hide the issue
by silently ignoring -no-undefined.

ax_pthread.m4 is sourced from:

e68e8f6f62/m4/ax_pthread.m4

Downstream issue: https://bugs.gentoo.org/780027

Signed-off-by: orbea <orbea@riseup.net>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
2021-05-18 08:30:15 +01:00
Frediano Ziglio
8c458fa35e Fix g_memdup deprecation warning with glib >= 2.68
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-05-05 06:35:56 +01:00
Frediano Ziglio
46cda65123 build: Remove GObject dependency
Not used anymore.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-05-01 06:58:09 +01:00
Frediano Ziglio
f6f998004b Wrap spice.h in order to do some adjustment
Instead of including spice.h directly include an header that wraps
it. This allows to remove the SPICE_SERVER_INTERNAL define.
Currently is used to rename SpiceCharDeviceInstance to RedCharDevice
and reduce its visibility to hidden. This remove some warnings
and some weird code in the source.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-05-01 06:58:09 +01:00
Frediano Ziglio
fe0298a290 safe-list: Add a class to implement a list with safe iterators
The reason to not using STL is that our code from how was designed requires
the iterator to be safe to the delete of the element pointed by the iterator.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-05-01 06:58:09 +01:00
Frediano Ziglio
75679dc95d dispatcher: Use IS-A relationship for Dispatcher hierarchy
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-05-01 06:58:09 +01:00
Frediano Ziglio
435ea33540 Reduce C++ symbols visibility
This allows the compiler to do some more optimisations on the
produced binary.
To allows possible future portability include header/footer in
some helper header files.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-05-01 06:58:09 +01:00
Frediano Ziglio
38cd152952 automake: Link with C++ linker
If automake sees no C++ files in the source it assumes have to
use C linker settings not linking C++ library.
This was not a problem as code did not use C++ libraries but next
patch will use pure virtual function call.
It could be provided but as later we will use RTTI use C++ library.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-05-01 06:58:09 +01:00
Frediano Ziglio
3a05720eaa Introduce some utilities for C++
red::add_ref will be used to increment a reference counter
and return the object pointer.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-05-01 06:58:09 +01:00
Frediano Ziglio
e6e6ded681 Use C++ IS-A relationship for RedChannelClient and RedChannel
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-05-01 06:58:08 +01:00
Frediano Ziglio
c4b4b967fb Allows C++ to be used in sources
Enable C++ compiler

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-05-01 06:58:08 +01:00
Frediano Ziglio
832ab9709c build: Fix a warning for Autoconf
Remove this warning:

server/Makefile.am:5: warning: SUBDIRS was already defined in condition TRUE, which includes condition ENABLE_TESTS ...
server/Makefile.am:2: ... 'SUBDIRS' previously defined here

This was caused by the recent commit 38c7964d53
("build: Make building the test binaries optional under Autoconf")

This problems was also causing some issues as "noinst_PROGRAMS" target
were not compiled as expected.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-03-26 14:11:38 +00:00
Frediano Ziglio
38c7964d53 build: Make building the test binaries optional under Autoconf
Following similar change for Meson.
Allow to save some time packaging and some dependencies.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-03-26 09:10:39 +00:00
Frediano Ziglio
626ad248f5 build: Update spice-common integration
Use new common.m4 include file to make easier to integrate
with spice-common repository.
The new include will allow for instance spice-common to
add additional dependencies without changes (or minor) to
spice-server.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Kevin Pouget <kpouget@redhat.com>
2020-03-02 14:04:06 +00:00
Victor Toso
7848ee3faf Remove glib-compat.h
Not used since 03d46e9e "build-sys: Raise glib requirement to 2.38" in
2019-02-05

Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-02-26 13:01:43 +00:00
Frediano Ziglio
34455d47a9 build: Cleanup old library flags
OpenGL and Slirp requirement were removed much time ago.
OpenGL was removed by c5c176a5c7
(cfr "server: remove OpenGL", Set 2013).
Slirp was removed by ef9a8bf053
(cfr "Remove tunneling support", Oct 2013).

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2019-11-25 13:20:18 +00:00
Jeremy White
cd2a317096 Add support for clients connecting with the WebSocket protocol.
We do this by auto detecting the inbound http(s) 'GET' and probing
for a well formulated WebSocket binary connection, such as used
by the spice-html5 client.  If detected, we implement a set of
cover functions that abstract the read/write/writev functions,
in a fashion similar to the SASL implementation.

This includes a limited implementation of the WebSocket protocol,
sufficient for our purposes.

Signed-off-by: Jeremy White <jwhite@codeweavers.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-06-26 14:18:27 +01:00
Frediano Ziglio
148203a5d2 spice-experimental: Remove obsolete file
This header was removed in 2014 (3c6b4e415) as deprecated and added again
in 2015 (2e88eb705) as causing some issue with former Qemu versions.
After 4 years remove again, now there should not be any usage of it.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Snir Sheriber <ssheribe@redhat.com>
2019-05-20 10:11:41 +01:00
Frediano Ziglio
55dd7410b0 sys-socket: Introduce some utility to make sockets more portable
Between Unix and Windows socket are quite different:
- on Windows sockets have a different namespace from C file
  descriptors so you can't use read/write/close or similar functions;
- errors are not stored in errno but you must be read/write the
  errors with specific function;
- sometimes sockets are put in non-blocking mode automatically
  calling some functions;
- SOCKET type is 64 bit on Windows 64 which does not fit technically
  in an int. Is however safe to assume them to fit in an int.

So encapsulate the socket APIs in some definition to make easier
and more safe to deal with them.
Where the portability to Windows would make to code more offuscated a Unix
style was preferred. For instance if errors are detected errno is set from
Windows socket error instead of changing all code handling.
Fortunately on Windows Qemu core interface accepts socket (but not
other types like C file descriptors!).

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2019-05-07 10:14:00 +01:00
Frediano Ziglio
c4e26a54d0 Use new common demarshallers.h
Avoids mismatching duplicate declarations causing potentially
ABI incompatibilities.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-10-15 13:39:10 +01:00
Eduardo Lima (Etrunko)
495d1612c4 Add support for building with meson/ninja
In a comparison with current autotools build system, meson/ninja
provides a huge improvement in build speed, while keeping the same
functionalities currently available and being considered more user
friendly.

The new system coexists within the same repository with the current one,
so we can do more extensive testing of its functionality before deciding
if the old system can be removed, or for some reason, has to stay for
good.

- Meson: https://mesonbuild.com

  This is the equivalent of autogen/configure step in autotools. It
  generates the files that will be used by ninja to actually build the
  source code.

  The project has received lots of traction recently, with many GNOME
  projects willing to move to this new build system. The following wiki
  page has more details of the status of the many projects being ported:

    https://wiki.gnome.org/Initiatives/GnomeGoals/MesonPorting

  Meson has a python-like syntax, easy to read, and the documentation
  on the project is very complete, with a dedicated page on how to port
  from autotools, explaining how most common use cases can be
  implemented using meson.

    http://mesonbuild.com/Porting-from-autotools.html

  Other important sources of information:

    http://mesonbuild.com/howtox.html
    http://mesonbuild.com/Syntax.html
    http://mesonbuild.com/Reference-manual.html

- Ninja: https://ninja-build.org

  Ninja is the equivalent of make in an autotools setup, which actually
  builds the source code. It has being used by large and complex
  projects such as Google Chrome, Android and LLVM. There is not much to
  say about ninja (other than it is much faster than make) because we
  won't interact directly with it as much, as meson does the middle man
  job here. The reasoning for creating ninja in the first place is
  explained on the following post:

    http://neugierig.org/software/chromium/notes/2011/02/ninja.html

  Also its manual provides more in-depth information about the design
  principles:

    https://ninja-build.org/manual.html

- Basic workflow:

  Meson package is available for most if not all distros, so, taking
  Fedora as an example, we only need to run:

    # dnf -y install meson ninja-build.

  With Meson, building in-tree is not possible at all, so we need to
  pass a directory as argument to meson where we want the build to be
  done. This has the advantage of creating builds with different options
  under the same parent directory, e.g.:

    $ meson ./build --prefix=/usr
    $ meson ./build-extra -Dextra-checks=true -Dalignment-checks=true

  After configuration is done, we call ninja to actually do the build.

    $ ninja -C ./build
    $ ninja -C ./build install

  Ninja defaults to parallel builds, and this can be changed with the -j
  flag.

    $ ninja -j 10 -C ./build

- Hacking:

  * meson.build: Mandatory for the project root and usually found under
                 each directory you want something to be built.

  * meson_options.txt: Options that can interfere with the result of the
                       build.

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2018-08-30 11:10:45 -03:00
Eduardo Lima (Etrunko)
b0e141b387 build: Move spice-common to subprojects/ directory
The reason for this commit is that Meson expects all submodules to be
placed in this subdirectory, and since autotools build is more flexible
in this case, we make some small adjustments to configure.ac and
Makefile.am files to accommodate for this change.

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-07-23 14:49:19 -03:00
Eduardo Lima (Etrunko)
a4d40532da Rename stream-device.[ch] to red-stream-device.[ch]
In order to avoid confusion with file named stream-device.h, from
spice-protocol.

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-03-13 10:53:05 +00:00
Frediano Ziglio
6bd9a486a9 stream-device: Separate declaration in a separate header
Move public declaration (stream_device_connect) from char-device.h
to a new stream-device.h.
Add type declaration for StreamDevice.
This allows to use the type outside the implementation file and makes it
easier to extend the interface without changing char-device.h header.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-03-08 10:58:46 +00:00
Eduardo Lima (Etrunko)
dafc941c76 build: Rename spice-server-enums.tmpl.[ch] to spice-server-enums.[ch].tmpl
This is a preparation for meson build, which has built-in support for
generating enums, but requires the template files to be renamed. It uses
the basename of template files to generate the output, and in this case
it would be the same file for both '.c' and '.h'. Ideally meson would
let us specify the name of the output files, but this is not the case.

Without renaming, the following error happens:

Meson encountered an error in file server/meson.build, line 30, column 0:
Tried to create target "spice-server-enums.tmpl", but a target of that
name already exists.

Reference: http://mesonbuild.com/Gnome-module.html#gnomemkenums

Note that by the time of this commit, the documentation is not accurate
and does not mention the fact that output files will get the base name
of the template files if they are specified, I submitted a pull request
to meson fixing this detail in docs:

   https://github.com/mesonbuild/meson/pull/3191

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-03-07 10:04:04 -03:00
Christophe Fergeau
1170282cec build: Use $(srcdir) when it makes sense
There are a few places which use $(top_srcdir) when $(srcdir) would be
equally valid.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-12-08 14:30:51 +01:00
Christophe Fergeau
c9b9a5fd35 build: Rebuild shared library when symbol file changes
At the moment, changing spice-server.syms to add/remove a new symbol to
be exported does not regenerate spice-server.so. This commit added the
needed dependency for this to work.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-12-08 14:30:45 +01:00
Jonathon Jongsma
2e08354ce1 Rename Stream to VideoStream
To prevent confusion between Stream (a video stream) and RedStream (a
generic data stream between client and server), change the name to
VideoStream to be more explicit about what it is.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-11-30 11:51:09 -06:00
Jonathon Jongsma
a5aa2a2261 Use standard "Red" namespace
The objects RedsStream and RedsSASL are currently using the namespace
"Reds" rather than the standard "Red" namespace used throughout the rest
of the project. Change these to be consistent. This also means changing
method names and some related enumeration types.

The files were also renamed to reflect the change:
  reds-stream.[ch] -> red-stream.[ch]

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-10-21 08:47:02 +01:00
Frediano Ziglio
efcb765d0a stream-channel: Write a base channel to implement the streaming
Currently only compile, not used and not much sense

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-10-16 19:59:14 +01:00
Frediano Ziglio
a0c184e89b stream-device: Add device to handle streaming
Add a stub device in guest.
The aim of this device is to make it possible for the guest to send a
stream through a DisplayChannel (in the sense of protocol channel).
This stub allows the guest to send some data and you can see some debug
lines of data arrived on host logs.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-10-16 19:59:14 +01:00
Frediano Ziglio
14aee7cd74 gstreamer: Check if ORC library can work
ORC library is used internally by GStreamer to generate code
dynamically.
If ORC cannot allocate executable memory, the failure causes
an abort(3) to be called.
This happens on some SELinux configurations that disable executable
memory allocation (execmem boolean).
Check that ORC could work before attempting to use GStreamer to
avoid crashes.
While this check is done, the ORC library outputs an error which will
be well visible in Qemu output.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-08-30 15:59:46 +01:00
Christophe Fergeau
ecf05ed6be reds-stream: Introduce reds_stream_set_no_delay() helper
The code to enable/disable on a TCP socket is duplicated in multiple
places in the code base, this commit replaces this duplicated code with
a helper in RedsStream.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-03-31 12:22:36 +02:00
Christophe Fergeau
0457d00f75 build-sys: Alphabetically order source file list
The list of source files to build was in a random order, this commit
orders them alphabetically.
2017-03-27 10:37:31 +02:00
Christophe Fergeau
68bc284b52 build-sys: Update to latest ax_valgrind_check.m4
This allows to remove a small hack in server/Makefile.am where we were
using make check-valgrind-memcheck rather than make check-valgrind to
make sure we get a non-0 exit code on failures.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-03-22 09:34:40 +00:00
Christophe Fergeau
844544f8be build-sys: Add make check-valgrind target
This allows to run automatically our test-suite with valgrind to test
for memory leaks.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-03-21 16:34:56 +01:00
Frediano Ziglio
a0c32918a2 build: Fix some indentation issue on Makefile.am
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-03-17 10:53:08 +00:00
Frediano Ziglio
89a722ce03 red-channel: Separate RedChannelCapabilities
Add function to initialize and destroy this type.
Add GType type for boxing it.
These changes a in preparation for next patch.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-03-02 15:32:16 +00:00
Christophe Fergeau
65501eb13c rcc: Remove red-channel-client-private.h
Nothing outside of RedChannelClient needs access to data contained in
RedChannelClientPrivate, so we can move all the type definitions to the
.c file to make it fully opaque rather than relying on a private header.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-02-15 08:47:52 +01:00
Snir Sheriber
c9987b0fd5 autotools: Add automake conditional for gstreamer
Adding conditional for having gstreamer_0_10 or gstreamer_1_0,
removing the previous conditionals and update relevant ifdefs
with the newly defined conditional
2017-02-03 09:08:55 +01:00
Christophe Fergeau
d8dc09b817 sound: Convert SndChannelClient to RedChannelClient
Now that SndChannelClient has switched from using its own code for
sending data to using RedChannelClient, it's very close to being an
actual RedChannelClient.
This commit makes it directly inherit from RedChannelClient rather than
having a channel_client field. This allows to get rid of the whole
DummyChannel/DummyChannelClient code.

Based on a patch from Frediano Ziglio <fziglio@redhat.com>

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2017-02-02 16:31:05 +01:00
Christophe Fergeau
e4ddd19180 sound: Remove dummy-channel.[ch]
This is no longer used since "sound: Convert SndChannel to GObject"

Based on a patch from Frediano Ziglio <fziglio@redhat.com>

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-01-11 14:21:16 +00:00
Jonathon Jongsma
a7829c9609 Fix build when builddir != srcdir
The following build error occurs when building outside of the source
directory:

glib-mkenums --template spice-server-enums.tmpl.c ../../server/spice-server.h > spice-server-enums.c
Can't open spice-server-enums.tmpl.c: No such file or directory
Makefile:1111: recipe for target 'spice-server-enums.c' failed

Make/Automake uses VPATH to determine that the spice-server-enums.tmpl.c
file listed in the prerequisites for the rule is located in the srcdir.
When we use an automatic variable (e.g. $<), the full path to the
resolved file is used. But when we use the literal filename directly
within the rule definition, this won't happen. So we need to explicitly
specify that the input template file is located in srcdir.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-16 10:47:26 -06:00
Frediano Ziglio
f9ccabfaea Separate code to manage statistic file
Code is quite independent so move in separate file.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-11-16 16:38:13 +00:00
Frediano Ziglio
eb02c0653d syntax-check: Use templates for glib-mkenums
Syntax checker complained about autoconf variable expansion used
inside Makefile.am.
This patch uses template files instead of options.
This also reduces quoting making template code more readable.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-11-14 17:45:32 +00:00
Frediano Ziglio
5902960d39 Make red-replay-qxl.h a public header
The functions declared in that header are all exported by the
library.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-11-10 06:37:15 +00:00
Jonathon Jongsma
bc8d967e67 Move RedClient to a separate file
Also move the RedClient struct out of the header to avoid accessing the
internals from other files.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-02 19:30:58 +00:00
Pavel Grunt
5fba8dd1a3 Do not enable statistic by default
It is more a feature for developers, not force them.

Signed-off-by: Pavel Grunt <pgrunt@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-01 11:36:33 +00:00
Pavel Grunt
840040b51e Add missing header to Makefile.am
Fix make distcheck

Signed-off-by: Pavel Grunt <pgrunt@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-10-26 07:47:44 +01:00